diff --git a/link.install b/link.install
index fdfc5d1..8b3dc4f 100644
--- a/link.install
+++ b/link.install
@@ -102,7 +102,7 @@ function link_update_7001() {
       $update_instance = FALSE;
       foreach ($instance_data['display'] as $display_name => $display_data) {
         if ($display_data['type'] && (0 !== strpos($display_data['type'], 'link_'))) {
-          $instance_data['display'][$display_name]['type'] = 'link_'. $display_data['type'];
+          $instance_data['display'][$display_name]['type'] = 'link_' . $display_data['type'];
           $update_instance = TRUE;
         }
       }
diff --git a/link.migrate.inc b/link.migrate.inc
index b96c33c..1b5f9fc 100644
--- a/link.migrate.inc
+++ b/link.migrate.inc
@@ -35,13 +35,13 @@ class MigrateLinkFieldHandler extends MigrateFieldHandler {
 
     $language = $this->getFieldLanguage($entity, $field_info, $arguments);
 
-    foreach($values as $delta => $value) {
+    foreach ($values as $delta => $value) {
       $item = array();
       if (isset($arguments['title'])) {
         if (!is_array($arguments['title'])) {
           $item['title'] = $arguments['title'];
         }
-        else if (isset($arguments['title'][$delta])) {
+        elseif (isset($arguments['title'][$delta])) {
           $item['title'] = $arguments['title'][$delta];
         }
       }
diff --git a/link.module b/link.module
index 16a5fad..385b07e 100644
--- a/link.module
+++ b/link.module
@@ -69,7 +69,7 @@ function link_field_instance_settings_form($field, $instance) {
   $form = array(
     '#element_validate' => array('link_field_settings_form_validate'),
   );
-  
+
   $form['validate_url'] = array(
     '#type' => 'checkbox',
     '#title' => t('Validate URL'),
@@ -148,6 +148,7 @@ function link_field_instance_settings_form($field, $instance) {
   $form['display'] = array(
     '#tree' => TRUE,
   );
+
   $form['display']['url_cutoff'] = array(
     '#type' => 'textfield',
     '#title' => t('URL Display Cutoff'),
@@ -166,12 +167,14 @@ function link_field_instance_settings_form($field, $instance) {
   $form['attributes'] = array(
     '#tree' => TRUE,
   );
+
   $form['attributes']['target'] = array(
     '#type' => 'radios',
     '#title' => t('Link Target'),
     '#default_value' => empty($instance['settings']['attributes']['target']) ? LINK_TARGET_DEFAULT : $instance['settings']['attributes']['target'],
     '#options' => $target_options,
   );
+
   $form['attributes']['rel'] = array(
     '#type' => 'textfield',
     '#title' => t('Rel Attribute'),
@@ -181,17 +184,20 @@ function link_field_instance_settings_form($field, $instance) {
     '#field_suffix' => '"',
     '#size' => 20,
   );
+
   $form['attributes']['class'] = array(
     '#type' => 'textfield',
     '#title' => t('Additional CSS Class'),
     '#description' => t('When output, this link will have this class attribute. Multiple classes should be separated by spaces.'),
     '#default_value' => empty($instance['settings']['attributes']['class']) ? '' : $instance['settings']['attributes']['class'],
   );
+
   $form['attributes']['configurable_title'] = array(
     '#title' => t("Allow the user to enter a link 'title' attribute"),
     '#type' => 'checkbox',
     '#default_value' => empty($instance['settings']['attributes']['configurable_title']) ? '' : $instance['settings']['attributes']['configurable_title'],
   );
+
   $form['attributes']['title'] = array(
     '#title' => t("Default link 'title' Attribute"),
     '#type' => 'textfield',
@@ -201,6 +207,7 @@ function link_field_instance_settings_form($field, $instance) {
     '#field_suffix' => '"',
     '#size' => 20,
   );
+
   return $form;
 }
 
@@ -218,12 +225,13 @@ function link_field_settings_form_validate($element, &$form_state, $complete_for
   }
   if (empty($form_state['values']['instance']['settings']['title_maxlength'])) {     // patch #1307788 from nmc
     form_set_value($element['title_maxlength'], '128', $form_state);
-  } elseif (!is_numeric($form_state['values']['instance']['settings']['title_maxlength'])) {
+  }
+  elseif (!is_numeric($form_state['values']['instance']['settings']['title_maxlength'])) {
     form_set_error('title_maxlength', t('The max length of the link title must be numeric.'));
-  } elseif ($form_state['values']['instance']['settings']['title_maxlength'] > 255) {
+  }
+  elseif ($form_state['values']['instance']['settings']['title_maxlength'] > 255) {
     form_set_error('title_maxlength', t('The max length of the link title cannot be greater than 255 characters.'));
   }
-
 }
 
 /**
@@ -256,7 +264,7 @@ function link_field_validate($entity_type, $entity, $field, $instance, $langcode
   }
 
   if ($instance['settings']['url'] === 'optional' && $instance['settings']['title'] === 'optional' && $instance['required'] && !$optional_field_found) {
-    form_set_error($field['field_name'] .'][0][title', t('At least one title or URL must be entered.'));
+    form_set_error($field['field_name'] . '][0][title', t('At least one title or URL must be entered.'));
   }
 }
 
@@ -308,13 +316,10 @@ function link_field_widget_form(&$form, &$form_state, $field, $instance, $langco
  * Unpacks the item attributes for use.
  */
 function _link_load($field, $item, $instance) {
-  /*return $item['attributes'] = isset($item['attributes']) ?
-                                unserialize($item['attributes']) :
-                                $instance['settings']['attributes'];*/
   if (isset($item['attributes'])) {
     return unserialize($item['attributes']);
   }
-  else if (isset($instance['settings']['attributes'])) {
+  elseif (isset($instance['settings']['attributes'])) {
     return $instance['settings']['attributes'];
   }
   else {
@@ -358,23 +363,23 @@ function _link_validate(&$item, $delta, $field, $node, $instance, &$optional_fie
       && !$instance['required'])) {
     // Validate the link.
     if (link_validate_url(trim($item['url'])) == FALSE) {
-      form_set_error($field['field_name'] .']['. $delta .'][url', t('Not a valid URL.'));
+      form_set_error($field['field_name'] . '][' . $delta . '][url', t('Not a valid URL.'));
     }
     // Require a title for the link if necessary.
-    if ($instance['settings']['title'] == 'required' && strlen(trim($item['title'])) == 0) {
-      form_set_error($field['field_name'] .']['. $delta .'][title', t('Titles are required for all links.'));
+    if ($instance['settings']['title'] == 'required' && drupal_strlen(trim($item['title'])) == 0) {
+      form_set_error($field['field_name'] . '][' . $delta . '][title', t('Titles are required for all links.'));
     }
   }
   // Require a link if we have a title.
   if ($instance['settings']['url'] !== 'optional'
-      && strlen(isset($item['title']) ? $item['title'] : NULL) > 0
-      && strlen(trim($item['url'])) == 0) {
-    form_set_error($field['field_name'] .']['. $delta .'][url', t('You cannot enter a title without a link url.'));
+      && drupla_strlen(isset($item['title']) ? $item['title'] : NULL) > 0
+      && drupla_strlen(trim($item['url'])) == 0) {
+    form_set_error($field['field_name'] . '][' . $delta . '][url', t('You cannot enter a title without a link url.'));
   }
   // In a totally bizzaro case, where URLs and titles are optional but the field is required, ensure there is at least one link.
   if ($instance['settings']['url'] === 'optional'
       && $instance['settings']['title'] === 'optional'
-      && (strlen(trim($item['url'])) !== 0 || strlen(trim($item['title'])) !== 0)) {
+      && (drupal_strlen(trim($item['url'])) !== 0 || drupal_strlen(trim($item['title'])) !== 0)) {
     $optional_field_found = TRUE;
   }
   // Require entire field
@@ -383,8 +388,7 @@ function _link_validate(&$item, $delta, $field, $node, $instance, &$optional_fie
     && $instance['required'] == 1
     && !$optional_field_found
     && isset($instance['id'])) {
-    form_set_error($instance['field_name'] .'][0][title',
-                   t('At least one title or URL must be entered.'));
+    form_set_error($instance['field_name'] . '][0][title', t('At least one title or URL must be entered.'));
   }
 }
 
@@ -424,15 +428,15 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$node) {
 
   // Separate out the anchor if any.
   if (strpos($url, '#') !== FALSE) {
-    $item['fragment'] = substr($url, strpos($url, '#') + 1);
-    $url = substr($url, 0, strpos($url, '#'));
+    $item['fragment'] = drupal_substr($url, strpos($url, '#') + 1);
+    $url = drupal_substr($url, 0, strpos($url, '#'));
   }
   // Separate out the query string if any.
   if (strpos($url, '?') !== FALSE) {
-    $query = substr($url, strpos($url, '?') + 1);
+    $query = drupal_substr($url, strpos($url, '?') + 1);
     parse_str($query, $query_array);
     $item['query'] = $query_array;
-    $url = substr($url, 0, strpos($url, '?'));
+    $url = drupal_substr($url, 0, strpos($url, '?'));
   }
 
   $item['url'] = check_plain($url);
@@ -447,17 +451,17 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$node) {
                                                 $item['fragment'] :
                                                 NULL,
                                   'absolute' => TRUE));
-  if ($instance['settings']['display']['url_cutoff'] && strlen($display_url) > $instance['settings']['display']['url_cutoff']) {
-    $display_url = substr($display_url, 0, $instance['settings']['display']['url_cutoff']) ."...";
+  if ($instance['settings']['display']['url_cutoff'] && drupal_strlen($display_url) > $instance['settings']['display']['url_cutoff']) {
+    $display_url = drupal_substr($display_url, 0, $instance['settings']['display']['url_cutoff']) . "...";
   }
   $item['display_url'] = $display_url;
 
   // Use the title defined at the instance level.
-  if ($instance['settings']['title'] == 'value' && strlen(trim($instance['settings']['title_value']))) {
+  if ($instance['settings']['title'] == 'value' && drupal_strlen(trim($instance['settings']['title_value']))) {
     $title = $instance['settings']['title_value'];
   }
   // Use the title defined by the user at the widget level.
-  else if (isset($item['title'])) {
+  elseif (isset($item['title'])) {
     $title = $item['title'];
   }
   else {
@@ -468,8 +472,7 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$node) {
   if ($title && ($instance['settings']['title'] == 'value' || $instance['settings']['enable_tokens'])) {
     // Load the node if necessary for nodes in views.
     $token_node = isset($node->nid) ? node_load($node->nid) : $node;
-    $title = filter_xss(token_replace($title, array('node' => $token_node)),
-                        array('b', 'br', 'code', 'em', 'i', 'img', 'span', 'strong', 'sub', 'sup', 'tt', 'u'));
+    $title = filter_xss(token_replace($title, array('node' => $token_node)), array('b', 'br', 'code', 'em', 'i', 'img', 'span', 'strong', 'sub', 'sup', 'tt', 'u'));
     $item['html'] = TRUE;
   }
   $item['title'] = empty($title) ? $item['display_url'] : $title;
@@ -484,7 +487,7 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$node) {
   }
 
   // Add default attributes.
-  if (!is_array($instance['settings']['attributes'])){
+  if (!is_array($instance['settings']['attributes'])) {
     $instance['settings']['attributes'] = _link_default_attributes();
   }
   else {
@@ -528,7 +531,7 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$node) {
 
   // Sets title to trimmed url if one exists
   // @TODO: Do we need this?  It seems not.
-  /*if(!empty($item['display_url']) && empty($item['title'])) {
+  /* if(!empty($item['display_url']) && empty($item['title'])) {
     $item['title'] = $item['display_url'];
   }
   elseif(!isset($item['title'])) {
@@ -542,7 +545,7 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$node) {
  */
 function link_theme() {
   return array(
-    /*'link_field_settings' => array(
+    /* 'link_field_settings' => array(
       'variables' => array('element' => NULL),
     ),*/
     'link_formatter_link_default' => array(
@@ -576,7 +579,7 @@ function link_theme() {
  * FAPI theme for an individual text elements.
  */
 function theme_link_field($vars) {
-  drupal_add_css(drupal_get_path('module', 'link') .'/link.css');
+  drupal_add_css(drupal_get_path('module', 'link') . '/link.css');
 
   $element = $vars['element'];
   // Prefix single value link fields with the name of the field.
@@ -589,15 +592,15 @@ function theme_link_field($vars) {
   $output = '';
   $output .= '<div class="link-field-subrow clearfix">';
   if (isset($element['title'])) {
-    $output .= '<div class="link-field-title link-field-column">'. drupal_render($element['title']) .'</div>';
+    $output .= '<div class="link-field-title link-field-column">' . drupal_render($element['title']) . '</div>';
   }
-  $output .= '<div class="link-field-url'. (isset($element['title']) ? ' link-field-column' : '') .'">'. drupal_render($element['url']) .'</div>';
+  $output .= '<div class="link-field-url' . (isset($element['title']) ? ' link-field-column' : '') . '">' . drupal_render($element['url']) . '</div>';
   $output .= '</div>';
   if (!empty($element['attributes']['target'])) {
-    $output .= '<div class="link-attributes">'. drupal_render($element['attributes']['target']) .'</div>';
+    $output .= '<div class="link-attributes">' . drupal_render($element['attributes']['target']) . '</div>';
   }
   if (!empty($element['attributes']['title'])) {
-    $output .= '<div class="link-attributes">'. drupal_render($element['attributes']['title']) .'</div>';
+    $output .= '<div class="link-attributes">' . drupal_render($element['attributes']['title']) . '</div>';
   }
   return $output;
 }
@@ -647,7 +650,7 @@ function link_field_process($element, $form_state, $complete_form) {
       '#type' => 'textfield',
       '#maxlength' => $settings['title_maxlength'],  // patch #1307788 from nmc
       '#title' => t('Title'),
-      '#description' => t('The link title is limited to '.$settings['title_maxlength'].' characters maximum.'), // patch #1307788 from nmc
+      '#description' => t('The link title is limited to ' . $settings['title_maxlength'] . ' characters maximum.'), // patch #1307788 from nmc
       '#required' => ($settings['title'] == 'required' && (($element['#delta'] == 0 && $element['#required']) || !empty($element['#value']['url']))) ? TRUE : FALSE, // davereids patch from jan 2011
       '#default_value' => isset($element['#value']['title']) ? $element['#value']['title'] : NULL,
     );
@@ -686,7 +689,7 @@ function link_field_process($element, $form_state, $complete_form) {
 }
 
 /**
- * Implementation of hook_field_formatter_info().
+ * Implements hook_field_formatter_info().
  */
 function link_field_formatter_info() {
   return array(
@@ -735,7 +738,7 @@ function link_field_formatter_view($entity_type, $entity, $field, $instance, $la
   $elements = array();
   foreach ($items as $delta => $item) {
     $elements[$delta] = array(
-      '#markup' => theme('link_formatter_'. $display['type'], array('element' => $item, 'field' => $instance)),
+      '#markup' => theme('link_formatter_' . $display['type'], array('element' => $item, 'field' => $instance)),
     );
   }
   return $elements;
@@ -748,12 +751,12 @@ function theme_link_formatter_link_default($vars) {
   $link_options = $vars['element'];
   unset($link_options['element']['title']);
   unset($link_options['element']['url']);
-  
+
   // Issue #1199806 by ss81: Fixes fatal error when the link URl is equal to page URL
   if (isset($link_options['attributes']['class'])) {
     $link_options['attributes']['class'] = array($link_options['attributes']['class']);
   }
-  
+
   // Display a normal link if both title and URL are available.
   if (!empty($vars['element']['title']) && !empty($vars['element']['url'])) {
     return l($vars['element']['title'], $vars['element']['url'], $link_options);
@@ -821,23 +824,23 @@ function theme_link_formatter_link_label($vars) {
  */
 
 function theme_link_formatter_link_separate($vars) {
-  $class = empty($vars['element']['attributes']['class']) ? '' : ' '. $vars['element']['attributes']['class'];
+  $class = empty($vars['element']['attributes']['class']) ? '' : ' ' . $vars['element']['attributes']['class'];
   unset($vars['element']['attributes']['class']);
   $link_options = $vars['element'];
   unset($link_options['element']['title']);
   unset($link_options['element']['url']);
   $title = empty($vars['element']['title']) ? '' : check_plain($vars['element']['title']);
-  
-  /** 
+
+  /**
    * @TODO static html markup looks not very elegant to me (who takes it off?)
-   * needs smarter output solution and an optional title/url seperator (digidog) 
+   * needs smarter output solution and an optional title/url seperator (digidog)
    */
   $output = '';
-  $output .= '<div class="link-item '. $class .'">';
+  $output .= '<div class="link-item ' . $class . '">';
   if (!empty($title)) {
-    $output .= '<div class="link-title">'. $title .'</div>';
+    $output .= '<div class="link-title">' . $title . '</div>';
   }
-  $output .= '<div class="link-url">'. l($vars['element']['url'], $vars['element']['url'], $link_options) .'</div>';
+  $output .= '<div class="link-url">' . l($vars['element']['url'], $vars['element']['url'], $link_options) . '</div>';
   $output .= '</div>';
   return $output;
 }
@@ -873,7 +876,7 @@ function link_token_values($type, $object = NULL) {
 function link_views_api() {
   return array(
     'api' => 2,
-    'path' => drupal_get_path('module', 'link') .'/views',
+    'path' => drupal_get_path('module', 'link') . '/views',
   );
 }
 
@@ -897,12 +900,12 @@ function link_cleanup_url($url, $protocol = "http") {
 
   if ($type === LINK_EXTERNAL) {
     // Check if there is no protocol specified.
-    $protocol_match = preg_match("/^([a-z0-9][a-z0-9\.\-_]*:\/\/)/i", $url);
+    $protocol_match = preg_match('/^([a-z0-9][a-z0-9\.\-_]*:\/\/)/i', $url);
     if (empty($protocol_match)) {
       // But should there be? Add an automatic http:// if it starts with a domain name.
-      $domain_match = preg_match('/^(([a-z0-9]([a-z0-9\-_]*\.)+)('. LINK_DOMAINS .'|[a-z]{2}))/i', $url);
+      $domain_match = preg_match('/^(([a-z0-9]([a-z0-9\-_]*\.)+)(' . LINK_DOMAINS . '|[a-z]{2}))/i', $url);
       if (!empty($domain_match)) {
-        $url = $protocol ."://". $url;
+        $url = $protocol . '://' . $url;
       }
     }
   }
@@ -955,8 +958,8 @@ function link_validate_url($text) {
     "&#x00D6;", // Ö
     "&#x00D4;", // Ô
     "&#x00F4;", // ô
-    "&#x00D5;",	// Õ
-    "&#x00F5;",	// õ
+    "&#x00D5;", // Õ
+    "&#x00F5;", // õ
     "&#x0152;", // Œ
     "&#x0153;", // œ
     "&#x00FC;", // ü
@@ -966,7 +969,7 @@ function link_validate_url($text) {
     "&#x00DB;", // Û
     "&#x00FB;", // û
     "&#x0178;", // Ÿ
-    "&#x00FF;", // ÿ 
+    "&#x00FF;", // ÿ
     "&#x00D1;", // Ñ
     "&#x00F1;", // ñ
     "&#x00FE;", // þ
@@ -982,34 +985,34 @@ function link_validate_url($text) {
   $allowed_protocols = variable_get('filter_allowed_protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal'));
 
   // Starting a parenthesis group with (?: means that it is grouped, but is not captured
-  $protocol = '((?:'. implode("|", $allowed_protocols) .'):\/\/)';
-  $authentication = "(?:(?:(?:[\w\.\-\+!$&'\(\)*\+,;=" . $LINK_ICHARS . "]|%[0-9a-f]{2})+(?::(?:[\w". $LINK_ICHARS ."\.\-\+%!$&'\(\)*\+,;=]|%[0-9a-f]{2})*)?)?@)";
-  $domain = '(?:(?:[a-z0-9' . $LINK_ICHARS_DOMAIN . ']([a-z0-9'. $LINK_ICHARS_DOMAIN . '\-_\[\]])*)(\.(([a-z0-9' . $LINK_ICHARS_DOMAIN . '\-_\[\]])+\.)*('. LINK_DOMAINS .'|[a-z]{2}))?)';
+  $protocol = '((?:' . implode("|", $allowed_protocols) . '):\/\/)';
+  $authentication = "(?:(?:(?:[\w\.\-\+!$&'\(\)*\+,;=" . $LINK_ICHARS . "]|%[0-9a-f]{2})+(?::(?:[\w" . $LINK_ICHARS . "\.\-\+%!$&'\(\)*\+,;=]|%[0-9a-f]{2})*)?)?@)";
+  $domain = '(?:(?:[a-z0-9' . $LINK_ICHARS_DOMAIN . ']([a-z0-9' . $LINK_ICHARS_DOMAIN . '\-_\[\]])*)(\.(([a-z0-9' . $LINK_ICHARS_DOMAIN . '\-_\[\]])+\.)*(' . LINK_DOMAINS . '|[a-z]{2}))?)';
   $ipv4 = '(?:[0-9]{1,3}(\.[0-9]{1,3}){3})';
   $ipv6 = '(?:[0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7})';
   $port = '(?::([0-9]{1,5}))';
 
   // Pattern specific to external links.
-  $external_pattern = '/^'. $protocol .'?'. $authentication .'?('. $domain .'|'. $ipv4 .'|'. $ipv6 .' |localhost)'. $port .'?';
+  $external_pattern = '/^' . $protocol . '?' . $authentication . '?(' . $domain . '|' . $ipv4 . '|' . $ipv6 . ' |localhost)' . $port . '?';
 
   // Pattern specific to internal links.
-  $internal_pattern = "/^(?:[a-z0-9". $LINK_ICHARS ."_\-+\[\]]+)";
-  $internal_pattern_file = "/^(?:[a-z0-9". $LINK_ICHARS ."_\-+\[\]\.]+)$/i";
+  $internal_pattern = '/^(?:[a-z0-9' . $LINK_ICHARS . '_\-+\[\]]+)';
+  $internal_pattern_file = '/^(?:[a-z0-9' . $LINK_ICHARS . '_\-+\[\]\.]+)$/i';
 
-  $directories = "(?:\/[a-z0-9". $LINK_ICHARS ."_\-\.~+%=&,$'#!():;*@\[\]]*)*";
+  $directories = '(?:\/[a-z0-9' . $LINK_ICHARS . "_\-\.~+%=&,$'#!():;*@\[\]]*)*";
   // Yes, four backslashes == a single backslash.
-  $query = "(?:\/?\?([?a-z0-9". $LINK_ICHARS ."+_|\-\.~\/\\\\%=&,$'():;*@\[\]{} ]*))";
-  $anchor = "(?:#[a-z0-9". $LINK_ICHARS ."_\-\.~+%=&,$'():;*@\[\]\/\?]*)";
+  $query = "(?:\/?\?([?a-z0-9" . $LINK_ICHARS . "+_|\-\.~\/\\\\%=&,$'():;*@\[\]{} ]*))";
+  $anchor = "(?:#[a-z0-9" . $LINK_ICHARS . "_\-\.~+%=&,$'():;*@\[\]\/\?]*)";
 
   // The rest of the path for a standard URL.
-  $end = $directories .'?'. $query .'?'. $anchor .'?'.'$/i';
+  $end = $directories . '?' . $query . '?' . $anchor . '?' . '$/i';
 
-  $message_id = '[^@].*@'. $domain;
+  $message_id = '[^@].*@' . $domain;
   $newsgroup_name = '(?:[0-9a-z+-]*\.)*[0-9a-z+-]*';
-  $news_pattern = '/^news:('. $newsgroup_name .'|'. $message_id .')$/i';
+  $news_pattern = '/^news:(' . $newsgroup_name . '|' . $message_id . ')$/i';
 
-  $user = '[a-zA-Z0-9'. $LINK_ICHARS .'_\-\.\+\^!#\$%&*+\/\=\?\`\|\{\}~\'\[\]]+';
-  $email_pattern = '/^mailto:'. $user .'@'.'(?:'. $domain .'|'. $ipv4 .'|'. $ipv6 .'|localhost)'. $query .'?$/';
+  $user = '[a-zA-Z0-9' . $LINK_ICHARS . '_\-\.\+\^!#\$%&*+\/\=\?\`\|\{\}~\'\[\]]+';
+  $email_pattern = '/^mailto:' . $user . '@' . '(?:' . $domain . '|' . $ipv4 . '|' . $ipv6 . '|localhost)' . $query . '?$/';
 
   if (strpos($text, '<front>') === 0) {
     return LINK_FRONT;
@@ -1064,7 +1067,7 @@ function link_field_settings_form() {
 
 /**
  * Additional callback to adapt the property info of link fields.
- * @see entity_metadata_field_entity_property_info().
+ * @see entity_metadata_field_entity_property_info()
  */
 function link_field_property_info_callback(&$info, $entity_type, $field, $instance, $field_type) {
   $property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$field['field_name']];
@@ -1074,7 +1077,7 @@ function link_field_property_info_callback(&$info, $entity_type, $field, $instan
   $property['setter callback'] = 'entity_metadata_field_verbatim_set';
 
   // Auto-create the field item as soon as a property is set.
- $property['auto creation'] = 'link_field_item_create';
+  $property['auto creation'] = 'link_field_item_create';
 
   $property['property info'] = link_field_item_property_info();
   $property['property info']['url']['required'] = !$instance['settings']['url'];
diff --git a/tests/link.attribute.test b/tests/link.attribute.test
index 398713a..bbeb748 100644
--- a/tests/link.attribute.test
+++ b/tests/link.attribute.test
@@ -48,10 +48,8 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
   private function assertLinkOnNode($field_name, $link_value, $message = '', $group = 'Other') {
     $this->zebra++;
     $zebra_string = ($this->zebra % 2 == 0) ? 'even' : 'odd';
-    $cssFieldLocator = 'field-'. str_replace('_', '-', $field_name);
-    $this->assertPattern('@<div class="field field-type-link '. $cssFieldLocator .'".*<div class="field-item '. $zebra_string .'">\s*'. $link_value .'\s*</div>@is',
-                         $message,
-                         $group);
+    $cssFieldLocator = 'field-' . str_replace('_', '-', $field_name);
+    $this->assertPattern('@<div class="field field-type-link ' . $cssFieldLocator . '".*<div class="field-item ' . $zebra_string . '">\s*' . $link_value . '\s*</div>@is', $message, $group);
   }
 
   /**
@@ -71,7 +69,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     // Create the content type.
     $this->clickLink(t('Add content type'));
 
-    $edit = array (
+    $edit = array(
       'name' => $content_type_friendly,
       'type' => $content_type_machine,
     );
@@ -81,8 +79,8 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     // Now add a singleton field.
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_machine = strtolower($this->randomName(10));
-    $single_field_name = 'field_'. $single_field_name_machine;
-    $edit = array (
+    $single_field_name = 'field_' . $single_field_name_machine;
+    $edit = array(
       'fields[_add_new_field][label]' => $single_field_name_friendly,
       'fields[_add_new_field][field_name]' => $single_field_name_machine,
       'fields[_add_new_field][type]' => 'link_field',
@@ -117,19 +115,19 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->drupalLogin($account);
 
     // Go to page.
-    $this->drupalGet('node/add/'. $content_type_machine);
+    $this->drupalGet('node/add/' . $content_type_machine);
 
     // Add a node.
     $edit = array(
       'title' => $title,
-      'field_'. $single_field_name_machine. '[und][0][title]' => 'Link',
-      'field_'. $single_field_name_machine. '[und][0][url]' => 'http://www.drupal.org/',
+      'field_' . $single_field_name_machine . '[und][0][title]' => 'Link',
+      'field_' . $single_field_name_machine . '[und][0][url]' => 'http://www.drupal.org/',
     );
 
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->assertText(t('@content_type_friendly @title has been created', array('@content_type_friendly' => $content_type_friendly, '@title' => $title)));
 
-    /*$field_settings = array(
+    /* $field_settings = array(
       'type' => 'link',
       'widget_type' => 'link',
       'type_name' => $this->content_types[0]->name,
@@ -153,7 +151,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->assert('debug', print_r($node, TRUE), 'Debug');*/
 
     //$this->drupalGet('node/'. $test_nid .'/edit');
-    $this->drupalGet('node/add/'. $content_type_machine);
+    $this->drupalGet('node/add/' . $content_type_machine);
 
     // lets add a node:
     $edit = array(
@@ -177,7 +175,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     // Create the content type.
     $this->clickLink(t('Add content type'));
 
-    $edit = array (
+    $edit = array(
       'name' => $content_type_friendly,
       'type' => $content_type_machine,
     );
@@ -186,7 +184,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
   }
 
   private function createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine) {
-    $edit = array (
+    $edit = array(
       'fields[_add_new_field][label]' => $single_field_name_friendly,
       'fields[_add_new_field][field_name]' => $single_field_name_machine,
       'fields[_add_new_field][type]' => 'link_field',
@@ -224,7 +222,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
 
   function createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $title, $url, $node_title = '') {
     // Go to page.
-    $this->drupalGet('node/add/'. $content_type_machine);
+    $this->drupalGet('node/add/' . $content_type_machine);
 
     if (!$node_title) {
       $node_title = $this->randomName(20);
@@ -258,10 +256,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
-    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
+    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_plain',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_plain',
     );
     $this->drupalPost(NULL, $edit, t('Save'));
 
@@ -289,10 +287,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
-    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
+    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_plain',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_plain',
     );
     $this->drupalPost(NULL, $edit, t('Save'));
 
@@ -320,10 +318,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
-    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
+    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_plain',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_plain',
     );
     $this->drupalPost(NULL, $edit, t('Save'));
 
@@ -351,10 +349,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
-    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
+    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_url',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_url',
     );
     $this->drupalPost(NULL, $edit, t('Save'));
 
@@ -381,10 +379,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
-    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
+    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_url',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_url',
     );
     $this->drupalPost(NULL, $edit, t('Save'));
 
@@ -411,10 +409,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
-    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
+    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_url',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_url',
     );
     $this->drupalPost(NULL, $edit, t('Save'));
 
@@ -441,10 +439,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
-    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
+    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_short',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_short',
     );
     $this->drupalPost(NULL, $edit, t('Save'));
 
@@ -472,10 +470,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
-    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
+    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_short',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_short',
     );
     $this->drupalPost(NULL, $edit, t('Save'));
 
@@ -503,10 +501,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
-    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
+    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_short',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_short',
     );
     $this->drupalPost(NULL, $edit, t('Save'));
 
@@ -534,10 +532,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
-    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
+    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_label',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_label',
     );
     $this->drupalPost(NULL, $edit, t('Save'));
 
@@ -565,10 +563,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
-    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
+    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_label',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_label',
     );
     $this->drupalPost(NULL, $edit, t('Save'));
 
@@ -596,10 +594,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
-    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
+    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_label',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_label',
     );
     $this->drupalPost(NULL, $edit, t('Save'));
 
@@ -627,10 +625,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
-    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
+    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_separate',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_separate',
     );
     $this->drupalPost(NULL, $edit, t('Save'));
 
@@ -658,10 +656,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
-    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
+    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_separate',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_separate',
     );
     $this->drupalPost(NULL, $edit, t('Save'));
 
@@ -689,10 +687,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
-    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
+    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_separate',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_separate',
     );
     $this->drupalPost(NULL, $edit, t('Save'));
 
@@ -720,10 +718,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
     
     // Okay, now we want to make sure this display is changed:
-    $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
+    $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_title_plain',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_title_plain',
     );
     $this->drupalPost(NULL, $edit, t('Save'));
     
diff --git a/tests/link.crud.test b/tests/link.crud.test
index cdd7fc5..3142892 100644
--- a/tests/link.crud.test
+++ b/tests/link.crud.test
@@ -39,7 +39,7 @@ class LinkContentCrudTest extends DrupalWebTestCase {
     $this->clickLink(t('Add content type'));
 
 
-    $edit = array (
+    $edit = array(
       'name' => $content_type_friendly,
       'type' => $content_type_machine,
     );
@@ -50,7 +50,7 @@ class LinkContentCrudTest extends DrupalWebTestCase {
     // Now add a singleton field.
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_machine = strtolower($this->randomName(10));
-    $edit = array (
+    $edit = array(
       'fields[_add_new_field][label]' => $single_field_name_friendly,
       'fields[_add_new_field][field_name]' => $single_field_name_machine,
       'fields[_add_new_field][type]' => 'link_field',
diff --git a/tests/link.crud_browser.test b/tests/link.crud_browser.test
index 7b01da0..784906a 100644
--- a/tests/link.crud_browser.test
+++ b/tests/link.crud_browser.test
@@ -74,8 +74,8 @@ class LinkUITest extends DrupalWebTestcase {
     //$this->drupalGet('node/add');
     $this->drupalGet('node/add/page');
     $field_name = 'field_' . $name;
-    $this->assertField('edit-field-'. $name .'-und-0-title', 'Title found');
-    $this->assertField('edit-field-'. $name .'-und-0-url', 'URL found');
+    $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found');
+    $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found');
 
     $input_test_cases = array(
       array(
@@ -116,12 +116,12 @@ class LinkUITest extends DrupalWebTestcase {
       ),
     );
     $test_case = array(
-      'href' => 'www.example.com/'. $this->randomName(),
+      'href' => 'www.example.com/' . $this->randomName(),
       'label' => $this->randomName(),
       'msg' => 'Link found',
       'type' => self::LINK_INPUT_TYPE_GOOD,
     );
-    $test_case['expected_href'] = 'http://'. $test_case['href'];
+    $test_case['expected_href'] = 'http://' . $test_case['href'];
     $input_test_cases[] = $test_case;
 
     foreach ($input_test_cases as $input) {
@@ -139,9 +139,7 @@ class LinkUITest extends DrupalWebTestcase {
         continue;
       }
       else {
-        $this->assertRaw(t(' has been created.',
-                           array('@type' => 'Basic Page', '%title' => $edit['title'])),
-                         'Page created: ' . $input['href']);
+        $this->assertRaw(t('has been created.', array('@type' => 'Basic Page', '%title' => $edit['title'])), 'Page created: ' . $input['href']);
       }
       $url = $this->getUrl();
 
@@ -154,10 +152,10 @@ class LinkUITest extends DrupalWebTestcase {
       // us and let us know it's broken.
       $this->assertFalse(libxml_use_internal_errors(TRUE));
       if (isset($input['expected_href'])) {
-        $path = '//a[@href="'. $input['expected_href'] .'" and text()="'. $input['label'] .'"]';
+        $path = '//a[@href="' . $input['expected_href'] . '" and text()="' . $input['label'] . '"]';
       }
       else {
-        $path = '//a[@href="'. $input['href'] .'" and text()="'. $input['label'] .'"]';
+        $path = '//a[@href="' . $input['href'] . '" and text()="' . $input['label'] . '"]';
       }
       //$this->pass(htmlentities($path));
       $elements = $this->xpath($path);
@@ -286,7 +284,7 @@ class LinkUITest extends DrupalWebTestcase {
 
     // create field
     $name = strtolower($this->randomName());
-    $field_name = 'field_'. $name;
+    $field_name = 'field_' . $name;
     $edit = array(
       'fields[_add_new_field][label]' => $name,
       'fields[_add_new_field][field_name]' => $name,
@@ -297,7 +295,7 @@ class LinkUITest extends DrupalWebTestcase {
     $this->drupalPost(NULL, array(), t('Save field settings'));
     $this->drupalPost(NULL, array(
       'instance[settings][title]' => 'value',
-      'instance[settings][title_value]' => '<strong>'. $name .'</strong>'), t('Save settings'));
+      'instance[settings][title_value]' => '<strong>' . $name . '</strong>'), t('Save settings'));
 
     // Is field created?
     $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');
@@ -322,7 +320,7 @@ class LinkUITest extends DrupalWebTestcase {
     $this->drupalLogout();
     $this->drupalGet($url);
 
-    $this->assertRaw(l('<strong>'. $name .'</strong>', $input['href'], array('html' => TRUE)));
+    $this->assertRaw(l(t('<strong>@name</strong>', array('@name' => $name)), $input['href'], array('html' => TRUE)));
   }
 
   /**
@@ -357,7 +355,7 @@ class LinkUITest extends DrupalWebTestcase {
     $instances = field_info_instances('node', 'page');
     //$this->debug($instances);
     //$this->assert('debug', '<pre>'. print_r($instances, TRUE) .'</pre>', 'Debug');
-    $instance = $instances['field_'. $name];
+    $instance = $instances['field_' . $name];
     //$this->assertTrue(1 === $instance['validate_url'], 'Make sure validation is on.');
     $this->assertFalse($instance['required'], 'Make sure field is not required.');
     $this->assertEqual($instance['settings']['title'], 'optional', 'Title should be optional by default.');
diff --git a/tests/link.test b/tests/link.test
index dfb4dda..408fd40 100644
--- a/tests/link.test
+++ b/tests/link.test
@@ -39,8 +39,8 @@ class LinkBaseTestClass extends DrupalWebTestCase {
       'fields[_add_new_field][type]' => 'link_field',
       'fields[_add_new_field][widget_type]' => 'link_field',
     );
-    $field_name = 'field_'. $name;
-    $this->drupalPost('admin/structure/types/manage/'. $node_type .'/fields', $edit, t('Save'));
+    $field_name = 'field_' . $name;
+    $this->drupalPost('admin/structure/types/manage/' . $node_type . '/fields', $edit, t('Save'));
     $this->drupalPost(NULL, array(), t('Save field settings'));
     $this->drupalPost(NULL, $settings, t('Save settings'));
 
diff --git a/tests/link.token.test b/tests/link.token.test
index d23f46a..840f8d3 100644
--- a/tests/link.token.test
+++ b/tests/link.token.test
@@ -81,7 +81,7 @@ class LinkTokenTest extends LinkBaseTestClass {
     $name = $this->randomName();
     $settings = array(
       'instance[settings][title]' => 'value',
-      'instance[settings][title_value]' => $name .' [node:content-type:machine-name]');
+      'instance[settings][title_value]' => $name . ' [node:content-type:machine-name]');
     $field_name = $this->createLinkField('page', $settings);
 
     // create page form
@@ -124,7 +124,7 @@ class LinkTokenTest extends LinkBaseTestClass {
     $name = $this->randomName();
     $settings = array(
       'instance[settings][title]' => 'value',
-      'instance[settings][title_value]' => $name .' [node:title]');
+      'instance[settings][title_value]' => $name . ' [node:title]');
     $field_name = $this->createLinkField('page', $settings);
 
     // create page form
@@ -150,7 +150,7 @@ class LinkTokenTest extends LinkBaseTestClass {
     $this->drupalLogout();
     $this->drupalGet($url);
 
-    $this->assertRaw(l($name .' '. $name, $input['href']));
+    $this->assertRaw(l($name . ' ' . $name, $input['href']));
   }
 
   // This test doesn't seem to actually work, due to lack of 'title' in url.
@@ -197,9 +197,9 @@ class LinkTokenTest extends LinkBaseTestClass {
 
     $edit = array();
     $test_link_url = 'http://www.example.com/test';
-    $edit[$field_name .'[und][0][url]'] = $test_link_url;
-    $title = 'title_'. $this->randomName(20);
-    $edit[$field_name .'[und][0][title]'] = $title;
+    $edit[$field_name . '[und][0][url]'] = $test_link_url;
+    $title = 'title_' . $this->randomName(20);
+    $edit[$field_name . '[und][0][title]'] = $title;
     $edit['title'] = $name;
 
     $this->drupalGet('node/add/page');
@@ -212,8 +212,8 @@ class LinkTokenTest extends LinkBaseTestClass {
 
     //$this->drupalGet('node/'. $node->nid);
     $this->assertText($title, 'Make sure the link title/text shows');
-    $this->assertRaw(' title="'. $test_link_url .'"', "Do we show the link url as the title attribute?");
-    $this->assertNoRaw(' title="['. $field_name .'-url]"');
+    $this->assertRaw(' title="' . $test_link_url . '"', "Do we show the link url as the title attribute?");
+    $this->assertNoRaw(' title="[' . $field_name . '-url]"');
     $this->assertTrue(module_exists('token'), t('Assure that Token Module is enabled.'));
     //$this->fail($this->content);
   }
@@ -242,11 +242,9 @@ class LinkTokenTest extends LinkBaseTestClass {
     $field_db_info = content_database_info($field);
     $url_type = str_replace('_', '-', $this->content_types[0]->type);
 
-    $edit = array('attributes[title]' => '['. $field_name .'-title]',
-                  'enable_tokens' => TRUE);
+    $edit = array('attributes[title]' => '[' . $field_name . '-title]', 'enable_tokens' => TRUE);
 
-    $this->drupalPost('admin/content/node-type/'. $url_type .'/fields/'. $field['field_name'],
-                      $edit, t('Save field settings'));
+    $this->drupalPost('admin/content/node-type/' . $url_type . '/fields/' . $field['field_name'], $edit, t('Save field settings'));
     $this->assertText(t('Saved field @field_name', array('@field_name' => $field['field_name'])));
 
     // So, having saved this field_name, let's see if it works...
@@ -254,14 +252,14 @@ class LinkTokenTest extends LinkBaseTestClass {
 
     $node = node_load($this->nodes[0]->nid);
 
-    $this->drupalGet('node/'. $this->nodes[0]->nid);
+    $this->drupalGet('node/' . $this->nodes[0]->nid);
 
     $edit = array();
-    $edit[$field['field_name'] .'[0][url]'] = 'http://www.example.com/test';
-    $title = 'title_'. $this->randomName(20);
-    $edit[$field['field_name'] .'[0][title]'] = $title;
+    $edit[$field['field_name'] . '[0][url]'] = 'http://www.example.com/test';
+    $title = 'title_' . $this->randomName(20);
+    $edit[$field['field_name'] . '[0][title]'] = $title;
 
-    $this->drupalPost('node/'. $this->nodes[0]->nid .'/edit', $edit, t('Save'));
+    $this->drupalPost('node/' . $this->nodes[0]->nid . '/edit', $edit, t('Save'));
 
     // Make sure we get a new version!
     $node = node_load($this->nodes[0]->nid, NULL, TRUE);
@@ -269,10 +267,10 @@ class LinkTokenTest extends LinkBaseTestClass {
                         array('@title' => $node->title,
                               '@type' => $this->content_types[0]->name)));
 
-    $this->drupalGet('node/'. $node->nid);
+    $this->drupalGet('node/' . $node->nid);
     $this->assertText($title, 'Make sure the link title/text shows');
-    $this->assertNoRaw(' title="'. $title .'"', "We should not show the link title as the title attribute?");
-    $this->assertNoRaw(' title="['. $field_name .'-title]"');
+    $this->assertNoRaw(' title="' . $title . '"', "We should not show the link title as the title attribute?");
+    $this->assertNoRaw(' title="[' . $field_name . '-title]"');
     //$this->fail($this->content);
   }
 
@@ -325,7 +323,7 @@ class LinkTokenTest extends LinkBaseTestClass {
     $this->drupalLogout();
     $this->drupalGet($url);
 
-    $this->assertRaw(l($input['label'], $input['href'] .'/page'));
+    $this->assertRaw(l($input['label'], $input['href'] . '/page'));
     //$this->fail($this->content);
   }
 
@@ -378,6 +376,6 @@ class LinkTokenTest extends LinkBaseTestClass {
     $this->drupalLogout();
     $this->drupalGet($url);
 
-    $this->assertRaw(l($input['label'], $input['href'] .'/'. $account->uid));
+    $this->assertRaw(l($input['label'], $input['href'] . '/' . $account->uid));
   }
 }
diff --git a/tests/link.validate.test b/tests/link.validate.test
index affa7e9..f0e275a 100644
--- a/tests/link.validate.test
+++ b/tests/link.validate.test
@@ -38,7 +38,7 @@ class LinkValidateTestCase extends LinkBaseTestClass {
       $field_name . '[und][0][url]' => $url,
     );
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertRaw(t(' has been created.'), 'Node created');
+    $this->assertRaw(t('has been created.'), 'Node created');
 
     $nid = 1; //$matches[1];
 
@@ -66,12 +66,14 @@ class LinkValidateTest extends LinkValidateTestCase {
    * Test if we're stopped from posting a bad url on default validation.
    */
   function test_link_validate_bad_url_validate_default() {
-    $account = $this->drupalCreateUser(array('administer content types',
-                                             'administer nodes',
-                                             'administer filters',
-                                             'access content',
-                                             'create page content',
-                                             'access administration pages'));
+    $account = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer nodes',
+      'administer filters',
+      'access content',
+      'create page content',
+      'access administration pages'
+    ));
     $this->drupalLogin($account);
 
     // create field
@@ -94,13 +96,13 @@ class LinkValidateTest extends LinkValidateTestCase {
     // create page form
     $this->drupalGet('node/add/page');
     $field_name = 'field_' . $name;
-    $this->assertField('edit-field-'. $name .'-und-0-title', 'Title found');
-    $this->assertField('edit-field-'. $name .'-und-0-url', 'URL found');
+    $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found');
+    $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found');
 
 
     $edit = array(
       'title' => 'Simple Title',
-      $field_name .'[und][0][url]' => 'edik:naw',
+      $field_name . '[und][0][url]' => 'edik:naw',
     );
 
     $this->drupalPost(NULL, $edit, t('Save'));
@@ -111,12 +113,14 @@ class LinkValidateTest extends LinkValidateTestCase {
    * Test if we're stopped from posting a bad url with validation on.
    */
   function test_link_validate_bad_url_validate_on() {
-    $account = $this->drupalCreateUser(array('administer content types',
-                                             'administer nodes',
-                                             'administer filters',
-                                             'access content',
-                                             'create page content',
-                                             'access administration pages'));
+    $account = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer nodes',
+      'administer filters',
+      'access content',
+      'create page content',
+      'access administration pages'
+    ));
     $this->drupalLogin($account);
 
     // create field
@@ -139,13 +143,13 @@ class LinkValidateTest extends LinkValidateTestCase {
     // create page form
     $this->drupalGet('node/add/page');
     $field_name = 'field_' . $name;
-    $this->assertField('edit-field-'. $name .'-und-0-title', 'Title found');
-    $this->assertField('edit-field-'. $name .'-und-0-url', 'URL found');
+    $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found');
+    $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found');
 
 
     $edit = array(
       'title' => 'Simple Title',
-      $field_name .'[und][0][url]' => 'edik:naw',
+      $field_name . '[und][0][url]' => 'edik:naw',
     );
 
     $this->drupalPost(NULL, $edit, t('Save'));
@@ -157,12 +161,14 @@ class LinkValidateTest extends LinkValidateTestCase {
    * Test if we can post a bad url if the validation is expressly turned off.
    */
   function test_link_validate_bad_url_validate_off() {
-    $account = $this->drupalCreateUser(array('administer content types',
-                                             'administer nodes',
-                                             'administer filters',
-                                             'access content',
-                                             'create page content',
-                                             'access administration pages'));
+    $account = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer nodes',
+      'administer filters',
+      'access content',
+      'create page content',
+      'access administration pages'
+    ));
     $this->drupalLogin($account);
 
     // create field
@@ -189,18 +195,16 @@ class LinkValidateTest extends LinkValidateTestCase {
     // create page form
     $this->drupalGet('node/add/page');
     $field_name = 'field_' . $name;
-    $this->assertField('edit-field-'. $name .'-und-0-title', 'Title found');
-    $this->assertField('edit-field-'. $name .'-und-0-url', 'URL found');
-
+    $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found');
+    $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found');
 
     $edit = array(
       'title' => 'Simple Title',
-      $field_name .'[und][0][url]' => 'edik:naw',
+      $field_name . '[und][0][url]' => 'edik:naw',
     );
 
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->assertNoText(t('Not a valid URL.'));
-
   }
 
   /**
@@ -208,14 +212,16 @@ class LinkValidateTest extends LinkValidateTestCase {
    */
   function x_test_link_validate_switching_between_validation_status() {
     $this->acquireContentTypes(1);
-    $account = $this->drupalCreateUser(array('administer content types',
-                                             'administer nodes',
-                                             'access administration pages',
-                                             'access content',
-                                             'create '. $this->content_types[0]->type .' content',
-                                             'edit any '. $this->content_types[0]->type .' content'));
+    $account = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer nodes',
+      'access administration pages',
+      'access content',
+      'create ' . $this->content_types[0]->type . ' content',
+      'edit any ' . $this->content_types[0]->type . ' content'
+    ));
     $this->drupalLogin($account);
-    variable_set('node_options_'. $this->content_types[0]->name, array('status', 'promote'));
+    variable_set('node_options_' . $this->content_types[0]->name, array('status', 'promote'));
     $field_settings = array(
       'type' => 'link',
       'widget_type' => 'link',
@@ -232,15 +238,15 @@ class LinkValidateTest extends LinkValidateTestCase {
 
     $node = node_load($this->nodes[0]->nid);
 
-    $this->drupalGet('node/'. $this->nodes[0]->nid);
+    $this->drupalGet('node/' . $this->nodes[0]->nid);
 
     $edit = array();
     $title = $this->randomName();
     $url = 'javascript:alert("http://example.com/' . $this->randomName() . '")';
-    $edit[$field['field_name'] .'[0][url]'] = $url;
-    $edit[$field['field_name'] .'[0][title]'] = $title;
+    $edit[$field['field_name'] . '[0][url]'] = $url;
+    $edit[$field['field_name'] . '[0][title]'] = $title;
 
-    $this->drupalPost('node/'. $this->nodes[0]->nid .'/edit', $edit, t('Save'));
+    $this->drupalPost('node/' . $this->nodes[0]->nid . '/edit', $edit, t('Save'));
     //$this->pass($this->content);
     $this->assertNoText(t('Not a valid URL.'));
 
@@ -248,7 +254,7 @@ class LinkValidateTest extends LinkValidateTestCase {
     $node = node_load($this->nodes[0]->nid, NULL, TRUE);
     $this->assertEqual($url, $node->{$field['field_name']}[0]['url']);
 
-    $this->drupalGet('node/'. $node->nid);
+    $this->drupalGet('node/' . $node->nid);
     $this->assertNoRaw($url, 'Make sure Javascript does not display.');
 
     // Turn the array validation back _on_.
@@ -256,9 +262,9 @@ class LinkValidateTest extends LinkValidateTestCase {
     $node_type_link = str_replace('_', '-', $node->type);
     //$this->drupalGet('admin/content/node-type/'. $node_type_link .'/fields'); ///'. $field['field_name']);
     //$this->fail($this->content);
-    $this->drupalPost('admin/content/node-type/'. $node_type_link .'/fields/'. $field['field_name'], $edit, t('Save field settings'));
+    $this->drupalPost('admin/content/node-type/' . $node_type_link . '/fields/' . $field['field_name'], $edit, t('Save field settings'));
 
-    $this->drupalGet('node/'. $node->nid);
+    $this->drupalGet('node/' . $node->nid);
     // This actually works because the display_url goes through the core
     // url() function.  But we should have a test that makes sure it continues
     // to work.
@@ -392,7 +398,7 @@ class LinkValidateUrlLight extends DrupalWebTestCase {
       case FALSE:
         return "Invalid Link";
       default:
-        return "Bad Value:". $type;
+        return "Bad Value:" . $type;
     }
   }
 
@@ -471,12 +477,12 @@ class LinkValidateUrlLight extends DrupalWebTestCase {
     $allowed_protocols = variable_get('filter_allowed_protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal'));
     foreach ($allowed_protocols as $protocol) {
       if ($protocol !== 'news' && $protocol !== 'mailto') {
-        $links[] = $protocol .'://www.example.com';
+        $links[] = $protocol . '://www.example.com';
       }
     }
     foreach ($links as $link) {
       $valid = link_validate_url($link);
-      $this->assertEqual(LINK_EXTERNAL, $valid, 'Testing that '. $link .' is a valid external link.');
+      $this->assertEqual(LINK_EXTERNAL, $valid, 'Testing that ' . $link . ' is a valid external link.');
       // The following two lines are commented out and only used for comparisons.
       //$valid2 = valid_url($link, TRUE);
       //$this->assertEqual(TRUE, $valid2, "Using valid_url() on $link.");
@@ -494,7 +500,7 @@ class LinkValidateUrlLight extends DrupalWebTestCase {
     );
     foreach ($links as $link) {
       $valid = link_validate_url($link);
-      $this->assertEqual(FALSE, $valid, 'Testing that '. $link .' is not a valid link.');
+      $this->assertEqual(FALSE, $valid, 'Testing that ' . $link . ' is not a valid link.');
     }
   }
 
diff --git a/views/link_views_handler_argument_target.inc b/views/link_views_handler_argument_target.inc
index b0a2a3e..03c5dbc 100644
--- a/views/link_views_handler_argument_target.inc
+++ b/views/link_views_handler_argument_target.inc
@@ -144,6 +144,6 @@ class link_views_handler_argument_target extends views_handler_argument {
     $this->ensure_my_table();
     // Because attributes are stored serialized, our only option is to also
     // serialize the data we're searching for and use LIKE to find similar data.
-    $this->query->add_where(0, $this->table_alias .'.'. $this->real_field ." LIKE '%%%s%'", serialize(array('target' => $this->argument)));
+    $this->query->add_where(0, $this->table_alias . '.' . $this->real_field . " LIKE '%%%s%'", serialize(array('target' => $this->argument)));
   }
 }
diff --git a/views/link_views_handler_filter_protocol.inc b/views/link_views_handler_filter_protocol.inc
index f43e345..8bac647 100644
--- a/views/link_views_handler_filter_protocol.inc
+++ b/views/link_views_handler_filter_protocol.inc
@@ -80,7 +80,7 @@ class link_views_handler_filter_protocol extends views_handler_filter_string {
     $where_conditions = array();
     foreach ($protocols as $protocol) {
       // Simple case, the URL begins with the specified protocol.
-      $condition = $field .' LIKE \''. $protocol .'%\'';
+      $condition = $field . ' LIKE \'' . $protocol . '%\'';
 
       // More complex case, no protocol specified but is automatically cleaned up
       // by link_cleanup_url(). RegEx is required for this search operation.
@@ -89,18 +89,18 @@ class link_views_handler_filter_protocol extends views_handler_filter_string {
           // PostGreSQL code has NOT been tested. Please report any problems to the link issue queue.
           // pgSQL requires all slashes to be double escaped in regular expressions.
           // See http://www.postgresql.org/docs/8.1/static/functions-matching.html#FUNCTIONS-POSIX-REGEXP
-          $condition .= ' OR '. $field .' ~* \''.'^(([a-z0-9]([a-z0-9\\-_]*\\.)+)('. LINK_DOMAINS .'|[a-z][a-z]))'.'\'';
+          $condition .= ' OR ' . $field . ' ~* \'' . '^(([a-z0-9]([a-z0-9\\-_]*\\.)+)(' . LINK_DOMAINS . '|[a-z][a-z]))' . '\'';
         }
         else {
           // mySQL requires backslashes to be double (triple?) escaped within character classes.
           // See http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html#operator_regexp
-          $condition .= ' OR '. $field .' REGEXP \''.'^(([a-z0-9]([a-z0-9\\\-_]*\.)+)('. LINK_DOMAINS .'|[a-z][a-z]))'.'\'';
+          $condition .= ' OR ' . $field . ' REGEXP \'' . '^(([a-z0-9]([a-z0-9\\\-_]*\.)+)(' . LINK_DOMAINS . '|[a-z][a-z]))' . '\'';
         }
       }
 
       $where_conditions[] = $condition;
     }
 
-    $this->query->add_where($this->options['group'], implode(' '. $this->operator .' ', $where_conditions));
+    $this->query->add_where($this->options['group'], implode(' ' . $this->operator . ' ', $where_conditions));
   }
 }
