Browse Source

updated contrib modules

Bachir Soussi Chiadmi 4 years ago
parent
commit
438237e852
100 changed files with 4106 additions and 2231 deletions
  1. 21 5
      sites/all/modules/context/context.core.inc
  2. 3 4
      sites/all/modules/context/context.info
  3. 1 1
      sites/all/modules/context/context.install
  4. 60 5
      sites/all/modules/context/context.module
  5. 2 2
      sites/all/modules/context/context.plugins.inc
  6. 3 4
      sites/all/modules/context/context_layouts/context_layouts.info
  7. 3 4
      sites/all/modules/context/context_ui/context_ui.info
  8. 2 2
      sites/all/modules/context/context_ui/context_ui.js
  9. 8 12
      sites/all/modules/context/context_ui/context_ui.module
  10. 2 2
      sites/all/modules/context/context_ui/context_ui_dialog.js
  11. 11 11
      sites/all/modules/context/context_ui/export_ui/context_export_ui.class.php
  12. 1 1
      sites/all/modules/context/context_ui/tests/context_ui.test
  13. 1 1
      sites/all/modules/context/plugins/context_condition_bookroot.inc
  14. 1 1
      sites/all/modules/context/plugins/context_condition_menu.inc
  15. 9 5
      sites/all/modules/context/plugins/context_condition_node_taxonomy.inc
  16. 1 1
      sites/all/modules/context/plugins/context_condition_query_string.inc
  17. 11 10
      sites/all/modules/context/plugins/context_reaction_block.inc
  18. 5 6
      sites/all/modules/context/plugins/context_reaction_block.js
  19. 1 0
      sites/all/modules/context/plugins/context_reaction_breadcrumb.inc
  20. 3 1
      sites/all/modules/context/plugins/context_reaction_menu.inc
  21. 5 1
      sites/all/modules/context/plugins/context_reaction_region.inc
  22. 1 1
      sites/all/modules/context/plugins/context_reaction_template_suggestions.inc
  23. 0 22
      sites/all/modules/context/tests/context.conditions.test
  24. 3 4
      sites/all/modules/context/theme/context_reaction_block.theme.inc
  25. 101 0
      sites/all/modules/link/README.txt
  26. 7 0
      sites/all/modules/link/link-rtl.css
  27. 2 3
      sites/all/modules/link/link.css
  28. 32 0
      sites/all/modules/link/link.devel_generate.inc
  29. 22 0
      sites/all/modules/link/link.diff.inc
  30. 6 6
      sites/all/modules/link/link.info
  31. 54 28
      sites/all/modules/link/link.install
  32. 139 0
      sites/all/modules/link/link.migrate.inc
  33. 11 2
      sites/all/modules/link/link.module
  34. 269 461
      sites/all/modules/link/tests/link.attribute.test
  35. 31 24
      sites/all/modules/link/tests/link.crud.test
  36. 309 159
      sites/all/modules/link/tests/link.crud_browser.test
  37. 164 0
      sites/all/modules/link/tests/link.entity_token.test
  38. 25 16
      sites/all/modules/link/tests/link.test
  39. 207 110
      sites/all/modules/link/tests/link.token.test
  40. 376 163
      sites/all/modules/link/tests/link.validate.test
  41. 3 0
      sites/all/modules/link/views/link.views.inc
  42. 16 9
      sites/all/modules/link/views/link_views_handler_argument_target.inc
  43. 55 16
      sites/all/modules/link/views/link_views_handler_filter_protocol.inc
  44. 49 62
      sites/all/modules/module_filter/CHANGELOG.txt
  45. 2 2
      sites/all/modules/module_filter/README.txt
  46. 0 2
      sites/all/modules/module_filter/css/dynamic_position.css
  47. 6 0
      sites/all/modules/module_filter/css/module_filter.css
  48. 15 4
      sites/all/modules/module_filter/css/module_filter_tab.css
  49. 53 0
      sites/all/modules/module_filter/css/modules.css
  50. BIN
      sites/all/modules/module_filter/images/collapsed.png
  51. BIN
      sites/all/modules/module_filter/images/expanded.png
  52. 19 27
      sites/all/modules/module_filter/js/dynamic_position.js
  53. 7 6
      sites/all/modules/module_filter/js/module_filter.js
  54. 151 25
      sites/all/modules/module_filter/js/module_filter_tab.js
  55. 11 0
      sites/all/modules/module_filter/js/modules.js
  56. 27 9
      sites/all/modules/module_filter/module_filter.admin.inc
  57. 3 5
      sites/all/modules/module_filter/module_filter.info
  58. 6 1
      sites/all/modules/module_filter/module_filter.install
  59. 73 28
      sites/all/modules/module_filter/module_filter.module
  60. 12 5
      sites/all/modules/module_filter/module_filter.pages.inc
  61. 64 74
      sites/all/modules/module_filter/module_filter.theme.inc
  62. 13 0
      sites/all/modules/uuid/composer.json
  63. 3 3
      sites/all/modules/uuid/uuid.info
  64. 16 17
      sites/all/modules/uuid/uuid.test
  65. 3 3
      sites/all/modules/uuid/uuid_path/uuid_path.info
  66. 5 3
      sites/all/modules/uuid/uuid_services/uuid_services.info
  67. 8 1
      sites/all/modules/uuid/uuid_services/uuid_services.module
  68. 231 0
      sites/all/modules/uuid/uuid_services/uuid_services.user_services.test
  69. 3 3
      sites/all/modules/uuid/uuid_services_example/uuid_services_example.info
  70. 1 1
      sites/all/modules/views/css/ie/views-admin.ie7.css
  71. 1 1
      sites/all/modules/views/css/views-admin.bartik-rtl.css
  72. 70 73
      sites/all/modules/views/css/views-admin.bartik.css
  73. 7 9
      sites/all/modules/views/css/views-admin.css
  74. 1 1
      sites/all/modules/views/css/views-admin.ctools-rtl.css
  75. 9 9
      sites/all/modules/views/css/views-admin.ctools.css
  76. 2 2
      sites/all/modules/views/css/views-admin.garland-rtl.css
  77. 70 73
      sites/all/modules/views/css/views-admin.garland.css
  78. 80 83
      sites/all/modules/views/css/views-admin.seven.css
  79. 55 56
      sites/all/modules/views/css/views-admin.theme.css
  80. 0 1
      sites/all/modules/views/css/views-rtl.css
  81. 83 66
      sites/all/modules/views/drush/views.drush.inc
  82. 58 26
      sites/all/modules/views/handlers/views_handler_area.inc
  83. 1 1
      sites/all/modules/views/handlers/views_handler_area_messages.inc
  84. 22 7
      sites/all/modules/views/handlers/views_handler_area_result.inc
  85. 37 12
      sites/all/modules/views/handlers/views_handler_area_text.inc
  86. 25 7
      sites/all/modules/views/handlers/views_handler_area_text_custom.inc
  87. 8 6
      sites/all/modules/views/handlers/views_handler_area_view.inc
  88. 279 156
      sites/all/modules/views/handlers/views_handler_argument.inc
  89. 35 18
      sites/all/modules/views/handlers/views_handler_argument_date.inc
  90. 16 7
      sites/all/modules/views/handlers/views_handler_argument_formula.inc
  91. 15 4
      sites/all/modules/views/handlers/views_handler_argument_group_by_numeric.inc
  92. 41 15
      sites/all/modules/views/handlers/views_handler_argument_many_to_one.inc
  93. 15 6
      sites/all/modules/views/handlers/views_handler_argument_null.inc
  94. 29 10
      sites/all/modules/views/handlers/views_handler_argument_numeric.inc
  95. 49 22
      sites/all/modules/views/handlers/views_handler_argument_string.inc
  96. 249 149
      sites/all/modules/views/handlers/views_handler_field.inc
  97. 26 12
      sites/all/modules/views/handlers/views_handler_field_boolean.inc
  98. 11 3
      sites/all/modules/views/handlers/views_handler_field_contextual_links.inc
  99. 23 8
      sites/all/modules/views/handlers/views_handler_field_counter.inc
  100. 21 4
      sites/all/modules/views/handlers/views_handler_field_ctools_dropdown.inc

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

@@ -94,11 +94,27 @@ function context_theme_registry_alter(&$theme_registry) {
  */
  */
 function context_ctools_render_alter($info, $page, $data) {
 function context_ctools_render_alter($info, $page, $data) {
   extract($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/context/context.info

@@ -8,9 +8,8 @@ files[] = tests/context.test
 files[] = tests/context.conditions.test
 files[] = tests/context.conditions.test
 files[] = tests/context.reactions.test
 files[] = tests/context.reactions.test
 
 
-; Information added by Drupal.org packaging script on 2015-01-06
-version = "7.x-3.6"
+; Information added by Drupal.org packaging script on 2019-02-26
+version = "7.x-3.10"
 core = "7.x"
 core = "7.x"
 project = "context"
 project = "context"
-datestamp = "1420573188"
-
+datestamp = "1551220089"

+ 1 - 1
sites/all/modules/context/context.install

@@ -103,7 +103,7 @@ function context_update_7000() {
     }
     }
   }
   }
   if (empty($updated)) {
   if (empty($updated)) {
-    $ret = t('No contexts requiring migration detected');
+    $ret = t('No contexts requiring migration detected.');
   }
   }
   else {
   else {
     $ret = t('The following contexts had theme reaction data migrated: @names', array('@names' => join(', ', $updated)));
     $ret = t('The following contexts had theme reaction data migrated: @names', array('@names' => join(', ', $updated)));

+ 60 - 5
sites/all/modules/context/context.module

@@ -192,11 +192,66 @@ function context_init() {
  * theme('menu_link') for the menu rendering to html.
  * theme('menu_link') for the menu rendering to html.
  */
  */
 function context_preprocess_menu_link(&$variables) {
 function context_preprocess_menu_link(&$variables) {
-  if($contexts = context_active_contexts()){
-    foreach($contexts as $context){
-      if((isset($context->reactions['menu']))){
-        if ($variables['element']['#href'] == $context->reactions['menu']) {
-          $variables['element']['#localized_options']['attributes']['class'][] = "active";
+  if ($contexts = context_active_contexts()) {
+    foreach ($contexts as $context) {
+      if (isset($context->reactions['menu'])) {
+        // In context module < v3.2 the url was a string. In version 3.3+ this is
+        // an array of urls. Implement interims BC layer.
+        //
+        // Examples:
+        // - OLD < v3.2 context reaction structure:
+        // array('menu' => 'taxonomy/term/1')
+        //
+        // - NEW 3.3+ context reaction structure:
+        // array(
+        //   'menu' => array(
+        //     0 => 'navigation:taxonomy/term/1'
+        //     1 => 'foo-menu:taxonomy/term/1'
+        //   )
+        // )
+        $reactions_menu = is_array($context->reactions['menu']) ? array_values($context->reactions['menu']) : array($context->reactions['menu']);
+
+        // Get everything after the first ':' character (if found) as the url to
+        // match against element '#href'.
+        $urls = array();
+        foreach ($reactions_menu as $url) {
+          if (strpos($url, ':') !== FALSE) {
+            // Get unique menu name 'navigation' from 'navigation:taxonomy/term/1'
+            $reaction_menu = explode(':', $url);
+            $path = $reaction_menu[1];
+            $urls[$path] = $reaction_menu[0];
+          }
+          else {
+            // BC layer for menu contexts that have not re-saved. This is for
+            // urls like 'taxonomy/term/1'. We need to add a fake menu key
+            // 'bc-context-menu-layer' or the BC link get's removed by
+            // array_intersect below.
+            //
+            // @TODO: Remove BC layer in 4.x
+            $urls[$url] = 'context-reaction-menu-bc-layer';
+          }
+        }
+
+        // Filter urls by the menu name of the current link. The link reaction
+        // can be configured per menu link in specific menus and the contect
+        // reaction should not applied to other menus with the same menu link.
+        $menu_name = $variables['element']['#original_link']['menu_name'];
+        $menu_paths = array_intersect($urls, array($menu_name, 'context-reaction-menu-bc-layer'));
+        $reaction_menu_paths = array_keys($menu_paths);
+
+        // - If menu href and context reaction menu url match, add the 'active'
+        //   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';
+          }
         }
         }
       }
       }
     }
     }

+ 2 - 2
sites/all/modules/context/context.plugins.inc

@@ -37,7 +37,7 @@ function _context_context_registry() {
       'plugin' => 'context_condition_path',
       'plugin' => 'context_condition_path',
     ),
     ),
     'query_string' => array(
     'query_string' => array(
-      'title' => t('Query String'),
+      'title' => t('Query string'),
       'description' => t('Set this context when any of the query strings above match the page query string. Put each query string on a separate line. You can use the "*" character as a wildcard and <code>~</code> to exclude one or more query strings.'),
       'description' => t('Set this context when any of the query strings above match the page query string. Put each query string on a separate line. You can use the "*" character as a wildcard and <code>~</code> to exclude one or more query strings.'),
       'plugin' => 'context_condition_query_string',
       'plugin' => 'context_condition_query_string',
     ),
     ),
@@ -119,7 +119,7 @@ function _context_context_registry() {
       'plugin' => 'context_reaction_template_suggestions',
       'plugin' => 'context_reaction_template_suggestions',
     ),
     ),
     'theme' => array(
     'theme' => array(
-      'title' => t('Theme Page'),
+      'title' => t('Theme page'),
       'description' => t('Control page theme variables using context.'),
       'description' => t('Control page theme variables using context.'),
       'plugin' => 'context_reaction_theme',
       'plugin' => 'context_reaction_theme',
     ),
     ),

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

@@ -6,9 +6,8 @@ core = 7.x
 
 
 files[] = plugins/context_layouts_reaction_block.inc
 files[] = plugins/context_layouts_reaction_block.inc
 
 
-; Information added by Drupal.org packaging script on 2015-01-06
-version = "7.x-3.6"
+; Information added by Drupal.org packaging script on 2019-02-26
+version = "7.x-3.10"
 core = "7.x"
 core = "7.x"
 project = "context"
 project = "context"
-datestamp = "1420573188"
-
+datestamp = "1551220089"

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

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

+ 2 - 2
sites/all/modules/context/context_ui/context_ui.js

@@ -12,11 +12,11 @@ function DrupalContextPlugins(form) {
     $('.context-plugin-list > li', this.form).each(function() {
     $('.context-plugin-list > li', this.form).each(function() {
       var plugin = $(this).attr('class').split('context-plugin-')[1].split(' ')[0];
       var plugin = $(this).attr('class').split('context-plugin-')[1].split(' ')[0];
       if ($(this).is('.disabled')) {
       if ($(this).is('.disabled')) {
-        $('.context-plugin-selector select option[value='+plugin+']', this.form).show();
+        $('.context-plugin-selector select option[value="'+plugin+'"]', this.form).show();
       }
       }
       else {
       else {
         state.push(plugin);
         state.push(plugin);
-        $('.context-plugin-selector select option[value='+plugin+']', this.form).hide();
+        $('.context-plugin-selector select option[value="'+plugin+'"]', this.form).hide();
       }
       }
     });
     });
     // Set the hidden plugin list state.
     // Set the hidden plugin list state.

+ 8 - 12
sites/all/modules/context/context_ui/context_ui.module

@@ -81,7 +81,7 @@ function context_ui_permission() {
     'description' => 'Associate menus, views, blocks, etc. with different contexts to structure your site.'
     'description' => 'Associate menus, views, blocks, etc. with different contexts to structure your site.'
   );
   );
   $permissions['context ajax block access'] = array(
   $permissions['context ajax block access'] = array(
-    'title' => t('Access All Blocks'),
+    'title' => t('Access all blocks'),
     'description' => t('Allows users to access all rendered blocks via an AJAX callback. If you have some blocks that should not be rendered for some users but need those users to be able to use context UI, then implement hook_context_allow_ajax_block_access with the necessary logic.'),
     'description' => t('Allows users to access all rendered blocks via an AJAX callback. If you have some blocks that should not be rendered for some users but need those users to be able to use context UI, then implement hook_context_allow_ajax_block_access with the necessary logic.'),
   );
   );
   return $permissions;
   return $permissions;
@@ -143,7 +143,7 @@ function context_ui_editor($form, &$form_state, $contexts) {
 
 
   $form['title'] = array(
   $form['title'] = array(
     '#prefix' => '<h2 class="context-editor-title">',
     '#prefix' => '<h2 class="context-editor-title">',
-    '#markup' => t('Select the Context/Layer to Edit'),
+    '#markup' => t('Select the context/layer to edit'),
     '#suffix' => '</h2>',
     '#suffix' => '</h2>',
     '#weight' => -2,
     '#weight' => -2,
   );
   );
@@ -151,10 +151,7 @@ function context_ui_editor($form, &$form_state, $contexts) {
   //add some help text to the top of the form
   //add some help text to the top of the form
   $form['help'] = array (
   $form['help'] = array (
     '#prefix' => '<p class="context-help help">',
     '#prefix' => '<p class="context-help help">',
-    '#markup' => t('Select which context, or layer of blocks, to edit.
-                    Each context is configured to appear on different sets of pages so read the description carefully.
-                    When you are done editing click Done and save your changes.
-                    You may use the Stop Editing Layout link to close the editor.'),
+    '#markup' => t('Select which context, or layer of blocks, to edit. Each context is configured to appear on different sets of pages so read the description carefully. When you are done editing click Done and save your changes. You may use the Stop Editing Layout link to close the editor.'),
     '#suffix' => '</p>',
     '#suffix' => '</p>',
     '#weight' => -1,
     '#weight' => -1,
   );
   );
@@ -166,10 +163,9 @@ function context_ui_editor($form, &$form_state, $contexts) {
     $edit = l(t('Edit'), $_GET['q'], array('fragment' => $context->name, 'attributes' => array('class' => array('edit'))));
     $edit = l(t('Edit'), $_GET['q'], array('fragment' => $context->name, 'attributes' => array('class' => array('edit'))));
     $done = l(t('Done'), $_GET['q'], array('fragment' => $context->name, 'attributes' => array('class' => array('done'))));
     $done = l(t('Done'), $_GET['q'], array('fragment' => $context->name, 'attributes' => array('class' => array('done'))));
     $readable_name = ucwords(str_replace('_', ' ', $context->name));
     $readable_name = ucwords(str_replace('_', ' ', $context->name));
-    $description = empty($context->description) ? '' :
-                        "<br/><div class='label bottom'>".check_plain($context->description)."</div>";
+    $description = empty($context->description) ? '' : '<br/><div class="label bottom">' . check_plain($context->description) . '</div>';
     $items[] = array(
     $items[] = array(
-      'data' => "<div class='label top'>" . $readable_name. "</div><div class='links'>{$edit} {$done}</div>" . $description,
+      'data' => '<div class="label top">' . $readable_name. "</div><div class='links'>{$edit} {$done}</div>" . $description,
       'class' => array('context-editable clearfix'),
       'class' => array('context-editable clearfix'),
       'id' => "context-editable-trigger-{$context->name}",
       'id' => "context-editable-trigger-{$context->name}",
     );
     );
@@ -306,9 +302,9 @@ function context_ui_settings($form, &$form_state) {
   }
   }
   $form['context_ui_dialog_enabled'] = array(
   $form['context_ui_dialog_enabled'] = array(
     '#type' => 'checkbox',
     '#type' => 'checkbox',
-    '#title' => t('Use Context Editor Dialog'),
+    '#title' => t('Use context editor dialog'),
     '#default_value' => context_ui_dialog_is_enabled(),
     '#default_value' => context_ui_dialog_is_enabled(),
-    '#description' => t('When enabled all contextual links will have a Edit Layout link that will refresh the page with the context editor in a dialog box.'),
+    '#description' => t('When enabled all contextual links will have a <em>Edit layout</em> link that will refresh the page with the context editor in a dialog box.'),
   );
   );
   $form = system_settings_form($form);
   $form = system_settings_form($form);
   $form['#submit'][] = 'context_ui_settings_submit';
   $form['#submit'][] = 'context_ui_settings_submit';
@@ -374,7 +370,7 @@ function context_ui_menu_contextual_links_alter(&$links, $router_item, $root_pat
      !context_isset('context_ui', 'context_ui_editor_present') && user_access('administer contexts')) {
      !context_isset('context_ui', 'context_ui_editor_present') && user_access('administer contexts')) {
     $links['layout'] = array(
     $links['layout'] = array(
       'href' => 'context-ui/activate',
       'href' => 'context-ui/activate',
-      'title' => t('Configure Layout'),
+      'title' => t('Configure layout'),
       'localized_options' => array(
       'localized_options' => array(
         'query' =>  array('destination'=> $_GET['q']),
         'query' =>  array('destination'=> $_GET['q']),
         'options' => array('html' => FALSE, 'attributes' => array()),
         'options' => array('html' => FALSE, 'attributes' => array()),

+ 2 - 2
sites/all/modules/context/context_ui/context_ui_dialog.js

@@ -9,11 +9,11 @@
         selector.detach();
         selector.detach();
         $('#page').prepend(selector);
         $('#page').prepend(selector);
 
 
-        var labelOpen = Drupal.t('Select Context');
+        var labelOpen = Drupal.t('Select context');
         var labelClose = Drupal.t('Hide');
         var labelClose = Drupal.t('Hide');
 
 
         // Create a tab to show/hide our edit area
         // Create a tab to show/hide our edit area
-        var tab = $('<a href="javascript:" class="context-ui-dialog-open" title="Show Context Selector">'+labelClose+'</a>');
+        var tab = $('<a href="javascript:" class="context-ui-dialog-open" title="' + Drupal.t('Show context selector') + '">'+labelClose+'</a>');
         selector.append(tab);
         selector.append(tab);
 
 
         selector.toggled = false;
         selector.toggled = false;

+ 11 - 11
sites/all/modules/context/context_ui/export_ui/context_export_ui.class.php

@@ -22,7 +22,7 @@ class context_export_ui extends ctools_export_ui {
   function list_render(&$form_state) {
   function list_render(&$form_state) {
     $table = array(
     $table = array(
       'header' => $this->list_table_header(),
       'header' => $this->list_table_header(),
-      'rows' => $this->rows, 
+      'rows' => $this->rows,
       'attributes' => array(
       'attributes' => array(
         'class' => array('context-admin'),
         'class' => array('context-admin'),
         'id' => 'ctools-export-ui-list-items',
         'id' => 'ctools-export-ui-list-items',
@@ -104,17 +104,17 @@ class context_export_ui extends ctools_export_ui {
  * @param $form_state
  * @param $form_state
  *   Form state array
  *   Form state array
  */
  */
-function context_ui_form(&$form, &$form_state) {  
+function context_ui_form(&$form, &$form_state) {
   $conditions = array_keys(context_conditions());
   $conditions = array_keys(context_conditions());
   sort($conditions);
   sort($conditions);
   $reactions = array_keys(context_reactions());
   $reactions = array_keys(context_reactions());
   sort($reactions);
   sort($reactions);
-    
+
   $context = $form_state['item'];
   $context = $form_state['item'];
   if (!empty($form_state['input'])) {
   if (!empty($form_state['input'])) {
     $context = _context_ui_rebuild_from_input($context, $form_state['input'], $conditions, $reactions);
     $context = _context_ui_rebuild_from_input($context, $form_state['input'], $conditions, $reactions);
   }
   }
-  
+
   $form['#base'] = 'context_ui_form';
   $form['#base'] = 'context_ui_form';
   $form['#theme'] = 'context_ui_form';
   $form['#theme'] = 'context_ui_form';
 
 
@@ -131,7 +131,7 @@ function context_ui_form(&$form, &$form_state) {
     '#required' => FALSE,
     '#required' => FALSE,
     '#maxlength' => 255,
     '#maxlength' => 255,
     '#default_value' => isset($context->tag) ? $context->tag : '',
     '#default_value' => isset($context->tag) ? $context->tag : '',
-    '#description' => t('Example: <code>theme</code>') .'<br/>'. t('A tag to group this context with others.'),
+    '#description' => t('Example: <code>theme</code>') . '<br/>' . t('A tag to group this context with others.'),
   );
   );
 
 
   $form['info']['description'] = array(
   $form['info']['description'] = array(
@@ -155,11 +155,11 @@ function context_ui_form(&$form, &$form_state) {
   $form['conditions'] = array(
   $form['conditions'] = array(
     '#theme' => 'context_ui_plugins',
     '#theme' => 'context_ui_plugins',
     '#title' => t('Conditions'),
     '#title' => t('Conditions'),
-    '#description' => t('Trigger the activation of this context'),
+    '#description' => t('Trigger the activation of this context.'),
     '#tree' => TRUE,
     '#tree' => TRUE,
     'selector' => array(
     'selector' => array(
       '#type' => 'select',
       '#type' => 'select',
-      '#options' => array(0 => '<'. t('Add a condition') .'>'),
+      '#options' => array(0 => '<' . t('Add a condition') . '>'),
       '#default_value' => 0,
       '#default_value' => 0,
     ),
     ),
     'state' => array(
     'state' => array(
@@ -185,11 +185,11 @@ function context_ui_form(&$form, &$form_state) {
   $form['reactions'] = array(
   $form['reactions'] = array(
     '#theme' => 'context_ui_plugins',
     '#theme' => 'context_ui_plugins',
     '#title' => t('Reactions'),
     '#title' => t('Reactions'),
-    '#description' => t('Actions to take when this context is active'),
+    '#description' => t('Actions to take when this context is active.'),
     '#tree' => TRUE,
     '#tree' => TRUE,
     'selector' => array(
     'selector' => array(
       '#type' => 'select',
       '#type' => 'select',
-      '#options' => array(0 => '<'. t('Add a reaction') .'>'),
+      '#options' => array(0 => '<' . t('Add a reaction') . '>'),
       '#default_value' => 0,
       '#default_value' => 0,
     ),
     ),
     'state' => array(
     'state' => array(
@@ -225,7 +225,7 @@ function context_ui_form(&$form, &$form_state) {
  *   A context object
  *   A context object
  */
  */
 function _context_ui_rebuild_from_input($context, $input, $conditions, $reactions) {
 function _context_ui_rebuild_from_input($context, $input, $conditions, $reactions) {
-  $condition_defaults = array();  
+  $condition_defaults = array();
   foreach ($conditions as $condition) {
   foreach ($conditions as $condition) {
     if ($plugin = context_get_plugin('condition', $condition)) {
     if ($plugin = context_get_plugin('condition', $condition)) {
       $condition_defaults[$condition] = array(
       $condition_defaults[$condition] = array(
@@ -235,7 +235,7 @@ function _context_ui_rebuild_from_input($context, $input, $conditions, $reaction
     }
     }
   }
   }
   $input['conditions']['plugins'] = array_merge($condition_defaults, $input['conditions']['plugins']);
   $input['conditions']['plugins'] = array_merge($condition_defaults, $input['conditions']['plugins']);
-  
+
   $reaction_defaults = array();
   $reaction_defaults = array();
   foreach ($reactions as $reaction) {
   foreach ($reactions as $reaction) {
     if ($plugin = context_get_plugin('reaction', $reaction)) {
     if ($plugin = context_get_plugin('reaction', $reaction)) {

+ 1 - 1
sites/all/modules/context/context_ui/tests/context_ui.test

@@ -48,7 +48,7 @@ class ContextUiTestCase extends DrupalWebTestCase {
       'description' => $context->description,
       'description' => $context->description,
       'tag' => $context->tag,
       'tag' => $context->tag,
       'conditions[plugins][node][values][blog]' => 'blog',
       'conditions[plugins][node][values][blog]' => 'blog',
-      'reactions[plugins][menu]' => 'node/add/blog',
+      'reactions[plugins][menu][]' => 'navigation:node/add/blog',
     );
     );
     $this->drupalPost('admin/structure/context/add', $edit, 'Save');
     $this->drupalPost('admin/structure/context/add', $edit, 'Save');
     $this->assertText($context->name . ' has been created.', 'Context saved.');
     $this->assertText($context->name . ' has been created.', 'Context saved.');

+ 1 - 1
sites/all/modules/context/plugins/context_condition_bookroot.inc

@@ -8,7 +8,7 @@ class context_condition_bookroot extends context_condition_node {
     if ($this->condition_used() && !empty($node->book['bid'])) {
     if ($this->condition_used() && !empty($node->book['bid'])) {
       $type = db_select('node')
       $type = db_select('node')
         ->fields('node', array('type'))
         ->fields('node', array('type'))
-        ->condition('nid', $node->book['nid'])
+        ->condition('nid', $node->book['bid'])
         ->execute()
         ->execute()
         ->fetchField();
         ->fetchField();
       $book = new stdClass();
       $book = new stdClass();

+ 1 - 1
sites/all/modules/context/plugins/context_condition_menu.inc

@@ -14,7 +14,7 @@ class context_condition_menu extends context_condition {
       foreach ($menus as $key => $name) {
       foreach ($menus as $key => $name) {
         $id = explode(':', $key);
         $id = explode(':', $key);
         if ($id[1] == '0') {
         if ($id[1] == '0') {
-          $root_menus[$id[0]] = check_plain($name);
+          $root_menus[$id[0]] = $name;
         }
         }
         else {
         else {
           $link = menu_link_load($id[1]);
           $link = menu_link_load($id[1]);

+ 9 - 5
sites/all/modules/context/plugins/context_condition_node_taxonomy.inc

@@ -45,24 +45,28 @@ class context_condition_node_taxonomy extends context_condition_node {
     $check_fields = array();
     $check_fields = array();
     foreach ($instance_fields as $key => $field_info) {
     foreach ($instance_fields as $key => $field_info) {
       if ($fields[$key]['type'] == 'taxonomy_term_reference') {
       if ($fields[$key]['type'] == 'taxonomy_term_reference') {
-        $check_fields[] = $key;
+        $check_fields[$key] = 'tid';
+      }
+      else if ($fields[$key]['type'] == 'entityreference' &&
+               $fields[$key]['settings']['target_type'] == 'taxonomy_term') {
+        $check_fields[$key] = 'target_id';
       }
       }
     }
     }
 
 
     if ($this->condition_used() && !empty($check_fields)) {
     if ($this->condition_used() && !empty($check_fields)) {
-      foreach ($check_fields as $field) {
+      foreach ($check_fields as $field => $term_id_key) {
         if ($terms = field_get_items('node', $node, $field)) {
         if ($terms = field_get_items('node', $node, $field)) {
           foreach ($terms as $term) {
           foreach ($terms as $term) {
-            foreach ($this->get_contexts($term['tid']) as $context) {
+            foreach ($this->get_contexts($term[$term_id_key]) as $context) {
               // Check the node form option.
               // Check the node form option.
               if ($op === 'form') {
               if ($op === 'form') {
                 $options = $this->fetch_from_context($context, 'options');
                 $options = $this->fetch_from_context($context, 'options');
                 if (!empty($options['node_form'])) {
                 if (!empty($options['node_form'])) {
-                  $this->condition_met($context, $term['tid']);
+                  $this->condition_met($context, $term[$term_id_key]);
                 }
                 }
               }
               }
               else {
               else {
-                $this->condition_met($context, $term['tid']);
+                $this->condition_met($context, $term[$term_id_key]);
               }
               }
             }
             }
           }
           }

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

@@ -16,7 +16,7 @@ class context_condition_query_string extends context_condition_path {
    */
    */
   function execute() {
   function execute() {
     if ($this->condition_used()) {
     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) {
       foreach ($this->get_contexts() as $context) {
         $query_strings = $this->fetch_from_context($context, 'values');
         $query_strings = $this->fetch_from_context($context, 'values');
         if ($this->match($current_query_string, $query_strings, TRUE)) {
         if ($this->match($current_query_string, $query_strings, TRUE)) {

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

@@ -400,13 +400,17 @@ class context_reaction_block extends context_reaction {
       unset($_context_blocks);
       unset($_context_blocks);
 
 
       foreach ($context_blocks as $r => $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)) {
         if (array_key_exists($r, $active_regions)) {
           $context_blocks[$r] = _block_render_blocks($blocks);
           $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);
               $context_blocks[$r][$key] = $this->editable_block($block);
             }
             }
           }
           }
@@ -450,12 +454,9 @@ class context_reaction_block extends context_reaction {
    */
    */
   protected function max_block_weight() {
   protected function max_block_weight() {
     $blocks = $this->get_blocks();
     $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);
   }
   }
 
 
   /**
   /**

+ 5 - 6
sites/all/modules/context/plugins/context_reaction_block.js

@@ -68,8 +68,8 @@ DrupalContextBlockForm = function(blockForm) {
 
 
     // Hide enabled blocks from selector that are used
     // Hide enabled blocks from selector that are used
     $('table.context-blockform-region tr').each(function() {
     $('table.context-blockform-region tr').each(function() {
-      var bid = $(this).attr('id');
-      $('div.context-blockform-selector input[value='+bid+']').parents('div.form-item').eq(0).hide();
+      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
     // Show blocks in selector that are unused
     $('div.context-blockform-selector input').each(function() {
     $('div.context-blockform-selector input').each(function() {
@@ -159,7 +159,7 @@ DrupalContextBlockForm = function(blockForm) {
           $(this).removeAttr('checked');
           $(this).removeAttr('checked');
         });
         });
         if (weight_warn) {
         if (weight_warn) {
-          alert(Drupal.t('Desired block weight exceeds available weight options, please check weights for blocks before saving'));
+          alert(Drupal.t('Desired block weight exceeds available weight options, please check weights for blocks before saving.'));
         }
         }
       }
       }
       return false;
       return false;
@@ -426,9 +426,8 @@ DrupalContextBlockEditor.prototype = {
 
 
     $('.editing-context-label').remove();
     $('.editing-context-label').remove();
     var label = $('#context-editable-trigger-'+context+' .label').text();
     var label = $('#context-editable-trigger-'+context+' .label').text();
-    label = Drupal.t('Now Editing: ') + label;
-    editor.parent().parent()
-      .prepend('<div class="editing-context-label">'+ label + '</div>');
+    label = Drupal.t('Now editing: @label', {'@label': label});
+    editor.parent().parent().prepend('<div class="editing-context-label">' + label + '</div>');
 
 
     // First pass, enable sortables on all regions.
     // First pass, enable sortables on all regions.
     $(this.regions).each(function() {
     $(this.regions).each(function() {

+ 1 - 0
sites/all/modules/context/plugins/context_reaction_breadcrumb.inc

@@ -8,6 +8,7 @@ class context_reaction_breadcrumb extends context_reaction_menu {
    * Overrides set_active_trail_from_link to set the breadcrumb instead of the menu path.
    * Overrides set_active_trail_from_link to set the breadcrumb instead of the menu path.
    */
    */
   function set_active_trail_from_link($item) {
   function set_active_trail_from_link($item) {
+    $breadcrumb = array(l(t('Home'), '<front>'));
     $result = db_select('menu_links')
     $result = db_select('menu_links')
       ->fields('menu_links', array('p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8'))
       ->fields('menu_links', array('p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8'))
       ->condition('hidden', 0)
       ->condition('hidden', 0)

+ 3 - 1
sites/all/modules/context/plugins/context_reaction_menu.inc

@@ -22,19 +22,21 @@ class context_reaction_menu extends context_reaction {
           $link = menu_link_load($mlid);
           $link = menu_link_load($mlid);
           $identifier = $link['link_path'];
           $identifier = $link['link_path'];
           $root_menu = $menu_names[$menu_name];
           $root_menu = $menu_names[$menu_name];
-          while (isset($options[$root_menu][$identifier])) {
+          while (isset($options[$root_menu][$menu_name . ':' . $identifier])) {
             $identifier .= "'";
             $identifier .= "'";
           }
           }
           $options[$root_menu][$menu_name . ':' . $identifier] = $title;
           $options[$root_menu][$menu_name . ':' . $identifier] = $title;
         }
         }
       }
       }
     }
     }
+    $menu_count = count($options, COUNT_RECURSIVE);
     return array(
     return array(
       '#title' => $this->title,
       '#title' => $this->title,
       '#description' => $this->description,
       '#description' => $this->description,
       '#options' => $options,
       '#options' => $options,
       '#type' => 'select',
       '#type' => 'select',
       '#multiple' => TRUE,
       '#multiple' => TRUE,
+      '#size' => $menu_count > 20 ? 20 : $menu_count,
       '#default_value' => $this->fetch_from_context($context),
       '#default_value' => $this->fetch_from_context($context),
     );
     );
   }
   }

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

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

+ 1 - 1
sites/all/modules/context/plugins/context_reaction_template_suggestions.inc

@@ -14,7 +14,7 @@ class context_reaction_template_suggestions extends context_reaction {
     return array(
     return array(
       '#title' => t('Template suggestions'),
       '#title' => t('Template suggestions'),
       '#type' => 'textarea',
       '#type' => 'textarea',
-      '#description' => t('Enter template suggestions such as "page__front", one per line, in order of preference (using underscores instead of hyphens).  For more information, please visit ') . l(t('Drupal 7 Template (Theme Hook) Suggestions'), 'http://drupal.org/node/1089656', array(array('target' => '_blank'), 'html' => TRUE,)) . '.',
+      '#description' => t('Enter template suggestions such as "page__front", one per line, in order of preference (using underscores instead of hyphens). For more information, please visit <a href="@template-suggestions">Drupal 7 Template (Theme Hook) Suggestions</a>.', array('@template-suggestions' => 'http://drupal.org/node/1089656')),
       '#default_value' => is_string($default_value) ? $default_value : '',
       '#default_value' => is_string($default_value) ? $default_value : '',
     );
     );
   }
   }

+ 0 - 22
sites/all/modules/context/tests/context.conditions.test

@@ -36,13 +36,6 @@ class ContextConditionUserTest extends DrupalWebTestCase {
     $this->assertTrue($saved, "Context 'testcontext' saved.");
     $this->assertTrue($saved, "Context 'testcontext' saved.");
   }
   }
 
 
-  function tearDown() {
-    parent::tearDown();
-    context_delete($this->context);
-    user_delete($this->user1->uid);
-    user_delete($this->user2->uid);
-  }
-
   function test() {
   function test() {
     // User 1 triggers the context.
     // User 1 triggers the context.
     $this->drupalLogin($this->user1);
     $this->drupalLogin($this->user1);
@@ -82,14 +75,6 @@ class ContextConditionUserPageTest extends DrupalWebTestCase {
     $this->assertTrue($saved, "Context 'testcontext' saved.");
     $this->assertTrue($saved, "Context 'testcontext' saved.");
   }
   }
 
 
-  function tearDown() {
-    parent::tearDown();
-    context_delete($this->context);
-    $edit = array();
-    user_delete($this->user1->uid);
-    user_delete($this->user2->uid);
-  }
-
   function test() {
   function test() {
     // Viewing any user profile triggers context.
     // Viewing any user profile triggers context.
     $this->drupalLogin($this->user1);
     $this->drupalLogin($this->user1);
@@ -157,13 +142,6 @@ class ContextConditionNodeTaxonomyTest extends DrupalWebTestCase {
     $this->assertTrue($saved, "Context 'testcontext' saved.");
     $this->assertTrue($saved, "Context 'testcontext' saved.");
   }
   }
 
 
-  function tearDown() {
-    parent::tearDown();
-    context_delete($this->context);
-    taxonomy_term_delete($this->terms['apples']->tid);
-    taxonomy_term_delete($this->terms['oranges']->tid);
-  }
-
   function test() {
   function test() {
     // Apples does trigger the context.
     // Apples does trigger the context.
     $edit = array(
     $edit = array(

+ 3 - 4
sites/all/modules/context/theme/context_reaction_block.theme.inc

@@ -52,7 +52,7 @@ function theme_context_block_regions_form($vars) {
     $output .= "<div class='label context-blockform-regionlabel-{$region}'>";
     $output .= "<div class='label context-blockform-regionlabel-{$region}'>";
     $output .= l(t('+') . ' ' . t('Add'), $_GET['q'], array('fragment' => $region, 'attributes' => array('class' => array('add-block'))));
     $output .= l(t('+') . ' ' . t('Add'), $_GET['q'], array('fragment' => $region, 'attributes' => array('class' => array('add-block'))));
     $output .= $form[$region]['#title'];
     $output .= $form[$region]['#title'];
-    $output .= "</div>";
+    $output .= '</div>';
     $output .= theme('table', array('rows' => $rows, 'attributes' => $attr));
     $output .= theme('table', array('rows' => $rows, 'attributes' => $attr));
   }
   }
   return $output;
   return $output;
@@ -100,14 +100,13 @@ function template_preprocess_context_block_browser(&$vars) {
   //add help text to tell people how to use the block browser
   //add help text to tell people how to use the block browser
   $help_text = array(
   $help_text = array(
     '#prefix' => '<div class="context_ui-help-text">',
     '#prefix' => '<div class="context_ui-help-text">',
-    '#markup' => t('To add a block to the current region, simply click on the block.  You may use the category filter to filter by
-      block type or the search filter to find the block that you wish to add.'),
+    '#markup' => t('To add a block to the current region, simply click on the block. You may use the category filter to filter by block type or the search filter to find the block that you wish to add.'),
     '#suffix' => '</div>',
     '#suffix' => '</div>',
   );
   );
 
 
   $filter_label = array(
   $filter_label = array(
     '#prefix' => '<div class="filter-label">',
     '#prefix' => '<div class="filter-label">',
-    '#markup' => t('Search Filter'),
+    '#markup' => t('Search filter'),
     '#suffix' => '</div>',
     '#suffix' => '</div>',
   );
   );
 
 

+ 101 - 0
sites/all/modules/link/README.txt

@@ -0,0 +1,101 @@
+CONTENTS OF THIS FILE
+---------------------
+   
+ * Introduction
+ * Requirements
+ * Installation
+ * Configuration
+ * Example
+ * Theming and Output
+ * Maintainers
+
+
+INTRODUCTION
+------------
+
+The link can be count to the top 50 projects in Drupal installations and
+provides a standard custom content field for links. With this module links can
+be added easily to any content types and profiles and include advanced
+validating and different ways of storing internal or external links and URLs. It
+also supports additional link text title, site wide tokens for titles and title
+attributes, target attributes, css class attribution, static repeating values,
+input conversion, and many more.
+
+
+
+REQUIREMENTS
+------------
+
+Project in Drupal 7 requires the following modules:
+
+ * Fields API (Fields API is provided already by core)
+ * Panels (https://drupal.org/project/panels)
+
+Drupal 8:
+
+ * Link is in core now. No installation needed. Yay! Don't forget to activate
+   it. It's deactivated by default.
+
+
+INSTALLATION
+------------
+
+Install as you would normally install a contributed Drupal module. See:
+https://drupal.org/documentation/install/modules-themes/modules-7 for further
+information.
+
+
+CONFIGURATION
+-------------
+
+ * Configuration is only slightly more complicated than a text field. Link text
+   titles for URLs can be made required, set as instead of URL, optional
+   (default), or left out entirely. If no link text title is provided, the
+   trimmed version of the complete URL will be displayed. The target attribute
+   should be set to "_blank", "top", or left out completely (checkboxes provide
+   info). The rel=nofollow attribute prevents the link from being followed by
+   certain search engines. More info at Wikipedia
+   (http://en.wikipedia.org/wiki/Spam_in_blogs#rel.3D.22nofollow.22).
+
+
+EXAMPLE
+-------
+If you were to create a field named 'My New Link', the default display of the
+link would be:
+<em><div class="field_my_new_link" target="[target_value]"><a href="[URL]">
+[Title]</a></div></em> where items between [] characters would be customized
+based on the user input.
+
+The link project supports both, internal and external URLs. URLs are validated
+on input. Here are some examples of data input and the default view of a link:
+http://drupal.org results in http://drupal.org, but drupal.org results in
+http://drupal.org, while <front> will convert into http://drupal.org and
+node/74971 into http://drupal.org/project/link
+
+Anchors and query strings may also be used in any of these cases, including:
+node/74971/edit?destination=node/74972<front>#pager
+
+
+THEMING AND OUTPUT
+------------------
+Since link module is mainly a data storage field in a modular framework, the
+theming and output is up to the site builder and other additional modules. There
+are many modules in the Drupal repository, which control the output of fields
+perfectly and can handle rules, user actions, markup dependencies, and can vary
+the output under many different conditions, with much more efficience and
+flexibility for different scenarios. Please check out modules like views,
+display suite, panels, etc for such needs
+
+
+MAINTAINERS
+-----------
+
+Current maintainers:
+ * John C Fiala (jcfiala) - https://www.drupal.org/user/163643
+ * Renato Gonçalves (RenatoG) - https://www.drupal.org/user/3326031
+ * Clemens Tolboom (clemens.tolboom) - https://www.drupal.org/user/125814
+ * diqidoq - https://www.drupal.org/user/1001934
+ * dropcube - https://www.drupal.org/user/37031
+ * Tom Kirkpatrick (mrfelton) - https://www.drupal.org/user/305669
+ * Sumit Madan (sumitmadan) - https://www.drupal.org/user/1538790
+ * Daniel Kudwien (sun) - https://www.drupal.org/user/54136

+ 7 - 0
sites/all/modules/link/link-rtl.css

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

+ 2 - 3
sites/all/modules/link/link.css

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

+ 32 - 0
sites/all/modules/link/link.devel_generate.inc

@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * @file
+ * Devel Generate support for Link module.
+ */
+
+/**
+ * Implements hook_devel_generate().
+ */
+function link_devel_generate($object, $field, $instance, $bundle) {
+  if (field_behaviors_widget('multiple values', $instance) == FIELD_BEHAVIOR_CUSTOM) {
+    return devel_generate_multiple('_link_devel_generate', $object, $field, $instance, $bundle);
+  }
+  else {
+    return _link_devel_generate($object, $field, $instance, $bundle);
+  }
+}
+
+/**
+ * Callback for hook_devel_generate().
+ */
+function _link_devel_generate($object, $field, $instance, $bundle) {
+  $link = array(
+    'url' => url('<front>', array('absolute' => TRUE)),
+    'attributes' => _link_default_attributes(),
+  );
+  if ($instance['settings']['title'] != 'none') {
+    $link['title'] = devel_create_greeking(mt_rand(1, 3), TRUE);
+  }
+  return $link;
+}

+ 22 - 0
sites/all/modules/link/link.diff.inc

@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @file
+ * Provide diff field functions for the Link module.
+ */
+
+/**
+ * Diff field callback for parsing link fields comparative values.
+ */
+function link_field_diff_view($items, $context) {
+  $diff_items = array();
+  foreach ($items as $delta => $item) {
+    if ($item['url'] && isset($item['title'])) {
+      $diff_items[$delta] = $item['title'] . ' (' . $item['url'] . ')';
+    }
+    else {
+      $diff_items[$delta] = $item['url'];
+    }
+  }
+  return $diff_items;
+}

+ 6 - 6
sites/all/modules/link/link.info

@@ -3,23 +3,23 @@ description = Defines simple link field types.
 core = 7.x
 core = 7.x
 package = Fields
 package = Fields
 
 
-files[] = link.module
-files[] = link.install
+files[] = link.migrate.inc
+
 ; Tests
 ; Tests
 files[] = tests/link.test
 files[] = tests/link.test
 files[] = tests/link.attribute.test
 files[] = tests/link.attribute.test
 files[] = tests/link.crud.test
 files[] = tests/link.crud.test
 files[] = tests/link.crud_browser.test
 files[] = tests/link.crud_browser.test
 files[] = tests/link.token.test
 files[] = tests/link.token.test
+files[] = tests/link.entity_token.test
 files[] = tests/link.validate.test
 files[] = tests/link.validate.test
 
 
 ; Views Handlers
 ; Views Handlers
 files[] = views/link_views_handler_argument_target.inc
 files[] = views/link_views_handler_argument_target.inc
 files[] = views/link_views_handler_filter_protocol.inc
 files[] = views/link_views_handler_filter_protocol.inc
 
 
-; Information added by drupal.org packaging script on 2011-10-23
-version = "7.x-1.0"
+; Information added by Drupal.org packaging script on 2019-02-20
+version = "7.x-1.6"
 core = "7.x"
 core = "7.x"
 project = "link"
 project = "link"
-datestamp = "1319392535"
-
+datestamp = "1550680687"

+ 54 - 28
sites/all/modules/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().
  * Implements hook_field_schema().
  */
  */
@@ -18,20 +46,21 @@ function link_field_schema($field) {
     'columns' => array(
     'columns' => array(
       'url' => array(
       'url' => array(
         'type' => 'varchar',
         'type' => 'varchar',
-        'length' => 2048, // Maximum URLs length.
+        // Maximum URLs length.
+        'length' => 2048,
         'not null' => FALSE,
         'not null' => FALSE,
-        'sortable' => TRUE
+        'sortable' => TRUE,
       ),
       ),
       'title' => array(
       'title' => array(
         'type' => 'varchar',
         'type' => 'varchar',
         'length' => 255,
         'length' => 255,
         'not null' => FALSE,
         'not null' => FALSE,
-        'sortable' => TRUE
+        'sortable' => TRUE,
       ),
       ),
       'attributes' => array(
       'attributes' => array(
         'type' => 'text',
         'type' => 'text',
         'size' => 'medium',
         'size' => 'medium',
-        'not null' => FALSE
+        'not null' => FALSE,
       ),
       ),
     ),
     ),
   );
   );
@@ -45,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() {
 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'");
   $result = db_query("SELECT id, field_name, data FROM {field_config} WHERE module = 'link' AND type = 'link_field'");
   foreach ($result as $field) {
   foreach ($result as $field) {
-    $field_id = $field->id;
-    $name = $field->field_name;
+
     $field_data = unserialize($field->data);
     $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) {
     foreach ($instances as $instance) {
       // If this field has been updated already, we want to skip it.
       // If this field has been updated already, we want to skip it.
       $instance_data = unserialize($instance->data);
       $instance_data = unserialize($instance->data);
@@ -70,8 +101,8 @@ function link_update_7000() {
           }
           }
         }
         }
         if ($update_instance) {
         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)))
             ->fields(array('data' => serialize($instance_data)))
             ->condition('id', $instance->id)
             ->condition('id', $instance->id)
             ->execute();
             ->execute();
@@ -79,36 +110,31 @@ function link_update_7000() {
       }
       }
     }
     }
   }
   }
-  
+
   return t("Instance settings have been set with the data from the field settings.");
   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() {
 function link_update_7001() {
-  // for each field that is a link field, we need to update the display types:
-  
+  // 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'");
   $result = db_query("SELECT id, field_name, data FROM {field_config} WHERE module = 'link' AND type = 'link_field'");
   foreach ($result as $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) {
     foreach ($instances as $instance) {
       // If this field has been updated already, we want to skip it.
       // If this field has been updated already, we want to skip it.
       $instance_data = unserialize($instance->data);
       $instance_data = unserialize($instance->data);
       $update_instance = FALSE;
       $update_instance = FALSE;
       foreach ($instance_data['display'] as $display_name => $display_data) {
       foreach ($instance_data['display'] as $display_name => $display_data) {
         if ($display_data['type'] && (0 !== strpos($display_data['type'], 'link_'))) {
         if ($display_data['type'] && (0 !== strpos($display_data['type'], 'link_'))) {
-          $instance_data['display'][$display_name]['type'] = 'link_'. $display_data['type'];
+          $instance_data['display'][$display_name]['type'] = 'link_' . $display_data['type'];
           $update_instance = TRUE;
           $update_instance = TRUE;
         }
         }
       }
       }
       if ($update_instance) {
       if ($update_instance) {
-        // update the database.
-        $num_updated = db_update('field_config_instance')
+        db_update('field_config_instance')
           ->fields(array('data' => serialize($instance_data)))
           ->fields(array('data' => serialize($instance_data)))
           ->condition('id', $instance->id)
           ->condition('id', $instance->id)
           ->execute();
           ->execute();

+ 139 - 0
sites/all/modules/link/link.migrate.inc

@@ -0,0 +1,139 @@
+<?php
+
+/**
+ * @file
+ * Support for migrate module.
+ *
+ * With Migrate 2.4 or later, you can use the subfield syntax to set the title
+ * and attributes:
+ *
+ * @code
+ * $this->addFieldMapping('field_my_link', 'source_url');
+ * $this->addFieldMapping('field_my_link:title', 'source_title');
+ * $this->addFieldMapping('field_my_link:attributes', 'source_attributes');
+ *
+ * # With earlier versions of Migrate, you must pass an arguments array:
+ *
+ * $link_args = array(
+ *   'title' => array('source_field' => 'source_title'),
+ *   'attributes' => array('source_field' => 'source_attributes'),
+ * );
+ * $this->addFieldMapping('field_my_link', 'source_url')
+ *      ->arguments($link_args);
+ * @endcode
+ */
+
+if (!class_exists('MigrateFieldHandler')) {
+  return;
+}
+
+/**
+ * Implements hook_migrate_api().
+ */
+function link_migrate_api() {
+  return array(
+    'api' => 2,
+    'field handlers' => array('MigrateLinkFieldHandler'),
+  );
+}
+
+// @codingStandardsIgnoreLine
+class MigrateLinkFieldHandler extends MigrateFieldHandler {
+
+  /**
+   * Construct.
+   */
+  public function __construct() {
+    $this->registerTypes(array('link_field'));
+  }
+
+  /**
+   * Arguments.
+   */
+  public static function arguments($title = NULL, $attributes = NULL, $language = NULL) {
+    $arguments = array();
+    if (!is_null($title)) {
+      $arguments['title'] = $title;
+    }
+    if (!is_null($attributes)) {
+      $arguments['attributes'] = $attributes;
+    }
+    if (!is_null($language)) {
+      $arguments['language'] = $language;
+    }
+    return $arguments;
+  }
+
+  /**
+   * Implementation of MigrateFieldHandler::fields().
+   *
+   * @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.
+   *
+   * @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'),
+      'language' => t('Subfield: The language for the field'),
+    );
+  }
+
+  /**
+   * Prepare.
+   */
+  public function prepare($entity, array $field_info, array $instance, array $values) {
+    if (isset($values['arguments'])) {
+      $arguments = $values['arguments'];
+      unset($values['arguments']);
+    }
+    else {
+      $arguments = array();
+    }
+
+    $language = $this->getFieldLanguage($entity, $field_info, $arguments);
+    $values = array_filter($values);
+
+    foreach ($values as $delta => $value) {
+      $item = array();
+      if (isset($arguments['title'])) {
+        if (!is_array($arguments['title'])) {
+          $item['title'] = $arguments['title'];
+        }
+        elseif (isset($arguments['title'][$delta])) {
+          $item['title'] = $arguments['title'][$delta];
+        }
+      }
+      if (isset($arguments['attributes'])) {
+        if (is_array($arguments['attributes']) && isset($arguments['attributes'][$delta])) {
+          $item['attributes'] = $arguments['attributes'][$delta];
+        }
+        else {
+          $item['attributes'] = $arguments['attributes'];
+        }
+      }
+      $item['url'] = $value;
+
+      if (is_array($language)) {
+        $current_language = $language[$delta];
+      }
+      else {
+        $current_language = $language;
+      }
+      $return[$current_language][$delta] = $item;
+    }
+
+    return isset($return) ? $return : NULL;
+  }
+
+}

File diff suppressed because it is too large
+ 11 - 2
sites/all/modules/link/link.module


+ 269 - 461
sites/all/modules/link/tests/link.attribute.test

@@ -5,11 +5,14 @@
  * Basic simpletests to test options on link module.
  * Basic simpletests to test options on link module.
  */
  */
 
 
+/**
+ * Attribute Crud Test.
+ */
 class LinkAttributeCrudTest extends DrupalWebTestCase {
 class LinkAttributeCrudTest extends DrupalWebTestCase {
 
 
   private $zebra;
   private $zebra;
 
 
-  public $permissions = array(
+  protected $permissions = array(
     'access content',
     'access content',
     'administer content types',
     'administer content types',
     'administer nodes',
     'administer nodes',
@@ -20,6 +23,9 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     'access administration pages',
     'access administration pages',
   );
   );
 
 
+  /**
+   * Get Info.
+   */
   public static function getInfo() {
   public static function getInfo() {
     return array(
     return array(
       'name' => 'Link Attribute Tests',
       'name' => 'Link Attribute Tests',
@@ -28,16 +34,24 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     );
     );
   }
   }
 
 
-  function setup() {
+  /**
+   * Setup.
+   */
+  public function setup() {
+    parent::setup('field_ui', 'link');
     $this->zebra = 0;
     $this->zebra = 0;
-    parent::setup('field_ui', 'link'); // was 'views'
-    //$this->loginWithPermissions($this->permissions);
     // Create and login user.
     // Create and login user.
-    $account = $this->drupalCreateUser(array('administer content types'));
-    $this->drupalLogin($account);
+    $this->web_user = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer fields',
+    ));
+    $this->drupalLogin($this->web_user);
   }
   }
 
 
-  function createLink($url, $title, $attributes = array()) {
+  /**
+   * Create Link.
+   */
+  protected function createLink($url, $title, $attributes = array()) {
     return array(
     return array(
       'url' => $url,
       'url' => $url,
       'title' => $title,
       'title' => $title,
@@ -45,23 +59,26 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     );
     );
   }
   }
 
 
-  private function assertLinkOnNode($field_name, $link_value, $message = '', $group = 'Other') {
+  /**
+   * Assert Link On Node.
+   */
+  protected function assertLinkOnNode($field_name, $link_value, $message = '', $group = 'Other') {
     $this->zebra++;
     $this->zebra++;
     $zebra_string = ($this->zebra % 2 == 0) ? 'even' : 'odd';
     $zebra_string = ($this->zebra % 2 == 0) ? 'even' : 'odd';
-    $cssFieldLocator = 'field-'. str_replace('_', '-', $field_name);
-    $this->assertPattern('@<div class="field field-type-link '. $cssFieldLocator .'".*<div class="field-item '. $zebra_string .'">\s*'. $link_value .'\s*</div>@is',
-                         $message,
-                         $group);
+    $cssFieldLocator = 'field-' . str_replace('_', '-', $field_name);
+    $this->assertPattern('@<div class="field field-type-link ' . $cssFieldLocator . '".*<div class="field-item ' . $zebra_string . '">\s*' . $link_value . '\s*</div>@is',
+      $message,
+      $group);
   }
   }
 
 
   /**
   /**
-   * 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() {
-    /*$this->acquireContentTypes(1);
-    variable_set('node_options_'. $this->content_types[0]->name, array('status', 'promote'));*/
-
+  public function testBasic() {
     $content_type_friendly = $this->randomName(20);
     $content_type_friendly = $this->randomName(20);
     $content_type_machine = strtolower($this->randomName(10));
     $content_type_machine = strtolower($this->randomName(10));
     $title = $this->randomName(20);
     $title = $this->randomName(20);
@@ -71,7 +88,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     // Create the content type.
     // Create the content type.
     $this->clickLink(t('Add content type'));
     $this->clickLink(t('Add content type'));
 
 
-    $edit = array (
+    $edit = array(
       'name' => $content_type_friendly,
       'name' => $content_type_friendly,
       'type' => $content_type_machine,
       'type' => $content_type_machine,
     );
     );
@@ -81,8 +98,8 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     // Now add a singleton field.
     // Now add a singleton field.
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_machine = strtolower($this->randomName(10));
     $single_field_name_machine = strtolower($this->randomName(10));
-    $single_field_name = 'field_'. $single_field_name_machine;
-    $edit = array (
+
+    $edit = array(
       'fields[_add_new_field][label]' => $single_field_name_friendly,
       'fields[_add_new_field][label]' => $single_field_name_friendly,
       'fields[_add_new_field][field_name]' => $single_field_name_machine,
       'fields[_add_new_field][field_name]' => $single_field_name_machine,
       'fields[_add_new_field][type]' => 'link_field',
       'fields[_add_new_field][type]' => 'link_field',
@@ -106,56 +123,35 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->assertTrue($type_exists, 'The new content type has been created in the database.');
     $this->assertTrue($type_exists, 'The new content type has been created in the database.');
 
 
     $permission = 'create ' . $content_type_machine . ' content';
     $permission = 'create ' . $content_type_machine . ' content';
-    $permission_edit = 'edit ' . $content_type_machine . ' content';
+
     // Reset the permissions cache.
     // Reset the permissions cache.
     $this->checkPermissions(array($permission), TRUE);
     $this->checkPermissions(array($permission), TRUE);
 
 
     // Now that we have a new content type, create a user that has privileges
     // Now that we have a new content type, create a user that has privileges
     // on the content type.
     // on the content type.
     $permissions = array_merge($this->permissions, array($permission));
     $permissions = array_merge($this->permissions, array($permission));
-    $account = $this->drupalCreateUser($permissions);
-    $this->drupalLogin($account);
+    $this->web_user = $this->drupalCreateUser($permissions);
+    $this->drupalLogin($this->web_user);
 
 
     // Go to page.
     // Go to page.
-    $this->drupalGet('node/add/'. $content_type_machine);
+    $this->drupalGet('node/add/' . $content_type_machine);
 
 
     // Add a node.
     // Add a node.
     $edit = array(
     $edit = array(
       'title' => $title,
       'title' => $title,
-      'field_'. $single_field_name_machine. '[und][0][title]' => 'Link',
-      'field_'. $single_field_name_machine. '[und][0][url]' => 'http://www.drupal.org/',
+      'field_' . $single_field_name_machine . '[und][0][title]' => 'Link',
+      'field_' . $single_field_name_machine . '[und][0][url]' => 'http://www.drupal.org/',
     );
     );
 
 
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertText(t('@content_type_friendly @title has been created', array('@content_type_friendly' => $content_type_friendly, '@title' => $title)));
-
-    /*$field_settings = array(
-      'type' => 'link',
-      'widget_type' => 'link',
-      'type_name' => $this->content_types[0]->name,
-      'attributes' => array(), // <-- This is needed or we have an error.
-    );
-
-    $field = $this->createField($field_settings, 0);
-    //$this->pass('<pre>'. print_r($field, TRUE) .'</pre>');
-    $field_db_info = content_database_info($field);*/
-
-    //$this->acquireNodes(2);
-    /*$node = $this->drupalCreateNode(array('type' => $content_type_machine,
-                                          'promote' => 1));
-    $test_nid = $node->nid;*/
+    $this->assertText(t('@content_type_friendly @title has been created', array(
+      '@content_type_friendly' => $content_type_friendly,
+      '@title' => $title,
+    )));
 
 
-    //$node = node_load($this->nodes[0]->nid);
-    //$node->promote = 1; // We want this to show on front page for the teaser test.
-    /*$this->assert('debug', print_r($node, TRUE), 'Debug');
-    $node->{$single_field_name}['und'][0] = $this->createLink('http://www.example.com', 'Test Link');
-    node_save($node);
-    $this->assert('debug', print_r($node, TRUE), 'Debug');*/
+    $this->drupalGet('node/add/' . $content_type_machine);
 
 
-    //$this->drupalGet('node/'. $test_nid .'/edit');
-    $this->drupalGet('node/add/'. $content_type_machine);
-
-    // lets add a node:
+    // Create a node:
     $edit = array(
     $edit = array(
       'title' => $title,
       'title' => $title,
       'field_' . $single_field_name_machine . '[und][0][url]' => 'http://www.example.com/',
       'field_' . $single_field_name_machine . '[und][0][url]' => 'http://www.example.com/',
@@ -164,29 +160,21 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
 
 
     // Now we can fill in the second item in the multivalue field and save.
     // Now we can fill in the second item in the multivalue field and save.
     $this->drupalPost(NULL, $edit, t('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->assertText('Display');
-    //$this->assertText('http://www.example.com/');
     $this->assertLinkByHref('http://www.example.com');
     $this->assertLinkByHref('http://www.example.com');
   }
   }
 
 
-  private function createNodeType($content_type_machine, $content_type_friendly) {
-    $this->drupalGet('admin/structure/types');
-
-    // Create the content type.
-    $this->clickLink(t('Add content type'));
-
-    $edit = array (
-      'name' => $content_type_friendly,
-      'type' => $content_type_machine,
-    );
-    $this->drupalPost(NULL, $edit, t('Save and add fields'));
-    $this->assertText(t('The content type @name has been added.', array('@name' => $content_type_friendly)));
-  }
-
-  private function createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine) {
-    $edit = array (
+  /**
+   * 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(
       'fields[_add_new_field][label]' => $single_field_name_friendly,
       'fields[_add_new_field][label]' => $single_field_name_friendly,
       'fields[_add_new_field][field_name]' => $single_field_name_machine,
       'fields[_add_new_field][field_name]' => $single_field_name_machine,
       'fields[_add_new_field][type]' => 'link_field',
       'fields[_add_new_field][type]' => 'link_field',
@@ -209,22 +197,26 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
     $this->assertTrue($type_exists, 'The new content type has been created in the database.');
     $this->assertTrue($type_exists, 'The new content type has been created in the database.');
   }
   }
 
 
-  function createNodeTypeUser($content_type_machine) {
+  /**
+   * Create Node Type User.
+   */
+  protected function createNodeTypeUser($content_type_machine) {
     $permission = 'create ' . $content_type_machine . ' content';
     $permission = 'create ' . $content_type_machine . ' content';
-    $permission_edit = 'edit ' . $content_type_machine . ' content';
     // Reset the permissions cache.
     // Reset the permissions cache.
     $this->checkPermissions(array($permission), TRUE);
     $this->checkPermissions(array($permission), TRUE);
 
 
     // Now that we have a new content type, create a user that has privileges
     // Now that we have a new content type, create a user that has privileges
     // on the content type.
     // on the content type.
     $permissions = array_merge($this->permissions, array($permission));
     $permissions = array_merge($this->permissions, array($permission));
-    $account = $this->drupalCreateUser($permissions);
-    $this->drupalLogin($account);
+    $this->web_user = $this->drupalCreateUser($permissions);
+    $this->drupalLogin($this->web_user);
   }
   }
 
 
-  function createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $title, $url, $node_title = '') {
-    // Go to page.
-    $this->drupalGet('node/add/'. $content_type_machine);
+  /**
+   * 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);
 
 
     if (!$node_title) {
     if (!$node_title) {
       $node_title = $this->randomName(20);
       $node_title = $this->randomName(20);
@@ -239,543 +231,359 @@ class LinkAttributeCrudTest extends DrupalWebTestCase {
       $edit['field_' . $single_field_name_machine . '[und][0][title]'] = $title;
       $edit['field_' . $single_field_name_machine . '[und][0][title]'] = $title;
     }
     }
 
 
-    // Now we can fill in the second item in the multivalue field and save.
     $this->drupalPost(NULL, $edit, t('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' => $node_title)));
+    $this->assertText(t('@content_type_friendly @title has been created', array(
+      '@content_type_friendly' => $content_type_friendly,
+      '@title' => $node_title,
+    )));
 
 
   }
   }
 
 
-  function testFormatterPlain() {
+  /**
+   * Test the link_plain formatter and it's output.
+   */
+  public function testFormatterPlain() {
     $content_type_friendly = $this->randomName(20);
     $content_type_friendly = $this->randomName(20);
     $content_type_machine = strtolower($this->randomName(10));
     $content_type_machine = strtolower($this->randomName(10));
 
 
-    $this->createNodeType($content_type_machine, $content_type_friendly);
+    $this->drupalCreateContentType(array(
+      'type' => $content_type_machine,
+      'name' => $content_type_friendly,
+    ));
 
 
     // Now add a singleton field.
     // Now add a singleton field.
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_machine = strtolower($this->randomName(10));
     $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);
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
 
     // Okay, now we want to make sure this display is changed:
     // 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(
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_plain',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_plain',
     );
     );
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->drupalPost(NULL, $edit, t('Save'));
 
 
     $this->createNodeTypeUser($content_type_machine);
     $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_url);
-    $this->assertNoText($link_text);
-    $this->assertNoLinkByHref($link_url);
-  }
-
-  function testFormatterPlainWithQuerystring() {
-    $content_type_friendly = $this->randomName(20);
-    $content_type_machine = strtolower($this->randomName(10));
-
-    $this->createNodeType($content_type_machine, $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;
-    $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(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_plain',
+    $link_tests = array(
+      'plain' => array(
+        'text' => 'Display',
+        'url' => 'http://www.example.com/',
+      ),
+      'query' => array(
+        'text' => 'Display',
+        'url' => 'http://www.example.com/?q=test',
+      ),
+      'fragment' => array(
+        'text' => 'Display',
+        'url' => 'http://www.example.com/#test',
+      ),
     );
     );
-    $this->drupalPost(NULL, $edit, t('Save'));
-
-    $this->createNodeTypeUser($content_type_machine);
 
 
-    $link_text = 'Display';
-    $link_url = 'http://www.example.com/?q=test';
-    $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
+    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);
+      $this->assertText($link_url);
+      $this->assertNoText($link_text);
+      $this->assertNoLinkByHref($link_url);
+    }
   }
   }
 
 
-  function testFormatterPlainWithFragment() {
+  /**
+   * Formatter Host.
+   */
+  public function testFormatterHost() {
     $content_type_friendly = $this->randomName(20);
     $content_type_friendly = $this->randomName(20);
     $content_type_machine = strtolower($this->randomName(10));
     $content_type_machine = strtolower($this->randomName(10));
 
 
-    $this->createNodeType($content_type_machine, $content_type_friendly);
+    $this->drupalCreateContentType(array(
+      'type' => $content_type_machine,
+      'name' => $content_type_friendly,
+    ));
 
 
     // Now add a singleton field.
     // Now add a singleton field.
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_machine = strtolower($this->randomName(10));
     $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);
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
 
     // Okay, now we want to make sure this display is changed:
     // 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(
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_plain',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_host',
     );
     );
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->drupalPost(NULL, $edit, t('Save'));
 
 
     $this->createNodeTypeUser($content_type_machine);
     $this->createNodeTypeUser($content_type_machine);
 
 
     $link_text = 'Display';
     $link_text = 'Display';
-    $link_url = 'http://www.example.com/#test';
+    $link_url = 'http://www.example.com/';
     $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
     $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 
 
-    $this->assertText($link_url);
+    $this->assertText('www.example.com');
     $this->assertNoText($link_text);
     $this->assertNoText($link_text);
     $this->assertNoLinkByHref($link_url);
     $this->assertNoLinkByHref($link_url);
   }
   }
 
 
-  function testFormatterURL() {
+  /**
+   * Formatter URL.
+   *
+   * @codingStandardsIgnoreStart
+   */
+  public function testFormatterURL() {
+    // @codingStandardsIgnoreEnd
     $content_type_friendly = $this->randomName(20);
     $content_type_friendly = $this->randomName(20);
     $content_type_machine = strtolower($this->randomName(10));
     $content_type_machine = strtolower($this->randomName(10));
 
 
-    $this->createNodeType($content_type_machine, $content_type_friendly);
+    $this->drupalCreateContentType(array(
+      'type' => $content_type_machine,
+      'name' => $content_type_friendly,
+    ));
 
 
     // Now add a singleton field.
     // Now add a singleton field.
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_machine = strtolower($this->randomName(10));
     $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);
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
 
     // Okay, now we want to make sure this display is changed:
     // 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(
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_url',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_url',
     );
     );
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->drupalPost(NULL, $edit, t('Save'));
 
 
     $this->createNodeTypeUser($content_type_machine);
     $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->assertNoText($link_text);
-    $this->assertLinkByHref($link_url);
-  }
-
-  function testFormatterURLWithQuerystring() {
-    $content_type_friendly = $this->randomName(20);
-    $content_type_machine = strtolower($this->randomName(10));
-
-    $this->createNodeType($content_type_machine, $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;
-    $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(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_url',
+    $link_tests = array(
+      'plain' => array(
+        'text' => 'Display',
+        'url' => 'http://www.example.com/',
+      ),
+      'query' => array(
+        'text' => 'Display',
+        'url' => 'http://www.example.com/?q=test',
+      ),
+      'fragment' => array(
+        'text' => 'Display',
+        'url' => 'http://www.example.com/#test',
+      ),
     );
     );
-    $this->drupalPost(NULL, $edit, t('Save'));
-
-    $this->createNodeTypeUser($content_type_machine);
 
 
-    $link_text = 'Display';
-    $link_url = 'http://www.example.com/?q=test';
-    $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
+    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);
+      $this->assertNoText($link_text);
+      $this->assertLinkByHref($link_url);
+    }
   }
   }
 
 
-  function testFormatterURLWithAnchor() {
+  /**
+   * Formatter Short.
+   */
+  public function testFormatterShort() {
     $content_type_friendly = $this->randomName(20);
     $content_type_friendly = $this->randomName(20);
     $content_type_machine = strtolower($this->randomName(10));
     $content_type_machine = strtolower($this->randomName(10));
 
 
-    $this->createNodeType($content_type_machine, $content_type_friendly);
+    $this->drupalCreateContentType(array(
+      'type' => $content_type_machine,
+      'name' => $content_type_friendly,
+    ));
 
 
     // Now add a singleton field.
     // Now add a singleton field.
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_machine = strtolower($this->randomName(10));
     $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);
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
 
     // Okay, now we want to make sure this display is changed:
     // 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(
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_url',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_short',
     );
     );
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->drupalPost(NULL, $edit, t('Save'));
 
 
     $this->createNodeTypeUser($content_type_machine);
     $this->createNodeTypeUser($content_type_machine);
 
 
-    $link_text = 'Display';
-    $link_url = 'http://www.example.com/#test';
-    $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() {
-    $content_type_friendly = $this->randomName(20);
-    $content_type_machine = strtolower($this->randomName(10));
-
-    $this->createNodeType($content_type_machine, $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;
-    $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(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_short',
+    $link_tests = array(
+      'plain' => array(
+        'text' => 'Display',
+        'url' => 'http://www.example.com/',
+      ),
+      'query' => array(
+        'text' => 'Display',
+        'url' => 'http://www.example.com/?q=test',
+      ),
+      'fragment' => array(
+        'text' => 'Display',
+        'url' => 'http://www.example.com/#test',
+      ),
     );
     );
-    $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);
+    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);
+      $this->assertText('Link');
+      $this->assertNoText($link_text);
+      $this->assertLinkByHref($link_url);
+    }
   }
   }
 
 
-  function testFormatterShortWithQuerystring() {
+  /**
+   * Formatter Label.
+   */
+  public function testFormatterLabel() {
     $content_type_friendly = $this->randomName(20);
     $content_type_friendly = $this->randomName(20);
     $content_type_machine = strtolower($this->randomName(10));
     $content_type_machine = strtolower($this->randomName(10));
 
 
-    $this->createNodeType($content_type_machine, $content_type_friendly);
+    $this->drupalCreateContentType(array(
+      'type' => $content_type_machine,
+      'name' => $content_type_friendly,
+    ));
 
 
     // Now add a singleton field.
     // Now add a singleton field.
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_machine = strtolower($this->randomName(10));
     $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);
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
 
     // Okay, now we want to make sure this display is changed:
     // 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(
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_short',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_label',
     );
     );
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->drupalPost(NULL, $edit, t('Save'));
 
 
     $this->createNodeTypeUser($content_type_machine);
     $this->createNodeTypeUser($content_type_machine);
 
 
-    $link_text = 'Display';
-    $link_url = 'http://www.example.com/?q=test';
-    $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 testFormatterShortWithFragment() {
-    $content_type_friendly = $this->randomName(20);
-    $content_type_machine = strtolower($this->randomName(10));
-
-    $this->createNodeType($content_type_machine, $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;
-    $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(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_short',
+    $link_tests = array(
+      'plain' => array(
+        'text' => 'Display',
+        'url' => 'http://www.example.com/',
+      ),
+      'query' => array(
+        'text' => 'Display',
+        'url' => 'http://www.example.com/?q=test',
+      ),
+      'fragment' => array(
+        'text' => 'Display',
+        'url' => 'http://www.example.com/#test',
+      ),
     );
     );
-    $this->drupalPost(NULL, $edit, t('Save'));
-
-    $this->createNodeTypeUser($content_type_machine);
 
 
-    $link_text = 'Display';
-    $link_url = 'http://www.example.com/#test';
-    $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
+    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);
+      $this->assertNoText($link_text);
+      $this->assertText($single_field_name_friendly);
+      $this->assertLinkByHref($link_url);
+    }
   }
   }
 
 
-  function testFormatterLabel() {
+  /**
+   * Formatter Separate.
+   */
+  public function testFormatterSeparate() {
     $content_type_friendly = $this->randomName(20);
     $content_type_friendly = $this->randomName(20);
     $content_type_machine = strtolower($this->randomName(10));
     $content_type_machine = strtolower($this->randomName(10));
 
 
-    $this->createNodeType($content_type_machine, $content_type_friendly);
+    $this->drupalCreateContentType(array(
+      'type' => $content_type_machine,
+      'name' => $content_type_friendly,
+    ));
 
 
     // Now add a singleton field.
     // Now add a singleton field.
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_machine = strtolower($this->randomName(10));
     $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);
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
 
     // Okay, now we want to make sure this display is changed:
     // 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(
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_label',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_separate',
     );
     );
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->drupalPost(NULL, $edit, t('Save'));
 
 
     $this->createNodeTypeUser($content_type_machine);
     $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->assertNoText($link_text);
-    $this->assertText($single_field_name_friendly);
-    $this->assertLinkByHref($link_url);
-  }
-
-  function testFormatterLabelWithQuerystring() {
-    $content_type_friendly = $this->randomName(20);
-    $content_type_machine = strtolower($this->randomName(10));
-
-    $this->createNodeType($content_type_machine, $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;
-    $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(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_label',
+    $plain_url = 'http://www.example.com/';
+    $link_tests = array(
+      'plain' => array(
+        'text' => $this->randomName(20),
+        'url' => $plain_url,
+      ),
+      'query' => array(
+        'text' => $this->randomName(20),
+        'url' => $plain_url . '?q=test',
+      ),
+      'fragment' => array(
+        'text' => $this->randomName(20),
+        'url' => $plain_url . '#test',
+      ),
     );
     );
-    $this->drupalPost(NULL, $edit, t('Save'));
 
 
-    $this->createNodeTypeUser($content_type_machine);
+    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);
 
 
-    $link_text = 'Display';
-    $link_url = 'http://www.example.com/?q=test';
-    $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);
+      $this->assertText($link_text);
+      $this->assertLink($plain_url);
+      $this->assertLinkByHref($link_url);
+    }
   }
   }
 
 
-  function testFormatterLabelWithFragment() {
+  /**
+   * Formatter Plain Title.
+   */
+  public function testFormatterPlainTitle() {
     $content_type_friendly = $this->randomName(20);
     $content_type_friendly = $this->randomName(20);
     $content_type_machine = strtolower($this->randomName(10));
     $content_type_machine = strtolower($this->randomName(10));
 
 
-    $this->createNodeType($content_type_machine, $content_type_friendly);
+    $this->drupalCreateContentType(array(
+      'type' => $content_type_machine,
+      'name' => $content_type_friendly,
+    ));
 
 
     // Now add a singleton field.
     // Now add a singleton field.
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_machine = strtolower($this->randomName(10));
     $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);
     $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine);
 
 
     // Okay, now we want to make sure this display is changed:
     // 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(
     $edit = array(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_label',
+      'fields[field_' . $single_field_name_machine . '][label]' => 'above',
+      'fields[field_' . $single_field_name_machine . '][type]' => 'link_title_plain',
     );
     );
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->drupalPost(NULL, $edit, t('Save'));
 
 
     $this->createNodeTypeUser($content_type_machine);
     $this->createNodeTypeUser($content_type_machine);
 
 
     $link_text = 'Display';
     $link_text = 'Display';
-    $link_url = 'http://www.example.com/#test';
-    $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() {
-    $content_type_friendly = $this->randomName(20);
-    $content_type_machine = strtolower($this->randomName(10));
-
-    $this->createNodeType($content_type_machine, $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;
-    $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(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_separate',
-    );
-    $this->drupalPost(NULL, $edit, t('Save'));
-
-    $this->createNodeTypeUser($content_type_machine);
-
-    $link_text = $this->randomName(20);
     $link_url = 'http://www.example.com/';
     $link_url = 'http://www.example.com/';
     $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
     $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
 
 
-    $this->assertText($link_text);
-    $this->assertLink($link_url);
-    $this->assertLinkByHref($link_url);
-  }
-
-  function testFormatterSeparateWithQuerystring() {
-    $content_type_friendly = $this->randomName(20);
-    $content_type_machine = strtolower($this->randomName(10));
-
-    $this->createNodeType($content_type_machine, $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;
-    $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(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_separate',
-    );
-    $this->drupalPost(NULL, $edit, t('Save'));
-
-    $this->createNodeTypeUser($content_type_machine);
-
-    $link_text = $this->randomName(20);
-    $link_url = 'http://www.example.com/?q=test';
-    $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
-
-    $this->assertText($link_text);
-    $this->assertLink('http://www.example.com/');
-    $this->assertLinkByHref($link_url);
-  }
-
-  function testFormatterSeparateWithFragment() {
-    $content_type_friendly = $this->randomName(20);
-    $content_type_machine = strtolower($this->randomName(10));
-
-    $this->createNodeType($content_type_machine, $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;
-    $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(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      'fields[field_'. $single_field_name_machine .'][type]' => 'link_separate',
-    );
-    $this->drupalPost(NULL, $edit, t('Save'));
-
-    $this->createNodeTypeUser($content_type_machine);
-
-    $link_text = $this->randomName(20);
-    $link_url = 'http://www.example.com/#test';
-    $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url);
-
-    $this->assertText($link_text);
-    $this->assertLink('http://www.example.com/');
-    $this->assertLinkByHref($link_url);
-  }
-  
-  function testFormatterPlainTitle() {
-    $content_type_friendly = $this->randomName(20);
-    $content_type_machine = strtolower($this->randomName(10));
-    
-    $this->createNodeType($content_type_machine, $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;
-    $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(
-      'fields[field_'. $single_field_name_machine .'][label]' => 'above',
-      '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->assertText($link_text);
     $this->assertNoText($link_url);
     $this->assertNoText($link_url);
     $this->assertNoLinkByHref($link_url);
     $this->assertNoLinkByHref($link_url);
   }
   }
 
 
-  /**
-   * This test sees that we can create a link field with a defined class, and make sure
-   * that class displays properly when the link is displayed.
-   */
-  /*function testLinkWithClassOnField() {
-    $this->acquireContentTypes(1);
-    $field_settings = array(
-      'type' => 'link',
-      'widget_type' => 'link',
-      'type_name' => $this->content_types[0]->name,
-      'attributes' => array(
-        'class' => 'test-class',
-        'target' => 'default',
-        'rel' => FALSE,
-      ),
-    );
-
-    $field = $this->createField($field_settings, 0);
-    //$this->pass('<pre>'. print_r($field, TRUE) .'</pre>');
-    $field_db_info = content_database_info($field);
-
-    $this->acquireNodes(2);
-
-    $node = node_load($this->nodes[0]->nid);
-    $node->promote = 1; // We want this to show on front page for the teaser test.
-    $node->{$field['field_name']}[0] = $this->createLink('http://www.example.com', 'Test Link');
-    node_save($node);
-
-    // Does this display on the node page?
-    $this->drupalGet('node/'. $this->nodes[0]->nid);
-    //$this->outputScreenContents('Link field with class', 'link_');
-    $this->assertLinkOnNode($field['field_name'], l('Test Link', 'http://www.example.com', array('attributes' => array('class' => 'test-class'))));
-
-    // Does this display on the front page?
-    $this->drupalGet('<front>');
-    // reset the zebra!
-    $this->zebra = 0;
-    $this->assertLinkOnNode($field['field_name'], l('Test Link', 'http://www.example.com', array('attributes' => array('class' => 'test-class'))));
-  }*/
-
 }
 }

+ 31 - 24
sites/all/modules/link/tests/link.crud.test

@@ -2,11 +2,20 @@
 
 
 /**
 /**
  * @file
  * @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 {
 class LinkContentCrudTest extends DrupalWebTestCase {
 
 
+  /**
+   * Get Info.
+   */
   public static function getInfo() {
   public static function getInfo() {
     return array(
     return array(
       'name' => 'Link CRUD - Basic API tests',
       'name' => 'Link CRUD - Basic API tests',
@@ -15,47 +24,53 @@ class LinkContentCrudTest extends DrupalWebTestCase {
     );
     );
   }
   }
 
 
-  function setUp() {
-    parent::setUp('field_ui', 'link'); // was views?
-    //$this->loginWithPermissions();
+  /**
+   * 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_friendly = $this->randomName(20);
     $content_type_machine = strtolower($this->randomName(10));
     $content_type_machine = strtolower($this->randomName(10));
-    $title = $this->randomName(20);
 
 
     // Create and login user.
     // Create and login user.
-    $account = $this->drupalCreateUser(array('administer content types'));
-    $this->drupalLogin($account);
+    $this->web_user = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer fields',
+    ));
+    $this->drupalLogin($this->web_user);
 
 
     $this->drupalGet('admin/structure/types');
     $this->drupalGet('admin/structure/types');
 
 
     // Create the content type.
     // Create the content type.
     $this->clickLink(t('Add content type'));
     $this->clickLink(t('Add content type'));
 
 
-
-    $edit = array (
+    $edit = array(
       'name' => $content_type_friendly,
       'name' => $content_type_friendly,
       'type' => $content_type_machine,
       'type' => $content_type_machine,
     );
     );
     $this->drupalPost(NULL, $edit, t('Save and add fields'));
     $this->drupalPost(NULL, $edit, t('Save and add fields'));
     $this->assertText(t('The content type @name has been added.', array('@name' => $content_type_friendly)));
     $this->assertText(t('The content type @name has been added.', array('@name' => $content_type_friendly)));
 
 
-    //$field = $this->createField(array('type' => 'link', 'widget_type' => 'link'), 0);
     // Now add a singleton field.
     // Now add a singleton field.
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_friendly = $this->randomName(20);
     $single_field_name_machine = strtolower($this->randomName(10));
     $single_field_name_machine = strtolower($this->randomName(10));
-    $edit = array (
+    $edit = array(
       'fields[_add_new_field][label]' => $single_field_name_friendly,
       'fields[_add_new_field][label]' => $single_field_name_friendly,
       'fields[_add_new_field][field_name]' => $single_field_name_machine,
       'fields[_add_new_field][field_name]' => $single_field_name_machine,
       'fields[_add_new_field][type]' => 'link_field',
       'fields[_add_new_field][type]' => 'link_field',
       'fields[_add_new_field][widget_type]' => 'link_field',
       'fields[_add_new_field][widget_type]' => 'link_field',
-
     );
     );
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->drupalPost(NULL, $edit, t('Save'));
 
 
@@ -72,14 +87,6 @@ class LinkContentCrudTest extends DrupalWebTestCase {
     menu_rebuild();
     menu_rebuild();
     $type_exists = db_query('SELECT 1 FROM {node_type} WHERE type = :type', array(':type' => $content_type_machine))->fetchField();
     $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.');
     $this->assertTrue($type_exists, 'The new content type has been created in the database.');
-
-    /*$table_schema = drupal_get_schema();
-    $this->assertEqual(1, 1, print_r(array_keys($table_schema), TRUE));
-    // Check the schema - the values should be in the per-type table.
-    $this->assertSchemaMatchesTables(array(
-      'per_type' => array(
-        $this->content_types[0]->type => array($field['field_name'] => array('url', 'title', 'attributes')),
-      ),
-    ));*/
   }
   }
+
 }
 }

+ 309 - 159
sites/all/modules/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 {
 class LinkUITest extends DrupalWebTestcase {
 
 
   /**
   /**
-   * Link supposed to be good
+   * Link supposed to be good.
    */
    */
   const LINK_INPUT_TYPE_GOOD = 0;
   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;
   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;
   const LINK_INPUT_TYPE_BAD_URL = 2;
 
 
+  /**
+   * Get Info.
+   */
   public static function getInfo() {
   public static function getInfo() {
     return array(
     return array(
       'name' => 'Link CRUD - browser test',
       'name' => 'Link CRUD - browser test',
@@ -33,24 +36,30 @@ class LinkUITest extends DrupalWebTestcase {
     );
     );
   }
   }
 
 
-  function setUp() {
+  /**
+   * Setup.
+   */
+  public function setUp() {
     parent::setUp('field_ui', 'link');
     parent::setUp('field_ui', 'link');
   }
   }
 
 
   /**
   /**
    * Creates a link field for the "page" type and creates a page with a link.
    * Creates a link field for the "page" type and creates a page with a link.
    */
    */
-  function testLinkCreate() {
-    //libxml_use_internal_errors(true);
-    $account = $this->drupalCreateUser(array('administer content types',
-                                             'administer nodes',
-                                             'administer filters',
-                                             'access content',
-                                             'create page content',
-                                             'access administration pages'));
-    $this->drupalLogin($account);
-
-    // create field
+  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',
+    ));
+    $this->drupalLogin($this->web_user);
+
+    // Create field.
     $name = strtolower($this->randomName());
     $name = strtolower($this->randomName());
     $edit = array(
     $edit = array(
       'fields[_add_new_field][label]' => $name,
       'fields[_add_new_field][label]' => $name,
@@ -70,62 +79,68 @@ class LinkUITest extends DrupalWebTestcase {
     $permission = 'create page content';
     $permission = 'create page content';
     $this->checkPermissions(array($permission), TRUE);
     $this->checkPermissions(array($permission), TRUE);
 
 
-    // create page form
-    //$this->drupalGet('node/add');
+    // Create page form
+    // $this->drupalGet('node/add');.
     $this->drupalGet('node/add/page');
     $this->drupalGet('node/add/page');
     $field_name = 'field_' . $name;
     $field_name = 'field_' . $name;
-    $this->assertField('edit-field-'. $name .'-und-0-title', 'Title found');
-    $this->assertField('edit-field-'. $name .'-und-0-url', 'URL found');
+    $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found');
+    $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found');
 
 
     $input_test_cases = array(
     $input_test_cases = array(
       array(
       array(
         'href' => 'http://example.com/' . $this->randomName(),
         'href' => 'http://example.com/' . $this->randomName(),
         'label' => $this->randomName(),
         'label' => $this->randomName(),
         'msg' => 'Link found',
         'msg' => 'Link found',
-        'type' => self::LINK_INPUT_TYPE_GOOD
+        'type' => self::LINK_INPUT_TYPE_GOOD,
       ),
       ),
       array(
       array(
         'href' => 'http://example.com/' . $this->randomName(),
         'href' => 'http://example.com/' . $this->randomName(),
         'label' => $this->randomName() . '<script>alert("hi");</script>',
         'label' => $this->randomName() . '<script>alert("hi");</script>',
         'msg' => 'js label',
         'msg' => 'js label',
-        'type' => self::LINK_INPUT_TYPE_BAD_TITLE
+        'type' => self::LINK_INPUT_TYPE_BAD_TITLE,
       ),
       ),
       array(
       array(
         'href' => 'http://example.com/' . $this->randomName(),
         'href' => 'http://example.com/' . $this->randomName(),
         'label' => $this->randomName() . '<script src="http://devil.site.com"></script>',
         'label' => $this->randomName() . '<script src="http://devil.site.com"></script>',
         'msg' => 'js label',
         'msg' => 'js label',
-        'type' => self::LINK_INPUT_TYPE_BAD_TITLE
+        'type' => self::LINK_INPUT_TYPE_BAD_TITLE,
       ),
       ),
       array(
       array(
         'href' => 'http://example.com/' . $this->randomName(),
         'href' => 'http://example.com/' . $this->randomName(),
         'label' => $this->randomName() . '" onmouseover="alert(\'hi\')',
         'label' => $this->randomName() . '" onmouseover="alert(\'hi\')',
         'msg' => 'js label',
         'msg' => 'js label',
-        'type' => self::LINK_INPUT_TYPE_BAD_TITLE
+        'type' => self::LINK_INPUT_TYPE_BAD_TITLE,
       ),
       ),
-       array(
+      array(
         'href' => 'http://example.com/' . $this->randomName(),
         'href' => 'http://example.com/' . $this->randomName(),
         'label' => $this->randomName() . '\' onmouseover="alert(\'hi\')',
         'label' => $this->randomName() . '\' onmouseover="alert(\'hi\')',
         'msg' => 'js label',
         'msg' => 'js label',
-        'type' => self::LINK_INPUT_TYPE_BAD_TITLE
+        'type' => self::LINK_INPUT_TYPE_BAD_TITLE,
       ),
       ),
-     array(
+      array(
         'href' => 'javascript:alert("http://example.com/' . $this->randomName() . '")',
         'href' => 'javascript:alert("http://example.com/' . $this->randomName() . '")',
         'label' => $this->randomName(),
         'label' => $this->randomName(),
         'msg' => 'js url',
         '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-',
+        'label' => 'http://ecs-es.kelkoo.es/ctl/go/sitesearchGo?.ts=1338833010331&.sig=qP9GXeEFH6syBzwmzYkxmsvp1EI-',
+        'msg' => 'Url with . in querystring',
+        'type' => self::LINK_INPUT_TYPE_GOOD,
       ),
       ),
     );
     );
     $test_case = array(
     $test_case = array(
-      'href' => 'www.example.com/'. $this->randomName(),
+      'href' => 'www.example.com/' . $this->randomName(),
       'label' => $this->randomName(),
       'label' => $this->randomName(),
       'msg' => 'Link found',
       'msg' => 'Link found',
       'type' => self::LINK_INPUT_TYPE_GOOD,
       'type' => self::LINK_INPUT_TYPE_GOOD,
     );
     );
-    $test_case['expected_href'] = 'http://'. $test_case['href'];
+    $test_case['expected_href'] = 'http://' . $test_case['href'];
     $input_test_cases[] = $test_case;
     $input_test_cases[] = $test_case;
 
 
     foreach ($input_test_cases as $input) {
     foreach ($input_test_cases as $input) {
-      $this->drupalLogin($account);
+      $this->drupalLogin($this->web_user);
       $this->drupalGet('node/add/page');
       $this->drupalGet('node/add/page');
 
 
       $edit = array(
       $edit = array(
@@ -135,49 +150,60 @@ class LinkUITest extends DrupalWebTestcase {
       );
       );
       $this->drupalPost(NULL, $edit, t('Save'));
       $this->drupalPost(NULL, $edit, t('Save'));
       if ($input['type'] == self::LINK_INPUT_TYPE_BAD_URL) {
       if ($input['type'] == self::LINK_INPUT_TYPE_BAD_URL) {
-        $this->assertRaw(t('Not a valid URL.'), '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;
         continue;
       }
       }
       else {
       else {
-        $this->assertRaw(t(' has been created.',
-                           array('@type' => 'Basic Page', '%title' => $edit['title'])),
-                         'Page created: ' . $input['href']);
+        $this->assertRaw(' ' . t('has been created.',
+            array('@type' => 'Basic Page', '%title' => $edit['title'])),
+          'Page created: ' . $input['href']);
       }
       }
       $url = $this->getUrl();
       $url = $this->getUrl();
 
 
-      // change to anonym user
+      // Change to Anonymous user.
       $this->drupalLogout();
       $this->drupalLogout();
 
 
       $this->drupalGet($url);
       $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));
       $this->assertFalse(libxml_use_internal_errors(TRUE));
       if (isset($input['expected_href'])) {
       if (isset($input['expected_href'])) {
-        $path = '//a[@href="'. $input['expected_href'] .'" and text()="'. $input['label'] .'"]';
+        $path = '//a[@href="' . $input['expected_href'] . '" and text()="' . $input['label'] . '"]';
       }
       }
       else {
       else {
-        $path = '//a[@href="'. $input['href'] .'" and text()="'. $input['label'] .'"]';
+        $path = '//a[@href="' . $input['href'] . '" and text()="' . $input['label'] . '"]';
       }
       }
-      //$this->pass(htmlentities($path));
       $elements = $this->xpath($path);
       $elements = $this->xpath($path);
       libxml_use_internal_errors(FALSE);
       libxml_use_internal_errors(FALSE);
       $this->assertIdentical(isset($elements[0]), $input['type'] == self::LINK_INPUT_TYPE_GOOD, $input['msg']);
       $this->assertIdentical(isset($elements[0]), $input['type'] == self::LINK_INPUT_TYPE_GOOD, $input['msg']);
     }
     }
-    //libxml_use_internal_errors(FALSE);
+    // libxml_use_internal_errors(FALSE);
   }
   }
 
 
   /**
   /**
-   * Creates a link field for the "page" type and creates a page with a link.
-   * Just like the above test, only here we're turning off the validation on the field.
+   * Static Link Create.
+   *
+   * Testing that if you use <strong> in a static title for your link, that the
+   * title actually displays <strong>.
    */
    */
-  /*function testLinkCreate_NoValidation() {
-    //libxml_use_internal_errors(true);
-    $account = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content'));
-    $this->drupalLogin($account);
+  public function testStaticLinkCreate() {
+
+    $this->web_user = $this->drupalCreateUser(array(
+      'administer content types',
+      'administer fields',
+      'access content',
+      'create page content',
+    ));
 
 
-    // create field
+    $this->drupalLogin($this->web_user);
+
+    // Create field.
     $name = strtolower($this->randomName());
     $name = strtolower($this->randomName());
+    $field_name = 'field_' . $name;
     $edit = array(
     $edit = array(
       'fields[_add_new_field][label]' => $name,
       'fields[_add_new_field][label]' => $name,
       'fields[_add_new_field][field_name]' => $name,
       'fields[_add_new_field][field_name]' => $name,
@@ -186,107 +212,58 @@ class LinkUITest extends DrupalWebTestcase {
     );
     );
     $this->drupalPost('admin/structure/types/manage/page/fields', $edit, t('Save'));
     $this->drupalPost('admin/structure/types/manage/page/fields', $edit, t('Save'));
     $this->drupalPost(NULL, array(), t('Save field settings'));
     $this->drupalPost(NULL, array(), t('Save field settings'));
-    $this->drupalPost(NULL, array('validate_url' => FALSE), t('Save settings'));
+    $this->drupalPost(NULL, array(
+      'instance[settings][title]' => 'value',
+      'instance[settings][title_value]' => '<strong>' . $name . '</strong>',
+    ), t('Save settings'));
 
 
     // Is field created?
     // Is field created?
     $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');
     $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');
-    _content_type_info(TRUE);
-    $fields = content_fields();
-    $this->assertTRUE(0 === $fields['field_'. $name]['validate_url'], 'Make sure validation is off.');
 
 
-    // create page form
+    // Create page form.
     $this->drupalGet('node/add/page');
     $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');
+    $this->assertField($field_name . '[und][0][url]', 'URL found');
 
 
-    $input_test_cases = array(
-      array(
-        'href' => 'http://example.com/' . $this->randomName(),
-        'label' => $this->randomName(),
-        'msg' => 'Link found',
-        '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
-      ),
-      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
-      ),
-      array(
-        'href' => 'http://example.com/' . $this->randomName(),
-        'label' => $this->randomName() . '" onmouseover="alert(\'hi\')',
-        'msg' => 'js label',
-        '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
-      ),
-     array(
-        'href' => 'javascript:alert("http://example.com/' . $this->randomName() . '")',
-        'label' => $this->randomName(),
-        'msg' => 'js url',
-        'type' => self::LINK_INPUT_TYPE_BAD_URL
-      ),
+    $input = array(
+      'href' => 'http://example.com/' . $this->randomName(),
     );
     );
-    foreach ($input_test_cases as $input) {
-      $this->drupalLogin($account);
-      $this->drupalGet('node/add/page');
 
 
-      $edit = array(
-        'title' => $input['label'],
-        $field_name . '[0][title]' => $input['label'],
-        $field_name . '[0][url]' => $input['href'],
-      );
-      $this->drupalPost(NULL, $edit, t('Save'));
-      if ($input['type'] == self::LINK_INPUT_TYPE_BAD_URL) {
-        //$this->assertRaw(t('Not a valid URL.'), 'Not a valid URL: ' . $input['href']);
-        $this->assertNoRaw($input['href']);
-        $this->assertRaw(t('@type %title has been created.', array('@type' => 'Basic Page', '%title' => $edit['title'])), 'Page created: ' . $input['href']);
-        continue;
-      }
-      else {
-        $this->assertRaw(t('@type %title has been created.', array('@type' => 'Basic Page', '%title' => $edit['title'])), 'Page created: ' . $input['href']);
-      }
-      $url = $this->getUrl();
+    $edit = array(
+      'title' => $name,
+      $field_name . '[und][0][url]' => $input['href'],
+    );
+    $this->drupalPost(NULL, $edit, t('Save'));
 
 
-      // change to anonym user
-      $this->drupalLogout();
+    $url = $this->getUrl();
 
 
-      $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.
-      $this->assertFalse(libxml_use_internal_errors(TRUE));
-      $path = '//a[@href="'. $input['href'] .'" and text()="'. $input['label'] .'"]';
-      //$this->pass(htmlentities($path));
-      $elements = $this->xpath($path);
-      libxml_use_internal_errors(FALSE);
-      $this->assertIdentical(isset($elements[0]), $input['type'] == self::LINK_INPUT_TYPE_GOOD, $input['msg']);
-    }
-    //libxml_use_internal_errors(FALSE);
-  }*/
+    // Change to anonymous user.
+    $this->drupalLogout();
+    $this->drupalGet($url);
+
+    $this->assertRaw(l('<strong>' . $name . '</strong>', $input['href'], array('html' => TRUE)));
+  }
 
 
   /**
   /**
-   * Testing that if you use <strong> in a static title for your link, that the
-   * title actually displays <strong>.
+   * CRUD Title Only Title No Link.
+   *
+   * Testing that if you have the title but no url, the title is not sanitized
+   * twice.
+   *
+   * @codingStandardsIgnoreStart
    */
    */
-  function testStaticLinkCreate() {
-    $account = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content'));
-    $this->drupalLogin($account);
-
-    // create field
+  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.
     $name = strtolower($this->randomName());
     $name = strtolower($this->randomName());
-    $field_name = 'field_'. $name;
+    $field_name = 'field_' . $name;
     $edit = array(
     $edit = array(
       'fields[_add_new_field][label]' => $name,
       'fields[_add_new_field][label]' => $name,
       'fields[_add_new_field][field_name]' => $name,
       'fields[_add_new_field][field_name]' => $name,
@@ -296,44 +273,58 @@ class LinkUITest extends DrupalWebTestcase {
     $this->drupalPost('admin/structure/types/manage/page/fields', $edit, t('Save'));
     $this->drupalPost('admin/structure/types/manage/page/fields', $edit, t('Save'));
     $this->drupalPost(NULL, array(), t('Save field settings'));
     $this->drupalPost(NULL, array(), t('Save field settings'));
     $this->drupalPost(NULL, array(
     $this->drupalPost(NULL, array(
-      'instance[settings][title]' => 'value',
-      'instance[settings][title_value]' => '<strong>'. $name .'</strong>'), t('Save settings'));
+      'instance[settings][url]' => 1,
+    ), t('Save settings'));
 
 
     // Is field created?
     // Is field created?
     $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');
     $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');
 
 
-    // create page form
+    // Create page form.
     $this->drupalGet('node/add/page');
     $this->drupalGet('node/add/page');
     $this->assertField($field_name . '[und][0][url]', 'URL found');
     $this->assertField($field_name . '[und][0][url]', 'URL found');
 
 
     $input = array(
     $input = array(
-      'href' => 'http://example.com/' . $this->randomName()
+      'title' => 'This & That',
+      'href' => '',
     );
     );
 
 
     $edit = array(
     $edit = array(
       'title' => $name,
       'title' => $name,
+      $field_name . '[und][0][title]' => $input['title'],
       $field_name . '[und][0][url]' => $input['href'],
       $field_name . '[und][0][url]' => $input['href'],
     );
     );
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->drupalPost(NULL, $edit, t('Save'));
 
 
     $url = $this->getUrl();
     $url = $this->getUrl();
 
 
-    // change to anonymous user
+    // Change to anonymous user.
     $this->drupalLogout();
     $this->drupalLogout();
     $this->drupalGet($url);
     $this->drupalGet($url);
 
 
-    $this->assertRaw(l('<strong>'. $name .'</strong>', $input['href'], array('html' => TRUE)));
+    $this->assertRaw('This &amp; That');
   }
   }
 
 
   /**
   /**
-   * 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() {
-    $account = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content'));
-    $this->drupalLogin($account);
+  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());
     $name = strtolower($this->randomName());
     $edit = array(
     $edit = array(
       'fields[_add_new_field][label]' => $name,
       'fields[_add_new_field][label]' => $name,
@@ -349,25 +340,184 @@ class LinkUITest extends DrupalWebTestcase {
     $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');
     $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');
     node_types_rebuild();
     node_types_rebuild();
     menu_rebuild();
     menu_rebuild();
-    //_content_type_info(TRUE);
-    //$fields = content_fields();
-    //$field = $fields['field_'. $name];
-    //$field = field_info_field('field_'. $name);
+
     _field_info_collate_fields(TRUE);
     _field_info_collate_fields(TRUE);
     $instances = field_info_instances('node', 'page');
     $instances = field_info_instances('node', 'page');
-    //$this->debug($instances);
-    //$this->assert('debug', '<pre>'. print_r($instances, TRUE) .'</pre>', 'Debug');
-    $instance = $instances['field_'. $name];
-    //$this->assertTrue(1 === $instance['validate_url'], 'Make sure validation is on.');
+
+    $instance = $instances['field_' . $name];
     $this->assertFalse($instance['required'], 'Make sure field is not required.');
     $this->assertFalse($instance['required'], 'Make sure field is not required.');
     $this->assertEqual($instance['settings']['title'], 'optional', 'Title should be optional by default.');
     $this->assertEqual($instance['settings']['title'], 'optional', 'Title should be optional by default.');
-    $this->assertTrue($instance['settings']['enable_tokens'], 'Enable Tokens should be off by default.');
+    $this->assertTrue($instance['settings']['validate_url'], 'Make sure validation is on.');
+    $this->assertTrue($instance['settings']['enable_tokens'], 'Enable Tokens should be on by default.');
     $this->assertEqual($instance['settings']['display']['url_cutoff'], 80, 'Url cutoff should be at 80 characters.');
     $this->assertEqual($instance['settings']['display']['url_cutoff'], 80, 'Url cutoff should be at 80 characters.');
     $this->assertEqual($instance['settings']['attributes']['target'], 'default', 'Target should be "default"');
     $this->assertEqual($instance['settings']['attributes']['target'], 'default', 'Target should be "default"');
     $this->assertFalse($instance['settings']['attributes']['rel'], 'Rel should be blank by default.');
     $this->assertFalse($instance['settings']['attributes']['rel'], 'Rel should be blank by default.');
     $this->assertFalse($instance['settings']['attributes']['class'], 'By default, no class should be set.');
     $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.');
     $this->assertFalse($instance['settings']['title_value'], 'By default, no title should be set.');
+  }
+
+  /**
+   * 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
+   */
+  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.
+    $name = strtolower($this->randomName());
+    $edit = array(
+      'fields[_add_new_field][label]' => $name,
+      'fields[_add_new_field][field_name]' => $name,
+      'fields[_add_new_field][type]' => 'link_field',
+      'fields[_add_new_field][widget_type]' => 'link_field',
+    );
+    $this->drupalPost('admin/structure/types/manage/page/fields', $edit, t('Save'));
+
+    $this->drupalPost(NULL, array(), t('Save field settings'));
+    $link_class_name = 'basic-link-' . strtolower($this->randomName());
+    $edit = array(
+      'instance[settings][attributes][class]' => $link_class_name,
+    );
+    $this->drupalPost(NULL, $edit, t('Save settings'));
+
+    // Is field created?
+    $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');
+    node_types_rebuild();
+    menu_rebuild();
+
+    _field_info_collate_fields(TRUE);
+    $instances = field_info_instances('node', 'page');
+
+    $instance = $instances['field_' . $name];
+    $this->assertFalse($instance['required'], 'Make sure field is not required.');
+    $this->assertEqual($instance['settings']['title'], 'optional', 'Title should be optional by default.');
+    $this->assertTrue($instance['settings']['validate_url'], 'Make sure validation is on.');
+    $this->assertTrue($instance['settings']['enable_tokens'], 'Enable Tokens should be on by default.');
+    $this->assertEqual($instance['settings']['display']['url_cutoff'], 80, 'Url cutoff should be at 80 characters.');
+    $this->assertEqual($instance['settings']['attributes']['target'], 'default', 'Target should be "default"');
+    $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.
+    $field_name = 'field_' . $name;
+    $this->drupalGet('node/add/page');
+    $this->assertField($field_name . '[und][0][url]', 'URL found');
+
+    $input = array(
+      'title' => 'This & That',
+      'href' => 'http://www.example.com/',
+    );
+
+    $edit = array(
+      'title' => $field_name,
+      $field_name . '[und][0][title]' => $input['title'],
+      $field_name . '[und][0][url]' => $input['href'],
+    );
+    $this->drupalPost(NULL, $edit, t('Save'));
+
+    $url = $this->getUrl();
+
+    // Change to anonymous user.
+    $this->drupalLogout();
+    $this->drupalGet($url);
+
+    $this->assertRaw('This &amp; That');
+    $this->assertPattern('|class\s?=\s?"' . $link_class_name . '"|', "Class $link_class_name exists on page.");
+  }
+
+  /**
+   * 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
+   */
+  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.
+    $name = strtolower($this->randomName());
+    $edit = array(
+      'fields[_add_new_field][label]' => $name,
+      'fields[_add_new_field][field_name]' => $name,
+      'fields[_add_new_field][type]' => 'link_field',
+      'fields[_add_new_field][widget_type]' => 'link_field',
+    );
+    $this->drupalPost('admin/structure/types/manage/page/fields', $edit, t('Save'));
+
+    $this->drupalPost(NULL, array(), t('Save field settings'));
+    $link_class_name = 'basic-link ' . strtoupper($this->randomName());
+    $edit = array(
+      'instance[settings][attributes][class]' => $link_class_name,
+    );
+    $this->drupalPost(NULL, $edit, t('Save settings'));
+
+    // Is field created?
+    $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');
+    node_types_rebuild();
+    menu_rebuild();
+
+    _field_info_collate_fields(TRUE);
+    $instances = field_info_instances('node', 'page');
+
+    $instance = $instances['field_' . $name];
+    $this->assertFalse($instance['required'], 'Make sure field is not required.');
+    $this->assertEqual($instance['settings']['title'], 'optional', 'Title should be optional by default.');
+    $this->assertTrue($instance['settings']['validate_url'], 'Make sure validation is on.');
+    $this->assertTrue($instance['settings']['enable_tokens'], 'Enable Tokens should be on by default.');
+    $this->assertEqual($instance['settings']['display']['url_cutoff'], 80, 'Url cutoff should be at 80 characters.');
+    $this->assertEqual($instance['settings']['attributes']['target'], 'default', 'Target should be "default"');
+    $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.
+    $field_name = 'field_' . $name;
+    $this->drupalGet('node/add/page');
+    $this->assertField($field_name . '[und][0][url]', 'URL found');
+
+    $input = array(
+      'title' => 'This & That',
+      'href' => 'http://www.example.com/',
+    );
 
 
-    //$this->fail('<pre>'. print_r($fields['field_'. $name], TRUE) .'</pre>');
+    $edit = array(
+      'title' => $field_name,
+      $field_name . '[und][0][title]' => $input['title'],
+      $field_name . '[und][0][url]' => $input['href'],
+    );
+    $this->drupalPost(NULL, $edit, t('Save'));
+
+    $url = $this->getUrl();
+
+    // 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.");
   }
   }
+
 }
 }

+ 164 - 0
sites/all/modules/link/tests/link.entity_token.test

@@ -0,0 +1,164 @@
+<?php
+
+/**
+ * @file
+ * Contains simpletests making sure entity_token integration works.
+ */
+
+/**
+ * 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',
+      'description' => 'Tests that a link field appears properly in entity tokens',
+      'group' => 'Link',
+      'dependencies' => array('token', 'entity', 'entity_token'),
+    );
+  }
+
+  /**
+   * 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.
+   */
+  public function testFieldTokenNodeLoaded() {
+    // Create field.
+    $settings = array(
+      'instance[settings][enable_tokens]' => 0,
+    );
+    $field_name = $this->createLinkField('page',
+      $settings);
+
+    // Create page form.
+    $this->drupalGet('node/add/page');
+    // $field_name = 'field_' . $name;.
+    $this->assertField($field_name . '[und][0][title]', 'Title found');
+    $this->assertField($field_name . '[und][0][url]', 'URL found');
+
+    $token_url_tests = array(
+      1 => array(
+        'href' => 'http://example.com/' . $this->randomName(),
+        'label' => $this->randomName(),
+      ),
+      2 => array(
+        'href' => 'http://example.com/' . $this->randomName() . '?property=value',
+        'label' => $this->randomName(),
+      ),
+      3 => array(
+        'href' => 'http://example.com/' . $this->randomName() . '#position',
+        'label' => $this->randomName(),
+      ),
+      4 => array(
+        'href' => 'http://example.com/' . $this->randomName() . '#lower?property=value2',
+        'label' => $this->randomName(),
+      ),
+    );
+    // @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'],
+        $field_name . '[und][0][url]' => $input['href'],
+      );
+      $this->drupalPost(NULL, $edit, t('Save'));
+      $url = $this->getUrl();
+      $input['url'] = $url;
+    }
+
+    // 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));
+      $this->assertEqual($input2['href'], $assert_data, "Test that the url token has been set to " . $input2['href'] . ' - ' . $assert_data);
+    }
+  }
+
+  /**
+   * Field Token Node Viewed.
+   *
+   * Creates a link field, fills it, then uses a loaded and node_view'd node to
+   * test tokens.
+   */
+  public function testFieldTokenNodeViewed() {
+    // Create field.
+    $settings = array(
+      'instance[settings][enable_tokens]' => 0,
+    );
+    $field_name = $this->createLinkField('page',
+      $settings);
+
+    // Create page form.
+    $this->drupalGet('node/add/page');
+    // $field_name = 'field_' . $name;.
+    $this->assertField($field_name . '[und][0][title]', 'Title found');
+    $this->assertField($field_name . '[und][0][url]', 'URL found');
+
+    $token_url_tests = array(
+      1 => array(
+        'href' => 'http://example.com/' . $this->randomName(),
+        'label' => $this->randomName(),
+      ),
+      2 => array(
+        'href' => 'http://example.com/' . $this->randomName() . '?property=value',
+        'label' => $this->randomName(),
+      ),
+      3 => array(
+        'href' => 'http://example.com/' . $this->randomName() . '#position',
+        'label' => $this->randomName(),
+      ),
+      4 => array(
+        'href' => 'http://example.com/' . $this->randomName() . '#lower?property=value2',
+        'label' => $this->randomName(),
+      ),
+    );
+
+    //@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'],
+        $field_name . '[und][0][url]' => $input['href'],
+      );
+      $this->drupalPost(NULL, $edit, t('Save'));
+      $url = $this->getUrl();
+      $input['url'] = $url;
+    }
+
+    // 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));
+      $this->assertEqual($input2['href'], $assert_data, "Test that the url token has been set to " . $input2['href'] . ' - ' . $assert_data);
+    }
+  }
+
+}

+ 25 - 16
sites/all/modules/link/tests/link.test

@@ -5,10 +5,15 @@
  * Link base test file - contains common functions for testing links.
  * Link base test file - contains common functions for testing links.
  */
  */
 
 
+/**
+ * Base Test Class.
+ */
 class LinkBaseTestClass extends DrupalWebTestCase {
 class LinkBaseTestClass extends DrupalWebTestCase {
-  public $permissions = array(
+
+  protected $permissions = array(
     'access content',
     'access content',
     'administer content types',
     'administer content types',
+    'administer fields',
     'administer nodes',
     'administer nodes',
     'administer filters',
     'administer filters',
     'access comments',
     'access comments',
@@ -17,21 +22,24 @@ class LinkBaseTestClass extends DrupalWebTestCase {
     'create page content',
     'create page content',
   );
   );
 
 
-  public $account;
-
-  function setUp($modules = array()) {
-    if ($modules) {
-      parent::setUp($modules);
-    }
-    else {
-      parent::setUp('field_ui', 'link');
-    }
-    $this->account = $this->drupalCreateUser($this->permissions);
-    $this->drupalLogin($this->account);
+  /**
+   * 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);
   }
   }
 
 
-  function createLinkField($node_type = 'page',
-                           $settings = array()) {
+  /**
+   * Create Link Field.
+   */
+  protected function createLinkField($node_type = 'page', $settings = array()) {
     $name = strtolower($this->randomName());
     $name = strtolower($this->randomName());
     $edit = array(
     $edit = array(
       'fields[_add_new_field][label]' => $name,
       'fields[_add_new_field][label]' => $name,
@@ -39,8 +47,8 @@ class LinkBaseTestClass extends DrupalWebTestCase {
       'fields[_add_new_field][type]' => 'link_field',
       'fields[_add_new_field][type]' => 'link_field',
       'fields[_add_new_field][widget_type]' => 'link_field',
       'fields[_add_new_field][widget_type]' => 'link_field',
     );
     );
-    $field_name = 'field_'. $name;
-    $this->drupalPost('admin/structure/types/manage/'. $node_type .'/fields', $edit, t('Save'));
+    $field_name = 'field_' . $name;
+    $this->drupalPost('admin/structure/types/manage/' . $node_type . '/fields', $edit, t('Save'));
     $this->drupalPost(NULL, array(), t('Save field settings'));
     $this->drupalPost(NULL, array(), t('Save field settings'));
     $this->drupalPost(NULL, $settings, t('Save settings'));
     $this->drupalPost(NULL, $settings, t('Save settings'));
 
 
@@ -51,4 +59,5 @@ class LinkBaseTestClass extends DrupalWebTestCase {
 
 
     return $field_name;
     return $field_name;
   }
   }
+
 }
 }

+ 207 - 110
sites/all/modules/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 {
 class LinkTokenTest extends LinkBaseTestClass {
 
 
+  /**
+   * Get Info.
+   */
   public static function getInfo() {
   public static function getInfo() {
     return array(
     return array(
       'name' => 'Link tokens - browser test',
       'name' => 'Link tokens - browser test',
@@ -19,40 +22,38 @@ class LinkTokenTest extends LinkBaseTestClass {
     );
     );
   }
   }
 
 
-  function setUp($modules = array()) {
-    $modules[] = 'field_ui';
-    $modules[] = 'link';
-    $modules[] = 'token';
-    parent::setUp($modules);
+  /**
+   * 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 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.
    * Creates a node with a token in the link title and checks the value.
    */
    */
-  function testUserTokenLinkCreate() {
-    /*$account = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content'));
-    $this->drupalLogin($account);*/
-
-    // create field
+  public function testUserTokenLinkCreate() {
+    // Create field.
     $settings = array(
     $settings = array(
       'instance[settings][enable_tokens]' => 1,
       'instance[settings][enable_tokens]' => 1,
     );
     );
     $field_name = $this->createLinkField('page',
     $field_name = $this->createLinkField('page',
-                                        $settings);
+      $settings);
 
 
-    // create page form
+    // Create page form.
     $this->drupalGet('node/add/page');
     $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][title]', 'Title found');
     $this->assertField($field_name . '[und][0][url]', 'URL found');
     $this->assertField($field_name . '[und][0][url]', 'URL found');
 
 
     $input = array(
     $input = array(
-        'href' => 'http://example.com/' . $this->randomName(),
-        'label' => $this->randomName(),
+      'href' => 'http://example.com/' . $this->randomName(),
+      'label' => $this->randomName(),
     );
     );
 
 
-    //$this->drupalLogin($account);
+    // $this->drupalLogin($this->web_user);.
     $this->drupalGet('node/add/page');
     $this->drupalGet('node/add/page');
 
 
     $edit = array(
     $edit = array(
@@ -63,36 +64,37 @@ class LinkTokenTest extends LinkBaseTestClass {
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->drupalPost(NULL, $edit, t('Save'));
     $url = $this->getUrl();
     $url = $this->getUrl();
 
 
-    // change to anonymous user
+    // Change to anonymous user.
     $this->drupalLogout();
     $this->drupalLogout();
     $this->drupalGet($url);
     $this->drupalGet($url);
 
 
     $this->assertRaw(l($input['label'] . ' page', $input['href']));
     $this->assertRaw(l($input['label'] . ' page', $input['href']));
   }
   }
 
 
-
   /**
   /**
    * Creates a link field with a static title and an admin-entered token.
    * Creates a link field with a static title and an admin-entered token.
+   *
    * Creates a node with a link and checks the title value.
    * Creates a node with a link and checks the title value.
    */
    */
-  function testStaticTokenLinkCreate() {
+  public function testStaticTokenLinkCreate() {
 
 
-    // create field
+    // Create field.
     $name = $this->randomName();
     $name = $this->randomName();
     $settings = array(
     $settings = array(
       'instance[settings][title]' => 'value',
       '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);
     $field_name = $this->createLinkField('page', $settings);
 
 
-    // create page form
+    // Create page form.
     $this->drupalGet('node/add/page');
     $this->drupalGet('node/add/page');
     $this->assertField($field_name . '[und][0][url]', 'URL found');
     $this->assertField($field_name . '[und][0][url]', 'URL found');
 
 
     $input = array(
     $input = array(
-      'href' => 'http://example.com/' . $this->randomName()
+      'href' => 'http://example.com/' . $this->randomName(),
     );
     );
 
 
-    //$this->drupalLogin($account);
+    // $this->drupalLogin($this->web_user);.
     $this->drupalGet('node/add/page');
     $this->drupalGet('node/add/page');
 
 
     $edit = array(
     $edit = array(
@@ -103,7 +105,7 @@ class LinkTokenTest extends LinkBaseTestClass {
 
 
     $url = $this->getUrl();
     $url = $this->getUrl();
 
 
-    // change to anonymous user
+    // Change to anonymous user.
     $this->drupalLogout();
     $this->drupalLogout();
     $this->drupalGet($url);
     $this->drupalGet($url);
 
 
@@ -112,30 +114,32 @@ class LinkTokenTest extends LinkBaseTestClass {
 
 
   /**
   /**
    * Creates a link field with a static title and an admin-entered token.
    * Creates a link field with a static title and an admin-entered token.
+   *
    * Creates a node with a link and checks the title value.
    * 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
    * 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
    * token that changes from node to node, where [type]'s always going to be the
    * same.
    * same.
    */
    */
-  function testStaticTokenLinkCreate2() {
+  public function testStaticTokenLinkCreate2() {
 
 
-    // create field
+    // Create field.
     $name = $this->randomName();
     $name = $this->randomName();
     $settings = array(
     $settings = array(
       'instance[settings][title]' => 'value',
       'instance[settings][title]' => 'value',
-      'instance[settings][title_value]' => $name .' [node:title]');
+      'instance[settings][title_value]' => $name . ' [node:title]',
+    );
     $field_name = $this->createLinkField('page', $settings);
     $field_name = $this->createLinkField('page', $settings);
 
 
-    // create page form
+    // Create page form.
     $this->drupalGet('node/add/page');
     $this->drupalGet('node/add/page');
     $this->assertField($field_name . '[und][0][url]', 'URL found');
     $this->assertField($field_name . '[und][0][url]', 'URL found');
 
 
     $input = array(
     $input = array(
-      'href' => 'http://example.com/' . $this->randomName()
+      'href' => 'http://example.com/' . $this->randomName(),
     );
     );
 
 
-    //$this->drupalLogin($account);
+    // $this->drupalLogin($this->web_user);.
     $this->drupalGet('node/add/page');
     $this->drupalGet('node/add/page');
 
 
     $edit = array(
     $edit = array(
@@ -146,27 +150,32 @@ class LinkTokenTest extends LinkBaseTestClass {
 
 
     $url = $this->getUrl();
     $url = $this->getUrl();
 
 
-    // change to anonymous user
+    // Change to anonymous user.
     $this->drupalLogout();
     $this->drupalLogout();
     $this->drupalGet($url);
     $this->drupalGet($url);
 
 
-    $this->assertRaw(l($name .' '. $name, $input['href']));
+    $this->assertRaw(l($name . ' ' . $name, $input['href']));
   }
   }
 
 
-  // This test doesn't seem to actually work, due to lack of 'title' in url.
-  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);
     $this->acquireContentTypes(1);
     $field_settings = array(
     $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);
     $field = $this->createField($field_settings, 0);
@@ -176,10 +185,10 @@ class LinkTokenTest extends LinkBaseTestClass {
     $url_type = str_replace('_', '-', $this->content_types[0]->type);
     $url_type = str_replace('_', '-', $this->content_types[0]->type);
 
 
     $edit = array('attributes[title]' => '['. $field_name .'-url]',
     $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'],
     $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'])));*/
     $this->assertText(t('Saved field @field_name', array('@field_name' => $field['field_name'])));*/
     $name = $this->randomName();
     $name = $this->randomName();
     $settings = array(
     $settings = array(
@@ -189,40 +198,42 @@ class LinkTokenTest extends LinkBaseTestClass {
     $field_name = $this->createLinkField('page', $settings);
     $field_name = $this->createLinkField('page', $settings);
 
 
     // So, having saved this field_name, let's see if it works...
     // 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();
     $edit = array();
     $test_link_url = 'http://www.example.com/test';
     $test_link_url = 'http://www.example.com/test';
-    $edit[$field_name .'[und][0][url]'] = $test_link_url;
-    $title = 'title_'. $this->randomName(20);
-    $edit[$field_name .'[und][0][title]'] = $title;
+    $edit[$field_name . '[und][0][url]'] = $test_link_url;
+    $title = 'title_' . $this->randomName(20);
+    $edit[$field_name . '[und][0][title]'] = $title;
     $edit['title'] = $name;
     $edit['title'] = $name;
 
 
     $this->drupalGet('node/add/page');
     $this->drupalGet('node/add/page');
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->drupalPost(NULL, $edit, t('Save'));
 
 
     // Make sure we get a new version!
     // 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.',
     $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->assertText($title, 'Make sure the link title/text shows');
-    $this->assertRaw(' title="'. $test_link_url .'"', "Do we show the link url as the title attribute?");
-    $this->assertNoRaw(' title="['. $field_name .'-url]"');
+    $this->assertRaw(' title="' . $test_link_url . '"', "Do we show the link url as the title attribute?");
+    $this->assertNoRaw(' title="[' . $field_name . '-url]"');
     $this->assertTrue(module_exists('token'), t('Assure that Token Module is enabled.'));
     $this->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
    * If the title of the link is set to the title attribute, then the title
    * attribute isn't supposed to show.
    * 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->loginWithPermissions($this->permissions);
     $this->acquireContentTypes(1);
     $this->acquireContentTypes(1);
     $field_settings = array(
     $field_settings = array(
@@ -239,51 +250,61 @@ class LinkTokenTest extends LinkBaseTestClass {
 
 
     $field = $this->createField($field_settings, 0);
     $field = $this->createField($field_settings, 0);
     $field_name = $field['field_name'];
     $field_name = $field['field_name'];
-    $field_db_info = content_database_info($field);
     $url_type = str_replace('_', '-', $this->content_types[0]->type);
     $url_type = str_replace('_', '-', $this->content_types[0]->type);
 
 
-    $edit = array('attributes[title]' => '['. $field_name .'-title]',
-                  'enable_tokens' => TRUE);
+    $edit = array(
+      'attributes[title]' => '[' . $field_name . '-title]',
+      'enable_tokens' => TRUE,
+    );
 
 
-    $this->drupalPost('admin/content/node-type/'. $url_type .'/fields/'. $field['field_name'],
-                      $edit, t('Save field settings'));
+    $this->drupalPost('admin/content/node-type/' . $url_type . '/fields/' . $field['field_name'],
+      $edit, t('Save field settings'));
     $this->assertText(t('Saved field @field_name', array('@field_name' => $field['field_name'])));
     $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...
     // So, having saved this field_name, let's see if it works...
     $this->acquireNodes(1);
     $this->acquireNodes(1);
 
 
-    $node = node_load($this->nodes[0]->nid);
-
-    $this->drupalGet('node/'. $this->nodes[0]->nid);
+    $this->drupalGet('node/' . $this->nodes[0]->nid);
 
 
     $edit = array();
     $edit = array();
-    $edit[$field['field_name'] .'[0][url]'] = 'http://www.example.com/test';
-    $title = 'title_'. $this->randomName(20);
-    $edit[$field['field_name'] .'[0][title]'] = $title;
+    $edit[$field['field_name'] . '[0][url]'] = 'http://www.example.com/test';
+    $title = 'title_' . $this->randomName(20);
+    $edit[$field['field_name'] . '[0][title]'] = $title;
 
 
-    $this->drupalPost('node/'. $this->nodes[0]->nid .'/edit', $edit, t('Save'));
+    $this->drupalPost('node/' . $this->nodes[0]->nid . '/edit', $edit, t('Save'));
 
 
     // Make sure we get a new version!
     // 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('@type @title has been updated.',
     $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->drupalGet('node/' . $node->nid);
     $this->assertText($title, 'Make sure the link title/text shows');
     $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->assertNoRaw(' title="' . $title . '"', "We should not show the link title as the title attribute?");
+    $this->assertNoRaw(' title="[' . $field_name . '-title]"');
+    // $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() {
-    $account = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content'));
-    $this->drupalLogin($account);
-
-    // create field
+  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.
     $name = strtolower($this->randomName());
     $name = strtolower($this->randomName());
     $edit = array(
     $edit = array(
       '_add_new_field[label]' => $name,
       '_add_new_field[label]' => $name,
@@ -294,23 +315,24 @@ class LinkTokenTest extends LinkBaseTestClass {
     $this->drupalPost('admin/content/node-type/page/fields', $edit, t('Save'));
     $this->drupalPost('admin/content/node-type/page/fields', $edit, t('Save'));
     $this->drupalPost(NULL, array(
     $this->drupalPost(NULL, array(
       'title' => 'required',
       'title' => 'required',
-      'enable_tokens' => 1), t('Save field settings'));
+      'enable_tokens' => 1,
+    ), t('Save field settings'));
 
 
     // Is field created?
     // Is field created?
     $this->assertRaw(t('Added field %label.', array('%label' => $name)), 'Field added');
     $this->assertRaw(t('Added field %label.', array('%label' => $name)), 'Field added');
 
 
-    // create page form
+    // Create page form.
     $this->drupalGet('node/add/page');
     $this->drupalGet('node/add/page');
     $field_name = 'field_' . $name;
     $field_name = 'field_' . $name;
     $this->assertField($field_name . '[0][title]', 'Title found');
     $this->assertField($field_name . '[0][title]', 'Title found');
     $this->assertField($field_name . '[0][url]', 'URL found');
     $this->assertField($field_name . '[0][url]', 'URL found');
 
 
     $input = array(
     $input = array(
-        'href' => 'http://example.com/' . $this->randomName(),
-        'label' => $this->randomName(),
+      'href' => 'http://example.com/' . $this->randomName(),
+      'label' => $this->randomName(),
     );
     );
 
 
-    $this->drupalLogin($account);
+    $this->drupalLogin($this->web_user);
     $this->drupalGet('node/add/page');
     $this->drupalGet('node/add/page');
 
 
     $edit = array(
     $edit = array(
@@ -321,22 +343,31 @@ class LinkTokenTest extends LinkBaseTestClass {
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->drupalPost(NULL, $edit, t('Save'));
     $url = $this->getUrl();
     $url = $this->getUrl();
 
 
-    // change to anonymous user
+    // Change to anonymous user.
     $this->drupalLogout();
     $this->drupalLogout();
     $this->drupalGet($url);
     $this->drupalGet($url);
 
 
-    $this->assertRaw(l($input['label'], $input['href'] .'/page'));
-    //$this->fail($this->content);
+    $this->assertRaw(l($input['label'], $input['href'] . '/page'));
+    // $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() {
-    $account = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content'));
-    $this->drupalLogin($account);
-
-    // create field
+  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.
     $name = strtolower($this->randomName());
     $name = strtolower($this->randomName());
     $edit = array(
     $edit = array(
       '_add_new_field[label]' => $name,
       '_add_new_field[label]' => $name,
@@ -347,23 +378,24 @@ class LinkTokenTest extends LinkBaseTestClass {
     $this->drupalPost('admin/content/node-type/page/fields', $edit, t('Save'));
     $this->drupalPost('admin/content/node-type/page/fields', $edit, t('Save'));
     $this->drupalPost(NULL, array(
     $this->drupalPost(NULL, array(
       'title' => 'required',
       'title' => 'required',
-      'enable_tokens' => 1), t('Save field settings'));
+      'enable_tokens' => 1,
+    ), t('Save field settings'));
 
 
     // Is field created?
     // Is field created?
     $this->assertRaw(t('Added field %label.', array('%label' => $name)), 'Field added');
     $this->assertRaw(t('Added field %label.', array('%label' => $name)), 'Field added');
 
 
-    // create page form
+    // Create page form.
     $this->drupalGet('node/add/page');
     $this->drupalGet('node/add/page');
     $field_name = 'field_' . $name;
     $field_name = 'field_' . $name;
     $this->assertField($field_name . '[0][title]', 'Title found');
     $this->assertField($field_name . '[0][title]', 'Title found');
     $this->assertField($field_name . '[0][url]', 'URL found');
     $this->assertField($field_name . '[0][url]', 'URL found');
 
 
     $input = array(
     $input = array(
-        'href' => 'http://example.com/' . $this->randomName(),
-        'label' => $this->randomName(),
+      'href' => 'http://example.com/' . $this->randomName(),
+      'label' => $this->randomName(),
     );
     );
 
 
-    $this->drupalLogin($account);
+    $this->drupalLogin($this->web_user);
     $this->drupalGet('node/add/page');
     $this->drupalGet('node/add/page');
 
 
     $edit = array(
     $edit = array(
@@ -374,10 +406,75 @@ class LinkTokenTest extends LinkBaseTestClass {
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->drupalPost(NULL, $edit, t('Save'));
     $url = $this->getUrl();
     $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));
+  }
+
+  /**
+   * 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
+   */
+  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.
+    $name = strtolower($this->randomName());
+    $field_name = 'field_' . $name;
+    $edit = array(
+      'fields[_add_new_field][label]' => $name,
+      'fields[_add_new_field][field_name]' => $name,
+      'fields[_add_new_field][type]' => 'link_field',
+      'fields[_add_new_field][widget_type]' => 'link_field',
+    );
+    $this->drupalPost('admin/structure/types/manage/page/fields', $edit, t('Save'));
+    $this->drupalPost(NULL, array(), t('Save field settings'));
+    $this->drupalPost(NULL, array(
+      'instance[settings][url]' => 1,
+      'instance[settings][enable_tokens]' => 0,
+    ), t('Save settings'));
+
+    // Is field created?
+    $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');
+
+    // Create page form.
+    $this->drupalGet('node/add/page');
+    $this->assertField($field_name . '[und][0][url]', 'URL found');
+
+    $input = array(
+      'title' => 'This & That',
+      'href' => '',
+    );
+
+    $edit = array(
+      'title' => $name,
+      $field_name . '[und][0][title]' => $input['title'],
+      $field_name . '[und][0][url]' => $input['href'],
+    );
+    $this->drupalPost(NULL, $edit, t('Save'));
+
+    $url = $this->getUrl();
+
+    // Change to anonymous user.
     $this->drupalLogout();
     $this->drupalLogout();
     $this->drupalGet($url);
     $this->drupalGet($url);
 
 
-    $this->assertRaw(l($input['label'], $input['href'] .'/'. $account->uid));
+    $this->assertRaw('This &amp; That');
   }
   }
+
 }
 }

+ 376 - 163
sites/all/modules/link/tests/link.validate.test

@@ -5,13 +5,15 @@
  * Tests that exercise the validation functions in the link module.
  * Tests that exercise the validation functions in the link module.
  */
  */
 
 
+/**
+ * Validate Test Case.
+ */
 class LinkValidateTestCase extends LinkBaseTestClass {
 class LinkValidateTestCase extends LinkBaseTestClass {
 
 
-  function setUp($modules = array()) {
-    parent::setUp($modules);
-  }
-
-  function createLink($url, $title, $attributes = array()) {
+  /**
+   * Create Link.
+   */
+  protected function createLink($url, $title, $attributes = array()) {
     return array(
     return array(
       'url' => $url,
       'url' => $url,
       'title' => $title,
       'title' => $title,
@@ -21,35 +23,44 @@ class LinkValidateTestCase extends LinkBaseTestClass {
 
 
   /**
   /**
    * Takes a url, and sees if it can validate that the url is valid.
    * Takes a url, and sees if it can validate that the url is valid.
+   *
+   * @codingStandardsIgnoreStart
    */
    */
-  public function link_test_validate_url($url) {
+  protected function link_test_validate_url($url) {
+    // @codingStandardsIgnoreEnd
 
 
     $field_name = $this->createLinkField();
     $field_name = $this->createLinkField();
 
 
-    $permission = 'create page content';
-    $this->checkPermissions(array($permission), TRUE);
-
-    $this->drupalGet('node/add/page');
-
     $label = $this->randomName();
     $label = $this->randomName();
-    $edit = array(
+    $settings = array(
       'title' => $label,
       'title' => $label,
-      $field_name . '[und][0][title]' => $label,
-      $field_name . '[und][0][url]' => $url,
+      $field_name => array(
+        LANGUAGE_NONE => array(
+          array(
+            'title' => $label,
+            'url' => $url,
+          ),
+        ),
+      ),
     );
     );
-    $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertRaw(t(' has been created.'), 'Node created');
 
 
-    $nid = 1; //$matches[1];
+    $node = $this->drupalCreateNode($settings);
 
 
-    $node = node_load($nid);
+    $this->assertNotNull($node, ' has been created.', 'Node created');
 
 
-    $this->assertEqual($url, $node->{$field_name}['und'][0]['url']);
+    $this->assertEqual($url, $node->{$field_name}[LANGUAGE_NONE][0]['url']);
   }
   }
+
 }
 }
 
 
+/**
+ * Class for Validate Test.
+ */
 class LinkValidateTest extends LinkValidateTestCase {
 class LinkValidateTest extends LinkValidateTestCase {
 
 
+  /**
+   * Get Info.
+   */
   public static function getInfo() {
   public static function getInfo() {
     return array(
     return array(
       'name' => 'Link Validation Tests',
       'name' => 'Link Validation Tests',
@@ -58,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');
     $this->link_test_validate_url('http://www.example.com');
   }
   }
 
 
   /**
   /**
    * Test if we're stopped from posting a bad url on default validation.
    * Test if we're stopped from posting a bad url on default validation.
+   *
+   * @codingStandardsIgnoreStart
    */
    */
-  function test_link_validate_bad_url_validate_default() {
-    $account = $this->drupalCreateUser(array('administer content types',
-                                             'administer nodes',
-                                             'administer filters',
-                                             'access content',
-                                             'create page content',
-                                             'access administration pages'));
-    $this->drupalLogin($account);
-
-    // create field
+  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.
     $name = strtolower($this->randomName());
     $name = strtolower($this->randomName());
     $edit = array(
     $edit = array(
       'fields[_add_new_field][label]' => $name,
       'fields[_add_new_field][label]' => $name,
@@ -91,35 +114,43 @@ class LinkValidateTest extends LinkValidateTestCase {
     node_types_rebuild();
     node_types_rebuild();
     menu_rebuild();
     menu_rebuild();
 
 
-    // create page form
+    // Create page form.
     $this->drupalGet('node/add/page');
     $this->drupalGet('node/add/page');
     $field_name = 'field_' . $name;
     $field_name = 'field_' . $name;
-    $this->assertField('edit-field-'. $name .'-und-0-title', 'Title found');
-    $this->assertField('edit-field-'. $name .'-und-0-url', 'URL found');
-
+    $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found');
+    $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found');
 
 
     $edit = array(
     $edit = array(
       'title' => 'Simple Title',
       'title' => 'Simple Title',
-      $field_name .'[und][0][url]' => 'edik:naw',
+      $field_name . '[und][0][url]' => 'edik:naw',
     );
     );
 
 
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertText(t('Not a valid URL.'));
+    $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.
    * Test if we're stopped from posting a bad url with validation on.
+   *
+   * @codingStandardsIgnoreStart
    */
    */
-  function test_link_validate_bad_url_validate_on() {
-    $account = $this->drupalCreateUser(array('administer content types',
-                                             'administer nodes',
-                                             'administer filters',
-                                             'access content',
-                                             'create page content',
-                                             'access administration pages'));
-    $this->drupalLogin($account);
-
-    // create field
+  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.
     $name = strtolower($this->randomName());
     $name = strtolower($this->randomName());
     $edit = array(
     $edit = array(
       'fields[_add_new_field][label]' => $name,
       'fields[_add_new_field][label]' => $name,
@@ -136,36 +167,44 @@ class LinkValidateTest extends LinkValidateTestCase {
     node_types_rebuild();
     node_types_rebuild();
     menu_rebuild();
     menu_rebuild();
 
 
-    // create page form
+    // Create page form.
     $this->drupalGet('node/add/page');
     $this->drupalGet('node/add/page');
     $field_name = 'field_' . $name;
     $field_name = 'field_' . $name;
-    $this->assertField('edit-field-'. $name .'-und-0-title', 'Title found');
-    $this->assertField('edit-field-'. $name .'-und-0-url', 'URL found');
-
+    $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found');
+    $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found');
 
 
     $edit = array(
     $edit = array(
       'title' => 'Simple Title',
       'title' => 'Simple Title',
-      $field_name .'[und][0][url]' => 'edik:naw',
+      $field_name . '[und][0][url]' => 'edik:naw',
     );
     );
 
 
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertText(t('Not a valid URL.'));
+    $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.
    * Test if we can post a bad url if the validation is expressly turned off.
+   *
+   * @codingStandardsIgnoreStart
    */
    */
-  function test_link_validate_bad_url_validate_off() {
-    $account = $this->drupalCreateUser(array('administer content types',
-                                             'administer nodes',
-                                             'administer filters',
-                                             'access content',
-                                             'create page content',
-                                             'access administration pages'));
-    $this->drupalLogin($account);
-
-    // create field
+  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.
     $name = strtolower($this->randomName());
     $name = strtolower($this->randomName());
     $edit = array(
     $edit = array(
       'fields[_add_new_field][label]' => $name,
       'fields[_add_new_field][label]' => $name,
@@ -177,6 +216,7 @@ class LinkValidateTest extends LinkValidateTestCase {
     $this->drupalPost(NULL, array(), t('Save field settings'));
     $this->drupalPost(NULL, array(), t('Save field settings'));
     $this->drupalPost(NULL, array('instance[settings][validate_url]' => FALSE), t('Save 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();
     /*$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($instance_details, TRUE) .'</pre>');
     $this->fail('<pre>'. print_r(unserialize($instance_details->data), TRUE) .'</pre>');*/
     $this->fail('<pre>'. print_r(unserialize($instance_details->data), TRUE) .'</pre>');*/
@@ -186,113 +226,167 @@ class LinkValidateTest extends LinkValidateTestCase {
     node_types_rebuild();
     node_types_rebuild();
     menu_rebuild();
     menu_rebuild();
 
 
-    // create page form
+    // Create page form.
     $this->drupalGet('node/add/page');
     $this->drupalGet('node/add/page');
     $field_name = 'field_' . $name;
     $field_name = 'field_' . $name;
-    $this->assertField('edit-field-'. $name .'-und-0-title', 'Title found');
-    $this->assertField('edit-field-'. $name .'-und-0-url', 'URL found');
-
+    $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found');
+    $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found');
 
 
     $edit = array(
     $edit = array(
       'title' => 'Simple Title',
       'title' => 'Simple Title',
-      $field_name .'[und][0][url]' => 'edik:naw',
+      $field_name . '[und][0][url]' => 'edik:naw',
     );
     );
 
 
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertNoText(t('Not a valid URL.'));
-
+    $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->acquireContentTypes(1);
-    $account = $this->drupalCreateUser(array('administer content types',
-                                             'administer nodes',
-                                             'access administration pages',
-                                             'access content',
-                                             'create '. $this->content_types[0]->type .' content',
-                                             'edit any '. $this->content_types[0]->type .' content'));
-    $this->drupalLogin($account);
-    variable_set('node_options_'. $this->content_types[0]->name, array('status', 'promote'));
+    $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',
+    ));
     $field_settings = array(
     $field_settings = array(
       'type' => 'link',
       'type' => 'link',
       'widget_type' => 'link',
       'widget_type' => 'link',
       'type_name' => $this->content_types[0]->name,
       '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,
       'validate_url' => 0,
     );
     );
 
 
     $field = $this->createField($field_settings, 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);
     $this->acquireNodes(2);
 
 
-    $node = node_load($this->nodes[0]->nid);
-
-    $this->drupalGet('node/'. $this->nodes[0]->nid);
+    $this->drupalGet('node/' . $this->nodes[0]->nid);
 
 
     $edit = array();
     $edit = array();
     $title = $this->randomName();
     $title = $this->randomName();
     $url = 'javascript:alert("http://example.com/' . $this->randomName() . '")';
     $url = 'javascript:alert("http://example.com/' . $this->randomName() . '")';
-    $edit[$field['field_name'] .'[0][url]'] = $url;
-    $edit[$field['field_name'] .'[0][title]'] = $title;
+    $edit[$field['field_name'] . '[0][url]'] = $url;
+    $edit[$field['field_name'] . '[0][title]'] = $title;
 
 
-    $this->drupalPost('node/'. $this->nodes[0]->nid .'/edit', $edit, t('Save'));
-    //$this->pass($this->content);
-    $this->assertNoText(t('Not a valid URL.'));
+    $this->drupalPost('node/' . $this->nodes[0]->nid . '/edit', $edit, t('Save'));
+    // $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!
     // 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->assertEqual($url, $node->{$field['field_name']}[0]['url']);
     $this->assertEqual($url, $node->{$field['field_name']}[0]['url']);
 
 
-    $this->drupalGet('node/'. $node->nid);
+    $this->drupalGet('node/' . $node->nid);
     $this->assertNoRaw($url, 'Make sure Javascript does not display.');
     $this->assertNoRaw($url, 'Make sure Javascript does not display.');
 
 
     // Turn the array validation back _on_.
     // Turn the array validation back _on_.
     $edit = array('validate_url' => TRUE);
     $edit = array('validate_url' => TRUE);
     $node_type_link = str_replace('_', '-', $node->type);
     $node_type_link = str_replace('_', '-', $node->type);
-    //$this->drupalGet('admin/content/node-type/'. $node_type_link .'/fields'); ///'. $field['field_name']);
-    //$this->fail($this->content);
-    $this->drupalPost('admin/content/node-type/'. $node_type_link .'/fields/'. $field['field_name'], $edit, t('Save field settings'));
+    // @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);
+    $this->drupalGet('node/' . $node->nid);
     // This actually works because the display_url goes through the core
     // This actually works because the display_url goes through the core
     // url() function.  But we should have a test that makes sure it continues
     // url() function.  But we should have a test that makes sure it continues
     // to work.
     // to work.
     $this->assertNoRaw($url, 'Make sure Javascript does not display.');
     $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>');
     $this->link_test_validate_url('<front>');
   }
   }
 
 
-  // Validate that an internal url would be accepted.
-  function test_link_internal_url() {
-    $this->link_test_validate_url('node/32');
+  /**
+   * Validate that an internal url would be accepted.
+   *
+   * @codingStandardsIgnoreStart
+   */
+  public function test_link_internal_url() {
+    // @codingStandardsIgnoreEnd
+    // Create the content first.
+    $node = $this->drupalCreateNode();
+
+    $link = 'node/' . $node->nid;
+    $this->link_test_validate_url($link);
+    $type = link_url_type($link);
+    $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');
     $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/');
     $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/');
     $this->link_test_validate_url('ftp://www.example.com/');
   }
   }
+
 }
 }
 
 
+/**
+ * Validate Test News.
+ */
 class LinkValidateTestNews extends LinkValidateTestCase {
 class LinkValidateTestNews extends LinkValidateTestCase {
 
 
+  /**
+   * Get Info.
+   */
   public static function getInfo() {
   public static function getInfo() {
     return array(
     return array(
       'name' => 'Link News Validation Tests',
       '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');
     $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');
     $this->link_test_validate_url('news:hj0db8$vrm$1@news.eternal-september.org');
   }
   }
+
 }
 }
 
 
+/**
+ * Validate Specific URL.
+ */
 class LinkValidateSpecificURL extends LinkValidateTestCase {
 class LinkValidateSpecificURL extends LinkValidateTestCase {
+
+  /**
+   * Get Info.
+   */
   public static function getInfo() {
   public static function getInfo() {
     return array(
     return array(
       'name' => 'Link Specific URL Validation Tests',
       'name' => 'Link Specific URL Validation Tests',
@@ -321,33 +433,65 @@ 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');
     $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');
     $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');
     $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/');
     $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}');
     $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}');
   }
   }
 
 
   /**
   /**
    * Here, we're testing that a very long url is stored properly in the db.
    * Here, we're testing that a very long url is stored properly in the db.
    *
    *
-   * Basicly, trying to test http://drupal.org/node/376818
+   * 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';
     $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);
     $this->link_test_validate_url($long_url);
   }
   }
@@ -355,17 +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 !
  * Validation is guided by the rules in http://tools.ietf.org/html/rfc1738 !
  */
  */
 class LinkValidateUrlLight extends DrupalWebTestCase {
 class LinkValidateUrlLight extends DrupalWebTestCase {
 
 
-  //function setUp() {
-    // do we need to include something here?
-    //module_load_include('inc', 'link');
-  //}
-
+  /**
+   * Get Info.
+   */
   public static function getInfo() {
   public static function getInfo() {
     return array(
     return array(
       'name' => 'Link Light Validation Tests',
       'name' => 'Link Light Validation Tests',
@@ -375,74 +520,117 @@ class LinkValidateUrlLight extends DrupalWebTestCase {
   }
   }
 
 
   /**
   /**
-   * Translates the LINK type constants to english for display and debugging of tests
+   * Setup.
+   */
+  public function setUp() {
+    parent::setUp('link');
+  }
+
+  /**
+   * 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) {
     switch ($type) {
       case LINK_FRONT:
       case LINK_FRONT:
         return "Front";
         return "Front";
+
       case LINK_EMAIL:
       case LINK_EMAIL:
         return "Email";
         return "Email";
+
       case LINK_NEWS:
       case LINK_NEWS:
         return "Newsgroup";
         return "Newsgroup";
+
       case LINK_INTERNAL:
       case LINK_INTERNAL:
         return "Internal Link";
         return "Internal Link";
+
       case LINK_EXTERNAL:
       case LINK_EXTERNAL:
         return "External Link";
         return "External Link";
+
       case FALSE:
       case FALSE:
         return "Invalid Link";
         return "Invalid Link";
+
       default:
       default:
-        return "Bad Value:". $type;
+        return "Bad Value:" . $type;
     }
     }
   }
   }
 
 
-  // Make sure that a link labelled <front> works.
-  function testValidateFrontLink() {
+  /**
+   * Make sure that a link labeled <front> works.
+   */
+  public function testValidateFrontLink() {
     $valid = link_validate_url('<front>');
     $valid = link_validate_url('<front>');
-    $this->assertEqual(LINK_FRONT, $valid, 'Make sure that front link is verfied and identified');
+    $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');
     $valid = link_validate_url('mailto:bob@example.com');
     $this->assertEqual(LINK_EMAIL, $valid, "Make sure a basic mailto is verified and identified");
     $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');
     $valid = link_validate_url(':bob@example.com');
     $this->assertEqual(FALSE, $valid, 'Make sure just a bad address is correctly failed');
     $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');
     $valid = link_validate_url('news:comp.infosystems.www.misc');
     $this->assertEqual(LINK_NEWS, $valid, 'Make sure link to newsgroup validates as news.');
     $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');
     $valid = link_validate_url('news:hj0db8$vrm$1@news.eternal-september.org');
-    $this->assertEqual(LINK_NEWS, $valid, 'Make sure link to specific article valiates as news.');
+    $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');
     $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.');
     $this->assertEqual(FALSE, $valid, 'newsgroup names can\'t contain underscores, so it should come back as invalid.');
   }
   }
 
 
-  function testValidateInternalLink() {
-    $valid = link_validate_url('node/5');
-    $this->assertEqual(LINK_INTERNAL, $valid, 'Test normal internal link.');
-  }
-
-  function testValidateInternalLinkWithDot() {
-    $valid = link_validate_url('rss.xml');
-    $this->assertEqual(LINK_INTERNAL, $valid, 'Test rss.xml internal link.');
-  }
+  /**
+   * Validate Internal Links.
+   */
+  public function testValidateInternalLinks() {
+    $tempfile = drupal_tempnam('public://files', 'test');
+    $links = array(
+      'rss.xml',
+      file_uri_target($tempfile),
+      drupal_realpath($tempfile),
+    );
 
 
-  function testValidateInternalLinkToFile() {
-    $valid = link_validate_url('files/test.jpg');
-    $this->assertEqual(LINK_INTERNAL, $valid, 'Test files/test.jpg internal link.');
+    foreach ($links as $link) {
+      $type = link_url_type($link);
+      $this->assertEqual(LINK_INTERNAL, $type, 'Test ' . $link . ' is an internal link.');
+      $valid = link_validate_url($link);
+      $this->assertTrue($valid, 'Test ' . $link . ' is valid internal link.');
+    }
   }
   }
 
 
-  function testValidateExternalLinks() {
+  /**
+   * Validate External Links.
+   */
+  public function testValidateExternalLinks() {
     $links = array(
     $links = array(
       'http://localhost:8080/',
       'http://localhost:8080/',
       'www.example.com',
       'www.example.com',
@@ -457,9 +645,8 @@ class LinkValidateUrlLight extends DrupalWebTestCase {
       'http://255.255.255.255:4823/',
       'http://255.255.255.255:4823/',
       'www.test-site.com',
       'www.test-site.com',
       'http://example.com/index.php?q=node/123',
       'http://example.com/index.php?q=node/123',
-      'http://example.com/index.php?page=this\that',
       'http://example.com/?first_name=Joe Bob&last_name=Smith',
       '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#test',
       'http://www.example.com/index.php#this@that.',
       'http://www.example.com/index.php#this@that.',
       'http://www.example.com/index.php#',
       'http://www.example.com/index.php#',
@@ -467,34 +654,60 @@ class LinkValidateUrlLight extends DrupalWebTestCase {
       'http://www.archive.org/stream/aesopsfables00aesorich#page/n7/mode/2up',
       'http://www.archive.org/stream/aesopsfables00aesorich#page/n7/mode/2up',
       'http://www.example.com/blah/#this@that?',
       'http://www.example.com/blah/#this@that?',
     );
     );
+
     // Test all of the protocols.
     // 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) {
     foreach ($allowed_protocols as $protocol) {
       if ($protocol !== 'news' && $protocol !== 'mailto') {
       if ($protocol !== 'news' && $protocol !== 'mailto') {
-        $links[] = $protocol .'://www.example.com';
+        $links[] = $protocol . '://www.example.com';
       }
       }
     }
     }
     foreach ($links as $link) {
     foreach ($links as $link) {
+      $type = link_url_type($link);
+      $this->assertEqual(LINK_EXTERNAL, $type, 'Testing that ' . $link . ' is an external link.');
       $valid = link_validate_url($link);
       $valid = link_validate_url($link);
-      $this->assertEqual(LINK_EXTERNAL, $valid, 'Testing that '. $link .' is a valid external link.');
-      // The following two lines are commented out and only used for comparisons.
-      //$valid2 = valid_url($link, TRUE);
-      //$this->assertEqual(TRUE, $valid2, "Using valid_url() on $link.");
+      $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.");.
     }
     }
   }
   }
 
 
-  function testInvalidExternalLinks() {
+  /**
+   * Check Invalid External Links.
+   */
+  public function testInvalidExternalLinks() {
     $links = array(
     $links = array(
       'http://www.ex ample.com/',
       'http://www.ex ample.com/',
-      '//www.example.com/',
-      'http://25.0.0/', // bad ip!
+      // Bad ip!
+      'http://25.0.0/',
       'http://4827.0.0.2/',
       'http://4827.0.0.2/',
-      'http://www.testß.com/', // ß not allowed in domain names!
-      //'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',
     );
     );
     foreach ($links as $link) {
     foreach ($links as $link) {
       $valid = link_validate_url($link);
       $valid = link_validate_url($link);
-      $this->assertEqual(FALSE, $valid, 'Testing that '. $link .' is not a valid link.');
+      $this->assertEqual(FALSE, $valid, 'Testing that ' . $link . ' is not a valid link.');
     }
     }
   }
   }
 
 

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

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

+ 16 - 9
sites/all/modules/link/views/link_views_handler_argument_target.inc

@@ -7,20 +7,26 @@
 
 
 /**
 /**
  * Argument handler to filter results by target.
  * Argument handler to filter results by target.
+ *
+ * @codingStandardsIgnoreStart
  */
  */
 class link_views_handler_argument_target extends views_handler_argument {
 class link_views_handler_argument_target extends views_handler_argument {
 
 
   /**
   /**
    * Provide defaults for the argument when a new one is created.
    * 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.
    * 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();
     $defaults = $this->default_actions();
 
 
     $form['title'] = array(
     $form['title'] = array(
@@ -52,7 +58,7 @@ class link_views_handler_argument_target extends views_handler_argument {
 
 
     $form['wildcard'] = array(
     $form['wildcard'] = array(
       '#prefix' => '<div class="views-right-50">',
       '#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',
       '#type' => 'textfield',
       '#title' => t('Wildcard'),
       '#title' => t('Wildcard'),
       '#size' => 20,
       '#size' => 20,
@@ -93,7 +99,7 @@ class link_views_handler_argument_target extends views_handler_argument {
       '#default_value' => $this->options['validate_type'],
       '#default_value' => $this->options['validate_type'],
     );
     );
 
 
-    $validate_types = array('none' => t('<Basic validation>'));
+    $validate_types = array('none' => t('- Basic validation -'));
     $plugins = views_fetch_plugin_data('argument validator');
     $plugins = views_fetch_plugin_data('argument validator');
     foreach ($plugins as $id => $info) {
     foreach ($plugins as $id => $info) {
       $valid = TRUE;
       $valid = TRUE;
@@ -125,8 +131,8 @@ class link_views_handler_argument_target extends views_handler_argument {
 
 
     asort($validate_types);
     asort($validate_types);
     $form['validate_type']['#options'] = $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(
     $form['validate_fail'] = array(
       '#type' => 'select',
       '#type' => 'select',
       '#title' => t('Action to take if argument does not validate'),
       '#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.
    * The argument sent may be found at $this->argument.
    */
    */
-  function query() {
+  public function query($group_by = FALSE) {
     $this->ensure_my_table();
     $this->ensure_my_table();
     // Because attributes are stored serialized, our only option is to also
     // 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.
     // serialize the data we're searching for and use LIKE to find similar data.
-    $this->query->add_where(0, $this->table_alias .'.'. $this->real_field ." LIKE '%%%s%'", serialize(array('target' => $this->argument)));
+    $this->query->add_where(0, $this->table_alias . ' . ' . $this->real_field . " LIKE '%%%s%'", serialize(array('target' => $this->argument)));
   }
   }
+
 }
 }

+ 55 - 16
sites/all/modules/link/views/link_views_handler_filter_protocol.inc

@@ -7,22 +7,30 @@
 
 
 /**
 /**
  * Filter handler for limiting a view to URLs of a certain protocol.
  * Filter handler for limiting a view to URLs of a certain protocol.
+ *
+ * @codingStandardsIgnoreStart
  */
  */
 class link_views_handler_filter_protocol extends views_handler_filter_string {
 class link_views_handler_filter_protocol extends views_handler_filter_string {
+
   /**
   /**
    * Set defaults for the filter options.
    * Set defaults for the filter options.
+   *
+   * @codingStandardsIgnoreEnd
    */
    */
-  function options(&$options) {
-    parent::options($options);
+  function option_definition() {
+    $options = parent::option_definition();
+
     $options['operator'] = 'OR';
     $options['operator'] = 'OR';
     $options['value'] = 'http';
     $options['value'] = 'http';
     $options['case'] = 0;
     $options['case'] = 0;
+
+    return $options;
   }
   }
 
 
   /**
   /**
    * Define the operators supported for protocols.
    * Define the operators supported for protocols.
    */
    */
-  function operators() {
+  public function operators() {
     $operators = array(
     $operators = array(
       'OR' => array(
       'OR' => array(
         'title' => t('Is one of'),
         'title' => t('Is one of'),
@@ -35,7 +43,13 @@ class link_views_handler_filter_protocol extends views_handler_filter_string {
     return $operators;
     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);
     parent::options_form($form, $form_state);
     $form['case'] = array(
     $form['case'] = array(
       '#type' => 'value',
       '#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.
    * 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
     // We have to make some choices when creating this as an exposed
     // filter form. For example, if the operator is locked and thus
     // filter form. For example, if the operator is locked and thus
     // not rendered, we can't render dependencies; instead we only
     // 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',
         '#type' => 'select',
         '#title' => t('Protocol'),
         '#title' => t('Protocol'),
         '#default_value' => $this->value,
         '#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,
         '#multiple' => 1,
         '#size' => 4,
         '#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.'),
         '#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.
    * 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();
     $db_type = db_driver();
 
 
     $protocols = $this->value;
     $protocols = $this->value;
@@ -80,27 +112,34 @@ class link_views_handler_filter_protocol extends views_handler_filter_string {
     $where_conditions = array();
     $where_conditions = array();
     foreach ($protocols as $protocol) {
     foreach ($protocols as $protocol) {
       // Simple case, the URL begins with the specified protocol.
       // Simple case, the URL begins with the specified protocol.
-      $condition = $field .' LIKE \''. $protocol .'%\'';
+      $condition = $field . ' LIKE \'' . $protocol . '%\'';
 
 
-      // More complex case, no protocol specified but is automatically cleaned up
-      // by link_cleanup_url(). RegEx is required for this search operation.
+      // 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') {
       if ($protocol == 'http') {
+        $link_domains = _link_domains();
         if ($db_type == 'pgsql') {
         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
           // 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 {
         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
           // See http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html#operator_regexp
-          $condition .= ' OR '. $field .' REGEXP \''.'^(([a-z0-9]([a-z0-9\\\-_]*\.)+)('. LINK_DOMAINS .'|[a-z][a-z]))'.'\'';
+          $condition .= ' OR ' . $field . ' REGEXP \'' . '^(([a-z0-9]([a-z0-9\\\-_]*\.)+)(' . $link_domains . '|[a-z][a-z]))' . '\'';
         }
         }
       }
       }
 
 
       $where_conditions[] = $condition;
       $where_conditions[] = $condition;
     }
     }
 
 
-    $this->query->add_where($this->options['group'], implode(' '. $this->operator .' ', $where_conditions));
+    $this->query->add_where($this->options['group'], implode(' ' . $this->operator . ' ', $where_conditions));
   }
   }
+
 }
 }

+ 49 - 62
sites/all/modules/module_filter/CHANGELOG.txt

@@ -1,23 +1,58 @@
-Module Filter 7.x-2.x, 2013-01-04
----------------------------------
+Module Filter 7.x-2.1, 2017-06-09
+---------------------------------
+Issue #2437439 by mikhail.krainiuk, greenSkin, jayhawkfan75: Module Filter does
+  not care about anchors in permission links.
+Issue #2866236 by Munavijayalakshmi, dhruveshdtripathi: Typo error in
+  README.TXT file.
+Issue #2452067 by Madis: Option to show description expanded as default
+  not working.
+Issue #2580791 by makbul_khan8: Coding standards and few function without
+  help comments.
+Issue #2153697 by annya: Disabling option "Number of enabled modules" breaks
+  tabs functionality.
+Issue #1710230 by willvincent: On | Off buttons does not change state with
+  jquery_update module active.
+Added option to show description as expanded by default.
+Improved description field so when it is open, interacting with it's contents
+  does not make it collapse.
+Placed collapsed/expanded images inside of module for easier, more reliable
+  access.
+Added option to place version in own column.
+Issue #2113191 by joelpittet: Category tabs not working.
+
+
+Module Filter 7.x-2.0, 2015-02-22
+---------------------------------
+Simplifying the table rows by hiding version and requirements until a
+  particular description is clicked.
+#2235553 by greenSkin: Fixed latest jquery_update breaks module filter.
+#2304687 by mpdonadio: Fixed Remove hardcoded operations.
+#2293029 by topsitemakers: Fixed Take header offset into account when selecting
+  a tab.
+#2290213 by topsitemakers: Minor typo in description - "has no affect" -> "has
+  no effect".
+#2141743, #2141743 by greenSkin: Fixed issues related to the new dynamically
+  positioned tabs and using the dynamically positioned save button.
+by greenSkin: Tabs now should always be visible while scrolling large lists of
+  modules.
+#1854348 by alexweber, greenSkin: Make filter textfield wider on modules page
+  when viewing as tabs.
+by greenSkin: Fixed what was suppose to be a call to variable_set().
+#1370492 by greenSkin: Remember selected tab after modules form submit.
+by greenSkin: Changed the title for the 'module_filter_dynamic_save_position'
+  checkbox to make it clearer what it does.
+#1166414 by greenSkin: Fixed broken submit when tabs are disabled. We no longer
+  reroute the theme of the system modules page unless tabs are enabled.
+by greenSkin: Fixed issue on Available updates page where the update state
+  would not be remembered.
+by greenSkin: Fixed 7200 update to rebuild the theme registry at the same time
+  as rebuilding the menu.
 by greenSkin: Fixed issue relating to row coloring when enabling/disabling
 by greenSkin: Fixed issue relating to row coloring when enabling/disabling
   modules via switch due to recent fix for jQuery Update module.
   modules via switch due to recent fix for jQuery Update module.
-
-
-Module Filter 7.x-2.x, 2012-11-27
----------------------------------
 by greenSkin: Added functionality to show recently enabled/disabled modules.
 by greenSkin: Added functionality to show recently enabled/disabled modules.
 #1710230 by littlekoala, greenSkin: Fixed On | Off buttons does not change
 #1710230 by littlekoala, greenSkin: Fixed On | Off buttons does not change
   state with jquery_update() module active.
   state with jquery_update() module active.
-
-
-Module Filter 7.x-2.x, 2012-11-26
----------------------------------
 by greenSkin: Added description to filter textfield on permissions page.
 by greenSkin: Added description to filter textfield on permissions page.
-
-
-Module Filter 7.x-2.x, 2012-11-04
----------------------------------
 by greenSkin: Added filter to user permissions page.
 by greenSkin: Added filter to user permissions page.
 by greenSkin: Fixed styling when JavaScript is disabled.
 by greenSkin: Fixed styling when JavaScript is disabled.
 by greenSkin: Fixed compatiblility with page_actions.
 by greenSkin: Fixed compatiblility with page_actions.
@@ -32,10 +67,6 @@ by greenSkin: Added ability for tabs to be disabled. Direct use case is when
   the "New" tab contains zero new modules.
   the "New" tab contains zero new modules.
 by greenSkin: Added title to "New" tab link that helps to describe the criteria
 by greenSkin: Added title to "New" tab link that helps to describe the criteria
   of a "new" module.
   of a "new" module.
-
-
-Module Filter 7.x-2.x, 2012-07-04
----------------------------------
 #1320796 by greenSkin: Added some validation checks before trying to select a
 #1320796 by greenSkin: Added some validation checks before trying to select a
   tab in case the tab does not actually exist.
   tab in case the tab does not actually exist.
 #1429248 by klonos, greenSkin: Fixed Modules page table header overlaps
 #1429248 by klonos, greenSkin: Fixed Modules page table header overlaps
@@ -51,24 +82,12 @@ by greenSkin: Clicking on module name now affects the toggle switch.
 by greenSkin: Do not render the switch for incompatible modules.
 by greenSkin: Do not render the switch for incompatible modules.
 #1033012 by greenSkin: Hide incompatible module rows when the 'Unavailable'
 #1033012 by greenSkin: Hide incompatible module rows when the 'Unavailable'
   checkbox is unchecked.
   checkbox is unchecked.
-
-
-Module Filter 7.x-2.x, 2012-02-24
----------------------------------
 by greenSkin: Performance tweak to counting the number of enabled modules.
 by greenSkin: Performance tweak to counting the number of enabled modules.
-
-
-Module Filter 7.x-2.x, 2012-02-01
----------------------------------
 by greenSkin: Base new modules on the filectime of their .info file.
 by greenSkin: Base new modules on the filectime of their .info file.
 #1424034 by greenSkin: Now adds the jquery.cookie.js file when needed.
 #1424034 by greenSkin: Now adds the jquery.cookie.js file when needed.
 by greenSkin: Removed tweaks to the save configuration button in favor
 by greenSkin: Removed tweaks to the save configuration button in favor
   http://drupal.org/project/page_actions.
   http://drupal.org/project/page_actions.
 by greenSkin: Updated hook_uninstall to del all Module Filter variables.
 by greenSkin: Updated hook_uninstall to del all Module Filter variables.
-
-
-Module Filter 7.x-2.x, 2012-01-30
----------------------------------
 by greenSkin: No longer including machine name in the tab summary of modules to
 by greenSkin: No longer including machine name in the tab summary of modules to
   enable/disable.
   enable/disable.
 by greenSkin: Made switches honor disabled checkboxes. A disabled switch can
 by greenSkin: Made switches honor disabled checkboxes. A disabled switch can
@@ -79,36 +98,20 @@ by greenSkin: Centered enable switch.
 by greenSkin: Moved couple styles to be applied via JavaScript instead of CSS
 by greenSkin: Moved couple styles to be applied via JavaScript instead of CSS
   so they get applied once the initial loading has finished.
   so they get applied once the initial loading has finished.
 by greenSkin: Implemented a "switch" look instead of checkboxes.
 by greenSkin: Implemented a "switch" look instead of checkboxes.
-
-
-Module Filter 7.x-2.x, 2012-01-30
----------------------------------
 by greenSkin: Remember last selected state on "Available updates" page.
 by greenSkin: Remember last selected state on "Available updates" page.
 by greenSkin: Switched to using filectime() rather than filemtime() for
 by greenSkin: Switched to using filectime() rather than filemtime() for
   determining new modules.
   determining new modules.
 #1354134 by klonos, greenSkin: Module list now formats correctly in core
 #1354134 by klonos, greenSkin: Module list now formats correctly in core
   "Garland" theme.
   "Garland" theme.
-
-
-Module Filter 7.x-2.x, 2011-12-12
----------------------------------
 #1354134 by klonos, greenSkin: Module list now formats correctly in core
 #1354134 by klonos, greenSkin: Module list now formats correctly in core
   "Garland" theme.
   "Garland" theme.
 #1124218 by jyee, greenSkin: Suppress form submission when hitting the enter
 #1124218 by jyee, greenSkin: Suppress form submission when hitting the enter
   key while the filter input is focused.
   key while the filter input is focused.
-
-
-Module Filter 7.x-2.x, 2011-11-23
----------------------------------
 by greenSkin: Simplified filter rules for updates page. Instead of checkboxes,
 by greenSkin: Simplified filter rules for updates page. Instead of checkboxes,
   now using radios.
   now using radios.
 by greenSkin: Fixed "All" tab to be selected by default when the page is first
 by greenSkin: Fixed "All" tab to be selected by default when the page is first
   loaded.
   loaded.
 #1350124 by greenSkin: Fixed filtering on package tab.
 #1350124 by greenSkin: Fixed filtering on package tab.
-
-
-Module Filter 7.x-2.x, 2011-11-21
----------------------------------
 by greenSkin: Added the "All" tab back. Added a "New" tab that lists modules
 by greenSkin: Added the "All" tab back. Added a "New" tab that lists modules
   installed within the last week.
   installed within the last week.
 by greenSkin: Fixed "No Results" not showing within selected tabs.
 by greenSkin: Fixed "No Results" not showing within selected tabs.
@@ -123,10 +126,6 @@ by greenSkin: Filter now uses OR instead of AND when filtering multiply
 #1170388 by greenSkin: Fixed confict with Overlay module. Added class
 #1170388 by greenSkin: Fixed confict with Overlay module. Added class
   "overlay-exclude" to tab links. Added setting to toggle the use of a URL
   "overlay-exclude" to tab links. Added setting to toggle the use of a URL
   fragment when selecting tabs.
   fragment when selecting tabs.
-
-
-Module Filter 7.x-2.x, 2011-10-11
----------------------------------
 by greenSkin: Added README.txt.
 by greenSkin: Added README.txt.
 by greenSkin: Fixed table row striping.
 by greenSkin: Fixed table row striping.
 by greenSkin: Fixed regular expression to not require an operator be at the
 by greenSkin: Fixed regular expression to not require an operator be at the
@@ -138,10 +137,6 @@ by greenSkin: Added operator support to filter. Added "requires:" and
   "requiredBy:" operators.
   "requiredBy:" operators.
 by greenSkin: Filter now processes multiple queries separated by spaces. Use
 by greenSkin: Filter now processes multiple queries separated by spaces. Use
   quotes for a single query that includes space(s).
   quotes for a single query that includes space(s).
-
-
-Module Filter 7.x-2.x, 2011-09-19
----------------------------------
 by greenSkin: Fixed not updating the index when a module is enabled/disabled.
 by greenSkin: Fixed not updating the index when a module is enabled/disabled.
 by greenSkin: Fixed visual aid for enabling/disabling modules. Previously had
 by greenSkin: Fixed visual aid for enabling/disabling modules. Previously had
   failed to remove +/- from tab summary.
   failed to remove +/- from tab summary.
@@ -150,10 +145,6 @@ by Kiphaas7, greenSkin: Tabs can now be configured to hide when they contain
 by Kiphaas7, greenSkin: Added result info to tabs. When a filter is performed,
 by Kiphaas7, greenSkin: Added result info to tabs. When a filter is performed,
   a count per tab is displayed of the number of visible results for that tab.
   a count per tab is displayed of the number of visible results for that tab.
 by greenSkin: Now more descriptive of what modules are being enabled/disabled.
 by greenSkin: Now more descriptive of what modules are being enabled/disabled.
-
-
-Module Filter 7.x-2.x, 2011-09-15
----------------------------------
 by greenSkin: Moved module operation links to below "Requires" and
 by greenSkin: Moved module operation links to below "Requires" and
   "Required by" section.
   "Required by" section.
 by greenSkin: Added a suggest class to tabs when their module is hovered.
 by greenSkin: Added a suggest class to tabs when their module is hovered.
@@ -165,10 +156,6 @@ by greenSkin: Added update to force a menu rebuild. This is needed to let
   filter on its page.
   filter on its page.
 #1254140 by greenSkin: No longer return anything in hook_update_7100.
 #1254140 by greenSkin: No longer return anything in hook_update_7100.
 #1257860 by greenSkin: Added filter to update status report.
 #1257860 by greenSkin: Added filter to update status report.
-
-
-Module Filter 7.x-2.x, 2011-09-14
----------------------------------
 by greenSkin: Moved hiding of the inputs wrapper to css rather than a style
 by greenSkin: Moved hiding of the inputs wrapper to css rather than a style
   attribute.
   attribute.
 by greenSkin: Added missing semi-colons in JavaScript.
 by greenSkin: Added missing semi-colons in JavaScript.

+ 2 - 2
sites/all/modules/module_filter/README.txt

@@ -17,8 +17,8 @@ visibility of modules that are disabled and depend on module(s) that are
 missing.
 missing.
 
 
 The update status report filter also contains four checkboxes: Up-to-Date,
 The update status report filter also contains four checkboxes: Up-to-Date,
-Update availabe, Security update, and Unknown. These directly affect the
-visibilty of each project; whether it is up-to-date, there is an update
+Update available, Security update, and Unknown. These directly affect the
+visibility of each project; whether it is up-to-date, there is an update
 available, a security update is available, or the status is unknown.
 available, a security update is available, or the status is unknown.
 
 
 Installation
 Installation

+ 0 - 2
sites/all/modules/module_filter/css/dynamic_position.css

@@ -1,6 +1,4 @@
 html.js #module-filter-submit {
 html.js #module-filter-submit {
-  float: left;
-  clear: both;
   background-color: #F6F6F6;
   background-color: #F6F6F6;
   width: 239px;
   width: 239px;
   border: 1px solid #ccc;
   border: 1px solid #ccc;

+ 6 - 0
sites/all/modules/module_filter/css/module_filter.css

@@ -18,3 +18,9 @@
   text-transform: uppercase;
   text-transform: uppercase;
   color: #888;
   color: #888;
 }
 }
+#module-filter-modules {
+  position: relative;
+}
+#module-filter-modules table {
+  position: absolute;
+}

+ 15 - 4
sites/all/modules/module_filter/css/module_filter_tab.css

@@ -3,6 +3,9 @@
 }
 }
 
 
 #module-filter-tabs {
 #module-filter-tabs {
+  float: left;
+}
+#module-filter-tabs ul {
   width: 239px;
   width: 239px;
   list-style: none;
   list-style: none;
   list-style-image: none;
   list-style-image: none;
@@ -11,7 +14,6 @@
   border-top: none;
   border-top: none;
   margin: 0;
   margin: 0;
   padding: 0;
   padding: 0;
-  float: left;
   line-height: 1;
   line-height: 1;
 }
 }
 #module-filter-tabs li {
 #module-filter-tabs li {
@@ -107,6 +109,9 @@ html.js .module-filter-inputs-wrapper .form-item {
 html.js .module-filter-inputs-wrapper label {
 html.js .module-filter-inputs-wrapper label {
   display: inline;
   display: inline;
 }
 }
+html.js .module-filter-inputs-wrapper input[name="module_filter[name]"] {
+  width: 80%;
+}
 html.js #module-filter-show-wrapper {
 html.js #module-filter-show-wrapper {
   margin-bottom: 1em;
   margin-bottom: 1em;
 }
 }
@@ -162,9 +167,6 @@ html.js #module-filter-modules table td {
 .admin-version {
 .admin-version {
   white-space: nowrap;
   white-space: nowrap;
 }
 }
-.admin-operations {
-  float: right;
-}
 .admin-operations a.module-link {
 .admin-operations a.module-link {
   display: inline;
   display: inline;
 }
 }
@@ -246,3 +248,12 @@ html.js .toggle-enable div:after {
 html.js .toggle-enable.off div {
 html.js .toggle-enable.off div {
   left: 24px;
   left: 24px;
 }
 }
+
+#module-filter-tabs.top-fixed {
+  position: fixed;
+  top: 0;
+}
+#module-filter-tabs.bottom-fixed {
+  position: fixed;
+  bottom: 0;
+}

+ 53 - 0
sites/all/modules/module_filter/css/modules.css

@@ -0,0 +1,53 @@
+#system-modules table {
+  table-layout: fixed;
+}
+#system-modules th.checkbox {
+  width: 8%;
+}
+#system-modules th.name {
+  width: 25%;
+}
+#system-modules th.version {
+  width: 10%;
+}
+#system-modules th.links {
+  width: 15%;
+}
+#system-modules td {
+  vertical-align: top;
+}
+#system-modules .expand.inner {
+  background: transparent url(../images/collapsed.png) left 0.6em no-repeat;
+  margin-left: -12px;
+  padding-left: 12px;
+}
+#system-modules .expanded.expand.inner {
+  background: transparent url(../images/expanded.png) left 0.6em no-repeat;
+}
+#system-modules .description {
+  cursor: pointer;
+}
+#system-modules .description .inner {
+  overflow: hidden; /* truncates descriptions if too long */
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+#system-modules .description .inner.expanded > * {
+  cursor: auto;
+}
+#system-modules .description .requirements,
+#system-modules .description .links {
+  display: none;
+}
+#system-modules .description .expanded.inner {
+  overflow: visible;
+  white-space: normal;
+}
+#system-modules .description .expanded .requirements,
+#system-modules .description .expanded .links {
+  display: block;
+}
+#system-modules .requirements {
+  padding: 5px 0;
+  max-width: 490px;
+}

BIN
sites/all/modules/module_filter/images/collapsed.png


BIN
sites/all/modules/module_filter/images/expanded.png


+ 19 - 27
sites/all/modules/module_filter/js/dynamic_position.js

@@ -6,35 +6,24 @@ Drupal.behaviors.moduleFilterDynamicPosition = {
 
 
     $('#module-filter-wrapper', context).once('dynamic-position', function() {
     $('#module-filter-wrapper', context).once('dynamic-position', function() {
       // Move the submit button just below the tabs.
       // Move the submit button just below the tabs.
-      $('#module-filter-modules'). before($('#module-filter-submit'));
-      if (Drupal.settings.moduleFilter.hideEmptyTabs) {
-        // Trigger window scroll. When the save buttons dynamic position is enabled
-        // we need this to ensure the save button's position updates with the new
-        // height of the tabs.
-        $window.trigger('scroll');
-      }
+      $('#module-filter-tabs').append($('#module-filter-submit'));
 
 
-      // Control the positioning.
-      $window.scroll(function() {
+      var positionSubmit = function() {
         var $tabs = $('#module-filter-tabs');
         var $tabs = $('#module-filter-tabs');
-        var $submit = $('#module-filter-submit');
+        var $submit = $('#module-filter-submit', $tabs);
 
 
         // Vertical movement.
         // Vertical movement.
-        var top = $tabs.offset().top;
-        var bottom = top + $tabs.height();
-        var windowHeight = $window.height();
-        var topOffset = Drupal.settings.tableHeaderOffset ? eval(Drupal.settings.tableHeaderOffset + '()') : 0;
-        if (((bottom - windowHeight) > ($window.scrollTop() - $submit.height())) && $window.scrollTop() + windowHeight - $submit.height() - $('li:first', $tabs).height() > top) {
-          $submit.css('margin-top', 0);
-          $submit.removeClass('fixed-top').addClass('fixed fixed-bottom');
+        var bottom = $tabs.offset().top + $tabs.outerHeight();
+        if ($submit.hasClass('fixed-bottom')) {
+          bottom += $submit.height();
         }
         }
-        else if (bottom < ($window.scrollTop() + topOffset)) {
-          $submit.css('margin-top', topOffset);
-          $submit.removeClass('fixed-bottom').addClass('fixed fixed-top');
+        if (bottom >= $window.height() + $window.scrollTop()) {
+          $submit.addClass('fixed fixed-bottom');
+          $tabs.css('padding-bottom', $submit.height());
         }
         }
         else {
         else {
-          $submit.css('margin-top', 0);
-          $submit.removeClass('fixed fixed-bottom fixed-top');
+          $submit.removeClass('fixed fixed-bottom');
+          $tabs.css('padding-bottom', 0);
         }
         }
 
 
         // Horizontal movement.
         // Horizontal movement.
@@ -44,11 +33,14 @@ Drupal.behaviors.moduleFilterDynamicPosition = {
             $submit.css('left', left);
             $submit.css('left', left);
           }
           }
         }
         }
-      });
-      $window.trigger('scroll');
-      $window.resize(function() {
-        $window.trigger('scroll');
-      });
+      };
+
+      // Control the positioning.
+      $window.scroll(positionSubmit);
+      $window.resize(positionSubmit);
+      var moduleFilter = $('input[name="module_filter[name]"]').data('moduleFilter');
+      moduleFilter.element.bind('moduleFilter:adjustHeight', positionSubmit);
+      moduleFilter.adjustHeight();
     });
     });
   }
   }
 };
 };

+ 7 - 6
sites/all/modules/module_filter/js/module_filter.js

@@ -40,13 +40,11 @@ Drupal.ModuleFilter.setState = function(key, value) {
   var existing = Drupal.ModuleFilter.getState(key);
   var existing = Drupal.ModuleFilter.getState(key);
   if (existing != value) {
   if (existing != value) {
     Drupal.ModuleFilter.state[key] = value;
     Drupal.ModuleFilter.state[key] = value;
-    if (Drupal.settings.moduleFilter.rememberUpdateState) {
-      var query = [];
-      for (var i in Drupal.ModuleFilter.state) {
-        query.push(i + '=' + Drupal.ModuleFilter.state[i]);
-      }
-      $.cookie('DrupalModuleFilter', query.join('&'), { expires: 7, path: '/' });
+    var query = [];
+    for (var i in Drupal.ModuleFilter.state) {
+      query.push(i + '=' + Drupal.ModuleFilter.state[i]);
     }
     }
+    $.cookie('DrupalModuleFilter', query.join('&'), { expires: 7, path: '/' });
   }
   }
 };
 };
 
 
@@ -267,6 +265,9 @@ $.fn.moduleFilter = function(selector, options) {
   if (Drupal.settings.moduleFilter.setFocus) {
   if (Drupal.settings.moduleFilter.setFocus) {
     filterInput.focus();
     filterInput.focus();
   }
   }
+  if (Drupal.settings.moduleFilter.expandedDescription) {
+    $('#system-modules td.description .inner.expand').addClass('expanded');
+  }
   filterInput.data('moduleFilter', new Drupal.ModuleFilter.Filter(this, selector, options));
   filterInput.data('moduleFilter', new Drupal.ModuleFilter.Filter(this, selector, options));
 };
 };
 
 

+ 151 - 25
sites/all/modules/module_filter/js/module_filter_tab.js

@@ -43,6 +43,7 @@ Drupal.behaviors.moduleFilterTabs = {
   attach: function(context) {
   attach: function(context) {
     if (Drupal.settings.moduleFilter.tabs) {
     if (Drupal.settings.moduleFilter.tabs) {
       $('#module-filter-wrapper table:not(.sticky-header)', context).once('module-filter-tabs', function() {
       $('#module-filter-wrapper table:not(.sticky-header)', context).once('module-filter-tabs', function() {
+        var $modules = $('#module-filter-modules');
         var moduleFilter = $('input[name="module_filter[name]"]').data('moduleFilter');
         var moduleFilter = $('input[name="module_filter[name]"]').data('moduleFilter');
         var table = $(this);
         var table = $(this);
 
 
@@ -51,10 +52,12 @@ Drupal.behaviors.moduleFilterTabs = {
         // Remove package header rows.
         // Remove package header rows.
         $('tr.admin-package-header', table).remove();
         $('tr.admin-package-header', table).remove();
 
 
+        var $tabsWrapper = $('<div id="module-filter-tabs"></div>');
+
         // Build tabs from package title rows.
         // Build tabs from package title rows.
-        var tabs = '<ul id="module-filter-tabs">';
+        var tabs = '<ul>';
         for (var i in Drupal.settings.moduleFilter.packageIDs) {
         for (var i in Drupal.settings.moduleFilter.packageIDs) {
-          var id = Drupal.settings.moduleFilter.packageIDs[i];
+          var id = Drupal.checkPlain(Drupal.settings.moduleFilter.packageIDs[i]);
 
 
           var name = id;
           var name = id;
           var tabClass = 'project-tab';
           var tabClass = 'project-tab';
@@ -81,9 +84,9 @@ Drupal.behaviors.moduleFilterTabs = {
                 summary += '<span>' + Drupal.t('No modules were enabled or disabled within the last week.') + '</span>';
                 summary += '<span>' + Drupal.t('No modules were enabled or disabled within the last week.') + '</span>';
               }
               }
               break;
               break;
-            default: 
-              var $row = $('#' + id + '-package');
-              name = $.trim($row.text());
+            default:
+              var $row = $('#' + id + '-package', this);
+              name = Drupal.checkPlain($.trim($row.text()));
               $row.remove();
               $row.remove();
               break;
               break;
           }
           }
@@ -91,7 +94,8 @@ Drupal.behaviors.moduleFilterTabs = {
           tabs += '<li id="' + id + '-tab" class="' + tabClass + '"><a href="#' + id + '" class="overlay-exclude"' + (title ? ' title="' + title + '"' : '') + '><strong>' + name + '</strong><span class="summary">' + summary + '</span></a></li>';
           tabs += '<li id="' + id + '-tab" class="' + tabClass + '"><a href="#' + id + '" class="overlay-exclude"' + (title ? ' title="' + title + '"' : '') + '><strong>' + name + '</strong><span class="summary">' + summary + '</span></a></li>';
         }
         }
         tabs += '</ul>';
         tabs += '</ul>';
-        $('#module-filter-modules').before(tabs);
+        $tabsWrapper.append(tabs);
+        $modules.before($tabsWrapper);
 
 
         // Index tabs.
         // Index tabs.
         $('#module-filter-tabs li').each(function() {
         $('#module-filter-tabs li').each(function() {
@@ -100,7 +104,7 @@ Drupal.behaviors.moduleFilterTabs = {
           Drupal.ModuleFilter.tabs[id] = new Drupal.ModuleFilter.Tab($tab, id);
           Drupal.ModuleFilter.tabs[id] = new Drupal.ModuleFilter.Tab($tab, id);
         });
         });
 
 
-        $('#module-filter-modules tbody td.checkbox input').change(function() {
+        $('tbody td.checkbox input', $modules).change(function() {
           var $checkbox = $(this);
           var $checkbox = $(this);
           var key = $checkbox.parents('tr').data('indexKey');
           var key = $checkbox.parents('tr').data('indexKey');
 
 
@@ -127,7 +131,7 @@ Drupal.behaviors.moduleFilterTabs = {
           .filter(':odd').addClass('even').end()
           .filter(':odd').addClass('even').end()
           .filter(':even').addClass('odd');
           .filter(':even').addClass('odd');
 
 
-        Drupal.ModuleFilter.adjustHeight();
+        moduleFilter.adjustHeight();
 
 
         moduleFilter.element.bind('moduleFilter:start', function() {
         moduleFilter.element.bind('moduleFilter:start', function() {
           moduleFilter.tabResults = {
           moduleFilter.tabResults = {
@@ -203,7 +207,6 @@ Drupal.behaviors.moduleFilterTabs = {
                     Drupal.ModuleFilter.tabs[id].element.hide();
                     Drupal.ModuleFilter.tabs[id].element.hide();
                   }
                   }
                 }
                 }
-                Drupal.ModuleFilter.adjustHeight();
               }
               }
             }
             }
             else {
             else {
@@ -218,18 +221,20 @@ Drupal.behaviors.moduleFilterTabs = {
             // The current tab contains no results.
             // The current tab contains no results.
             moduleFilter.results = 0;
             moduleFilter.results = 0;
           }
           }
+
+          moduleFilter.adjustHeight();
         });
         });
 
 
         if (Drupal.settings.moduleFilter.useURLFragment) {
         if (Drupal.settings.moduleFilter.useURLFragment) {
           $(window).bind('hashchange.module-filter', $.proxy(Drupal.ModuleFilter, 'eventHandlerOperateByURLFragment')).triggerHandler('hashchange.module-filter');
           $(window).bind('hashchange.module-filter', $.proxy(Drupal.ModuleFilter, 'eventHandlerOperateByURLFragment')).triggerHandler('hashchange.module-filter');
         }
         }
         else {
         else {
-          Drupal.ModuleFilter.selectTab('all');
+          Drupal.ModuleFilter.selectTab();
         }
         }
 
 
         if (Drupal.settings.moduleFilter.useSwitch) {
         if (Drupal.settings.moduleFilter.useSwitch) {
-          $('td.checkbox div.form-item').hide();
-          $('td.checkbox').each(function(i) {
+          $('td.checkbox div.form-item', table).hide();
+          $('td.checkbox', table).each(function(i) {
             var $cell = $(this);
             var $cell = $(this);
             var $checkbox = $(':checkbox', $cell);
             var $checkbox = $(':checkbox', $cell);
             var $switch = $('.toggle-enable', $cell);
             var $switch = $('.toggle-enable', $cell);
@@ -237,19 +242,115 @@ Drupal.behaviors.moduleFilterTabs = {
               if (!$(this).hasClass('disabled')) {
               if (!$(this).hasClass('disabled')) {
                 if (Drupal.ModuleFilter.jQueryIsNewer()) {
                 if (Drupal.ModuleFilter.jQueryIsNewer()) {
                   $checkbox.click();
                   $checkbox.click();
+                  $switch.toggleClass('off');
                 }
                 }
                 else {
                 else {
                   $checkbox.click().change();
                   $checkbox.click().change();
+                  $switch.toggleClass('off');
                 }
                 }
               }
               }
             });
             });
-            $checkbox.click(function() {
-              if (!$switch.hasClass('disabled')) {
-                $switch.toggleClass('off');
-              }
-            });
           });
           });
         }
         }
+
+        var $tabs = $('#module-filter-tabs');
+
+        function getParentTopOffset($obj, offset) {
+          var $parent = $obj.offsetParent();
+          if ($obj[0] != $parent[0]) {
+            offset += $parent.position().top;
+            return getParentTopOffset($parent, offset);
+          }
+          return offset;
+        }
+
+        var tabsTopOffset = null;
+        function getParentsTopOffset() {
+          if (tabsTopOffset === null) {
+            tabsTopOffset = getParentTopOffset($tabs.parent(), 0);
+          }
+          return tabsTopOffset;
+        }
+
+        function viewportTop() {
+          var top = $(window).scrollTop();
+          return top;
+        }
+
+        function viewportBottom() {
+          var top = $(window).scrollTop();
+          var bottom = top + $(window).height();
+
+          bottom -= $('#page-actions').height();
+
+          return bottom;
+        }
+
+        function fixToTop(top) {
+          if ($tabs.hasClass('bottom-fixed')) {
+            $tabs.css({
+              'position': 'absolute',
+              'top': $tabs.position().top - getParentsTopOffset(),
+              'bottom': 'auto'
+            });
+            $tabs.removeClass('bottom-fixed');
+          }
+
+          if (($tabs.css('position') == 'absolute' && $tabs.offset().top - top >= 0) || ($tabs.css('position') != 'absolute' && $tabs.offset().top - top <= 0)) {
+            $tabs.addClass('top-fixed');
+            $tabs.attr('style', '');
+          }
+        }
+
+        function fixToBottom(bottom) {
+          if ($tabs.hasClass('top-fixed')) {
+            $tabs.css({
+              'position': 'absolute',
+              'top': $tabs.position().top - getParentsTopOffset(),
+              'bottom': 'auto'
+            });
+            $tabs.removeClass('top-fixed');
+          }
+
+          if ($tabs.offset().top + $tabs.height() - bottom <= 0) {
+            $tabs.addClass('bottom-fixed');
+            var style = '';
+            var pageActionsHeight = $('#page-actions').height();
+            if (pageActionsHeight > 0) {
+              style = 'bottom: ' + pageActionsHeight + 'px';
+            }
+            else if (Drupal.settings.moduleFilter.dynamicPosition) {
+              // style = 'bottom: ' + $('#module-filter-submit', $tabs).height() + 'px';
+            }
+            $tabs.attr('style', style);
+          }
+        }
+
+        var lastTop = 0;
+        $(window).scroll(function() {
+          var top = viewportTop();
+          var bottom = viewportBottom();
+
+          if ($modules.offset().top >= top) {
+            $tabs.removeClass('top-fixed').attr('style', '');
+          }
+          else {
+            if (top > lastTop) { // Downward scroll.
+              if ($tabs.height() > bottom - top) {
+                fixToBottom(bottom);
+              }
+              else {
+                fixToTop(top);
+              }
+            }
+            else { // Upward scroll.
+              fixToTop(top);
+            }
+          }
+          lastTop = top;
+        });
+
+        moduleFilter.adjustHeight();
       });
       });
     }
     }
   }
   }
@@ -288,7 +389,16 @@ Drupal.ModuleFilter.Tab = function(element, id) {
 
 
 Drupal.ModuleFilter.selectTab = function(hash) {
 Drupal.ModuleFilter.selectTab = function(hash) {
   if (!hash || Drupal.ModuleFilter.tabs[hash + '-tab'] == undefined || Drupal.settings.moduleFilter.enabledCounts[hash].total == 0) {
   if (!hash || Drupal.ModuleFilter.tabs[hash + '-tab'] == undefined || Drupal.settings.moduleFilter.enabledCounts[hash].total == 0) {
-    hash = 'all';
+    if (Drupal.settings.moduleFilter.rememberActiveTab) {
+      var activeTab = Drupal.ModuleFilter.getState('activeTab');
+      if (activeTab && Drupal.ModuleFilter.tabs[activeTab + '-tab'] != undefined) {
+        hash = activeTab;
+      }
+    }
+
+    if (!hash) {
+      hash = 'all';
+    }
   }
   }
 
 
   if (Drupal.ModuleFilter.activeTab != undefined) {
   if (Drupal.ModuleFilter.activeTab != undefined) {
@@ -299,7 +409,24 @@ Drupal.ModuleFilter.selectTab = function(hash) {
   Drupal.ModuleFilter.activeTab.element.addClass('selected');
   Drupal.ModuleFilter.activeTab.element.addClass('selected');
 
 
   var moduleFilter = $('input[name="module_filter[name]"]').data('moduleFilter');
   var moduleFilter = $('input[name="module_filter[name]"]').data('moduleFilter');
-  moduleFilter.applyFilter();
+  var filter = moduleFilter.applyFilter();
+
+  if (!Drupal.ModuleFilter.modulesTop) {
+    Drupal.ModuleFilter.modulesTop = $('#module-filter-modules').offset().top;
+  }
+  else {
+    // Calculate header offset; this is important in case the site is using
+    // admin_menu module which has fixed positioning and is on top of everything
+    // else.
+    var headerOffset = Drupal.settings.tableHeaderOffset ? eval(Drupal.settings.tableHeaderOffset + '()') : 0;
+    // Scroll back to top of #module-filter-modules.
+    $('html, body').animate({
+      scrollTop: Drupal.ModuleFilter.modulesTop - headerOffset
+    }, 500);
+    // $('html, body').scrollTop(Drupal.ModuleFilter.modulesTop);
+  }
+
+  Drupal.ModuleFilter.setState('activeTab', hash);
 };
 };
 
 
 Drupal.ModuleFilter.eventHandlerOperateByURLFragment = function(event) {
 Drupal.ModuleFilter.eventHandlerOperateByURLFragment = function(event) {
@@ -390,7 +517,7 @@ Drupal.ModuleFilter.updateVisualAid = function(type, $row) {
   }
   }
 
 
   var tab = Drupal.ModuleFilter.tabs[id];
   var tab = Drupal.ModuleFilter.tabs[id];
-  var name = $('td:nth(1) strong', $row).text();
+  var name = Drupal.checkPlain($('td:nth(1) strong', $row).text());
   switch (type) {
   switch (type) {
     case 'enable':
     case 'enable':
       if (Drupal.ModuleFilter.disabling[id + name] != undefined) {
       if (Drupal.ModuleFilter.disabling[id + name] != undefined) {
@@ -421,13 +548,12 @@ Drupal.ModuleFilter.updateVisualAid = function(type, $row) {
   tab.updateVisualAid();
   tab.updateVisualAid();
 };
 };
 
 
-Drupal.ModuleFilter.adjustHeight = function() {
+Drupal.ModuleFilter.Filter.prototype.adjustHeight = function() {
   // Hack for adjusting the height of the modules section.
   // Hack for adjusting the height of the modules section.
-  var minHeight = $('#module-filter-tabs').height() + 10;
-  if (Drupal.settings.moduleFilter.dynamicPosition) {
-    minHeight += $('#module-filter-submit').height();
-  }
+  var minHeight = $('#module-filter-tabs ul').height() + 10;
+  minHeight += $('#module-filter-tabs #module-filter-submit').height();
   $('#module-filter-modules').css('min-height', minHeight);
   $('#module-filter-modules').css('min-height', minHeight);
+  this.element.trigger('moduleFilter:adjustHeight');
 }
 }
 
 
 })(jQuery);
 })(jQuery);

+ 11 - 0
sites/all/modules/module_filter/js/modules.js

@@ -2,6 +2,17 @@
 
 
 Drupal.behaviors.moduleFilter = {
 Drupal.behaviors.moduleFilter = {
   attach: function(context) {
   attach: function(context) {
+    $('#system-modules td.description').once('description', function() {
+      $(this).click(function() {
+        $('.inner.expand', $(this)).toggleClass('expanded');
+      });
+      $('.inner.expand', $(this)).children().click(function(e) {
+        if ($(this).parent().hasClass('expanded')) {
+          e.stopPropagation();
+        }
+      });
+    });
+
     $('.module-filter-inputs-wrapper', context).once('module-filter', function() {
     $('.module-filter-inputs-wrapper', context).once('module-filter', function() {
       var filterInput = $('input[name="module_filter[name]"]', context);
       var filterInput = $('input[name="module_filter[name]"]', context);
       var selector = '#system-modules table tbody tr';
       var selector = '#system-modules table tbody tr';

+ 27 - 9
sites/all/modules/module_filter/module_filter.admin.inc

@@ -17,7 +17,7 @@ function module_filter_settings() {
   $form['module_filter_set_focus'] = array(
   $form['module_filter_set_focus'] = array(
     '#type' => 'checkbox',
     '#type' => 'checkbox',
     '#title' => t('Set focus to filter field on page load'),
     '#title' => t('Set focus to filter field on page load'),
-    '#description' => t('Currently has no affect when using Overlay module.'),
+    '#description' => t('Currently has no effect when using Overlay module.'),
     '#default_value' => variable_get('module_filter_set_focus', 1),
     '#default_value' => variable_get('module_filter_set_focus', 1),
   );
   );
 
 
@@ -25,44 +25,44 @@ function module_filter_settings() {
     '#type' => 'checkbox',
     '#type' => 'checkbox',
     '#title' => t('Enhance the modules page with tabs'),
     '#title' => t('Enhance the modules page with tabs'),
     '#description' => t('Alternate tabbed theme that restructures packages into tabs.'),
     '#description' => t('Alternate tabbed theme that restructures packages into tabs.'),
-    '#default_value' => variable_get('module_filter_tabs', 1)
+    '#default_value' => variable_get('module_filter_tabs', 1),
   );
   );
   $form['tabs'] = array(
   $form['tabs'] = array(
     '#type' => 'fieldset',
     '#type' => 'fieldset',
     '#title' => t('Tabs'),
     '#title' => t('Tabs'),
     '#description' => t('Settings used with the tabs view of the modules page.'),
     '#description' => t('Settings used with the tabs view of the modules page.'),
     '#collapsible' => TRUE,
     '#collapsible' => TRUE,
-    '#collapsed' => FALSE
+    '#collapsed' => FALSE,
   );
   );
   $form['tabs']['module_filter_count_enabled'] = array(
   $form['tabs']['module_filter_count_enabled'] = array(
     '#type' => 'checkbox',
     '#type' => 'checkbox',
     '#title' => t('Number of enabled modules'),
     '#title' => t('Number of enabled modules'),
     '#description' => t('Display the number of enabled modules in the active tab along with the total number of modules.'),
     '#description' => t('Display the number of enabled modules in the active tab along with the total number of modules.'),
-    '#default_value' => variable_get('module_filter_count_enabled', 1)
+    '#default_value' => variable_get('module_filter_count_enabled', 1),
   );
   );
   $form['tabs']['module_filter_visual_aid'] = array(
   $form['tabs']['module_filter_visual_aid'] = array(
     '#type' => 'checkbox',
     '#type' => 'checkbox',
     '#title' => t('Visual aids'),
     '#title' => t('Visual aids'),
     '#description' => t('When enabling/disabling modules, the module name will display in the tab summary.<br />When filtering, a count of results for each tab will be presented.'),
     '#description' => t('When enabling/disabling modules, the module name will display in the tab summary.<br />When filtering, a count of results for each tab will be presented.'),
-    '#default_value' => variable_get('module_filter_visual_aid', 1)
+    '#default_value' => variable_get('module_filter_visual_aid', 1),
   );
   );
   $form['tabs']['module_filter_hide_empty_tabs'] = array(
   $form['tabs']['module_filter_hide_empty_tabs'] = array(
     '#type' => 'checkbox',
     '#type' => 'checkbox',
     '#title' => t('Hide tabs with no results'),
     '#title' => t('Hide tabs with no results'),
     '#description' => t('When a filter returns no results for a tab, the tab is hidden. This is dependent on visual aids being enabled.'),
     '#description' => t('When a filter returns no results for a tab, the tab is hidden. This is dependent on visual aids being enabled.'),
-    '#default_value' => variable_get('module_filter_hide_empty_tabs', 0)
+    '#default_value' => variable_get('module_filter_hide_empty_tabs', 0),
   );
   );
   $form['tabs']['module_filter_dynamic_save_position'] = array(
   $form['tabs']['module_filter_dynamic_save_position'] = array(
     '#type' => 'checkbox',
     '#type' => 'checkbox',
-    '#title' => t('Dynamic Save position'),
+    '#title' => t('Dynamically position Save button'),
     '#description' => t("For sites with lots of tabs, enable to help keep the 'Save configuration' button more accessible."),
     '#description' => t("For sites with lots of tabs, enable to help keep the 'Save configuration' button more accessible."),
-    '#default_value' => variable_get('module_filter_dynamic_save_position', 1)
+    '#default_value' => variable_get('module_filter_dynamic_save_position', 1),
   );
   );
   $form['tabs']['module_filter_use_url_fragment'] = array(
   $form['tabs']['module_filter_use_url_fragment'] = array(
     '#type' => 'checkbox',
     '#type' => 'checkbox',
     '#title' => t('Use URL fragment'),
     '#title' => t('Use URL fragment'),
     '#description' => t('Use URL fragment when navigating between tabs. This lets you use the browsers back/forward buttons to navigate through the tabs you selected.') . '<br />' . t('When the Overlay module is enabled this functionality will not be used since overlay relies on the URL fragment.'),
     '#description' => t('Use URL fragment when navigating between tabs. This lets you use the browsers back/forward buttons to navigate through the tabs you selected.') . '<br />' . t('When the Overlay module is enabled this functionality will not be used since overlay relies on the URL fragment.'),
-    '#default_value' => variable_get('module_filter_use_url_fragment', 1)
+    '#default_value' => variable_get('module_filter_use_url_fragment', 1),
   );
   );
   $form['tabs']['module_filter_use_switch'] = array(
   $form['tabs']['module_filter_use_switch'] = array(
     '#type' => 'checkbox',
     '#type' => 'checkbox',
@@ -76,6 +76,24 @@ function module_filter_settings() {
     '#description' => t('Adds a "Recent" tab that displays modules that have been enabled or disabled with the last week.'),
     '#description' => t('Adds a "Recent" tab that displays modules that have been enabled or disabled with the last week.'),
     '#default_value' => variable_get('module_filter_track_recent_modules', 1),
     '#default_value' => variable_get('module_filter_track_recent_modules', 1),
   );
   );
+  $form['tabs']['module_filter_remember_active_tab'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Remember active tab.'),
+    '#description' => t('When enabled, the active tab will be remembered.'),
+    '#default_value' => variable_get('module_filter_remember_active_tab', 1),
+  );
+  $form['tabs']['module_filter_version_column'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Place version in own column'),
+    '#description' => t("Moves the version out of the description and into it's own column"),
+    '#default_value' => variable_get('module_filter_version_column', 0),
+  );
+  $form['tabs']['module_filter_expanded_description'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Expand description by default'),
+    '#description' => t('When enabled, the description will be expanded by default.'),
+    '#default_value' => variable_get('module_filter_expanded_description', 0),
+  );
 
 
   $form['update'] = array(
   $form['update'] = array(
     '#type' => 'fieldset',
     '#type' => 'fieldset',

+ 3 - 5
sites/all/modules/module_filter/module_filter.info

@@ -4,7 +4,6 @@ core = 7.x
 package = Administration
 package = Administration
 
 
 files[] = module_filter.install
 files[] = module_filter.install
-files[] = module_filter.js
 files[] = module_filter.module
 files[] = module_filter.module
 files[] = module_filter.admin.inc
 files[] = module_filter.admin.inc
 files[] = module_filter.theme.inc
 files[] = module_filter.theme.inc
@@ -17,9 +16,8 @@ files[] = js/module_filter_tab.js
 
 
 configure = admin/config/user-interface/modulefilter
 configure = admin/config/user-interface/modulefilter
 
 
-; Information added by drupal.org packaging script on 2013-01-05
-version = "7.x-2.x-dev"
+; Information added by Drupal.org packaging script on 2019-03-27
+version = "7.x-2.2"
 core = "7.x"
 core = "7.x"
 project = "module_filter"
 project = "module_filter"
-datestamp = "1357349173"
-
+datestamp = "1553698385"

+ 6 - 1
sites/all/modules/module_filter/module_filter.install

@@ -17,7 +17,10 @@ function module_filter_uninstall() {
   variable_del('module_filter_use_url_fragment');
   variable_del('module_filter_use_url_fragment');
   variable_del('module_filter_use_switch');
   variable_del('module_filter_use_switch');
   variable_del('module_filter_track_recent_modules');
   variable_del('module_filter_track_recent_modules');
+  variable_del('module_filter_remember_active_tab');
   variable_del('module_filter_remember_update_state');
   variable_del('module_filter_remember_update_state');
+  variable_del('module_filter_version_column');
+  variable_del('module_filter_expanded_description');
 }
 }
 
 
 /**
 /**
@@ -28,10 +31,12 @@ function module_filter_update_7100() {
 }
 }
 
 
 /**
 /**
- * Rebuild the menu.
+ * Rebuild the menu and theme registry.
  */
  */
 function module_filter_update_7200() {
 function module_filter_update_7200() {
   menu_rebuild();
   menu_rebuild();
+  system_rebuild_theme_data();
+  drupal_theme_rebuild();
 }
 }
 
 
 /**
 /**

+ 73 - 28
sites/all/modules/module_filter/module_filter.module

@@ -18,8 +18,8 @@ function module_filter_permission() {
   return array(
   return array(
     'administer module filter' => array(
     'administer module filter' => array(
       'title' => t('Administer Module Filter'),
       'title' => t('Administer Module Filter'),
-      'description' => t('Configure how Module Filter performs.')
-    )
+      'description' => t('Configure how Module Filter performs.'),
+    ),
   );
   );
 }
 }
 
 
@@ -33,7 +33,7 @@ function module_filter_menu() {
     'access arguments' => array('administer module filter'),
     'access arguments' => array('administer module filter'),
     'page callback' => 'drupal_get_form',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('module_filter_settings'),
     'page arguments' => array('module_filter_settings'),
-    'file' => 'module_filter.admin.inc'
+    'file' => 'module_filter.admin.inc',
   );
   );
   return $items;
   return $items;
 }
 }
@@ -63,25 +63,39 @@ function module_filter_form_system_modules_alter(&$form, &$form_state, $form_id)
     '#type' => 'module_filter',
     '#type' => 'module_filter',
     '#attached' => array(
     '#attached' => array(
       'js' => array(
       'js' => array(
-        drupal_get_path('module', 'module_filter') . '/js/modules.js'
-      )
-    )
+        drupal_get_path('module', 'module_filter') . '/js/modules.js' => array('weight' => 1),
+      ),
+    ),
   );
   );
   $checkbox_defaults = array(
   $checkbox_defaults = array(
     ((isset($_GET['enabled'])) ? $_GET['enabled'] : 1) ? 'enabled' : '',
     ((isset($_GET['enabled'])) ? $_GET['enabled'] : 1) ? 'enabled' : '',
     ((isset($_GET['disabled'])) ? $_GET['disabled'] : 1) ? 'disabled' : '',
     ((isset($_GET['disabled'])) ? $_GET['disabled'] : 1) ? 'disabled' : '',
     ((isset($_GET['required'])) ? $_GET['required'] : 1) ? 'required' : '',
     ((isset($_GET['required'])) ? $_GET['required'] : 1) ? 'required' : '',
-    ((isset($_GET['unavailable'])) ? $_GET['unavailable'] : 1) ? 'unavailable' : ''
+    ((isset($_GET['unavailable'])) ? $_GET['unavailable'] : 1) ? 'unavailable' : '',
   );
   );
   $form['module_filter']['show'] = array(
   $form['module_filter']['show'] = array(
     '#type' => 'checkboxes',
     '#type' => 'checkboxes',
     '#default_value' => array_filter($checkbox_defaults),
     '#default_value' => array_filter($checkbox_defaults),
     '#options' => array('enabled' => t('Enabled'), 'disabled' => t('Disabled'), 'required' => t('Required'), 'unavailable' => t('Unavailable')),
     '#options' => array('enabled' => t('Enabled'), 'disabled' => t('Disabled'), 'required' => t('Required'), 'unavailable' => t('Unavailable')),
     '#prefix' => '<div id="module-filter-show-wrapper">',
     '#prefix' => '<div id="module-filter-show-wrapper">',
-    '#suffix' => '</div>'
+    '#suffix' => '</div>',
   );
   );
 
 
-  $form['#theme'] = 'module_filter_system_modules';
+  if (variable_get('module_filter_tabs', 1)) {
+    $form['module_filter']['#attached']['css'][] = drupal_get_path('module', 'module_filter') . '/css/module_filter_tab.css';
+    $form['module_filter']['#attached']['library'][] = array('system', 'jquery.bbq');
+    $form['module_filter']['#attached']['js'][drupal_get_path('module', 'module_filter') . '/js/module_filter_tab.js'] = array('weight' => 2);
+
+    if (!module_exists('page_actions') && variable_get('module_filter_dynamic_save_position', 1)) {
+      $form['module_filter']['#attached']['css'][] = drupal_get_path('module', 'module_filter') . '/css/dynamic_position.css';
+      $form['module_filter']['#attached']['js'][drupal_get_path('module', 'module_filter') . '/js/dynamic_position.js'] = array('weight' => 3);
+    }
+
+    $form['#attached']['css'][] = drupal_get_path('module', 'module_filter') . '/css/modules.css';
+
+    $form['#theme'] = 'module_filter_system_modules_tabs';
+  }
+
   $form['#submit'][] = 'module_filter_system_modules_submit_redirect';
   $form['#submit'][] = 'module_filter_system_modules_submit_redirect';
 
 
   if (variable_get('module_filter_track_recent_modules', 1)) {
   if (variable_get('module_filter_track_recent_modules', 1)) {
@@ -114,7 +128,7 @@ function module_filter_element_info() {
     '#process' => array('form_process_module_filter', 'ajax_process_form'),
     '#process' => array('form_process_module_filter', 'ajax_process_form'),
     '#weight' => -1,
     '#weight' => -1,
     '#tree' => TRUE,
     '#tree' => TRUE,
-    '#theme' => 'module_filter'
+    '#theme' => 'module_filter',
   );
   );
   return $types;
   return $types;
 }
 }
@@ -128,10 +142,6 @@ function module_filter_theme() {
       'render element' => 'element',
       'render element' => 'element',
       'file' => 'module_filter.theme.inc',
       'file' => 'module_filter.theme.inc',
     ),
     ),
-    'module_filter_system_modules' => array(
-      'render element' => 'form',
-      'file' => 'module_filter.theme.inc',
-    ),
     'module_filter_system_modules_tabs' => array(
     'module_filter_system_modules_tabs' => array(
       'render element' => 'form',
       'render element' => 'form',
       'file' => 'module_filter.theme.inc',
       'file' => 'module_filter.theme.inc',
@@ -143,6 +153,18 @@ function module_filter_theme() {
   );
   );
 }
 }
 
 
+/**
+ * Create and add new textfield element.
+ *
+ * @param $element
+ *   An associative array containing the properties and children of the
+ *   form actions container.
+ * @param $form_state
+ *   The $form_state array for the form this element belongs to.
+ *
+ * @return
+ *   The processed element.
+ */
 function form_process_module_filter($element, &$form_state) {
 function form_process_module_filter($element, &$form_state) {
   $element['name'] = array(
   $element['name'] = array(
     '#type' => 'textfield',
     '#type' => 'textfield',
@@ -153,9 +175,10 @@ function form_process_module_filter($element, &$form_state) {
     '#attributes' => ((isset($element['#attributes'])) ? $element['#attributes'] : array()) + array('autocomplete' => 'off'),
     '#attributes' => ((isset($element['#attributes'])) ? $element['#attributes'] : array()) + array('autocomplete' => 'off'),
     '#attached' => array(
     '#attached' => array(
       'css' => array(
       'css' => array(
-        drupal_get_path('module', 'module_filter') . '/css/module_filter.css'
+        drupal_get_path('module', 'module_filter') . '/css/module_filter.css',
       ),
       ),
       'js' => array(
       'js' => array(
+        'misc/jquery.cookie.js',
         drupal_get_path('module', 'module_filter') . '/js/module_filter.js',
         drupal_get_path('module', 'module_filter') . '/js/module_filter.js',
         array(
         array(
           'data' => array(
           'data' => array(
@@ -169,32 +192,34 @@ function form_process_module_filter($element, &$form_state) {
               'useURLFragment' => variable_get('module_filter_use_url_fragment', 1),
               'useURLFragment' => variable_get('module_filter_use_url_fragment', 1),
               'useSwitch' => variable_get('module_filter_use_switch', 1),
               'useSwitch' => variable_get('module_filter_use_switch', 1),
               'trackRecent' => variable_get('module_filter_track_recent_modules', 1),
               'trackRecent' => variable_get('module_filter_track_recent_modules', 1),
+              'rememberActiveTab' => variable_get('module_filter_remember_active_tab', 1),
               'rememberUpdateState' => variable_get('module_filter_remember_update_state', 0),
               'rememberUpdateState' => variable_get('module_filter_remember_update_state', 0),
-            )
+              'expandedDescription' => variable_get('module_filter_expanded_description', 0),
+            ),
           ),
           ),
-          'type' => 'setting'
-        )
-      )
-    )
+          'type' => 'setting',
+        ),
+      ),
+    ),
   );
   );
   if (isset($element['#description'])) {
   if (isset($element['#description'])) {
     $element['name']['#description'] = $element['#description'];
     $element['name']['#description'] = $element['#description'];
   }
   }
-  if (variable_get('module_filter_remember_update_state', 0)) {
-    $element['name']['#attached']['js'][] = 'misc/jquery.cookie.js';
-  }
   return $element;
   return $element;
 }
 }
 
 
+/**
+ * Form submission handler to filters module list.
+ */
 function module_filter_system_modules_submit_redirect($form, &$form_state) {
 function module_filter_system_modules_submit_redirect($form, &$form_state) {
   $query = array();
   $query = array();
   if (!empty($form_state['values']['module_filter']['name'])) {
   if (!empty($form_state['values']['module_filter']['name'])) {
     $query['filter'] = $form_state['values']['module_filter']['name'];
     $query['filter'] = $form_state['values']['module_filter']['name'];
   }
   }
-  $query['enabled'] = (int)(!empty($form_state['values']['module_filter']['show']['enabled']));
-  $query['disabled'] = (int)(!empty($form_state['values']['module_filter']['show']['disabled']));
-  $query['required'] = (int)(!empty($form_state['values']['module_filter']['show']['required']));
-  $query['unavailable'] = (int)(!empty($form_state['values']['module_filter']['show']['unavailable']));
+  $query['enabled'] = (int) (!empty($form_state['values']['module_filter']['show']['enabled']));
+  $query['disabled'] = (int) (!empty($form_state['values']['module_filter']['show']['disabled']));
+  $query['required'] = (int) (!empty($form_state['values']['module_filter']['show']['required']));
+  $query['unavailable'] = (int) (!empty($form_state['values']['module_filter']['show']['unavailable']));
 
 
   $form_state['redirect'] = array(
   $form_state['redirect'] = array(
     'admin/modules',
     'admin/modules',
@@ -202,6 +227,9 @@ function module_filter_system_modules_submit_redirect($form, &$form_state) {
   );
   );
 }
 }
 
 
+/**
+ * Form submission handler to track recently enabled/disabled modules
+ */
 function module_filter_system_modules_submit_recent($form, &$form_state) {
 function module_filter_system_modules_submit_recent($form, &$form_state) {
   $recent_modules = variable_get('module_filter_recent_modules', array());
   $recent_modules = variable_get('module_filter_recent_modules', array());
 
 
@@ -216,6 +244,11 @@ function module_filter_system_modules_submit_recent($form, &$form_state) {
   variable_set('module_filter_recent_modules', $recent_modules);
   variable_set('module_filter_recent_modules', $recent_modules);
 }
 }
 
 
+/**
+ * Create list of newly added modules (within a week)
+ * @return
+ *   An array of newly added modules.
+ */
 function module_filter_new_modules() {
 function module_filter_new_modules() {
   // Get current list of modules.
   // Get current list of modules.
   $files = system_rebuild_module_data();
   $files = system_rebuild_module_data();
@@ -240,12 +273,24 @@ function module_filter_new_modules() {
   return $new_modules;
   return $new_modules;
 }
 }
 
 
+/**
+ * Function to replace special characters with hyphen.
+ * @param string $text
+ * @return
+ *   String
+ */
 function module_filter_get_id($text) {
 function module_filter_get_id($text) {
   $id = strtolower($text);
   $id = strtolower($text);
   $id = preg_replace('/([^a-z0-9]+)/', '-', $id);
   $id = preg_replace('/([^a-z0-9]+)/', '-', $id);
   return trim($id, '-');
   return trim($id, '-');
 }
 }
 
 
+/**
+ * Function to return true/false depending on module changed time and a week timestamp
+ * @param integer $var
+ * @return
+ *   Boolean indicating
+ */
 function module_filter_recent_filter($var) {
 function module_filter_recent_filter($var) {
-  return (!($var < REQUEST_TIME - 60*60*24*7));
+  return (!($var < REQUEST_TIME - 60 * 60 * 24 * 7));
 }
 }

+ 12 - 5
sites/all/modules/module_filter/module_filter.pages.inc

@@ -1,5 +1,9 @@
 <?php
 <?php
 
 
+/**
+ * @file
+ */
+
 /**
 /**
  * Wrapper function for update_status().
  * Wrapper function for update_status().
  *
  *
@@ -12,20 +16,23 @@ function module_filter_update_status() {
   return array(
   return array(
     'module_filter' => drupal_get_form('module_filter_update_status_form'),
     'module_filter' => drupal_get_form('module_filter_update_status_form'),
     'update_report' => array(
     'update_report' => array(
-      '#markup' => $update_report
-    )
+      '#markup' => $update_report,
+    ),
   );
   );
 }
 }
 
 
+/**
+ * Form builder for the module filter form.
+ */
 function module_filter_update_status_form($form, &$form_state) {
 function module_filter_update_status_form($form, &$form_state) {
   $form['module_filter'] = array(
   $form['module_filter'] = array(
     '#type' => 'module_filter',
     '#type' => 'module_filter',
     '#attached' => array(
     '#attached' => array(
       'css' => array(
       'css' => array(
-        drupal_get_path('module', 'module_filter') . '/css/update_status.css'
+        drupal_get_path('module', 'module_filter') . '/css/update_status.css',
       ),
       ),
       'js' => array(
       'js' => array(
-        drupal_get_path('module', 'module_filter') . '/js/update_status.js'
+        drupal_get_path('module', 'module_filter') . '/js/update_status.js',
       ),
       ),
     ),
     ),
   );
   );
@@ -34,7 +41,7 @@ function module_filter_update_status_form($form, &$form_state) {
     '#default_value' => (isset($_GET['show']) && in_array($_GET['show'], array('all', 'updates', 'security', 'unknown'))) ? $_GET['show'] : 'all',
     '#default_value' => (isset($_GET['show']) && in_array($_GET['show'], array('all', 'updates', 'security', 'unknown'))) ? $_GET['show'] : 'all',
     '#options' => array('all' => t('All'), 'updates' => t('Update available'), 'security' => t('Security update'), 'unknown' => t('Unknown')),
     '#options' => array('all' => t('All'), 'updates' => t('Update available'), 'security' => t('Security update'), 'unknown' => t('Unknown')),
     '#prefix' => '<div id="module-filter-show-wrapper">',
     '#prefix' => '<div id="module-filter-show-wrapper">',
-    '#suffix' => '</div>'
+    '#suffix' => '</div>',
   );
   );
   if (module_exists('update_advanced')) {
   if (module_exists('update_advanced')) {
     $options = $form['module_filter']['show']['#options'];
     $options = $form['module_filter']['show']['#options'];

+ 64 - 74
sites/all/modules/module_filter/module_filter.theme.inc

@@ -11,45 +11,6 @@ function theme_module_filter($variables) {
   return '<div class="module-filter-inputs-wrapper">' . drupal_render_children($element) . '</div>';
   return '<div class="module-filter-inputs-wrapper">' . drupal_render_children($element) . '</div>';
 }
 }
 
 
-/**
- * A router theme function.
- *
- * Appropriately themes the system modules page with alterations and based on
- * set variables
- *
- * @param $form
- *   An associative array containing the structure of the form.
- *
- * @return
- *   An output string.
- */
-function theme_module_filter_system_modules($variables) {
-  $form = $variables['form'];
-
-  $output = '';
-  if (variable_get('module_filter_tabs', 1)) {
-    $form['module_filter']['#attached']['css'][] = drupal_get_path('module', 'module_filter') .'/css/module_filter_tab.css';
-    $form['module_filter']['#attached']['js'][] = 'misc/jquery.ba-bbq.js';
-    $form['module_filter']['#attached']['js'][] = drupal_get_path('module', 'module_filter') .'/js/module_filter_tab.js';
-
-    if (!module_exists('page_actions') && variable_get('module_filter_dynamic_save_position', 1)) {
-      $form['module_filter']['#attached']['css'][] = drupal_get_path('module', 'module_filter') .'/css/dynamic_position.css';
-      $form['module_filter']['#attached']['js'][] = drupal_get_path('module', 'module_filter') .'/js/dynamic_position.js';
-    }
-
-    $output .= theme('module_filter_system_modules_tabs', $form);
-  }
-  else {
-    $form['#theme'] = 'system_modules';
-
-    $output .= drupal_render($form['module_filter']);
-    $output .= drupal_render($form['modules']);
-    $output .= drupal_render($form['actions']);
-  }
-
-  return $output;
-}
-
 /**
 /**
  * Theme callback for the modules tabbed form.
  * Theme callback for the modules tabbed form.
  */
  */
@@ -71,18 +32,21 @@ function theme_module_filter_system_modules_tabs($variables) {
   }
   }
 
 
   $header = array(
   $header = array(
-    t('Enabled'),
-    t('Name'),
-    t('Version'),
-    t('Description')
+    array('data' => '', 'class' => array('checkbox')),
+    array('data' => t('Name'), 'class' => array('name')),
+    array('data' => t('Description'), 'class' => array('description')),
+    array('data' => t('Links'), 'class' => array('links')),
   );
   );
+  if (variable_get('module_filter_version_column', 0)) {
+    array_splice($header, 2, 0, array(array('data' => t('Version'), 'class' => array('version'))));
+  }
   $package_ids = array('all');
   $package_ids = array('all');
   $enabled['all'] = array();
   $enabled['all'] = array();
 
 
   if (variable_get('module_filter_track_recent_modules', 1)) {
   if (variable_get('module_filter_track_recent_modules', 1)) {
     $recent_modules = array_filter(variable_get('module_filter_recent_modules', array()), 'module_filter_recent_filter');
     $recent_modules = array_filter(variable_get('module_filter_recent_modules', array()), 'module_filter_recent_filter');
     // Save the filtered results.
     // Save the filtered results.
-    variable_get('module_filter_recent_modules', $recent_modules);
+    variable_set('module_filter_recent_modules', $recent_modules);
 
 
     $package_ids[] = 'recent';
     $package_ids[] = 'recent';
     $enabled['recent'] = array();
     $enabled['recent'] = array();
@@ -118,6 +82,11 @@ function theme_module_filter_system_modules_tabs($variables) {
       }
       }
 
 
       $row = array();
       $row = array();
+
+      $version = !empty($module['version']['#markup']);
+      $requires = !empty($module['#requires']);
+      $required_by = !empty($module['#required_by']);
+
       $toggle_enable = '';
       $toggle_enable = '';
       if (isset($module['enable']['#type']) && $module['enable']['#type'] == 'checkbox') {
       if (isset($module['enable']['#type']) && $module['enable']['#type'] == 'checkbox') {
         unset($module['enable']['#title']);
         unset($module['enable']['#title']);
@@ -128,26 +97,39 @@ function theme_module_filter_system_modules_tabs($variables) {
         $toggle_enable = '<div class="js-hide toggle-enable ' . $class . '"><div>&nbsp;</div></div>';
         $toggle_enable = '<div class="js-hide toggle-enable ' . $class . '"><div>&nbsp;</div></div>';
       }
       }
       $row[] = array('class' => array('checkbox'), 'data' => $toggle_enable . drupal_render($module['enable']));
       $row[] = array('class' => array('checkbox'), 'data' => $toggle_enable . drupal_render($module['enable']));
+
       $label = '<label';
       $label = '<label';
       if (isset($module['enable']['#id'])) {
       if (isset($module['enable']['#id'])) {
         $label .= ' for="' . $module['enable']['#id'] . '"';
         $label .= ' for="' . $module['enable']['#id'] . '"';
       }
       }
-      $row[] = array('class' => array('name'), 'data' => $label . '><strong>' . drupal_render($module['name']) . '</strong><br><span class="module-machine-name">(' . $key . ')</span></label>');
-      $row[] = array('class' => array('version'), 'data' => drupal_render($module['version']));
-      // Add the description, along with any modules it requires and any
-      // operation links.
-      $description = drupal_render($module['description']);
-      if ($module['#requires']) {
-        $description .= '<div class="admin-requirements">' . t('Requires: !module-list', array('!module-list' => implode(', ', $module['#requires']))) . '</div>';
+      $row[] = array('class' => array('name'), 'data' => $label . '><strong>' . drupal_render($module['name']) . '</strong> <span class="module-machine-name">(' . $key . ')</span></label>');
+
+      if (variable_get('module_filter_version_column', 0) && $version) {
+        $row[] = array('class' => array('version'), 'data' => drupal_render($module['version']));
       }
       }
-      if ($module['#required_by']) {
-        $description .= '<div class="admin-requirements">' . t('Required by: !module-list', array('!module-list' => implode(', ', $module['#required_by']))) . '</div>';
+
+      // Add the description, along with any modules it requires.
+      if (empty($module['description']['#markup'])) {
+        $module['description']['#markup'] = '<em>' . t('No description available.') . '</em>';
       }
       }
-      $operations = (module_exists('ctools')) ? theme('module_filter_operations', array('links' => $module['links'], 'dropbutton' => TRUE)) : theme('module_filter_operations', array('links' => $module['links']));
-      if (!empty($operations)) {
-        $description .= $operations;
+      $description = '<span class="details"><span class="text">' . drupal_render($module['description']) . '</span></span>';
+      if ($requires || $required_by || (!variable_get('module_filter_version_column', 0) && $version)) {
+        $description .= '<div class="requirements">';
+        if (!variable_get('module_filter_version_column', 0) && $version) {
+          $description .= '<div class="admin-requirements">' . t('Version: !module-version', array('!module-version' => drupal_render($module['version']))) . '</div>';
+        }
+        if ($requires) {
+          $description .= '<div class="admin-requirements">' . t('Requires: !module-list', array('!module-list' => implode(', ', $module['#requires']))) . '</div>';
+        }
+        if ($required_by) {
+          $description .= '<div class="admin-requirements">' . t('Required by: !module-list', array('!module-list' => implode(', ', $module['#required_by']))) . '</div>';
+        }
+        $description .= '</div>';
       }
       }
-      $row[] = array('data' => $description, 'class' => array('description'));
+      $row[] = array('data' => '<div class="inner expand" role="button">' . $description . '</div>', 'class' => array('description'));
+
+      $operations = (module_exists('ctools')) ? theme('module_filter_operations', array('links' => $module['links'], 'dropbutton' => TRUE)) : theme('module_filter_operations', array('links' => $module['links']));
+      $row[] = array('data' => '<div class="links">' . $operations . '</div>', 'class' => array('links'));
 
 
       $class = array(module_filter_get_id($package) . '-tab', 'module', $stripe);
       $class = array(module_filter_get_id($package) . '-tab', 'module', $stripe);
       if (isset($recent_modules[$key])) {
       if (isset($recent_modules[$key])) {
@@ -164,21 +146,20 @@ function theme_module_filter_system_modules_tabs($variables) {
     $form['modules'][$package]['#printed'] = TRUE;
     $form['modules'][$package]['#printed'] = TRUE;
   }
   }
 
 
-  if (variable_get('module_filter_count_enabled', 1)) {
-    $enabled_counts = array();
-    foreach ($enabled as $package_id => $value) {
-      $enabled_counts[$package_id] = array(
-        'enabled' => count(array_filter($value)),
-        'total' => count($value),
-      );
-    }
-    drupal_add_js(array(
-      'moduleFilter' => array(
-        'packageIDs' => $package_ids,
-        'enabledCounts' => $enabled_counts,
-      )
-    ), 'setting');
+  //Get packages and count number of modules
+  $enabled_counts = array();
+  foreach ($enabled as $package_id => $value) {
+    $enabled_counts[$package_id] = array(
+      'enabled' => count(array_filter($value)),
+      'total' => count($value),
+    );
   }
   }
+  drupal_add_js(array(
+    'moduleFilter' => array(
+      'packageIDs' => $package_ids,
+      'enabledCounts' => $enabled_counts,
+    )
+  ), 'setting');
 
 
   // Add first and last class to rows.
   // Add first and last class to rows.
   $rows[0]['class'][] = 'first';
   $rows[0]['class'][] = 'first';
@@ -193,25 +174,34 @@ function theme_module_filter_system_modules_tabs($variables) {
   return $output;
   return $output;
 }
 }
 
 
+/**
+ * Theme function for module filter operations.
+ * @param $variables
+ * @return
+ *   HTML for admin status operations.
+ */
 function theme_module_filter_operations(&$vars) {
 function theme_module_filter_operations(&$vars) {
   $links = &$vars['links'];
   $links = &$vars['links'];
   $dropbutton = $vars['dropbutton'];
   $dropbutton = $vars['dropbutton'];
 
 
   $operations = array();
   $operations = array();
-  foreach (array('configure', 'permissions', 'help') as $key) {
+  foreach (element_children($links) as $key) {
     if ($dropbutton) {
     if ($dropbutton) {
       hide($links[$key]);
       hide($links[$key]);
       if (!empty($links[$key]['#href'])) {
       if (!empty($links[$key]['#href'])) {
-        $operations[] = array(
+        $operations[$key] = array(
           'title' => $links[$key]['#title'],
           'title' => $links[$key]['#title'],
           'href' => $links[$key]['#href'],
           'href' => $links[$key]['#href'],
         );
         );
+        if (isset($links[$key]['#options'])) {
+          $operations[$key] += $links[$key]['#options'];
+        }
       }
       }
     }
     }
     else {
     else {
       $data = drupal_render($links[$key]);
       $data = drupal_render($links[$key]);
       if (!empty($data)) {
       if (!empty($data)) {
-        $operations[] = array('data' => $data);
+        $operations[$key] = array('data' => $data);
       }
       }
     }
     }
   }
   }

+ 13 - 0
sites/all/modules/uuid/composer.json

@@ -0,0 +1,13 @@
+{
+  "name": "drupal/uuid",
+  "description": "Extends the entity functionality and adds support for universally unique identifiers.",
+  "type": "drupal-module",
+  "license": "GPL-2.0+",
+  "minimum-stability": "dev",
+  "require-dev": {
+    "drupal/ctools": "1.x-dev",
+    "drupal/rest_server": "~3.0",
+    "drupal/services": "~3.0",
+    "drupal/entity": "~1.0"
+  }
+}

+ 3 - 3
sites/all/modules/uuid/uuid.info

@@ -7,8 +7,8 @@ files[] = uuid.test
 dependencies[] = node
 dependencies[] = node
 dependencies[] = user
 dependencies[] = user
 
 
-; Information added by Drupal.org packaging script on 2018-07-19
-version = "7.x-1.2"
+; Information added by Drupal.org packaging script on 2019-05-29
+version = "7.x-1.3"
 core = "7.x"
 core = "7.x"
 project = "uuid"
 project = "uuid"
-datestamp = "1531990689"
+datestamp = "1559150887"

+ 16 - 17
sites/all/modules/uuid/uuid.test

@@ -6,11 +6,9 @@
  */
  */
 
 
 /**
 /**
- * UUID test helper trait.
- *
- * Contains methods that assist with running UUID tests.
+ * Base class with some helper methods.
  */
  */
-trait UUIDTestHelper {
+abstract class UUIDTestCase extends DrupalWebTestCase {
 
 
   /**
   /**
    * Helper function that asserts a UUID.
    * Helper function that asserts a UUID.
@@ -21,15 +19,6 @@ trait UUIDTestHelper {
 
 
 }
 }
 
 
-/**
- * Base class with some helper methods.
- */
-abstract class UUIDTestCase extends DrupalWebTestCase {
-
-  use UUIDTestHelper;
-
-}
-
 /**
 /**
  * Tests the UUID API functions.
  * Tests the UUID API functions.
  */
  */
@@ -488,8 +477,6 @@ class UUIDNodeTestCase extends UUIDTestCase {
  */
  */
 class UUIDCommentTestCase extends CommentHelperCase {
 class UUIDCommentTestCase extends CommentHelperCase {
 
 
-  use UUIDTestHelper;
-
   /**
   /**
    * {@inheritdoc}
    * {@inheritdoc}
    */
    */
@@ -501,6 +488,13 @@ class UUIDCommentTestCase extends CommentHelperCase {
     );
     );
   }
   }
 
 
+  /**
+   * Helper function that asserts a UUID.
+   */
+  protected function assertUuid($uuid, $message = NULL) {
+    $this->assertTrue(uuid_is_valid($uuid), $message);
+  }
+
   /**
   /**
    * Test CRUD on comments with UUID functions.
    * Test CRUD on comments with UUID functions.
    */
    */
@@ -559,8 +553,6 @@ class UUIDCommentTestCase extends CommentHelperCase {
  */
  */
 class UUIDTaxonomyTestCase extends TaxonomyWebTestCase {
 class UUIDTaxonomyTestCase extends TaxonomyWebTestCase {
 
 
-  use UUIDTestHelper;
-
   /**
   /**
    * {@inheritdoc}
    * {@inheritdoc}
    */
    */
@@ -588,6 +580,13 @@ class UUIDTaxonomyTestCase extends TaxonomyWebTestCase {
     parent::setUp($modules);
     parent::setUp($modules);
   }
   }
 
 
+  /**
+   * Helper function that asserts a UUID.
+   */
+  protected function assertUuid($uuid, $message = NULL) {
+    $this->assertTrue(uuid_is_valid($uuid), $message);
+  }
+
   /**
   /**
    * Test CRUD on comments with UUID functions.
    * Test CRUD on comments with UUID functions.
    */
    */

+ 3 - 3
sites/all/modules/uuid/uuid_path/uuid_path.info

@@ -5,8 +5,8 @@ package = UUID
 dependencies[] = uuid
 dependencies[] = uuid
 
 
 
 
-; Information added by Drupal.org packaging script on 2018-07-19
-version = "7.x-1.2"
+; Information added by Drupal.org packaging script on 2019-05-29
+version = "7.x-1.3"
 core = "7.x"
 core = "7.x"
 project = "uuid"
 project = "uuid"
-datestamp = "1531990689"
+datestamp = "1559150887"

+ 5 - 3
sites/all/modules/uuid/uuid_services/uuid_services.info

@@ -3,6 +3,8 @@ description = Provides integration with the Services module, like exposing a UUI
 core = 7.x
 core = 7.x
 package = Services - resources
 package = Services - resources
 
 
+files[] = uuid_services.user_services.test
+
 dependencies[] = services
 dependencies[] = services
 dependencies[] = uuid
 dependencies[] = uuid
 dependencies[] = entity
 dependencies[] = entity
@@ -13,8 +15,8 @@ test_dependencies[] = file
 test_dependencies[] = field
 test_dependencies[] = field
 test_dependencies[] = file_entity
 test_dependencies[] = file_entity
 
 
-; Information added by Drupal.org packaging script on 2018-07-19
-version = "7.x-1.2"
+; Information added by Drupal.org packaging script on 2019-05-29
+version = "7.x-1.3"
 core = "7.x"
 core = "7.x"
 project = "uuid"
 project = "uuid"
-datestamp = "1531990689"
+datestamp = "1559150887"

+ 8 - 1
sites/all/modules/uuid/uuid_services/uuid_services.module

@@ -170,6 +170,13 @@ function _uuid_services_entity_update($entity_type, $uuid, $entity) {
         }
         }
       }
       }
     }
     }
+
+    // Sanitize user roles if user is not allowed to modify them.
+    if ($entity_type == 'user' && !empty($entity->roles) && !user_access('administer permissions')) {
+      $original_user = user_load(entity_get_id_by_uuid('user', array($entity->uuid))[$entity->uuid]);
+      $entity->roles = $original_user->roles;
+    }
+
     entity_uuid_save($entity_type, $entity);
     entity_uuid_save($entity_type, $entity);
     return $entity;
     return $entity;
   }
   }
@@ -194,7 +201,7 @@ function _uuid_services_entity_delete($entity_type, $uuid) {
       return TRUE;
       return TRUE;
     }
     }
 
 
-    $return = entity_uuid_delete($entity_type, array($uuid)) !== FALSE;
+    $return = entity_uuid_delete($entity_type, $uuid) !== FALSE;
     return $return;
     return $return;
   }
   }
   catch (Exception $exception) {
   catch (Exception $exception) {

+ 231 - 0
sites/all/modules/uuid/uuid_services/uuid_services.user_services.test

@@ -0,0 +1,231 @@
+<?php
+
+/**
+ * @file
+ * Test the UUID User Services integration.
+ */
+
+ /**
+  * Test the UUID User Services integration.
+  */
+class UuidUserServicesTest extends ServicesWebTestCase {
+
+  /**
+   * The endpoint configuration.
+   *
+   * @var object
+   */
+  protected $endpoint = NULL;
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function getInfo() {
+    return array(
+      'name' => 'UUID User Services tests',
+      'description' => 'Test the user services resource UUID methods and actions.',
+      'group' => 'UUID',
+    );
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
+    parent::setUp(
+      'ctools',
+      'services',
+      'rest_server',
+      'uuid_services'
+    );
+    $this->endpoint = $this->saveNewEndpoint();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function saveNewEndpoint() {
+    $edit = $this->populateEndpointFAPI();
+    $endpoint = new stdClass();
+    $endpoint->disabled = FALSE;
+    $endpoint->api_version = 3;
+    $endpoint->name = $edit['name'];
+    $endpoint->server = $edit['server'];
+    $endpoint->path = $edit['path'];
+    $endpoint->authentication = array(
+      'services' => 'services',
+    );
+    $endpoint->server_settings = array(
+      'formatters' => array(
+        'json' => TRUE,
+        'bencode' => TRUE,
+        'rss' => TRUE,
+        'plist' => TRUE,
+        'xmlplist' => TRUE,
+        'php' => TRUE,
+        'yaml' => TRUE,
+        'jsonp' => FALSE,
+        'xml' => FALSE,
+      ),
+      'parsers' => array(
+        'application/x-yaml' => TRUE,
+        'application/json' => TRUE,
+        'application/vnd.php.serialized' => TRUE,
+        'application/plist' => TRUE,
+        'application/plist+xml' => TRUE,
+        'application/x-www-form-urlencoded' => TRUE,
+        'multipart/form-data' => TRUE,
+      ),
+    );
+    $endpoint->resources = array(
+      'user' => array(
+        'operations' => array(
+          'create' => array(
+            'enabled' => 1,
+          ),
+          'retrieve' => array(
+            'enabled' => 1,
+          ),
+          'update' => array(
+            'enabled' => 1,
+          ),
+          'delete' => array(
+            'enabled' => 1,
+          ),
+          'index' => array(
+            'enabled' => 1,
+          ),
+        ),
+      ),
+    );
+    $endpoint->debug = 1;
+    $endpoint->export_type = FALSE;
+    services_endpoint_save($endpoint);
+    $endpoint = services_endpoint_load($endpoint->name);
+    $this->assertTrue($endpoint->name == $edit['name'], 'Endpoint successfully created');
+    return $endpoint;
+  }
+
+  /**
+   * Tests user Retrieve.
+   */
+  public function testUserRetrieve() {
+    $admin_user = $this->drupalCreateUser(array(
+      'administer services',
+      'administer users',
+    ));
+    $this->drupalLogin($admin_user);
+    $other_user = $this->drupalCreateUser();
+
+    // Verify user is found.
+    $response = $this->servicesGet($this->endpoint->path . '/user/' . $other_user->uuid);
+    $this->assertTrue($other_user->uuid == $response['body']->uuid,
+      'Successfully received User info');
+  }
+
+  /**
+   * Tests user Update his own account.
+   */
+  public function testUserUpdate() {
+    $admin_user = $this->drupalCreateUser(array(
+      'administer services',
+      'administer users',
+      'administer permissions',
+    ));
+    $this->drupalLogin($admin_user);
+
+    $other_user = $this->drupalCreateUser();
+    $update = array(
+      'uuid' => $other_user->uuid,
+      'roles' => array(
+        '2' => 'authenticated user',
+        '3' => 'administrator',
+      ),
+    );
+    $this->servicesPut($this->endpoint->path . '/user/' . $other_user->uuid, $update);
+    $user_after_update = user_load($other_user->uid, TRUE);
+    $this->assertTrue(in_array('administrator', $user_after_update->roles), 'Administrator role successfully added');
+  }
+
+  /**
+   * Tests user Update another account fail with no permissions.
+   */
+  public function testUserUpdatePermFail() {
+    $user = $this->drupalCreateUser();
+    $this->drupalLogin($user);
+
+    $other_user = $this->drupalCreateUser();
+
+    $update = array(
+      'uuid' => $other_user->uuid,
+      'name' => 'test_edit',
+      'roles' => array(
+        '2' => 'authenticated user',
+        '3' => 'administrator',
+      ),
+    );
+    $response = $this->servicesPut($this->endpoint->path . '/user/' . $other_user->uuid, $update);
+    $user_after_update = user_load($other_user->uid, TRUE);
+    $this->assertNotEqual($update['name'], $user_after_update->name, 'User name was not updated without the needed permissions');
+    $this->assertFalse(in_array('administrator', $user_after_update->roles), 'Administrator role was not added without the needed permissions');
+    $this->assertTrue($response['code'] == 403,
+      'Updating the user failed without the needed permissions');
+  }
+
+  /**
+   * Tests user Update his own account fail with no permissions.
+   */
+  public function testUserOwnUpdatePermFail() {
+    $user = $this->drupalCreateUser([
+      'access user profiles',
+    ]);
+    $this->drupalLogin($user);
+    $user = user_load($user->uid, TRUE);
+
+    $update = array(
+      'uuid' => $user->uuid,
+      'roles' => array(
+        '2' => 'authenticated user',
+        '3' => 'administrator',
+      ),
+    );
+    $this->servicesPut($this->endpoint->path . '/user/' . $user->uuid, $update);
+    $user_after_update = user_load($user->uid, TRUE);
+    $this->assertFalse(in_array('administrator', $user_after_update->roles), 'Administrator role was not added without the needed permissions');
+    $this->assertEqual($user->roles, $user_after_update->roles, 'Existing roles persist after update.');
+  }
+
+  /**
+   * Tests user Delete.
+   */
+  public function testUserDelete() {
+    $admin_user = $this->drupalCreateUser(array(
+      'administer services',
+      'administer users',
+    ));
+    $this->drupalLogin($admin_user);
+
+    $other_user = $this->drupalCreateUser();
+
+    $this->servicesDelete($this->endpoint->path . '/user/' . $other_user->uuid);
+    $user_after_update = user_load($other_user->uid, TRUE);
+    $this->assertTrue(empty($user_after_update), 'User was deleted');
+  }
+
+  /**
+   * Tests user Delete fail with no permissions.
+   */
+  public function testUserDeletePermFail() {
+    $user = $this->drupalCreateUser();
+    $this->drupalLogin($user);
+
+    $other_user = $this->drupalCreateUser();
+
+    $response = $this->servicesDelete($this->endpoint->path . '/user/' . $other_user->uuid);
+    $user_after_update = user_load($other_user->uid, TRUE);
+    $this->assertTrue(!empty($user_after_update), 'User was not deleted without the needed permissions');
+    $this->assertTrue($response['code'] == 403,
+      'Deleting the user failed without the needed permissions');
+  }
+
+}

+ 3 - 3
sites/all/modules/uuid/uuid_services_example/uuid_services_example.info

@@ -11,8 +11,8 @@ features[ctools][] = services:services:3
 features[features_api][] = api:2
 features[features_api][] = api:2
 features[services_endpoint][] = uuid_services_example
 features[services_endpoint][] = uuid_services_example
 
 
-; Information added by Drupal.org packaging script on 2018-07-19
-version = "7.x-1.2"
+; Information added by Drupal.org packaging script on 2019-05-29
+version = "7.x-1.3"
 core = "7.x"
 core = "7.x"
 project = "uuid"
 project = "uuid"
-datestamp = "1531990689"
+datestamp = "1559150887"

+ 1 - 1
sites/all/modules/views/css/ie/views-admin.ie7.css

@@ -17,7 +17,7 @@
 
 
 /**
 /**
  * IE7 has no idea how large this container should be and it doesn't
  * IE7 has no idea how large this container should be and it doesn't
- * apply has-layout. Expand it's width to 100% and trigger has-layout.
+ * apply has-layout. Expand its width to 100% and trigger has-layout.
  */
  */
 .views-edit-view .views-displays {
 .views-edit-view .views-displays {
   height: 1%;
   height: 1%;

+ 1 - 1
sites/all/modules/views/css/views-admin.bartik-rtl.css

@@ -3,7 +3,7 @@
  * in the Bartik theme.
  * in the Bartik theme.
  */
  */
 
 
- /* @group Lists */
+/* @group Lists */
 
 
 .views-display-top .secondary .action-list {
 .views-display-top .secondary .action-list {
   padding-right: 0;
   padding-right: 0;

+ 70 - 73
sites/all/modules/views/css/views-admin.bartik.css

@@ -42,7 +42,7 @@
 }
 }
 
 
 .views-displays .secondary .open > a:hover {
 .views-displays .secondary .open > a:hover {
-  color: #0071B3;
+  color: #0071b3;
 }
 }
 
 
 .views-displays .secondary input.form-submit {
 .views-displays .secondary input.form-submit {
@@ -57,7 +57,7 @@
  */
  */
 
 
 .views-filterable-options .even .form-type-checkbox {
 .views-filterable-options .even .form-type-checkbox {
-  background-color: #F9F9F9;
+  background-color: #f9f9f9;
 }
 }
 
 
 .views-ui-dialog .ui-dialog-titlebar-close,
 .views-ui-dialog .ui-dialog-titlebar-close,
@@ -83,29 +83,28 @@
 /* @group Buttons */
 /* @group Buttons */
 
 
 .ctools-button-processed {
 .ctools-button-processed {
-  background-image:
-    -moz-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f9f9f9 100%);
-  background-image:
-    -webkit-gradient(
-      linear,
-      left top,
-      left bottom,
-      color-stop(0.0, rgba(255, 255, 255, 1.0)),
-      color-stop(1.0, rgba(249, 249, 249, 1.0))
-    );
-  background-image:
-    -webkit-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f9f9f9 100%);
-  background-image:
-    linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f9f9f9 100%);
+  background-image: -moz-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f9f9f9 100%
+  );
+  background-image: -webkit-gradient(
+  linear,
+  left top,
+  left bottom,
+  color-stop(0.0, rgba(255, 255, 255, 1.0)),
+  color-stop(1.0, rgba(249, 249, 249, 1.0))
+  );
+  background-image: -webkit-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f9f9f9 100%
+  );
+  background-image: linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f9f9f9 100%
+  );
   -moz-border-radius: 5px;
   -moz-border-radius: 5px;
   -webkit-border-radius: 5px;
   -webkit-border-radius: 5px;
   border-radius: 5px;
   border-radius: 5px;
@@ -114,29 +113,28 @@
 }
 }
 
 
 .ctools-button-processed:hover {
 .ctools-button-processed:hover {
-  background-image:
-    -moz-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f1f1f1 100%);
-  background-image:
-    -webkit-gradient(
-      linear,
-      left top,
-      left bottom,
-      color-stop(0.0, rgba(255, 255, 255, 1.0)),
-      color-stop(1.0, rgba(241, 241, 241, 1.0))
-    );
-  background-image:
-    -webkit-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f1f1f1 100%);
-  background-image:
-    linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f1f1f1 100%);
+  background-image: -moz-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f1f1f1 100%
+  );
+  background-image: -webkit-gradient(
+  linear,
+  left top,
+  left bottom,
+  color-stop(0.0, rgba(255, 255, 255, 1.0)),
+  color-stop(1.0, rgba(241, 241, 241, 1.0))
+  );
+  background-image: -webkit-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f1f1f1 100%
+  );
+  background-image: linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f1f1f1 100%
+  );
 }
 }
 
 
 .ctools-button-processed li a,
 .ctools-button-processed li a,
@@ -150,29 +148,28 @@
 }
 }
 
 
 .ctools-dropbutton-processed.open:hover {
 .ctools-dropbutton-processed.open:hover {
-  background-image:
-    -moz-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f9f9f9 100%);
-  background-image:
-    -webkit-gradient(
-      linear,
-      left top,
-      left bottom,
-      color-stop(0.0, rgba(255, 255, 255, 1.0)),
-      color-stop(1.0, rgba(249, 249, 249, 1.0))
-    );
-  background-image:
-    -webkit-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f9f9f9 100%);
-  background-image:
-    linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f9f9f9 100%);
+  background-image: -moz-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f9f9f9 100%
+  );
+  background-image: -webkit-gradient(
+  linear,
+  left top,
+  left bottom,
+  color-stop(0.0, rgba(255, 255, 255, 1.0)),
+  color-stop(1.0, rgba(249, 249, 249, 1.0))
+  );
+  background-image: -webkit-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f9f9f9 100%
+  );
+  background-image: linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f9f9f9 100%
+  );
 }
 }
 
 
 .ctools-dropbutton-processed.open {
 .ctools-dropbutton-processed.open {
@@ -220,12 +217,12 @@
 }
 }
 
 
 .views-ui-display-tab-actions .ctools-button input {
 .views-ui-display-tab-actions .ctools-button input {
-  color: #0071B3;
+  color: #0071b3;
 }
 }
 
 
 .views-ui-display-tab-actions .ctools-button input:hover,
 .views-ui-display-tab-actions .ctools-button input:hover,
 .views-ui-display-tab-actions .ctools-button input:focus {
 .views-ui-display-tab-actions .ctools-button input:focus {
-  color: #018FE2;
+  color: #018fe2;
 }
 }
 
 
 /* @end */
 /* @end */

+ 7 - 9
sites/all/modules/views/css/views-admin.css

@@ -117,12 +117,12 @@
  *
  *
  * The tabs that switch between sections
  * The tabs that switch between sections
  */
  */
- .views-displays .secondary {
-   border-bottom: 0 none;
-   margin: 0;
-   overflow: visible;
-   padding: 0;
- }
+.views-displays .secondary {
+  border-bottom: 0 none;
+  margin: 0;
+  overflow: visible;
+  padding: 0;
+}
 
 
 .views-displays .secondary > li {
 .views-displays .secondary > li {
   border-right: 0 none;
   border-right: 0 none;
@@ -312,9 +312,7 @@ div.form-item-options-value-all {
 
 
 /* @end */
 /* @end */
 
 
-
-
-/* @group Javascript dependent styling */
+/* @group JavaScript dependent styling */
 
 
 .js-only {
 .js-only {
   display: none;
   display: none;

+ 1 - 1
sites/all/modules/views/css/views-admin.ctools-rtl.css

@@ -10,7 +10,7 @@
 }
 }
 
 
 .ctools-dropbutton .ctools-link {
 .ctools-dropbutton .ctools-link {
-  border-right: 1px solid #ffffff;
+  border-right: 1px solid #fff;
 }
 }
 
 
 .ctools-dropbutton li {
 .ctools-dropbutton li {

+ 9 - 9
sites/all/modules/views/css/views-admin.ctools.css

@@ -1,8 +1,8 @@
 /* @group Buttons */
 /* @group Buttons */
 
 
 .ctools-button-processed {
 .ctools-button-processed {
-  background-color: #ffffff;
-  border-color: #cccccc;
+  background-color: #fff;
+  border-color: #ccc;
   font-size: 11px;
   font-size: 11px;
   padding-bottom: 2px;
   padding-bottom: 2px;
   padding-top: 2px;
   padding-top: 2px;
@@ -46,7 +46,7 @@
 }
 }
 
 
 .ctools-dropbutton-processed.open:hover {
 .ctools-dropbutton-processed.open:hover {
-  border-color: #D0D0D0;
+  border-color: #d0d0d0;
 }
 }
 
 
 .ctools-dropbutton-processed.open {
 .ctools-dropbutton-processed.open {
@@ -54,11 +54,11 @@
 }
 }
 
 
 .ctools-dropbutton-processed .ctools-link {
 .ctools-dropbutton-processed .ctools-link {
-  border-left: 1px solid #ffffff;
+  border-left: 1px solid #fff;
 }
 }
 
 
 .ctools-dropbutton-processed.open .ctools-content {
 .ctools-dropbutton-processed.open .ctools-content {
-    padding-bottom: 4px;
+  padding-bottom: 4px;
 }
 }
 
 
 .ctools-dropbutton-processed li a,
 .ctools-dropbutton-processed li a,
@@ -132,7 +132,7 @@
 
 
 .ctools-toggle.ctools-toggle-collapsed {
 .ctools-toggle.ctools-toggle-collapsed {
   border-bottom-color: transparent;
   border-bottom-color: transparent;
-  border-left:  4px solid;
+  border-left: 4px solid;
   border-right-color: transparent;
   border-right-color: transparent;
   border-top-color: transparent;
   border-top-color: transparent;
   border-width: 5px 0 5px 5px;
   border-width: 5px 0 5px 5px;
@@ -158,7 +158,7 @@
 }
 }
 
 
 .views-display-settings .ctools-toggle {
 .views-display-settings .ctools-toggle {
-  color: #000000;
+  color: #000;
 }
 }
 
 
 .views-display-column > .ctools-toggle {
 .views-display-column > .ctools-toggle {
@@ -173,7 +173,7 @@
 }
 }
 
 
 .views-display-column > .ctools-collapsible-handle {
 .views-display-column > .ctools-collapsible-handle {
-  border-color: #F3F3F3;
+  border-color: #f3f3f3;
   border-style: solid;
   border-style: solid;
   border-width: 1px 1px 0;
   border-width: 1px 1px 0;
   font-size: 13px;
   font-size: 13px;
@@ -225,7 +225,7 @@ h2.ctools-collapsible-handle {
 
 
 /* @group Jump list */
 /* @group Jump list */
 
 
-#views-live-preview .ctools-jump-menu-select{
+#views-live-preview .ctools-jump-menu-select {
   max-width: 450px;
   max-width: 450px;
 }
 }
 
 

+ 2 - 2
sites/all/modules/views/css/views-admin.garland-rtl.css

@@ -3,11 +3,11 @@
  * in the Garland theme.
  * in the Garland theme.
  */
  */
 
 
- /* @group Lists */
+/* @group Lists */
 
 
 .views-displays .secondary .action-list {
 .views-displays .secondary .action-list {
   left: auto;
   left: auto;
   right: 1px;
   right: 1px;
 }
 }
 
 
- /* @end */
+/* @end */

+ 70 - 73
sites/all/modules/views/css/views-admin.garland.css

@@ -54,7 +54,7 @@
 .views-displays .secondary .open > a:hover {
 .views-displays .secondary .open > a:hover {
   border-color: #e9e9e9 #e9e9e9 #f1f1f1 #e9e9e9;
   border-color: #e9e9e9 #e9e9e9 #f1f1f1 #e9e9e9;
   border-width: 1px 1px 1px 1px;
   border-width: 1px 1px 1px 1px;
-  color: #0071B3;
+  color: #0071b3;
 }
 }
 
 
 .views-displays .secondary input.form-submit {
 .views-displays .secondary input.form-submit {
@@ -84,7 +84,7 @@
 }
 }
 
 
 .views-filterable-options .even .form-type-checkbox {
 .views-filterable-options .even .form-type-checkbox {
-  background-color: #F9F9F9;
+  background-color: #f9f9f9;
 }
 }
 
 
 .views-ui-dialog .ui-dialog-titlebar-close,
 .views-ui-dialog .ui-dialog-titlebar-close,
@@ -101,29 +101,28 @@
 /* @group Buttons */
 /* @group Buttons */
 
 
 .ctools-button-processed {
 .ctools-button-processed {
-  background-image:
-    -moz-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f9f9f9 100%);
-  background-image:
-    -webkit-gradient(
-      linear,
-      left top,
-      left bottom,
-      color-stop(0.0, rgba(255, 255, 255, 1.0)),
-      color-stop(1.0, rgba(249, 249, 249, 1.0))
-    );
-  background-image:
-    -webkit-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f9f9f9 100%);
-  background-image:
-    linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f9f9f9 100%);
+  background-image: -moz-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f9f9f9 100%
+  );
+  background-image: -webkit-gradient(
+  linear,
+  left top,
+  left bottom,
+  color-stop(0.0, rgba(255, 255, 255, 1.0)),
+  color-stop(1.0, rgba(249, 249, 249, 1.0))
+  );
+  background-image: -webkit-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f9f9f9 100%
+  );
+  background-image: linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f9f9f9 100%
+  );
   -moz-border-radius: 5px;
   -moz-border-radius: 5px;
   -webkit-border-radius: 5px;
   -webkit-border-radius: 5px;
   border-radius: 5px;
   border-radius: 5px;
@@ -132,29 +131,28 @@
 }
 }
 
 
 .ctools-button-processed:hover {
 .ctools-button-processed:hover {
-  background-image:
-    -moz-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f1f1f1 100%);
-  background-image:
-    -webkit-gradient(
-      linear,
-      left top,
-      left bottom,
-      color-stop(0.0, rgba(255, 255, 255, 1.0)),
-      color-stop(1.0, rgba(241, 241, 241, 1.0))
-    );
-  background-image:
-    -webkit-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f1f1f1 100%);
-  background-image:
-    linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f1f1f1 100%);
+  background-image: -moz-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f1f1f1 100%
+  );
+  background-image: -webkit-gradient(
+  linear,
+  left top,
+  left bottom,
+  color-stop(0.0, rgba(255, 255, 255, 1.0)),
+  color-stop(1.0, rgba(241, 241, 241, 1.0))
+  );
+  background-image: -webkit-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f1f1f1 100%
+  );
+  background-image: linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f1f1f1 100%
+  );
 }
 }
 
 
 .ctools-button-processed ol li,
 .ctools-button-processed ol li,
@@ -172,29 +170,28 @@
 }
 }
 
 
 .ctools-dropbutton-processed.open:hover {
 .ctools-dropbutton-processed.open:hover {
-  background-image:
-    -moz-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f9f9f9 100%);
-  background-image:
-    -webkit-gradient(
-      linear,
-      left top,
-      left bottom,
-      color-stop(0.0, rgba(255, 255, 255, 1.0)),
-      color-stop(1.0, rgba(249, 249, 249, 1.0))
-    );
-  background-image:
-    -webkit-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f9f9f9 100%);
-  background-image:
-    linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f9f9f9 100%);
+  background-image: -moz-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f9f9f9 100%
+  );
+  background-image: -webkit-gradient(
+  linear,
+  left top,
+  left bottom,
+  color-stop(0.0, rgba(255, 255, 255, 1.0)),
+  color-stop(1.0, rgba(249, 249, 249, 1.0))
+  );
+  background-image: -webkit-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f9f9f9 100%
+  );
+  background-image: linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f9f9f9 100%
+  );
 }
 }
 
 
 .ctools-dropbutton-processed.open {
 .ctools-dropbutton-processed.open {
@@ -249,13 +246,13 @@
 }
 }
 
 
 .views-ui-display-tab-actions .ctools-button input {
 .views-ui-display-tab-actions .ctools-button input {
-  color: #027AC6;
+  color: #027ac6;
   font-size: 12px;
   font-size: 12px;
 }
 }
 
 
 .views-ui-display-tab-actions .ctools-button input:hover,
 .views-ui-display-tab-actions .ctools-button input:hover,
 .views-ui-display-tab-actions .ctools-button input:focus {
 .views-ui-display-tab-actions .ctools-button input:focus {
-  color: #0062A0;
+  color: #0062a0;
 }
 }
 
 
 /* @end */
 /* @end */

+ 80 - 83
sites/all/modules/views/css/views-admin.seven.css

@@ -213,14 +213,14 @@ fieldset.fieldset-no-legend {
 /* Override for input elements that are themed like ctools-buttons */
 /* Override for input elements that are themed like ctools-buttons */
 .ctools-button-processed input.form-submit:hover {
 .ctools-button-processed input.form-submit:hover {
   background-image: none;
   background-image: none;
-  color: #0074BD;
+  color: #0074bd;
   text-shadow: none;
   text-shadow: none;
 }
 }
 
 
 .ctools-button-processed input.form-submit:active {
 .ctools-button-processed input.form-submit:active {
   background: none;
   background: none;
   border: medium none;
   border: medium none;
-  color: #0074BD;
+  color: #0074bd;
   text-shadow: none;
   text-shadow: none;
 }
 }
 
 
@@ -238,7 +238,7 @@ table th {
 /* @group Attachment details */
 /* @group Attachment details */
 
 
 #edit-display-settings-title {
 #edit-display-settings-title {
-  color: #008BCB;
+  color: #008bcb;
 }
 }
 
 
 /* @end */
 /* @end */
@@ -249,11 +249,11 @@ table th {
  */
  */
 
 
 .views-displays .secondary {
 .views-displays .secondary {
- text-align: left; /* LTR */
+  text-align: left; /* LTR */
 }
 }
 
 
 .views-displays .secondary > li:first-child {
 .views-displays .secondary > li:first-child {
- padding-left: 0;
+  padding-left: 0;
 }
 }
 
 
 .views-admin .icon.add {
 .views-admin .icon.add {
@@ -265,7 +265,7 @@ table th {
   -moz-border-radius: 7px;
   -moz-border-radius: 7px;
   -webkit-border-radius: 7px;
   -webkit-border-radius: 7px;
   border-radius: 7px;
   border-radius: 7px;
-  color: #008BCB;
+  color: #008bcb;
 }
 }
 
 
 .views-displays .secondary a:hover > .icon.add {
 .views-displays .secondary a:hover > .icon.add {
@@ -280,7 +280,7 @@ table th {
 
 
 .views-displays .secondary .open > a:hover {
 .views-displays .secondary .open > a:hover {
   background-color: #f1f1f1;
   background-color: #f1f1f1;
-  color: #008BCB;
+  color: #008bcb;
 }
 }
 
 
 .views-displays .secondary .action-list  li:first-child {
 .views-displays .secondary .action-list  li:first-child {
@@ -299,7 +299,7 @@ table th {
   -moz-border-radius: 0;
   -moz-border-radius: 0;
   -webkit-border-radius: 0;
   -webkit-border-radius: 0;
   border-radius: 0;
   border-radius: 0;
-  color: #008BCB;
+  color: #008bcb;
 }
 }
 
 
 /* @end */
 /* @end */
@@ -349,11 +349,11 @@ table th {
 }
 }
 
 
 #views-ui-rearrange-filter-form tr.drag td {
 #views-ui-rearrange-filter-form tr.drag td {
-  background-color: #FFEE77 !important;
+  background-color: #ffee77 !important;
 }
 }
 
 
 #views-ui-rearrange-filter-form tr.drag-previous td {
 #views-ui-rearrange-filter-form tr.drag-previous td {
-  background-color: #FFFFBB !important;
+  background-color: #ffffbb !important;
 }
 }
 
 
 /* @end */
 /* @end */
@@ -402,7 +402,7 @@ table th {
   -moz-box-shadow: none;
   -moz-box-shadow: none;
   -webkit-box-shadow: none;
   -webkit-box-shadow: none;
   box-shadow: none;
   box-shadow: none;
-  border-color: #cccccc;
+  border-color: #ccc;
   right: -27px;
   right: -27px;
   top: -1px;
   top: -1px;
 }
 }
@@ -429,84 +429,81 @@ table th {
 /* @group Buttons */
 /* @group Buttons */
 
 
 .ctools-button-processed {
 .ctools-button-processed {
-  background-image:
-    -moz-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f9f9f9 100%);
-  background-image:
-    -webkit-gradient(
-      linear,
-      left top,
-      left bottom,
-      color-stop(0.0, rgba(255, 255, 255, 1.0)),
-      color-stop(1.0, rgba(249, 249, 249, 1.0))
-    );
-  background-image:
-    -webkit-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f9f9f9 100%);
-  background-image:
-    linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f9f9f9 100%);
+  background-image: -moz-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f9f9f9 100%
+  );
+  background-image: -webkit-gradient(
+  linear,
+  left top,
+  left bottom,
+  color-stop(0.0, rgba(255, 255, 255, 1.0)),
+  color-stop(1.0, rgba(249, 249, 249, 1.0))
+  );
+  background-image: -webkit-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f9f9f9 100%
+  );
+  background-image: linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f9f9f9 100%
+  );
   -moz-border-radius: 11px 11px 11px 11px;
   -moz-border-radius: 11px 11px 11px 11px;
   -webkit-border-radius: 11px 11px 11px 11px;
   -webkit-border-radius: 11px 11px 11px 11px;
   border-radius: 11px 11px 11px 11px;
   border-radius: 11px 11px 11px 11px;
 }
 }
 
 
 .ctools-button-processed:hover {
 .ctools-button-processed:hover {
-  background-image:
-    -moz-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f1f1f1 100%);
-  background-image:
-    -webkit-gradient(
-      linear,
-      left top,
-      left bottom,
-      color-stop(0.0, rgba(255, 255, 255, 1.0)),
-      color-stop(1.0, rgba(241, 241, 241, 1.0))
-    );
-  background-image:
-    -webkit-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f1f1f1 100%);
-  background-image:
-    linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f1f1f1 100%);
+  background-image: -moz-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f1f1f1 100%
+  );
+  background-image: -webkit-gradient(
+  linear,
+  left top,
+  left bottom,
+  color-stop(0.0, rgba(255, 255, 255, 1.0)),
+  color-stop(1.0, rgba(241, 241, 241, 1.0))
+  );
+  background-image: -webkit-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f1f1f1 100%
+  );
+  background-image: linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f1f1f1 100%
+  );
 }
 }
 
 
 .ctools-dropbutton-processed.open:hover {
 .ctools-dropbutton-processed.open:hover {
-  background-image:
-    -moz-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f9f9f9 100%);
-  background-image:
-    -webkit-gradient(
-      linear,
-      left top,
-      left bottom,
-      color-stop(0.0, rgba(255, 255, 255, 1.0)),
-      color-stop(1.0, rgba(249, 249, 249, 1.0))
-    );
-  background-image:
-    -webkit-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f9f9f9 100%);
-  background-image:
-    linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #f9f9f9 100%);
+  background-image: -moz-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f9f9f9 100%
+  );
+  background-image: -webkit-gradient(
+  linear,
+  left top,
+  left bottom,
+  color-stop(0.0, rgba(255, 255, 255, 1.0)),
+  color-stop(1.0, rgba(249, 249, 249, 1.0))
+  );
+  background-image: -webkit-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f9f9f9 100%
+  );
+  background-image: linear-gradient(
+  -90deg,
+  #fff 0px,
+  #f9f9f9 100%
+  );
 }
 }
 
 
 .ctools-dropbutton-processed.open {
 .ctools-dropbutton-processed.open {
@@ -528,7 +525,7 @@ table th {
 }
 }
 
 
 .views-display-settings .ctools-toggle {
 .views-display-settings .ctools-toggle {
-  color: #008BCB;
+  color: #008bcb;
 }
 }
 
 
 .views-display-column > .ctools-toggle {
 .views-display-column > .ctools-toggle {
@@ -540,11 +537,11 @@ table th {
 }
 }
 
 
 .views-display-column > .ctools-collapsible-handle {
 .views-display-column > .ctools-collapsible-handle {
-  color: #008BCB;
+  color: #008bcb;
 }
 }
 
 
 .views-ui-display-tab-actions .ctools-button-processed input {
 .views-ui-display-tab-actions .ctools-button-processed input {
-  color: #0074BD;
+  color: #0074bd;
 }
 }
 
 
 /* @end */
 /* @end */

+ 55 - 56
sites/all/modules/views/css/views-admin.theme.css

@@ -39,35 +39,34 @@
 .views-admin .icon,
 .views-admin .icon,
 .views-admin .icon-text {
 .views-admin .icon-text {
   background-attachment: scroll;
   background-attachment: scroll;
-  background-image: url("../images/sprites.png");
+  background-image: url('../images/sprites.png');
   background-position: left top; /* LTR */
   background-position: left top; /* LTR */
   background-repeat: no-repeat;
   background-repeat: no-repeat;
 }
 }
 
 
 .views-admin a.icon {
 .views-admin a.icon {
-  background-image:
-    url("../images/sprites.png"),
-    -moz-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #e8e8e8 100%);
-  background-image:
-    url("../images/sprites.png"),
-    -webkit-gradient(
-      linear,
-      left top,
-      left bottom,
-      color-stop(0.0, rgba(255, 255, 255, 1.0)),
-      color-stop(1.0, rgba(232, 232, 232, 1.0))
-    );
-  background-image:
-    url("../images/sprites.png"),
-    -webkit-linear-gradient(
-      -90deg,
-      #ffffff 0px,
-      #e8e8e8 100%);
+  background-image: url('../images/sprites.png'),
+  -moz-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #e8e8e8 100%
+  );
+  background-image: url('../images/sprites.png'),
+  -webkit-gradient(
+  linear,
+  left top,
+  left bottom,
+  color-stop(0.0, rgba(255, 255, 255, 1.0)),
+  color-stop(1.0, rgba(232, 232, 232, 1.0))
+  );
+  background-image: url('../images/sprites.png'),
+  -webkit-linear-gradient(
+  -90deg,
+  #fff 0px,
+  #e8e8e8 100%
+  );
   background-repeat: no-repeat, repeat-y;
   background-repeat: no-repeat, repeat-y;
-  border: 1px solid #dddddd;
+  border: 1px solid #ddd;
   -moz-border-radius: 4px;
   -moz-border-radius: 4px;
   -webkit-border-radius: 4px;
   -webkit-border-radius: 4px;
   border-radius: 4px;
   border-radius: 4px;
@@ -206,7 +205,7 @@ input.form-radio {
 
 
 /* Hide 'remove' checkboxes. */
 /* Hide 'remove' checkboxes. */
 .views-remove-checkbox {
 .views-remove-checkbox {
-    display: none;
+  display: none;
 }
 }
 
 
 /* sizes the labels of checkboxes and radio button to the height of the text */
 /* sizes the labels of checkboxes and radio button to the height of the text */
@@ -406,13 +405,13 @@ td.group-title {
 /* @group Attachments */
 /* @group Attachments */
 
 
 .views-displays {
 .views-displays {
-  border: 1px solid #CCC;
+  border: 1px solid #ccc;
   padding-bottom: 36px;
   padding-bottom: 36px;
 }
 }
 
 
 .views-display-top {
 .views-display-top {
-  background-color: #F9F9F9;
-  border-bottom: 1px solid #CCCCCC;
+  background-color: #f9f9f9;
+  border-bottom: 1px solid #ccc;
   padding: 8px 8px 8px; /* LTR */
   padding: 8px 8px 8px; /* LTR */
   position: relative;
   position: relative;
 }
 }
@@ -453,7 +452,7 @@ ul#views-display-menu-tabs li {
   margin-bottom: 5px;
   margin-bottom: 5px;
 }
 }
 
 
-ul#views-display-menu-tabs li.add ul.action-list li{
+ul#views-display-menu-tabs li.add ul.action-list li {
   margin: 0;
   margin: 0;
 }
 }
 
 
@@ -470,7 +469,7 @@ ul#views-display-menu-tabs li.add ul.action-list li{
  */
  */
 .views-displays ul.secondary li.active a.active.error,
 .views-displays ul.secondary li.active a.active.error,
 .views-displays .secondary a.error {
 .views-displays .secondary a.error {
-  border: 2px solid #ED541D;
+  border: 2px solid #ed541d;
   padding: 1px 6px;
   padding: 1px 6px;
 }
 }
 
 
@@ -480,8 +479,8 @@ ul#views-display-menu-tabs li.add ul.action-list li{
 
 
 .views-displays .secondary a:hover,
 .views-displays .secondary a:hover,
 .views-displays .secondary .active a {
 .views-displays .secondary .active a {
-  background-color: #666666;
-  color: #ffffff;
+  background-color: #666;
+  color: #fff;
   border-bottom-width: 1px;
   border-bottom-width: 1px;
 }
 }
 
 
@@ -523,7 +522,7 @@ ul#views-display-menu-tabs li.add ul.action-list li{
 }
 }
 
 
 .views-displays .secondary .action-list li:hover {
 .views-displays .secondary .action-list li:hover {
-  background-color: #dddddd;
+  background-color: #ddd;
 }
 }
 
 
 /* @end */
 /* @end */
@@ -556,10 +555,10 @@ ul#views-display-menu-tabs li.add ul.action-list li{
  */
  */
 
 
 .views-display-column + .views-display-column {
 .views-display-column + .views-display-column {
-   margin-top: 0;
- }
+  margin-top: 0;
+}
 
 
- /* @end */
+/* @end */
 
 
 /* @group Auto preview
 /* @group Auto preview
  *
  *
@@ -683,7 +682,7 @@ ul#views-display-menu-tabs li.add ul.action-list li{
  */
  */
 
 
 .views-ui-display-tab-bucket .views-display-setting {
 .views-ui-display-tab-bucket .views-display-setting {
-  color: #666666;
+  color: #666;
   font-size: 12px;
   font-size: 12px;
   padding-bottom: 2px;
   padding-bottom: 2px;
 }
 }
@@ -753,8 +752,8 @@ ul#views-display-menu-tabs li.add ul.action-list li{
 }
 }
 
 
 .views-ui-dialog .ui-dialog-titlebar-close {
 .views-ui-dialog .ui-dialog-titlebar-close {
-  background: url("../images/close.png") no-repeat scroll 6px 3px #F3F4EE;
-  border-color: #aaaaaa;
+  background: url('../images/close.png') no-repeat scroll 6px 3px #f3f4ee;
+  border-color: #aaa;
   -moz-border-radius: 0 10px 12px 0;
   -moz-border-radius: 0 10px 12px 0;
   -webkit-border-radius: 0 10px 12px 0;
   -webkit-border-radius: 0 10px 12px 0;
   border-radius: 0 10px 12px 0;
   border-radius: 0 10px 12px 0;
@@ -774,17 +773,17 @@ ul#views-display-menu-tabs li.add ul.action-list li{
 }
 }
 
 
 .views-filterable-options .form-type-checkbox {
 .views-filterable-options .form-type-checkbox {
-  border: 1px solid #CCC;
+  border: 1px solid #ccc;
   padding: 5px 8px;
   padding: 5px 8px;
   border-top: none;
   border-top: none;
 }
 }
 
 
 .views-filterable-options {
 .views-filterable-options {
-  border-top:  1px solid #CCC;
+  border-top: 1px solid #ccc;
 }
 }
 
 
 .views-filterable-options .even .form-type-checkbox {
 .views-filterable-options .even .form-type-checkbox {
-  background-color: #F3F4EE;
+  background-color: #f3f4ee;
 }
 }
 
 
 .filterable-option .form-item {
 .filterable-option .form-item {
@@ -830,7 +829,7 @@ ul#views-display-menu-tabs li.add ul.action-list li{
 
 
 .views-ui-dialog #views-ajax-title,
 .views-ui-dialog #views-ajax-title,
 .views-ui-dialog .views-override {
 .views-ui-dialog .views-override {
-  background-color: #F3F4EE;
+  background-color: #f3f4ee;
 }
 }
 
 
 .views-ui-dialog .views-override {
 .views-ui-dialog .views-override {
@@ -862,7 +861,7 @@ ul#views-display-menu-tabs li.add ul.action-list li{
 }
 }
 
 
 .views-ui-dialog .scroll {
 .views-ui-dialog .scroll {
-  border: 1px solid #CCC;
+  border: 1px solid #ccc;
   border-width: 1px 0;
   border-width: 1px 0;
   padding: 8px 13px;
   padding: 8px 13px;
 }
 }
@@ -872,7 +871,7 @@ ul#views-display-menu-tabs li.add ul.action-list li{
 }
 }
 
 
 .views-ui-dialog .form-buttons {
 .views-ui-dialog .form-buttons {
-  background-color: #F3F4EE;
+  background-color: #f3f4ee;
   padding: 8px 13px;
   padding: 8px 13px;
 }
 }
 .views-ui-dialog .form-buttons input {
 .views-ui-dialog .form-buttons input {
@@ -888,7 +887,7 @@ ul#views-display-menu-tabs li.add ul.action-list li{
 /* @todo Make this a class to be used anywhere there's node types? */
 /* @todo Make this a class to be used anywhere there's node types? */
 .form-type-checkboxes #edit-options-value,
 .form-type-checkboxes #edit-options-value,
 .form-type-checkboxes #edit-options-validate-options-node-types {
 .form-type-checkboxes #edit-options-validate-options-node-types {
-  border-color: #CCCCCC;
+  border-color: #ccc;
   border-style: solid;
   border-style: solid;
   border-width: 1px;
   border-width: 1px;
   max-height: 210px;
   max-height: 210px;
@@ -907,25 +906,25 @@ ul#views-display-menu-tabs li.add ul.action-list li{
 }
 }
 
 
 #views-ui-rearrange-filter-form tr td[rowspan] {
 #views-ui-rearrange-filter-form tr td[rowspan] {
-  border-color: #CDCDCD;
+  border-color: #cdcdcd;
   border-style: solid;
   border-style: solid;
   border-width: 0 1px 1px 1px;
   border-width: 0 1px 1px 1px;
 }
 }
 
 
 #views-ui-rearrange-filter-form tr[id^="views-row"] {
 #views-ui-rearrange-filter-form tr[id^="views-row"] {
-  border-right: 1px solid #CDCDCD;
+  border-right: 1px solid #cdcdcd;
 }
 }
 
 
 #views-ui-rearrange-filter-form tr[id^="views-row"].even td {
 #views-ui-rearrange-filter-form tr[id^="views-row"].even td {
-  background-color: #F3F4ED;
+  background-color: #f3f4ed;
 }
 }
 
 
 #views-ui-rearrange-filter-form .views-group-title {
 #views-ui-rearrange-filter-form .views-group-title {
-  border-top: 1px solid #CDCDCD;
+  border-top: 1px solid #cdcdcd;
 }
 }
 
 
 #views-ui-rearrange-filter-form .group-empty {
 #views-ui-rearrange-filter-form .group-empty {
-  border-bottom: 1px solid #CDCDCD;
+  border-bottom: 1px solid #cdcdcd;
 }
 }
 
 
 /* @end */
 /* @end */
@@ -945,8 +944,8 @@ ul#views-display-menu-tabs li.add ul.action-list li{
 /* @group Live preview elements */
 /* @group Live preview elements */
 
 
 #views-preview-wrapper {
 #views-preview-wrapper {
-  border: 1px solid #CCC;
-  border-top: 2px solid #CCC;
+  border: 1px solid #ccc;
+  border-top: 2px solid #ccc;
   padding-bottom: 12px;
   padding-bottom: 12px;
   padding-top: 12px;
   padding-top: 12px;
 }
 }
@@ -979,7 +978,7 @@ ul#views-display-menu-tabs li.add ul.action-list li{
 }
 }
 
 
 #views-live-preview .preview-section {
 #views-live-preview .preview-section {
-  border: 1px dashed #DEDEDE;
+  border: 1px dashed #dedede;
   margin: 0 -5px;
   margin: 0 -5px;
   padding: 3px 5px;
   padding: 3px 5px;
 }
 }
@@ -997,7 +996,7 @@ ul#views-display-menu-tabs li.add ul.action-list li{
 
 
 .views-query-info table {
 .views-query-info table {
   border-collapse: separate;
   border-collapse: separate;
-  border-color: #dddddd;
+  border-color: #ddd;
   border-spacing: 0;
   border-spacing: 0;
   margin: 10px 0;
   margin: 10px 0;
 }
 }
@@ -1008,7 +1007,7 @@ ul#views-display-menu-tabs li.add ul.action-list li{
 
 
 .views-query-info table th,
 .views-query-info table th,
 .views-query-info table td {
 .views-query-info table td {
-  color: #666666;
+  color: #666;
   padding: 4px 10px;
   padding: 4px 10px;
 }
 }
 
 
@@ -1058,7 +1057,7 @@ ul#views-display-menu-tabs li.add ul.action-list li{
 
 
 .ajax-progress-throbber {
 .ajax-progress-throbber {
   background-color: #232323;
   background-color: #232323;
-  background-image: url("../images/loading-small.gif");
+  background-image: url('../images/loading-small.gif');
   background-position: center center;
   background-position: center center;
   background-repeat: no-repeat;
   background-repeat: no-repeat;
   -moz-border-radius: 7px;
   -moz-border-radius: 7px;

+ 0 - 1
sites/all/modules/views/css/views-rtl.css

@@ -1,4 +1,3 @@
-
 .views-exposed-form .views-exposed-widget {
 .views-exposed-form .views-exposed-widget {
   float: right; /* RTL */
   float: right; /* RTL */
   padding: .5em 1em 0 0; /* RTL */
   padding: .5em 1em 0 0; /* RTL */

+ 83 - 66
sites/all/modules/views/drush/views.drush.inc

@@ -2,14 +2,15 @@
 
 
 /**
 /**
  * @file
  * @file
- * Drush integration of views.
+ * Drush integration for Views.
  *
  *
- * drush cache-clear views - Clears the views specific caches.
- * views-revert - Drush command to revert views overridden in the system.
+ * Useful commands:
+ * - drush cache-clear views - Clears the views specific caches.
+ * - views-revert - Drush command to revert views overridden in the system.
  */
  */
 
 
 /**
 /**
- * Implement hook_drush_help().
+ * Implements hook_drush_help().
  */
  */
 function views_drush_help($section) {
 function views_drush_help($section) {
   switch ($section) {
   switch ($section) {
@@ -18,17 +19,20 @@ function views_drush_help($section) {
       $help .= dt('If no view names are specified, you will be presented with a list of overridden views to choose from. ');
       $help .= dt('If no view names are specified, you will be presented with a list of overridden views to choose from. ');
       $help .= dt('To revert all views, do not specify any view names, and choose the option "All" from the options presented.');
       $help .= dt('To revert all views, do not specify any view names, and choose the option "All" from the options presented.');
       return $help;
       return $help;
+
     case 'drush:views-list':
     case 'drush:views-list':
       return dt('Show a list of available views with information about them.');
       return dt('Show a list of available views with information about them.');
+
     case 'drush:views-enable':
     case 'drush:views-enable':
       return dt('Enable the specified views. Follow the command with a space delimited list of view names');
       return dt('Enable the specified views. Follow the command with a space delimited list of view names');
+
     case 'drush:views-disable':
     case 'drush:views-disable':
       return dt('Disable the specified views. Follow the command with a space delimited list of view names');
       return dt('Disable the specified views. Follow the command with a space delimited list of view names');
   }
   }
 }
 }
 
 
 /**
 /**
- * Implement hook_drush_command().
+ * Implements hook_drush_command().
  */
  */
 function views_drush_command() {
 function views_drush_command() {
   $items = array();
   $items = array();
@@ -70,7 +74,7 @@ function views_drush_command() {
       'tags' => 'A comma-separated list of views tags by which to filter the results.',
       'tags' => 'A comma-separated list of views tags by which to filter the results.',
       'status' => 'Status of the views by which to filter the results. Choices: enabled, disabled.',
       'status' => 'Status of the views by which to filter the results. Choices: enabled, disabled.',
       'type' => 'Type of the views by which to filter the results. Choices: normal, default or overridden.',
       'type' => 'Type of the views by which to filter the results. Choices: normal, default or overridden.',
-      ),
+    ),
     'examples' => array(
     'examples' => array(
       'drush vl' => 'Show a list of all available views.',
       'drush vl' => 'Show a list of all available views.',
       'drush vl --name=blog' => 'Show a list of views which names contain "blog".',
       'drush vl --name=blog' => 'Show a list of views which names contain "blog".',
@@ -115,10 +119,11 @@ function views_drush_command() {
  * Callback function for views-revert command.
  * Callback function for views-revert command.
  */
  */
 function views_revert_views() {
 function views_revert_views() {
+  $args = func_get_args();
+  // The provided views names specified in the command.
+  $viewnames = _convert_csv_to_array($args);
   $views = views_get_all_views();
   $views = views_get_all_views();
   $i = 0;
   $i = 0;
-  // The provided views names specified in the command.
-  $viewnames = _convert_csv_to_array(func_get_args());
 
 
   // Find all overridden views.
   // Find all overridden views.
   foreach ($views as $view) {
   foreach ($views as $view) {
@@ -143,10 +148,10 @@ function views_revert_views() {
   // If the user specified a list of views on the CLI, revert those.
   // If the user specified a list of views on the CLI, revert those.
   elseif (!empty($viewnames)) {
   elseif (!empty($viewnames)) {
     foreach ($viewnames as $key => $viewname) {
     foreach ($viewnames as $key => $viewname) {
-      $is_overridden = key_exists($viewname, $overridden);
+      $is_overridden = array_key_exists($viewname, $overridden);
 
 
-      // Check if the provided view name is in the system
-      if ($viewname && !key_exists($viewname, $views)) {
+      // Check if the provided view name is in the system.
+      if ($viewname && !array_key_exists($viewname, $views)) {
         drush_set_error(dt("'@viewname' view is not present in the system.", array('@viewname' => $viewname)));
         drush_set_error(dt("'@viewname' view is not present in the system.", array('@viewname' => $viewname)));
       }
       }
       // Check if the provided view is overridden.
       // Check if the provided view is overridden.
@@ -158,7 +163,7 @@ function views_revert_views() {
         views_revert_view($views[$viewname]);
         views_revert_view($views[$viewname]);
         $i++;
         $i++;
       }
       }
-      // We should never get here but well...
+      // We should never get here but well.
       else {
       else {
         drush_set_error(dt(
         drush_set_error(dt(
           "The view specified '@viewname' is not provided in code, and thus cannot be reverted.",
           "The view specified '@viewname' is not provided in code, and thus cannot be reverted.",
@@ -168,19 +173,20 @@ function views_revert_views() {
     }
     }
   }
   }
 
 
-  // The user neither selected the "--all" option, nor provided a list of views to revert.
-  // Prompt the user.
+  // The user neither selected the "--all" option, nor provided a list of views
+  // to revert. Prompt the user.
   else {
   else {
-    // list of choices for the user
-    $overridden['all'] = dt('Revert all overridden views'); // add a choice at the end
-    $choice = drush_choice($overridden, 'Enter a number to choose which view to revert.', '!key'); // prompt the user
-
+    // List of choices for the user.
+    $overridden['all'] = dt('Revert all overridden views');
+    // Add a choice at the end.
+    $choice = drush_choice($overridden, 'Enter a number to choose which view to revert.', '!key');
+    // Prompt the user.
     if ($choice !== FALSE) {
     if ($choice !== FALSE) {
-      // revert all views option
+      // Revert all views option.
       if ($choice == 'all') {
       if ($choice == 'all') {
         $i = views_revert_allviews($views);
         $i = views_revert_allviews($views);
       }
       }
-      // else the user specified a single view
+      // Else the user specified a single view.
       else {
       else {
         views_revert_view($views[$choice]);
         views_revert_view($views[$choice]);
         $i++;
         $i++;
@@ -189,7 +195,7 @@ function views_revert_views() {
 
 
   }
   }
 
 
-  // final results output
+  // Final results output.
   if ($i == 0) {
   if ($i == 0) {
     drush_log(dt('No views were reverted.'), 'ok');
     drush_log(dt('No views were reverted.'), 'ok');
   }
   }
@@ -199,9 +205,10 @@ function views_revert_views() {
 }
 }
 
 
 /**
 /**
- * Reverts all views
- * @param $views
- * All views in the system as provided by views_get_all_views().
+ * Reverts all views.
+ *
+ * @param array $views
+ *   All views in the system as provided by views_get_all_views().
  */
  */
 function views_revert_allviews($views) {
 function views_revert_allviews($views) {
   $i = 0;
   $i = 0;
@@ -219,15 +226,17 @@ function views_revert_allviews($views) {
 }
 }
 
 
 /**
 /**
- * Revert a specified view
- * @param $view
- * The view object to be reverted
+ * Revert a specified view.
  *
  *
- * Checks on wether or not the view is overridden is handled in views_revert_views_revert()
- * We perform a check here anyway in case someone somehow calls this function on their own...
+ * Checks on wether or not the view is overridden is handled in
+ * views_revert_views_revert(). We perform a check here anyway in case someone
+ * somehow calls this function on their own...
+ *
+ * @param object $view
+ *   The view object to be reverted.
  */
  */
 function views_revert_view($view) {
 function views_revert_view($view) {
-  // check anyway just in case
+  // Check anyway just in case.
   if ($view->type == t('Overridden')) {
   if ($view->type == t('Overridden')) {
     // Revert the view.
     // Revert the view.
     $view->delete();
     $view->delete();
@@ -269,7 +278,7 @@ function views_development_settings() {
  * Callback function for views-list command.
  * Callback function for views-list command.
  */
  */
 function drush_views_list() {
 function drush_views_list() {
-  // Initialize stuf
+  // Initialize stuff.
   $rows = array();
   $rows = array();
   $disabled_views = array();
   $disabled_views = array();
   $enabled_views = array();
   $enabled_views = array();
@@ -281,19 +290,18 @@ function drush_views_list() {
 
 
   $views = views_get_all_views();
   $views = views_get_all_views();
 
 
-  // get the --name option
-  // TODO : take into account the case off a comma-separated list of names
+  // Get the --name option.
+  // @todo Take into account the case off a comma-separated list of names.
   $name = drush_get_option_list('name');
   $name = drush_get_option_list('name');
   $with_name = !empty($name) ? TRUE : FALSE;
   $with_name = !empty($name) ? TRUE : FALSE;
 
 
-  // get the --tags option
+  // Get the --tags option.
   $tags = drush_get_option_list('tags');
   $tags = drush_get_option_list('tags');
   $with_tags = !empty($tags) ? TRUE : FALSE;
   $with_tags = !empty($tags) ? TRUE : FALSE;
 
 
-  // get the --status option
-  // store user input appart to reuse it after
+  // Get the --status option. Store user input appart to reuse it after.
   $status_opt = drush_get_option_list('status');
   $status_opt = drush_get_option_list('status');
-  // use the same logic than $view->disabled
+  // Use the same logic than $view->disabled.
   if (in_array('disabled', $status_opt)) {
   if (in_array('disabled', $status_opt)) {
     $status = TRUE;
     $status = TRUE;
     $with_status = TRUE;
     $with_status = TRUE;
@@ -304,19 +312,19 @@ function drush_views_list() {
   }
   }
   else {
   else {
     $status = NULL;
     $status = NULL;
-    // wrong or empty --status option
+    // Wrong or empty --status option.
     $with_status = FALSE;
     $with_status = FALSE;
   }
   }
 
 
-  // get the --type option
+  // Get the --type option.
   $type = drush_get_option_list('type');
   $type = drush_get_option_list('type');
-  // use the same logic than $view->type
+  // Use the same logic than $view->type.
   $with_type = FALSE;
   $with_type = FALSE;
   if (in_array('normal', $type) || in_array('default', $type)|| in_array('overridden', $type)) {
   if (in_array('normal', $type) || in_array('default', $type)|| in_array('overridden', $type)) {
     $with_type = TRUE;
     $with_type = TRUE;
   }
   }
 
 
-  // set the table headers
+  // Set the table headers.
   $header = array(
   $header = array(
     dt('Machine name'),
     dt('Machine name'),
     dt('Description'),
     dt('Description'),
@@ -325,10 +333,10 @@ function drush_views_list() {
     dt('Tag'),
     dt('Tag'),
   );
   );
 
 
-  // setup a row for each view
-  foreach($views as $id => $view){
-    // if options were specified, check that first
-    // mismatch push the loop to the next view
+  // Setup a row for each view.
+  foreach ($views as $id => $view) {
+    // If options were specified, check that first mismatch push the loop to
+    // the next view.
     if ($with_tags && !in_array($view->tag, $tags)) {
     if ($with_tags && !in_array($view->tag, $tags)) {
       continue;
       continue;
     }
     }
@@ -343,25 +351,25 @@ function drush_views_list() {
     }
     }
 
 
     $row = array();
     $row = array();
-    // each row entry should be in the same order as the header
+    // Each row entry should be in the same order as the header.
     $row[] = $view->name;
     $row[] = $view->name;
     $row[] = $view->description;
     $row[] = $view->description;
     $row[] = $view->type;
     $row[] = $view->type;
     $row[] = $view->disabled ? dt('Disabled') : dt('Enabled');
     $row[] = $view->disabled ? dt('Disabled') : dt('Enabled');
     $row[] = $view->tag;
     $row[] = $view->tag;
 
 
-    // place the row in the appropiate array,
-    // so we can have disabled views at the bottom
-    if($view->disabled) {
+    // Place the row in the appropiate array so we can have disabled views at
+    // the bottom.
+    if ($view->disabled) {
       $disabled_views[] = $row;
       $disabled_views[] = $row;
-      }
-    else{
+    }
+    else {
       $enabled_views[] = $row;
       $enabled_views[] = $row;
     }
     }
     unset($row);
     unset($row);
 
 
-    // gather some statistics
-    switch($view->type) {
+    // Gather some statistics.
+    switch ($view->type) {
       case dt('Normal'):
       case dt('Normal'):
         $indb++;
         $indb++;
         break;
         break;
@@ -379,11 +387,11 @@ function drush_views_list() {
 
 
   $disabled = count($disabled_views);
   $disabled = count($disabled_views);
 
 
-  // sort alphabeticaly
+  // Sort alphabeticaly.
   asort($disabled_views);
   asort($disabled_views);
   asort($enabled_views);
   asort($enabled_views);
 
 
-  // if options were used
+  // If options were used.
   $summary = "";
   $summary = "";
   if ($with_name || $with_tags || $with_status || $with_type) {
   if ($with_name || $with_tags || $with_status || $with_type) {
     $summary = "Views";
     $summary = "Views";
@@ -412,23 +420,26 @@ function drush_views_list() {
     drush_print($summary . "\n");
     drush_print($summary . "\n");
   }
   }
 
 
-  // print all rows as a table
+  // Print all rows as a table.
   if ($total > 0) {
   if ($total > 0) {
     $rows = array_merge($enabled_views, $disabled_views);
     $rows = array_merge($enabled_views, $disabled_views);
-    // put the headers as first row
+    // Put the headers as first row.
     array_unshift($rows, $header);
     array_unshift($rows, $header);
 
 
     drush_print_table($rows, TRUE);
     drush_print_table($rows, TRUE);
   }
   }
 
 
-  // print the statistics messages
+  // Print the statistics messages.
   drush_print(dt("A total of @total views were found in this Drupal installation:", array('@total' => $total)));
   drush_print(dt("A total of @total views were found in this Drupal installation:", array('@total' => $total)));
-  drush_print(dt("  @indb views reside only in the database", array('@indb' => $indb )));
+  drush_print(dt("  @indb views reside only in the database", array('@indb' => $indb)));
   drush_print(dt("  @over views are overridden", array('@over' => $overridden)));
   drush_print(dt("  @over views are overridden", array('@over' => $overridden)));
   drush_print(dt("  @incode views are in their default state", array('@incode' => $incode)));
   drush_print(dt("  @incode views are in their default state", array('@incode' => $incode)));
   drush_print(dt("  @dis views are disabled\n", array('@dis' => $disabled)));
   drush_print(dt("  @dis views are disabled\n", array('@dis' => $disabled)));
 }
 }
 
 
+/**
+ * Analyze all installed views.
+ */
 function drush_views_analyze() {
 function drush_views_analyze() {
   views_include('analyze');
   views_include('analyze');
   $messages_count = 0;
   $messages_count = 0;
@@ -440,7 +451,7 @@ function drush_views_analyze() {
       drush_print($view_name);
       drush_print($view_name);
       foreach ($messages as $message) {
       foreach ($messages as $message) {
         $messages_count++;
         $messages_count++;
-        drush_print($message['type'] .': '. $message['message'], 2);
+        drush_print($message['type'] . ': ' . $message['message'], 2);
       }
       }
     }
     }
   }
   }
@@ -448,7 +459,7 @@ function drush_views_analyze() {
 }
 }
 
 
 /**
 /**
- * Enables views
+ * Enables views.
  */
  */
 function drush_views_enable() {
 function drush_views_enable() {
   $viewnames = _convert_csv_to_array(func_get_args());
   $viewnames = _convert_csv_to_array(func_get_args());
@@ -460,7 +471,7 @@ function drush_views_enable() {
 }
 }
 
 
 /**
 /**
- * Disables views
+ * Disables views.
  */
  */
 function drush_views_disable() {
 function drush_views_disable() {
   $viewnames = _convert_csv_to_array(func_get_args());
   $viewnames = _convert_csv_to_array(func_get_args());
@@ -472,9 +483,12 @@ function drush_views_disable() {
 }
 }
 
 
 /**
 /**
- * Helper function to enable / disable views
- * @param $viewnames: array of viewnames to process
- * @param $status: TRUE to disable or FALSE to enable the view
+ * Helper function to enable / disable views.
+ *
+ * @param array $viewnames
+ *   Names of the views to process.
+ * @param bool $status
+ *   TRUE to disable or FALSE to enable the view.
  */
  */
 function _views_drush_changestatus($viewnames = array(), $status = NULL) {
 function _views_drush_changestatus($viewnames = array(), $status = NULL) {
   if ($status !== NULL && !empty($viewnames)) {
   if ($status !== NULL && !empty($viewnames)) {
@@ -492,7 +506,7 @@ function _views_drush_changestatus($viewnames = array(), $status = NULL) {
         drush_set_error(dt("The view '!name' is already !processed", array('!name' => $viewname, '!processed' => $processed)));
         drush_set_error(dt("The view '!name' is already !processed", array('!name' => $viewname, '!processed' => $processed)));
       }
       }
     }
     }
-    // If we made changes to views status, save them and clear caches
+    // If we made changes to views status, save them and clear caches.
     if ($changed) {
     if ($changed) {
       variable_set('views_defaults', $views_status);
       variable_set('views_defaults', $views_status);
       views_invalidate_cache();
       views_invalidate_cache();
@@ -504,6 +518,9 @@ function _views_drush_changestatus($viewnames = array(), $status = NULL) {
 
 
 /**
 /**
  * Adds a cache clear option for views.
  * Adds a cache clear option for views.
+ *
+ * @param array $types
+ *   The list of cache types that are available.
  */
  */
 function views_drush_cache_clear(&$types) {
 function views_drush_cache_clear(&$types) {
   $types['views'] = 'views_invalidate_cache';
   $types['views'] = 'views_invalidate_cache';

+ 58 - 26
sites/all/modules/views/handlers/views_handler_area.inc

@@ -2,7 +2,7 @@
 
 
 /**
 /**
  * @file
  * @file
- * Views area handlers.
+ * Definition of views_handler_area and views_handler_area_broken.
  */
  */
 
 
 /**
 /**
@@ -20,29 +20,31 @@
 class views_handler_area extends views_handler {
 class views_handler_area extends views_handler {
 
 
   /**
   /**
-   * Overrides views_handler::init().
-   *
-   * Make sure that no result area handlers are set to be shown when the result
-   * is empty.
+   * {@inheritdoc}
    */
    */
-  function init(&$view, &$options) {
+  public function init(&$view, &$options) {
     parent::init($view, $options);
     parent::init($view, $options);
+    // Make sure that no result area handlers are set to be shown when the
+    // result is empty.
     if ($this->handler_type == 'empty') {
     if ($this->handler_type == 'empty') {
       $this->options['empty'] = TRUE;
       $this->options['empty'] = TRUE;
     }
     }
   }
   }
 
 
   /**
   /**
-   * Get this field's label.
+   * {@inheritdoc}
    */
    */
-  function label() {
+  public function label() {
     if (!isset($this->options['label'])) {
     if (!isset($this->options['label'])) {
       return $this->ui_name();
       return $this->ui_name();
     }
     }
     return $this->options['label'];
     return $this->options['label'];
   }
   }
 
 
-  function option_definition() {
+  /**
+   * {@inheritdoc}
+   */
+  public function option_definition() {
     $options = parent::option_definition();
     $options = parent::option_definition();
 
 
     $this->definition['field'] = !empty($this->definition['field']) ? $this->definition['field'] : '';
     $this->definition['field'] = !empty($this->definition['field']) ? $this->definition['field'] : '';
@@ -54,17 +56,17 @@ class views_handler_area extends views_handler {
   }
   }
 
 
   /**
   /**
-   * Provide extra data to the administration form
+   * Provide extra data to the administration form.
    */
    */
-  function admin_summary() {
+  public function admin_summary() {
     return $this->label();
     return $this->label();
   }
   }
 
 
   /**
   /**
-   * Default options form that provides the label widget that all fields
-   * should have.
+   * Default options form that provides the label widget that all fields should
+   * have.
    */
    */
-  function options_form(&$form, &$form_state) {
+  public function options_form(&$form, &$form_state) {
     parent::options_form($form, $form_state);
     parent::options_form($form, $form_state);
     $form['label'] = array(
     $form['label'] = array(
       '#type' => 'textfield',
       '#type' => 'textfield',
@@ -83,23 +85,25 @@ class views_handler_area extends views_handler {
   }
   }
 
 
   /**
   /**
-   * Don't run a query
+   * Don't run a query.
    */
    */
-  function query() { }
+  public function query() {
+  }
 
 
   /**
   /**
-   * Render the area
+   * Render the area.
    */
    */
-  function render($empty = FALSE) {
+  public function render($empty = FALSE) {
     return '';
     return '';
   }
   }
 
 
   /**
   /**
    * Area handlers shouldn't have groupby.
    * Area handlers shouldn't have groupby.
    */
    */
-  function use_group_by() {
+  public function use_group_by() {
     return FALSE;
     return FALSE;
   }
   }
+
 }
 }
 
 
 /**
 /**
@@ -108,14 +112,39 @@ class views_handler_area extends views_handler {
  * @ingroup views_area_handlers
  * @ingroup views_area_handlers
  */
  */
 class views_handler_area_broken extends views_handler_area {
 class views_handler_area_broken extends views_handler_area {
-  function ui_name($short = FALSE) {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function ui_name($short = FALSE) {
     return t('Broken/missing handler');
     return t('Broken/missing handler');
   }
   }
 
 
-  function ensure_my_table() { /* No table to ensure! */ }
-  function query($group_by = FALSE) { /* No query to run */ }
-  function render($empty = FALSE) { return ''; }
-  function options_form(&$form, &$form_state) {
+  /**
+   * {@inheritdoc}
+   */
+  public function ensure_my_table() {
+    // No table to ensure!
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function query($group_by = FALSE) {
+    // No query to run.
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function render($empty = FALSE) {
+    return '';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function options_form(&$form, &$form_state) {
     $form['markup'] = array(
     $form['markup'] = array(
       '#prefix' => '<div class="form-item description">',
       '#prefix' => '<div class="form-item description">',
       '#value' => t('The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item.'),
       '#value' => t('The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item.'),
@@ -123,9 +152,12 @@ class views_handler_area_broken extends views_handler_area {
   }
   }
 
 
   /**
   /**
-   * Determine if the handler is considered 'broken'
+   * {@inheritdoc}
    */
    */
-  function broken() { return TRUE; }
+  public function broken() {
+    return TRUE;
+  }
+
 }
 }
 
 
 /**
 /**

+ 1 - 1
sites/all/modules/views/handlers/views_handler_area_messages.inc

@@ -2,7 +2,7 @@
 
 
 /**
 /**
  * @file
  * @file
- * Contains views_handler_area_messages.
+ * Definition of views_handler_area_messages.
  */
  */
 
 
 /**
 /**

+ 22 - 7
sites/all/modules/views/handlers/views_handler_area_result.inc

@@ -12,7 +12,10 @@
  */
  */
 class views_handler_area_result extends views_handler_area {
 class views_handler_area_result extends views_handler_area {
 
 
-  function option_definition() {
+  /**
+   * {@inheritdoc}
+   */
+  public function option_definition() {
     $options = parent::option_definition();
     $options = parent::option_definition();
 
 
     $options['content'] = array(
     $options['content'] = array(
@@ -23,7 +26,10 @@ class views_handler_area_result extends views_handler_area {
     return $options;
     return $options;
   }
   }
 
 
-  function options_form(&$form, &$form_state) {
+  /**
+   * {@inheritdoc}
+   */
+  public function options_form(&$form, &$form_state) {
     parent::options_form($form, $form_state);
     parent::options_form($form, $form_state);
     $variables = array(
     $variables = array(
       'items' => array(
       'items' => array(
@@ -47,11 +53,10 @@ class views_handler_area_result extends views_handler_area {
     );
     );
   }
   }
 
 
-
   /**
   /**
    * Find out the information to render.
    * Find out the information to render.
    */
    */
-  function render($empty = FALSE) {
+  public function render($empty = FALSE) {
     // Must have options and does not work on summaries.
     // Must have options and does not work on summaries.
     if (!isset($this->options['content']) || $this->view->plugin_name == 'default_summary') {
     if (!isset($this->options['content']) || $this->view->plugin_name == 'default_summary') {
       return;
       return;
@@ -61,7 +66,7 @@ class views_handler_area_result extends views_handler_area {
     // Calculate the page totals.
     // Calculate the page totals.
     $current_page = (int) $this->view->get_current_page() + 1;
     $current_page = (int) $this->view->get_current_page() + 1;
     $per_page = (int) $this->view->get_items_per_page();
     $per_page = (int) $this->view->get_items_per_page();
-    // @TODO: Maybe use a possible is views empty functionality.
+    // @todo Maybe use a possible is views empty functionality.
     // Not every view has total_rows set, use view->result instead.
     // Not every view has total_rows set, use view->result instead.
     $total = isset($this->view->total_rows) ? $this->view->total_rows : count($this->view->result);
     $total = isset($this->view->total_rows) ? $this->view->total_rows : count($this->view->result);
     $name = check_plain($this->view->human_name);
     $name = check_plain($this->view->human_name);
@@ -81,15 +86,25 @@ class views_handler_area_result extends views_handler_area {
     }
     }
     $current_record_count = ($end - $start) + 1;
     $current_record_count = ($end - $start) + 1;
     // Get the search information.
     // Get the search information.
-    $items = array('start', 'end', 'total', 'name', 'per_page', 'current_page', 'current_record_count', 'page_count');
+    $items = array(
+      'start',
+      'end',
+      'total',
+      'name',
+      'per_page',
+      'current_page',
+      'current_record_count',
+      'page_count',
+    );
     $replacements = array();
     $replacements = array();
     foreach ($items as $item) {
     foreach ($items as $item) {
       $replacements["@$item"] = ${$item};
       $replacements["@$item"] = ${$item};
     }
     }
     // Send the output.
     // Send the output.
-    if (!empty($total)) {
+    if (!empty($total) || !empty($this->options['empty'])) {
       $output .= filter_xss_admin(str_replace(array_keys($replacements), array_values($replacements), $format));
       $output .= filter_xss_admin(str_replace(array_keys($replacements), array_values($replacements), $format));
     }
     }
     return $output;
     return $output;
   }
   }
+
 }
 }

+ 37 - 12
sites/all/modules/views/handlers/views_handler_area_text.inc

@@ -12,15 +12,30 @@
  */
  */
 class views_handler_area_text extends views_handler_area {
 class views_handler_area_text extends views_handler_area {
 
 
-  function option_definition() {
+  /**
+   * {@inheritdoc}
+   */
+  public function option_definition() {
     $options = parent::option_definition();
     $options = parent::option_definition();
-    $options['content'] = array('default' => '', 'translatable' => TRUE, 'format_key' => 'format');
-    $options['format'] = array('default' => NULL);
-    $options['tokenize'] = array('default' => FALSE, 'bool' => TRUE);
+    $options['content'] = array(
+      'default' => '',
+      'translatable' => TRUE,
+      'format_key' => 'format',
+    );
+    $options['format'] = array(
+      'default' => NULL,
+    );
+    $options['tokenize'] = array(
+      'default' => FALSE,
+      'bool' => TRUE,
+    );
     return $options;
     return $options;
   }
   }
 
 
-  function options_form(&$form, &$form_state) {
+  /**
+   * {@inheritdoc}
+   */
+  public function options_form(&$form, &$form_state) {
     parent::options_form($form, $form_state);
     parent::options_form($form, $form_state);
 
 
     $form['content'] = array(
     $form['content'] = array(
@@ -31,7 +46,7 @@ class views_handler_area_text extends views_handler_area {
       '#wysiwyg' => FALSE,
       '#wysiwyg' => FALSE,
     );
     );
 
 
-    // @TODO: Refactor token handling into a base class.
+    // @todo Refactor token handling into a base class.
     $form['tokenize'] = array(
     $form['tokenize'] = array(
       '#type' => 'checkbox',
       '#type' => 'checkbox',
       '#title' => t('Use replacement tokens from the first row'),
       '#title' => t('Use replacement tokens from the first row'),
@@ -44,14 +59,17 @@ class views_handler_area_text extends views_handler_area {
       $options[t('Fields')]["[$field]"] = $handler->ui_name();
       $options[t('Fields')]["[$field]"] = $handler->ui_name();
     }
     }
 
 
-    $count = 0; // This lets us prepare the key as we want it printed.
+    $count = 0;
+    // This lets us prepare the key as we want it printed.
     foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) {
     foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) {
       $options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->ui_name()));
       $options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->ui_name()));
       $options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->ui_name()));
       $options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->ui_name()));
     }
     }
 
 
     if (!empty($options)) {
     if (!empty($options)) {
-      $output = '<p>' . t('The following tokens are available. If you would like to have the characters \'[\' and \']\' please use the html entity codes \'%5B\' or  \'%5D\' or they will get replaced with empty space.' . '</p>');
+      $output = '<p>'
+        . t("The following tokens are available. If you would like to have the characters '[' and ']' please use the html entity codes '%5B' or '%5D' or they will get replaced with empty space.")
+        . '</p>';
       foreach (array_keys($options) as $type) {
       foreach (array_keys($options) as $type) {
         if (!empty($options[$type])) {
         if (!empty($options[$type])) {
           $items = array();
           $items = array();
@@ -61,7 +79,7 @@ class views_handler_area_text extends views_handler_area {
           $output .= theme('item_list',
           $output .= theme('item_list',
             array(
             array(
               'items' => $items,
               'items' => $items,
-              'type' => $type
+              'type' => $type,
             ));
             ));
         }
         }
       }
       }
@@ -82,13 +100,19 @@ class views_handler_area_text extends views_handler_area {
     }
     }
   }
   }
 
 
-  function options_submit(&$form, &$form_state) {
+  /**
+   * {@inheritdoc}
+   */
+  public function options_submit(&$form, &$form_state) {
     $form_state['values']['options']['format'] = $form_state['values']['options']['content']['format'];
     $form_state['values']['options']['format'] = $form_state['values']['options']['content']['format'];
     $form_state['values']['options']['content'] = $form_state['values']['options']['content']['value'];
     $form_state['values']['options']['content'] = $form_state['values']['options']['content']['value'];
     parent::options_submit($form, $form_state);
     parent::options_submit($form, $form_state);
   }
   }
 
 
-  function render($empty = FALSE) {
+  /**
+   * {@inheritdoc}
+   */
+  public function render($empty = FALSE) {
     $format = isset($this->options['format']) ? $this->options['format'] : filter_default_format();
     $format = isset($this->options['format']) ? $this->options['format'] : filter_default_format();
     if (!$empty || !empty($this->options['empty'])) {
     if (!$empty || !empty($this->options['empty'])) {
       return $this->render_textarea($this->options['content'], $format);
       return $this->render_textarea($this->options['content'], $format);
@@ -99,7 +123,7 @@ class views_handler_area_text extends views_handler_area {
   /**
   /**
    * Render a text area, using the proper format.
    * Render a text area, using the proper format.
    */
    */
-  function render_textarea($value, $format) {
+  public function render_textarea($value, $format) {
     if ($value) {
     if ($value) {
       if ($this->options['tokenize']) {
       if ($this->options['tokenize']) {
         $value = $this->view->style_plugin->tokenize_value($value, 0);
         $value = $this->view->style_plugin->tokenize_value($value, 0);
@@ -107,4 +131,5 @@ class views_handler_area_text extends views_handler_area {
       return check_markup($value, $format, '', FALSE);
       return check_markup($value, $format, '', FALSE);
     }
     }
   }
   }
+
 }
 }

+ 25 - 7
sites/all/modules/views/handlers/views_handler_area_text_custom.inc

@@ -12,13 +12,19 @@
  */
  */
 class views_handler_area_text_custom extends views_handler_area_text {
 class views_handler_area_text_custom extends views_handler_area_text {
 
 
-  function option_definition() {
+  /**
+   * {@inheritdoc}
+   */
+  public function option_definition() {
     $options = parent::option_definition();
     $options = parent::option_definition();
     unset($options['format']);
     unset($options['format']);
     return $options;
     return $options;
   }
   }
 
 
-  function options_form(&$form, &$form_state) {
+  /**
+   * {@inheritdoc}
+   */
+  public function options_form(&$form, &$form_state) {
     parent::options_form($form, $form_state);
     parent::options_form($form, $form_state);
 
 
     // Alter the form element, to be a regular text area.
     // Alter the form element, to be a regular text area.
@@ -26,14 +32,20 @@ class views_handler_area_text_custom extends views_handler_area_text {
     unset($form['content']['#format']);
     unset($form['content']['#format']);
     unset($form['content']['#wysiwyg']);
     unset($form['content']['#wysiwyg']);
 
 
-    // @TODO: Use the token refactored base class.
+    // @todo Use the token refactored base class.
   }
   }
 
 
-  // Empty, so we don't inherit options_submit from the parent.
-  function options_submit(&$form, &$form_state) {
+  /**
+   * {@inheritdoc}
+   */
+  public function options_submit(&$form, &$form_state) {
+    // Empty, so we don't inherit options_submit from the parent.
   }
   }
 
 
-  function render($empty = FALSE) {
+  /**
+   * {@inheritdoc}
+   */
+  public function render($empty = FALSE) {
     if (!$empty || !empty($this->options['empty'])) {
     if (!$empty || !empty($this->options['empty'])) {
       return $this->render_textarea_custom($this->options['content']);
       return $this->render_textarea_custom($this->options['content']);
     }
     }
@@ -43,8 +55,14 @@ class views_handler_area_text_custom extends views_handler_area_text {
 
 
   /**
   /**
    * Render a text area with filter_xss_admin.
    * Render a text area with filter_xss_admin.
+   *
+   * @param string $value
+   *   The text area string to process.
+   *
+   * @return string
+   *   The string after it has been sanitized, optionally tokenized too.
    */
    */
-  function render_textarea_custom($value) {
+  public function render_textarea_custom($value) {
     if ($value) {
     if ($value) {
       if ($this->options['tokenize']) {
       if ($this->options['tokenize']) {
         $value = $this->view->style_plugin->tokenize_value($value, 0);
         $value = $this->view->style_plugin->tokenize_value($value, 0);

+ 8 - 6
sites/all/modules/views/handlers/views_handler_area_view.inc

@@ -12,7 +12,10 @@
  */
  */
 class views_handler_area_view extends views_handler_area {
 class views_handler_area_view extends views_handler_area {
 
 
-  function option_definition() {
+  /**
+   * {@inheritdoc}
+   */
+  public function option_definition() {
     $options = parent::option_definition();
     $options = parent::option_definition();
 
 
     $options['view_to_insert'] = array('default' => '');
     $options['view_to_insert'] = array('default' => '');
@@ -21,10 +24,9 @@ class views_handler_area_view extends views_handler_area {
   }
   }
 
 
   /**
   /**
-   * Default options form that provides the label widget that all fields
-   * should have.
+   * Default options form; provides the label widget all fields should have.
    */
    */
-  function options_form(&$form, &$form_state) {
+  public function options_form(&$form, &$form_state) {
     parent::options_form($form, $form_state);
     parent::options_form($form, $form_state);
 
 
     $view_display = $this->view->name . ':' . $this->view->current_display;
     $view_display = $this->view->name . ':' . $this->view->current_display;
@@ -48,9 +50,9 @@ class views_handler_area_view extends views_handler_area {
   }
   }
 
 
   /**
   /**
-   * Render the area
+   * Render the area.
    */
    */
-  function render($empty = FALSE) {
+  public function render($empty = FALSE) {
     if ($view = $this->loadView()) {
     if ($view = $this->loadView()) {
       if (!empty($this->options['inherit_arguments']) && !empty($this->view->args)) {
       if (!empty($this->options['inherit_arguments']) && !empty($this->view->args)) {
         return $view->preview(NULL, $this->view->args);
         return $view->preview(NULL, $this->view->args);

+ 279 - 156
sites/all/modules/views/handlers/views_handler_argument.inc

@@ -2,7 +2,7 @@
 
 
 /**
 /**
  * @file
  * @file
- * @todo.
+ * Definition of views_handler_argument.
  */
  */
 
 
 /**
 /**
@@ -14,50 +14,63 @@
 /**
 /**
  * Base class for arguments.
  * Base class for arguments.
  *
  *
- * The basic argument works for very simple arguments such as nid and uid
+ * The basic argument works for very simple arguments such as nid and uid.
  *
  *
  * Definition terms for this handler:
  * Definition terms for this handler:
  * - name field: The field to use for the name to use in the summary, which is
  * - name field: The field to use for the name to use in the summary, which is
- *               the displayed output. For example, for the node: nid argument,
- *               the argument itself is the nid, but node.title is displayed.
+ *   the displayed output. For example, for the node: nid argument, the argument
+ *   itself is the nid, but node.title is displayed.
  * - name table: The table to use for the name, should it not be in the same
  * - name table: The table to use for the name, should it not be in the same
- *               table as the argument.
+ *   table as the argument.
  * - empty field name: For arguments that can have no value, such as taxonomy
  * - empty field name: For arguments that can have no value, such as taxonomy
- *                     which can have "no term", this is the string which
- *                     will be displayed for this lack of value. Be sure to use
- *                     t().
+ *   which can have "no term", this is the string which will be displayed for
+ *   this lack of value. Be sure to use t().
  * - validate type: A little used string to allow an argument to restrict
  * - validate type: A little used string to allow an argument to restrict
- *                  which validator is available to just one. Use the
- *                  validator ID. This probably should not be used at all,
- *                  and may disappear or change.
+ *   which validator is available to just one. Use the validator ID. This
+ *   probably should not be used at all, and may disappear or change.
  * - numeric: If set to TRUE this field is numeric and will use %d instead of
  * - numeric: If set to TRUE this field is numeric and will use %d instead of
- *            %s in queries.
+ *   %s in queries.
  *
  *
  * @ingroup views_argument_handlers
  * @ingroup views_argument_handlers
  */
  */
 class views_handler_argument extends views_handler {
 class views_handler_argument extends views_handler {
-  var $validator = NULL;
-  var $argument = NULL;
-  var $value = NULL;
 
 
   /**
   /**
-   * The table to use for the name, should it not be in the same table as the argument.
+   * @var object
+   */
+  public $validator = NULL;
+
+  /**
+   * @var mixed
+   */
+  public $argument = NULL;
+
+  /**
+   * @var mixed
+   */
+  public $value = NULL;
+
+  /**
+   * The table to use for the name, if not the same table as the argument.
+   *
    * @var string
    * @var string
    */
    */
-  var $name_table;
+  public $name_table;
 
 
   /**
   /**
-   * The field to use for the name to use in the summary, which is
-   * the displayed output. For example, for the node: nid argument,
-   * the argument itself is the nid, but node.title is displayed.
+   * The field to use for the name to use in the summary.
+   *
+   * Used as the displayed output. For example, for the node: nid argument, the
+   * argument itself is the nid, but node.title is displayed.
+   *
    * @var string
    * @var string
    */
    */
-  var $name_field;
+  public $name_field;
 
 
   /**
   /**
-   * Constructor
+   * {@inheritdoc}
    */
    */
-  function construct() {
+  public function construct() {
     parent::construct();
     parent::construct();
 
 
     if (!empty($this->definition['name field'])) {
     if (!empty($this->definition['name field'])) {
@@ -68,7 +81,10 @@ class views_handler_argument extends views_handler {
     }
     }
   }
   }
 
 
-  function init(&$view, &$options) {
+  /**
+   * {@inheritdoc}
+   */
+  public function init(&$view, &$options) {
     parent::init($view, $options);
     parent::init($view, $options);
 
 
     // Compatibility: The new UI changed several settings.
     // Compatibility: The new UI changed several settings.
@@ -132,31 +148,43 @@ class views_handler_argument extends views_handler {
 
 
   /**
   /**
    * Give an argument the opportunity to modify the breadcrumb, if it wants.
    * Give an argument the opportunity to modify the breadcrumb, if it wants.
-   * This only gets called on displays where a breadcrumb is actually used.
+   *
+   * Only gets called on displays where a breadcrumb is actually used.
    *
    *
    * The breadcrumb will be in the form of an array, with the keys being
    * The breadcrumb will be in the form of an array, with the keys being
    * the path and the value being the already sanitized title of the path.
    * the path and the value being the already sanitized title of the path.
    */
    */
-  function set_breadcrumb(&$breadcrumb) { }
+  public function set_breadcrumb(&$breadcrumb) {
+  }
 
 
   /**
   /**
-   * Determine if the argument can generate a breadcrumb
+   * Determine if the argument can generate a breadcrumb.
    *
    *
-   * @return TRUE/FALSE
+   * @return bool
+   *   Indicates whether the argument can generate a breadcrumb.
    */
    */
-  function uses_breadcrumb() {
+  public function uses_breadcrumb() {
     $info = $this->default_actions($this->options['default_action']);
     $info = $this->default_actions($this->options['default_action']);
     return !empty($info['breadcrumb']);
     return !empty($info['breadcrumb']);
   }
   }
 
 
-  function is_exception($arg = NULL) {
+  /**
+   * {@inheritdoc}
+   */
+  public function is_exception($arg = NULL) {
     if (!isset($arg)) {
     if (!isset($arg)) {
       $arg = isset($this->argument) ? $this->argument : NULL;
       $arg = isset($this->argument) ? $this->argument : NULL;
     }
     }
-    return !empty($this->options['exception']['value']) && $this->options['exception']['value'] === $arg;
+    return !empty($this->options['exception']['value']) && ($this->options['exception']['value'] === $arg);
   }
   }
 
 
-  function exception_title() {
+  /**
+   * Work out which title to use.
+   *
+   * @return string
+   *   The title string to use.
+   */
+  public function exception_title() {
     // If title overriding is off for the exception, return the normal title.
     // If title overriding is off for the exception, return the normal title.
     if (empty($this->options['exception']['title_enable'])) {
     if (empty($this->options['exception']['title_enable'])) {
       return $this->get_title();
       return $this->get_title();
@@ -167,15 +195,19 @@ class views_handler_argument extends views_handler {
   /**
   /**
    * Determine if the argument needs a style plugin.
    * Determine if the argument needs a style plugin.
    *
    *
-   * @return TRUE/FALSE
+   * @return bool
+   *   the argument needs a plugin style.
    */
    */
-  function needs_style_plugin() {
+  public function needs_style_plugin() {
     $info = $this->default_actions($this->options['default_action']);
     $info = $this->default_actions($this->options['default_action']);
     $validate_info = $this->default_actions($this->options['validate']['fail']);
     $validate_info = $this->default_actions($this->options['validate']['fail']);
     return !empty($info['style plugin']) || !empty($validate_info['style plugin']);
     return !empty($info['style plugin']) || !empty($validate_info['style plugin']);
   }
   }
 
 
-  function option_definition() {
+  /**
+   * {@inheritdoc}
+   */
+  public function option_definition() {
     $options = parent::option_definition();
     $options = parent::option_definition();
 
 
     $options['default_action'] = array('default' => 'ignore');
     $options['default_action'] = array('default' => 'ignore');
@@ -213,7 +245,10 @@ class views_handler_argument extends views_handler {
     return $options;
     return $options;
   }
   }
 
 
-  function options_form(&$form, &$form_state) {
+  /**
+   * {@inheritdoc}
+   */
+  public function options_form(&$form, &$form_state) {
     parent::options_form($form, $form_state);
     parent::options_form($form, $form_state);
 
 
     $argument_text = $this->view->display_handler->get_argument_text();
     $argument_text = $this->view->display_handler->get_argument_text();
@@ -380,8 +415,9 @@ class views_handler_argument extends views_handler {
               '#prefix' => '<div id="edit-options-validate-options-' . $id . '-wrapper">',
               '#prefix' => '<div id="edit-options-validate-options-' . $id . '-wrapper">',
               '#suffix' => '</div>',
               '#suffix' => '</div>',
               '#type' => 'item',
               '#type' => 'item',
-              // Even if the plugin has no options add the key to the form_state.
-              '#input' => TRUE, // trick it into checking input to make #process run
+              // Even if the plugin has no options, add the key to the
+              // form_state. Trick it into checking input to make #process run.
+              '#input' => TRUE,
               '#dependency' => array(
               '#dependency' => array(
                 'edit-options-specify-validation' => array('1'),
                 'edit-options-specify-validation' => array('1'),
                 'edit-options-validate-type' => array($id),
                 'edit-options-validate-type' => array($id),
@@ -411,7 +447,10 @@ class views_handler_argument extends views_handler {
     );
     );
   }
   }
 
 
-  function options_validate(&$form, &$form_state) {
+  /**
+   * {@inheritdoc}
+   */
+  public function options_validate(&$form, &$form_state) {
     if (empty($form_state['values']['options'])) {
     if (empty($form_state['values']['options'])) {
       return;
       return;
     }
     }
@@ -440,7 +479,10 @@ class views_handler_argument extends views_handler {
 
 
   }
   }
 
 
-  function options_submit(&$form, &$form_state) {
+  /**
+   * {@inheritdoc}
+   */
+  public function options_submit(&$form, &$form_state) {
     if (empty($form_state['values']['options'])) {
     if (empty($form_state['values']['options'])) {
       return;
       return;
     }
     }
@@ -451,7 +493,8 @@ class views_handler_argument extends views_handler {
     if ($plugin) {
     if ($plugin) {
       $options = &$form_state['values']['options']['argument_default'][$default_id];
       $options = &$form_state['values']['options']['argument_default'][$default_id];
       $plugin->options_submit($form['argument_default'][$default_id], $form_state, $options);
       $plugin->options_submit($form['argument_default'][$default_id], $form_state, $options);
-      // Copy the now submitted options to their final resting place so they get saved.
+      // Copy the now submitted options to their final resting place so they
+      // get saved.
       $form_state['values']['options']['default_argument_options'] = $options;
       $form_state['values']['options']['default_argument_options'] = $options;
     }
     }
 
 
@@ -462,7 +505,8 @@ class views_handler_argument extends views_handler {
       if ($plugin) {
       if ($plugin) {
         $options = &$form_state['values']['options']['summary']['options'][$summary_id];
         $options = &$form_state['values']['options']['summary']['options'][$summary_id];
         $plugin->options_submit($form['summary']['options'][$summary_id], $form_state, $options);
         $plugin->options_submit($form['summary']['options'][$summary_id], $form_state, $options);
-        // Copy the now submitted options to their final resting place so they get saved.
+        // Copy the now submitted options to their final resting place so they
+        // get saved.
         $form_state['values']['options']['summary_options'] = $options;
         $form_state['values']['options']['summary_options'] = $options;
       }
       }
     }
     }
@@ -472,7 +516,8 @@ class views_handler_argument extends views_handler {
     if ($plugin) {
     if ($plugin) {
       $options = &$form_state['values']['options']['validate']['options'][$validate_id];
       $options = &$form_state['values']['options']['validate']['options'][$validate_id];
       $plugin->options_submit($form['validate']['options'][$validate_id], $form_state, $options);
       $plugin->options_submit($form['validate']['options'][$validate_id], $form_state, $options);
-      // Copy the now submitted options to their final resting place so they get saved.
+      // Copy the now submitted options to their final resting place so they
+      // get saved.
       $form_state['values']['options']['validate_options'] = $options;
       $form_state['values']['options']['validate_options'] = $options;
     }
     }
 
 
@@ -484,47 +529,53 @@ class views_handler_argument extends views_handler {
   }
   }
 
 
   /**
   /**
-   * Provide a list of default behaviors for this argument if the argument
-   * is not present.
+   * List of default behaviors for this argument if the argument is not present.
    *
    *
    * Override this method to provide additional (or fewer) default behaviors.
    * Override this method to provide additional (or fewer) default behaviors.
    */
    */
-  function default_actions($which = NULL) {
+  public function default_actions($which = NULL) {
     $defaults = array(
     $defaults = array(
       'ignore' => array(
       'ignore' => array(
         'title' => t('Display all results for the specified field'),
         'title' => t('Display all results for the specified field'),
         'method' => 'default_ignore',
         'method' => 'default_ignore',
-        'breadcrumb' => TRUE, // generate a breadcrumb to here
+        // Generate a breadcrumb to here.
+        'breadcrumb' => TRUE,
       ),
       ),
       'default' => array(
       'default' => array(
         'title' => t('Provide default value'),
         'title' => t('Provide default value'),
         'method' => 'default_default',
         'method' => 'default_default',
         'form method' => 'default_argument_form',
         'form method' => 'default_argument_form',
         'has default argument' => TRUE,
         'has default argument' => TRUE,
-        'default only' => TRUE, // this can only be used for missing argument, not validation failure
-        'breadcrumb' => TRUE, // generate a breadcrumb to here
+        // This can only be used for missing argument, not validation failure.
+        'default only' => TRUE,
+        // Generate a breadcrumb to here.
+        'breadcrumb' => TRUE,
       ),
       ),
       'not found' => array(
       'not found' => array(
         'title' => t('Hide view'),
         'title' => t('Hide view'),
         'method' => 'default_not_found',
         'method' => 'default_not_found',
-        'hard fail' => TRUE, // This is a hard fail condition
+        // This is a hard fail condition.
+        'hard fail' => TRUE,
       ),
       ),
       'summary' => array(
       'summary' => array(
         'title' => t('Display a summary'),
         'title' => t('Display a summary'),
         'method' => 'default_summary',
         'method' => 'default_summary',
         'form method' => 'default_summary_form',
         'form method' => 'default_summary_form',
         'style plugin' => TRUE,
         'style plugin' => TRUE,
-        'breadcrumb' => TRUE, // generate a breadcrumb to here
+        // Generate a breadcrumb to here.
+        'breadcrumb' => TRUE,
       ),
       ),
       'empty' => array(
       'empty' => array(
         'title' => t('Display contents of "No results found"'),
         'title' => t('Display contents of "No results found"'),
         'method' => 'default_empty',
         'method' => 'default_empty',
-        'breadcrumb' => TRUE, // generate a breadcrumb to here
+        // Generate a breadcrumb to here.
+        'breadcrumb' => TRUE,
       ),
       ),
       'access denied' => array(
       'access denied' => array(
         'title' => t('Display "Access Denied"'),
         'title' => t('Display "Access Denied"'),
         'method' => 'default_access_denied',
         'method' => 'default_access_denied',
-        'breadcrumb' => FALSE, // generate a breadcrumb to here
+        // Generate a breadcrumb to here.
+        'breadcrumb' => FALSE,
       ),
       ),
     );
     );
 
 
@@ -543,10 +594,11 @@ class views_handler_argument extends views_handler {
   }
   }
 
 
   /**
   /**
-   * Provide a form for selecting the default argument when the
-   * default action is set to provide default argument.
+   * Provide a form for selecting the default argument.
+   *
+   * Used when the default action is set to provide default argument.
    */
    */
-  function default_argument_form(&$form, &$form_state) {
+  public function default_argument_form(&$form, &$form_state) {
     $plugins = views_fetch_plugin_data('argument default');
     $plugins = views_fetch_plugin_data('argument default');
     $options = array();
     $options = array();
 
 
@@ -554,7 +606,7 @@ class views_handler_argument extends views_handler {
       '#type' => 'checkbox',
       '#type' => 'checkbox',
       '#title' => t('Skip default argument for view URL'),
       '#title' => t('Skip default argument for view URL'),
       '#default_value' => $this->options['default_argument_skip_url'],
       '#default_value' => $this->options['default_argument_skip_url'],
-      '#description' => t('Select whether to include this default argument when constructing the URL for this view. Skipping default arguments is useful e.g. in the case of feeds.')
+      '#description' => t('Select whether to include this default argument when constructing the URL for this view. Skipping default arguments is useful e.g. in the case of feeds.'),
     );
     );
 
 
     $form['default_argument_type'] = array(
     $form['default_argument_type'] = array(
@@ -564,8 +616,11 @@ class views_handler_argument extends views_handler {
       '#id' => 'edit-options-default-argument-type',
       '#id' => 'edit-options-default-argument-type',
       '#title' => t('Type'),
       '#title' => t('Type'),
       '#default_value' => $this->options['default_argument_type'],
       '#default_value' => $this->options['default_argument_type'],
-
-      '#dependency' => array('radio:options[default_action]' => array('default')),
+      '#dependency' => array(
+        'radio:options[default_action]' => array(
+          'default',
+        ),
+      ),
       // Views custom key, moves this element to the appropriate container
       // Views custom key, moves this element to the appropriate container
       // under the radio button.
       // under the radio button.
       '#argument_option' => 'default',
       '#argument_option' => 'default',
@@ -588,7 +643,7 @@ class views_handler_argument extends views_handler {
             '#input' => TRUE,
             '#input' => TRUE,
             '#dependency' => array(
             '#dependency' => array(
               'radio:options[default_action]' => array('default'),
               'radio:options[default_action]' => array('default'),
-              'edit-options-default-argument-type' => array($id)
+              'edit-options-default-argument-type' => array($id),
             ),
             ),
             '#dependency_count' => 2,
             '#dependency_count' => 2,
           );
           );
@@ -603,10 +658,11 @@ class views_handler_argument extends views_handler {
   }
   }
 
 
   /**
   /**
-   * Provide a form for selecting further summary options when the
-   * default action is set to display one.
+   * Form for selecting further summary options.
+   *
+   * Only used when the default action is set to display one.
    */
    */
-  function default_summary_form(&$form, &$form_state) {
+  public function default_summary_form(&$form, &$form_state) {
     $style_plugins = views_fetch_plugin_data('style');
     $style_plugins = views_fetch_plugin_data('style');
     $summary_plugins = array();
     $summary_plugins = array();
     $format_options = array();
     $format_options = array();
@@ -635,7 +691,7 @@ class views_handler_argument extends views_handler {
       '#default_value' => $this->options['summary']['number_of_records'],
       '#default_value' => $this->options['summary']['number_of_records'],
       '#options' => array(
       '#options' => array(
         0 => $this->get_sort_name(),
         0 => $this->get_sort_name(),
-        1 => t('Number of records')
+        1 => t('Number of records'),
       ),
       ),
       '#dependency' => array('radio:options[default_action]' => array('summary')),
       '#dependency' => array('radio:options[default_action]' => array('summary')),
     );
     );
@@ -659,7 +715,8 @@ class views_handler_argument extends views_handler {
           '#suffix' => '</div>',
           '#suffix' => '</div>',
           '#id' => 'edit-options-summary-options-' . $id,
           '#id' => 'edit-options-summary-options-' . $id,
           '#type' => 'item',
           '#type' => 'item',
-          '#input' => TRUE, // trick it into checking input to make #process run
+          // Trick it into checking input to make #process run.
+          '#input' => TRUE,
           '#dependency' => array(
           '#dependency' => array(
             'radio:options[default_action]' => array('summary'),
             'radio:options[default_action]' => array('summary'),
             'radio:options[summary][format]' => array($id),
             'radio:options[summary][format]' => array($id),
@@ -677,11 +734,11 @@ class views_handler_argument extends views_handler {
    *
    *
    * Override this method only with extreme care.
    * Override this method only with extreme care.
    *
    *
-   * @return
+   * @return bool
    *   A boolean value; if TRUE, continue building this view. If FALSE,
    *   A boolean value; if TRUE, continue building this view. If FALSE,
    *   building the view will be aborted here.
    *   building the view will be aborted here.
    */
    */
-  function default_action($info = NULL) {
+  public function default_action($info = NULL) {
     if (!isset($info)) {
     if (!isset($info)) {
       $info = $this->default_actions($this->options['default_action']);
       $info = $this->default_actions($this->options['default_action']);
     }
     }
@@ -699,29 +756,30 @@ class views_handler_argument extends views_handler {
   }
   }
 
 
   /**
   /**
-   * How to act if validation failes
+   * How to act if validation fails.
    */
    */
-  function validate_fail() {
+  public function validate_fail() {
     $info = $this->default_actions($this->options['validate']['fail']);
     $info = $this->default_actions($this->options['validate']['fail']);
     return $this->default_action($info);
     return $this->default_action($info);
   }
   }
+
   /**
   /**
    * Default action: ignore.
    * Default action: ignore.
    *
    *
-   * If an argument was expected and was not given, in this case, simply
-   * ignore the argument entirely.
+   * If an argument was expected and was not given, in this case, simply ignore
+   * the argument entirely.
    */
    */
-  function default_ignore() {
+  public function default_ignore() {
     return TRUE;
     return TRUE;
   }
   }
 
 
   /**
   /**
    * Default action: not found.
    * Default action: not found.
    *
    *
-   * If an argument was expected and was not given, in this case, report
-   * the view as 'not found' or hide it.
+   * If an argument was expected and was not given, in this case, report the
+   * view as 'not found' or hide it.
    */
    */
-  function default_not_found() {
+  public function default_not_found() {
     // Set a failure condition and let the display manager handle it.
     // Set a failure condition and let the display manager handle it.
     $this->view->build_info['fail'] = TRUE;
     $this->view->build_info['fail'] = TRUE;
     return FALSE;
     return FALSE;
@@ -730,21 +788,21 @@ class views_handler_argument extends views_handler {
   /**
   /**
    * Default action: access denied.
    * Default action: access denied.
    *
    *
-   * If an argument was expected and was not given, in this case, report
-   * the view as 'access denied'.
+   * If an argument was expected and was not given, in this case, report the
+   * view as 'access denied'.
    */
    */
-  function default_access_denied() {
+  public function default_access_denied() {
     $this->view->build_info['denied'] = TRUE;
     $this->view->build_info['denied'] = TRUE;
     return FALSE;
     return FALSE;
   }
   }
 
 
   /**
   /**
-   * Default action: empty
+   * Default action: empty.
    *
    *
-   * If an argument was expected and was not given, in this case, display
-   * the view's empty text
+   * If an argument was expected and was not given, in this case, display the
+   * view's empty text.
    */
    */
-  function default_empty() {
+  public function default_empty() {
     // We return with no query; this will force the empty text.
     // We return with no query; this will force the empty text.
     $this->view->built = TRUE;
     $this->view->built = TRUE;
     $this->view->executed = TRUE;
     $this->view->executed = TRUE;
@@ -753,17 +811,20 @@ class views_handler_argument extends views_handler {
   }
   }
 
 
   /**
   /**
-   * This just returns true. The view argument builder will know where
-   * to find the argument from.
+   * This just returns true.
+   *
+   * The view argument builder will know where to find the argument from.
+   *
+   * @todo Why is this needed?
    */
    */
-  function default_default() {
+  public function default_default() {
     return TRUE;
     return TRUE;
   }
   }
 
 
   /**
   /**
    * Determine if the argument is set to provide a default argument.
    * Determine if the argument is set to provide a default argument.
    */
    */
-  function has_default_argument() {
+  public function has_default_argument() {
     $info = $this->default_actions($this->options['default_action']);
     $info = $this->default_actions($this->options['default_action']);
     return !empty($info['has default argument']);
     return !empty($info['has default argument']);
   }
   }
@@ -771,7 +832,7 @@ class views_handler_argument extends views_handler {
   /**
   /**
    * Get a default argument, if available.
    * Get a default argument, if available.
    */
    */
-  function get_default_argument() {
+  public function get_default_argument() {
     $plugin = $this->get_plugin('argument default');
     $plugin = $this->get_plugin('argument default');
     if ($plugin) {
     if ($plugin) {
       return $plugin->get_argument();
       return $plugin->get_argument();
@@ -784,7 +845,7 @@ class views_handler_argument extends views_handler {
    * For example, the validation plugin may want to alter an argument for use in
    * For example, the validation plugin may want to alter an argument for use in
    * the URL.
    * the URL.
    */
    */
-  function process_summary_arguments(&$args) {
+  public function process_summary_arguments(&$args) {
     if ($this->options['validate']['type'] != 'none') {
     if ($this->options['validate']['type'] != 'none') {
       if (isset($this->validator) || $this->validator = $this->get_plugin('argument validator')) {
       if (isset($this->validator) || $this->validator = $this->get_plugin('argument validator')) {
         $this->validator->process_summary_arguments($args);
         $this->validator->process_summary_arguments($args);
@@ -795,20 +856,19 @@ class views_handler_argument extends views_handler {
   /**
   /**
    * Default action: summary.
    * Default action: summary.
    *
    *
-   * If an argument was expected and was not given, in this case, display
-   * a summary query.
+   * If an argument was expected and was not given, in this case, display a
+   * summary query.
    */
    */
-  function default_summary() {
+  public function default_summary() {
     $this->view->build_info['summary'] = TRUE;
     $this->view->build_info['summary'] = TRUE;
     $this->view->build_info['summary_level'] = $this->options['id'];
     $this->view->build_info['summary_level'] = $this->options['id'];
 
 
-    // Change the display style to the summary style for this
-    // argument.
+    // Change the display style to the summary style for this argument.
     $this->view->plugin_name = $this->options['summary']['format'];
     $this->view->plugin_name = $this->options['summary']['format'];
     $this->view->style_options = $this->options['summary_options'];
     $this->view->style_options = $this->options['summary_options'];
 
 
-    // Clear out the normal primary field and whatever else may have
-    // been added and let the summary do the work.
+    // Clear out the normal primary field and whatever else may have been added
+    // and let the summary do the work.
     $this->query->clear_fields();
     $this->query->clear_fields();
     $this->summary_query();
     $this->summary_query();
 
 
@@ -826,14 +886,14 @@ class views_handler_argument extends views_handler {
    *
    *
    * This must:
    * This must:
    * - add_groupby: group on this field in order to create summaries.
    * - add_groupby: group on this field in order to create summaries.
-   * - add_field: add a 'num_nodes' field for the count. Usually it will
-   *   be a count on $view->base_field
+   * - add_field: add a 'num_nodes' field for the count. Usually it will be a
+   *   count on $view->base_field
    * - set_count_field: Reset the count field so we get the right paging.
    * - set_count_field: Reset the count field so we get the right paging.
    *
    *
-   * @return
+   * @return string
    *   The alias used to get the number of records (count) for this entry.
    *   The alias used to get the number of records (count) for this entry.
    */
    */
-  function summary_query() {
+  public function summary_query() {
     $this->ensure_my_table();
     $this->ensure_my_table();
     // Add the field.
     // Add the field.
     $this->base_alias = $this->query->add_field($this->table_alias, $this->real_field);
     $this->base_alias = $this->query->add_field($this->table_alias, $this->real_field);
@@ -844,15 +904,15 @@ class views_handler_argument extends views_handler {
 
 
   /**
   /**
    * Add the name field, which is the field displayed in summary queries.
    * Add the name field, which is the field displayed in summary queries.
+   *
    * This is often used when the argument is numeric.
    * This is often used when the argument is numeric.
    */
    */
-  function summary_name_field() {
-    // Add the 'name' field. For example, if this is a uid argument, the
-    // name field would be 'name' (i.e, the username).
-
+  public function summary_name_field() {
+    // Add the 'name' field. For example, if this is a uid argument, the name
+    // field would be 'name' (i.e, the username).
     if (isset($this->name_table)) {
     if (isset($this->name_table)) {
-      // if the alias is different then we're probably added, not ensured,
-      // so look up the join and add it instead.
+      // If the alias is different then we're probably added, not ensured, so
+      // look up the join and add it instead.
       if ($this->table_alias != $this->name_table) {
       if ($this->table_alias != $this->name_table) {
         $j = views_get_table_join($this->name_table, $this->table);
         $j = views_get_table_join($this->name_table, $this->table);
         if ($j) {
         if ($j) {
@@ -878,15 +938,21 @@ class views_handler_argument extends views_handler {
   }
   }
 
 
   /**
   /**
-   * Some basic summary behavior that doesn't need to be repeated as much as
-   * code that goes into summary_query()
+   * Some basic summary behavior.
+   *
+   * This doesn't need to be repeated as much as code that goes into
+   * summary_query().
    */
    */
-  function summary_basics($count_field = TRUE) {
-    // Add the number of nodes counter
+  public function summary_basics($count_field = TRUE) {
+    // Add the number of nodes counter.
     $distinct = ($this->view->display_handler->get_option('distinct') && empty($this->query->no_distinct));
     $distinct = ($this->view->display_handler->get_option('distinct') && empty($this->query->no_distinct));
 
 
-    $count_alias = $this->query->add_field($this->query->base_table, $this->query->base_field, 'num_records',
-                                           array('count' => TRUE, 'distinct' => $distinct));
+    $count_alias = $this->query->add_field($this->query->base_table,
+      $this->query->base_field, 'num_records',
+      array(
+        'count' => TRUE,
+        'distinct' => $distinct,
+      ));
     $this->query->add_groupby($this->name_alias);
     $this->query->add_groupby($this->name_alias);
 
 
     if ($count_field) {
     if ($count_field) {
@@ -897,36 +963,44 @@ class views_handler_argument extends views_handler {
   }
   }
 
 
   /**
   /**
-   * Sorts the summary based upon the user's selection. The base variant of
-   * this is usually adequte.
+   * Sorts the summary based upon the user's selection.
+   *
+   * The base variant of this is usually adequte.
    *
    *
-   * @param $order
+   * @param string $order
    *   The order selected in the UI.
    *   The order selected in the UI.
+   * @param string $by
+   *   Optional alias for this field.
    */
    */
-  function summary_sort($order, $by = NULL) {
+  public function summary_sort($order, $by = NULL) {
     $this->query->add_orderby(NULL, NULL, $order, (!empty($by) ? $by : $this->name_alias));
     $this->query->add_orderby(NULL, NULL, $order, (!empty($by) ? $by : $this->name_alias));
   }
   }
 
 
   /**
   /**
-   * Provide the argument to use to link from the summary to the next level;
-   * this will be called once per row of a summary, and used as part of
+   * Provide the argument to use to link from the summary to the next level.
+   *
+   * This will be called once per row of a summary, and used as part of
    * $view->get_url().
    * $view->get_url().
    *
    *
-   * @param $data
+   * @param object $data
    *   The query results for the row.
    *   The query results for the row.
    */
    */
-  function summary_argument($data) {
+  public function summary_argument($data) {
     return $data->{$this->base_alias};
     return $data->{$this->base_alias};
   }
   }
 
 
   /**
   /**
-   * Provides the name to use for the summary. By default this is just
-   * the name field.
+   * Provides the name to use for the summary.
+   *
+   * By default this is just the name field.
    *
    *
-   * @param $data
+   * @param object $data
    *   The query results for the row.
    *   The query results for the row.
+   *
+   * @return string
+   *   The summary.
    */
    */
-  function summary_name($data) {
+  public function summary_name($data) {
     $value = $data->{$this->name_alias};
     $value = $data->{$this->name_alias};
     if (empty($value) && !empty($this->definition['empty field name'])) {
     if (empty($value) && !empty($this->definition['empty field name'])) {
       $value = $this->definition['empty field name'];
       $value = $this->definition['empty field name'];
@@ -938,8 +1012,11 @@ class views_handler_argument extends views_handler {
    * Set up the query for this argument.
    * Set up the query for this argument.
    *
    *
    * The argument sent may be found at $this->argument.
    * The argument sent may be found at $this->argument.
+   *
+   * @param bool $group_by
+   *   Whether the query uses a group-by.
    */
    */
-  function query($group_by = FALSE) {
+  public function query($group_by = FALSE) {
     $this->ensure_my_table();
     $this->ensure_my_table();
     $this->query->add_where(0, "$this->table_alias.$this->real_field", $this->argument);
     $this->query->add_where(0, "$this->table_alias.$this->real_field", $this->argument);
   }
   }
@@ -949,15 +1026,17 @@ class views_handler_argument extends views_handler {
    *
    *
    * This usually needs to be overridden to provide a proper title.
    * This usually needs to be overridden to provide a proper title.
    */
    */
-  function title() {
+  public function title() {
     return check_plain($this->argument);
     return check_plain($this->argument);
   }
   }
 
 
   /**
   /**
-   * Called by the view object to get the title. This may be set by a
-   * validator so we don't necessarily call through to title().
+   * Called by the view object to get the title.
+   *
+   * This may be set by a validator so we don't necessarily call through to
+   * title().
    */
    */
-  function get_title() {
+  public function get_title() {
     if (isset($this->validated_title)) {
     if (isset($this->validated_title)) {
       return $this->validated_title;
       return $this->validated_title;
     }
     }
@@ -969,7 +1048,7 @@ class views_handler_argument extends views_handler {
   /**
   /**
    * Validate that this argument works. By default, all arguments are valid.
    * Validate that this argument works. By default, all arguments are valid.
    */
    */
-  function validate_arg($arg) {
+  public function validate_arg($arg) {
     // By using % in URLs, arguments could be validated twice; this eases
     // By using % in URLs, arguments could be validated twice; this eases
     // that pain.
     // that pain.
     if (isset($this->argument_validated)) {
     if (isset($this->argument_validated)) {
@@ -989,7 +1068,7 @@ class views_handler_argument extends views_handler {
       return $this->argument_validated = $plugin->validate_argument($arg);
       return $this->argument_validated = $plugin->validate_argument($arg);
     }
     }
 
 
-    // If the plugin isn't found, fall back to the basic validation path:
+    // If the plugin isn't found, fall back to the basic validation path.
     return $this->argument_validated = $this->validate_argument_basic($arg);
     return $this->argument_validated = $this->validate_argument_basic($arg);
   }
   }
 
 
@@ -997,10 +1076,10 @@ class views_handler_argument extends views_handler {
    * Called by the menu system to validate an argument.
    * Called by the menu system to validate an argument.
    *
    *
    * This checks to see if this is a 'soft fail', which means that if the
    * This checks to see if this is a 'soft fail', which means that if the
-   * argument fails to validate, but there is an action to take anyway,
-   * then validation cannot actually fail.
+   * argument fails to validate, but there is an action to take anyway, then
+   * validation cannot actually fail.
    */
    */
-  function validate_argument($arg) {
+  public function validate_argument($arg) {
     $validate_info = $this->default_actions($this->options['validate']['fail']);
     $validate_info = $this->default_actions($this->options['validate']['fail']);
     if (empty($validate_info['hard fail'])) {
     if (empty($validate_info['hard fail'])) {
       return TRUE;
       return TRUE;
@@ -1008,8 +1087,8 @@ class views_handler_argument extends views_handler {
 
 
     $rc = $this->validate_arg($arg);
     $rc = $this->validate_arg($arg);
 
 
-    // If the validator has changed the validate fail condition to a
-    // soft fail, deal with that:
+    // If the validator has changed the validate fail condition to a soft fail,
+    // deal with that.
     $validate_info = $this->default_actions($this->options['validate']['fail']);
     $validate_info = $this->default_actions($this->options['validate']['fail']);
     if (empty($validate_info['hard fail'])) {
     if (empty($validate_info['hard fail'])) {
       return TRUE;
       return TRUE;
@@ -1021,11 +1100,14 @@ class views_handler_argument extends views_handler {
   /**
   /**
    * Provide a basic argument validation.
    * Provide a basic argument validation.
    *
    *
-   * This can be overridden for more complex types; the basic
-   * validator only checks to see if the argument is not NULL
-   * or is numeric if the definition says it's numeric.
+   * This can be overridden for more complex types; the basic validator only
+   * checks to see if the argument is not NULL or is numeric if the definition
+   * says it's numeric.
+   *
+   * @return bool
+   *   Whether or not the argument validates.
    */
    */
-  function validate_argument_basic($arg) {
+  public function validate_argument_basic($arg) {
     if (!isset($arg) || $arg === '') {
     if (!isset($arg) || $arg === '') {
       return FALSE;
       return FALSE;
     }
     }
@@ -1038,19 +1120,23 @@ class views_handler_argument extends views_handler {
   }
   }
 
 
   /**
   /**
-   * Set the input for this argument
+   * Set the input for this argument.
    *
    *
-   * @return TRUE if it successfully validates; FALSE if it does not.
+   * @return bool
+   *   TRUE if it successfully validates; FALSE if it does not.
    */
    */
-  function set_argument($arg) {
+  public function set_argument($arg) {
     $this->argument = $arg;
     $this->argument = $arg;
     return $this->validate_arg($arg);
     return $this->validate_arg($arg);
   }
   }
 
 
   /**
   /**
    * Get the value of this argument.
    * Get the value of this argument.
+   *
+   * @return string
+   *   The value.
    */
    */
-  function get_value() {
+  public function get_value() {
     // If we already processed this argument, we're done.
     // If we already processed this argument, we're done.
     if (isset($this->argument)) {
     if (isset($this->argument)) {
       return $this->argument;
       return $this->argument;
@@ -1089,8 +1175,11 @@ class views_handler_argument extends views_handler {
    *
    *
    * Arguments can have styles for the summary view. This special export
    * Arguments can have styles for the summary view. This special export
    * handler makes sure this works properly.
    * handler makes sure this works properly.
+   *
+   * @return string
+   *   The export summary.
    */
    */
-  function export_summary($indent, $prefix, $storage, $option, $definition, $parents) {
+  public function export_summary($indent, $prefix, $storage, $option, $definition, $parents) {
     $output = '';
     $output = '';
     $name = $this->options['summary'][$option];
     $name = $this->options['summary'][$option];
     $options = $this->options['summary_options'];
     $options = $this->options['summary_options'];
@@ -1113,8 +1202,11 @@ class views_handler_argument extends views_handler {
    *
    *
    * Arguments use validation plugins. This special export handler makes sure
    * Arguments use validation plugins. This special export handler makes sure
    * this works properly.
    * this works properly.
+   *
+   * @return string
+   *   The validation response.
    */
    */
-  function export_validation($indent, $prefix, $storage, $option, $definition, $parents) {
+  public function export_validation($indent, $prefix, $storage, $option, $definition, $parents) {
     $output = '';
     $output = '';
     $name = $this->options['validate'][$option];
     $name = $this->options['validate'][$option];
     $options = $this->options['validate_options'];
     $options = $this->options['validate_options'];
@@ -1137,8 +1229,11 @@ class views_handler_argument extends views_handler {
    *
    *
    * Since style and validation plugins have their own export handlers, this
    * Since style and validation plugins have their own export handlers, this
    * one is currently only used for default argument plugins.
    * one is currently only used for default argument plugins.
+   *
+   * @return string
+   *   Export string.
    */
    */
-  function export_plugin($indent, $prefix, $storage, $option, $definition, $parents) {
+  public function export_plugin($indent, $prefix, $storage, $option, $definition, $parents) {
     $output = '';
     $output = '';
     if ($option == 'default_argument_type') {
     if ($option == 'default_argument_type') {
       $type = 'argument default';
       $type = 'argument default';
@@ -1162,28 +1257,30 @@ class views_handler_argument extends views_handler {
   /**
   /**
    * Get the display or row plugin, if it exists.
    * Get the display or row plugin, if it exists.
    */
    */
-  function get_plugin($type = 'argument default', $name = NULL) {
+  public function get_plugin($type = 'argument default', $name = NULL) {
     $options = array();
     $options = array();
     switch ($type) {
     switch ($type) {
       case 'argument default':
       case 'argument default':
         $plugin_name = $this->options['default_argument_type'];
         $plugin_name = $this->options['default_argument_type'];
         $options_name = 'default_argument_options';
         $options_name = 'default_argument_options';
         break;
         break;
+
       case 'argument validator':
       case 'argument validator':
         $plugin_name = $this->options['validate']['type'];
         $plugin_name = $this->options['validate']['type'];
         $options_name = 'validate_options';
         $options_name = 'validate_options';
         break;
         break;
+
       case 'style':
       case 'style':
         $plugin_name = $this->options['summary']['format'];
         $plugin_name = $this->options['summary']['format'];
         $options_name = 'summary_options';
         $options_name = 'summary_options';
+        break;
     }
     }
 
 
     if (!$name) {
     if (!$name) {
       $name = $plugin_name;
       $name = $plugin_name;
     }
     }
 
 
-    // we only fetch the options if we're fetching the plugin actually
-    // in use.
+    // We only fetch the options if we're fetching the plugin actually in use.
     if ($name == $plugin_name) {
     if ($name == $plugin_name) {
       $options = $this->options[$options_name];
       $options = $this->options[$options_name];
     }
     }
@@ -1206,10 +1303,14 @@ class views_handler_argument extends views_handler {
    *
    *
    * Subclasses should override this to specify what the default sort order of
    * Subclasses should override this to specify what the default sort order of
    * their argument is (e.g. alphabetical, numeric, date).
    * their argument is (e.g. alphabetical, numeric, date).
+   *
+   * @return string
+   *   The label for the sorter.
    */
    */
-  function get_sort_name() {
+  public function get_sort_name() {
     return t('Default sort', array(), array('context' => 'Sort order'));
     return t('Default sort', array(), array('context' => 'Sort order'));
   }
   }
+
 }
 }
 
 
 /**
 /**
@@ -1218,22 +1319,44 @@ class views_handler_argument extends views_handler {
  * @ingroup views_argument_handlers
  * @ingroup views_argument_handlers
  */
  */
 class views_handler_argument_broken extends views_handler_argument {
 class views_handler_argument_broken extends views_handler_argument {
-  function ui_name($short = FALSE) {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function ui_name($short = FALSE) {
     return t('Broken/missing handler');
     return t('Broken/missing handler');
   }
   }
 
 
-  function ensure_my_table() { /* No table to ensure! */ }
-  function query($group_by = FALSE) { /* No query to run */ }
-  function options_form(&$form, &$form_state) {
+  /**
+   * {@inheritdoc}
+   */
+  public function ensure_my_table() {
+    // No table to ensure!
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function query($group_by = FALSE) {
+    // No query to run.
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function options_form(&$form, &$form_state) {
     $form['markup'] = array(
     $form['markup'] = array(
       '#markup' => '<div class="form-item description">' . t('The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item.') . '</div>',
       '#markup' => '<div class="form-item description">' . t('The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item.') . '</div>',
     );
     );
   }
   }
 
 
   /**
   /**
-   * Determine if the handler is considered 'broken'
+   * {@inheritdoc}
    */
    */
-  function broken() { return TRUE; }
+  public function broken() {
+    return TRUE;
+  }
+
 }
 }
 
 
 /**
 /**

+ 35 - 18
sites/all/modules/views/handlers/views_handler_argument_date.inc

@@ -10,41 +10,54 @@
  *
  *
  * Adds an option to set a default argument based on the current date.
  * Adds an option to set a default argument based on the current date.
  *
  *
- * @param $arg_format
- *   The format string to use on the current time when
- *   creating a default date argument.
+ * @param string $arg_format
+ *   The format string to use on the current time when creating a default date
+ *   argument.
  *
  *
  * Definitions terms:
  * Definitions terms:
  * - many to one: If true, the "many to one" helper will be used.
  * - many to one: If true, the "many to one" helper will be used.
  * - invalid input: A string to give to the user for obviously invalid input.
  * - invalid input: A string to give to the user for obviously invalid input.
- *                  This is deprecated in favor of argument validators.
+ *   This is deprecated in favor of argument validators.
  *
  *
  * @see views_many_to_one_helper()
  * @see views_many_to_one_helper()
  *
  *
  * @ingroup views_argument_handlers
  * @ingroup views_argument_handlers
  */
  */
 class views_handler_argument_date extends views_handler_argument_formula {
 class views_handler_argument_date extends views_handler_argument_formula {
-  var $option_name = 'default_argument_date';
-  var $arg_format = 'Y-m-d';
+
+  /**
+   * @var string
+   */
+  public $option_name = 'default_argument_date';
+
+  /**
+   * @var string
+   */
+  public $arg_format = 'Y-m-d';
 
 
   /**
   /**
    * Add an option to set the default value to the current date.
    * Add an option to set the default value to the current date.
    */
    */
-  function default_argument_form(&$form, &$form_state) {
+  public function default_argument_form(&$form, &$form_state) {
     parent::default_argument_form($form, $form_state);
     parent::default_argument_form($form, $form_state);
     $form['default_argument_type']['#options'] += array('date' => t('Current date'));
     $form['default_argument_type']['#options'] += array('date' => t('Current date'));
     $form['default_argument_type']['#options'] += array('node_created' => t("Current node's creation time"));
     $form['default_argument_type']['#options'] += array('node_created' => t("Current node's creation time"));
-    $form['default_argument_type']['#options'] += array('node_changed' => t("Current node's update time"));  }
+    $form['default_argument_type']['#options'] += array('node_changed' => t("Current node's update time"));
+  }
 
 
   /**
   /**
-   * Set the empty argument value to the current date,
-   * formatted appropriately for this argument.
+   * Set the empty argument value to the current date.
+   *
+   * Formatted appropriately for this argument.
+   *
+   * @return string
+   *   The default argument.
    */
    */
-  function get_default_argument($raw = FALSE) {
+  public function get_default_argument($raw = FALSE) {
     if (!$raw && $this->options['default_argument_type'] == 'date') {
     if (!$raw && $this->options['default_argument_type'] == 'date') {
       return date($this->arg_format, REQUEST_TIME);
       return date($this->arg_format, REQUEST_TIME);
     }
     }
-    else if (!$raw && in_array($this->options['default_argument_type'], array('node_created', 'node_changed'))) {
+    elseif (!$raw && in_array($this->options['default_argument_type'], array('node_created', 'node_changed'))) {
       foreach (range(1, 3) as $i) {
       foreach (range(1, 3) as $i) {
         $node = menu_get_object('node', $i);
         $node = menu_get_object('node', $i);
         if (!empty($node)) {
         if (!empty($node)) {
@@ -71,11 +84,12 @@ class views_handler_argument_date extends views_handler_argument_formula {
   }
   }
 
 
   /**
   /**
-   * The date handler provides some default argument types, which aren't argument default plugins,
-   * so addapt the export mechanism.
+   * Adapt the export mechanism.
+   *
+   * The date handler provides some default argument types, which aren't
+   * argument default plugins.
    */
    */
-  function export_plugin($indent, $prefix, $storage, $option, $definition, $parents) {
-
+  public function export_plugin($indent, $prefix, $storage, $option, $definition, $parents) {
     // Only use a special behaviour for the special argument types, else just
     // Only use a special behaviour for the special argument types, else just
     // use the default behaviour.
     // use the default behaviour.
     if ($option == 'default_argument_type') {
     if ($option == 'default_argument_type') {
@@ -94,8 +108,11 @@ class views_handler_argument_date extends views_handler_argument_formula {
     return parent::export_plugin($indent, $prefix, $storage, $option, $definition, $parents);
     return parent::export_plugin($indent, $prefix, $storage, $option, $definition, $parents);
   }
   }
 
 
-
-  function get_sort_name() {
+  /**
+   * {@inheritdoc}
+   */
+  public function get_sort_name() {
     return t('Date', array(), array('context' => 'Sort order'));
     return t('Date', array(), array('context' => 'Sort order'));
   }
   }
+
 }
 }

+ 16 - 7
sites/all/modules/views/handlers/views_handler_argument_formula.inc

@@ -16,11 +16,16 @@
  * @ingroup views_argument_handlers
  * @ingroup views_argument_handlers
  */
  */
 class views_handler_argument_formula extends views_handler_argument {
 class views_handler_argument_formula extends views_handler_argument {
-  var $formula = NULL;
+
+  /**
+   *
+   */
+  public $formula = NULL;
+
   /**
   /**
-   * Constructor
+   * {@inheritdoc}
    */
    */
-  function construct() {
+  public function construct() {
     parent::construct();
     parent::construct();
 
 
     if (!empty($this->definition['formula'])) {
     if (!empty($this->definition['formula'])) {
@@ -28,14 +33,17 @@ class views_handler_argument_formula extends views_handler_argument {
     }
     }
   }
   }
 
 
-  function get_formula() {
+  /**
+   *
+   */
+  public function get_formula() {
     return str_replace('***table***', $this->table_alias, $this->formula);
     return str_replace('***table***', $this->table_alias, $this->formula);
   }
   }
 
 
   /**
   /**
    * Build the summary query based on a formula
    * Build the summary query based on a formula
    */
    */
-  function summary_query() {
+  public function summary_query() {
     $this->ensure_my_table();
     $this->ensure_my_table();
     // Now that our table is secure, get our formula.
     // Now that our table is secure, get our formula.
     $formula = $this->get_formula();
     $formula = $this->get_formula();
@@ -50,14 +58,15 @@ class views_handler_argument_formula extends views_handler_argument {
   /**
   /**
    * Build the query based upon the formula
    * Build the query based upon the formula
    */
    */
-  function query($group_by = FALSE) {
+  public function query($group_by = FALSE) {
     $this->ensure_my_table();
     $this->ensure_my_table();
     // Now that our table is secure, get our formula.
     // Now that our table is secure, get our formula.
     $placeholder = $this->placeholder();
     $placeholder = $this->placeholder();
-    $formula = $this->get_formula() .' = ' . $placeholder;
+    $formula = $this->get_formula() . ' = ' . $placeholder;
     $placeholders = array(
     $placeholders = array(
       $placeholder => $this->argument,
       $placeholder => $this->argument,
     );
     );
     $this->query->add_where(0, $formula, $placeholders, 'formula');
     $this->query->add_where(0, $formula, $placeholders, 'formula');
   }
   }
+
 }
 }

+ 15 - 4
sites/all/modules/views/handlers/views_handler_argument_group_by_numeric.inc

@@ -10,8 +10,12 @@
  *
  *
  * @ingroup views_argument_handlers
  * @ingroup views_argument_handlers
  */
  */
-class views_handler_argument_group_by_numeric extends views_handler_argument  {
-  function query($group_by = FALSE) {
+class views_handler_argument_group_by_numeric extends views_handler_argument {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function query($group_by = FALSE) {
     $this->ensure_my_table();
     $this->ensure_my_table();
     $field = $this->get_field();
     $field = $this->get_field();
     $placeholder = $this->placeholder();
     $placeholder = $this->placeholder();
@@ -19,11 +23,18 @@ class views_handler_argument_group_by_numeric extends views_handler_argument  {
     $this->query->add_having_expression(0, "$field = $placeholder", array($placeholder => $this->argument));
     $this->query->add_having_expression(0, "$field = $placeholder", array($placeholder => $this->argument));
   }
   }
 
 
-  function ui_name($short = FALSE) {
+  /**
+   * {@inheritdoc}
+   */
+  public function ui_name($short = FALSE) {
     return $this->get_field(parent::ui_name($short));
     return $this->get_field(parent::ui_name($short));
   }
   }
 
 
-  function get_sort_name() {
+  /**
+   * {@inheritdoc}
+   */
+  public function get_sort_name() {
     return t('Numerical', array(), array('context' => 'Sort order'));
     return t('Numerical', array(), array('context' => 'Sort order'));
   }
   }
+
 }
 }

+ 41 - 15
sites/all/modules/views/handlers/views_handler_argument_many_to_one.inc

@@ -6,29 +6,39 @@
  */
  */
 
 
 /**
 /**
- * An argument handler for use in fields that have a many to one relationship
- * with the table(s) to the left. This adds a bunch of options that are
- * reasonably common with this type of relationship.
+ * Argument handler for fields that have many-to-one table relationships.
+ *
+ * (i.e. with the table(s) to the left.)
+ * This adds a bunch of options that are reasonably common with this type of
+ * relationship.
+ *
  * Definition terms:
  * Definition terms:
  * - numeric: If true, the field will be considered numeric. Probably should
  * - numeric: If true, the field will be considered numeric. Probably should
  *   always be set TRUE as views_handler_argument_string has many to one
  *   always be set TRUE as views_handler_argument_string has many to one
  *   capabilities.
  *   capabilities.
- * - zero is null: If true, a 0 will be handled as empty, so for example
- *   a default argument can be provided or a summary can be shown.
+ * - zero is null: If true, a 0 will be handled as empty, so for example a
+ *   default argument can be provided or a summary can be shown.
  *
  *
  * @ingroup views_argument_handlers
  * @ingroup views_argument_handlers
  */
  */
 class views_handler_argument_many_to_one extends views_handler_argument {
 class views_handler_argument_many_to_one extends views_handler_argument {
-  function init(&$view, &$options) {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function init(&$view, &$options) {
     parent::init($view, $options);
     parent::init($view, $options);
     $this->helper = new views_many_to_one_helper($this);
     $this->helper = new views_many_to_one_helper($this);
 
 
-    // Ensure defaults for these, during summaries and stuff:
+    // Ensure defaults for these, during summaries and stuff.
     $this->operator = 'or';
     $this->operator = 'or';
     $this->value = array();
     $this->value = array();
   }
   }
 
 
-  function option_definition() {
+  /**
+   * {@inheritdoc}
+   */
+  public function option_definition() {
     $options = parent::option_definition();
     $options = parent::option_definition();
 
 
     if (!empty($this->definition['numeric'])) {
     if (!empty($this->definition['numeric'])) {
@@ -49,7 +59,10 @@ class views_handler_argument_many_to_one extends views_handler_argument {
     return $options;
     return $options;
   }
   }
 
 
-  function options_form(&$form, &$form_state) {
+  /**
+   * {@inheritdoc}
+   */
+  public function options_form(&$form, &$form_state) {
     parent::options_form($form, $form_state);
     parent::options_form($form, $form_state);
 
 
     // allow + for or, , for and
     // allow + for or, , for and
@@ -85,11 +98,14 @@ class views_handler_argument_many_to_one extends views_handler_argument {
    * Override ensure_my_table so we can control how this joins in.
    * Override ensure_my_table so we can control how this joins in.
    * The operator actually has influence over joining.
    * The operator actually has influence over joining.
    */
    */
-  function ensure_my_table() {
+  public function ensure_my_table() {
     $this->helper->ensure_my_table();
     $this->helper->ensure_my_table();
   }
   }
 
 
-  function query($group_by = FALSE) {
+  /**
+   * {@inheritdoc}
+   */
+  public function query($group_by = FALSE) {
     $empty = FALSE;
     $empty = FALSE;
     if (isset($this->definition['zero is null']) && $this->definition['zero is null']) {
     if (isset($this->definition['zero is null']) && $this->definition['zero is null']) {
       if (empty($this->argument)) {
       if (empty($this->argument)) {
@@ -118,7 +134,10 @@ class views_handler_argument_many_to_one extends views_handler_argument {
     $this->helper->add_filter();
     $this->helper->add_filter();
   }
   }
 
 
-  function title() {
+  /**
+   * {@inheritdoc}
+   */
+  public function title() {
     if (!$this->argument) {
     if (!$this->argument) {
       return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : t('Uncategorized');
       return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : t('Uncategorized');
     }
     }
@@ -144,7 +163,10 @@ class views_handler_argument_many_to_one extends views_handler_argument {
     return implode($this->operator == 'or' ? ' + ' : ', ', $this->title_query());
     return implode($this->operator == 'or' ? ' + ' : ', ', $this->title_query());
   }
   }
 
 
-  function summary_query() {
+  /**
+   * {@inheritdoc}
+   */
+  public function summary_query() {
     $field = $this->table . '.' . $this->field;
     $field = $this->table . '.' . $this->field;
     $join = $this->get_join();
     $join = $this->get_join();
 
 
@@ -167,7 +189,10 @@ class views_handler_argument_many_to_one extends views_handler_argument {
     return $this->summary_basics();
     return $this->summary_basics();
   }
   }
 
 
-  function summary_argument($data) {
+  /**
+   * {@inheritdoc}
+   */
+  public function summary_argument($data) {
     $value = $data->{$this->base_alias};
     $value = $data->{$this->base_alias};
     if (empty($value)) {
     if (empty($value)) {
       $value = 0;
       $value = 0;
@@ -179,7 +204,8 @@ class views_handler_argument_many_to_one extends views_handler_argument {
   /**
   /**
    * Override for specific title lookups.
    * Override for specific title lookups.
    */
    */
-  function title_query() {
+  public function title_query() {
     return $this->value;
     return $this->value;
   }
   }
+
 }
 }

+ 15 - 6
sites/all/modules/views/handlers/views_handler_argument_null.inc

@@ -11,7 +11,11 @@
  * @ingroup views_argument_handlers
  * @ingroup views_argument_handlers
  */
  */
 class views_handler_argument_null extends views_handler_argument {
 class views_handler_argument_null extends views_handler_argument {
-  function option_definition() {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function option_definition() {
     $options = parent::option_definition();
     $options = parent::option_definition();
     $options['must_not_be'] = array('default' => FALSE, 'bool' => TRUE);
     $options['must_not_be'] = array('default' => FALSE, 'bool' => TRUE);
     return $options;
     return $options;
@@ -21,7 +25,7 @@ class views_handler_argument_null extends views_handler_argument {
    * Override options_form() so that only the relevant options
    * Override options_form() so that only the relevant options
    * are displayed to the user.
    * are displayed to the user.
    */
    */
-  function options_form(&$form, &$form_state) {
+  public function options_form(&$form, &$form_state) {
     parent::options_form($form, $form_state);
     parent::options_form($form, $form_state);
     $form['must_not_be'] = array(
     $form['must_not_be'] = array(
       '#type' => 'checkbox',
       '#type' => 'checkbox',
@@ -38,9 +42,9 @@ class views_handler_argument_null extends views_handler_argument {
    * Override default_actions() to remove actions that don't
    * Override default_actions() to remove actions that don't
    * make sense for a null argument.
    * make sense for a null argument.
    */
    */
-  function default_actions($which = NULL) {
+  public function default_actions($which = NULL) {
     if ($which) {
     if ($which) {
-      if (in_array($which, array('ignore', 'not found', 'empty', 'default'))) {
+      if (in_array($which, array('ignore', 'not found', 'empty', 'default', 'access denied'))) {
         return parent::default_actions($which);
         return parent::default_actions($which);
       }
       }
       return;
       return;
@@ -51,7 +55,10 @@ class views_handler_argument_null extends views_handler_argument {
     return $actions;
     return $actions;
   }
   }
 
 
-  function validate_argument_basic($arg) {
+  /**
+   * {@inheritdoc}
+   */
+  public function validate_argument_basic($arg) {
     if (!empty($this->options['must_not_be'])) {
     if (!empty($this->options['must_not_be'])) {
       return !isset($arg);
       return !isset($arg);
     }
     }
@@ -63,5 +70,7 @@ class views_handler_argument_null extends views_handler_argument {
    * Override the behavior of query() to prevent the query
    * Override the behavior of query() to prevent the query
    * from being changed in any way.
    * from being changed in any way.
    */
    */
-  function query($group_by = FALSE) {}
+  public function query($group_by = FALSE) {
+  }
+
 }
 }

+ 29 - 10
sites/all/modules/views/handlers/views_handler_argument_numeric.inc

@@ -6,25 +6,30 @@
  */
  */
 
 
 /**
 /**
- * Basic argument handler for arguments that are numeric. Incorporates
- * break_phrase.
+ * Basic argument handler for arguments that are numeric.
+ *
+ * Incorporates break_phrase.
  *
  *
  * @ingroup views_argument_handlers
  * @ingroup views_argument_handlers
  */
  */
 class views_handler_argument_numeric extends views_handler_argument {
 class views_handler_argument_numeric extends views_handler_argument {
+
   /**
   /**
    * The operator used for the query: or|and.
    * The operator used for the query: or|and.
    * @var string
    * @var string
    */
    */
-  var $operator;
+  public $operator;
 
 
   /**
   /**
    * The actual value which is used for querying.
    * The actual value which is used for querying.
    * @var array
    * @var array
    */
    */
-  var $value;
+  public $value;
 
 
-  function option_definition() {
+  /**
+   * {@inheritdoc}
+   */
+  public function option_definition() {
     $options = parent::option_definition();
     $options = parent::option_definition();
 
 
     $options['break_phrase'] = array('default' => FALSE, 'bool' => TRUE);
     $options['break_phrase'] = array('default' => FALSE, 'bool' => TRUE);
@@ -33,7 +38,10 @@ class views_handler_argument_numeric extends views_handler_argument {
     return $options;
     return $options;
   }
   }
 
 
-  function options_form(&$form, &$form_state) {
+  /**
+   * {@inheritdoc}
+   */
+  public function options_form(&$form, &$form_state) {
     parent::options_form($form, $form_state);
     parent::options_form($form, $form_state);
 
 
     // allow + for or, , for and
     // allow + for or, , for and
@@ -54,7 +62,10 @@ class views_handler_argument_numeric extends views_handler_argument {
     );
     );
   }
   }
 
 
-  function title() {
+  /**
+   * {@inheritdoc}
+   */
+  public function title() {
     if (!$this->argument) {
     if (!$this->argument) {
       return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : t('Uncategorized');
       return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : t('Uncategorized');
     }
     }
@@ -80,14 +91,18 @@ class views_handler_argument_numeric extends views_handler_argument {
 
 
   /**
   /**
    * Override for specific title lookups.
    * Override for specific title lookups.
+   *
    * @return array
    * @return array
    *    Returns all titles, if it's just one title it's an array with one entry.
    *    Returns all titles, if it's just one title it's an array with one entry.
    */
    */
-  function title_query() {
+  public function title_query() {
     return $this->value;
     return $this->value;
   }
   }
 
 
-  function query($group_by = FALSE) {
+  /**
+   * {@inheritdoc}
+   */
+  public function query($group_by = FALSE) {
     $this->ensure_my_table();
     $this->ensure_my_table();
 
 
     if (!empty($this->options['break_phrase'])) {
     if (!empty($this->options['break_phrase'])) {
@@ -110,7 +125,11 @@ class views_handler_argument_numeric extends views_handler_argument {
     }
     }
   }
   }
 
 
-  function get_sort_name() {
+  /**
+   * {@inheritdoc}
+   */
+  public function get_sort_name() {
     return t('Numerical', array(), array('context' => 'Sort order'));
     return t('Numerical', array(), array('context' => 'Sort order'));
   }
   }
+
 }
 }

+ 49 - 22
sites/all/modules/views/handlers/views_handler_argument_string.inc

@@ -6,24 +6,30 @@
  */
  */
 
 
 /**
 /**
- * Basic argument handler to implement string arguments that may have length
- * limits.
+ * Argument handler to implement string arguments that may have length limits.
  *
  *
  * @ingroup views_argument_handlers
  * @ingroup views_argument_handlers
  */
  */
 class views_handler_argument_string extends views_handler_argument {
 class views_handler_argument_string extends views_handler_argument {
-  function init(&$view, &$options) {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function init(&$view, &$options) {
     parent::init($view, $options);
     parent::init($view, $options);
     if (!empty($this->definition['many to one'])) {
     if (!empty($this->definition['many to one'])) {
       $this->helper = new views_many_to_one_helper($this);
       $this->helper = new views_many_to_one_helper($this);
 
 
-      // Ensure defaults for these, during summaries and stuff:
+      // Ensure defaults for these, during summaries and stuff.
       $this->operator = 'or';
       $this->operator = 'or';
       $this->value = array();
       $this->value = array();
     }
     }
   }
   }
 
 
-  function option_definition() {
+  /**
+   * {@inheritdoc}
+   */
+  public function option_definition() {
     $options = parent::option_definition();
     $options = parent::option_definition();
 
 
     $options['glossary'] = array('default' => FALSE, 'bool' => TRUE);
     $options['glossary'] = array('default' => FALSE, 'bool' => TRUE);
@@ -32,6 +38,7 @@ class views_handler_argument_string extends views_handler_argument {
     $options['path_case'] = array('default' => 'none');
     $options['path_case'] = array('default' => 'none');
     $options['transform_dash'] = array('default' => FALSE, 'bool' => TRUE);
     $options['transform_dash'] = array('default' => FALSE, 'bool' => TRUE);
     $options['break_phrase'] = array('default' => FALSE, 'bool' => TRUE);
     $options['break_phrase'] = array('default' => FALSE, 'bool' => TRUE);
+    $options['not'] = array('default' => FALSE, 'bool' => TRUE);
 
 
     if (!empty($this->definition['many to one'])) {
     if (!empty($this->definition['many to one'])) {
       $options['add_table'] = array('default' => FALSE, 'bool' => TRUE);
       $options['add_table'] = array('default' => FALSE, 'bool' => TRUE);
@@ -41,7 +48,10 @@ class views_handler_argument_string extends views_handler_argument {
     return $options;
     return $options;
   }
   }
 
 
-  function options_form(&$form, &$form_state) {
+  /**
+   * {@inheritdoc}
+   */
+  public function options_form(&$form, &$form_state) {
     parent::options_form($form, $form_state);
     parent::options_form($form, $form_state);
 
 
     $form['glossary'] = array(
     $form['glossary'] = array(
@@ -123,12 +133,19 @@ class views_handler_argument_string extends views_handler_argument {
       '#default_value' => !empty($this->options['break_phrase']),
       '#default_value' => !empty($this->options['break_phrase']),
       '#fieldset' => 'more',
       '#fieldset' => 'more',
     );
     );
+    $form['not'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Exclude'),
+      '#description' => t('If selected, the numbers entered for the filter will be excluded rather than limiting the view.'),
+      '#default_value' => !empty($this->options['not']),
+      '#fieldset' => 'more',
+    );
   }
   }
 
 
   /**
   /**
-   * Build the summary query based on a string
+   * Build the summary query based on a string.
    */
    */
-  function summary_query() {
+  public function summary_query() {
     if (empty($this->definition['many to one'])) {
     if (empty($this->definition['many to one'])) {
       $this->ensure_my_table();
       $this->ensure_my_table();
     }
     }
@@ -157,14 +174,14 @@ class views_handler_argument_string extends views_handler_argument {
    *
    *
    * $this->ensure_my_table() MUST have been called prior to this.
    * $this->ensure_my_table() MUST have been called prior to this.
    */
    */
-  function get_formula() {
+  public function get_formula() {
     return "SUBSTRING($this->table_alias.$this->real_field, 1, " . intval($this->options['limit']) . ")";
     return "SUBSTRING($this->table_alias.$this->real_field, 1, " . intval($this->options['limit']) . ")";
   }
   }
 
 
   /**
   /**
    * Build the query based upon the formula
    * Build the query based upon the formula
    */
    */
-  function query($group_by = FALSE) {
+  public function query($group_by = FALSE) {
     $argument = $this->argument;
     $argument = $this->argument;
     if (!empty($this->options['transform_dash'])) {
     if (!empty($this->options['transform_dash'])) {
       $argument = strtr($argument, '-', ' ');
       $argument = strtr($argument, '-', ' ');
@@ -198,21 +215,19 @@ class views_handler_argument_string extends views_handler_argument {
     }
     }
 
 
     if (count($this->value) > 1) {
     if (count($this->value) > 1) {
-      $operator = 'IN';
+      $operator = empty($this->options['not']) ? 'IN' : 'NOT IN';
       $argument = $this->value;
       $argument = $this->value;
     }
     }
     else {
     else {
-      $operator = '=';
+      $operator = empty($this->options['not']) ? '=' : '!=';
     }
     }
 
 
     if ($formula) {
     if ($formula) {
       $placeholder = $this->placeholder();
       $placeholder = $this->placeholder();
-      if ($operator == 'IN') {
-        $field .= " IN($placeholder)";
-      }
-      else {
-        $field .= ' = ' . $placeholder;
+      if (count($this->value) > 1) {
+        $placeholder = "($placeholder)";
       }
       }
+      $field .= " $operator $placeholder";
       $placeholders = array(
       $placeholders = array(
         $placeholder => $argument,
         $placeholder => $argument,
       );
       );
@@ -223,7 +238,10 @@ class views_handler_argument_string extends views_handler_argument {
     }
     }
   }
   }
 
 
-  function summary_argument($data) {
+  /**
+   * {@inheritdoc}
+   */
+  public function summary_argument($data) {
     $value = $this->case_transform($data->{$this->base_alias}, $this->options['path_case']);
     $value = $this->case_transform($data->{$this->base_alias}, $this->options['path_case']);
     if (!empty($this->options['transform_dash'])) {
     if (!empty($this->options['transform_dash'])) {
       $value = strtr($value, ' ', '-');
       $value = strtr($value, ' ', '-');
@@ -231,11 +249,17 @@ class views_handler_argument_string extends views_handler_argument {
     return $value;
     return $value;
   }
   }
 
 
-  function get_sort_name() {
+  /**
+   * {@inheritdoc}
+   */
+  public function get_sort_name() {
     return t('Alphabetical', array(), array('context' => 'Sort order'));
     return t('Alphabetical', array(), array('context' => 'Sort order'));
   }
   }
 
 
-  function title() {
+  /**
+   * {@inheritdoc}
+   */
+  public function title() {
     $this->argument = $this->case_transform($this->argument, $this->options['case']);
     $this->argument = $this->case_transform($this->argument, $this->options['case']);
     if (!empty($this->options['transform_dash'])) {
     if (!empty($this->options['transform_dash'])) {
       $this->argument = strtr($this->argument, '-', ' ');
       $this->argument = strtr($this->argument, '-', ' ');
@@ -263,11 +287,14 @@ class views_handler_argument_string extends views_handler_argument {
   /**
   /**
    * Override for specific title lookups.
    * Override for specific title lookups.
    */
    */
-  function title_query() {
+  public function title_query() {
     return drupal_map_assoc($this->value, 'check_plain');
     return drupal_map_assoc($this->value, 'check_plain');
   }
   }
 
 
-  function summary_name($data) {
+  /**
+   * {@inheritdoc}
+   */
+  public function summary_name($data) {
     return $this->case_transform(parent::summary_name($data), $this->options['case']);
     return $this->case_transform(parent::summary_name($data), $this->options['case']);
   }
   }
 
 

+ 249 - 149
sites/all/modules/views/handlers/views_handler_field.inc

@@ -2,25 +2,26 @@
 
 
 /**
 /**
  * @file
  * @file
- * @todo.
+ * Definition of views_handler_field.
  */
  */
 
 
 /**
 /**
  * @defgroup views_field_handlers Views field handlers
  * @defgroup views_field_handlers Views field handlers
  * @{
  * @{
  * Handlers to tell Views how to build and display fields.
  * Handlers to tell Views how to build and display fields.
- *
  */
  */
 
 
 /**
 /**
  * Indicator of the render_text() method for rendering a single item.
  * Indicator of the render_text() method for rendering a single item.
- * (If no render_item() is present).
+ *
+ * If no render_item() is present.
  */
  */
 define('VIEWS_HANDLER_RENDER_TEXT_PHASE_SINGLE_ITEM', 0);
 define('VIEWS_HANDLER_RENDER_TEXT_PHASE_SINGLE_ITEM', 0);
 
 
 /**
 /**
  * Indicator of the render_text() method for rendering the whole element.
  * Indicator of the render_text() method for rendering the whole element.
- * (if no render_item() method is available).
+ *
+ * if no render_item() method is available.
  */
  */
 define('VIEWS_HANDLER_RENDER_TEXT_PHASE_COMPLETELY', 1);
 define('VIEWS_HANDLER_RENDER_TEXT_PHASE_COMPLETELY', 1);
 
 
@@ -34,17 +35,29 @@ define('VIEWS_HANDLER_RENDER_TEXT_PHASE_EMPTY', 2);
  *
  *
  * Definition terms:
  * Definition terms:
  * - additional fields: An array of fields that should be added to the query
  * - additional fields: An array of fields that should be added to the query
- *                      for some purpose. The array is in the form of:
- *                      array('identifier' => array('table' => tablename,
- *                      'field' => fieldname); as many fields as are necessary
- *                      may be in this array.
+ *   for some purpose. The array is in the form of:
+ *   array(
+ *     'identifier' => array(
+ *       'table' => tablename,
+ *       'field' => fieldname,
+ *     )
+ *   );
+ *   with as many fields as are necessary may be in this array.
  * - click sortable: If TRUE, this field may be click sorted.
  * - click sortable: If TRUE, this field may be click sorted.
  *
  *
  * @ingroup views_field_handlers
  * @ingroup views_field_handlers
  */
  */
 class views_handler_field extends views_handler {
 class views_handler_field extends views_handler {
-  var $field_alias = 'unknown';
-  var $aliases = array();
+
+  /**
+   *
+   */
+  public $field_alias = 'unknown';
+
+  /**
+   *
+   */
+  public $aliases = array();
 
 
   /**
   /**
    * The field value prior to any rewriting.
    * The field value prior to any rewriting.
@@ -55,15 +68,15 @@ class views_handler_field extends views_handler {
 
 
   /**
   /**
    * @var array
    * @var array
-   * Stores additional fields which get's added to the query.
+   * Stores additional fields which get added to the query.
    * The generated aliases are stored in $aliases.
    * The generated aliases are stored in $aliases.
    */
    */
-  var $additional_fields = array();
+  public $additional_fields = array();
 
 
   /**
   /**
    * Construct a new field handler.
    * Construct a new field handler.
    */
    */
-  function construct() {
+  public function construct() {
     parent::construct();
     parent::construct();
 
 
     $this->additional_fields = array();
     $this->additional_fields = array();
@@ -79,21 +92,24 @@ class views_handler_field extends views_handler {
   /**
   /**
    * Determine if this field can allow advanced rendering.
    * Determine if this field can allow advanced rendering.
    *
    *
-   * Fields can set this to FALSE if they do not wish to allow
-   * token based rewriting or link-making.
+   * Fields can set this to FALSE if they do not wish to allow token based
+   * rewriting or link-making.
    */
    */
-  function allow_advanced_render() {
+  public function allow_advanced_render() {
     return TRUE;
     return TRUE;
   }
   }
 
 
-  function init(&$view, &$options) {
+  /**
+   * {@inheritdoc}
+   */
+  public function init(&$view, &$options) {
     parent::init($view, $options);
     parent::init($view, $options);
   }
   }
 
 
   /**
   /**
    * Called to add the field to a query.
    * Called to add the field to a query.
    */
    */
-  function query() {
+  public function query() {
     $this->ensure_my_table();
     $this->ensure_my_table();
     // Add the field.
     // Add the field.
     $params = $this->options['group_type'] != 'group' ? array('function' => $this->options['group_type']) : array();
     $params = $this->options['group_type'] != 'group' ? array('function' => $this->options['group_type']) : array();
@@ -105,16 +121,15 @@ class views_handler_field extends views_handler {
   /**
   /**
    * Add 'additional' fields to the query.
    * Add 'additional' fields to the query.
    *
    *
-   * @param $fields
-   * An array of fields. The key is an identifier used to later find the
-   * field alias used. The value is either a string in which case it's
-   * assumed to be a field on this handler's table; or it's an array in the
-   * form of
-   * @code array('table' => $tablename, 'field' => $fieldname) @endcode
+   * @param array $fields
+   *   An array of fields. The key is an identifier used to later find the field
+   *   alias used. The value is either a string in which case it's assumed to be
+   *   a field on this handler's table; or it's an array in the form of
+   *   @code array('table' => $tablename, 'field' => $fieldname) @endcode
    */
    */
-  function add_additional_fields($fields = NULL) {
+  public function add_additional_fields($fields = NULL) {
     if (!isset($fields)) {
     if (!isset($fields)) {
-      // notice check
+      // Notice check.
       if (empty($this->additional_fields)) {
       if (empty($this->additional_fields)) {
         return;
         return;
       }
       }
@@ -139,7 +154,12 @@ class views_handler_field extends views_handler {
           }
           }
 
 
           if (empty($table_alias)) {
           if (empty($table_alias)) {
-            debug(t('Handler @handler tried to add additional_field @identifier but @table could not be added!', array('@handler' => $this->definition['handler'], '@identifier' => $identifier, '@table' => $info['table'])));
+            $t_args = array(
+              '@handler' => $this->definition['handler'],
+              '@identifier' => $identifier,
+              '@table' => $info['table'],
+            );
+            debug(t('Handler @handler tried to add additional_field @identifier but @table could not be added!', $t_args));
             $this->aliases[$identifier] = 'broken';
             $this->aliases[$identifier] = 'broken';
             continue;
             continue;
           }
           }
@@ -162,7 +182,7 @@ class views_handler_field extends views_handler {
   /**
   /**
    * Called to determine what to tell the clicksorter.
    * Called to determine what to tell the clicksorter.
    */
    */
-  function click_sort($order) {
+  public function click_sort($order) {
     if (isset($this->field_alias)) {
     if (isset($this->field_alias)) {
       // Since fields should always have themselves already added, just
       // Since fields should always have themselves already added, just
       // add a sort on the field.
       // add a sort on the field.
@@ -174,14 +194,14 @@ class views_handler_field extends views_handler {
   /**
   /**
    * Determine if this field is click sortable.
    * Determine if this field is click sortable.
    */
    */
-  function click_sortable() {
+  public function click_sortable() {
     return !empty($this->definition['click sortable']);
     return !empty($this->definition['click sortable']);
   }
   }
 
 
   /**
   /**
    * Get this field's label.
    * Get this field's label.
    */
    */
-  function label() {
+  public function label() {
     if (!isset($this->options['label'])) {
     if (!isset($this->options['label'])) {
       return '';
       return '';
     }
     }
@@ -191,7 +211,7 @@ class views_handler_field extends views_handler {
   /**
   /**
    * Return an HTML element based upon the field's element type.
    * Return an HTML element based upon the field's element type.
    */
    */
-  function element_type($none_supported = FALSE, $default_empty = FALSE, $inline = FALSE) {
+  public function element_type($none_supported = FALSE, $default_empty = FALSE, $inline = FALSE) {
     if ($none_supported) {
     if ($none_supported) {
       if ($this->options['element_type'] === '0') {
       if ($this->options['element_type'] === '0') {
         return '';
         return '';
@@ -219,7 +239,7 @@ class views_handler_field extends views_handler {
   /**
   /**
    * Return an HTML element for the label based upon the field's element type.
    * Return an HTML element for the label based upon the field's element type.
    */
    */
-  function element_label_type($none_supported = FALSE, $default_empty = FALSE) {
+  public function element_label_type($none_supported = FALSE, $default_empty = FALSE) {
     if ($none_supported) {
     if ($none_supported) {
       if ($this->options['element_label_type'] === '0') {
       if ($this->options['element_label_type'] === '0') {
         return '';
         return '';
@@ -239,7 +259,7 @@ class views_handler_field extends views_handler {
   /**
   /**
    * Return an HTML element for the wrapper based upon the field's element type.
    * Return an HTML element for the wrapper based upon the field's element type.
    */
    */
-  function element_wrapper_type($none_supported = FALSE, $default_empty = FALSE) {
+  public function element_wrapper_type($none_supported = FALSE, $default_empty = FALSE) {
     if ($none_supported) {
     if ($none_supported) {
       if ($this->options['element_wrapper_type'] === '0') {
       if ($this->options['element_wrapper_type'] === '0') {
         return 0;
         return 0;
@@ -259,11 +279,10 @@ class views_handler_field extends views_handler {
   /**
   /**
    * Provide a list of elements valid for field HTML.
    * Provide a list of elements valid for field HTML.
    *
    *
-   * This function can be overridden by fields that want more or fewer
-   * elements available, though this seems like it would be an incredibly
-   * rare occurence.
+   * This function can be overridden by fields that want more or fewer elements
+   * available, though this seems like it would be an incredibly rare occurence.
    */
    */
-  function get_elements() {
+  public function get_elements() {
     static $elements = NULL;
     static $elements = NULL;
     if (!isset($elements)) {
     if (!isset($elements)) {
       $elements = variable_get('views_field_rewrite_elements', array(
       $elements = variable_get('views_field_rewrite_elements', array(
@@ -289,7 +308,7 @@ class views_handler_field extends views_handler {
   /**
   /**
    * Return the class of the field.
    * Return the class of the field.
    */
    */
-  function element_classes($row_index = NULL) {
+  public function element_classes($row_index = NULL) {
     $classes = explode(' ', $this->options['element_class']);
     $classes = explode(' ', $this->options['element_class']);
     foreach ($classes as &$class) {
     foreach ($classes as &$class) {
       $class = $this->tokenize_value($class, $row_index);
       $class = $this->tokenize_value($class, $row_index);
@@ -304,15 +323,14 @@ class views_handler_field extends views_handler {
    * This function actually figures out which field was last and uses its
    * This function actually figures out which field was last and uses its
    * tokens so they will all be available.
    * tokens so they will all be available.
    */
    */
-  function tokenize_value($value, $row_index = NULL) {
+  public function tokenize_value($value, $row_index = NULL) {
     if (strpos($value, '[') !== FALSE || strpos($value, '!') !== FALSE || strpos($value, '%') !== FALSE) {
     if (strpos($value, '[') !== FALSE || strpos($value, '!') !== FALSE || strpos($value, '%') !== FALSE) {
       $fake_item = array(
       $fake_item = array(
         'alter_text' => TRUE,
         'alter_text' => TRUE,
         'text' => $value,
         'text' => $value,
       );
       );
 
 
-      // Use isset() because empty() will trigger on 0 and 0 is
-      // the first row.
+      // Use isset() because empty() will trigger on 0 and 0 is the first row.
       if (isset($row_index) && isset($this->view->style_plugin->render_tokens[$row_index])) {
       if (isset($row_index) && isset($this->view->style_plugin->render_tokens[$row_index])) {
         $tokens = $this->view->style_plugin->render_tokens[$row_index];
         $tokens = $this->view->style_plugin->render_tokens[$row_index];
       }
       }
@@ -339,7 +357,7 @@ class views_handler_field extends views_handler {
   /**
   /**
    * Return the class of the field's label.
    * Return the class of the field's label.
    */
    */
-  function element_label_classes($row_index = NULL) {
+  public function element_label_classes($row_index = NULL) {
     $classes = explode(' ', $this->options['element_label_class']);
     $classes = explode(' ', $this->options['element_label_class']);
     foreach ($classes as &$class) {
     foreach ($classes as &$class) {
       $class = $this->tokenize_value($class, $row_index);
       $class = $this->tokenize_value($class, $row_index);
@@ -351,7 +369,7 @@ class views_handler_field extends views_handler {
   /**
   /**
    * Return the class of the field's wrapper.
    * Return the class of the field's wrapper.
    */
    */
-  function element_wrapper_classes($row_index = NULL) {
+  public function element_wrapper_classes($row_index = NULL) {
     $classes = explode(' ', $this->options['element_wrapper_class']);
     $classes = explode(' ', $this->options['element_wrapper_class']);
     foreach ($classes as &$class) {
     foreach ($classes as &$class) {
       $class = $this->tokenize_value($class, $row_index);
       $class = $this->tokenize_value($class, $row_index);
@@ -366,12 +384,12 @@ class views_handler_field extends views_handler {
    * This api exists so that other modules can easy set the values of the field
    * This api exists so that other modules can easy set the values of the field
    * without having the need to change the render method as well.
    * without having the need to change the render method as well.
    *
    *
-   * @param $values
+   * @param object $values
    *   An object containing all retrieved values.
    *   An object containing all retrieved values.
-   * @param $field
+   * @param string $field
    *   Optional name of the field where the value is stored.
    *   Optional name of the field where the value is stored.
    */
    */
-  function get_value($values, $field = NULL) {
+  public function get_value($values, $field = NULL) {
     $alias = isset($field) ? $this->aliases[$field] : $this->field_alias;
     $alias = isset($field) ? $this->aliases[$field] : $this->field_alias;
     if (isset($values->{$alias})) {
     if (isset($values->{$alias})) {
       return $values->{$alias};
       return $values->{$alias};
@@ -383,13 +401,16 @@ class views_handler_field extends views_handler {
    * by in the style settings.
    * by in the style settings.
    *
    *
    * @return bool
    * @return bool
-   *  TRUE if this field handler is groupable, otherwise FALSE.
+   *   TRUE if this field handler is groupable, otherwise FALSE.
    */
    */
-  function use_string_group_by() {
+  public function use_string_group_by() {
     return TRUE;
     return TRUE;
   }
   }
 
 
-  function option_definition() {
+  /**
+   * {@inheritdoc}
+   */
+  public function option_definition() {
     $options = parent::option_definition();
     $options = parent::option_definition();
 
 
     $options['label'] = array('default' => $this->definition['title'], 'translatable' => TRUE);
     $options['label'] = array('default' => $this->definition['title'], 'translatable' => TRUE);
@@ -403,6 +424,7 @@ class views_handler_field extends views_handler {
         'absolute' => array('default' => FALSE, 'bool' => TRUE),
         'absolute' => array('default' => FALSE, 'bool' => TRUE),
         'external' => array('default' => FALSE, 'bool' => TRUE),
         'external' => array('default' => FALSE, 'bool' => TRUE),
         'replace_spaces' => array('default' => FALSE, 'bool' => TRUE),
         'replace_spaces' => array('default' => FALSE, 'bool' => TRUE),
+        'unwanted_characters' => array('default' => ''),
         'path_case' => array('default' => 'none', 'translatable' => FALSE),
         'path_case' => array('default' => 'none', 'translatable' => FALSE),
         'trim_whitespace' => array('default' => FALSE, 'bool' => TRUE),
         'trim_whitespace' => array('default' => FALSE, 'bool' => TRUE),
         'alt' => array('default' => '', 'translatable' => TRUE),
         'alt' => array('default' => '', 'translatable' => TRUE),
@@ -447,10 +469,19 @@ class views_handler_field extends views_handler {
   /**
   /**
    * Performs some cleanup tasks on the options array before saving it.
    * Performs some cleanup tasks on the options array before saving it.
    */
    */
-  function options_submit(&$form, &$form_state) {
+  public function options_submit(&$form, &$form_state) {
     $options = &$form_state['values']['options'];
     $options = &$form_state['values']['options'];
-    $types = array('element_type', 'element_label_type', 'element_wrapper_type');
-    $classes = array_combine(array('element_class', 'element_label_class', 'element_wrapper_class'), $types);
+    $types = array(
+      'element_type',
+      'element_label_type',
+      'element_wrapper_type',
+    );
+    $base_types = array(
+      'element_class',
+      'element_label_class',
+      'element_wrapper_class',
+    );
+    $classes = array_combine($base_types, $types);
 
 
     foreach ($types as $type) {
     foreach ($types as $type) {
       if (!$options[$type . '_enable']) {
       if (!$options[$type . '_enable']) {
@@ -471,10 +502,9 @@ class views_handler_field extends views_handler {
   }
   }
 
 
   /**
   /**
-   * Default options form that provides the label widget that all fields
-   * should have.
+   * Default options form provides the label widget that all fields should have.
    */
    */
-  function options_form(&$form, &$form_state) {
+  public function options_form(&$form, &$form_state) {
     parent::options_form($form, $form_state);
     parent::options_form($form, $form_state);
 
 
     $label = $this->label();
     $label = $this->label();
@@ -581,7 +611,7 @@ class views_handler_field extends views_handler {
       '#type' => 'checkbox',
       '#type' => 'checkbox',
       '#title' => t('Create a CSS class'),
       '#title' => t('Create a CSS class'),
       '#dependency' => array(
       '#dependency' => array(
-        'edit-options-element-label-type-enable' => array(1)
+        'edit-options-element-label-type-enable' => array(1),
       ),
       ),
       '#default_value' => !empty($this->options['element_label_class']) || (string) $this->options['element_label_class'] == '0',
       '#default_value' => !empty($this->options['element_label_class']) || (string) $this->options['element_label_class'] == '0',
       '#fieldset' => 'style_settings',
       '#fieldset' => 'style_settings',
@@ -703,7 +733,7 @@ class views_handler_field extends views_handler {
         '#title' => t('Replace spaces with dashes'),
         '#title' => t('Replace spaces with dashes'),
         '#default_value' => $this->options['alter']['replace_spaces'],
         '#default_value' => $this->options['alter']['replace_spaces'],
         '#dependency' => array(
         '#dependency' => array(
-          'edit-options-alter-make-link' => array(1)
+          'edit-options-alter-make-link' => array(1),
         ),
         ),
       );
       );
       $form['alter']['external'] = array(
       $form['alter']['external'] = array(
@@ -715,6 +745,16 @@ class views_handler_field extends views_handler {
           'edit-options-alter-make-link' => array(1),
           'edit-options-alter-make-link' => array(1),
         ),
         ),
       );
       );
+      $form['alter']['unwanted_characters'] = array(
+        '#type' => 'textfield',
+        '#title' => t('Remove unwanted characters'),
+        '#description' => t('Space-separated list of characters to remove from the URL path'),
+        '#default_value' => $this->options['alter']['unwanted_characters'],
+        '#dependency' => array(
+          'edit-options-alter-make-link' => array(1)
+        ),
+        '#maxlength' => 255,
+      );
       $form['alter']['path_case'] = array(
       $form['alter']['path_case'] = array(
         '#type' => 'select',
         '#type' => 'select',
         '#title' => t('Transform the case'),
         '#title' => t('Transform the case'),
@@ -722,7 +762,7 @@ class views_handler_field extends views_handler {
         '#dependency' => array(
         '#dependency' => array(
           'edit-options-alter-make-link' => array(1),
           'edit-options-alter-make-link' => array(1),
         ),
         ),
-       '#options' => array(
+        '#options' => array(
           'none' => t('No transform'),
           'none' => t('No transform'),
           'upper' => t('Upper case'),
           'upper' => t('Upper case'),
           'lower' => t('Lower case'),
           'lower' => t('Lower case'),
@@ -753,7 +793,7 @@ class views_handler_field extends views_handler {
         '#title' => t('Rel Text'),
         '#title' => t('Rel Text'),
         '#type' => 'textfield',
         '#type' => 'textfield',
         '#default_value' => $this->options['alter']['rel'],
         '#default_value' => $this->options['alter']['rel'],
-        '#description' => t('Include Rel attribute for use in lightbox2 or other javascript utility.'),
+        '#description' => t('Include Rel attribute for use in lightbox2 or other JavaScript utility.'),
         '#dependency' => array(
         '#dependency' => array(
           'edit-options-alter-make-link' => array(1),
           'edit-options-alter-make-link' => array(1),
         ),
         ),
@@ -796,7 +836,8 @@ class views_handler_field extends views_handler {
           break;
           break;
         }
         }
       }
       }
-      $count = 0; // This lets us prepare the key as we want it printed.
+      // This lets us prepare the key as we want it printed.
+      $count = 0;
       foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) {
       foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) {
         $options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->ui_name()));
         $options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->ui_name()));
         $options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->ui_name()));
         $options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->ui_name()));
@@ -819,15 +860,15 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
             $output .= theme('item_list',
             $output .= theme('item_list',
               array(
               array(
                 'items' => $items,
                 'items' => $items,
-                'type' => $type
+                'type' => $type,
               ));
               ));
           }
           }
         }
         }
       }
       }
       // This construct uses 'hidden' and not markup because process doesn't
       // This construct uses 'hidden' and not markup because process doesn't
-      // run. It also has an extra div because the dependency wants to hide
-      // the parent in situations like this, so we need a second div to
-      // make this work.
+      // run. It also has an extra div because the dependency wants to hide the
+      // parent in situations like this, so we need a second div to make this
+      // work.
       $form['alter']['help'] = array(
       $form['alter']['help'] = array(
         '#type' => 'fieldset',
         '#type' => 'fieldset',
         '#title' => t('Replacement patterns'),
         '#title' => t('Replacement patterns'),
@@ -997,28 +1038,29 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
   /**
   /**
    * Provide extra data to the administration form
    * Provide extra data to the administration form
    */
    */
-  function admin_summary() {
+  public function admin_summary() {
     return $this->label();
     return $this->label();
   }
   }
 
 
   /**
   /**
    * Run before any fields are rendered.
    * Run before any fields are rendered.
    *
    *
-   * This gives the handlers some time to set up before any handler has
-   * been rendered.
+   * This gives the handlers some time to set up before any handler has been
+   * rendered.
    *
    *
-   * @param $values
+   * @param array $values
    *   An array of all objects returned from the query.
    *   An array of all objects returned from the query.
    */
    */
-  function pre_render(&$values) { }
+  public function pre_render(&$values) {
+  }
 
 
   /**
   /**
    * Render the field.
    * Render the field.
    *
    *
-   * @param $values
+   * @param array $values
    *   The values retrieved from the database.
    *   The values retrieved from the database.
    */
    */
-  function render($values) {
+  public function render($values) {
     $value = $this->get_value($values);
     $value = $this->get_value($values);
     return $this->sanitize_value($value);
     return $this->sanitize_value($value);
   }
   }
@@ -1029,7 +1071,7 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
    * This renders a field normally, then decides if render-as-link and
    * This renders a field normally, then decides if render-as-link and
    * text-replacement rendering is necessary.
    * text-replacement rendering is necessary.
    */
    */
-  function advanced_render($values) {
+  public function advanced_render($values) {
     if ($this->allow_advanced_render() && method_exists($this, 'render_item')) {
     if ($this->allow_advanced_render() && method_exists($this, 'render_item')) {
       $raw_items = $this->get_items($values);
       $raw_items = $this->get_items($values);
       // If there are no items, set the original value to NULL.
       // If there are no items, set the original value to NULL.
@@ -1094,7 +1136,7 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
   /**
   /**
    * Checks if a field value is empty.
    * Checks if a field value is empty.
    *
    *
-   * @param $value
+   * @param mixed $value
    *   The field value.
    *   The field value.
    * @param bool $empty_zero
    * @param bool $empty_zero
    *   Whether or not this field is configured to consider 0 as empty.
    *   Whether or not this field is configured to consider 0 as empty.
@@ -1102,9 +1144,9 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
    *   Whether or not to use empty() to check the value.
    *   Whether or not to use empty() to check the value.
    *
    *
    * @return bool
    * @return bool
-   * TRUE if the value is considered empty, FALSE otherwise.
+   *   TRUE if the value is considered empty, FALSE otherwise.
    */
    */
-  function is_value_empty($value, $empty_zero, $no_skip_empty = TRUE) {
+  public function is_value_empty($value, $empty_zero, $no_skip_empty = TRUE) {
     if (!isset($value)) {
     if (!isset($value)) {
       $empty = TRUE;
       $empty = TRUE;
     }
     }
@@ -1124,7 +1166,7 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
    * This is separated out as some fields may render lists, and this allows
    * This is separated out as some fields may render lists, and this allows
    * each item to be handled individually.
    * each item to be handled individually.
    */
    */
-  function render_text($alter) {
+  public function render_text($alter) {
     $value = $this->last_render;
     $value = $this->last_render;
 
 
     if (!empty($alter['alter_text']) && $alter['text'] !== '') {
     if (!empty($alter['alter_text']) && $alter['text'] !== '') {
@@ -1139,9 +1181,10 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
     // Check if there should be no further rewrite for empty values.
     // Check if there should be no further rewrite for empty values.
     $no_rewrite_for_empty = $this->options['hide_alter_empty'] && $this->is_value_empty($this->original_value, $this->options['empty_zero']);
     $no_rewrite_for_empty = $this->options['hide_alter_empty'] && $this->is_value_empty($this->original_value, $this->options['empty_zero']);
 
 
-    // Check whether the value is empty and return nothing, so the field isn't rendered.
-    // First check whether the field should be hidden if the value(hide_alter_empty = TRUE) /the rewrite is empty (hide_alter_empty = FALSE).
-    // For numeric values you can specify whether "0"/0 should be empty.
+    // Check whether the value is empty and return nothing, so the field isn't
+    // rendered. First check whether the field should be hidden if the
+    // value(hide_alter_empty = TRUE) /the rewrite is empty (hide_alter_empty =
+    // FALSE). For numeric values you can specify whether "0"/0 should be empty.
     if ((($this->options['hide_empty'] && empty($value))
     if ((($this->options['hide_empty'] && empty($value))
         || ($alter['phase'] != VIEWS_HANDLER_RENDER_TEXT_PHASE_EMPTY && $no_rewrite_for_empty))
         || ($alter['phase'] != VIEWS_HANDLER_RENDER_TEXT_PHASE_EMPTY && $no_rewrite_for_empty))
       && $this->is_value_empty($value, $this->options['empty_zero'], FALSE)) {
       && $this->is_value_empty($value, $this->options['empty_zero'], FALSE)) {
@@ -1169,7 +1212,8 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
         $more_link_path = $this->options['alter']['more_link_path'];
         $more_link_path = $this->options['alter']['more_link_path'];
         $more_link_path = strip_tags(decode_entities(strtr($more_link_path, $tokens)));
         $more_link_path = strip_tags(decode_entities(strtr($more_link_path, $tokens)));
 
 
-        // Take sure that paths which was runned through url() does work as well.
+        // Take sure that paths which was runned through url() does work as
+        // well.
         $base_path = base_path();
         $base_path = base_path();
         // Checks whether the path starts with the base_path.
         // Checks whether the path starts with the base_path.
         if (strpos($more_link_path, $base_path) === 0) {
         if (strpos($more_link_path, $base_path) === 0) {
@@ -1189,7 +1233,7 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
 
 
     if (!empty($alter['make_link']) && !empty($alter['path'])) {
     if (!empty($alter['make_link']) && !empty($alter['path'])) {
       if (!isset($tokens)) {
       if (!isset($tokens)) {
-       $tokens = $this->get_render_tokens($alter);
+        $tokens = $this->get_render_tokens($alter);
       }
       }
       $value = $this->render_as_link($alter, $value, $tokens);
       $value = $this->render_as_link($alter, $value, $tokens);
     }
     }
@@ -1200,9 +1244,10 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
   /**
   /**
    * Render this field as altered text, from a fieldset set by the user.
    * Render this field as altered text, from a fieldset set by the user.
    */
    */
-  function render_altered($alter, $tokens) {
-    // Filter this right away as our substitutions are already sanitized.
-    $value = filter_xss_admin($alter['text']);
+  public function render_altered($alter, $tokens) {
+    // We trust admins so we allow any tag content. This is important for
+    // displays such as XML where we should not mess with tags.
+    $value = $alter['text'];
     $value = strtr($value, $tokens);
     $value = strtr($value, $tokens);
 
 
     return $value;
     return $value;
@@ -1211,21 +1256,20 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
   /**
   /**
    * Trim the field down to the specified length.
    * Trim the field down to the specified length.
    */
    */
-  function render_trim_text($alter, $value) {
+  public function render_trim_text($alter, $value) {
     if (!empty($alter['strip_tags'])) {
     if (!empty($alter['strip_tags'])) {
       // NOTE: It's possible that some external fields might override the
       // NOTE: It's possible that some external fields might override the
-      // element type so if someone from, say, CCK runs into a bug here,
-      // this may be why =)
+      // element type so if someone from, say, CCK runs into a bug here, this
+      // may be why =)
       $this->definition['element type'] = 'span';
       $this->definition['element type'] = 'span';
     }
     }
     return views_trim_text($alter, $value);
     return views_trim_text($alter, $value);
   }
   }
 
 
   /**
   /**
-   * Render this field as a link, with the info from a fieldset set by
-   * the user.
+   * Render this field as a link, with info from a fieldset set by the user.
    */
    */
-  function render_as_link($alter, $text, $tokens) {
+  public function render_as_link($alter, $text, $tokens) {
     $value = '';
     $value = '';
 
 
     if (!empty($alter['prefix'])) {
     if (!empty($alter['prefix'])) {
@@ -1243,9 +1287,9 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
 
 
     // strip_tags() removes <front>, so check whether its different to front.
     // strip_tags() removes <front>, so check whether its different to front.
     if ($path != '<front>') {
     if ($path != '<front>') {
-      // Use strip tags as there should never be HTML in the path.
-      // However, we need to preserve special characters like " that
-      // were removed by check_plain().
+      // Use strip tags as there should never be HTML in the path. However, we
+      // need to preserve special characters like " that were removed by
+      // check_plain().
       $path = strip_tags(decode_entities(strtr($path, $tokens)));
       $path = strip_tags(decode_entities(strtr($path, $tokens)));
 
 
       if (!empty($alter['path_case']) && $alter['path_case'] != 'none') {
       if (!empty($alter['path_case']) && $alter['path_case'] != 'none') {
@@ -1255,6 +1299,12 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
       if (!empty($alter['replace_spaces'])) {
       if (!empty($alter['replace_spaces'])) {
         $path = str_replace(' ', '-', $path);
         $path = str_replace(' ', '-', $path);
       }
       }
+
+      if (!empty($alter['unwanted_characters'])) {
+        foreach (explode(' ', $alter['unwanted_characters']) as $unwanted) {
+          $path = str_replace($unwanted, '', $path);
+        }
+      }
     }
     }
 
 
     // Parse the URL and move any query and fragment parameters out of the path.
     // Parse the URL and move any query and fragment parameters out of the path.
@@ -1266,16 +1316,16 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
     }
     }
 
 
     // If the path is empty do not build a link around the given text and return
     // If the path is empty do not build a link around the given text and return
-    // it as is.
-    // http://www.example.com URLs will not have a $url['path'], so check host as well.
+    // it as is. http://www.example.com URLs will not have a $url['path'], so
+    // check host as well.
     if (empty($url['path']) && empty($url['host']) && empty($url['fragment'])) {
     if (empty($url['path']) && empty($url['host']) && empty($url['fragment'])) {
       return $text;
       return $text;
     }
     }
 
 
     // If no scheme is provided in the $path, assign the default 'http://'.
     // If no scheme is provided in the $path, assign the default 'http://'.
-    // This allows a url of 'www.example.com' to be converted to 'http://www.example.com'.
-    // Only do this on for external URLs.
-    if ($alter['external']){
+    // This allows a url of 'www.example.com' to be converted to
+    // 'http://www.example.com'. Only do this on for external URLs.
+    if ($alter['external']) {
       if (!isset($url['scheme'])) {
       if (!isset($url['scheme'])) {
         // There is no scheme, add the default 'http://' to the $path.
         // There is no scheme, add the default 'http://' to the $path.
         $path = "http://$path";
         $path = "http://$path";
@@ -1320,13 +1370,14 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
       $options['attributes']['rel'] = $rel;
       $options['attributes']['rel'] = $rel;
     }
     }
 
 
-    $target = check_plain(trim(strtr($alter['target'],$tokens)));
+    $target = check_plain(trim(strtr($alter['target'], $tokens)));
     if (!empty($target)) {
     if (!empty($target)) {
       $options['attributes']['target'] = $target;
       $options['attributes']['target'] = $target;
     }
     }
 
 
-    // Allow the addition of arbitrary attributes to links. Additional attributes
-    // currently can only be altered in preprocessors and not within the UI.
+    // Allow the addition of arbitrary attributes to links. Additional
+    // attributes currently can only be altered in preprocessors and not within
+    // the UI.
     if (isset($alter['link_attributes']) && is_array($alter['link_attributes'])) {
     if (isset($alter['link_attributes']) && is_array($alter['link_attributes'])) {
       foreach ($alter['link_attributes'] as $key => $attribute) {
       foreach ($alter['link_attributes'] as $key => $attribute) {
         if (!isset($options['attributes'][$key])) {
         if (!isset($options['attributes'][$key])) {
@@ -1375,11 +1426,10 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
   /**
   /**
    * Get the 'render' tokens to use for advanced rendering.
    * Get the 'render' tokens to use for advanced rendering.
    *
    *
-   * This runs through all of the fields and arguments that
-   * are available and gets their values. This will then be
-   * used in one giant str_replace().
+   * This runs through all of the fields and arguments that are available and
+   * gets their values. This will then be used in one giant str_replace().
    */
    */
-  function get_render_tokens($item) {
+  public function get_render_tokens($item) {
     $tokens = array();
     $tokens = array();
     if (!empty($this->view->build_info['substitutions'])) {
     if (!empty($this->view->build_info['substitutions'])) {
       $tokens = $this->view->build_info['substitutions'];
       $tokens = $this->view->build_info['substitutions'];
@@ -1391,9 +1441,9 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
         $tokens[$token] = '';
         $tokens[$token] = '';
       }
       }
 
 
-      // Use strip tags as there should never be HTML in the path.
-      // However, we need to preserve special characters like " that
-      // were removed by check_plain().
+      // Use strip tags as there should never be HTML in the path. However, we
+      // need to preserve special characters like " that were removed by
+      // check_plain().
       $tokens['!' . $count] = isset($this->view->args[$count - 1]) ? strip_tags(decode_entities($this->view->args[$count - 1])) : '';
       $tokens['!' . $count] = isset($this->view->args[$count - 1]) ? strip_tags(decode_entities($this->view->args[$count - 1])) : '';
     }
     }
 
 
@@ -1450,27 +1500,28 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
    *     '%bar_b_c' => 'value'
    *     '%bar_b_c' => 'value'
    *   );
    *   );
    *
    *
-   * @param $array
+   * @param array $array
    *   An array of values.
    *   An array of values.
-   *
-   * @param $parent_keys
+   * @param array $parent_keys
    *   An array of parent keys. This will represent the array depth.
    *   An array of parent keys. This will represent the array depth.
    *
    *
-   * @return
-   *   An array of available tokens, with nested keys representative of the array structure.
+   * @return array
+   *   An array of available tokens, with nested keys representative of the
+   *   array structure.
    */
    */
-  function get_token_values_recursive(array $array, array $parent_keys = array()) {
+  public function get_token_values_recursive(array $array, array $parent_keys = array()) {
     $tokens = array();
     $tokens = array();
 
 
     foreach ($array as $param => $val) {
     foreach ($array as $param => $val) {
       if (is_array($val)) {
       if (is_array($val)) {
-         // Copy parent_keys array, so we don't afect other elements of this iteration.
-         $child_parent_keys = $parent_keys;
-         $child_parent_keys[] = $param;
-         // Get the child tokens.
-         $child_tokens = $this->get_token_values_recursive($val, $child_parent_keys);
-         // Add them to the current tokens array.
-         $tokens += $child_tokens;
+        // Copy parent_keys array, so we don't afect other elements of this
+        // iteration.
+        $child_parent_keys = $parent_keys;
+        $child_parent_keys[] = $param;
+        // Get the child tokens.
+        $child_tokens = $this->get_token_values_recursive($val, $child_parent_keys);
+        // Add them to the current tokens array.
+        $tokens += $child_tokens;
       }
       }
       else {
       else {
         // Create a token key based on array element structure.
         // Create a token key based on array element structure.
@@ -1485,50 +1536,57 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
   /**
   /**
    * Add any special tokens this field might use for itself.
    * Add any special tokens this field might use for itself.
    *
    *
-   * This method is intended to be overridden by items that generate
-   * fields as a list. For example, the field that displays all terms
-   * on a node might have tokens for the tid and the term.
+   * This method is intended to be overridden by items that generate fields as a
+   * list. For example, the field that displays all terms on a node might have
+   * tokens for the tid and the term.
    *
    *
-   * By convention, tokens should follow the format of [token-subtoken]
-   * where token is the field ID and subtoken is the field. If the
-   * field ID is terms, then the tokens might be [terms-tid] and [terms-name].
+   * By convention, tokens should follow the format of [token-subtoken] where
+   * token is the field ID and subtoken is the field. If the field ID is terms,
+   * then the tokens might be [terms-tid] and [terms-name].
    */
    */
-  function add_self_tokens(&$tokens, $item) { }
+  public function add_self_tokens(&$tokens, $item) {
+  }
 
 
   /**
   /**
    * Document any special tokens this field might use for itself.
    * Document any special tokens this field might use for itself.
    *
    *
    * @see add_self_tokens()
    * @see add_self_tokens()
    */
    */
-  function document_self_tokens(&$tokens) { }
+  public function document_self_tokens(&$tokens) {
+  }
 
 
   /**
   /**
-   * Call out to the theme() function, which probably just calls render() but
-   * allows sites to override output fairly easily.
+   * Call out to the theme() function.
+   *
+   * It probably just calls render() but allows sites to override output fairly
+   * easily.
    */
    */
-  function theme($values) {
+  public function theme($values) {
     return theme($this->theme_functions(),
     return theme($this->theme_functions(),
       array(
       array(
         'view' => $this->view,
         'view' => $this->view,
         'field' => $this,
         'field' => $this,
-        'row' => $values
+        'row' => $values,
       ));
       ));
   }
   }
 
 
-  function theme_functions() {
+  /**
+   * Build a list of suitable theme functions for this view.
+   */
+  public function theme_functions() {
     $themes = array();
     $themes = array();
     $hook = 'views_view_field';
     $hook = 'views_view_field';
 
 
     $display = $this->view->display[$this->view->current_display];
     $display = $this->view->display[$this->view->current_display];
 
 
     if (!empty($display)) {
     if (!empty($display)) {
-      $themes[] = $hook . '__' . $this->view->name  . '__' . $display->id . '__' . $this->options['id'];
-      $themes[] = $hook . '__' . $this->view->name  . '__' . $display->id;
+      $themes[] = $hook . '__' . $this->view->name . '__' . $display->id . '__' . $this->options['id'];
+      $themes[] = $hook . '__' . $this->view->name . '__' . $display->id;
       $themes[] = $hook . '__' . $display->id . '__' . $this->options['id'];
       $themes[] = $hook . '__' . $display->id . '__' . $this->options['id'];
       $themes[] = $hook . '__' . $display->id;
       $themes[] = $hook . '__' . $display->id;
       if ($display->id != $display->display_plugin) {
       if ($display->id != $display->display_plugin) {
-        $themes[] = $hook . '__' . $this->view->name  . '__' . $display->display_plugin . '__' . $this->options['id'];
-        $themes[] = $hook . '__' . $this->view->name  . '__' . $display->display_plugin;
+        $themes[] = $hook . '__' . $this->view->name . '__' . $display->display_plugin . '__' . $this->options['id'];
+        $themes[] = $hook . '__' . $this->view->name . '__' . $display->display_plugin;
         $themes[] = $hook . '__' . $display->display_plugin . '__' . $this->options['id'];
         $themes[] = $hook . '__' . $display->display_plugin . '__' . $this->options['id'];
         $themes[] = $hook . '__' . $display->display_plugin;
         $themes[] = $hook . '__' . $display->display_plugin;
       }
       }
@@ -1541,9 +1599,13 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
     return $themes;
     return $themes;
   }
   }
 
 
-  function ui_name($short = FALSE) {
+  /**
+   * {@inheritdoc}
+   */
+  public function ui_name($short = FALSE) {
     return $this->get_field(parent::ui_name($short));
     return $this->get_field(parent::ui_name($short));
   }
   }
+
 }
 }
 
 
 /**
 /**
@@ -1552,22 +1614,44 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
  * @ingroup views_field_handlers
  * @ingroup views_field_handlers
  */
  */
 class views_handler_field_broken extends views_handler_field {
 class views_handler_field_broken extends views_handler_field {
-  function ui_name($short = FALSE) {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function ui_name($short = FALSE) {
     return t('Broken/missing handler');
     return t('Broken/missing handler');
   }
   }
 
 
-  function ensure_my_table() { /* No table to ensure! */ }
-  function query($group_by = FALSE) { /* No query to run */ }
-  function options_form(&$form, &$form_state) {
+  /**
+   * {@inheritdoc}
+   */
+  public function ensure_my_table() {
+    // No table to ensure!
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function query($group_by = FALSE) {
+    // No query to run.
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function options_form(&$form, &$form_state) {
     $form['markup'] = array(
     $form['markup'] = array(
       '#markup' => '<div class="form-item description">' . t('The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item.') . '</div>',
       '#markup' => '<div class="form-item description">' . t('The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item.') . '</div>',
     );
     );
   }
   }
 
 
   /**
   /**
-   * Determine if the handler is considered 'broken'
+   * {@inheritdoc}
    */
    */
-  function broken() { return TRUE; }
+  public function broken() {
+    return TRUE;
+  }
+
 }
 }
 
 
 /**
 /**
@@ -1576,7 +1660,11 @@ class views_handler_field_broken extends views_handler_field {
  * @ingroup views_field_handlers
  * @ingroup views_field_handlers
  */
  */
 class views_handler_field_file_size extends views_handler_field {
 class views_handler_field_file_size extends views_handler_field {
-  function option_definition() {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function option_definition() {
     $options = parent::option_definition();
     $options = parent::option_definition();
 
 
     $options['file_size_display'] = array('default' => 'formatted');
     $options['file_size_display'] = array('default' => 'formatted');
@@ -1584,7 +1672,10 @@ class views_handler_field_file_size extends views_handler_field {
     return $options;
     return $options;
   }
   }
 
 
-  function options_form(&$form, &$form_state) {
+  /**
+   * {@inheritdoc}
+   */
+  public function options_form(&$form, &$form_state) {
     parent::options_form($form, $form_state);
     parent::options_form($form, $form_state);
     $form['file_size_display'] = array(
     $form['file_size_display'] = array(
       '#title' => t('File size display'),
       '#title' => t('File size display'),
@@ -1596,7 +1687,10 @@ class views_handler_field_file_size extends views_handler_field {
     );
     );
   }
   }
 
 
-  function render($values) {
+  /**
+   * {@inheritdoc}
+   */
+  public function render($values) {
     $value = $this->get_value($values);
     $value = $this->get_value($values);
     if ($value) {
     if ($value) {
       switch ($this->options['file_size_display']) {
       switch ($this->options['file_size_display']) {
@@ -1611,6 +1705,7 @@ class views_handler_field_file_size extends views_handler_field {
       return '';
       return '';
     }
     }
   }
   }
+
 }
 }
 
 
 /**
 /**
@@ -1619,10 +1714,15 @@ class views_handler_field_file_size extends views_handler_field {
  * @ingroup views_field_handlers
  * @ingroup views_field_handlers
  */
  */
 class views_handler_field_xss extends views_handler_field {
 class views_handler_field_xss extends views_handler_field {
-  function render($values) {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function render($values) {
     $value = $this->get_value($values);
     $value = $this->get_value($values);
     return $this->sanitize_value($value, 'xss');
     return $this->sanitize_value($value, 'xss');
   }
   }
+
 }
 }
 
 
 /**
 /**

+ 26 - 12
sites/all/modules/views/handlers/views_handler_field_boolean.inc

@@ -11,18 +11,22 @@
  * Allows for display of true/false, yes/no, on/off, enabled/disabled.
  * Allows for display of true/false, yes/no, on/off, enabled/disabled.
  *
  *
  * Definition terms:
  * Definition terms:
- *   - output formats: An array where the first entry is displayed on boolean true
- *      and the second is displayed on boolean false. An example for sticky is:
- *      @code
- *      'output formats' => array(
- *        'sticky' => array(t('Sticky'), ''),
- *      ),
- *      @endcode
+ * - output formats: An array where the first entry is displayed on boolean true
+ *   and the second is displayed on boolean false. An example for sticky is:
+ *   @code
+ *   'output formats' => array(
+ *     'sticky' => array(t('Sticky'), ''),
+ *   ),
+ *   @endcode
  *
  *
  * @ingroup views_field_handlers
  * @ingroup views_field_handlers
  */
  */
 class views_handler_field_boolean extends views_handler_field {
 class views_handler_field_boolean extends views_handler_field {
-  function option_definition() {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function option_definition() {
     $options = parent::option_definition();
     $options = parent::option_definition();
     $options['type'] = array('default' => 'yes-no');
     $options['type'] = array('default' => 'yes-no');
     $options['type_custom_true'] = array('default' => '', 'translatable' => TRUE);
     $options['type_custom_true'] = array('default' => '', 'translatable' => TRUE);
@@ -32,7 +36,10 @@ class views_handler_field_boolean extends views_handler_field {
     return $options;
     return $options;
   }
   }
 
 
-  function init(&$view, &$options) {
+  /**
+   * {@inheritdoc}
+   */
+  public function init(&$view, &$options) {
     parent::init($view, $options);
     parent::init($view, $options);
 
 
     $default_formats = array(
     $default_formats = array(
@@ -48,7 +55,10 @@ class views_handler_field_boolean extends views_handler_field {
     $this->formats = array_merge($default_formats, $output_formats, $custom_format);
     $this->formats = array_merge($default_formats, $output_formats, $custom_format);
   }
   }
 
 
-  function options_form(&$form, &$form_state) {
+  /**
+   * {@inheritdoc}
+   */
+  public function options_form(&$form, &$form_state) {
     foreach ($this->formats as $key => $item) {
     foreach ($this->formats as $key => $item) {
       $options[$key] = implode('/', $item);
       $options[$key] = implode('/', $item);
     }
     }
@@ -91,7 +101,10 @@ class views_handler_field_boolean extends views_handler_field {
     parent::options_form($form, $form_state);
     parent::options_form($form, $form_state);
   }
   }
 
 
-  function render($values) {
+  /**
+   * {@inheritdoc}
+   */
+  public function render($values) {
     $value = $this->get_value($values);
     $value = $this->get_value($values);
     if (!empty($this->options['not'])) {
     if (!empty($this->options['not'])) {
       $value = !$value;
       $value = !$value;
@@ -100,11 +113,12 @@ class views_handler_field_boolean extends views_handler_field {
     if ($this->options['type'] == 'custom') {
     if ($this->options['type'] == 'custom') {
       return $value ? filter_xss_admin($this->options['type_custom_true']) : filter_xss_admin($this->options['type_custom_false']);
       return $value ? filter_xss_admin($this->options['type_custom_true']) : filter_xss_admin($this->options['type_custom_false']);
     }
     }
-    else if (isset($this->formats[$this->options['type']])) {
+    elseif (isset($this->formats[$this->options['type']])) {
       return $value ? $this->formats[$this->options['type']][0] : $this->formats[$this->options['type']][1];
       return $value ? $this->formats[$this->options['type']][0] : $this->formats[$this->options['type']][1];
     }
     }
     else {
     else {
       return $value ? $this->formats['yes-no'][0] : $this->formats['yes-no'][1];
       return $value ? $this->formats['yes-no'][0] : $this->formats['yes-no'][1];
     }
     }
   }
   }
+
 }
 }

+ 11 - 3
sites/all/modules/views/handlers/views_handler_field_contextual_links.inc

@@ -11,7 +11,11 @@
  * @ingroup views_field_handlers
  * @ingroup views_field_handlers
  */
  */
 class views_handler_field_contextual_links extends views_handler_field_links {
 class views_handler_field_contextual_links extends views_handler_field_links {
-  function pre_render(&$values) {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function pre_render(&$values) {
     // Add a row plugin css class for the contextual link.
     // Add a row plugin css class for the contextual link.
     $class = 'contextual-links-region';
     $class = 'contextual-links-region';
     if (!empty($this->view->style_plugin->options['row_class'])) {
     if (!empty($this->view->style_plugin->options['row_class'])) {
@@ -22,7 +26,10 @@ class views_handler_field_contextual_links extends views_handler_field_links {
     }
     }
   }
   }
 
 
-  function options_form(&$form, &$form_state) {
+  /**
+   * {@inheritdoc}
+   */
+  public function options_form(&$form, &$form_state) {
     parent::options_form($form, $form_state);
     parent::options_form($form, $form_state);
 
 
     $form['fields']['#description'] = t('Fields to be included as contextual links.');
     $form['fields']['#description'] = t('Fields to be included as contextual links.');
@@ -32,7 +39,7 @@ class views_handler_field_contextual_links extends views_handler_field_links {
   /**
   /**
    * Render the contextual fields.
    * Render the contextual fields.
    */
    */
-  function render($values) {
+  public function render($values) {
     $links = $this->get_links();
     $links = $this->get_links();
     if (!empty($links)) {
     if (!empty($links)) {
       $build = array(
       $build = array(
@@ -52,4 +59,5 @@ class views_handler_field_contextual_links extends views_handler_field_links {
       return '';
       return '';
     }
     }
   }
   }
+
 }
 }

+ 23 - 8
sites/all/modules/views/handlers/views_handler_field_counter.inc

@@ -11,14 +11,21 @@
  * @ingroup views_field_handlers
  * @ingroup views_field_handlers
  */
  */
 class views_handler_field_counter extends views_handler_field {
 class views_handler_field_counter extends views_handler_field {
-  function option_definition() {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function option_definition() {
     $options = parent::option_definition();
     $options = parent::option_definition();
     $options['counter_start'] = array('default' => 1);
     $options['counter_start'] = array('default' => 1);
     $options['reverse'] = array('default' => FALSE);
     $options['reverse'] = array('default' => FALSE);
     return $options;
     return $options;
   }
   }
 
 
-  function options_form(&$form, &$form_state) {
+  /**
+   * {@inheritdoc}
+   */
+  public function options_form(&$form, &$form_state) {
     $form['counter_start'] = array(
     $form['counter_start'] = array(
       '#type' => 'textfield',
       '#type' => 'textfield',
       '#title' => t('Starting value'),
       '#title' => t('Starting value'),
@@ -37,24 +44,31 @@ class views_handler_field_counter extends views_handler_field {
     parent::options_form($form, $form_state);
     parent::options_form($form, $form_state);
   }
   }
 
 
-  function query() {
-    // do nothing -- to override the parent query.
+  /**
+   * {@inheritdoc}
+   */
+  public function query() {
+    // Do nothing -- to override the parent query.
   }
   }
 
 
-  function render($values) {
+  /**
+   * {@inheritdoc}
+   */
+  public function render($values) {
     $reverse = empty($this->options['reverse']) ? 1 : -1;
     $reverse = empty($this->options['reverse']) ? 1 : -1;
 
 
-    // Note:  1 is subtracted from the counter start value below because the
+    // Note: 1 is subtracted from the counter start value below because the
     // counter value is incremented by 1 at the end of this function.
     // counter value is incremented by 1 at the end of this function.
     $counter_start = is_numeric($this->options['counter_start']) ? $this->options['counter_start'] : 0;
     $counter_start = is_numeric($this->options['counter_start']) ? $this->options['counter_start'] : 0;
-    $count = ($reverse == -1) ? count($this->view->result) + $counter_start : $counter_start -1;
+    $count = ($reverse == -1) ? count($this->view->result) + $counter_start : $counter_start - 1;
     $pager = $this->view->query->pager;
     $pager = $this->view->query->pager;
 
 
     // Get the base count of the pager.
     // Get the base count of the pager.
     if ($pager->use_pager()) {
     if ($pager->use_pager()) {
       if ($reverse == -1) {
       if ($reverse == -1) {
         $count = ($pager->total_items + $counter_start - ($pager->get_current_page() * $pager->get_items_per_page()) + $pager->get_offset());
         $count = ($pager->total_items + $counter_start - ($pager->get_current_page() * $pager->get_items_per_page()) + $pager->get_offset());
-      } else {
+      }
+      else {
         $count += (($pager->get_items_per_page() * $pager->get_current_page() + $pager->get_offset())) * $reverse;
         $count += (($pager->get_items_per_page() * $pager->get_current_page() + $pager->get_offset())) * $reverse;
       }
       }
     }
     }
@@ -63,4 +77,5 @@ class views_handler_field_counter extends views_handler_field {
 
 
     return $count;
     return $count;
   }
   }
+
 }
 }

+ 21 - 4
sites/all/modules/views/handlers/views_handler_field_ctools_dropdown.inc

@@ -11,7 +11,11 @@
  * @ingroup views_field_handlers
  * @ingroup views_field_handlers
  */
  */
 class views_handler_field_ctools_dropdown extends views_handler_field_links {
 class views_handler_field_ctools_dropdown extends views_handler_field_links {
-  function option_definition() {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function option_definition() {
     $options = parent::option_definition();
     $options = parent::option_definition();
 
 
     $options['views_admin_css'] = array('default' => TRUE, 'bool' => TRUE);
     $options['views_admin_css'] = array('default' => TRUE, 'bool' => TRUE);
@@ -19,7 +23,10 @@ class views_handler_field_ctools_dropdown extends views_handler_field_links {
     return $options;
     return $options;
   }
   }
 
 
-  function options_form(&$form, &$form_state) {
+  /**
+   * {@inheritdoc}
+   */
+  public function options_form(&$form, &$form_state) {
     parent::options_form($form, $form_state);
     parent::options_form($form, $form_state);
     $form['fields']['#description'] = t('Fields to be included as ctools dropdown button.');
     $form['fields']['#description'] = t('Fields to be included as ctools dropdown button.');
     $form['destination']['#description'] = t('Include a "destination" parameter in the link to return the user to the original view upon completing a link action.');
     $form['destination']['#description'] = t('Include a "destination" parameter in the link to return the user to the original view upon completing a link action.');
@@ -35,7 +42,7 @@ class views_handler_field_ctools_dropdown extends views_handler_field_links {
   /**
   /**
    * Render the dropdown button.
    * Render the dropdown button.
    */
    */
-  function render($values) {
+  public function render($values) {
     static $added_admin_css;
     static $added_admin_css;
     $links = $this->get_links();
     $links = $this->get_links();
 
 
@@ -46,10 +53,20 @@ class views_handler_field_ctools_dropdown extends views_handler_field_links {
         $added_admin_css = TRUE;
         $added_admin_css = TRUE;
       }
       }
 
 
-      return theme('links__ctools_dropbutton', array('links' => $links, 'attributes' => array('class' => array('links', 'inline'))));
+      $vars = array(
+        'links' => $links,
+        'attributes' => array(
+          'class' => array(
+            'links',
+            'inline',
+          ),
+        ),
+      );
+      return theme('links__ctools_dropbutton', $vars);
     }
     }
     else {
     else {
       return '';
       return '';
     }
     }
   }
   }
+
 }
 }

Some files were not shown because too many files changed in this diff