فهرست منبع

security update for context link entity_reference

Bachir Soussi Chiadmi 5 سال پیش
والد
کامیت
835220fa8b
41فایلهای تغییر یافته به همراه1397 افزوده شده و 515 حذف شده
  1. 21 5
      sites/all/modules/contrib/admin/context/context.core.inc
  2. 3 4
      sites/all/modules/contrib/admin/context/context.info
  3. 5 0
      sites/all/modules/contrib/admin/context/context.module
  4. 3 4
      sites/all/modules/contrib/admin/context/context_layouts/context_layouts.info
  5. 3 4
      sites/all/modules/contrib/admin/context/context_ui/context_ui.info
  6. 1 1
      sites/all/modules/contrib/admin/context/plugins/context_condition_query_string.inc
  7. 11 10
      sites/all/modules/contrib/admin/context/plugins/context_reaction_block.inc
  8. 1 1
      sites/all/modules/contrib/admin/context/plugins/context_reaction_block.js
  9. 5 1
      sites/all/modules/contrib/admin/context/plugins/context_reaction_region.inc
  10. 3 3
      sites/all/modules/contrib/fields/entityreference/entityreference.info
  11. 25 0
      sites/all/modules/contrib/fields/entityreference/entityreference.install
  12. 215 40
      sites/all/modules/contrib/fields/entityreference/entityreference.module
  13. 3 3
      sites/all/modules/contrib/fields/entityreference/examples/entityreference_behavior_example/entityreference_behavior_example.info
  14. 7 5
      sites/all/modules/contrib/fields/entityreference/plugins/behavior/EntityReferenceBehavior_TaxonomyIndex.class.php
  15. 6 2
      sites/all/modules/contrib/fields/entityreference/plugins/selection/EntityReference_SelectionHandler_Generic.class.php
  16. 69 5
      sites/all/modules/contrib/fields/entityreference/plugins/selection/EntityReference_SelectionHandler_Views.class.php
  17. 3 2
      sites/all/modules/contrib/fields/entityreference/plugins/selection/abstract.inc
  18. 1 1
      sites/all/modules/contrib/fields/entityreference/tests/entityreference.admin.test
  19. 16 1
      sites/all/modules/contrib/fields/entityreference/tests/entityreference.handlers.test
  20. 48 0
      sites/all/modules/contrib/fields/entityreference/tests/entityreference.taxonomy.test
  21. 3 3
      sites/all/modules/contrib/fields/entityreference/tests/modules/entityreference_feeds_test/entityreference_feeds_test.info
  22. 3 2
      sites/all/modules/contrib/fields/entityreference/views/entityreference_plugin_display.inc
  23. 1 1
      sites/all/modules/contrib/fields/entityreference/views/entityreference_plugin_style.inc
  24. 0 2
      sites/all/modules/contrib/fields/link/README.txt
  25. 0 1
      sites/all/modules/contrib/fields/link/link-rtl.css
  26. 0 1
      sites/all/modules/contrib/fields/link/link.css
  27. 2 2
      sites/all/modules/contrib/fields/link/link.diff.inc
  28. 3 5
      sites/all/modules/contrib/fields/link/link.info
  29. 46 19
      sites/all/modules/contrib/fields/link/link.install
  30. 37 11
      sites/all/modules/contrib/fields/link/link.migrate.inc
  31. 11 2
      sites/all/modules/contrib/fields/link/link.module
  32. 111 51
      sites/all/modules/contrib/fields/link/tests/link.attribute.test
  33. 27 7
      sites/all/modules/contrib/fields/link/tests/link.crud.test
  34. 130 66
      sites/all/modules/contrib/fields/link/tests/link.crud_browser.test
  35. 38 29
      sites/all/modules/contrib/fields/link/tests/link.entity_token.test
  36. 14 2
      sites/all/modules/contrib/fields/link/tests/link.test
  37. 141 92
      sites/all/modules/contrib/fields/link/tests/link.token.test
  38. 311 105
      sites/all/modules/contrib/fields/link/tests/link.validate.test
  39. 3 0
      sites/all/modules/contrib/fields/link/views/link.views.inc
  40. 14 7
      sites/all/modules/contrib/fields/link/views/link_views_handler_argument_target.inc
  41. 53 15
      sites/all/modules/contrib/fields/link/views/link_views_handler_filter_protocol.inc

+ 21 - 5
sites/all/modules/contrib/admin/context/context.core.inc

@@ -94,11 +94,27 @@ function context_theme_registry_alter(&$theme_registry) {
  */
 function context_ctools_render_alter($info, $page, $data) {
   extract($data);
-  if ($page && in_array($task['name'], array('node_view', 'node_edit'), TRUE)) {
-    foreach ($contexts as $ctools_context) {
-      if (in_array('node', $ctools_context->type) && !empty($ctools_context->data)) {
-        context_node_condition($ctools_context->data, $task['name'] === 'node_view' ? 'view' : 'form');
-        break;
+
+  // Check for page handlers.
+  if ($page) {
+    // Check for node page handler.
+    if (in_array($task['name'], array('node_view', 'node_edit'), TRUE)) {
+      foreach ($contexts as $ctools_context) {
+        if (in_array('node', $ctools_context->type) && !empty($ctools_context->data)) {
+          context_node_condition($ctools_context->data, $task['name'] === 'node_view' ? 'view' : 'form');
+          break;
+        }
+      }
+    }
+    // Check for taxonomy term page handler.
+    elseif (in_array($task['name'], array('term_view', 'term_edit'), TRUE)) {
+      foreach ($contexts as $ctools_context) {
+        if (in_array('taxonomy_term', $ctools_context->type) && !empty($ctools_context->data)) {
+          if ($plugin = context_get_plugin('condition', 'taxonomy_term')) {
+            $plugin->execute($ctools_context->data, $task['name'] === 'term_view' ? 'view' : 'form');
+          }
+          break;
+        }
       }
     }
   }

+ 3 - 4
sites/all/modules/contrib/admin/context/context.info

@@ -8,9 +8,8 @@ files[] = tests/context.test
 files[] = tests/context.conditions.test
 files[] = tests/context.reactions.test
 
-; Information added by Drupal.org packaging script on 2016-05-18
-version = "7.x-3.7"
+; Information added by Drupal.org packaging script on 2019-02-26
+version = "7.x-3.10"
 core = "7.x"
 project = "context"
-datestamp = "1463605446"
-
+datestamp = "1551220089"

+ 5 - 0
sites/all/modules/contrib/admin/context/context.module

@@ -243,6 +243,11 @@ function context_preprocess_menu_link(&$variables) {
         //   css class to the link of this menu.
         // - Do not add class twice on current page.
         if (in_array($variables['element']['#href'], $reaction_menu_paths) && $variables['element']['#href'] != $_GET['q']) {
+          // Initialize classes array if not set.
+          if (!isset($variables['element']['#localized_options']['attributes']['class'])) {
+            $variables['element']['#localized_options']['attributes']['class'] = array();
+          }
+
           // Do not add the 'active' class twice in views tabs.
           if (!in_array('active', $variables['element']['#localized_options']['attributes']['class'])) {
             $variables['element']['#localized_options']['attributes']['class'][] = 'active';

+ 3 - 4
sites/all/modules/contrib/admin/context/context_layouts/context_layouts.info

@@ -6,9 +6,8 @@ core = 7.x
 
 files[] = plugins/context_layouts_reaction_block.inc
 
-; Information added by Drupal.org packaging script on 2016-05-18
-version = "7.x-3.7"
+; Information added by Drupal.org packaging script on 2019-02-26
+version = "7.x-3.10"
 core = "7.x"
 project = "context"
-datestamp = "1463605446"
-
+datestamp = "1551220089"

+ 3 - 4
sites/all/modules/contrib/admin/context/context_ui/context_ui.info

@@ -8,9 +8,8 @@ configure = admin/structure/context
 files[] = context.module
 files[] = tests/context_ui.test
 
-; Information added by Drupal.org packaging script on 2016-05-18
-version = "7.x-3.7"
+; Information added by Drupal.org packaging script on 2019-02-26
+version = "7.x-3.10"
 core = "7.x"
 project = "context"
-datestamp = "1463605446"
-
+datestamp = "1551220089"

+ 1 - 1
sites/all/modules/contrib/admin/context/plugins/context_condition_query_string.inc

@@ -16,7 +16,7 @@ class context_condition_query_string extends context_condition_path {
    */
   function execute() {
     if ($this->condition_used()) {
-      $current_query_string = $_SERVER["QUERY_STRING"];
+      $current_query_string = empty($_SERVER["QUERY_STRING"]) ? '' : $_SERVER["QUERY_STRING"];
       foreach ($this->get_contexts() as $context) {
         $query_strings = $this->fetch_from_context($context, 'values');
         if ($this->match($current_query_string, $query_strings, TRUE)) {

+ 11 - 10
sites/all/modules/contrib/admin/context/plugins/context_reaction_block.inc

@@ -400,13 +400,17 @@ class context_reaction_block extends context_reaction {
       unset($_context_blocks);
 
       foreach ($context_blocks as $r => $blocks) {
-        //only render blocks in an active region
+        // Only render blocks in an active region.
         if (array_key_exists($r, $active_regions)) {
           $context_blocks[$r] = _block_render_blocks($blocks);
 
-          // Make blocks editable if allowed.
-          if ($this->is_editable_region($r)) {
-            foreach ($context_blocks[$r] as $key => $block) {
+          $editable = $this->is_editable_region($r);
+          foreach ($context_blocks[$r] as $key => $block) {
+            // Add the region property to each block.
+            $context_blocks[$r][$key]->region = $r;
+
+            // Make blocks editable if allowed.
+            if ($editable) {
               $context_blocks[$r][$key] = $this->editable_block($block);
             }
           }
@@ -450,12 +454,9 @@ class context_reaction_block extends context_reaction {
    */
   protected function max_block_weight() {
     $blocks = $this->get_blocks();
-    $block_count = 0;
-    foreach ($blocks as $region => $block_list) {
-      $block_count += count($block_list);
-    }
-    // Add 2 to make sure there's space at either end of the block list
-    return round(($block_count + 2) / 2);
+
+    // Add 2 to make sure there's space at either end of the block list.
+    return round((count($blocks) + 2) / 2);
   }
 
   /**

+ 1 - 1
sites/all/modules/contrib/admin/context/plugins/context_reaction_block.js

@@ -68,7 +68,7 @@ DrupalContextBlockForm = function(blockForm) {
 
     // Hide enabled blocks from selector that are used
     $('table.context-blockform-region tr').each(function() {
-      var bid = $(this).attr('id');
+      var bid = Drupal.checkPlain($(this).attr('id'));
       $('div.context-blockform-selector input[value="'+bid+'"]').parents('div.form-item').eq(0).hide();
     });
     // Show blocks in selector that are unused

+ 5 - 1
sites/all/modules/contrib/admin/context/plugins/context_reaction_region.inc

@@ -17,7 +17,7 @@ class context_reaction_region extends context_reaction {
           '#type' => 'fieldset',
           '#title' => "Disable Regions in {$theme->name} Theme",
           '#collapsible' => TRUE,
-          '#collapsed' => !array_reduce($default, create_function('$a, $b', 'return $a || $b;')),
+          '#collapsed' => !array_reduce($default, 'context_reaction_region::collapseRegion'),
         );
         $form[$theme->name]['disable'] = array(
           '#type' => 'checkboxes',
@@ -29,6 +29,10 @@ class context_reaction_region extends context_reaction {
     }
     return $form;
   }
+
+  function collapseRegion($a, $b) {
+    return $a || $b;
+  }
   
   function execute(&$page) {  
     global $theme;

+ 3 - 3
sites/all/modules/contrib/fields/entityreference/entityreference.info

@@ -29,9 +29,9 @@ files[] = tests/entityreference.admin.test
 files[] = tests/entityreference.feeds.test
 files[] = tests/entityreference.entity_translation.test
 
-; Information added by Drupal.org packaging script on 2016-09-19
-version = "7.x-1.2"
+; Information added by Drupal.org packaging script on 2017-08-16
+version = "7.x-1.5"
 core = "7.x"
 project = "entityreference"
-datestamp = "1474306740"
+datestamp = "1502895850"
 

+ 25 - 0
sites/all/modules/contrib/fields/entityreference/entityreference.install

@@ -163,3 +163,28 @@ function entityreference_update_7002() {
     ));
   }
 }
+
+/**
+ * Implements hook_update_N().
+ *
+ * Remove duplicate rows in the taxonomy_index table.
+ */
+function entityreference_update_7100() {
+  if (db_table_exists('taxonomy_index')) {
+    if (db_table_exists('taxonomy_index_tmp')) {
+      db_drop_table('taxonomy_index_tmp');
+    }
+
+    $tx_schema = drupal_get_schema('taxonomy_index');
+    db_create_table('taxonomy_index_tmp', $tx_schema);
+    $select = db_select('taxonomy_index', 'tx');
+    $select->fields('tx', array('nid', 'tid'));
+    $select->groupBy('tx.nid');
+    $select->groupBy('tx.tid');
+    $select->addExpression('MAX(sticky)', 'sticky');
+    $select->addExpression('MAX(created)', 'created');
+    db_insert('taxonomy_index_tmp')->from($select)->execute();
+    db_drop_table('taxonomy_index');
+    db_rename_table('taxonomy_index_tmp', 'taxonomy_index');
+  }
+}

+ 215 - 40
sites/all/modules/contrib/fields/entityreference/entityreference.module

@@ -1,5 +1,12 @@
 <?php
 
+define('ENTITYREFERENCE_DENIED', '- Restricted access -');
+
+/**
+ * @file
+ * Entityreference primary module file.
+ */
+
 /**
  * Implements hook_ctools_plugin_directory().
  */
@@ -87,6 +94,20 @@ function entityreference_flush_caches() {
   variable_set('entityreference:base-tables', $base_tables);
 }
 
+/**
+ * Implements hook_theme().
+ */
+function entityreference_theme($existing, $type, $theme, $path) {
+  return array(
+    'entityreference_label' => array(
+      'variables' => array('label' => NULL, 'item' => NULL, 'settings' => NULL, 'uri' => NULL),
+    ),
+    'entityreference_entity_id' => array(
+      'variables' => array('item' => NULL, 'settings' => NULL),
+    ),
+  );
+}
+
 /**
  * Implements hook_menu().
  */
@@ -163,7 +184,7 @@ function entityreference_get_behavior_handlers($field, $instance = NULL) {
 /**
  * Get the behavior handler for a given entityreference field and instance.
  *
- * @param $handler
+ * @param $behavior
  *   The behavior handler name.
  */
 function _entityreference_get_behavior_handler($behavior) {
@@ -400,6 +421,9 @@ function entityreference_field_settings_form($field, $instance, $has_data) {
   return $form;
 }
 
+/**
+ * Callback for custom element processing.
+ */
 function _entityreference_field_settings_process($form, $form_state) {
   $field = isset($form_state['entityreference']['field']) ? $form_state['entityreference']['field'] : $form['#field'];
   $instance = isset($form_state['entityreference']['instance']) ? $form_state['entityreference']['instance'] : $form['#instance'];
@@ -481,11 +505,17 @@ function _entityreference_field_settings_process($form, $form_state) {
   return $form;
 }
 
+/**
+ * Custom callback for ajax processing.
+ */
 function _entityreference_field_settings_ajax_process($form, $form_state) {
   _entityreference_field_settings_ajax_process_element($form, $form);
   return $form;
 }
 
+/**
+ * Helper function for custom ajax processing.
+ */
 function _entityreference_field_settings_ajax_process_element(&$element, $main_form) {
   if (isset($element['#ajax']) && $element['#ajax'] === TRUE) {
     $element['#ajax'] = array(
@@ -500,6 +530,9 @@ function _entityreference_field_settings_ajax_process_element(&$element, $main_f
   }
 }
 
+/**
+ * Custom callback for element processing.
+ */
 function _entityreference_form_process_merge_parent($element) {
   $parents = $element['#parents'];
   array_pop($parents);
@@ -507,11 +540,17 @@ function _entityreference_form_process_merge_parent($element) {
   return $element;
 }
 
+/**
+ * Helper function to remove blank elements.
+ */
 function _entityreference_element_validate_filter(&$element, &$form_state) {
   $element['#value'] = array_filter($element['#value']);
   form_set_value($element, $element['#value'], $form_state);
 }
 
+/**
+ * Implements hook_validate().
+ */
 function _entityreference_field_settings_validate($form, &$form_state) {
   // Store the new values in the form state.
   $field = $form['#field'];
@@ -547,6 +586,9 @@ function entityreference_field_instance_settings_form($field, $instance) {
   return $form;
 }
 
+/**
+ * Implements hook_field_settings_form().
+ */
 function _entityreference_field_instance_settings_form($form, $form_state) {
   $field = isset($form_state['entityreference']['field']) ? $form_state['entityreference']['field'] : $form['#field'];
   $instance = isset($form_state['entityreference']['instance']) ? $form_state['entityreference']['instance'] : $form['#instance'];
@@ -564,6 +606,9 @@ function _entityreference_field_instance_settings_form($form, $form_state) {
   return $form;
 }
 
+/**
+ * Implements hook_validate().
+ */
 function _entityreference_field_instance_settings_validate($form, &$form_state) {
   // Store the new values in the form state.
   $instance = $form['#instance'];
@@ -795,7 +840,7 @@ function entityreference_query_entityreference_alter(QueryAlterableInterface $qu
 function entityreference_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
   // Ensure that the entity target type exists before displaying the widget.
   $entity_info = entity_get_info($field['settings']['target_type']);
-  if (empty($entity_info)){
+  if (empty($entity_info)) {
     return;
   }
   $entity_type = $instance['entity_type'];
@@ -820,7 +865,9 @@ function entityreference_field_widget_form(&$form, &$form_state, $field, $instan
 
     // Build an array of entities ID.
     foreach ($items as $item) {
-      $entity_ids[] = $item['target_id'];
+      if (isset($item['target_id'])) {
+        $entity_ids[] = $item['target_id'];
+      }
     }
 
     // Load those entities and loop through them to extract their labels.
@@ -881,6 +928,9 @@ function entityreference_field_widget_form(&$form, &$form_state, $field, $instan
   }
 }
 
+/**
+ * Implements hook_validate().
+ */
 function _entityreference_autocomplete_validate($element, &$form_state, $form) {
   // If a value was entered into the autocomplete...
   $value = '';
@@ -905,6 +955,9 @@ function _entityreference_autocomplete_validate($element, &$form_state, $form) {
   form_set_value($element, $value, $form_state);
 }
 
+/**
+ * Implements hook_validate().
+ */
 function _entityreference_autocomplete_tags_validate($element, &$form_state, $form) {
   $value = array();
   // If a value was entered into the autocomplete...
@@ -951,7 +1004,8 @@ function entityreference_field_widget_error($element, $error) {
  *   The entity type.
  * @param $bundle_name
  *   The bundle name.
- * @return
+ *
+ * @return bool
  *   True if user can access this menu item.
  */
 function entityreference_autocomplete_access_callback($type, $field_name, $entity_type, $bundle_name) {
@@ -983,10 +1037,11 @@ function entityreference_autocomplete_access_callback($type, $field_name, $entit
  */
 function entityreference_autocomplete_callback($type, $field_name, $entity_type, $bundle_name, $entity_id = '', $string = '') {
   // If the request has a '/' in the search text, then the menu system will have
-  // split it into multiple arguments and $string will only be a partial. We want
-  //  to make sure we recover the intended $string.
+  // split it into multiple arguments and $string will only be a partial.
+  // We want to make sure we recover the intended $string.
   $args = func_get_args();
-  // Shift off the $type, $field_name, $entity_type, $bundle_name, and $entity_id args.
+  // Shift off the $type, $field_name, $entity_type,
+  // $bundle_name, and $entity_id args.
   array_shift($args);
   array_shift($args);
   array_shift($args);
@@ -1022,6 +1077,7 @@ function entityreference_autocomplete_callback($type, $field_name, $entity_type,
  */
 function entityreference_autocomplete_callback_get_matches($type, $field, $instance, $entity_type, $entity_id = '', $string = '') {
   $matches = array();
+  $prefix = '';
 
   $entity = NULL;
   if ($entity_id !== 'NULL') {
@@ -1036,7 +1092,8 @@ function entityreference_autocomplete_callback_get_matches($type, $field, $insta
   $handler = entityreference_get_selection_handler($field, $instance, $entity_type, $entity);
 
   if ($type == 'tags') {
-    // The user enters a comma-separated list of tags. We only autocomplete the last tag.
+    // The user enters a comma-separated list of tags.
+    // We only autocomplete the last tag.
     $tags_typed = drupal_explode_tags($string);
     $tag_last = drupal_strtolower(array_pop($tags_typed));
     if (!empty($tag_last)) {
@@ -1045,19 +1102,22 @@ function entityreference_autocomplete_callback_get_matches($type, $field, $insta
   }
   else {
     // The user enters a single tag.
-    $prefix = '';
     $tag_last = $string;
   }
 
   if (isset($tag_last)) {
     // Get an array of matching entities.
     $entity_labels = $handler->getReferencableEntities($tag_last, $instance['widget']['settings']['match_operator'], 10);
-
+    $denied_label = t(ENTITYREFERENCE_DENIED);
     // Loop through the products and convert them into autocomplete output.
     foreach ($entity_labels as $values) {
       foreach ($values as $entity_id => $label) {
+        // Never autocomplete entities that aren't accessible.
+        if ($label == $denied_label) {
+          continue;
+        }
         $key = "$label ($entity_id)";
-        // Strip things like starting/trailing white spaces, line breaks and tags.
+        // Strip starting/trailing white spaces, line breaks and tags.
         $key = preg_replace('/\s\s+/', ' ', str_replace("\n", '', trim(decode_entities(strip_tags($key)))));
         // Names containing commas or quotes must be wrapped in quotes.
         if (strpos($key, ',') !== FALSE || strpos($key, '"') !== FALSE) {
@@ -1071,6 +1131,32 @@ function entityreference_autocomplete_callback_get_matches($type, $field, $insta
   drupal_json_output($matches);
 }
 
+ /**
+ * Introspects field and instance settings, and determines the correct settings
+ * for the functioning of the formatter.
+ *
+ * Settings:
+ *   - entity_type - The entity_type being loaded.
+ *   - column - The name of the ref. field column that stores the entity id.
+ */
+function entityreference_field_type_settings($field) {
+  $settings = array(
+    'entity_type' => NULL,
+    'column' => NULL,
+  );
+
+  if ($field['type'] == 'entityreference') {
+    $settings['entity_type'] = $field['settings']['target_type'];
+    $settings['column'] = 'target_id';
+  }
+  elseif ($field['type'] == 'taxonomy_term_reference') {
+    $settings['entity_type'] = 'taxonomy_term';
+    $settings['column'] = 'tid';
+  }
+
+  return $settings;
+}
+
 /**
  * Implements hook_field_formatter_info().
  */
@@ -1082,6 +1168,7 @@ function entityreference_field_formatter_info() {
       'field types' => array('entityreference'),
       'settings' => array(
         'link' => FALSE,
+        'bypass_access' => FALSE,
       ),
     ),
     'entityreference_entity_id' => array(
@@ -1092,7 +1179,7 @@ function entityreference_field_formatter_info() {
     'entityreference_entity_view' => array(
       'label' => t('Rendered entity'),
       'description' => t('Display the referenced entities rendered by entity_view().'),
-      'field types' => array('entityreference'),
+      'field types' => array('entityreference', 'taxonomy_term_reference'),
       'settings' => array(
         'view_mode' => 'default',
         'links' => TRUE,
@@ -1108,9 +1195,17 @@ function entityreference_field_formatter_info() {
 function entityreference_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
   $display = $instance['display'][$view_mode];
   $settings = $display['settings'];
+  $field_type_settings = entityreference_field_type_settings($field);
   $element = array();
 
   if ($display['type'] == 'entityreference_label') {
+    $element['bypass_access'] = array(
+      '#title' => t('Show entity labels regardless of user access'),
+      '#description' => t("All entities in the field will be shown, without checking them for access. If the 'Link' setting is also enabled, an entity which the user does not have access to view will show without a link."),
+      '#type' => 'checkbox',
+      '#default_value' => $settings['bypass_access'],
+    );
+
     $element['link'] = array(
       '#title' => t('Link label to the referenced entity'),
       '#type' => 'checkbox',
@@ -1119,7 +1214,7 @@ function entityreference_field_formatter_settings_form($field, $instance, $view_
   }
 
   if ($display['type'] == 'entityreference_entity_view') {
-    $entity_info = entity_get_info($field['settings']['target_type']);
+    $entity_info = entity_get_info($field_type_settings['entity_type']);
     $options = array('default' => t('Default'));
     if (!empty($entity_info['view modes'])) {
       foreach ($entity_info['view modes'] as $view_mode => $view_mode_settings) {
@@ -1157,15 +1252,17 @@ function entityreference_field_formatter_settings_form($field, $instance, $view_
 function entityreference_field_formatter_settings_summary($field, $instance, $view_mode) {
   $display = $instance['display'][$view_mode];
   $settings = $display['settings'];
+  $field_type_settings = entityreference_field_type_settings($field);
 
   $summary = array();
 
   if ($display['type'] == 'entityreference_label') {
     $summary[] = $settings['link'] ? t('Link to the referenced entity') : t('No link');
+    $summary[] = $settings['bypass_access'] ? t('Show labels regardless of access') : t('Respect entity access for label visibility');
   }
 
   if ($display['type'] == 'entityreference_entity_view') {
-    $entity_info = entity_get_info($field['settings']['target_type']);
+    $entity_info = entity_get_info($field_type_settings['entity_type']);
     $view_mode_label = $settings['view_mode'] == 'default' ? t('Default') : $settings['view_mode'];
     if (isset($entity_info['view modes'][$settings['view_mode']]['label'])) {
       $view_mode_label = $entity_info['view modes'][$settings['view_mode']]['label'];
@@ -1182,19 +1279,22 @@ function entityreference_field_formatter_settings_summary($field, $instance, $vi
  * Implements hook_field_formatter_prepare_view().
  */
 function entityreference_field_formatter_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items, $displays) {
+  $field_type_settings = entityreference_field_type_settings($field);
+  $target_type = $field_type_settings['entity_type'];
+  $column = $field_type_settings['column'];
   $target_ids = array();
 
   // Collect every possible entity attached to any of the entities.
   foreach ($entities as $id => $entity) {
     foreach ($items[$id] as $delta => $item) {
-      if (isset($item['target_id'])) {
-        $target_ids[] = $item['target_id'];
+      if (isset($item[$column])) {
+        $target_ids[] = $item[$column];
       }
     }
   }
 
   if ($target_ids) {
-    $target_entities = entity_load($field['settings']['target_type'], $target_ids);
+    $target_entities = entity_load($target_type, $target_ids);
   }
   else {
     $target_entities = array();
@@ -1206,12 +1306,12 @@ function entityreference_field_formatter_prepare_view($entity_type, $entities, $
 
     foreach ($items[$id] as $delta => $item) {
       // Check whether the referenced entity could be loaded.
-      if (isset($item['target_id']) && isset($target_entities[$item['target_id']])) {
+      if (isset($target_entities[$item[$column]]) && isset($target_entities[$item[$column]])) {
         // Replace the instance value with the term data.
-        $items[$id][$delta]['entity'] = $target_entities[$item['target_id']];
+        $items[$id][$delta]['entity'] = $target_entities[$item[$column]];
         // Check whether the user has access to the referenced entity.
-        $has_view_access = (entity_access('view', $field['settings']['target_type'], $target_entities[$item['target_id']]) !== FALSE);
-        $has_update_access = (entity_access('update', $field['settings']['target_type'], $target_entities[$item['target_id']]) !== FALSE);
+        $has_view_access = (entity_access('view', $target_type, $target_entities[$item[$column]]) !== FALSE);
+        $has_update_access = (entity_access('update', $target_type, $target_entities[$item[$column]]) !== FALSE);
         $items[$id][$delta]['access'] = ($has_view_access || $has_update_access);
       }
       // Otherwise, unset the instance value, since the entity does not exist.
@@ -1234,34 +1334,63 @@ function entityreference_field_formatter_prepare_view($entity_type, $entities, $
 function entityreference_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
   $result = array();
   $settings = $display['settings'];
-
-  // Rebuild the items list to contain only those with access.
-  foreach ($items as $key => $item) {
-    if (empty($item['access'])) {
-      unset($items[$key]);
-    }
-  }
+  $field_type_settings = entityreference_field_type_settings($field);
+  $target_type = $field_type_settings['entity_type'];
+  $column = $field_type_settings['column'];
 
   switch ($display['type']) {
     case 'entityreference_label':
       $handler = entityreference_get_selection_handler($field, $instance, $entity_type, $entity);
 
       foreach ($items as $delta => $item) {
-        $label = $handler->getLabel($item['entity']);
-        // If the link is to be displayed and the entity has a uri, display a link.
-        // Note the assignment ($url = ) here is intended to be an assignment.
-        if ($display['settings']['link'] && ($uri = entity_uri($field['settings']['target_type'], $item['entity']))) {
-          $result[$delta] = array('#markup' => l($label, $uri['path'], $uri['options']));
+        // Skip an item that is not accessible, unless we're allowing output of
+        // entity labels without considering access.
+        if (empty($item['access']) && !$display['settings']['bypass_access']) {
+          continue;
         }
-        else {
-          $result[$delta] = array('#markup' => check_plain($label));
+
+        // Calling EntityReferenceHandler::getLabel() would make a repeated,
+        // wasteful call to entity_access().
+        $label = entity_label($field['settings']['target_type'], $item['entity']);
+
+        // Check if the settings and access allow a link to be displayed.
+        $display_link = $display['settings']['link'] && $item['access'];
+
+        $uri = NULL;
+
+        // If the link is allowed and the entity has a uri, display a link.
+        if ($display_link) {
+          $uri = entity_uri($target_type, $item['entity']);
         }
+
+        $result[$delta] = array(
+          '#theme' => 'entityreference_label',
+          '#label' => $label,
+          '#item' => $item,
+          '#uri' => $uri,
+          '#settings' => array(
+            'display' => $display['settings'],
+            'field' => $field['settings'],
+          ),
+        );
       }
       break;
 
     case 'entityreference_entity_id':
       foreach ($items as $delta => $item) {
-        $result[$delta] = array('#markup' => check_plain($item['target_id']));
+        // Skip an item that is not accessible.
+        if (empty($item['access'])) {
+          continue;
+        }
+
+        $result[$delta] = array(
+          '#theme' => 'entityreference_entity_id',
+          '#item' => $item,
+          '#settings' => array(
+            'display' => $display['settings'],
+            'field' => $field['settings'],
+          ),
+        );
       }
       break;
 
@@ -1272,19 +1401,24 @@ function entityreference_field_formatter_view($entity_type, $entity, $field, $in
       }
 
       foreach ($items as $delta => $item) {
+        // Skip an item that is not accessible.
+        if (empty($item['access'])) {
+          continue;
+        }
+
         // Protect ourselves from recursive rendering.
         static $depth = 0;
         $depth++;
         if ($depth > 20) {
-          throw new EntityReferenceRecursiveRenderingException(t('Recursive rendering detected when rendering entity @entity_type(@entity_id). Aborting rendering.', array('@entity_type' => $entity_type, '@entity_id' => $item['target_id'])));
+          throw new EntityReferenceRecursiveRenderingException(t('Recursive rendering detected when rendering entity @entity_type(@entity_id). Aborting rendering.', array('@entity_type' => $target_type, '@entity_id' => $item[$column])));
         }
 
         $target_entity = clone $item['entity'];
         unset($target_entity->content);
-        $result[$delta] = entity_view($field['settings']['target_type'], array($item['target_id'] => $target_entity), $settings['view_mode'], $target_langcode, FALSE);
+        $result[$delta] = entity_view($target_type, array($item[$column] => $target_entity), $settings['view_mode'], $target_langcode, FALSE);
 
-        if (empty($settings['links']) && isset($result[$delta][$field['settings']['target_type']][$item['target_id']]['links'])) {
-          $result[$delta][$field['settings']['target_type']][$item['target_id']]['links']['#access'] = FALSE;
+        if (empty($settings['links']) && isset($result[$delta][$target_type][$column]['links'])) {
+          $result[$delta][$target_type][$item[$column]]['links']['#access'] = FALSE;
         }
         $depth = 0;
       }
@@ -1308,3 +1442,44 @@ function entityreference_views_api() {
     'path' => drupal_get_path('module', 'entityreference') . '/views',
   );
 }
+
+/**
+ * Theme label.
+ *
+ * @ingroup themeable.
+ */
+function theme_entityreference_label($vars) {
+  $label = $vars['label'];
+  $settings = $vars['settings'];
+  $item = $vars['item'];
+  $uri = $vars['uri'];
+
+  $output = '';
+
+  // If the link is to be displayed and the entity has a uri, display a link.
+  // Note the assignment ($url = ) here is intended to be an assignment.
+  if ($settings['display']['link'] && isset($uri['path'])) {
+    $output .= l($label, $uri['path'], $uri['options']);
+  }
+  else {
+    $output .= check_plain($label);
+  }
+
+  return $output;
+}
+
+/**
+ * Theme entity_id
+ *
+ * @ingroup themeable.
+ */
+function theme_entityreference_entity_id($vars) {
+  $settings = $vars['settings'];
+  $item = $vars['item'];
+
+  $output = '';
+
+  $output = check_plain($item['target_id']);
+
+  return $output;
+}

+ 3 - 3
sites/all/modules/contrib/fields/entityreference/examples/entityreference_behavior_example/entityreference_behavior_example.info

@@ -4,9 +4,9 @@ core = 7.x
 package = Fields
 dependencies[] = entityreference
 
-; Information added by Drupal.org packaging script on 2016-09-19
-version = "7.x-1.2"
+; Information added by Drupal.org packaging script on 2017-08-16
+version = "7.x-1.5"
 core = "7.x"
 project = "entityreference"
-datestamp = "1474306740"
+datestamp = "1502895850"
 

+ 7 - 5
sites/all/modules/contrib/fields/entityreference/plugins/behavior/EntityReferenceBehavior_TaxonomyIndex.class.php

@@ -144,18 +144,20 @@ class EntityReferenceBehavior_TaxonomyIndex extends EntityReference_BehaviorHand
       // already inserted in taxonomy_build_node_index().
       $tid_all = array_diff($tid_all, $original_tid_all);
 
-      // Insert index entries for all the node's terms.
+      // Insert index entries for all the node's terms, preventing duplicates.
       if (!empty($tid_all)) {
-        $query = db_insert('taxonomy_index')->fields(array('nid', 'tid', 'sticky', 'created'));
         foreach ($tid_all as $tid) {
-          $query->values(array(
+          $row = array(
             'nid' => $node->nid,
             'tid' => $tid,
             'sticky' => $sticky,
             'created' => $node->created,
-          ));
+          );
+          $query = db_merge('taxonomy_index')
+            ->key($row)
+            ->fields($row);
+          $query->execute();
         }
-        $query->execute();
       }
     }
   }

+ 6 - 2
sites/all/modules/contrib/fields/entityreference/plugins/selection/EntityReference_SelectionHandler_Generic.class.php

@@ -208,7 +208,11 @@ class EntityReference_SelectionHandler_Generic implements EntityReference_Select
    * Implements EntityReferenceHandler::validateAutocompleteInput().
    */
   public function validateAutocompleteInput($input, &$element, &$form_state, $form) {
-      $entities = $this->getReferencableEntities($input, '=', 6);
+      $bundled_entities = $this->getReferencableEntities($input, '=', 6);
+      $entities = array();
+      foreach($bundled_entities as $entities_list) {
+        $entities += $entities_list;
+      }
       if (empty($entities)) {
         // Error if there are no entities available for a required field.
         form_error($element, t('There are no entities matching "%value"', array('%value' => $input)));
@@ -305,7 +309,7 @@ class EntityReference_SelectionHandler_Generic implements EntityReference_Select
    */
   public function getLabel($entity) {
     $target_type = $this->field['settings']['target_type'];
-    return entity_access('view', $target_type, $entity) ? entity_label($target_type, $entity) : t('- Restricted access -');
+    return entity_access('view', $target_type, $entity) ? entity_label($target_type, $entity) : t(ENTITYREFERENCE_DENIED);
   }
 
   /**

+ 69 - 5
sites/all/modules/contrib/fields/entityreference/plugins/selection/EntityReference_SelectionHandler_Views.class.php

@@ -9,12 +9,13 @@ class EntityReference_SelectionHandler_Views implements EntityReference_Selectio
    * Implements EntityReferenceHandler::getInstance().
    */
   public static function getInstance($field, $instance = NULL, $entity_type = NULL, $entity = NULL) {
-    return new EntityReference_SelectionHandler_Views($field, $instance);
+    return new EntityReference_SelectionHandler_Views($field, $instance, $entity);
   }
 
-  protected function __construct($field, $instance) {
+  protected function __construct($field, $instance, $entity) {
     $this->field = $field;
     $this->instance = $instance;
+    $this->entity = $entity;
   }
 
   /**
@@ -52,13 +53,32 @@ class EntityReference_SelectionHandler_Views implements EntityReference_Selectio
       );
 
       $default = !empty($view_settings['args']) ? implode(', ', $view_settings['args']) : '';
+      $description = t('Provide a comma separated list of arguments to pass to the view.') . '<br />' . t('This field supports tokens.');
+
+      if (!module_exists('token')) {
+        $description .= '<br>' . t('Install the <a href="@url">token module</a> to get more tokens and display available once.', array('@url' => 'http://drupal.org/project/token'));
+      }
+
       $form['view']['args'] = array(
         '#type' => 'textfield',
         '#title' => t('View arguments'),
         '#default_value' => $default,
         '#required' => FALSE,
-        '#description' => t('Provide a comma separated list of arguments to pass to the view.'),
+        '#description' => $description,
+        '#maxlength' => '512',
       );
+      if (module_exists('token')) {
+        // Get the token type for the entity type our field is in (a type 'taxonomy_term' has a 'term' type token).
+        $info = entity_get_info($instance['entity_type']);
+
+        $form['view']['tokens'] = array(
+          '#theme' => 'token_tree',
+          '#token_types' => array($info['token type']),
+          '#global_types' => TRUE,
+          '#click_insert' => TRUE,
+          '#dialog' => TRUE,
+        );
+      }
     }
     else {
       $form['view']['no_view_help'] = array(
@@ -84,6 +104,7 @@ class EntityReference_SelectionHandler_Views implements EntityReference_Selectio
       return FALSE;
     }
     $this->view->set_display($display_name);
+    $this->view->pre_execute();
 
     // Make sure the query is not cached.
     $this->view->is_cacheable = FALSE;
@@ -104,7 +125,7 @@ class EntityReference_SelectionHandler_Views implements EntityReference_Selectio
    */
   public function getReferencableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) {
     $display_name = $this->field['settings']['handler_settings']['view']['display_name'];
-    $args = $this->field['settings']['handler_settings']['view']['args'];
+    $args = $this->handleArgs($this->field['settings']['handler_settings']['view']['args']);
     $result = array();
     if ($this->initializeView($match, $match_operator, $limit)) {
       // Get the results.
@@ -133,7 +154,7 @@ class EntityReference_SelectionHandler_Views implements EntityReference_Selectio
 
   function validateReferencableEntities(array $ids) {
     $display_name = $this->field['settings']['handler_settings']['view']['display_name'];
-    $args = $this->field['settings']['handler_settings']['view']['args'];
+    $args = $this->handleArgs($this->field['settings']['handler_settings']['view']['args']);
     $result = array();
     if ($this->initializeView(NULL, 'CONTAINS', 0, $ids)) {
       // Get the results.
@@ -166,6 +187,49 @@ class EntityReference_SelectionHandler_Views implements EntityReference_Selectio
 
   }
 
+  /**
+   * Handles arguments for views.
+   *
+   * Replaces tokens using token_replace().
+   *
+   * @param array $args
+   *   Usually $this->field['settings']['handler_settings']['view']['args'].
+   *
+   * @return array
+   *   The arguments to be send to the View.
+   */
+  protected function handleArgs($args) {
+    if (!module_exists('token')) {
+      return $args;
+    }
+
+    // Parameters for token_replace().
+    $data = array();
+    $options = array('clear' => TRUE);
+
+    if ($entity = $this->entity) {
+      // D7 HACK: For new entities, entity and revision id are not set. This leads to
+      // * token replacement emitting PHP warnings
+      // * views choking on empty arguments
+      // We workaround this by filling in '0' for these IDs
+      // and use a clone to leave no traces of our unholy doings.
+      $info = entity_get_info($this->instance['entity_type']);
+      if (!isset($entity->{$info['entity keys']['id']})) {
+        $entity = clone $entity;
+        $entity->{$info['entity keys']['id']} = '0';
+        if (!empty($info['entity keys']['revision'])) {
+          $entity->{$info['entity keys']['revision']} = '0';
+        }
+      }
+
+      $data[$info['token type']] = $entity;
+    }
+    // Replace tokens for each argument.
+    foreach ($args as $key => $arg) {
+      $args[$key] = token_replace($arg, $data, $options);
+    }
+    return $args;
+  }
 }
 
 function entityreference_view_settings_validate($element, &$form_state, $form) {

+ 3 - 2
sites/all/modules/contrib/fields/entityreference/plugins/selection/abstract.inc

@@ -21,8 +21,9 @@ interface EntityReference_SelectionHandler {
    * Return a list of referencable entities.
    *
    * @return
-   *   An array of referencable entities, which keys are entity ids and
-   *   values (safe HTML) labels to be displayed to the user.
+   *   A nested array of entities, the first level is keyed by the
+   *   entity bundle, which contains an array of entity labels (safe HTML),
+   *   keyed by the entity ID.
    */
   public function getReferencableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0);
 

+ 1 - 1
sites/all/modules/contrib/fields/entityreference/tests/entityreference.admin.test

@@ -68,7 +68,7 @@ class EntityReferenceAdminTestCase extends DrupalWebTestCase {
       'fields[_add_new_field][type]' => 'entityreference',
       'fields[_add_new_field][widget_type]' => 'entityreference_autocomplete',
     ), t('Save'));
-    return;
+
     // Node should be selected by default.
     $this->assertFieldByName('field[settings][target_type]', 'node');
     // The base handler should be selected by default.

+ 16 - 1
sites/all/modules/contrib/fields/entityreference/tests/entityreference.handlers.test

@@ -194,6 +194,21 @@ class EntityReferenceHandlersTestCase extends DrupalWebTestCase {
       ),
     );
     $this->assertReferencable($field, $referencable_tests, 'Node handler (admin)');
+
+    // Verify autocomplete input validation.
+    $handler = entityreference_get_selection_handler($field);
+    $element = array(
+      '#parents' => array('element_name'),
+    );
+    $form_state = array();
+    $form = array();
+    $value = $handler->validateAutocompleteInput($nodes['published1']->title, $element, $form_state, $form);
+    $this->assertEqual($value, $nodes['published1']->nid);
+
+    $invalid_input = $this->randomName();
+    $value = $handler->validateAutocompleteInput($invalid_input, $element, $form_state, $form);
+    $this->assertNull($value);
+    $this->assertEqual(form_get_error($element), t('There are no entities matching "%value"', array('%value' => $invalid_input)));
   }
 
   /**
@@ -256,7 +271,7 @@ class EntityReferenceHandlersTestCase extends DrupalWebTestCase {
         ),
         'result' => array(
           'user' => array(
-            $users['admin']->uid => '- Restricted access -',
+            $users['admin']->uid => ENTITYREFERENCE_DENIED,
             $users['non_admin']->uid => $user_labels['non_admin'],
           ),
         ),

+ 48 - 0
sites/all/modules/contrib/fields/entityreference/tests/entityreference.taxonomy.test

@@ -112,4 +112,52 @@ class EntityReferenceTaxonomyTestCase extends DrupalWebTestCase {
     $this->assertFalse(taxonomy_select_nodes(1));
   }
 
+  /**
+   * Add a second ER field from node/article to taxonomy.
+   *
+   * This should not cause {taxonomy_index} to receive duplicate entries.
+   */
+  protected function setupForIndexDuplicates() {
+    // Create an entity reference field.
+    $field = array(
+      'entity_types' => array('node'),
+      'settings' => array(
+        'handler' => 'base',
+        'target_type' => 'taxonomy_term',
+        'handler_settings' => array(
+          'target_bundles' => array(),
+        ),
+      ),
+      'field_name' => 'field_entityreference_term2',
+      'type' => 'entityreference',
+    );
+    $field = field_create_field($field);
+    $instance = array(
+      'field_name' => 'field_entityreference_term2',
+      'bundle' => 'article',
+      'entity_type' => 'node',
+    );
+
+    // Enable the taxonomy-index behavior.
+    $instance['settings']['behaviors']['taxonomy-index']['status'] = TRUE;
+    field_create_instance($instance);
+  }
+
+  /**
+   * Make sure the index only contains one entry for a given node->term
+   * reference, even when multiple ER fields link from the node bundle to terms.
+   */
+  public function testIndexDuplicates() {
+    // Extra setup for this test: add another ER field on this content type.
+    $this->setupForIndexDuplicates();
+
+    // Assert node insert with reference to term in first field.
+    $tid = 1;
+    $settings = array();
+    $settings['type'] = 'article';
+    $settings['field_entityreference_term'][LANGUAGE_NONE][0]['target_id'] = $tid;
+    $node = $this->drupalCreateNode($settings);
+
+    $this->assertEqual(taxonomy_select_nodes($tid), array($node->nid));
+  }
 }

+ 3 - 3
sites/all/modules/contrib/fields/entityreference/tests/modules/entityreference_feeds_test/entityreference_feeds_test.info

@@ -8,9 +8,9 @@ dependencies[] = feeds
 dependencies[] = feeds_ui
 dependencies[] = entityreference
 
-; Information added by Drupal.org packaging script on 2016-09-19
-version = "7.x-1.2"
+; Information added by Drupal.org packaging script on 2017-08-16
+version = "7.x-1.5"
 core = "7.x"
 project = "entityreference"
-datestamp = "1474306740"
+datestamp = "1502895850"
 

+ 3 - 2
sites/all/modules/contrib/fields/entityreference/views/entityreference_plugin_display.inc

@@ -81,8 +81,9 @@ class entityreference_plugin_display extends views_plugin_display {
             $field = $this->view->query->fields[$this->view->field[$field_alias]->field_alias];
           }
           else {
-            $this->view->query->add_field($this->view->field[$field_alias]->options['table'], $this->view->field[$field_alias]->real_field, $this->view->field[$field_alias]->options['field'], array());
-            $field = $this->view->query->fields[$this->view->field[$field_alias]->options['field']];
+            $field_table = $this->view->query->ensure_table($this->view->field[$field_alias]->table, $this->view->field[$field_alias]->relationship);
+            $this->view->query->add_field($field_table, $this->view->field[$field_alias]->real_field, $this->view->field[$field_alias]->field, array());
+            $field = $this->view->query->fields[$this->view->field[$field_alias]->field];
           }
           // Add an OR condition for the field
           $conditions->condition($field['table'] . '.' . $field['field'], $value, 'LIKE');

+ 1 - 1
sites/all/modules/contrib/fields/entityreference/views/entityreference_plugin_style.inc

@@ -26,7 +26,7 @@ class entityreference_plugin_style extends views_plugin_style {
         '#title' => t('Search fields'),
         '#options' => $options,
         '#required' => TRUE,
-        '#default_value' => $this->options['search_fields'],
+        '#default_value' => isset($this->options['search_fields']) ? $this->options['search_fields'] : array(),
         '#description' => t('Select the field(s) that will be searched when using the autocomplete widget.'),
         '#weight' => -3,
       );

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 2
sites/all/modules/contrib/fields/link/README.txt


+ 0 - 1
sites/all/modules/contrib/fields/link/link-rtl.css

@@ -1,7 +1,6 @@
 .link-field-column {
   float: right;
 }
-
 .link-field-column.link-field-url .form-text {
   direction: ltr;
   text-align: left;

+ 0 - 1
sites/all/modules/contrib/fields/link/link.css

@@ -2,7 +2,6 @@
   float: left;
   width: 48%;
 }
-
 .link-field-column .form-text {
   width: 95%;
 }

+ 2 - 2
sites/all/modules/contrib/fields/link/link.diff.inc

@@ -11,11 +11,11 @@
 function link_field_diff_view($items, $context) {
   $diff_items = array();
   foreach ($items as $delta => $item) {
-    if ($item['url'] && $item['title']) {
+    if ($item['url'] && isset($item['title'])) {
       $diff_items[$delta] = $item['title'] . ' (' . $item['url'] . ')';
     }
     else {
-      $diff_items[$delta] = $item['title'] . $item['url'];
+      $diff_items[$delta] = $item['url'];
     }
   }
   return $diff_items;

+ 3 - 5
sites/all/modules/contrib/fields/link/link.info

@@ -3,7 +3,6 @@ description = Defines simple link field types.
 core = 7.x
 package = Fields
 
-files[] = link.module
 files[] = link.migrate.inc
 
 ; Tests
@@ -19,9 +18,8 @@ files[] = tests/link.validate.test
 files[] = views/link_views_handler_argument_target.inc
 files[] = views/link_views_handler_filter_protocol.inc
 
-; Information added by Drupal.org packaging script on 2016-01-15
-version = "7.x-1.4"
+; Information added by Drupal.org packaging script on 2019-02-20
+version = "7.x-1.6"
 core = "7.x"
 project = "link"
-datestamp = "1452830642"
-
+datestamp = "1550680687"

+ 46 - 19
sites/all/modules/contrib/fields/link/link.install

@@ -6,10 +6,38 @@
  */
 
 /**
- * Upgrade notes:
- * Things we need to make sure work when upgrading from Drupal 6 to Drupal 7:
+ * Upgrade notes.
+ *
+ * Things we need to make sure work when upgrading from Drupal 6 to Drupal 7:.
  */
 
+/**
+ * Implements hook_uninstall().
+ */
+function link_install() {
+  // Notify the user they may want to install token.
+  if (!module_exists('token')) {
+    $t = get_t();
+    drupal_set_message($t('If you install the <a href="!url" target="blank">Token</a>, static title can use any other entity field as its value.', array(
+      '!url' => 'http://drupal.org/project/token',
+    )));
+  }
+}
+
+/**
+ * Removes unused link_extra_domains variable.
+ */
+function link_update_7002() {
+  variable_del('link_extra_domains');
+}
+
+/**
+ * Implements hook_uninstall().
+ */
+function link_uninstall() {
+  variable_del('link_allowed_domains');
+}
+
 /**
  * Implements hook_field_schema().
  */
@@ -46,19 +74,21 @@ function link_update_last_removed() {
 }
 
 /**
- * Handles moving settings data from field_config.data to field_config_instance.data.
+ * Implements hook_update_N().
+ *
+ * Handles moving settings data from field_config.data to
+ * field_config_instance.data.
  */
 function link_update_7000() {
-  
-  // For each field that is a link field, we need to copy the settings from the general field level down to the instance.
-  //$field_data = array();
+
+  // For each field that is a link field, we need to copy the settings from the
+  // general field level down to the instance.
   $result = db_query("SELECT id, field_name, data FROM {field_config} WHERE module = 'link' AND type = 'link_field'");
   foreach ($result as $field) {
-    $field_id = $field->id;
-    $name = $field->field_name;
+
     $field_data = unserialize($field->data);
-    
-    $instances = db_query("SELECT id, data FROM {field_config_instance} WHERE field_id = :field_id", array(':field_id' => $field_id));
+
+    $instances = db_query("SELECT id, data FROM {field_config_instance} WHERE field_id = :field_id", array(':field_id' => $field->id));
     foreach ($instances as $instance) {
       // If this field has been updated already, we want to skip it.
       $instance_data = unserialize($instance->data);
@@ -71,8 +101,8 @@ function link_update_7000() {
           }
         }
         if ($update_instance) {
-          // update the database.
-          $num_updated = db_update('field_config_instance')
+          // Update the database.
+          db_update('field_config_instance')
             ->fields(array('data' => serialize($instance_data)))
             ->condition('id', $instance->id)
             ->execute();
@@ -80,22 +110,19 @@ function link_update_7000() {
       }
     }
   }
-  
+
   return t("Instance settings have been set with the data from the field settings.");
 }
 
 /**
- * Renames all displays from foobar to link_foobar
+ * Renames all displays from foobar to link_foobar.
  */
 function link_update_7001() {
   // Update the display type for each link field type.
   $result = db_query("SELECT id, field_name, data FROM {field_config} WHERE module = 'link' AND type = 'link_field'");
   foreach ($result as $field) {
-    $field_id = $field->id;
-    $name = $field->field_name;
-    $field_data = unserialize($field->data);
-    
-    $instances = db_query("SELECT id, data FROM {field_config_instance} WHERE field_id = :field_id", array(':field_id' => $field_id));
+
+    $instances = db_query("SELECT id, data FROM {field_config_instance} WHERE field_id = :field_id", array(':field_id' => $field->id));
     foreach ($instances as $instance) {
       // If this field has been updated already, we want to skip it.
       $instance_data = unserialize($instance->data);

+ 37 - 11
sites/all/modules/contrib/fields/link/link.migrate.inc

@@ -11,11 +11,9 @@
  * $this->addFieldMapping('field_my_link', 'source_url');
  * $this->addFieldMapping('field_my_link:title', 'source_title');
  * $this->addFieldMapping('field_my_link:attributes', 'source_attributes');
- * @endcode
  *
- * With earlier versions of Migrate, you must pass an arguments array:
+ * # With earlier versions of Migrate, you must pass an arguments array:
  *
- * @code
  * $link_args = array(
  *   'title' => array('source_field' => 'source_title'),
  *   'attributes' => array('source_field' => 'source_attributes'),
@@ -25,6 +23,10 @@
  * @endcode
  */
 
+if (!class_exists('MigrateFieldHandler')) {
+  return;
+}
+
 /**
  * Implements hook_migrate_api().
  */
@@ -35,12 +37,20 @@ function link_migrate_api() {
   );
 }
 
+// @codingStandardsIgnoreLine
 class MigrateLinkFieldHandler extends MigrateFieldHandler {
+
+  /**
+   * Construct.
+   */
   public function __construct() {
     $this->registerTypes(array('link_field'));
   }
 
-  static function arguments($title = NULL, $attributes = NULL, $language = NULL) {
+  /**
+   * Arguments.
+   */
+  public static function arguments($title = NULL, $attributes = NULL, $language = NULL) {
     $arguments = array();
     if (!is_null($title)) {
       $arguments['title'] = $title;
@@ -57,16 +67,21 @@ class MigrateLinkFieldHandler extends MigrateFieldHandler {
   /**
    * Implementation of MigrateFieldHandler::fields().
    *
-   * @param $type
-   *  The field type.
-   * @param $instance
-   *  Instance info for the field.
+   * @param array $type
+   *   The field type.
+   * @param array $instance
+   *   Instance info for the field.
    * @param Migration $migration
-   *  The migration context for the parent field. We can look at the mappings
-   *  and determine which subfields are relevant.
+   *   The migration context for the parent field. We can look at the mappings
+   *   and determine which subfields are relevant.
+   *
    * @return array
+   *   Array with values.
+   *
+   * @codingStandardsIgnoreStart
    */
   public function fields($type, $instance, $migration = NULL) {
+    // @codingStandardsIgnoreEnd
     return array(
       'title' => t('Subfield: The link title attribute'),
       'attributes' => t('Subfield: The attributes for this link'),
@@ -74,6 +89,9 @@ class MigrateLinkFieldHandler extends MigrateFieldHandler {
     );
   }
 
+  /**
+   * Prepare.
+   */
   public function prepare($entity, array $field_info, array $instance, array $values) {
     if (isset($values['arguments'])) {
       $arguments = $values['arguments'];
@@ -105,9 +123,17 @@ class MigrateLinkFieldHandler extends MigrateFieldHandler {
         }
       }
       $item['url'] = $value;
-      $return[$language][$delta] = $item;
+
+      if (is_array($language)) {
+        $current_language = $language[$delta];
+      }
+      else {
+        $current_language = $language;
+      }
+      $return[$current_language][$delta] = $item;
     }
 
     return isset($return) ? $return : NULL;
   }
+
 }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 11 - 2
sites/all/modules/contrib/fields/link/link.module


+ 111 - 51
sites/all/modules/contrib/fields/link/tests/link.attribute.test

@@ -5,7 +5,11 @@
  * Basic simpletests to test options on link module.
  */
 
+/**
+ * Attribute Crud Test.
+ */
 class LinkAttributeCrudTest extends DrupalWebTestCase {
+
   private $zebra;
 
   protected $permissions = array(
@@ -19,6 +23,9 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     'access administration pages',
   );
 
+  /**
+   * Get Info.
+   */
   public static function getInfo() {
     return array(
       'name' => 'Link Attribute Tests',
@@ -27,14 +34,23 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     );
   }
 
-  function setup() {
+  /**
+   * Setup.
+   */
+  public function setup() {
     parent::setup('field_ui', 'link');
     $this->zebra = 0;
     // Create and login user.
-    $this->web_user = $this->drupalCreateUser(array('administer content types'));
+    $this->web_user = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer fields',
+    ));
     $this->drupalLogin($this->web_user);
   }
 
+  /**
+   * Create Link.
+   */
   protected function createLink($url, $title, $attributes = array()) {
     return array(
       'url' => $url,
@@ -43,20 +59,26 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     );
   }
 
+  /**
+   * Assert Link On Node.
+   */
   protected 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);
+      $message,
+      $group);
   }
 
   /**
-   * A simple test that just creates a new node type, adds a link field to it, creates a new node of that type, and makes sure
-   * that the node is being displayed.
+   * Test Basic.
+   *
+   * A simple test that just creates a new node type, adds a link field to it,
+   * creates a new node of that type, and makes sure that the node is being
+   * displayed.
    */
-  function testBasic() {
+  public function testBasic() {
     $content_type_friendly = $this->randomName(20);
     $content_type_machine = strtolower($this->randomName(10));
     $title = $this->randomName(20);
@@ -76,7 +98,7 @@ 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(
       'fields[_add_new_field][label]' => $single_field_name_friendly,
       'fields[_add_new_field][field_name]' => $single_field_name_machine,
@@ -101,7 +123,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->assertTrue($type_exists, 'The new content type has been created in the database.');
 
     $permission = 'create ' . $content_type_machine . ' content';
-    $permission_edit = 'edit ' . $content_type_machine . ' content';
+
     // Reset the permissions cache.
     $this->checkPermissions(array($permission), TRUE);
 
@@ -122,7 +144,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     );
 
     $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)));
+    $this->assertText(t('@content_type_friendly @title has been created', array(
+      '@content_type_friendly' => $content_type_friendly,
+      '@title' => $title,
+    )));
 
     $this->drupalGet('node/add/' . $content_type_machine);
 
@@ -135,12 +160,18 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
 
     // Now we can fill in the second item in the multivalue field and save.
     $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)));
+    $this->assertText(t('@content_type_friendly @title has been created', array(
+      '@content_type_friendly' => $content_type_friendly,
+      '@title' => $title,
+    )));
 
     $this->assertText('Display');
     $this->assertLinkByHref('http://www.example.com');
   }
 
+  /**
+   * Create Simple Link Field.
+   */
   protected function createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine) {
     $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/fields');
     $edit = array(
@@ -166,9 +197,11 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->assertTrue($type_exists, 'The new content type has been created in the database.');
   }
 
+  /**
+   * Create Node Type User.
+   */
   protected function createNodeTypeUser($content_type_machine) {
     $permission = 'create ' . $content_type_machine . ' content';
-    $permission_edit = 'edit ' . $content_type_machine . ' content';
     // Reset the permissions cache.
     $this->checkPermissions(array($permission), TRUE);
 
@@ -179,6 +212,9 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->drupalLogin($this->web_user);
   }
 
+  /**
+   * Create Node For Testing.
+   */
   protected function createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $title, $url, $node_title = '') {
     $this->drupalGet('node/add/' . $content_type_machine);
 
@@ -196,14 +232,17 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     }
 
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertText(t('@content_type_friendly @title has been created', array('@content_type_friendly' => $content_type_friendly, '@title' => $node_title)));
+    $this->assertText(t('@content_type_friendly @title has been created', array(
+      '@content_type_friendly' => $content_type_friendly,
+      '@title' => $node_title,
+    )));
 
   }
 
   /**
    * Test the link_plain formatter and it's output.
    */
-  function testFormatterPlain() {
+  public function testFormatterPlain() {
     $content_type_friendly = $this->randomName(20);
     $content_type_machine = strtolower($this->randomName(10));
 
@@ -215,7 +254,7 @@ 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;
+    // $single_field_name = 'field_'. $single_field_name_machine;.
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
@@ -227,7 +266,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->drupalPost(NULL, $edit, t('Save'));
 
     $this->createNodeTypeUser($content_type_machine);
-    
+
     $link_tests = array(
       'plain' => array(
         'text' => 'Display',
@@ -243,18 +282,21 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
       ),
     );
 
-    foreach ($link_tests as $key => $link_test) {
+    foreach ($link_tests as $link_test) {
       $link_text = $link_test['text'];
       $link_url = $link_test['url'];
       $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
-  
+
       $this->assertText($link_url);
       $this->assertNoText($link_text);
       $this->assertNoLinkByHref($link_url);
     }
   }
 
-  function testFormatterHost() {
+  /**
+   * Formatter Host.
+   */
+  public function testFormatterHost() {
     $content_type_friendly = $this->randomName(20);
     $content_type_machine = strtolower($this->randomName(10));
 
@@ -263,18 +305,17 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
       'name' => $content_type_friendly,
     ));
 
-
     // 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;
+    // $single_field_name = 'field_'. $single_field_name_machine;.
     $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_host',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_host',
     );
     $this->drupalPost(NULL, $edit, t('Save'));
 
@@ -289,7 +330,13 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->assertNoLinkByHref($link_url);
   }
 
-  function testFormatterURL() {
+  /**
+   * Formatter URL.
+   *
+   * @codingStandardsIgnoreStart
+   */
+  public function testFormatterURL() {
+    // @codingStandardsIgnoreEnd
     $content_type_friendly = $this->randomName(20);
     $content_type_machine = strtolower($this->randomName(10));
 
@@ -301,7 +348,7 @@ 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;
+    // $single_field_name = 'field_'. $single_field_name_machine;.
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
@@ -313,7 +360,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->drupalPost(NULL, $edit, t('Save'));
 
     $this->createNodeTypeUser($content_type_machine);
-    
+
     $link_tests = array(
       'plain' => array(
         'text' => 'Display',
@@ -329,17 +376,20 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
       ),
     );
 
-    foreach ($link_tests as $key => $link_test) {
+    foreach ($link_tests as $link_test) {
       $link_text = $link_test['text'];
       $link_url = $link_test['url'];
       $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
-  
+
       $this->assertNoText($link_text);
       $this->assertLinkByHref($link_url);
     }
   }
 
-  function testFormatterShort() {
+  /**
+   * Formatter Short.
+   */
+  public function testFormatterShort() {
     $content_type_friendly = $this->randomName(20);
     $content_type_machine = strtolower($this->randomName(10));
 
@@ -351,7 +401,7 @@ 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;
+    // $single_field_name = 'field_'. $single_field_name_machine;.
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
@@ -379,18 +429,21 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
       ),
     );
 
-    foreach ($link_tests as $key => $link_test) {
+    foreach ($link_tests as $link_test) {
       $link_text = $link_test['text'];
       $link_url = $link_test['url'];
       $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
-  
+
       $this->assertText('Link');
       $this->assertNoText($link_text);
       $this->assertLinkByHref($link_url);
     }
   }
 
-  function testFormatterLabel() {
+  /**
+   * Formatter Label.
+   */
+  public function testFormatterLabel() {
     $content_type_friendly = $this->randomName(20);
     $content_type_machine = strtolower($this->randomName(10));
 
@@ -402,7 +455,7 @@ 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;
+    // $single_field_name = 'field_'. $single_field_name_machine;.
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
@@ -430,18 +483,21 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
       ),
     );
 
-    foreach ($link_tests as $key => $link_test) {
+    foreach ($link_tests as $link_test) {
       $link_text = $link_test['text'];
-      $link_url = $link_test['url'];  
+      $link_url = $link_test['url'];
       $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
-  
+
       $this->assertNoText($link_text);
       $this->assertText($single_field_name_friendly);
       $this->assertLinkByHref($link_url);
     }
   }
 
-  function testFormatterSeparate() {
+  /**
+   * Formatter Separate.
+   */
+  public function testFormatterSeparate() {
     $content_type_friendly = $this->randomName(20);
     $content_type_machine = strtolower($this->randomName(10));
 
@@ -453,7 +509,7 @@ 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;
+    // $single_field_name = 'field_'. $single_field_name_machine;.
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
     // Okay, now we want to make sure this display is changed:
@@ -482,32 +538,35 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
       ),
     );
 
-    foreach ($link_tests as $key => $link_test) {
+    foreach ($link_tests as $link_test) {
       $link_text = $link_test['text'];
       $link_url = $link_test['url'];
       $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
-  
+
       $this->assertText($link_text);
       $this->assertLink($plain_url);
       $this->assertLinkByHref($link_url);
     }
   }
-  
-  function testFormatterPlainTitle() {
+
+  /**
+   * Formatter Plain Title.
+   */
+  public function testFormatterPlainTitle() {
     $content_type_friendly = $this->randomName(20);
     $content_type_machine = strtolower($this->randomName(10));
-    
+
     $this->drupalCreateContentType(array(
       'type' => $content_type_machine,
       'name' => $content_type_friendly,
     ));
-    
+
     // 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;
+    // $single_field_name = 'field_'. $single_field_name_machine;.
     $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');
     $edit = array(
@@ -515,15 +574,16 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
       'fields[field_' . $single_field_name_machine . '][type]' => 'link_title_plain',
     );
     $this->drupalPost(NULL, $edit, t('Save'));
-    
+
     $this->createNodeTypeUser($content_type_machine);
-    
+
     $link_text = 'Display';
     $link_url = 'http://www.example.com/';
     $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
-    
+
     $this->assertText($link_text);
     $this->assertNoText($link_url);
     $this->assertNoLinkByHref($link_url);
   }
+
 }

+ 27 - 7
sites/all/modules/contrib/fields/link/tests/link.crud.test

@@ -2,11 +2,20 @@
 
 /**
  * @file
- * Basic CRUD simpletests for the link module, based off of content.crud.test in CCK.
+ * File for Crud Tests.
+ *
+ * Basic CRUD simpletests for the link module, based off of content.crud.test in
+ * CCK.
  */
 
+/**
+ * Content Crud.
+ */
 class LinkContentCrudTest extends DrupalWebTestCase {
 
+  /**
+   * Get Info.
+   */
   public static function getInfo() {
     return array(
       'name' => 'Link CRUD - Basic API tests',
@@ -15,21 +24,31 @@ class LinkContentCrudTest extends DrupalWebTestCase {
     );
   }
 
-  function setUp() {
+  /**
+   * Setup.
+   */
+  public function setUp() {
     parent::setUp('field_ui', 'link');
   }
 
   /**
-   * All we're doing here is creating a content type, creating a simple link field
-   * on that content type.
+   * Create Field API.
+   *
+   * All we're doing here is creating a content type, creating a simple link
+   * field on that content type.
+   *
+   * @codingStandardsIgnoreStart
    */
-  function testLinkCreateFieldAPI() {
+  public function testLinkCreateFieldAPI() {
+    // @codingStandardsIgnoreEnd
     $content_type_friendly = $this->randomName(20);
     $content_type_machine = strtolower($this->randomName(10));
-    $title = $this->randomName(20);
 
     // Create and login user.
-    $this->web_user = $this->drupalCreateUser(array('administer content types'));
+    $this->web_user = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer fields',
+    ));
     $this->drupalLogin($this->web_user);
 
     $this->drupalGet('admin/structure/types');
@@ -69,4 +88,5 @@ class LinkContentCrudTest extends DrupalWebTestCase {
     $type_exists = db_query('SELECT 1 FROM {node_type} WHERE type = :type', array(':type' => $content_type_machine))->fetchField();
     $this->assertTrue($type_exists, 'The new content type has been created in the database.');
   }
+
 }

+ 130 - 66
sites/all/modules/contrib/fields/link/tests/link.crud_browser.test

@@ -6,25 +6,28 @@
  */
 
 /**
- * Testing that users can not input bad URLs or labels
+ * Testing that users can not input bad URLs or labels.
  */
 class LinkUITest extends DrupalWebTestcase {
 
   /**
-   * Link supposed to be good
+   * Link supposed to be good.
    */
   const LINK_INPUT_TYPE_GOOD = 0;
 
   /**
-   * Link supposed to have a bad title
+   * Link supposed to have a bad title.
    */
   const LINK_INPUT_TYPE_BAD_TITLE = 1;
 
   /**
-   * Link supposed to have a bad URL
+   * Link supposed to have a bad URL.
    */
   const LINK_INPUT_TYPE_BAD_URL = 2;
 
+  /**
+   * Get Info.
+   */
   public static function getInfo() {
     return array(
       'name' => 'Link CRUD - browser test',
@@ -33,26 +36,30 @@ class LinkUITest extends DrupalWebTestcase {
     );
   }
 
-  function setUp() {
+  /**
+   * Setup.
+   */
+  public function setUp() {
     parent::setUp('field_ui', 'link');
   }
 
   /**
    * Creates a link field for the "page" type and creates a page with a link.
    */
-  function testLinkCreate() {
-    //libxml_use_internal_errors(true);
+  public function testLinkCreate() {
+    // libxml_use_internal_errors(true);
     $this->web_user = $this->drupalCreateUser(array(
       'administer content types',
+      'administer fields',
       'administer nodes',
       'administer filters',
       'access content',
       'create page content',
-      'access administration pages'
+      'access administration pages',
     ));
     $this->drupalLogin($this->web_user);
 
-    // create field
+    // Create field.
     $name = strtolower($this->randomName());
     $edit = array(
       'fields[_add_new_field][label]' => $name,
@@ -72,8 +79,8 @@ class LinkUITest extends DrupalWebTestcase {
     $permission = 'create page content';
     $this->checkPermissions(array($permission), TRUE);
 
-    // create page form
-    //$this->drupalGet('node/add');
+    // Create page form
+    // $this->drupalGet('node/add');.
     $this->drupalGet('node/add/page');
     $field_name = 'field_' . $name;
     $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found');
@@ -84,37 +91,37 @@ class LinkUITest extends DrupalWebTestcase {
         'href' => 'http://example.com/' . $this->randomName(),
         'label' => $this->randomName(),
         'msg' => 'Link found',
-        'type' => self::LINK_INPUT_TYPE_GOOD
+        'type' => self::LINK_INPUT_TYPE_GOOD,
       ),
       array(
         'href' => 'http://example.com/' . $this->randomName(),
         'label' => $this->randomName() . '<script>alert("hi");</script>',
         'msg' => 'js label',
-        'type' => self::LINK_INPUT_TYPE_BAD_TITLE
+        'type' => self::LINK_INPUT_TYPE_BAD_TITLE,
       ),
       array(
         'href' => 'http://example.com/' . $this->randomName(),
         'label' => $this->randomName() . '<script src="http://devil.site.com"></script>',
         'msg' => 'js label',
-        'type' => self::LINK_INPUT_TYPE_BAD_TITLE
+        'type' => self::LINK_INPUT_TYPE_BAD_TITLE,
       ),
       array(
         'href' => 'http://example.com/' . $this->randomName(),
         'label' => $this->randomName() . '" onmouseover="alert(\'hi\')',
         'msg' => 'js label',
-        'type' => self::LINK_INPUT_TYPE_BAD_TITLE
+        'type' => self::LINK_INPUT_TYPE_BAD_TITLE,
       ),
       array(
         'href' => 'http://example.com/' . $this->randomName(),
         'label' => $this->randomName() . '\' onmouseover="alert(\'hi\')',
         'msg' => 'js label',
-        'type' => self::LINK_INPUT_TYPE_BAD_TITLE
+        'type' => self::LINK_INPUT_TYPE_BAD_TITLE,
       ),
       array(
         'href' => 'javascript:alert("http://example.com/' . $this->randomName() . '")',
         'label' => $this->randomName(),
         'msg' => 'js url',
-        'type' => self::LINK_INPUT_TYPE_BAD_URL
+        'type' => self::LINK_INPUT_TYPE_BAD_URL,
       ),
       array(
         'href' => 'http://ecs-es.kelkoo.es/ctl/go/sitesearchGo?.ts=1338833010331&.sig=qP9GXeEFH6syBzwmzYkxmsvp1EI-',
@@ -143,23 +150,26 @@ class LinkUITest extends DrupalWebTestcase {
       );
       $this->drupalPost(NULL, $edit, t('Save'));
       if ($input['type'] == self::LINK_INPUT_TYPE_BAD_URL) {
-        $this->assertRaw(t('The value %value provided for %field is not a valid URL.', array('%field' => $name, '%value' => trim($input['href']))), 'Not a valid URL: ' . $input['href']);
+        $this->assertRaw(t('The value %value provided for %field is not a valid URL.', array(
+          '%field' => $name,
+          '%value' => trim($input['href']),
+        )), 'Not a valid URL: ' . $input['href']);
         continue;
       }
       else {
         $this->assertRaw(' ' . t('has been created.',
-                           array('@type' => 'Basic Page', '%title' => $edit['title'])),
-                         'Page created: ' . $input['href']);
+            array('@type' => 'Basic Page', '%title' => $edit['title'])),
+          'Page created: ' . $input['href']);
       }
       $url = $this->getUrl();
 
-      // change to Anonymous user.
+      // Change to Anonymous user.
       $this->drupalLogout();
 
       $this->drupalGet($url);
-      //debug($this);
-      // If simpletest starts using something to override the error system, this will flag
-      // us and let us know it's broken.
+      // debug($this);
+      // If simpletest starts using something to override the error system, this
+      // will flag 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'] . '"]';
@@ -171,18 +181,27 @@ class LinkUITest extends DrupalWebTestcase {
       libxml_use_internal_errors(FALSE);
       $this->assertIdentical(isset($elements[0]), $input['type'] == self::LINK_INPUT_TYPE_GOOD, $input['msg']);
     }
-    //libxml_use_internal_errors(FALSE);
+    // libxml_use_internal_errors(FALSE);
   }
 
   /**
+   * Static Link Create.
+   *
    * Testing that if you use <strong> in a static title for your link, that the
    * title actually displays <strong>.
    */
-  function testStaticLinkCreate() {
-    $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content'));
+  public function testStaticLinkCreate() {
+
+    $this->web_user = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer fields',
+      'access content',
+      'create page content',
+    ));
+
     $this->drupalLogin($this->web_user);
 
-    // create field
+    // Create field.
     $name = strtolower($this->randomName());
     $field_name = 'field_' . $name;
     $edit = array(
@@ -195,17 +214,18 @@ 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');
 
-    // create page form
+    // Create page form.
     $this->drupalGet('node/add/page');
     $this->assertField($field_name . '[und][0][url]', 'URL found');
 
     $input = array(
-      'href' => 'http://example.com/' . $this->randomName()
+      'href' => 'http://example.com/' . $this->randomName(),
     );
 
     $edit = array(
@@ -216,21 +236,32 @@ class LinkUITest extends DrupalWebTestcase {
 
     $url = $this->getUrl();
 
-    // change to anonymous user
+    // Change to anonymous user.
     $this->drupalLogout();
     $this->drupalGet($url);
 
     $this->assertRaw(l('<strong>' . $name . '</strong>', $input['href'], array('html' => TRUE)));
   }
-  
+
   /**
-   * Testing that if you have the title but no url, the title is not sanitized twice.
+   * CRUD Title Only Title No Link.
+   *
+   * Testing that if you have the title but no url, the title is not sanitized
+   * twice.
+   *
+   * @codingStandardsIgnoreStart
    */
-  function testCRUDTitleOnlyTitleNoLink() {
-    $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content'));
+  public function testCRUDTitleOnlyTitleNoLink() {
+    // @codingStandardsIgnoreEnd
+    $this->web_user = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer fields',
+      'access content',
+      'create page content',
+    ));
     $this->drupalLogin($this->web_user);
 
-    // create field
+    // Create field.
     $name = strtolower($this->randomName());
     $field_name = 'field_' . $name;
     $edit = array(
@@ -247,8 +278,8 @@ class LinkUITest extends DrupalWebTestcase {
 
     // Is field created?
     $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');
-    
-    // create page form
+
+    // Create page form.
     $this->drupalGet('node/add/page');
     $this->assertField($field_name . '[und][0][url]', 'URL found');
 
@@ -265,8 +296,8 @@ class LinkUITest extends DrupalWebTestcase {
     $this->drupalPost(NULL, $edit, t('Save'));
 
     $url = $this->getUrl();
-    
-    // change to anonymous user
+
+    // Change to anonymous user.
     $this->drupalLogout();
     $this->drupalGet($url);
 
@@ -274,14 +305,26 @@ class LinkUITest extends DrupalWebTestcase {
   }
 
   /**
-   * If we're creating a new field and just hit 'save' on the default options, we want to make
-   * sure they are set to the expected results.
+   * CRUD Create Field Defaults.
+   *
+   * If we're creating a new field and just hit 'save' on the default options,
+   * we want to make sure they are set to the expected results.
+   *
+   * @codingStandardsIgnoreStart
    */
-  function testCRUDCreateFieldDefaults() {
-    $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content'));
+  public function testCRUDCreateFieldDefaults() {
+    // @codingStandardsIgnoreEnd
+
+    $this->web_user = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer fields',
+      'access content',
+      'create page content',
+    ));
+
     $this->drupalLogin($this->web_user);
 
-    // create field
+    // Create field.
     $name = strtolower($this->randomName());
     $edit = array(
       'fields[_add_new_field][label]' => $name,
@@ -312,16 +355,26 @@ class LinkUITest extends DrupalWebTestcase {
     $this->assertFalse($instance['settings']['attributes']['class'], 'By default, no class should be set.');
     $this->assertFalse($instance['settings']['title_value'], 'By default, no title should be set.');
   }
-  
+
   /**
-   * If we're creating a new field and just hit 'save' on the default options, we want to make
-   * sure they are set to the expected results.
+   * CRUD Create Field With Class.
+   *
+   * If we're creating a new field and just hit 'save' on the default options,
+   * we want to make sure they are set to the expected results.
+   *
+   * @codingStandardsIgnoreStart
    */
-  function testCRUDCreateFieldWithClass() {
-    $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content'));
+  public function testCRUDCreateFieldWithClass() {
+    // @codingStandardsIgnoreEnd
+    $this->web_user = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer fields',
+      'access content',
+      'create page content',
+    ));
     $this->drupalLogin($this->web_user);
 
-    // create field
+    // Create field.
     $name = strtolower($this->randomName());
     $edit = array(
       'fields[_add_new_field][label]' => $name,
@@ -356,9 +409,9 @@ class LinkUITest extends DrupalWebTestcase {
     $this->assertFalse($instance['settings']['attributes']['rel'], 'Rel should be blank by default.');
     $this->assertEqual($instance['settings']['attributes']['class'], $link_class_name, 'One class should be set.');
     $this->assertFalse($instance['settings']['title_value'], 'By default, no title should be set.');
-    
+
     // Now, let's create a node with this field and make sure the link shows up:
-    // create page form
+    // create page form.
     $field_name = 'field_' . $name;
     $this->drupalGet('node/add/page');
     $this->assertField($field_name . '[und][0][url]', 'URL found');
@@ -376,8 +429,8 @@ class LinkUITest extends DrupalWebTestcase {
     $this->drupalPost(NULL, $edit, t('Save'));
 
     $url = $this->getUrl();
-    
-    // change to anonymous user
+
+    // Change to anonymous user.
     $this->drupalLogout();
     $this->drupalGet($url);
 
@@ -385,15 +438,25 @@ class LinkUITest extends DrupalWebTestcase {
     $this->assertPattern('|class\s?=\s?"' . $link_class_name . '"|', "Class $link_class_name exists on page.");
   }
 
-/**
-   * If we're creating a new field and just hit 'save' on the default options, we want to make
-   * sure they are set to the expected results.
+  /**
+   * CRUD Create Field With Two Classes.
+   *
+   * If we're creating a new field and just hit 'save' on the default options,
+   * we want to make sure they are set to the expected results.
+   *
+   * @codingStandardsIgnoreStart
    */
-  function testCRUDCreateFieldWithTwoClasses() {
-    $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content'));
+  public function testCRUDCreateFieldWithTwoClasses() {
+    // @codingStandardsIgnoreEnd
+    $this->web_user = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer fields',
+      'access content',
+      'create page content',
+    ));
     $this->drupalLogin($this->web_user);
 
-    // create field
+    // Create field.
     $name = strtolower($this->randomName());
     $edit = array(
       'fields[_add_new_field][label]' => $name,
@@ -428,9 +491,9 @@ class LinkUITest extends DrupalWebTestcase {
     $this->assertFalse($instance['settings']['attributes']['rel'], 'Rel should be blank by default.');
     $this->assertEqual($instance['settings']['attributes']['class'], $link_class_name, 'Two classes should be set.');
     $this->assertFalse($instance['settings']['title_value'], 'By default, no title should be set.');
-    
+
     // Now, let's create a node with this field and make sure the link shows up:
-    // create page form
+    // create page form.
     $field_name = 'field_' . $name;
     $this->drupalGet('node/add/page');
     $this->assertField($field_name . '[und][0][url]', 'URL found');
@@ -448,12 +511,13 @@ class LinkUITest extends DrupalWebTestcase {
     $this->drupalPost(NULL, $edit, t('Save'));
 
     $url = $this->getUrl();
-    
-    // change to anonymous user
+
+    // Change to anonymous user.
     $this->drupalLogout();
     $this->drupalGet($url);
 
     $this->assertRaw('This &amp; That');
     $this->assertPattern('|class\s?=\s?"' . $link_class_name . '"|', "Classes $link_class_name exist on page.");
   }
+
 }

+ 38 - 29
sites/all/modules/contrib/fields/link/tests/link.entity_token.test

@@ -6,10 +6,13 @@
  */
 
 /**
- * Testing that tokens can be used in link titles
+ * Testing that tokens can be used in link titles.
  */
 class LinkEntityTokenTest extends LinkBaseTestClass {
 
+  /**
+   * Get Info.
+   */
   public static function getInfo() {
     return array(
       'name' => 'Link entity tokens test',
@@ -19,24 +22,27 @@ class LinkEntityTokenTest extends LinkBaseTestClass {
     );
   }
 
-  function setUp($modules = array()) {
+  /**
+   * Setup.
+   */
+  public function setUp($modules = array()) {
     parent::setUp(array('token', 'entity', 'entity_token'));
   }
-  
+
   /**
    * Creates a link field, fills it, then uses a loaded node to test tokens.
    */
-  function testFieldTokenNodeLoaded() {
-    // create field
+  public function testFieldTokenNodeLoaded() {
+    // Create field.
     $settings = array(
       'instance[settings][enable_tokens]' => 0,
     );
     $field_name = $this->createLinkField('page',
-                                        $settings);
+      $settings);
 
-    // create page form
+    // Create page form.
     $this->drupalGet('node/add/page');
-    //$field_name = 'field_' . $name;
+    // $field_name = 'field_' . $name;.
     $this->assertField($field_name . '[und][0][title]', 'Title found');
     $this->assertField($field_name . '[und][0][url]', 'URL found');
 
@@ -58,11 +64,11 @@ class LinkEntityTokenTest extends LinkBaseTestClass {
         'label' => $this->randomName(),
       ),
     );
-    //$this->assert('pass', '<pre>' . print_r($token_url_tests, TRUE) . '<pre>');
-
+    // @codingStandardsIgnoreLine
+    // $this->assert('pass', '<pre>' . print_r($token_url_tests, TRUE) . '<pre>');.
     foreach ($token_url_tests as &$input) {
       $this->drupalGet('node/add/page');
-  
+
       $edit = array(
         'title' => $input['label'],
         $field_name . '[und][0][title]' => $input['label'],
@@ -73,34 +79,37 @@ class LinkEntityTokenTest extends LinkBaseTestClass {
       $input['url'] = $url;
     }
 
-    // change to anonymous user
+    // Change to anonymous user.
     $this->drupalLogout();
-    
+
     foreach ($token_url_tests as $index => $input2) {
       $node = node_load($index);
       $this->assertNotEqual(NULL, $node, "Do we have a node?");
       $this->assertEqual($node->nid, $index, "Test that we have a node.");
       $token_name = '[node:' . str_replace('_', '-', $field_name) . ':url]';
       $assert_data = token_replace($token_name,
-                      array('node' => $node));
+        array('node' => $node));
       $this->assertEqual($input2['href'], $assert_data, "Test that the url token has been set to " . $input2['href'] . ' - ' . $assert_data);
     }
   }
-  
+
   /**
-   * Creates a link field, fills it, then uses a loaded and node_view'd node to test tokens.
+   * Field Token Node Viewed.
+   *
+   * Creates a link field, fills it, then uses a loaded and node_view'd node to
+   * test tokens.
    */
-  function testFieldTokenNodeViewed() {
-    // create field
+  public function testFieldTokenNodeViewed() {
+    // Create field.
     $settings = array(
       'instance[settings][enable_tokens]' => 0,
     );
     $field_name = $this->createLinkField('page',
-                                        $settings);
+      $settings);
 
-    // create page form
+    // Create page form.
     $this->drupalGet('node/add/page');
-    //$field_name = 'field_' . $name;
+    // $field_name = 'field_' . $name;.
     $this->assertField($field_name . '[und][0][title]', 'Title found');
     $this->assertField($field_name . '[und][0][url]', 'URL found');
 
@@ -122,11 +131,12 @@ class LinkEntityTokenTest extends LinkBaseTestClass {
         'label' => $this->randomName(),
       ),
     );
-    //$this->assert('pass', '<pre>' . print_r($token_url_tests, TRUE) . '<pre>');
 
+    //@codingStandardsIgnoreLine
+    // $this->assert('pass', '<pre>' . print_r($token_url_tests, TRUE) . '<pre>');.
     foreach ($token_url_tests as &$input) {
       $this->drupalGet('node/add/page');
-  
+
       $edit = array(
         'title' => $input['label'],
         $field_name . '[und][0][title]' => $input['label'],
@@ -137,19 +147,18 @@ class LinkEntityTokenTest extends LinkBaseTestClass {
       $input['url'] = $url;
     }
 
-    // change to anonymous user
+    // Change to anonymous user.
     $this->drupalLogout();
-    
+
     foreach ($token_url_tests as $index => $input2) {
       $node = node_load($index);
-      $node_array = node_view($node, 'full');
       $this->assertNotEqual(NULL, $node, "Do we have a node?");
       $this->assertEqual($node->nid, $index, "Test that we have a node.");
       $token_name = '[node:' . str_replace('_', '-', $field_name) . ':url]';
       $assert_data = token_replace($token_name,
-                      array('node' => $node));
+        array('node' => $node));
       $this->assertEqual($input2['href'], $assert_data, "Test that the url token has been set to " . $input2['href'] . ' - ' . $assert_data);
     }
   }
-  
-}
+
+}

+ 14 - 2
sites/all/modules/contrib/fields/link/tests/link.test

@@ -5,10 +5,15 @@
  * Link base test file - contains common functions for testing links.
  */
 
+/**
+ * Base Test Class.
+ */
 class LinkBaseTestClass extends DrupalWebTestCase {
+
   protected $permissions = array(
     'access content',
     'administer content types',
+    'administer fields',
     'administer nodes',
     'administer filters',
     'access comments',
@@ -17,17 +22,23 @@ class LinkBaseTestClass extends DrupalWebTestCase {
     'create page content',
   );
 
-  function setUp() {
+  /**
+   * Setup.
+   */
+  public function setUp() {
     $modules = func_get_args();
     $modules = (isset($modules[0]) && is_array($modules[0]) ? $modules[0] : $modules);
     $modules[] = 'field_ui';
     $modules[] = 'link';
     parent::setUp($modules);
-    
+
     $this->web_user = $this->drupalCreateUser($this->permissions);
     $this->drupalLogin($this->web_user);
   }
 
+  /**
+   * Create Link Field.
+   */
   protected function createLinkField($node_type = 'page', $settings = array()) {
     $name = strtolower($this->randomName());
     $edit = array(
@@ -48,4 +59,5 @@ class LinkBaseTestClass extends DrupalWebTestCase {
 
     return $field_name;
   }
+
 }

+ 141 - 92
sites/all/modules/contrib/fields/link/tests/link.token.test

@@ -6,10 +6,13 @@
  */
 
 /**
- * Testing that tokens can be used in link titles
+ * Testing that tokens can be used in link titles.
  */
 class LinkTokenTest extends LinkBaseTestClass {
 
+  /**
+   * Get Info.
+   */
   public static function getInfo() {
     return array(
       'name' => 'Link tokens - browser test',
@@ -19,34 +22,38 @@ class LinkTokenTest extends LinkBaseTestClass {
     );
   }
 
-  function setUp($modules = array()) {
+  /**
+   * Setup.
+   */
+  public function setUp($modules = array()) {
     parent::setUp(array('token'));
   }
 
   /**
    * Creates a link field with a required title enabled for user-entered tokens.
+   *
    * Creates a node with a token in the link title and checks the value.
    */
-  function testUserTokenLinkCreate() {
-    // create field
+  public function testUserTokenLinkCreate() {
+    // Create field.
     $settings = array(
       'instance[settings][enable_tokens]' => 1,
     );
     $field_name = $this->createLinkField('page',
-                                        $settings);
+      $settings);
 
-    // create page form
+    // Create page form.
     $this->drupalGet('node/add/page');
-    //$field_name = 'field_' . $name;
+    // $field_name = 'field_' . $name;.
     $this->assertField($field_name . '[und][0][title]', 'Title found');
     $this->assertField($field_name . '[und][0][url]', 'URL found');
 
     $input = array(
-        'href' => 'http://example.com/' . $this->randomName(),
-        'label' => $this->randomName(),
+      'href' => 'http://example.com/' . $this->randomName(),
+      'label' => $this->randomName(),
     );
 
-    //$this->drupalLogin($this->web_user);
+    // $this->drupalLogin($this->web_user);.
     $this->drupalGet('node/add/page');
 
     $edit = array(
@@ -57,36 +64,37 @@ class LinkTokenTest extends LinkBaseTestClass {
     $this->drupalPost(NULL, $edit, t('Save'));
     $url = $this->getUrl();
 
-    // change to anonymous user
+    // Change to anonymous user.
     $this->drupalLogout();
     $this->drupalGet($url);
 
     $this->assertRaw(l($input['label'] . ' page', $input['href']));
   }
 
-
   /**
    * Creates a link field with a static title and an admin-entered token.
+   *
    * Creates a node with a link and checks the title value.
    */
-  function testStaticTokenLinkCreate() {
+  public function testStaticTokenLinkCreate() {
 
-    // create field
+    // Create field.
     $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
+    // Create page form.
     $this->drupalGet('node/add/page');
     $this->assertField($field_name . '[und][0][url]', 'URL found');
 
     $input = array(
-      'href' => 'http://example.com/' . $this->randomName()
+      'href' => 'http://example.com/' . $this->randomName(),
     );
 
-    //$this->drupalLogin($this->web_user);
+    // $this->drupalLogin($this->web_user);.
     $this->drupalGet('node/add/page');
 
     $edit = array(
@@ -97,7 +105,7 @@ class LinkTokenTest extends LinkBaseTestClass {
 
     $url = $this->getUrl();
 
-    // change to anonymous user
+    // Change to anonymous user.
     $this->drupalLogout();
     $this->drupalGet($url);
 
@@ -106,30 +114,32 @@ class LinkTokenTest extends LinkBaseTestClass {
 
   /**
    * Creates a link field with a static title and an admin-entered token.
+   *
    * Creates a node with a link and checks the title value.
    *
    * Basically, I want to make sure the [title-raw] token works, because it's a
    * token that changes from node to node, where [type]'s always going to be the
    * same.
    */
-  function testStaticTokenLinkCreate2() {
+  public function testStaticTokenLinkCreate2() {
 
-    // create field
+    // Create field.
     $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
+    // Create page form.
     $this->drupalGet('node/add/page');
     $this->assertField($field_name . '[und][0][url]', 'URL found');
 
     $input = array(
-      'href' => 'http://example.com/' . $this->randomName()
+      'href' => 'http://example.com/' . $this->randomName(),
     );
 
-    //$this->drupalLogin($this->web_user);
+    // $this->drupalLogin($this->web_user);.
     $this->drupalGet('node/add/page');
 
     $edit = array(
@@ -140,27 +150,32 @@ class LinkTokenTest extends LinkBaseTestClass {
 
     $url = $this->getUrl();
 
-    // change to anonymous user
+    // Change to anonymous user.
     $this->drupalLogout();
     $this->drupalGet($url);
 
     $this->assertRaw(l($name . ' ' . $name, $input['href']));
   }
 
-  // This test doesn't seem to actually work, due to lack of 'title' in url.
-  function _test_Link_With_Title_Attribute_token_url_form() {
-   /* $this->loginWithPermissions($this->permissions);
+  /**
+   * This test doesn't seem to actually work, due to lack of 'title' in url.
+   *
+   * @codingStandardsIgnoreStart
+   */
+  public function _test_Link_With_Title_Attribute_token_url_form() {
+    // @codingStandardsIgnoreEnd
+    /* $this->loginWithPermissions($this->permissions);
     $this->acquireContentTypes(1);
     $field_settings = array(
-      'type' => 'link',
-      'widget_type' => 'link',
-      'type_name' => $this->content_types[0]->name,
-      'attributes' => array(
-        'class' => '',
-        'target' => 'default',
-        'rel' => 'nofollow',
-        'title' => '',
-      ),
+    'type' => 'link',
+    'widget_type' => 'link',
+    'type_name' => $this->content_types[0]->name,
+    'attributes' => array(
+    'class' => '',
+    'target' => 'default',
+    'rel' => 'nofollow',
+    'title' => '',
+    ),
     );
 
     $field = $this->createField($field_settings, 0);
@@ -170,10 +185,10 @@ class LinkTokenTest extends LinkBaseTestClass {
     $url_type = str_replace('_', '-', $this->content_types[0]->type);
 
     $edit = array('attributes[title]' => '['. $field_name .'-url]',
-                  'enable_tokens' => TRUE);
-
+    'enable_tokens' => TRUE);
+    // @codingStandardsIgnoreLine
     $this->drupalPost('admin/content/node-type/'. $url_type .'/fields/'. $field['field_name'],
-                      $edit, t('Save field settings'));
+    $edit, t('Save field settings'));
     $this->assertText(t('Saved field @field_name', array('@field_name' => $field['field_name'])));*/
     $name = $this->randomName();
     $settings = array(
@@ -183,12 +198,9 @@ class LinkTokenTest extends LinkBaseTestClass {
     $field_name = $this->createLinkField('page', $settings);
 
     // So, having saved this field_name, let's see if it works...
-    //$this->acquireNodes(1);
-
-    //$node = node_load($this->nodes[0]->nid);
-
-    //$this->drupalGet('node/'. $this->nodes[0]->nid);
-
+    // $this->acquireNodes(1);
+    // $node = node_load($this->nodes[0]->nid);
+    // $this->drupalGet('node/'. $this->nodes[0]->nid);.
     $edit = array();
     $test_link_url = 'http://www.example.com/test';
     $edit[$field_name . '[und][0][url]'] = $test_link_url;
@@ -200,23 +212,28 @@ class LinkTokenTest extends LinkBaseTestClass {
     $this->drupalPost(NULL, $edit, t('Save'));
 
     // Make sure we get a new version!
-    //$node = node_load($this->nodes[0]->nid, NULL, TRUE);
+    // $node = node_load($this->nodes[0]->nid, NULL, TRUE);.
     $this->assertText(t('Basic page @title has been updated.',
-                        array('@title' => $name)));
+      array('@title' => $name)));
 
-    //$this->drupalGet('node/'. $node->nid);
+    // $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->assertTrue(module_exists('token'), t('Assure that Token Module is enabled.'));
-    //$this->fail($this->content);
+    // $this->fail($this->content);.
   }
 
   /**
+   * Link With Title Attribute token title form.
+   *
    * If the title of the link is set to the title attribute, then the title
    * attribute isn't supposed to show.
+   *
+   * @codingStandardsIgnoreStart
    */
-  function _test_Link_With_Title_Attribute_token_title_form() {
+  public function _test_Link_With_Title_Attribute_token_title_form() {
+    // @codingStandardsIgnoreEnd
     $this->loginWithPermissions($this->permissions);
     $this->acquireContentTypes(1);
     $field_settings = array(
@@ -233,21 +250,20 @@ class LinkTokenTest extends LinkBaseTestClass {
 
     $field = $this->createField($field_settings, 0);
     $field_name = $field['field_name'];
-    $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'));
+      $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...
     $this->acquireNodes(1);
 
-    $node = node_load($this->nodes[0]->nid);
-
     $this->drupalGet('node/' . $this->nodes[0]->nid);
 
     $edit = array();
@@ -260,24 +276,35 @@ class LinkTokenTest extends LinkBaseTestClass {
     // Make sure we get a new version!
     $node = node_load($this->nodes[0]->nid, NULL, TRUE);
     $this->assertText(t('@type @title has been updated.',
-                        array('@title' => $node->title,
-                              '@type' => $this->content_types[0]->name)));
+      array(
+        '@title' => $node->title,
+        '@type' => $this->content_types[0]->name,
+      )));
 
     $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->fail($this->content);
+    // $this->fail($this->content);.
   }
 
   /**
-   *  Trying to set the url to contain a token.
+   * Trying to set the url to contain a token.
+   *
+   * @codingStandardsIgnoreStart
    */
-  function _testUserTokenLinkCreateInURL() {
-    $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content'));
+  public function _testUserTokenLinkCreateInURL() {
+    //@codingStandardsIgnoreEnd
+
+    $this->web_user = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer fields',
+      'access content',
+      'create page content',
+    ));
     $this->drupalLogin($this->web_user);
 
-    // create field
+    // Create field.
     $name = strtolower($this->randomName());
     $edit = array(
       '_add_new_field[label]' => $name,
@@ -288,20 +315,21 @@ class LinkTokenTest extends LinkBaseTestClass {
     $this->drupalPost('admin/content/node-type/page/fields', $edit, t('Save'));
     $this->drupalPost(NULL, array(
       'title' => 'required',
-      'enable_tokens' => 1), t('Save field settings'));
+      'enable_tokens' => 1,
+    ), t('Save field settings'));
 
     // Is field created?
     $this->assertRaw(t('Added field %label.', array('%label' => $name)), 'Field added');
 
-    // create page form
+    // Create page form.
     $this->drupalGet('node/add/page');
     $field_name = 'field_' . $name;
     $this->assertField($field_name . '[0][title]', 'Title found');
     $this->assertField($field_name . '[0][url]', 'URL found');
 
     $input = array(
-        'href' => 'http://example.com/' . $this->randomName(),
-        'label' => $this->randomName(),
+      'href' => 'http://example.com/' . $this->randomName(),
+      'label' => $this->randomName(),
     );
 
     $this->drupalLogin($this->web_user);
@@ -315,22 +343,31 @@ class LinkTokenTest extends LinkBaseTestClass {
     $this->drupalPost(NULL, $edit, t('Save'));
     $url = $this->getUrl();
 
-    // change to anonymous user
+    // Change to anonymous user.
     $this->drupalLogout();
     $this->drupalGet($url);
 
     $this->assertRaw(l($input['label'], $input['href'] . '/page'));
-    //$this->fail($this->content);
+    // $this->fail($this->content);.
   }
 
   /**
-   *  Trying to set the url to contain a token.
+   * Trying to set the url to contain a token.
+   *
+   * @codingStandardsIgnoreStart
    */
-  function _testUserTokenLinkCreateInURL2() {
-    $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content'));
+  public function _testUserTokenLinkCreateInURL2() {
+    // @codingStandardsIgnoreEnd
+
+    $this->web_user = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer fields',
+      'access content',
+      'create page content',
+    ));
     $this->drupalLogin($this->web_user);
 
-    // create field
+    // Create field.
     $name = strtolower($this->randomName());
     $edit = array(
       '_add_new_field[label]' => $name,
@@ -341,20 +378,21 @@ class LinkTokenTest extends LinkBaseTestClass {
     $this->drupalPost('admin/content/node-type/page/fields', $edit, t('Save'));
     $this->drupalPost(NULL, array(
       'title' => 'required',
-      'enable_tokens' => 1), t('Save field settings'));
+      'enable_tokens' => 1,
+    ), t('Save field settings'));
 
     // Is field created?
     $this->assertRaw(t('Added field %label.', array('%label' => $name)), 'Field added');
 
-    // create page form
+    // Create page form.
     $this->drupalGet('node/add/page');
     $field_name = 'field_' . $name;
     $this->assertField($field_name . '[0][title]', 'Title found');
     $this->assertField($field_name . '[0][url]', 'URL found');
 
     $input = array(
-        'href' => 'http://example.com/' . $this->randomName(),
-        'label' => $this->randomName(),
+      'href' => 'http://example.com/' . $this->randomName(),
+      'label' => $this->randomName(),
     );
 
     $this->drupalLogin($this->web_user);
@@ -368,22 +406,34 @@ class LinkTokenTest extends LinkBaseTestClass {
     $this->drupalPost(NULL, $edit, t('Save'));
     $url = $this->getUrl();
 
-    // change to anonymous user
+    // Change to anonymous user.
     $this->drupalLogout();
     $this->drupalGet($url);
 
     $this->assertRaw(l($input['label'], $input['href'] . '/' . $this->web_user->uid));
   }
-  
+
   /**
-   *  Test that if you have a title and no url on a field which does not have tokens enabled,
-   *  that the title is sanitized once.
+   * CRUD Title Only Title No Link.
+   *
+   * Test that if you have a title and no url on a field which does not have
+   * tokens enabled, that the title is sanitized once.
+   *
+   * @codingStandardsIgnoreStart
    */
-  function testCRUDTitleOnlyTitleNoLink2() {
-    $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content'));
+  public function testCRUDTitleOnlyTitleNoLink2() {
+    //@codingStandardsIgnoreEnd
+
+    $this->web_user = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer fields',
+      'access content',
+      'create page content',
+    ));
+
     $this->drupalLogin($this->web_user);
 
-    // create field
+    // Create field.
     $name = strtolower($this->randomName());
     $field_name = 'field_' . $name;
     $edit = array(
@@ -401,8 +451,8 @@ class LinkTokenTest extends LinkBaseTestClass {
 
     // Is field created?
     $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');
-    
-    // create page form
+
+    // Create page form.
     $this->drupalGet('node/add/page');
     $this->assertField($field_name . '[und][0][url]', 'URL found');
 
@@ -419,13 +469,12 @@ class LinkTokenTest extends LinkBaseTestClass {
     $this->drupalPost(NULL, $edit, t('Save'));
 
     $url = $this->getUrl();
-    
-    // change to anonymous user
+
+    // Change to anonymous user.
     $this->drupalLogout();
     $this->drupalGet($url);
 
     $this->assertRaw('This &amp; That');
   }
-  
-  
+
 }

+ 311 - 105
sites/all/modules/contrib/fields/link/tests/link.validate.test

@@ -5,8 +5,14 @@
  * Tests that exercise the validation functions in the link module.
  */
 
+/**
+ * Validate Test Case.
+ */
 class LinkValidateTestCase extends LinkBaseTestClass {
 
+  /**
+   * Create Link.
+   */
   protected function createLink($url, $title, $attributes = array()) {
     return array(
       'url' => $url,
@@ -17,8 +23,11 @@ class LinkValidateTestCase extends LinkBaseTestClass {
 
   /**
    * Takes a url, and sees if it can validate that the url is valid.
+   *
+   * @codingStandardsIgnoreStart
    */
   protected function link_test_validate_url($url) {
+    // @codingStandardsIgnoreEnd
 
     $field_name = $this->createLinkField();
 
@@ -26,11 +35,11 @@ class LinkValidateTestCase extends LinkBaseTestClass {
     $settings = array(
       'title' => $label,
       $field_name => array(
-        LANGUAGE_NONE=> array(
+        LANGUAGE_NONE => array(
           array(
             'title' => $label,
             'url' => $url,
-          )
+          ),
         ),
       ),
     );
@@ -41,10 +50,17 @@ class LinkValidateTestCase extends LinkBaseTestClass {
 
     $this->assertEqual($url, $node->{$field_name}[LANGUAGE_NONE][0]['url']);
   }
+
 }
 
+/**
+ * Class for Validate Test.
+ */
 class LinkValidateTest extends LinkValidateTestCase {
 
+  /**
+   * Get Info.
+   */
   public static function getInfo() {
     return array(
       'name' => 'Link Validation Tests',
@@ -53,23 +69,35 @@ class LinkValidateTest extends LinkValidateTestCase {
     );
   }
 
-  function test_link_validate_basic_url() {
+  /**
+   * Validate basic URL.
+   *
+   * @codingStandardsIgnoreStart
+   */
+  public function test_link_validate_basic_url() {
+    // @codingStandardsIgnoreEnd
     $this->link_test_validate_url('http://www.example.com');
   }
 
   /**
    * Test if we're stopped from posting a bad url on default validation.
+   *
+   * @codingStandardsIgnoreStart
    */
-  function test_link_validate_bad_url_validate_default() {
-    $this->web_user = $this->drupalCreateUser(array('administer content types',
-                                             'administer nodes',
-                                             'administer filters',
-                                             'access content',
-                                             'create page content',
-                                             'access administration pages'));
+  public function test_link_validate_bad_url_validate_default() {
+    // @codingStandardsIgnoreEnd
+    $this->web_user = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer fields',
+      'administer nodes',
+      'administer filters',
+      'access content',
+      'create page content',
+      'access administration pages',
+    ));
     $this->drupalLogin($this->web_user);
 
-    // create field
+    // Create field.
     $name = strtolower($this->randomName());
     $edit = array(
       'fields[_add_new_field][label]' => $name,
@@ -86,35 +114,43 @@ class LinkValidateTest extends LinkValidateTestCase {
     node_types_rebuild();
     menu_rebuild();
 
-    // create page form
+    // 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');
 
-
     $edit = array(
       'title' => 'Simple Title',
       $field_name . '[und][0][url]' => 'edik:naw',
     );
 
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertText(t('The value @value provided for @field is not a valid URL.', array('@value' => 'edik:naw', '@field' => $name)));
+    $this->assertText(t('The value @value provided for @field is not a valid URL.', array(
+      '@value' => 'edik:naw',
+      '@field' => $name,
+    )));
   }
 
   /**
    * Test if we're stopped from posting a bad url with validation on.
+   *
+   * @codingStandardsIgnoreStart
    */
-  function test_link_validate_bad_url_validate_on() {
-    $this->web_user = $this->drupalCreateUser(array('administer content types',
-                                             'administer nodes',
-                                             'administer filters',
-                                             'access content',
-                                             'create page content',
-                                             'access administration pages'));
+  public function test_link_validate_bad_url_validate_on() {
+    // @codingStandardsIgnoreEnd
+    $this->web_user = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer fields',
+      'administer nodes',
+      'administer filters',
+      'access content',
+      'create page content',
+      'access administration pages',
+    ));
     $this->drupalLogin($this->web_user);
 
-    // create field
+    // Create field.
     $name = strtolower($this->randomName());
     $edit = array(
       'fields[_add_new_field][label]' => $name,
@@ -131,36 +167,44 @@ class LinkValidateTest extends LinkValidateTestCase {
     node_types_rebuild();
     menu_rebuild();
 
-    // create page form
+    // 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');
 
-
     $edit = array(
       'title' => 'Simple Title',
       $field_name . '[und][0][url]' => 'edik:naw',
     );
 
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertText(t('The value @value provided for @field is not a valid URL.', array('@field' => $name, '@value' => 'edik:naw')));
+    $this->assertText(t('The value @value provided for @field is not a valid URL.', array(
+      '@field' => $name,
+      '@value' => 'edik:naw',
+    )));
 
   }
 
   /**
    * Test if we can post a bad url if the validation is expressly turned off.
+   *
+   * @codingStandardsIgnoreStart
    */
-  function test_link_validate_bad_url_validate_off() {
-    $this->web_user = $this->drupalCreateUser(array('administer content types',
-                                             'administer nodes',
-                                             'administer filters',
-                                             'access content',
-                                             'create page content',
-                                             'access administration pages'));
+  public function test_link_validate_bad_url_validate_off() {
+    // @codingStandardsIgnoreEnd
+    $this->web_user = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer fields',
+      'administer nodes',
+      'administer filters',
+      'access content',
+      'create page content',
+      'access administration pages',
+    ));
     $this->drupalLogin($this->web_user);
 
-    // create field
+    // Create field.
     $name = strtolower($this->randomName());
     $edit = array(
       'fields[_add_new_field][label]' => $name,
@@ -172,6 +216,7 @@ class LinkValidateTest extends LinkValidateTestCase {
     $this->drupalPost(NULL, array(), t('Save field settings'));
     $this->drupalPost(NULL, array('instance[settings][validate_url]' => FALSE), t('Save settings'));
 
+    // @codingStandardsIgnoreLine
     /*$instance_details = db_query("SELECT * FROM {field_config_instance} WHERE field_name = :field_name AND bundle = 'page'", array(':field_name' => 'field_'. $name))->fetchObject();
     $this->fail('<pre>'. print_r($instance_details, TRUE) .'</pre>');
     $this->fail('<pre>'. print_r(unserialize($instance_details->data), TRUE) .'</pre>');*/
@@ -181,51 +226,62 @@ class LinkValidateTest extends LinkValidateTestCase {
     node_types_rebuild();
     menu_rebuild();
 
-    // create page form
+    // 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');
 
-
     $edit = array(
       'title' => 'Simple Title',
       $field_name . '[und][0][url]' => 'edik:naw',
     );
 
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertNoText(t('The value %value provided for %field is not a valid URL.', array('%field' => $name, '%value' => 'edik:naw')));
+    $this->assertNoText(t('The value %value provided for %field is not a valid URL.', array(
+      '%field' => $name,
+      '%value' => 'edik:naw',
+    )));
   }
 
   /**
-   * Test if a bad url can sneak through un-filtered if we play with the validation...
+   * Validate switching between validation status.
+   *
+   * Test if a bad url can sneak through un-filtered if we play with the
+   * validation...
+   *
+   * @codingStandardsIgnoreStart
    */
-  function x_test_link_validate_switching_between_validation_status() {
+  public function x_test_link_validate_switching_between_validation_status() {
+    // @codingStandardsIgnoreEnd
     $this->acquireContentTypes(1);
-    $this->web_user = $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->web_user = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer fields',
+      'administer nodes',
+      'access administration pages',
+      'access content',
+      'create ' . $this->content_types[0]->type . ' content',
+      'edit any ' . $this->content_types[0]->type . ' content',
+    ));
     $this->drupalLogin($this->web_user);
-    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',
       'type_name' => $this->content_types[0]->name,
-      'attributes' => array(), // <-- This is needed or we have an error
+      // <-- This is needed or we have an error.
+      'attributes' => array(),
       'validate_url' => 0,
     );
 
     $field = $this->createField($field_settings, 0);
-    //$this->fail('<pre>'. print_r($field, TRUE) .'</pre>');
-    $field_db_info = content_database_info($field);
 
     $this->acquireNodes(2);
 
-    $node = node_load($this->nodes[0]->nid);
-
     $this->drupalGet('node/' . $this->nodes[0]->nid);
 
     $edit = array();
@@ -235,8 +291,12 @@ class LinkValidateTest extends LinkValidateTestCase {
     $edit[$field['field_name'] . '[0][title]'] = $title;
 
     $this->drupalPost('node/' . $this->nodes[0]->nid . '/edit', $edit, t('Save'));
-    //$this->pass($this->content);
-    $this->assertNoText(t('The value %value provided for %field is not a valid URL.', array('%field' => $name, '%value' => trim($url))));
+    // $this->pass($this->content);.
+    // @codingStandardsIgnoreLine
+    $this->assertNoText(t('The value %value provided for %field is not a valid URL.', array(
+      '%field' => $name,
+      '%value' => trim($url),
+    )));
 
     // Make sure we get a new version!
     $node = node_load($this->nodes[0]->nid, NULL, TRUE);
@@ -248,8 +308,9 @@ class LinkValidateTest extends LinkValidateTestCase {
     // Turn the array validation back _on_.
     $edit = array('validate_url' => TRUE);
     $node_type_link = str_replace('_', '-', $node->type);
-    //$this->drupalGet('admin/content/node-type/'. $node_type_link .'/fields'); ///'. $field['field_name']);
-    //$this->fail($this->content);
+    // @codingStandardsIgnoreLine
+    // $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->drupalGet('node/' . $node->nid);
@@ -257,17 +318,26 @@ class LinkValidateTest extends LinkValidateTestCase {
     // url() function.  But we should have a test that makes sure it continues
     // to work.
     $this->assertNoRaw($url, 'Make sure Javascript does not display.');
-    //$this->fail($this->content);
-
+    // $this->fail($this->content);.
   }
 
-  // Validate that '<front>' is a valid url.
-  function test_link_front_url() {
+  /**
+   * Validate that '<front>' is a valid url.
+   *
+   * @codingStandardsIgnoreStart
+   */
+  public function test_link_front_url() {
+    // @codingStandardsIgnoreEnd
     $this->link_test_validate_url('<front>');
   }
 
-  // Validate that an internal url would be accepted.
-  function test_link_internal_url() {
+  /**
+   * Validate that an internal url would be accepted.
+   *
+   * @codingStandardsIgnoreStart
+   */
+  public function test_link_internal_url() {
+    // @codingStandardsIgnoreEnd
     // Create the content first.
     $node = $this->drupalCreateNode();
 
@@ -277,22 +347,46 @@ class LinkValidateTest extends LinkValidateTestCase {
     $this->assertEqual(LINK_INTERNAL, $type, 'Test ' . $link . ' is an internal link.');
   }
 
-  // Validate a simple mailto.
-  function test_link_mailto() {
+  /**
+   * Validate a simple mailto.
+   *
+   * @codingStandardsIgnoreStart
+   */
+  public function test_link_mailto() {
+    // @codingStandardsIgnoreEnd
     $this->link_test_validate_url('mailto:jcfiala@gmail.com');
   }
 
-  function test_link_external_https() {
+  /**
+   * Check link external https.
+   *
+   * @codingStandardsIgnoreStart
+   */
+  public function test_link_external_https() {
+    // @codingStandardsIgnoreEnd
     $this->link_test_validate_url('https://www.example.com/');
   }
 
-  function test_link_ftp() {
+  /**
+   * Check link FTP.
+   *
+   * @codingStandardsIgnoreStart
+   */
+  public function test_link_ftp() {
+    // @codingStandardsIgnoreEnd
     $this->link_test_validate_url('ftp://www.example.com/');
   }
+
 }
 
+/**
+ * Validate Test News.
+ */
 class LinkValidateTestNews extends LinkValidateTestCase {
 
+  /**
+   * Get Info.
+   */
   public static function getInfo() {
     return array(
       'name' => 'Link News Validation Tests',
@@ -301,18 +395,36 @@ class LinkValidateTestNews extends LinkValidateTestCase {
     );
   }
 
-  // Validate a news link to a message group
-  function test_link_news() {
+  /**
+   * Validate a news link to a message group.
+   *
+   * @codingStandardsIgnoreStart
+   */
+  public function test_link_news() {
+    // @codingStandardsIgnoreEnd
     $this->link_test_validate_url('news:comp.infosystems.www.misc');
   }
 
-  // Validate a news link to a message id.  Said ID copied off of google groups.
-  function test_link_news_message() {
+  /**
+   * Validate a news link to a message id.  Said ID copied off of google groups.
+   *
+   * @codingStandardsIgnoreStart
+   */
+  public function test_link_news_message() {
+    // @codingStandardsIgnoreEnd
     $this->link_test_validate_url('news:hj0db8$vrm$1@news.eternal-september.org');
   }
+
 }
 
+/**
+ * Validate Specific URL.
+ */
 class LinkValidateSpecificURL extends LinkValidateTestCase {
+
+  /**
+   * Get Info.
+   */
   public static function getInfo() {
     return array(
       'name' => 'Link Specific URL Validation Tests',
@@ -321,24 +433,53 @@ class LinkValidateSpecificURL extends LinkValidateTestCase {
     );
   }
 
-  // Lets throw in a lot of umlouts for testing!
-  function test_umlout_url() {
+  /**
+   * Lets throw in a lot of umlouts for testing!
+   *
+   * @codingStandardsIgnoreStart
+   */
+  public function test_umlout_url() {
+    // @codingStandardsIgnoreEnd
     $this->link_test_validate_url('http://üÜü.exämple.com/nöde');
   }
 
-  function test_umlout_mailto() {
+  /**
+   * Check umlout mailto.
+   *
+   * @codingStandardsIgnoreStart
+   */
+  public function test_umlout_mailto() {
+    // @codingStandardsIgnoreEnd
     $this->link_test_validate_url('mailto:Üser@exÅmple.com');
   }
 
-  function test_german_b_url() {
+  /**
+   * Check german b in url.
+   *
+   * @codingStandardsIgnoreStart
+   */
+  public function test_german_b_url() {
+    // @codingStandardsIgnoreEnd
     $this->link_test_validate_url('http://www.test.com/ßstuff');
   }
 
-  function test_special_n_url() {
+  /**
+   * Check Special in url.
+   *
+   * @codingStandardsIgnoreStart
+   */
+  public function test_special_n_url() {
+    // @codingStandardsIgnoreEnd
     $this->link_test_validate_url('http://www.testÑñ.com/');
   }
 
-  function test_curly_brackets_in_query() {
+  /**
+   * Curly Brackets in query.
+   *
+   * @codingStandardsIgnoreStart
+   */
+  public function test_curly_brackets_in_query() {
+    // @codingStandardsIgnoreEnd
     $this->link_test_validate_url('http://www.healthyteennetwork.org/index.asp?Type=B_PR&SEC={2AE1D600-4FC6-4B4D-8822-F1D5F072ED7B}&DE={235FD1E7-208D-4363-9854-4E6775EB8A4C}');
   }
 
@@ -346,8 +487,11 @@ class LinkValidateSpecificURL extends LinkValidateTestCase {
    * Here, we're testing that a very long url is stored properly in the db.
    *
    * Basically, trying to test http://drupal.org/node/376818
+   *
+   * @codingStandardsIgnoreStart
    */
-  function testLinkURLFieldIsBig() {
+  public function testLinkURLFieldIsBig() {
+    // @codingStandardsIgnoreEnd
     $long_url = 'http://th.wikipedia.org/wiki/%E0%B9%82%E0%B8%A3%E0%B8%87%E0%B9%80%E0%B8%A3%E0%B8%B5%E0%B8%A2%E0%B8%99%E0%B9%80%E0%B8%9A%E0%B8%8D%E0%B8%88%E0%B8%A1%E0%B8%A3%E0%B8%B2%E0%B8%8A%E0%B8%B9%E0%B8%97%E0%B8%B4%E0%B8%A8_%E0%B8%99%E0%B8%84%E0%B8%A3%E0%B8%A8%E0%B8%A3%E0%B8%B5%E0%B8%98%E0%B8%A3%E0%B8%A3%E0%B8%A1%E0%B8%A3%E0%B8%B2%E0%B8%8A';
     $this->link_test_validate_url($long_url);
   }
@@ -355,12 +499,18 @@ class LinkValidateSpecificURL extends LinkValidateTestCase {
 }
 
 /**
- * A series of tests of links, only going against the link_validate_url function in link.module.
+ * Validate Url Light.
+ *
+ * A series of tests of links, only going against the link_validate_url function
+ * in link.module.
  *
  * Validation is guided by the rules in http://tools.ietf.org/html/rfc1738 !
  */
 class LinkValidateUrlLight extends DrupalWebTestCase {
 
+  /**
+   * Get Info.
+   */
   public static function getInfo() {
     return array(
       'name' => 'Link Light Validation Tests',
@@ -368,72 +518,107 @@ class LinkValidateUrlLight extends DrupalWebTestCase {
       'group' => 'Link',
     );
   }
-  
-  function setUp() {
+
+  /**
+   * Setup.
+   */
+  public function setUp() {
     parent::setUp('link');
   }
 
   /**
-   * Translates the LINK type constants to english for display and debugging of tests
+   * Name Link Type.
+   *
+   * Translates the LINK type constants to english for display and debugging of
+   * tests.
+   *
+   * @codingStandardsIgnoreStart
    */
-  function name_Link_Type($type) {
+  public function name_Link_Type($type) {
+    // @codingStandardsIgnoreEnd
     switch ($type) {
       case LINK_FRONT:
         return "Front";
+
       case LINK_EMAIL:
         return "Email";
+
       case LINK_NEWS:
         return "Newsgroup";
+
       case LINK_INTERNAL:
         return "Internal Link";
+
       case LINK_EXTERNAL:
         return "External Link";
+
       case FALSE:
         return "Invalid Link";
+
       default:
         return "Bad Value:" . $type;
     }
   }
 
-  // Make sure that a link labeled <front> works.
-  function testValidateFrontLink() {
+  /**
+   * Make sure that a link labeled <front> works.
+   */
+  public function testValidateFrontLink() {
     $valid = link_validate_url('<front>');
     $this->assertEqual(LINK_FRONT, $valid, 'Make sure that front link is verified and identified');
   }
 
-  function testValidateEmailLink() {
+  /**
+   * Validate Email Link.
+   */
+  public function testValidateEmailLink() {
     $valid = link_validate_url('mailto:bob@example.com');
     $this->assertEqual(LINK_EMAIL, $valid, "Make sure a basic mailto is verified and identified");
   }
 
-  function testValidateEmailLinkBad() {
+  /**
+   * Validate Email Link Bad.
+   */
+  public function testValidateEmailLinkBad() {
     $valid = link_validate_url(':bob@example.com');
     $this->assertEqual(FALSE, $valid, 'Make sure just a bad address is correctly failed');
   }
 
-  function testValidateNewsgroupLink() {
+  /**
+   * Validate Newsgroup Link.
+   */
+  public function testValidateNewsgroupLink() {
     $valid = link_validate_url('news:comp.infosystems.www.misc');
     $this->assertEqual(LINK_NEWS, $valid, 'Make sure link to newsgroup validates as news.');
   }
 
-  function testValidateNewsArticleLink() {
+  /**
+   * Validate News Article Link.
+   */
+  public function testValidateNewsArticleLink() {
     $valid = link_validate_url('news:hj0db8$vrm$1@news.eternal-september.org');
     $this->assertEqual(LINK_NEWS, $valid, 'Make sure link to specific article validates as news.');
   }
 
-  function testValidateBadNewsgroupLink() {
+  /**
+   * Validate Bad Newsgroup Link.
+   */
+  public function testValidateBadNewsgroupLink() {
     $valid = link_validate_url('news:comp.bad_name.misc');
     $this->assertEqual(FALSE, $valid, 'newsgroup names can\'t contain underscores, so it should come back as invalid.');
   }
 
-  function testValidateInternalLinks() {
+  /**
+   * Validate Internal Links.
+   */
+  public function testValidateInternalLinks() {
     $tempfile = drupal_tempnam('public://files', 'test');
     $links = array(
       'rss.xml',
       file_uri_target($tempfile),
       drupal_realpath($tempfile),
     );
-    
+
     foreach ($links as $link) {
       $type = link_url_type($link);
       $this->assertEqual(LINK_INTERNAL, $type, 'Test ' . $link . ' is an internal link.');
@@ -442,7 +627,10 @@ class LinkValidateUrlLight extends DrupalWebTestCase {
     }
   }
 
-  function testValidateExternalLinks() {
+  /**
+   * Validate External Links.
+   */
+  public function testValidateExternalLinks() {
     $links = array(
       'http://localhost:8080/',
       'www.example.com',
@@ -458,7 +646,7 @@ class LinkValidateUrlLight extends DrupalWebTestCase {
       'www.test-site.com',
       'http://example.com/index.php?q=node/123',
       'http://example.com/?first_name=Joe Bob&last_name=Smith',
-      // Anchors
+      // Anchors.
       'http://www.example.com/index.php#test',
       'http://www.example.com/index.php#this@that.',
       'http://www.example.com/index.php#',
@@ -466,8 +654,22 @@ class LinkValidateUrlLight extends DrupalWebTestCase {
       'http://www.archive.org/stream/aesopsfables00aesorich#page/n7/mode/2up',
       'http://www.example.com/blah/#this@that?',
     );
+
     // Test all of the protocols.
-    $allowed_protocols = variable_get('filter_allowed_protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal'));
+    $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';
@@ -478,25 +680,28 @@ class LinkValidateUrlLight extends DrupalWebTestCase {
       $this->assertEqual(LINK_EXTERNAL, $type, 'Testing that ' . $link . ' is an external link.');
       $valid = link_validate_url($link);
       $this->assertTrue($valid, 'Test ' . $link . ' is 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.");
+      // 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.");.
     }
-    // Test if we can make a tld valid:
-    variable_set('link_extra_domains', array('frog'));
-    $valid = link_validate_url('http://www.example.frog');
-    $this->assertEqual(LINK_EXTERNAL, $valid, "Testing that http://www.example.frog is a valid external link if we've added 'frog' to the list of valid domains.");
   }
 
-  function testInvalidExternalLinks() {
+  /**
+   * Check Invalid External Links.
+   */
+  public function testInvalidExternalLinks() {
     $links = array(
       'http://www.ex ample.com/',
-      'http://25.0.0/', // bad ip!
+      // Bad ip!
+      'http://25.0.0/',
       'http://4827.0.0.2/',
-      '//www.example.com/',
-      'http://www.testß.com/', // ß not allowed in domain names!
-      'http://www.example.frog/', // Bad TLD
-      //'http://www.-fudge.com/', // domains can't have sections starting with a dash.
+      // ß not allowed in domain names!
+      'http://www.testß.com/',
+      // Bad TLD.
+      'http://.www.foo.bar./',
+      // Domains can't have sections starting with a dash.
+      // 'http://www.-fudge.com/',
       'http://example.com/index.php?page=this\that',
       'example@example.com',
     );
@@ -505,4 +710,5 @@ class LinkValidateUrlLight extends DrupalWebTestCase {
       $this->assertEqual(FALSE, $valid, 'Testing that ' . $link . ' is not a valid link.');
     }
   }
+
 }

+ 3 - 0
sites/all/modules/contrib/fields/link/views/link.views.inc

@@ -1,4 +1,7 @@
 <?php
+
+// @codingStandardsIgnoreFile
+
 /**
  * @file
  * Contains functions handling views integration.

+ 14 - 7
sites/all/modules/contrib/fields/link/views/link_views_handler_argument_target.inc

@@ -7,20 +7,26 @@
 
 /**
  * Argument handler to filter results by target.
+ *
+ * @codingStandardsIgnoreStart
  */
 class link_views_handler_argument_target extends views_handler_argument {
 
   /**
    * Provide defaults for the argument when a new one is created.
    */
-  function options(&$options) {
-    parent::options($options);
-  }
+  function option_definition() {
+    $options = parent::option_definition();
 
+    return $options;
+  }
   /**
    * Provide a default options form for the argument.
+   *
+   * @codingStandardsIgnoreStart
    */
-  function options_form(&$form, &$form_state) {
+  public function options_form(&$form, &$form_state) {
+    // @codingStandardsIgnoreEnd
     $defaults = $this->default_actions();
 
     $form['title'] = array(
@@ -52,7 +58,7 @@ class link_views_handler_argument_target extends views_handler_argument {
 
     $form['wildcard'] = array(
       '#prefix' => '<div class="views-right-50">',
-      // prefix and no suffix means these two items will be grouped together.
+      // Prefix and no suffix means these two items will be grouped together.
       '#type' => 'textfield',
       '#title' => t('Wildcard'),
       '#size' => 20,
@@ -125,8 +131,8 @@ class link_views_handler_argument_target extends views_handler_argument {
 
     asort($validate_types);
     $form['validate_type']['#options'] = $validate_types;
-    // Show this gadget if *anything* but 'none' is selected
 
+    // Show this gadget if *anything* but 'none' is selected.
     $form['validate_fail'] = array(
       '#type' => 'select',
       '#title' => t('Action to take if argument does not validate'),
@@ -140,10 +146,11 @@ class link_views_handler_argument_target extends views_handler_argument {
    *
    * The argument sent may be found at $this->argument.
    */
-  function query($group_by = FALSE) {
+  public function query($group_by = FALSE) {
     $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)));
   }
+
 }

+ 53 - 15
sites/all/modules/contrib/fields/link/views/link_views_handler_filter_protocol.inc

@@ -7,22 +7,30 @@
 
 /**
  * Filter handler for limiting a view to URLs of a certain protocol.
+ *
+ * @codingStandardsIgnoreStart
  */
 class link_views_handler_filter_protocol extends views_handler_filter_string {
+
   /**
    * Set defaults for the filter options.
+   *
+   * @codingStandardsIgnoreEnd
    */
-  function options(&$options) {
-    parent::options($options);
+  function option_definition() {
+    $options = parent::option_definition();
+
     $options['operator'] = 'OR';
     $options['value'] = 'http';
     $options['case'] = 0;
+
+    return $options;
   }
 
   /**
    * Define the operators supported for protocols.
    */
-  function operators() {
+  public function operators() {
     $operators = array(
       'OR' => array(
         'title' => t('Is one of'),
@@ -35,7 +43,13 @@ class link_views_handler_filter_protocol extends views_handler_filter_string {
     return $operators;
   }
 
-  function options_form(&$form, &$form_state) {
+  /**
+   * Options form.
+   *
+   * @codingStandardsIgnoreStart
+   */
+  public function options_form(&$form, &$form_state) {
+    //@codingStandardsIgnoreEnd
     parent::options_form($form, $form_state);
     $form['case'] = array(
       '#type' => 'value',
@@ -45,8 +59,11 @@ class link_views_handler_filter_protocol extends views_handler_filter_string {
 
   /**
    * Provide a select list to choose the desired protocols.
+   *
+   * @codingStandardsIgnoreStart
    */
-  function value_form(&$form, &$form_state) {
+  public function value_form(&$form, &$form_state) {
+    // @codingStandardsIgnoreEnd
     // We have to make some choices when creating this as an exposed
     // filter form. For example, if the operator is locked and thus
     // not rendered, we can't render dependencies; instead we only
@@ -61,7 +78,19 @@ class link_views_handler_filter_protocol extends views_handler_filter_string {
         '#type' => 'select',
         '#title' => t('Protocol'),
         '#default_value' => $this->value,
-        '#options' => drupal_map_assoc(variable_get('filter_allowed_protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal'))),
+        '#options' => drupal_map_assoc(variable_get('filter_allowed_protocols', array(
+          'http',
+          'https',
+          'ftp',
+          'news',
+          'nntp',
+          'telnet',
+          'mailto',
+          'irc',
+          'ssh',
+          'sftp',
+          'webcal',
+        ))),
         '#multiple' => 1,
         '#size' => 4,
         '#description' => t('The protocols displayed here are those globally available. You may add more protocols by modifying the <em>filter_allowed_protocols</em> variable in your installation.'),
@@ -71,8 +100,11 @@ class link_views_handler_filter_protocol extends views_handler_filter_string {
 
   /**
    * Filter down the query to include only the selected protocols.
+   *
+   * @codingStandardsIgnoreStart
    */
-  function op_protocol($field, $upper) {
+  public function op_protocol($field, $upper) {
+    // @codingStandardsIgnoreEnd
     $db_type = db_driver();
 
     $protocols = $this->value;
@@ -82,20 +114,25 @@ class link_views_handler_filter_protocol extends views_handler_filter_string {
       // Simple case, the URL begins with the specified 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.
+      // More complex case, no protocol specified but is automatically cleaned
+      // up by link_cleanup_url(). RegEx is required for this search operation.
       if ($protocol == 'http') {
-        $LINK_DOMAINS = _link_domains();
+        $link_domains = _link_domains();
         if ($db_type == 'pgsql') {
-          // 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.
+          // 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.
+          // @codingStandardsIgnoreLine
           // 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.
+          // mySQL requires backslashes to be double (triple?) escaped within
+          // character classes.
+          // @codingStandardsIgnoreLine
           // 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]))' . '\'';
         }
       }
 
@@ -104,4 +141,5 @@ class link_views_handler_filter_protocol extends views_handler_filter_string {
 
     $this->query->add_where($this->options['group'], implode(' ' . $this->operator . ' ', $where_conditions));
   }
+
 }

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است