diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 4adf5a43c530b2e1bffe15ed79b4e2f34895c395..8c651312f5e9c06bebf6785c62bdba1e2a142aaa 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,14 @@ +Drupal 7.xx, xxxx-xx-xx (development version) +----------------------- + +Drupal 7.64, 2019-02-06 +----------------------- +- [regression] Unset the 'host' header in drupal_http_request() during redirect +- Fixed: 7.x does not have Phar protection and Phar tests are failing on Drupal 7 +- Fixed: Notice: Undefined index: display_field in file_field_widget_value() (line 582 of /module/file/file.field.inc) +- Performance improvement: Registry rebuild should not parse the same file twice in the same request +- Fixed _registry_update() to clear caches after transaction is committed + Drupal 7.63, 2019-01-16 ----------------------- - Fixed a fatal error for some Drush users introduced by SA-CORE-2019-002. diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index f484fce2651f3dd088dff2b84c8d4f0589022f31..db2ac1f5d123e344c406b304b7ddaa36e9806cfc 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -8,7 +8,7 @@ /** * The current system version. */ -define('VERSION', '7.63'); +define('VERSION', '7.64'); /** * Core API compatibility. diff --git a/includes/common.inc b/includes/common.inc index a7d95656ab0d1958efff1c09e29f9ffe58cca200..af87660be0f44c76f41407379584fd692d2f6165 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -1094,6 +1094,11 @@ function drupal_http_request($url, array $options = array()) { elseif ($options['max_redirects']) { // Redirect to the new location. $options['max_redirects']--; + + // We need to unset the 'Host' header + // as we are redirecting to a new location. + unset($options['headers']['Host']); + $result = drupal_http_request($location, $options); $result->redirect_code = $code; } diff --git a/includes/file.inc b/includes/file.inc index d2a7b2c1995635293a20c83827ad30a437cc51e4..d6f315602ecf1241512450f775e63259e13ce2fd 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -2134,9 +2134,33 @@ function file_download_access($uri) { * 'filename', and 'name' members corresponding to the matching files. */ function file_scan_directory($dir, $mask, $options = array(), $depth = 0) { + // Default nomask option. + $nomask = '/(\.\.?|CVS)$/'; + + // Overrides the $nomask variable accordingly if $options['nomask'] is set. + // + // Allow directories specified in settings.php to be ignored. You can use this + // to not check for files in common special-purpose directories. For example, + // node_modules and bower_components. Ignoring irrelevant directories is a + // performance boost. + if (!isset($options['nomask'])) { + $ignore_directories = variable_get( + 'file_scan_ignore_directories', + array() + ); + + foreach ($ignore_directories as $index => $ignore_directory) { + $ignore_directories[$index] = preg_quote($ignore_directory, '/'); + } + + if (!empty($ignore_directories)) { + $nomask = '/^(\.\.?)|CVS|' . implode('|', $ignore_directories) . '$/'; + } + } + // Merge in defaults. $options += array( - 'nomask' => '/(\.\.?|CVS)$/', + 'nomask' => $nomask, 'callback' => 0, 'recurse' => TRUE, 'key' => 'uri', diff --git a/includes/registry.inc b/includes/registry.inc index 29a1fca8cc56a7f905833f6df6cf946f8606e5df..ee678e891b56525b63dfd0ea5b069ec110cf8575 100644 --- a/includes/registry.inc +++ b/includes/registry.inc @@ -19,7 +19,6 @@ * Does the work for registry_update(). */ function _registry_update() { - // The registry serves as a central autoloader for all classes, including // the database query builders. However, the registry rebuild process // requires write ability to the database, which means having access to the @@ -33,6 +32,11 @@ function _registry_update() { require_once DRUPAL_ROOT . '/includes/database/select.inc'; require_once DRUPAL_ROOT . '/includes/database/' . $driver . '/query.inc'; + // During the first registry rebuild in a request, we check all the files. + // During subsequent rebuilds, we only add new files. It makes the rebuilding + // process faster during installation of modules. + static $check_existing_files = TRUE; + // Get current list of modules and their files. $modules = db_query("SELECT * FROM {system} WHERE type = 'module'")->fetchAll(); // Get the list of files we are going to parse. @@ -55,6 +59,9 @@ function _registry_update() { $files["$filename"] = array('module' => '', 'weight' => 0); } + // Initialize an empty array for the unchanged files. + $unchanged_files = array(); + $transaction = db_transaction(); try { // Allow modules to manually modify the list of files before the registry @@ -63,10 +70,19 @@ function _registry_update() { // list can then be added to the list of files that the registry will parse, // or modify attributes of a file. drupal_alter('registry_files', $files, $modules); + foreach (registry_get_parsed_files() as $filename => $file) { // Add the hash for those files we have already parsed. if (isset($files[$filename])) { - $files[$filename]['hash'] = $file['hash']; + if ($check_existing_files === TRUE) { + $files[$filename]['hash'] = $file['hash']; + } + else { + // Ignore that file for this request, it has been parsed previously + // and it is unlikely it has changed. + unset($files[$filename]); + $unchanged_files[$filename] = $file; + } } else { // Flush the registry of resources in files that are no longer on disc @@ -79,8 +95,12 @@ function _registry_update() { ->execute(); } } + $parsed_files = _registry_parse_files($files); + // Add unchanged files to the files. + $files += $unchanged_files; + $unchanged_resources = array(); $lookup_cache = array(); if ($cache = cache_get('lookup_cache', 'cache_bootstrap')) { @@ -89,12 +109,10 @@ function _registry_update() { foreach ($lookup_cache as $key => $file) { // If the file for this cached resource is carried over unchanged from // the last registry build, then we can safely re-cache it. - if ($file && in_array($file, array_keys($files)) && !in_array($file, $parsed_files)) { + if ($file && isset($files[$file]) && !in_array($file, $parsed_files, TRUE)) { $unchanged_resources[$key] = $file; } } - module_implements('', FALSE, TRUE); - _registry_check_code(REGISTRY_RESET_LOOKUP_CACHE); } catch (Exception $e) { $transaction->rollback(); @@ -102,6 +120,13 @@ function _registry_update() { throw $e; } + module_implements('', FALSE, TRUE); + _registry_check_code(REGISTRY_RESET_LOOKUP_CACHE); + + // During the next run in this request, don't bother re-checking existing + // files. + $check_existing_files = FALSE; + // We have some unchanged resources, warm up the cache - no need to pay // for looking them up again. if (count($unchanged_resources) > 0) { diff --git a/modules/field/modules/number/number.test b/modules/field/modules/number/number.test index 839da36c37b23c036776535666888005417a56ef..db225855bf4a1602ed136a792a8f08bf35301806 100644 --- a/modules/field/modules/number/number.test +++ b/modules/field/modules/number/number.test @@ -69,7 +69,7 @@ class NumberFieldTestCase extends DrupalWebTestCase { preg_match('|test-entity/manage/(\d+)/edit|', $this->url, $match); $id = $match[1]; $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), 'Entity was created'); - $this->assertRaw(round($value, 2), 'Value is displayed.'); + $this->assertRaw($value, 'Value is displayed.'); // Try to create entries with more than one decimal separator; assert fail. $wrong_entries = array( diff --git a/modules/file/file.field.inc b/modules/file/file.field.inc index d592381bd56f7799bb37cbe852b196dae20ff503..fc1a1df200d6f84d80a4c2bbdc987d7dae222167 100644 --- a/modules/file/file.field.inc +++ b/modules/file/file.field.inc @@ -599,7 +599,7 @@ function file_field_widget_value($element, $input = FALSE, $form_state) { // If the display field is present make sure its unchecked value is saved. $field = field_widget_field($element, $form_state); if (empty($input['display'])) { - $input['display'] = $field['settings']['display_field'] ? 0 : 1; + $input['display'] = !empty($field['settings']['display_field']) ? 0 : 1; } } diff --git a/modules/file/tests/file.test b/modules/file/tests/file.test index f764a903320983eca7d0f098f247830793aedd59..849451a5581d1c9395ee736f357fde6c8545ac0f 100644 --- a/modules/file/tests/file.test +++ b/modules/file/tests/file.test @@ -1875,3 +1875,60 @@ class FileFieldAnonymousSubmission extends FileFieldTestCase { } } + +/** + * Tests the file_scan_directory() function. + */ +class FileScanDirectory extends FileFieldTestCase { + + /** + * @var string + */ + protected $path; + + /** + * {@inheritdoc} + */ + public static function getInfo() { + return array( + 'name' => 'File ScanDirectory', + 'description' => 'Tests the file_scan_directory() function.', + 'group' => 'File', + ); + } + + /** + * {@inheritdoc} + */ + function setUp() { + parent::setUp(); + + $this->path = 'modules/file/tests/fixtures/file_scan_ignore'; + } + + /** + * Tests file_scan_directory() obeys 'file_scan_ignore_directories' setting. + * If nomask is not passed as argument, it should use the default settings. + * If nomask is passed as argument, it should obey this rule. + */ + public function testNoMask() { + $files = file_scan_directory($this->path, '/\.txt$/'); + $this->assertEqual(3, count($files), '3 text files found when not ignoring directories.'); + + global $conf; + $conf['file_scan_ignore_directories'] = array('frontend_framework'); + + $files = file_scan_directory($this->path, '/\.txt$/'); + $this->assertEqual(1, count($files), '1 text files found when ignoring directories called "frontend_framework".'); + + // Make that directories specified by default still work when a new nomask is provided. + $files = file_scan_directory($this->path, '/\.txt$/', array('nomask' => '/^c.txt/')); + $this->assertEqual(2, count($files), '2 text files found when an "nomask" option is passed in.'); + + // Ensure that the directories in file_scan_ignore_directories are escaped using preg_quote. + $conf['file_scan_ignore_directories'] = array('frontend.*'); + $files = file_scan_directory($this->path, '/\.txt$/'); + $this->assertEqual(3, count($files), '2 text files found when ignoring a directory that is not there.'); + } + +} diff --git a/modules/file/tests/fixtures/file_scan_ignore/a.txt b/modules/file/tests/fixtures/file_scan_ignore/a.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/modules/file/tests/fixtures/file_scan_ignore/frontend_framework/b.txt b/modules/file/tests/fixtures/file_scan_ignore/frontend_framework/b.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/modules/file/tests/fixtures/file_scan_ignore/frontend_framework/c.txt b/modules/file/tests/fixtures/file_scan_ignore/frontend_framework/c.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index 3124ffe82a8327abf5324212a7610ae9213e13e8..a0872c234a8fa237f1705aeb000c4735f9a7e645 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -3012,7 +3012,7 @@ class DrupalWebTestCase extends DrupalTestCase { if (!$message) { $message = t('Raw "@raw" found', array('@raw' => $raw)); } - return $this->assert(strpos($this->drupalGetContent(), $raw) !== FALSE, $message, $group); + return $this->assert(strpos($this->drupalGetContent(), (string) $raw) !== FALSE, $message, $group); } /** @@ -3032,7 +3032,7 @@ class DrupalWebTestCase extends DrupalTestCase { if (!$message) { $message = t('Raw "@raw" not found', array('@raw' => $raw)); } - return $this->assert(strpos($this->drupalGetContent(), $raw) === FALSE, $message, $group); + return $this->assert(strpos($this->drupalGetContent(), (string) $raw) === FALSE, $message, $group); } /** diff --git a/modules/simpletest/tests/bootstrap.test b/modules/simpletest/tests/bootstrap.test index 16ac1714f6fad2d7eb24b8e673a05749fa8fcff9..effd04bf2f424eb5d20a99e723862a4dbb2344da 100644 --- a/modules/simpletest/tests/bootstrap.test +++ b/modules/simpletest/tests/bootstrap.test @@ -729,16 +729,12 @@ class BootstrapMiscTestCase extends DrupalUnitTestCase { * Tests that the drupal_check_memory_limit() function works as expected. */ function testCheckMemoryLimit() { - $memory_limit = ini_get('memory_limit'); // Test that a very reasonable amount of memory is available. $this->assertTrue(drupal_check_memory_limit('30MB'), '30MB of memory tested available.'); - // Get the available memory and multiply it by two to make it unreasonably - // high. - $twice_avail_memory = ($memory_limit * 2) . 'MB'; - + // Test an unlimited memory limit. // The function should always return true if the memory limit is set to -1. - $this->assertTrue(drupal_check_memory_limit($twice_avail_memory, -1), 'drupal_check_memory_limit() returns TRUE when a limit of -1 (none) is supplied'); + $this->assertTrue(drupal_check_memory_limit('9999999999YB', -1), 'drupal_check_memory_limit() returns TRUE when a limit of -1 (none) is supplied'); // Test that even though we have 30MB of memory available - the function // returns FALSE when given an upper limit for how much memory can be used. diff --git a/modules/system/system.install b/modules/system/system.install index a4f24a75c257fd4fa29eecc11b2fd36c192c0de4..862436429e727b8636fb680bcf8e27552231dc0e 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -2885,7 +2885,7 @@ function system_update_7061(&$sandbox) { if (!db_table_exists('system_update_7061')) { $table = array( 'description' => t('Stores temporary data for system_update_7061.'), - 'fields' => array('vid' => array('type' => 'int')), + 'fields' => array('vid' => array('type' => 'int', 'not null' => TRUE)), 'primary key' => array('vid'), ); db_create_table('system_update_7061', $table); diff --git a/profiles/wcm_base/CHANGELOG.txt b/profiles/wcm_base/CHANGELOG.txt index 755927e04b11a3b5dd547b9ac67878acd4bb7eaf..2e43ca4111073ff18dc942604324abf3ba7f35fc 100644 --- a/profiles/wcm_base/CHANGELOG.txt +++ b/profiles/wcm_base/CHANGELOG.txt @@ -1,3 +1,10 @@ +WCM Base 7.x-1.11, 2019-02-25 +----------------------------- +- WCM Base: + - Updated Panopoly to 1.62. + - Updated Link to 1.6 per SA-CONTRIB-2019-004, removed obsolete patch for tel: links. + - Updated Webform to 4.19, removed obsolete patch for fieldset accessibility. + WCM Base 7.x-1.11-rc3, 2019-02-04 --------------------------------- - WCM Base: Patched SMTP module to fix errors on webforms with multiple recipients. diff --git a/profiles/wcm_base/modules/contrib/admin_menu/PATCHES.txt b/profiles/wcm_base/modules/contrib/admin_menu/PATCHES.txt deleted file mode 100644 index fc460af5566e366e0520a3e935d8fd60349219ab..0000000000000000000000000000000000000000 --- a/profiles/wcm_base/modules/contrib/admin_menu/PATCHES.txt +++ /dev/null @@ -1,4 +0,0 @@ -The following patches have been applied to this project: -- https://www.drupal.org/files/issues/admin-menu-2929025-each-function-deprecated-php-7.2.patch - -This file was automatically generated by Drush Make (http://drupal.org/project/drush). diff --git a/profiles/wcm_base/modules/contrib/admin_menu/README.txt b/profiles/wcm_base/modules/contrib/admin_menu/README.txt index 136db70991f499da0eb0bdcbbe6e57002c4c0abc..6fe556d25f5f5553b327c385bd9a3915037b2eff 100644 --- a/profiles/wcm_base/modules/contrib/admin_menu/README.txt +++ b/profiles/wcm_base/modules/contrib/admin_menu/README.txt @@ -1,65 +1,84 @@ +CONTENTS OF THIS FILE +--------------------- --- SUMMARY -- + * Introduction + * Requirements + * Installation + * Configuration + * Customization + * Troubleshooting + * FAQ + * Maintainers + + +INTRODUCTION +------------ The Administration menu module displays the entire administrative menu tree (and most local tasks) in a drop-down menu, providing administrators one- or two-click access to most pages. Other modules may also add menu links to the menu using hook_admin_menu_output_alter(). -For a full description of the module, visit the project page: - http://drupal.org/project/admin_menu +For a full description of the project visit the project page: +http://drupal.org/project/admin_menu To submit bug reports and feature suggestions, or to track changes: - http://drupal.org/project/issues/admin_menu +http://drupal.org/project/issues/admin_menu --- REQUIREMENTS -- +REQUIREMENTS +------------ -None. +No special requirements --- INSTALLATION -- +INSTALLATION +------------ -* Install as usual, see http://drupal.org/node/895232 for further information. +Install as you would normally install a contributed Drupal. See: +https://drupal.org/documentation/install/modules-themes/modules-7 for further +information. -* You likely want to disable Toolbar module, since its output clashes with - Administration menu. + * You likely want to disable Toolbar module, since its output clashes with + Administration menu. --- CONFIGURATION -- +CONFIGURATION +------------- -* Configure user permissions in Administration » People » Permissions: + * Configure user permissions in Administration » People » Permissions: - - Use the administration pages and help (System module) + - Use the administration pages and help (System module) - The top-level administration categories require this permission to be - accessible. The administration menu will be empty unless this permission is - granted. + The top-level administration categories require this permission to be + accessible. The administration menu will be empty unless this permission is + granted. - - Access administration menu + - Access administration menu - Users in roles with the "Access administration menu" permission will see - the administration menu at the top of each page. + Users in roles with the "Access administration menu" permission will see + the administration menu at the top of each page. - - Display Drupal links + - Display Drupal links - Users in roles with the "Display drupal links" permission will receive - links to drupal.org issue queues for all enabled contributed modules. The - issue queue links appear under the administration menu icon. + Users in roles with the "Display drupal links" permission will receive + links to drupal.org issue queues for all enabled contributed modules. The + issue queue links appear under the administration menu icon. - Note that the menu items displayed in the administration menu depend on the - actual permissions of the viewing user. For example, the "People" menu item - is not displayed to a user who is not a member of a role with the "Administer - users" permission. + Note that the menu items displayed in the administration menu depend on the + actual permissions of the viewing user. For example, the "People" menu item + is not displayed to a user who is not a member of a role with the + "Administer users" permission. -* Customize the menu settings in Administration » Configuration and modules » - Administration » Administration menu. + * Customize the menu settings in Administration » Configuration and modules » + Administration » Administration menu. -* To prevent administrative menu items from appearing twice, you may hide the - "Management" menu block. + * To prevent administrative menu items from appearing twice, you may hide the + "Management" menu block. --- CUSTOMIZATION -- +CUSTOMIZATION +------------- * To override the default administration menu icon, you may: @@ -82,12 +101,13 @@ None. body #admin-menu { font-size: 10px; } --- TROUBLESHOOTING -- +TROUBLESHOOTING +------------- * If the menu does not display, check the following: - - Are the "Access administration menu" and "Use the administration pages and help" - permissions enabled for the appropriate roles? + - Are the "Access administration menu" and "Use the administration pages and + help" permissions enabled for the appropriate roles? - Does html.tpl.php of your theme output the $page_bottom variable? @@ -99,90 +119,102 @@ None. See http://drupal.org/node/195386 for further information. --- FAQ -- +FAQ +--- + + Q: When the administration menu module is enabled, blank space is added to the + bottom of my theme. Why? -Q: When the administration menu module is enabled, blank space is added to the - bottom of my theme. Why? + A: This is caused by a long list of links to module issue queues at Drupal.org. + Use Administer >> User management >> Permissions to disable the "display + drupal links" permission for all appropriate roles. Note that since UID 1 + automatically receives all permissions, the list of issue queue links cannot + be disabled for UID 1. -A: This is caused by a long list of links to module issue queues at Drupal.org. - Use Administer >> User management >> Permissions to disable the "display - drupal links" permission for all appropriate roles. Note that since UID 1 - automatically receives all permissions, the list of issue queue links cannot - be disabled for UID 1. + Q: After upgrading to 6.x-1.x, the menu disappeared. Why? -Q: After upgrading to 6.x-1.x, the menu disappeared. Why? + A: You may need to regenerate your menu. Visit + http://example.com/admin/build/modules to regenerate your menu (substitute + your site name for example.com). -A: You may need to regenerate your menu. Visit - http://example.com/admin/build/modules to regenerate your menu (substitute - your site name for example.com). + Q: Can I configure the administration menu module to display another menu (like + the Navigation menu, for instance)? -Q: Can I configure the administration menu module to display another menu (like - the Navigation menu, for instance)? + A: No. As the name implies, administration menu module is for administrative + menu links only. However, you can copy and paste the contents of + admin_menu.css into your theme's stylesheet and replace #admin-menu with any + other menu block id (#block-menu-1, for example). -A: No. As the name implies, administration menu module is for administrative - menu links only. However, you can copy and paste the contents of - admin_menu.css into your theme's stylesheet and replace #admin-menu with any - other menu block id (#block-menu-1, for example). + Q: Sometimes, the user counter displays a lot of anonymous users, but no spike + of users or requests appear in Google Analytics or other tracking tools. -Q: Sometimes, the user counter displays a lot of anonymous users, but no spike - of users or requests appear in Google Analytics or other tracking tools. + A: If your site was concurrently spidered by search-engine robots, it may have + a significant number of anonymous users for a short time. Most web tracking + tools like Google Analytics automatically filter out these requests. -A: If your site was concurrently spidered by search-engine robots, it may have - a significant number of anonymous users for a short time. Most web tracking - tools like Google Analytics automatically filter out these requests. + Q: I enabled "Aggregate and compress CSS files", but admin_menu.css is still + there. Is this normal? -Q: I enabled "Aggregate and compress CSS files", but admin_menu.css is still - there. Is this normal? + A: Yes, this is the intended behavior. the administration menu module only + loads its stylesheet as needed (i.e., on page requests by logged-on, + administrative users). -A: Yes, this is the intended behavior. the administration menu module only loads - its stylesheet as needed (i.e., on page requests by logged-on, administrative - users). + Q: Why are sub-menus not visible in Opera? -Q: Why are sub-menus not visible in Opera? + A: In the Opera browser preferences under "web pages" there is an option to fit + to width. By disabling this option, sub-menus in the administration menu + should appear. -A: In the Opera browser preferences under "web pages" there is an option to fit - to width. By disabling this option, sub-menus in the administration menu - should appear. + Q: How can the administration menu be hidden on certain pages? -Q: How can the administration menu be hidden on certain pages? + A: You can suppress it by simply calling the following function in PHP: + module_invoke('admin_menu', 'suppress'); -A: You can suppress it by simply calling the following function in PHP: + However, this needs to happen as early as possible in the page request, so + placing it in the theming layer (resp. a page template file) is too late. + Ideally, the function is called in hook_init() in a custom module. If you + do not have a custom module, placing it into some conditional code at the + top of template.php may work out, too. - module_invoke('admin_menu', 'suppress'); - However, this needs to happen as early as possible in the page request, so - placing it in the theming layer (resp. a page template file) is too late. - Ideally, the function is called in hook_init() in a custom module. If you do - not have a custom module, placing it into some conditional code at the top of - template.php may work out, too. +Q: What does the "Administration Development Tools" module do? +A: The Administration Development Tools adds a jQuery Debugger which allows + a developer to debug and inspect arbitrary data/variables in Firebug's + console, and also to access them again in the global window object + (optionally using a named identifier, e.g. window.debug.myValue). + Chainable via jQuery. Especially useful for re-accessing and debugging + selected data via Firebug's console. --- CONTACT -- + +MAINTAINERS +----------- Current maintainers: -* Daniel F. Kudwien (sun) - http://drupal.org/user/54136 -* Peter Wolanin (pwolanin) - http://drupal.org/user/49851 -* Stefan M. Kudwien (smk-ka) - http://drupal.org/user/48898 -* Dave Reid (Dave Reid) - http://drupal.org/user/53892 + * Daniel F. Kudwien (sun) - http://drupal.org/user/54136 + * Peter Wolanin (pwolanin) - http://drupal.org/user/49851 + * Stefan M. Kudwien (smk-ka) - http://drupal.org/user/48898 + * Dave Reid (Dave Reid) - http://drupal.org/user/53892 + * Truls S. Yggeseth (truls1502) - http://drupal.org/user/325866 + * Sebastian Siemssen (fubhy) - https://www.drupal.org/user/761344 Major rewrite for Drupal 6 by Peter Wolanin (pwolanin). This project has been sponsored by: -* UNLEASHED MIND - Specialized in consulting and planning of Drupal powered sites, UNLEASHED - MIND offers installation, development, theming, customization, and hosting - to get you started. Visit http://www.unleashedmind.com for more information. - -* Lullabot - Friendly Drupal experts providing professional consulting & education - services. Visit http://www.lullabot.com for more information. + * UNLEASHED MIND + Specialized in consulting and planning of Drupal powered sites, UNLEASHED + MIND offers installation, development, theming, customization, and hosting + to get you started. Visit http://www.unleashedmind.com for more information. -* Acquia - Commercially Supported Drupal. Visit http://acquia.com for more information. + * Lullabot + Friendly Drupal experts providing professional consulting & education + services. Visit http://www.lullabot.com for more information. + * Acquia + Commercially Supported Drupal. Visit http://acquia.com for more information. diff --git a/profiles/wcm_base/modules/contrib/admin_menu/admin_devel/admin_devel.info b/profiles/wcm_base/modules/contrib/admin_menu/admin_devel/admin_devel.info index ab3d641ff343f377dae045001dabc98b50c2722c..8b09eb181379bb2c1fe1b9812a09501100015477 100644 --- a/profiles/wcm_base/modules/contrib/admin_menu/admin_devel/admin_devel.info +++ b/profiles/wcm_base/modules/contrib/admin_menu/admin_devel/admin_devel.info @@ -4,9 +4,8 @@ package = Administration core = 7.x scripts[] = admin_devel.js -; Information added by Drupal.org packaging script on 2014-12-19 -version = "7.x-3.0-rc5" +; Information added by Drupal.org packaging script on 2018-12-03 +version = "7.x-3.0-rc6" core = "7.x" project = "admin_menu" -datestamp = "1419029284" - +datestamp = "1543859284" diff --git a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu-rtl.css b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu-rtl.css index 9414dcf950c4ff93c7f4eb0f9635e79f6a721d8c..ff9f500843859ff1e6bd8f3bb03601e520e9edc9 100644 --- a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu-rtl.css +++ b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu-rtl.css @@ -1,4 +1,3 @@ - #admin-menu { text-align: right; } @@ -25,7 +24,7 @@ border-right: 0; } #admin-menu .dropdown .admin-menu-tab a { - border-left: 1px solid #52565E; + border-left: 1px solid #52565e; border-right: 0; } #admin-menu .dropdown li li a { @@ -42,13 +41,13 @@ /* Second-level lists */ #admin-menu .dropdown li ul { left: auto; - right: -999em; + right: auto; } /* Third-and-above-level lists */ #admin-menu .dropdown li li.expandable ul { - margin-left: 0; - margin-right: 160px; + margin-left: 0 !important; + margin-right: 160px !important; } /* Lists nested under hovered list items */ diff --git a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.admin.js b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.admin.js index 9ee9f36f3a61fa82a418294bdd43e68f23fa5bd2..3753463132434dfa9b5287d3485dc6d87d211f9a 100644 --- a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.admin.js +++ b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.admin.js @@ -1,4 +1,8 @@ -(function($) { +/** + * @file + */ + +(function ($) { /** * Live preview of Administration menu components. @@ -45,9 +49,9 @@ Drupal.behaviors.adminMenuPermissionsSetupHelp = { // Figure out which is the other, check whether it still disabled, // and if so, ask whether to auto-enable it. var other = (this == $admin[index] ? $menu[index] : $admin[index]); - if (!other.checked && confirm(Drupal.t('Also allow !name role to !permission?', { - '!name': $roles[index].textContent, - '!permission': (this == $admin[index] ? menuPermission : adminPermission) + if (!other.checked && confirm(Drupal.t('Also allow @name role to @permission?', { + '@name': $roles[index].textContent, + '@permission': (this == $admin[index] ? menuPermission : adminPermission) }))) { other.checked = 'checked'; } diff --git a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.color.css b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.color.css index ea3ef491d5b88b14c394b170ed9c40505d4aa3de..00cbf651fd5e3815c0f48b615821715991435e8a 100644 --- a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.color.css +++ b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.color.css @@ -1,4 +1,3 @@ - /** * @file * Administration menu color override. @@ -17,7 +16,7 @@ border-right-color: #a91f1f; } #admin-menu ul li.admin-menu-tab a { - border-right-color: #52565E; + border-right-color: #52565e; } #admin-menu li li a { border-top-color: #801f1f; diff --git a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.css b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.css index 52ae3ff54c53d6bbfab57a29895b15d19bdd19ca..73f15e32a0aecb80350ef0715285613f3d785a44 100644 --- a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.css +++ b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.css @@ -1,4 +1,3 @@ - /** * @file * Administration menu. @@ -16,6 +15,7 @@ position: absolute; text-align: left; top: 0; + height: 30px; width: 100%; } #admin-menu-wrapper { @@ -62,7 +62,7 @@ body.admin-menu { #admin-menu li > span { background: transparent none; border: none; - color: #EEE; + color: #eee; font-weight: normal; text-align: left; /* LTR */ text-decoration: none; @@ -74,7 +74,7 @@ body.admin-menu { padding: 4px 8px; } #admin-menu .dropdown .admin-menu-tab a { - border-right: 1px solid #52565E; /* LTR */ + border-right: 1px solid #52565e; /* LTR */ } #admin-menu .dropdown li li a { border-right: none; /* LTR */ @@ -147,7 +147,7 @@ body.admin-menu { /* Second-and-more-level hovering */ #admin-menu .dropdown li li.expandable { - background: #45454A url(images/arrow.png) no-repeat 145px 6px; + background: #45454a url(images/arrow.png) no-repeat 145px 6px; } #admin-menu .dropdown li li:hover { background-color: #111; @@ -155,19 +155,19 @@ body.admin-menu { #admin-menu .dropdown li li:hover a, #admin-menu .dropdown li li:hover li:hover a, #admin-menu .dropdown li li:hover li:hover li:hover a { - color: #FFF; + color: #fff; } #admin-menu .dropdown li li.expandable:hover a, #admin-menu .dropdown li li.expandable:hover li.expandable:hover a { border-color: #444; - color: #EEE; + color: #eee; } #admin-menu .dropdown li li.expandable:hover li a, #admin-menu .dropdown li li.expandable:hover li.expandable:hover li a { border-color: #323232; } #admin-menu .dropdown li li:hover li a { - color: #EEE; + color: #eee; } /* Search form */ diff --git a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.inc b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.inc index e6169df700114a5367d6f97eb6393c71f6656327..5721d9adf8a22ffce11dd2c69067fc7b0689bb64 100644 --- a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.inc +++ b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.inc @@ -97,7 +97,7 @@ function admin_menu_tree_dynamic(array $expand_map) { $db_or = db_or(); foreach ($plids as $path_plids) { $db_and = db_and(); - // plids with value 0 may be ignored. + // Plids with value 0 may be ignored. foreach (array_filter($path_plids) as $column => $plid) { $db_and->condition($column, $plid); } @@ -269,7 +269,7 @@ function admin_menu_translate($router_item, $map) { // replace any other. // @todo Doing this instead leads to plenty of duplicate links below // admin/structure/menu; likely a hidden recursion problem. - // $router_item['mlid'] = $router_item['href'] . $router_item['mlid']; + // $router_item['mlid'] = $router_item['href'] . $router_item['mlid'];. $router_item['mlid'] = $router_item['href']; // Turn menu callbacks into regular menu items to make them visible. if ($router_item['type'] == MENU_CALLBACK) { @@ -278,10 +278,12 @@ function admin_menu_translate($router_item, $map) { // @see _menu_tree_check_access() $key = (50000 + $router_item['weight']) . ' ' . $router_item['title'] . ' ' . $router_item['mlid']; - return array($key => array( - 'link' => $router_item, - 'below' => array(), - )); + return array( + $key => array( + 'link' => $router_item, + 'below' => array(), + ), + ); } return array(); @@ -461,20 +463,22 @@ function admin_menu_links_icon() { '#access' => user_access('display drupal links'), '#href' => 'http://drupal.org', ); - // Add links to project issue queues. - foreach (module_list(FALSE, TRUE) as $module) { - $info = drupal_parse_info_file(drupal_get_path('module', $module) . '/' . $module . '.info'); - if (!isset($info['project']) || isset($links['icon']['drupal.org'][$info['project']])) { - continue; + if (variable_get('admin_menu_issue_queues', TRUE)) { + // Add links to project issue queues. + foreach (module_list(FALSE, TRUE) as $module) { + $info = drupal_parse_info_file(drupal_get_path('module', $module) . '/' . $module . '.info'); + if (!isset($info['project']) || isset($links['icon']['drupal.org'][$info['project']])) { + continue; + } + $links['icon']['drupal.org'][$info['project']] = array( + '#title' => t('@project issue queue', array('@project' => $info['name'])), + '#weight' => ($info['project'] == 'drupal' ? -10 : 0), + '#href' => 'http://drupal.org/project/issues/' . $info['project'], + '#options' => array( + 'query' => array('version' => (isset($info['core']) ? $info['core'] : 'All')), + ), + ); } - $links['icon']['drupal.org'][$info['project']] = array( - '#title' => t('@project issue queue', array('@project' => $info['name'])), - '#weight' => ($info['project'] == 'drupal' ? -10 : 0), - '#href' => 'http://drupal.org/project/issues/' . $info['project'], - '#options' => array( - 'query' => array('version' => (isset($info['core']) ? $info['core'] : 'All')), - ), - ); } // Add items to flush caches. $links['icon']['flush-cache'] = array( @@ -570,7 +574,7 @@ function admin_menu_links_users() { '#description' => t('Current anonymous / authenticated users'), '#weight' => -90, '#attributes' => array('class' => array('admin-menu-action', 'admin-menu-users')), - '#href' => (user_access('administer users') ? 'admin/people/people' : 'user'), + '#href' => (user_access('administer users') ? 'admin/people' : 'user'), ); return $links; } @@ -658,7 +662,7 @@ function admin_menu_theme_settings() { '#default_value' => variable_get('admin_menu_tweak_modules', 0), ); if (module_exists('util')) { - $form['tweaks']['admin_menu_tweak_modules']['#description'] .= '<br /><strong>' . t('If the Utility module was installed for this purpose, it can be safely disabled and uninstalled.') . '</strong>'; + $form['tweaks']['admin_menu_tweak_modules']['#description'] = '<br /><strong>' . t('If the Utility module was installed for this purpose, it can be safely disabled and uninstalled.') . '</strong>'; } $form['tweaks']['admin_menu_tweak_permissions'] = array( '#type' => 'checkbox', @@ -685,6 +689,11 @@ function admin_menu_theme_settings() { '#title' => t('Cache menu in client-side browser'), '#default_value' => variable_get('admin_menu_cache_client', 1), ); + $form['performance']['admin_menu_issue_queues'] = array( + '#type' => 'checkbox', + '#title' => t('Show Issue Queue links in icon menu'), + '#default_value' => variable_get('admin_menu_issue_queues', 1), + ); return system_settings_form($form); } @@ -763,18 +772,20 @@ function admin_menu_flush_cache($name = NULL) { if (!isset($caches[$name])) { return MENU_NOT_FOUND; } + $message = t('@title cache cleared.', array('@title' => $caches[$name]['title'])); } else { $caches[$name] = array( 'title' => t('Every'), 'callback' => 'drupal_flush_all_caches', ); + $message = t('All caches cleared.'); } // Pass the cache to flush forward to the callback. $function = $caches[$name]['callback']; $function($name); - drupal_set_message(t('!title cache cleared.', array('!title' => $caches[$name]['title']))); + drupal_set_message($message); // The JavaScript injects a destination request parameter pointing to the // originating page, so the user is redirected back to that page. Without @@ -907,4 +918,3 @@ function template_preprocess_admin_menu_icon(&$variables) { function theme_admin_menu_icon($variables) { return '<img class="admin-menu-icon" src="' . $variables['src'] . '" width="16" height="16" alt="' . $variables['alt'] . '" />'; } - diff --git a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.info b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.info index c6dbd892b3cc2379218eb52a365ed4fc01bb247b..ffd22e44222628438a7f441a4fd05f51f4d644e9 100644 --- a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.info +++ b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.info @@ -8,9 +8,8 @@ configure = admin/config/administration/admin_menu dependencies[] = system (>7.10) files[] = tests/admin_menu.test -; Information added by Drupal.org packaging script on 2014-12-19 -version = "7.x-3.0-rc5" +; Information added by Drupal.org packaging script on 2018-12-03 +version = "7.x-3.0-rc6" core = "7.x" project = "admin_menu" -datestamp = "1419029284" - +datestamp = "1543859284" diff --git a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.js b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.js index 2e28b554a2ce80b2b812ca5f89b261472be48ca8..1e32b3d65e3efc628c6bcefd5e14d4415de986f0 100644 --- a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.js +++ b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.js @@ -1,4 +1,8 @@ -(function($) { +/** + * @file + */ + +(function ($) { Drupal.admin = Drupal.admin || {}; Drupal.admin.behaviors = Drupal.admin.behaviors || {}; @@ -139,7 +143,7 @@ Drupal.admin.getCache = function (hash, onSuccess) { * * @see toolbar.js */ -Drupal.admin.height = function() { +Drupal.admin.height = function () { var $adminMenu = $('#admin-menu'); var height = $adminMenu.outerHeight(); // In IE, Shadow filter adds some extra height, so we need to remove it from @@ -161,7 +165,7 @@ Drupal.admin.height = function() { Drupal.admin.attachBehaviors = function (context, settings, $adminMenu) { if ($adminMenu.length) { $adminMenu.addClass('admin-menu-processed'); - $.each(Drupal.admin.behaviors, function() { + $.each(Drupal.admin.behaviors, function () { this(context, settings, $adminMenu); }); } @@ -206,7 +210,7 @@ Drupal.admin.behaviors.replacements = function (context, settings, $adminMenu) { */ Drupal.admin.behaviors.destination = function (context, settings, $adminMenu) { if (settings.admin_menu.destination) { - $('a.admin-menu-destination', $adminMenu).each(function() { + $('a.admin-menu-destination', $adminMenu).each(function () { this.search += (!this.search.length ? '?' : '&') + Drupal.settings.admin_menu.destination; }); } diff --git a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.map.inc b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.map.inc index f86e80cda48df15521751af4e527afcdaedf81e1..831e3243e4d61205558ff219cabbed54d933ebc0 100644 --- a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.map.inc +++ b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.map.inc @@ -80,7 +80,14 @@ function field_ui_admin_menu_map() { 'access callback' => 'user_access', 'access arguments' => array('administer site configuration'), ); - if (!call_user_func_array($bundle_info['admin']['access callback'], $bundle_info['admin']['access arguments'])) { + $access_arguments = $bundle_info['admin']['access arguments']; + if (isset($bundle_info['admin']['real path'])) { + $menu_item = menu_get_item($bundle_info['admin']['real path']); + if (isset($menu_item['map'])) { + $access_arguments = menu_unserialize(serialize($access_arguments), $menu_item['map']); + } + } + if (!call_user_func_array($bundle_info['admin']['access callback'], $access_arguments)) { continue; } diff --git a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.module b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.module index 795ad21118b80cdf935aa34cc1dc3286c40d1905..f9ce3aede3bbf8aae39a6cfbaccc6fa54771975b 100644 --- a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.module +++ b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.module @@ -63,7 +63,7 @@ function admin_menu_theme() { function admin_menu_menu() { // AJAX callback. // @see http://drupal.org/project/js - $items['js/admin_menu/cache'] = array( + $items['js/admin_menu/cache/%'] = array( 'page callback' => 'admin_menu_js_cache', 'delivery callback' => 'admin_menu_deliver', 'access arguments' => array('access administration menu'), @@ -78,7 +78,7 @@ function admin_menu_menu() { 'file' => 'system.admin.inc', 'file path' => drupal_get_path('module', 'system'), ); - $items['admin/config/administration/admin_menu'] = array( + $items['admin/config/administration/admin-menu'] = array( 'title' => 'Administration menu', 'description' => 'Adjust administration menu settings.', 'page callback' => 'drupal_get_form', @@ -211,7 +211,7 @@ function admin_menu_page_build(&$page) { // @todo Drupal.behaviors.adminMenuMarginTop is obsolete, but // hook_page_build() does not allow to set a CSS class on the body yet. // @see http://drupal.org/node/1473548, http://drupal.org/node/1194528 - //$page['#attributes']['class'][] = 'admin-menu'; + // $page['#attributes']['class'][] = 'admin-menu'; } if ($setting = variable_get('admin_menu_position_fixed', 1)) { $settings['position_fixed'] = $setting; @@ -230,7 +230,7 @@ function admin_menu_page_build(&$page) { if ($_GET['q'] == 'admin/modules' || strpos($_GET['q'], 'admin/modules/list') === 0) { $settings['tweak_modules'] = variable_get('admin_menu_tweak_modules', 0); } - if ($_GET['q'] == 'admin/people/permissions' || $_GET['q'] == 'admin/people/permissions/list') { + if (strpos($_GET['q'], 'admin/people/permissions') === 0) { $settings['tweak_permissions'] = variable_get('admin_menu_tweak_permissions', 0); } @@ -502,7 +502,6 @@ function admin_menu_output($complete = FALSE) { // @todo Move the below callbacks into hook_admin_menu_build() // implementations (and $module.admin_menu.inc). - // Add administration menu. if (!empty($components['admin_menu.menu']) || $complete) { $content['menu'] = admin_menu_links_menu(admin_menu_tree('management')); @@ -548,7 +547,10 @@ function admin_menu_output($complete = FALSE) { // Store the new hash for this user. if (!empty($_COOKIE['has_js']) && !$complete) { - admin_menu_cache_set($cid, md5($content)); + $cache = cache_get($cid, 'cache_admin_menu'); + if (!$cache || !isset($cache->data)) { + admin_menu_cache_set($cid, md5($content)); + } } return $content; @@ -603,11 +605,13 @@ function admin_menu_admin_menu_output_build(&$content) { * Implements hook_admin_menu_output_alter(). */ function admin_menu_admin_menu_output_alter(&$content) { - foreach ($content['menu'] as $key => $link) { - // Move local tasks on 'admin' into icon menu. - if ($key == 'admin/tasks' || $key == 'admin/index') { - $content['icon']['icon'][$key] = $link; - unset($content['menu'][$key]); + if (!empty($content['menu'])) { + foreach ($content['menu'] as $key => $link) { + // Move local tasks on 'admin' into icon menu. + if ($key == 'admin/tasks' || $key == 'admin/index') { + $content['icon']['icon'][$key] = $link; + unset($content['menu'][$key]); + } } } } @@ -677,6 +681,13 @@ function theme_admin_menu_links($variables) { $elements[$path]['#options']['attributes']['class'][] = 'admin-menu-destination'; } + // If the path has an alias replace the href with the alias. + if (module_exists('path')) { + if ($alias = drupal_get_path_alias($elements[$path]['#href'])) { + $elements[$path]['#href'] = $alias; + } + } + $link = l($elements[$path]['#title'], $elements[$path]['#href'], $elements[$path]['#options']); } // Handle plain text items, but do not interfere with menu additions. @@ -751,7 +762,7 @@ function admin_menu_translated_menu_link_alter(&$item, $map) { } } - // Don't waste cycles altering items that are not visible + // Don't waste cycles altering items that are not visible. if (!$item['access']) { return; } @@ -795,8 +806,8 @@ function admin_menu_flush_caches($uid = NULL) { cache_clear_all($cid, 'cache_menu', TRUE); // Flush client-side cache hashes. drupal_static_reset('admin_menu_cache_get'); - // db_table_exists() required for SimpleTest. - if (db_table_exists('cache_admin_menu')) { + // If cache_admin_menu is not empty, flush it. + if (!cache_is_empty('cache_admin_menu')) { cache_clear_all(isset($uid) ? $cid : '*', 'cache_admin_menu', TRUE); } } diff --git a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.uid1.css b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.uid1.css index e375cfe66650cb85a31e72453d853dc208df929c..105fd2423ba11da229e46041af54262138b19097 100644 --- a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.uid1.css +++ b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu.uid1.css @@ -1,4 +1,3 @@ - /** * @file * Administration menu color override for uid1. diff --git a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar-rtl.css b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar-rtl.css new file mode 100644 index 0000000000000000000000000000000000000000..a159034d012810615a2a2c42afd8ed3c6a4b0874 --- /dev/null +++ b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar-rtl.css @@ -0,0 +1,4 @@ +#admin-menu > div > .dropdown > li > a, +#admin-menu > div > .dropdown > li > span { + border-left: 0; +} diff --git a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.css b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.css index a3e9f3e300ca067b5fbcf905d0bae9960b040780..f1bc09357f56d19933faa441157ba45c234dd36d 100644 --- a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.css +++ b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.css @@ -1,4 +1,3 @@ - /** * @file * Toolbar style for Administration menu. @@ -63,8 +62,9 @@ body div#toolbar.toolbar { background: url(toolbar.png) no-repeat 0 -45px; text-indent: -9999px; } -#admin-menu > div > .dropdown > li > a { - border-right: 0; +#admin-menu > div > .dropdown > li > a, +#admin-menu > div > .dropdown > li > span { + border-right: 0; /* LTR */ margin-bottom: 4px; padding: 2px 10px 3px; } @@ -142,4 +142,3 @@ body div#toolbar.toolbar { #admin-menu .shortcut-toolbar a { display: block; } - diff --git a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.info b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.info index fa4ca095e82b44e5a5c95f9b8153811f46f04300..340ced0705afcf8220df16944bfbaad47e1d9afe 100644 --- a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.info +++ b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.info @@ -4,9 +4,8 @@ package = Administration core = 7.x dependencies[] = admin_menu -; Information added by Drupal.org packaging script on 2014-12-19 -version = "7.x-3.0-rc5" +; Information added by Drupal.org packaging script on 2018-12-03 +version = "7.x-3.0-rc6" core = "7.x" project = "admin_menu" -datestamp = "1419029284" - +datestamp = "1543859284" diff --git a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.install b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.install index bf067d7858236469512e9b6b8a2eeaeb2bcd79f7..f6449dcd46e4cfec0c82cee93639c3f23a87826c 100644 --- a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.install +++ b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.install @@ -34,4 +34,3 @@ function admin_menu_toolbar_update_6300() { ->condition('name', 'admin_menu_toolbar') ->execute(); } - diff --git a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module index c6111bdc4d6ed4f8f20dc3c56eb4d9eeac868263..0f5c066284367900b38f4ba2825d5ace381ca3f9 100644 --- a/profiles/wcm_base/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module +++ b/profiles/wcm_base/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module @@ -115,4 +115,3 @@ function admin_menu_toolbar_admin_menu_output_alter(&$content) { $content['account']['account']['#options']['html'] = TRUE; } } - diff --git a/profiles/wcm_base/modules/contrib/admin_menu/tests/admin_menu.test b/profiles/wcm_base/modules/contrib/admin_menu/tests/admin_menu.test index 4b48c9ab54695f8b698278afd62b7829f4fd4d2e..b7c611d7a82baa9c5ee851e6adc5ff236675559a 100644 --- a/profiles/wcm_base/modules/contrib/admin_menu/tests/admin_menu.test +++ b/profiles/wcm_base/modules/contrib/admin_menu/tests/admin_menu.test @@ -16,7 +16,10 @@ class AdminMenuWebTestCase extends DrupalWebTestCase { 'admin_menu' => 'access administration menu', ); - function setUp() { + /** + * + */ + public function setUp() { // Enable admin menu module and any other modules. $modules = func_get_args(); $modules = isset($modules[0]) ? $modules[0] : $modules; @@ -108,12 +111,17 @@ class AdminMenuWebTestCase extends DrupalWebTestCase { $xpath = '//div[@id="admin-menu"]/div/ul' . implode('/parent::li/ul', $xpath); $this->assertNoElementByXPath($xpath, $args, $message . ' link not found.'); } + } /** * Tests menu links depending on user permissions. */ class AdminMenuPermissionsTestCase extends AdminMenuWebTestCase { + + /** + * + */ public static function getInfo() { return array( 'name' => 'Menu link access permissions', @@ -122,14 +130,17 @@ class AdminMenuPermissionsTestCase extends AdminMenuWebTestCase { ); } - function setUp() { + /** + * + */ + public function setUp() { parent::setUp(array('node')); } /** * Test that the links are added to the page (no JS testing). */ - function testPermissions() { + public function testPermissions() { module_enable(array('contact')); $this->resetAll(); @@ -140,7 +151,7 @@ class AdminMenuPermissionsTestCase extends AdminMenuWebTestCase { // Create a user who // - can access content overview // - cannot access drupal.org links - // - cannot administer Contact module + // - cannot administer Contact module. $permissions = $this->basePermissions + array( 'access content overview', ); @@ -156,7 +167,7 @@ class AdminMenuPermissionsTestCase extends AdminMenuWebTestCase { // Create a user "reversed" to the above; i.e., who // - cannot access content overview // - can access drupal.org links - // - can administer Contact module + // - can administer Contact module. $permissions = $this->basePermissions + array( 'display drupal links', 'administer contact forms', @@ -172,7 +183,7 @@ class AdminMenuPermissionsTestCase extends AdminMenuWebTestCase { /** * Tests handling of links pointing to category/overview pages. */ - function testCategories() { + public function testCategories() { // Create a user with minimum permissions. $admin_user = $this->drupalCreateUser($this->basePermissions); $this->drupalLogin($admin_user); @@ -201,7 +212,7 @@ class AdminMenuPermissionsTestCase extends AdminMenuWebTestCase { /** * Tests that user role and permission changes are properly taken up. */ - function testPermissionChanges() { + public function testPermissionChanges() { // Create a user who is able to change permissions. $permissions = $this->basePermissions + array( 'administer permissions', @@ -253,12 +264,17 @@ class AdminMenuPermissionsTestCase extends AdminMenuWebTestCase { // Verify that Structure » Content types does not appear. $this->assertNoLinkTrailByTitle(array(t('Structure'), t('Content types'))); } + } /** * Tests appearance, localization, and escaping of dynamic links. */ class AdminMenuDynamicLinksTestCase extends AdminMenuWebTestCase { + + /** + * + */ public static function getInfo() { return array( 'name' => 'Dynamic links', @@ -267,14 +283,17 @@ class AdminMenuDynamicLinksTestCase extends AdminMenuWebTestCase { ); } - function setUp() { + /** + * + */ + public function setUp() { parent::setUp(array('node')); } /** * Tests node type links. */ - function testNode() { + public function testNode() { $type = $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article')); // Create a content-type with special characters. $type = $this->drupalCreateContentType(array('type' => 'special', 'name' => 'Cool & Special')); @@ -324,7 +343,7 @@ class AdminMenuDynamicLinksTestCase extends AdminMenuWebTestCase { /** * Tests Add content links. */ - function testNodeAdd() { + public function testNodeAdd() { $type = $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article')); // Verify that "Add content" does not appear for unprivileged users. @@ -359,12 +378,17 @@ class AdminMenuDynamicLinksTestCase extends AdminMenuWebTestCase { t('Add content'), )); } + } /** * Tests appearance of different types of links. */ class AdminMenuLinkTypesTestCase extends AdminMenuWebTestCase { + + /** + * + */ public static function getInfo() { return array( 'name' => 'Link types', @@ -373,7 +397,10 @@ class AdminMenuLinkTypesTestCase extends AdminMenuWebTestCase { ); } - function setUp() { + /** + * + */ + public function setUp() { parent::setUp(array('help')); $permissions = module_invoke_all('permission'); @@ -385,7 +412,7 @@ class AdminMenuLinkTypesTestCase extends AdminMenuWebTestCase { /** * Tests appearance of different router item link types. */ - function testLinkTypes() { + public function testLinkTypes() { // Verify that MENU_NORMAL_ITEMs appear. $this->assertLinkTrailByTitle(array( t('Configuration'), @@ -420,12 +447,17 @@ class AdminMenuLinkTypesTestCase extends AdminMenuWebTestCase { ':title' => t('Index'), ), "Icon » Index link found."); } + } /** * Tests customized menu links. */ class AdminMenuCustomizedTestCase extends AdminMenuWebTestCase { + + /** + * + */ public static function getInfo() { return array( 'name' => 'Customized links', @@ -434,7 +466,10 @@ class AdminMenuCustomizedTestCase extends AdminMenuWebTestCase { ); } - function setUp() { + /** + * + */ + public function setUp() { parent::setUp(array('menu')); $this->admin_user = $this->drupalCreateUser($this->basePermissions + array( @@ -446,7 +481,7 @@ class AdminMenuCustomizedTestCase extends AdminMenuWebTestCase { /** * Test disabled custom links. */ - function testCustomDisabled() { + public function testCustomDisabled() { $type = $this->drupalCreateContentType(); $node = $this->drupalCreateNode(array('type' => $type->type)); $text = $this->randomName(); @@ -488,7 +523,7 @@ class AdminMenuCustomizedTestCase extends AdminMenuWebTestCase { /** * Tests external links. */ - function testCustomExternal() { + public function testCustomExternal() { // Add a custom link to the node to the menu. $edit = array( 'link_path' => 'http://example.com', @@ -516,5 +551,5 @@ class AdminMenuCustomizedTestCase extends AdminMenuWebTestCase { ':path' => $path, ))->fetchField(); } -} +} diff --git a/profiles/wcm_base/modules/contrib/link/PATCHES.txt b/profiles/wcm_base/modules/contrib/link/PATCHES.txt deleted file mode 100644 index 77b4d7bbc68a5ccf43812423fd720667a487fd90..0000000000000000000000000000000000000000 --- a/profiles/wcm_base/modules/contrib/link/PATCHES.txt +++ /dev/null @@ -1,4 +0,0 @@ -The following patches have been applied to this project: -- http://drupal.org/files/issues/link.allow-tel-links-1993920-6.patch - -This file was automatically generated by Drush Make (http://drupal.org/project/drush). diff --git a/profiles/wcm_base/modules/contrib/link/README.txt b/profiles/wcm_base/modules/contrib/link/README.txt index 387cc594f614df0a0094de89fed60ce3362e2d82..a258d4dd8628e53c15aee2bd683ebe6655e205f3 100644 --- a/profiles/wcm_base/modules/contrib/link/README.txt +++ b/profiles/wcm_base/modules/contrib/link/README.txt @@ -1,33 +1,101 @@ -Module description ------------------- -The link module can be count to the top 50 modules 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. +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: -Requirements / Dependencies ---------------------------- -1. Drupal 6: Custom content module (CCK) -2. Drupal 7: Fields API is provided already by core [no dependencies]. -3. Drupal 8: Link module is in core now. No module installation needed. Yay! Don't forget to activate it. It's deactivated by default. + * Fields API (Fields API is provided already by core) + * Panels (https://drupal.org/project/panels) -INFO Since some misleading user reports we need to clarify here - Link module is NOT about to add links to any menus or the navigation nor primary/secondary menu. This can be done with default menu module (part of Drupal core). The Link module provides an additional custom field for storing and validating links to be added with any content type, which means another input block additional to your text-body, title, image and any other input you can make on new content creation. +Drupal 8: -Installation + * Link is in core now. No installation needed. Yay! Don't forget to activate + it. It's deactivated by default. + + +INSTALLATION ------------ -1. Drop the entire link module directory into your 'sites/all/modules' folder -2. Enable the module from the Administration area modules page (admin/build/modules) -3. Create or Edit a content-type and add a new field of type link (admin/content/types in D6, admin/structure/types in D7) -Configuration +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 + * 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. +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 -The link module 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 -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 +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. \ No newline at end of file +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 diff --git a/profiles/wcm_base/modules/contrib/link/link-rtl.css b/profiles/wcm_base/modules/contrib/link/link-rtl.css index 0359487e2b36540b46908fbc3c34d40386b2c743..613db5da6cd06fbc28aee5eeafaa747fee4c8ca9 100644 --- a/profiles/wcm_base/modules/contrib/link/link-rtl.css +++ b/profiles/wcm_base/modules/contrib/link/link-rtl.css @@ -1,7 +1,6 @@ .link-field-column { float: right; } - .link-field-column.link-field-url .form-text { direction: ltr; text-align: left; diff --git a/profiles/wcm_base/modules/contrib/link/link.css b/profiles/wcm_base/modules/contrib/link/link.css index 1590e7ad51bc27bf461157af85bcfabd6846d0b7..6250df7f46fdc1d9019f0635ef67b3aa50d5718b 100644 --- a/profiles/wcm_base/modules/contrib/link/link.css +++ b/profiles/wcm_base/modules/contrib/link/link.css @@ -2,7 +2,6 @@ float: left; width: 48%; } - .link-field-column .form-text { width: 95%; } diff --git a/profiles/wcm_base/modules/contrib/link/link.diff.inc b/profiles/wcm_base/modules/contrib/link/link.diff.inc index 9e34123ae4d9fd4324f60fe2919af89c4299bf58..b01ba6e7de34860b4a98ae75bf236d95ff7a3370 100644 --- a/profiles/wcm_base/modules/contrib/link/link.diff.inc +++ b/profiles/wcm_base/modules/contrib/link/link.diff.inc @@ -11,11 +11,11 @@ function link_field_diff_view($items, $context) { $diff_items = array(); foreach ($items as $delta => $item) { - if ($item['url'] && $item['title']) { + if ($item['url'] && isset($item['title'])) { $diff_items[$delta] = $item['title'] . ' (' . $item['url'] . ')'; } else { - $diff_items[$delta] = $item['title'] . $item['url']; + $diff_items[$delta] = $item['url']; } } return $diff_items; diff --git a/profiles/wcm_base/modules/contrib/link/link.info b/profiles/wcm_base/modules/contrib/link/link.info index 4ff71e256486b620c1ca5a04103dd746e07f876a..351e1782bc84b0458b6ff91638cb7a1eee74026b 100644 --- a/profiles/wcm_base/modules/contrib/link/link.info +++ b/profiles/wcm_base/modules/contrib/link/link.info @@ -3,7 +3,6 @@ description = Defines simple link field types. core = 7.x package = Fields -files[] = link.module files[] = link.migrate.inc ; Tests @@ -19,9 +18,8 @@ files[] = tests/link.validate.test files[] = views/link_views_handler_argument_target.inc files[] = views/link_views_handler_filter_protocol.inc -; Information added by Drupal.org packaging script on 2016-01-15 -version = "7.x-1.4" +; Information added by Drupal.org packaging script on 2019-02-20 +version = "7.x-1.6" core = "7.x" project = "link" -datestamp = "1452830642" - +datestamp = "1550680687" diff --git a/profiles/wcm_base/modules/contrib/link/link.install b/profiles/wcm_base/modules/contrib/link/link.install index 14e745d42158981b34657879dcb846f66f83e62c..8125b6991231335dfe363003f387080bea64c6b2 100644 --- a/profiles/wcm_base/modules/contrib/link/link.install +++ b/profiles/wcm_base/modules/contrib/link/link.install @@ -6,10 +6,38 @@ */ /** - * Upgrade notes: - * Things we need to make sure work when upgrading from Drupal 6 to Drupal 7: + * Upgrade notes. + * + * Things we need to make sure work when upgrading from Drupal 6 to Drupal 7:. */ +/** + * Implements hook_uninstall(). + */ +function link_install() { + // Notify the user they may want to install token. + if (!module_exists('token')) { + $t = get_t(); + drupal_set_message($t('If you install the <a href="!url" target="blank">Token</a>, static title can use any other entity field as its value.', array( + '!url' => 'http://drupal.org/project/token', + ))); + } +} + +/** + * Removes unused link_extra_domains variable. + */ +function link_update_7002() { + variable_del('link_extra_domains'); +} + +/** + * Implements hook_uninstall(). + */ +function link_uninstall() { + variable_del('link_allowed_domains'); +} + /** * Implements hook_field_schema(). */ @@ -46,19 +74,21 @@ function link_update_last_removed() { } /** - * Handles moving settings data from field_config.data to field_config_instance.data. + * Implements hook_update_N(). + * + * Handles moving settings data from field_config.data to + * field_config_instance.data. */ function link_update_7000() { - - // For each field that is a link field, we need to copy the settings from the general field level down to the instance. - //$field_data = array(); + + // For each field that is a link field, we need to copy the settings from the + // general field level down to the instance. $result = db_query("SELECT id, field_name, data FROM {field_config} WHERE module = 'link' AND type = 'link_field'"); foreach ($result as $field) { - $field_id = $field->id; - $name = $field->field_name; + $field_data = unserialize($field->data); - - $instances = db_query("SELECT id, data FROM {field_config_instance} WHERE field_id = :field_id", array(':field_id' => $field_id)); + + $instances = db_query("SELECT id, data FROM {field_config_instance} WHERE field_id = :field_id", array(':field_id' => $field->id)); foreach ($instances as $instance) { // If this field has been updated already, we want to skip it. $instance_data = unserialize($instance->data); @@ -71,8 +101,8 @@ function link_update_7000() { } } if ($update_instance) { - // update the database. - $num_updated = db_update('field_config_instance') + // Update the database. + db_update('field_config_instance') ->fields(array('data' => serialize($instance_data))) ->condition('id', $instance->id) ->execute(); @@ -80,22 +110,19 @@ function link_update_7000() { } } } - + return t("Instance settings have been set with the data from the field settings."); } /** - * Renames all displays from foobar to link_foobar + * Renames all displays from foobar to link_foobar. */ function link_update_7001() { // Update the display type for each link field type. $result = db_query("SELECT id, field_name, data FROM {field_config} WHERE module = 'link' AND type = 'link_field'"); foreach ($result as $field) { - $field_id = $field->id; - $name = $field->field_name; - $field_data = unserialize($field->data); - - $instances = db_query("SELECT id, data FROM {field_config_instance} WHERE field_id = :field_id", array(':field_id' => $field_id)); + + $instances = db_query("SELECT id, data FROM {field_config_instance} WHERE field_id = :field_id", array(':field_id' => $field->id)); foreach ($instances as $instance) { // If this field has been updated already, we want to skip it. $instance_data = unserialize($instance->data); diff --git a/profiles/wcm_base/modules/contrib/link/link.migrate.inc b/profiles/wcm_base/modules/contrib/link/link.migrate.inc index fc8363f6d1d78261c335c927a0dfbf50fbb0308c..4900051007ce43426799665fcf3cc2dbc3d69bcc 100644 --- a/profiles/wcm_base/modules/contrib/link/link.migrate.inc +++ b/profiles/wcm_base/modules/contrib/link/link.migrate.inc @@ -11,11 +11,9 @@ * $this->addFieldMapping('field_my_link', 'source_url'); * $this->addFieldMapping('field_my_link:title', 'source_title'); * $this->addFieldMapping('field_my_link:attributes', 'source_attributes'); - * @endcode * - * With earlier versions of Migrate, you must pass an arguments array: + * # With earlier versions of Migrate, you must pass an arguments array: * - * @code * $link_args = array( * 'title' => array('source_field' => 'source_title'), * 'attributes' => array('source_field' => 'source_attributes'), @@ -25,6 +23,10 @@ * @endcode */ +if (!class_exists('MigrateFieldHandler')) { + return; +} + /** * Implements hook_migrate_api(). */ @@ -35,12 +37,20 @@ function link_migrate_api() { ); } +// @codingStandardsIgnoreLine class MigrateLinkFieldHandler extends MigrateFieldHandler { + + /** + * Construct. + */ public function __construct() { $this->registerTypes(array('link_field')); } - static function arguments($title = NULL, $attributes = NULL, $language = NULL) { + /** + * Arguments. + */ + public static function arguments($title = NULL, $attributes = NULL, $language = NULL) { $arguments = array(); if (!is_null($title)) { $arguments['title'] = $title; @@ -57,16 +67,21 @@ class MigrateLinkFieldHandler extends MigrateFieldHandler { /** * Implementation of MigrateFieldHandler::fields(). * - * @param $type - * The field type. - * @param $instance - * Instance info for the field. + * @param array $type + * The field type. + * @param array $instance + * Instance info for the field. * @param Migration $migration - * The migration context for the parent field. We can look at the mappings - * and determine which subfields are relevant. + * The migration context for the parent field. We can look at the mappings + * and determine which subfields are relevant. + * * @return array + * Array with values. + * + * @codingStandardsIgnoreStart */ public function fields($type, $instance, $migration = NULL) { + // @codingStandardsIgnoreEnd return array( 'title' => t('Subfield: The link title attribute'), 'attributes' => t('Subfield: The attributes for this link'), @@ -74,6 +89,9 @@ class MigrateLinkFieldHandler extends MigrateFieldHandler { ); } + /** + * Prepare. + */ public function prepare($entity, array $field_info, array $instance, array $values) { if (isset($values['arguments'])) { $arguments = $values['arguments']; @@ -105,9 +123,17 @@ class MigrateLinkFieldHandler extends MigrateFieldHandler { } } $item['url'] = $value; - $return[$language][$delta] = $item; + + if (is_array($language)) { + $current_language = $language[$delta]; + } + else { + $current_language = $language; + } + $return[$current_language][$delta] = $item; } return isset($return) ? $return : NULL; } + } diff --git a/profiles/wcm_base/modules/contrib/link/link.module b/profiles/wcm_base/modules/contrib/link/link.module index 11db2382ffad3c00d864b23db6f16a006417bf1d..8b3094f3614e4fbc0f71c39210e460d261d56e6b 100644 --- a/profiles/wcm_base/modules/contrib/link/link.module +++ b/profiles/wcm_base/modules/contrib/link/link.module @@ -10,8 +10,6 @@ define('LINK_INTERNAL', 'internal'); define('LINK_FRONT', 'front'); define('LINK_EMAIL', 'email'); define('LINK_NEWS', 'news'); -define('LINK_DOMAINS', 'aero|arpa|asia|biz|build|com|cat|ceo|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|post|pro|tel|travel|mobi|local|xxx'); - define('LINK_TARGET_DEFAULT', 'default'); define('LINK_TARGET_NEW_WINDOW', '_blank'); define('LINK_TARGET_TOP', '_top'); @@ -22,6 +20,22 @@ define('LINK_TARGET_USER', 'user'); */ define('LINK_URL_MAX_LENGTH', 2048); +/** + * Implements hook_help(). + */ +function link_help($path, $arg) { + switch ($path) { + case 'admin/help#link': + $output = '<p><strong>About</strong></p>'; + $output .= '<p>' . 'The link provides a standard custom content field for links. Links can be easily added 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.' . '</p>'; + $output .= '<p>' . '<strong>Requirements / Dependencies</strong>' . '</p>'; + $output .= '<p>' . 'Fields API is provided already by core [no dependencies].' . '</p>'; + $output .= '<p><strong>Configuration</strong></p>'; + $output .= '<p>' . '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.' . '</p>'; + return $output; + } +} + /** * Implements hook_field_info(). */ @@ -98,6 +112,7 @@ function link_field_instance_settings_form($field, $instance) { 'optional' => t('Optional Title'), 'required' => t('Required Title'), 'value' => t('Static Title'), + 'select' => t('Selected Title'), 'none' => t('No Title'), ); @@ -111,9 +126,26 @@ function link_field_instance_settings_form($field, $instance) { $form['title_value'] = array( '#type' => 'textfield', - '#title' => t('Static title'), + '#title' => t('Static or default title'), '#default_value' => isset($instance['settings']['title_value']) ? $instance['settings']['title_value'] : '', - '#description' => t('This title will always be used if “Static Title” is selected above.'), + '#description' => t('This title will 1) always be used if "Static Title" is selected above, or 2) used if "Optional title" is selected above and no title is entered when creating content.'), + '#states' => array( + 'visible' => array( + ':input[name="instance[settings][title]"]' => array('value' => 'value'), + ), + ), + ); + + $form['title_allowed_values'] = array( + '#type' => 'textarea', + '#title' => t('Title allowed values'), + '#default_value' => isset($instance['settings']['title_allowed_values']) ? $instance['settings']['title_allowed_values'] : '', + '#description' => t('When using "Selected Title", you can allow users to select the title from a limited set of values (eg. Home, Office, Other). Enter here all possible values that title can take, one value per line.'), + '#states' => array( + 'visible' => array( + ':input[name="instance[settings][title]"]' => array('value' => 'select'), + ), + ), ); $form['title_label_use_field_label'] = array( @@ -181,7 +213,7 @@ function link_field_instance_settings_form($field, $instance) { $form['attributes']['rel'] = array( '#type' => 'textfield', '#title' => t('Rel Attribute'), - '#description' => t('When output, this link will have this rel attribute. The most common usage is <a href="http://en.wikipedia.org/wiki/Nofollow">rel="nofollow"</a> which prevents some search engines from spidering entered links.'), + '#description' => t('When output, this link will have this rel attribute. The most common usage is <a href="http://en.wikipedia.org/wiki/Nofollow" target="blank">rel="nofollow"</a> which prevents some search engines from spidering entered links.'), '#default_value' => empty($instance['settings']['attributes']['rel']) ? '' : $instance['settings']['attributes']['rel'], '#field_prefix' => 'rel = "', '#field_suffix' => '"', @@ -218,7 +250,7 @@ function link_field_instance_settings_form($field, $instance) { $form['attributes']['title'] = array( '#title' => t("Default link 'title' Attribute"), '#type' => 'textfield', - '#description' => t('When output, links will use this "title" attribute if the user does not provide one and when different from the link text. Read <a href="http://www.w3.org/TR/WCAG10-HTML-TECHS/#links">WCAG 1.0 Guidelines</a> for links comformances. Tokens values will be evaluated.'), + '#description' => t('When output, links will use this "title" attribute if the user does not provide one and when different from the link text. Read <a href="http://www.w3.org/TR/WCAG10-HTML-TECHS/#links" target="blank">WCAG 1.0 Guidelines</a> for links comformances. Tokens values will be evaluated.'), '#default_value' => empty($instance['settings']['attributes']['title']) ? '' : $instance['settings']['attributes']['title'], '#field_prefix' => 'title = "', '#field_suffix' => '"', @@ -228,11 +260,17 @@ function link_field_instance_settings_form($field, $instance) { } /** + * Form validate. + * * #element_validate handler for link_field_instance_settings_form(). */ function link_field_settings_form_validate($element, &$form_state, $complete_form) { if ($form_state['values']['instance']['settings']['title'] === 'value' && empty($form_state['values']['instance']['settings']['title_value'])) { - form_set_error('title_value', t('A default title must be provided if the title is a static value.')); + form_set_error('instance][settings][title_value', t('A default title must be provided if the title is a static value.')); + } + if ($form_state['values']['instance']['settings']['title'] === 'select' + && empty($form_state['values']['instance']['settings']['title_allowed_values'])) { + form_set_error('instance][settings][title_allowed_values', t('You must enter one or more allowed values for link Title, the title is a selected value.')); } if (!empty($form_state['values']['instance']['settings']['display']['url_cutoff']) && !is_numeric($form_state['values']['instance']['settings']['display']['url_cutoff'])) { form_set_error('display', t('URL Display Cutoff value must be numeric.')); @@ -277,6 +315,16 @@ function link_field_validate($entity_type, $entity, $field, $instance, $langcode } } + foreach ($items as $delta => $value) { + if (isset($value['attributes']) && is_string($value['attributes'])) { + $errors[$field['field_name']][$langcode][$delta][] = array( + 'error' => 'link_required', + 'message' => t('String values are not acceptable for attributes.'), + 'error_element' => array('url' => TRUE, 'title' => FALSE), + ); + } + } + if ($instance['settings']['url'] === 'optional' && $instance['settings']['title'] === 'optional' && $instance['required'] && !$optional_field_found) { $errors[$field['field_name']][$langcode][0][] = array( 'error' => 'link_required', @@ -343,10 +391,10 @@ function link_field_widget_form(&$form, &$form_state, $field, $instance, $langco * Implements hook_field_widget_error(). */ function link_field_widget_error($element, $error, $form, &$form_state) { - if ($error['error_element']['title']) { + if (!empty($error['error_element']['title'])) { form_error($element['title'], $error['message']); } - elseif ($error['error_element']['url']) { + elseif (!empty($error['error_element']['url'])) { form_error($element['url'], $error['message']); } } @@ -372,23 +420,21 @@ function _link_load($field, $item, $instance) { /** * Prepares the item attributes and url for storage. * - * @param $item - * Link field values. - * - * @param $delta - * The sequence number for current values. - * - * @param $field - * The field structure array. - * - * @param $entity - * Entity object. - * - * @param $instance - * The instance structure for $field on $entity's bundle. + * @param array $item + * Link field values. + * @param array $delta + * The sequence number for current values. + * @param array $field + * The field structure array. + * @param object $entity + * Entity object. + * @param array $instance + * The instance structure for $field on $entity's bundle. * + * @codingStandardsIgnoreStart */ function _link_process(&$item, $delta, $field, $entity, $instance) { + // @codingStandardsIgnoreEnd // Trim whitespace from URL. if (!empty($item['url'])) { $item['url'] = trim($item['url']); @@ -447,9 +493,10 @@ function _link_validate(&$item, $delta, $field, $entity, $instance, $langcode, & 'error_element' => array('url' => TRUE, 'title' => FALSE), ); } - // In a totally bizzaro case, where URLs and titles are optional but the field is required, ensure there is at least one link. + // In a totally bizzaro case, where URLs and titles are optional but the field + // is required, ensure there is at least one link. if ($instance['settings']['url'] === 'optional' && $instance['settings']['title'] === 'optional' - && (strlen(trim($item['url'])) !== 0 || strlen(trim($item['title'])) !== 0)) { + && (strlen(trim($item['url'])) !== 0 || strlen(trim($item['title'])) !== 0)) { $optional_field_found = TRUE; } // Require entire field. @@ -465,16 +512,19 @@ function _link_validate(&$item, $delta, $field, $entity, $instance, $langcode, & /** * Clean up user-entered values for a link field according to field settings. * - * @param array $item + * @param array $item * A single link item, usually containing url, title, and attributes. - * @param int $delta + * @param int $delta * The delta value if this field is one of multiple fields. - * @param array $field + * @param array $field * The CCK field definition. - * @param object $entity + * @param object $entity * The entity containing this link. + * + * @codingStandardsIgnoreStart */ function _link_sanitize(&$item, $delta, &$field, $instance, &$entity) { + // @codingStandardsIgnoreEnd // Don't try to process empty links. if (empty($item['url']) && empty($item['title'])) { return; @@ -488,7 +538,7 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$entity) { $entity_info = entity_get_info($entity_type); $property_id = $entity_info['entity keys']['id']; $entity_token_type = isset($entity_info['token type']) ? $entity_info['token type'] : ( - $entity_type == 'taxonomy_term' || $entity_type == 'taxonomy_vocabulary' ? str_replace('taxonomy_', '', $entity_type) : $entity_type + $entity_type == 'taxonomy_term' || $entity_type == 'taxonomy_vocabulary' ? str_replace('taxonomy_', '', $entity_type) : $entity_type ); if (isset($instance['settings']['enable_tokens']) && $instance['settings']['enable_tokens']) { $text_tokens = token_scan($item['url']); @@ -516,10 +566,11 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$entity) { if (!empty($url_parts['url'])) { $item['url'] = url($url_parts['url'], - array('query' => isset($url_parts['query']) ? $url_parts['query'] : NULL, - 'fragment' => isset($url_parts['fragment']) ? $url_parts['fragment'] : NULL, - 'absolute' => !empty($instance['settings']['absolute_url']), - 'html' => TRUE, + array( + 'query' => isset($url_parts['query']) ? $url_parts['query'] : NULL, + 'fragment' => isset($url_parts['fragment']) ? $url_parts['fragment'] : NULL, + 'absolute' => !empty($instance['settings']['absolute_url']), + 'html' => TRUE, ) ); } @@ -551,15 +602,20 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$entity) { } } // Use the title defined by the user at the widget level. - elseif (isset($item['title'])) { + elseif (drupal_strlen(trim($item['title']))) { $title = $item['title']; } + // Use the static title if a user-defined title is optional and a static title + // has been defined. + elseif ($instance['settings']['title'] == 'optional' && drupal_strlen(trim($instance['settings']['title_value']))) { + $title = $instance['settings']['title_value']; + } else { $title = ''; } // Replace title tokens. - if ($title && ($instance['settings']['title'] == 'value' || $instance['settings']['enable_tokens'])) { + if ($title && $instance['settings']['enable_tokens']) { $text_tokens = token_scan($title); if (!empty($text_tokens)) { // Load the entity if necessary for entities in views. @@ -572,10 +628,25 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$entity) { } $title = token_replace($title, array($entity_token_type => $entity_loaded)); } - $title = filter_xss($title, array('b', 'br', 'code', 'em', 'i', 'img', 'span', 'strong', 'sub', 'sup', 'tt', 'u')); + } + if ($title && ($instance['settings']['title'] == 'value' || $instance['settings']['enable_tokens'])) { + $title = filter_xss($title, array( + 'b', + 'br', + 'code', + 'em', + 'i', + 'img', + 'span', + 'strong', + 'sub', + 'sup', + 'tt', + 'u', + )); $item['html'] = TRUE; } - $item['title'] = empty($title) ? $item['display_url'] : $title; + $item['title'] = empty($title) && $title !== '0' ? $item['display_url'] : $title; if (!isset($item['attributes'])) { $item['attributes'] = array(); @@ -622,7 +693,7 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$entity) { // Handle "title" link attribute. if (!empty($item['attributes']['title']) && module_exists('token')) { $text_tokens = token_scan($item['attributes']['title']); - if (!empty($text_tokens)) { + if (!empty($text_tokens)) { // Load the entity (necessary for entities in views). if (isset($entity->{$property_id})) { $entity_loaded = entity_load($entity_type, array($entity->{$property_id})); @@ -633,7 +704,20 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$entity) { } $item['attributes']['title'] = token_replace($item['attributes']['title'], array($entity_token_type => $entity_loaded)); } - $item['attributes']['title'] = filter_xss($item['attributes']['title'], array('b', 'br', 'code', 'em', 'i', 'img', 'span', 'strong', 'sub', 'sup', 'tt', 'u')); + $item['attributes']['title'] = filter_xss($item['attributes']['title'], array( + 'b', + 'br', + 'code', + 'em', + 'i', + 'img', + 'span', + 'strong', + 'sub', + 'sup', + 'tt', + 'u', + )); } // Handle attribute classes. if (!empty($item['attributes']['class'])) { @@ -685,7 +769,8 @@ function _link_parse_url($url) { * Replaces the PHP parse_str() function. * * Because parse_str replaces the following characters in query parameters name - * in order to maintain compatibility with deprecated register_globals directive: + * in order to maintain compatibility with deprecated register_globals + * directive: * * - chr(32) ( ) (space) * - chr(46) (.) (dot) @@ -732,7 +817,14 @@ function link_theme() { 'variables' => array('element' => NULL, 'field' => NULL), ), 'link_formatter_link_domain' => array( - 'variables' => array('element' => NULL, 'display' => NULL, 'field' => NULL), + 'variables' => array( + 'element' => NULL, + 'display' => NULL, + 'field' => NULL, + ), + ), + 'link_formatter_link_no_protocol' => array( + 'variables' => array('element' => NULL, 'field' => NULL), ), 'link_formatter_link_title_plain' => array( 'variables' => array('element' => NULL, 'field' => NULL), @@ -819,7 +911,8 @@ function _link_default_attributes() { * Build the form element. When creating a form using FAPI #process, * note that $element['#value'] is already set. * - * The $fields array is in $complete_form['#field_info'][$element['#field_name']]. + * The $fields array is in + * $complete_form['#field_info'][$element['#field_name']]. */ function link_field_process($element, $form_state, $complete_form) { $instance = field_widget_instance($element, $form_state); @@ -831,7 +924,7 @@ function link_field_process($element, $form_state, $complete_form) { '#required' => ($element['#delta'] == 0 && $settings['url'] !== 'optional') ? $element['#required'] : FALSE, '#default_value' => isset($element['#value']['url']) ? $element['#value']['url'] : NULL, ); - if ($settings['title'] !== 'none' && $settings['title'] !== 'value') { + if (in_array($settings['title'], array('optional', 'required'))) { // Figure out the label of the title field. if (!empty($settings['title_label_use_field_label'])) { // Use the element label as the title field label. @@ -843,15 +936,31 @@ function link_field_process($element, $form_state, $complete_form) { $title_label = t('Title'); } + // Default value. + $title_maxlength = 128; + if (!empty($settings['title_maxlength'])) { + $title_maxlength = $settings['title_maxlength']; + } + $element['title'] = array( '#type' => 'textfield', - '#maxlength' => $settings['title_maxlength'], + '#maxlength' => $title_maxlength, '#title' => $title_label, - '#description' => t('The link title is limited to @maxlength characters maximum.', array('@maxlength' => $settings['title_maxlength'])), + '#description' => t('The link title is limited to @maxlength characters maximum.', array('@maxlength' => $title_maxlength)), '#required' => ($settings['title'] == 'required' && (($element['#delta'] == 0 && $element['#required']) || !empty($element['#value']['url']))) ? TRUE : FALSE, '#default_value' => isset($element['#value']['title']) ? $element['#value']['title'] : NULL, ); } + elseif ($settings['title'] == 'select') { + $options = drupal_map_assoc(array_filter(explode("\n", str_replace("\r", "\n", trim($settings['title_allowed_values']))))); + $element['title'] = array( + '#type' => 'select', + '#title' => t('Title'), + '#description' => t('Select the a title for this link.'), + '#default_value' => isset($element['#value']['title']) ? $element['#value']['title'] : NULL, + '#options' => $options, + ); + } // Initialize field attributes as an array if it is not an array yet. if (!is_array($settings['attributes'])) { @@ -888,7 +997,8 @@ function link_field_process($element, $form_state, $complete_form) { } // If the title field is available or there are field accepts multiple values - // then allow the individual field items display the required asterisk if needed. + // then allow the individual field items display the required asterisk if + // needed. if (isset($element['title']) || isset($element['_weight'])) { // To prevent an extra required indicator, disable the required flag on the // base element since all the sub-fields are already required if desired. @@ -941,6 +1051,11 @@ function link_field_formatter_info() { 'strip_www' => FALSE, ), ), + 'link_no_protocol' => array( + 'label' => t('URL with the protocol removed'), + 'field types' => array('link_field'), + 'multiple values' => FIELD_BEHAVIOR_DEFAULT, + ), 'link_short' => array( 'label' => t('Short, as link with title "Link"'), 'field types' => array('link_field'), @@ -980,8 +1095,9 @@ function link_field_formatter_settings_form($field, $instance, $view_mode, $form * Implements hook_field_formatter_settings_summary(). */ function link_field_formatter_settings_summary($field, $instance, $view_mode) { + $display = $instance['display'][$view_mode]; - $settings = $display['settings']; + if ($display['type'] == 'link_domain') { if ($display['settings']['strip_www']) { return t('Strip www. from domain'); @@ -1026,7 +1142,7 @@ function theme_link_formatter_link_default($vars) { } // If only a title, display the title. elseif (!empty($vars['element']['title'])) { - return $link_options['html'] ? $vars['element']['title'] : check_plain($vars['element']['title']); + return !empty($link_options['html']) ? $vars['element']['title'] : check_plain($vars['element']['title']); } elseif (!empty($vars['element']['url'])) { return l($vars['element']['title'], $vars['element']['url'], $link_options); @@ -1078,11 +1194,27 @@ function theme_link_formatter_link_domain($vars) { return $vars['element']['url'] ? l($domain, $vars['element']['url'], $link_options) : ''; } +/** + * Formats a link without the http:// or https://. + */ +function theme_link_formatter_link_no_protocol($vars) { + $link_options = $vars['element']; + unset($link_options['title']); + unset($link_options['url']); + // We drop any scheme of the url. + $scheme = parse_url($vars['element']['url']); + $search = '/' . preg_quote($scheme['scheme'] . '://', '/') . '/'; + $replace = ''; + $display_url = preg_replace($search, $replace, $vars['element']['url'], 1); + + return $vars['element']['url'] ? l($display_url, $vars['element']['url'], $link_options) : ''; +} + /** * Formats a link's title as plain text. */ function theme_link_formatter_link_title_plain($vars) { - return empty($vars['element']['title']) ? '' : check_plain($vars['element']['title']); + return empty($vars['element']['title']) ? '' : check_plain(decode_entities($vars['element']['title'])); } /** @@ -1142,7 +1274,8 @@ function theme_link_formatter_link_separate($vars) { /** * Implements hook_token_list(). * - * @TODO: hook_token_list no longer exists - this should change to hook_token_info(). + * @TODO: hook_token_list no longer exists - this should change to + * hook_token_info(). */ function link_token_list($type = 'all') { if ($type === 'field' || $type === 'all') { @@ -1157,7 +1290,8 @@ function link_token_list($type = 'all') { /** * Implements hook_token_values(). * - * @TODO: hook_token_values no longer exists - this should change to hook_tokens(). + * @TODO: hook_token_values no longer exists - this should change to + * hook_tokens(). */ function link_token_values($type, $object = NULL) { if ($type === 'field') { @@ -1185,12 +1319,12 @@ function link_views_api() { * Forms a valid URL if possible from an entered address. * * Trims whitespace and automatically adds an http:// to addresses without a - * protocol specified + * protocol specified. * * @param string $url * The url entered by the user. * @param string $protocol - * The protocol to be prepended to the url if one is not specified + * The protocol to be prepended to the url if one is not specified. */ function link_cleanup_url($url, $protocol = 'http') { $url = trim($url); @@ -1200,9 +1334,10 @@ function link_cleanup_url($url, $protocol = 'http') { // Check if there is no protocol specified. $protocol_match = preg_match("/^([a-z0-9][a-z0-9\.\-_]*:\/\/)/i", $url); if (empty($protocol_match)) { - // But should there be? Add an automatic http:// if it starts with a domain name. - $LINK_DOMAINS = _link_domains(); - $domain_match = preg_match('/^(([a-z0-9]([a-z0-9\-_]*\.)+)(' . $LINK_DOMAINS . '|[a-z]{2}))/i', $url); + // But should there be? Add an automatic http:// if it starts with a + // domain name. + $link_domains = _link_domains(); + $domain_match = preg_match('/^(([a-z0-9]([a-z0-9\-_]*\.)+)(' . $link_domains . '|[a-z]{2}))/i', $url); if (!empty($domain_match)) { $url = $protocol . "://" . $url; } @@ -1215,16 +1350,17 @@ function link_cleanup_url($url, $protocol = 'http') { /** * Validates a URL. * - * @param $text + * @param string $text * Url to be validated. - * - * @param $langcode + * @param string $langcode * An optional language code to look up the path in. * - * @return boolean + * @return bool * True if a valid link, FALSE otherwise. */ function link_validate_url($text, $langcode = NULL) { + + $text = _link_clean_relative($text); $text = link_cleanup_url($text); $type = link_url_type($text); @@ -1253,6 +1389,31 @@ function link_validate_url($text, $langcode = NULL) { return $flag; } +/** + * Cleaner of relatives urls. + * + * @param string $url + * The url to clean up the relative protocol. + */ +function _link_clean_relative($url) { + $check = substr($url, 0, 2); + if (isset($_SERVER['HTTPS']) && + ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || + isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && + $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { + $protocol = 'https://'; + } + else { + $protocol = 'http://'; + } + + if ($check == '//') { + $url = str_replace('//', $protocol, $url); + } + + return $url; +} + /** * Type check a URL. * @@ -1261,105 +1422,135 @@ function link_validate_url($text, $langcode = NULL) { * * @param string $text * Url to be checked. - * + * * @return mixed * Returns boolean FALSE if the URL is not valid. On success, returns one of * the LINK_(linktype) constants. */ function link_url_type($text) { // @TODO Complete letters. - $LINK_ICHARS_DOMAIN = (string) html_entity_decode(implode("", array( - "æ", // æ - "Æ", // Æ + // @codingStandardsIgnoreStart + $link_ichars_domain = (string) html_entity_decode(implode("", array( + "¿", // ¿ "À", // À - "à", // à "Á", // Á - "á", // á "Â", //  - "â", // â - "å", // å - "Å", // Å - "ä", // ä + "Ã", // à "Ä", // Ä + "Å", // Å + "Æ", // Æ "Ç", // Ç - "ç", // ç - "Ð", // Ð - "ð", // ð "È", // È - "è", // è "É", // É - "é", // é "Ê", // Ê - "ê", // ê "Ë", // Ë - "ë", // ë + "Ì", // Ì + "Í", // Í "Î", // Î - "î", // î "Ï", // Ï - "ï", // ï - "ø", // ø - "Ø", // Ø - "ö", // ö - "Ö", // Ö + "Ð", // Ð + "Ñ", // Ñ + "Ò", // Ò + "Ó", // Ó "Ô", // Ô - "ô", // ô "Õ", // Õ - "õ", // õ - "Œ", // Œ - "œ", // œ - "ü", // ü - "Ü", // Ü + "Ö", // Ö + // × + "Ø", // Ø "Ù", // Ù - "ù", // ù + "Ú", // Ú "Û", // Û - "û", // û - "Ÿ", // Ÿ - "ÿ", // ÿ - "Ñ", // Ñ - "ñ", // ñ - "þ", // þ + "Ü", // Ü + "Ý", // Ý "Þ", // Þ + // ß (see LINK_ICHARS) + "à", // à + "á", // á + "â", // â + "ã", // ã + "ä", // ä + "å", // å + "æ", // æ + "ç", // ç + "è", // è + "é", // é + "ê", // ê + "ë", // ë + "ì", // ì + "í", // í + "î", // î + "ï", // ï + "ð", // ð + "ñ", // ñ + "ò", // ò + "ó", // ó + "ô", // ô + "õ", // õ + "ö", // ö + // ÷ + "ø", // ø + "ù", // ù + "ú", // ú + "û", // û + "ü", // ü "ý", // ý - "Ý", // Ý - "¿", // ¿ - )), ENT_QUOTES, 'UTF-8'); - - $LINK_ICHARS = $LINK_ICHARS_DOMAIN . (string) html_entity_decode(implode("", array( - "ß", // ß + "þ", // þ + "ÿ", // ÿ + "Œ", // Œ + "œ", // œ + "Ÿ", // Ÿ )), ENT_QUOTES, 'UTF-8'); - $allowed_protocols = variable_get('filter_allowed_protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal', 'tel')); - $LINK_DOMAINS = _link_domains(); - - // Starting a parenthesis group with (?: means that it is grouped, but is not captured. + // @codingStandardsIgnoreEnd + + $link_ichars = $link_ichars_domain . (string) html_entity_decode(implode("", array( + // ß. + "ß", + )), ENT_QUOTES, 'UTF-8'); + $allowed_protocols = variable_get('filter_allowed_protocols', array( + 'http', + 'https', + 'ftp', + 'news', + 'nntp', + 'telnet', + 'mailto', + 'irc', + 'ssh', + 'sftp', + 'webcal', + )); + $link_domains = _link_domains(); + + // Starting a parenthesis group with (?: means that it is grouped, but is not + // captured. $protocol = '((?:' . implode("|", $allowed_protocols) . '):\/\/)'; - $authentication = "(?:(?:(?:[\w\.\-\+!$&'\(\)*\+,;=" . $LINK_ICHARS . "]|%[0-9a-f]{2})+(?::(?:[\w" . $LINK_ICHARS . "\.\-\+%!$&'\(\)*\+,;=]|%[0-9a-f]{2})*)?)?@)"; - $domain = '(?:(?:[a-z0-9' . $LINK_ICHARS_DOMAIN . ']([a-z0-9' . $LINK_ICHARS_DOMAIN . '\-_\[\]])*)(\.(([a-z0-9' . $LINK_ICHARS_DOMAIN . '\-_\[\]])+\.)*(' . $LINK_DOMAINS . '|[a-z]{2}))?)'; + $authentication = "(?:(?:(?:[\w\.\-\+!$&'\(\)*\+,;=" . $link_ichars . "]|%[0-9a-f]{2})+(?::(?:[\w" . $link_ichars . "\.\-\+%!$&'\(\)*\+,;=]|%[0-9a-f]{2})*)?)?@)"; + $domain = '(?:(?:[a-z0-9' . $link_ichars_domain . ']([a-z0-9' . $link_ichars_domain . '\-_\[\]])*)(\.(([a-z0-9' . $link_ichars_domain . '\-_\[\]])+\.)*(' . $link_domains . '|[a-z]{2}))?)'; $ipv4 = '(?:[0-9]{1,3}(\.[0-9]{1,3}){3})'; $ipv6 = '(?:[0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7})'; $port = '(?::([0-9]{1,5}))'; - // Pattern specific to external links. $external_pattern = '/^' . $protocol . '?' . $authentication . '?(' . $domain . '|' . $ipv4 . '|' . $ipv6 . ' |localhost)' . $port . '?'; // Pattern specific to internal links. - $internal_pattern = "/^(?:[a-z0-9" . $LINK_ICHARS . "_\-+\[\] ]+)"; - $internal_pattern_file = "/^(?:[a-z0-9" . $LINK_ICHARS . "_\-+\[\]\. \/\(\)][a-z0-9" . $LINK_ICHARS . "_\-+\[\]\. \(\)][a-z0-9" . $LINK_ICHARS . "_\-+\[\]\. \/\(\)]+)$/i"; + $internal_pattern = "/^(?:[a-z0-9" . $link_ichars . "_\-+\[\] ]+)"; + $internal_pattern_file = "/^(?:[a-z0-9" . $link_ichars . "_\-+\[\]\. \/\(\)][a-z0-9" . $link_ichars . "_\-+\[\]\. \(\)][a-z0-9" . $link_ichars . "_\-+\[\]\. \/\(\)]+)$/i"; - $directories = "(?:\/[a-z0-9" . $LINK_ICHARS . "_\-\.~+%=&,$'#!():;*@\[\]]*)*"; + $directories = "(?:\/[a-z0-9" . $link_ichars . "_\-\.~+%=&,$'#!():;*@\[\]]*)*"; // Yes, four backslashes == a single backslash. - $query = "(?:\/?\?([?a-z0-9" . $LINK_ICHARS . "+_|\-\.~\/\\\\%=&,$'!():;*@\[\]{} ]*))"; - $anchor = "(?:#[a-z0-9" . $LINK_ICHARS . "_\-\.~+%=&,$'():;*@\[\]\/\?]*)"; + $query = "(?:\/?\?([?a-z0-9" . $link_ichars . "+_|\-\.~\/\\\\%=&,$'!():;*@\[\]{} ]*))"; + $anchor = "(?:#[a-z0-9" . $link_ichars . "_\-\.~+%=&,$'():;*@\[\]\/\?]*)"; // The rest of the path for a standard URL. + // @codingStandardsIgnoreLine $end = $directories . '?' . $query . '?' . $anchor . '?' . '$/i'; $message_id = '[^@].*@' . $domain; $newsgroup_name = '(?:[0-9a-z+-]*\.)*[0-9a-z+-]*'; $news_pattern = '/^news:(' . $newsgroup_name . '|' . $message_id . ')$/i'; - $user = '[a-zA-Z0-9' . $LINK_ICHARS . '_\-\.\+\^!#\$%&*+\/\=\?\`\|\{\}~\'\[\]]+'; + $user = '[a-zA-Z0-9' . $link_ichars . '_\-\.\+\^!#\$%&*+\/\=\?\`\|\{\}~\'\[\]]+'; $email_pattern = '/^mailto:' . $user . '@' . '(?:' . $domain . '|' . $ipv4 . '|' . $ipv6 . '|localhost)' . $query . '?$/'; - $tel_pattern = '/^tel:\+?[1-9]\d{1,15}$/'; if (strpos($text, '<front>') === 0) { return LINK_FRONT; @@ -1367,15 +1558,15 @@ function link_url_type($text) { if (in_array('mailto', $allowed_protocols) && preg_match($email_pattern, $text)) { return LINK_EMAIL; } - if (in_array('tel', $allowed_protocols) && preg_match($tel_pattern, $text)) { - return LINK_EXTERNAL; - } if (in_array('news', $allowed_protocols) && preg_match($news_pattern, $text)) { return LINK_NEWS; } if (preg_match($internal_pattern . $end, $text)) { return LINK_INTERNAL; } + if (drupal_valid_path($text) && url_is_external($text) == FALSE) { + return LINK_INTERNAL; + } if (preg_match($external_pattern . $end, $text)) { return LINK_EXTERNAL; } @@ -1387,11 +1578,16 @@ function link_url_type($text) { } /** - * Returns the list of allowed domains, including domains added by admins via variable_set/$config. + * Returns the list of allowed domains. + * + * If the variable link_allowed_domains is set, restrict allowed domains to the + * strings in that array. If the variable link_allowed_domains is not set, allow + * all domains between 2 and 63 characters in length. + * See https://tools.ietf.org/html/rfc1034. */ function _link_domains() { - $link_extra_domains = variable_get('link_extra_domains', array()); - return empty($link_extra_domains) ? LINK_DOMAINS : LINK_DOMAINS . '|' . implode('|', $link_extra_domains); + $link_allowed_domains = variable_get('link_allowed_domains', array()); + return empty($link_allowed_domains) ? '[a-z][a-z0-9-]{1,62}' : implode('|', $link_allowed_domains); } /** @@ -1402,7 +1598,15 @@ function link_content_migrate_field_alter(&$field_value, $instance_value) { // Adjust the field type. $field_value['type'] = 'link_field'; // Remove settings that are now on the instance. - foreach (array('attributes', 'display', 'url', 'title', 'title_value', 'enable_tokens', 'validate_url') as $setting) { + foreach (array( + 'attributes', + 'display', + 'url', + 'title', + 'title_value', + 'enable_tokens', + 'validate_url', + ) as $setting) { unset($field_value['settings'][$setting]); } } @@ -1416,7 +1620,15 @@ function link_content_migrate_field_alter(&$field_value, $instance_value) { function link_content_migrate_instance_alter(&$instance_value, $field_value) { if ($field_value['type'] == 'link') { // Grab settings that were previously on the field. - foreach (array('attributes', 'display', 'url', 'title', 'title_value', 'enable_tokens', 'validate_url') as $setting) { + foreach (array( + 'attributes', + 'display', + 'url', + 'title', + 'title_value', + 'enable_tokens', + 'validate_url', + ) as $setting) { if (isset($field_value['settings'][$setting])) { $instance_value['settings'][$setting] = $field_value['settings'][$setting]; } @@ -1427,7 +1639,15 @@ function link_content_migrate_instance_alter(&$instance_value, $field_value) { } // Adjust formatter types. foreach ($instance_value['display'] as $context => $settings) { - if (in_array($settings['type'], array('default', 'title_plain', 'url', 'plain', 'short', 'label', 'separate'))) { + if (in_array($settings['type'], array( + 'default', + 'title_plain', + 'url', + 'plain', + 'short', + 'label', + 'separate', + ))) { $instance_value['display'][$context]['type'] = 'link_' . $settings['type']; } } @@ -1443,7 +1663,7 @@ function link_field_settings_form() { /** * Additional callback to adapt the property info of link fields. - * + * * @see entity_metadata_field_entity_property_info() */ function link_field_property_info_callback(&$info, $entity_type, $field, $instance, $field_type) { @@ -1471,7 +1691,7 @@ function link_field_property_info_callback(&$info, $entity_type, $field, $instan * @see link_field_property_info_callback() */ function link_field_item_create() { - return array('title' => NULL, 'url' => NULL); + return array('title' => NULL, 'url' => NULL, 'display_url' => NULL); } /** @@ -1484,7 +1704,7 @@ function link_field_item_property_info() { 'setter callback' => 'entity_property_verbatim_set', ); $properties['url'] = array( - 'type' => 'uri', + 'type' => 'text', 'label' => t('The URL of the link.'), 'setter callback' => 'entity_property_verbatim_set', ); @@ -1494,6 +1714,11 @@ function link_field_item_property_info() { 'setter callback' => 'entity_property_verbatim_set', 'getter callback' => 'link_attribute_property_get', ); + $properties['display_url'] = array( + 'type' => 'uri', + 'label' => t('The full URL of the link.'), + 'setter callback' => 'entity_property_verbatim_set', + ); return $properties; } @@ -1508,7 +1733,7 @@ function link_attribute_property_get($data, array $options, $name, $type, $info) * Implements hook_field_update_instance(). */ function link_field_update_instance($instance, $prior_instance) { - if (function_exists('i18n_string_update') && $instance['widget']['type'] == 'link_field' && $prior_instance['settings']['title_value'] != $instance['settings']['title_value']) { + if (function_exists('i18n_string_update') && isset($instance['widget']) && $instance['widget']['type'] == 'link_field' && $prior_instance['settings']['title_value'] != $instance['settings']['title_value']) { $i18n_string_name = "field:{$instance['field_name']}:{$instance['bundle']}:title_value"; i18n_string_update($i18n_string_name, $instance['settings']['title_value']); } diff --git a/profiles/wcm_base/modules/contrib/link/tests/link.attribute.test b/profiles/wcm_base/modules/contrib/link/tests/link.attribute.test index 36e6be5e94633dcba64ede0d41f76a425e42e126..f66a0e6eda319fe21f3a5c40947161782a900527 100644 --- a/profiles/wcm_base/modules/contrib/link/tests/link.attribute.test +++ b/profiles/wcm_base/modules/contrib/link/tests/link.attribute.test @@ -5,7 +5,11 @@ * Basic simpletests to test options on link module. */ +/** + * Attribute Crud Test. + */ class LinkAttributeCrudTest extends DrupalWebTestCase { + private $zebra; protected $permissions = array( @@ -19,6 +23,9 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { 'access administration pages', ); + /** + * Get Info. + */ public static function getInfo() { return array( 'name' => 'Link Attribute Tests', @@ -27,14 +34,23 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { ); } - function setup() { + /** + * Setup. + */ + public function setup() { parent::setup('field_ui', 'link'); $this->zebra = 0; // Create and login user. - $this->web_user = $this->drupalCreateUser(array('administer content types')); + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + )); $this->drupalLogin($this->web_user); } + /** + * Create Link. + */ protected function createLink($url, $title, $attributes = array()) { return array( 'url' => $url, @@ -43,20 +59,26 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { ); } + /** + * Assert Link On Node. + */ protected function assertLinkOnNode($field_name, $link_value, $message = '', $group = 'Other') { $this->zebra++; $zebra_string = ($this->zebra % 2 == 0) ? 'even' : 'odd'; $cssFieldLocator = 'field-' . str_replace('_', '-', $field_name); $this->assertPattern('@<div class="field field-type-link ' . $cssFieldLocator . '".*<div class="field-item ' . $zebra_string . '">\s*' . $link_value . '\s*</div>@is', - $message, - $group); + $message, + $group); } /** - * A simple test that just creates a new node type, adds a link field to it, creates a new node of that type, and makes sure - * that the node is being displayed. + * Test Basic. + * + * A simple test that just creates a new node type, adds a link field to it, + * creates a new node of that type, and makes sure that the node is being + * displayed. */ - function testBasic() { + public function testBasic() { $content_type_friendly = $this->randomName(20); $content_type_machine = strtolower($this->randomName(10)); $title = $this->randomName(20); @@ -76,7 +98,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { // Now add a singleton field. $single_field_name_friendly = $this->randomName(20); $single_field_name_machine = strtolower($this->randomName(10)); - $single_field_name = 'field_' . $single_field_name_machine; + $edit = array( 'fields[_add_new_field][label]' => $single_field_name_friendly, 'fields[_add_new_field][field_name]' => $single_field_name_machine, @@ -101,7 +123,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { $this->assertTrue($type_exists, 'The new content type has been created in the database.'); $permission = 'create ' . $content_type_machine . ' content'; - $permission_edit = 'edit ' . $content_type_machine . ' content'; + // Reset the permissions cache. $this->checkPermissions(array($permission), TRUE); @@ -122,7 +144,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { ); $this->drupalPost(NULL, $edit, t('Save')); - $this->assertText(t('@content_type_friendly @title has been created', array('@content_type_friendly' => $content_type_friendly, '@title' => $title))); + $this->assertText(t('@content_type_friendly @title has been created', array( + '@content_type_friendly' => $content_type_friendly, + '@title' => $title, + ))); $this->drupalGet('node/add/' . $content_type_machine); @@ -135,12 +160,18 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { // Now we can fill in the second item in the multivalue field and save. $this->drupalPost(NULL, $edit, t('Save')); - $this->assertText(t('@content_type_friendly @title has been created', array('@content_type_friendly' => $content_type_friendly, '@title' => $title))); + $this->assertText(t('@content_type_friendly @title has been created', array( + '@content_type_friendly' => $content_type_friendly, + '@title' => $title, + ))); $this->assertText('Display'); $this->assertLinkByHref('http://www.example.com'); } + /** + * Create Simple Link Field. + */ protected function createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine) { $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/fields'); $edit = array( @@ -166,9 +197,11 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { $this->assertTrue($type_exists, 'The new content type has been created in the database.'); } + /** + * Create Node Type User. + */ protected function createNodeTypeUser($content_type_machine) { $permission = 'create ' . $content_type_machine . ' content'; - $permission_edit = 'edit ' . $content_type_machine . ' content'; // Reset the permissions cache. $this->checkPermissions(array($permission), TRUE); @@ -179,6 +212,9 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { $this->drupalLogin($this->web_user); } + /** + * Create Node For Testing. + */ protected function createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $title, $url, $node_title = '') { $this->drupalGet('node/add/' . $content_type_machine); @@ -196,14 +232,17 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { } $this->drupalPost(NULL, $edit, t('Save')); - $this->assertText(t('@content_type_friendly @title has been created', array('@content_type_friendly' => $content_type_friendly, '@title' => $node_title))); + $this->assertText(t('@content_type_friendly @title has been created', array( + '@content_type_friendly' => $content_type_friendly, + '@title' => $node_title, + ))); } /** * Test the link_plain formatter and it's output. */ - function testFormatterPlain() { + public function testFormatterPlain() { $content_type_friendly = $this->randomName(20); $content_type_machine = strtolower($this->randomName(10)); @@ -215,7 +254,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { // Now add a singleton field. $single_field_name_friendly = $this->randomName(20); $single_field_name_machine = strtolower($this->randomName(10)); - //$single_field_name = 'field_'. $single_field_name_machine; + // $single_field_name = 'field_'. $single_field_name_machine;. $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); // Okay, now we want to make sure this display is changed: @@ -227,7 +266,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { $this->drupalPost(NULL, $edit, t('Save')); $this->createNodeTypeUser($content_type_machine); - + $link_tests = array( 'plain' => array( 'text' => 'Display', @@ -243,18 +282,21 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { ), ); - foreach ($link_tests as $key => $link_test) { + foreach ($link_tests as $link_test) { $link_text = $link_test['text']; $link_url = $link_test['url']; $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url); - + $this->assertText($link_url); $this->assertNoText($link_text); $this->assertNoLinkByHref($link_url); } } - function testFormatterHost() { + /** + * Formatter Host. + */ + public function testFormatterHost() { $content_type_friendly = $this->randomName(20); $content_type_machine = strtolower($this->randomName(10)); @@ -263,18 +305,17 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { 'name' => $content_type_friendly, )); - // Now add a singleton field. $single_field_name_friendly = $this->randomName(20); $single_field_name_machine = strtolower($this->randomName(10)); - //$single_field_name = 'field_'. $single_field_name_machine; + // $single_field_name = 'field_'. $single_field_name_machine;. $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); // Okay, now we want to make sure this display is changed: - $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display'); + $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display'); $edit = array( - 'fields[field_'. $single_field_name_machine .'][label]' => 'above', - 'fields[field_'. $single_field_name_machine .'][type]' => 'link_host', + 'fields[field_' . $single_field_name_machine . '][label]' => 'above', + 'fields[field_' . $single_field_name_machine . '][type]' => 'link_host', ); $this->drupalPost(NULL, $edit, t('Save')); @@ -289,7 +330,13 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { $this->assertNoLinkByHref($link_url); } - function testFormatterURL() { + /** + * Formatter URL. + * + * @codingStandardsIgnoreStart + */ + public function testFormatterURL() { + // @codingStandardsIgnoreEnd $content_type_friendly = $this->randomName(20); $content_type_machine = strtolower($this->randomName(10)); @@ -301,7 +348,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { // Now add a singleton field. $single_field_name_friendly = $this->randomName(20); $single_field_name_machine = strtolower($this->randomName(10)); - //$single_field_name = 'field_'. $single_field_name_machine; + // $single_field_name = 'field_'. $single_field_name_machine;. $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); // Okay, now we want to make sure this display is changed: @@ -313,7 +360,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { $this->drupalPost(NULL, $edit, t('Save')); $this->createNodeTypeUser($content_type_machine); - + $link_tests = array( 'plain' => array( 'text' => 'Display', @@ -329,17 +376,20 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { ), ); - foreach ($link_tests as $key => $link_test) { + foreach ($link_tests as $link_test) { $link_text = $link_test['text']; $link_url = $link_test['url']; $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url); - + $this->assertNoText($link_text); $this->assertLinkByHref($link_url); } } - function testFormatterShort() { + /** + * Formatter Short. + */ + public function testFormatterShort() { $content_type_friendly = $this->randomName(20); $content_type_machine = strtolower($this->randomName(10)); @@ -351,7 +401,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { // Now add a singleton field. $single_field_name_friendly = $this->randomName(20); $single_field_name_machine = strtolower($this->randomName(10)); - //$single_field_name = 'field_'. $single_field_name_machine; + // $single_field_name = 'field_'. $single_field_name_machine;. $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); // Okay, now we want to make sure this display is changed: @@ -379,18 +429,21 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { ), ); - foreach ($link_tests as $key => $link_test) { + foreach ($link_tests as $link_test) { $link_text = $link_test['text']; $link_url = $link_test['url']; $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url); - + $this->assertText('Link'); $this->assertNoText($link_text); $this->assertLinkByHref($link_url); } } - function testFormatterLabel() { + /** + * Formatter Label. + */ + public function testFormatterLabel() { $content_type_friendly = $this->randomName(20); $content_type_machine = strtolower($this->randomName(10)); @@ -402,7 +455,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { // Now add a singleton field. $single_field_name_friendly = $this->randomName(20); $single_field_name_machine = strtolower($this->randomName(10)); - //$single_field_name = 'field_'. $single_field_name_machine; + // $single_field_name = 'field_'. $single_field_name_machine;. $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); // Okay, now we want to make sure this display is changed: @@ -430,18 +483,21 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { ), ); - foreach ($link_tests as $key => $link_test) { + foreach ($link_tests as $link_test) { $link_text = $link_test['text']; - $link_url = $link_test['url']; + $link_url = $link_test['url']; $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url); - + $this->assertNoText($link_text); $this->assertText($single_field_name_friendly); $this->assertLinkByHref($link_url); } } - function testFormatterSeparate() { + /** + * Formatter Separate. + */ + public function testFormatterSeparate() { $content_type_friendly = $this->randomName(20); $content_type_machine = strtolower($this->randomName(10)); @@ -453,7 +509,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { // Now add a singleton field. $single_field_name_friendly = $this->randomName(20); $single_field_name_machine = strtolower($this->randomName(10)); - //$single_field_name = 'field_'. $single_field_name_machine; + // $single_field_name = 'field_'. $single_field_name_machine;. $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); // Okay, now we want to make sure this display is changed: @@ -482,32 +538,35 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { ), ); - foreach ($link_tests as $key => $link_test) { + foreach ($link_tests as $link_test) { $link_text = $link_test['text']; $link_url = $link_test['url']; $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url); - + $this->assertText($link_text); $this->assertLink($plain_url); $this->assertLinkByHref($link_url); } } - - function testFormatterPlainTitle() { + + /** + * Formatter Plain Title. + */ + public function testFormatterPlainTitle() { $content_type_friendly = $this->randomName(20); $content_type_machine = strtolower($this->randomName(10)); - + $this->drupalCreateContentType(array( 'type' => $content_type_machine, 'name' => $content_type_friendly, )); - + // Now add a singleton field. $single_field_name_friendly = $this->randomName(20); $single_field_name_machine = strtolower($this->randomName(10)); - //$single_field_name = 'field_'. $single_field_name_machine; + // $single_field_name = 'field_'. $single_field_name_machine;. $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); - + // Okay, now we want to make sure this display is changed: $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display'); $edit = array( @@ -515,15 +574,16 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { 'fields[field_' . $single_field_name_machine . '][type]' => 'link_title_plain', ); $this->drupalPost(NULL, $edit, t('Save')); - + $this->createNodeTypeUser($content_type_machine); - + $link_text = 'Display'; $link_url = 'http://www.example.com/'; $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url); - + $this->assertText($link_text); $this->assertNoText($link_url); $this->assertNoLinkByHref($link_url); } + } diff --git a/profiles/wcm_base/modules/contrib/link/tests/link.crud.test b/profiles/wcm_base/modules/contrib/link/tests/link.crud.test index e9b7db416c74e1fc120381a41a8d5b7a768cd282..6bc386749ec1628aed4482c4c2da5f364ef9f825 100644 --- a/profiles/wcm_base/modules/contrib/link/tests/link.crud.test +++ b/profiles/wcm_base/modules/contrib/link/tests/link.crud.test @@ -2,11 +2,20 @@ /** * @file - * Basic CRUD simpletests for the link module, based off of content.crud.test in CCK. + * File for Crud Tests. + * + * Basic CRUD simpletests for the link module, based off of content.crud.test in + * CCK. */ +/** + * Content Crud. + */ class LinkContentCrudTest extends DrupalWebTestCase { + /** + * Get Info. + */ public static function getInfo() { return array( 'name' => 'Link CRUD - Basic API tests', @@ -15,21 +24,31 @@ class LinkContentCrudTest extends DrupalWebTestCase { ); } - function setUp() { + /** + * Setup. + */ + public function setUp() { parent::setUp('field_ui', 'link'); } /** - * All we're doing here is creating a content type, creating a simple link field - * on that content type. + * Create Field API. + * + * All we're doing here is creating a content type, creating a simple link + * field on that content type. + * + * @codingStandardsIgnoreStart */ - function testLinkCreateFieldAPI() { + public function testLinkCreateFieldAPI() { + // @codingStandardsIgnoreEnd $content_type_friendly = $this->randomName(20); $content_type_machine = strtolower($this->randomName(10)); - $title = $this->randomName(20); // Create and login user. - $this->web_user = $this->drupalCreateUser(array('administer content types')); + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + )); $this->drupalLogin($this->web_user); $this->drupalGet('admin/structure/types'); @@ -69,4 +88,5 @@ class LinkContentCrudTest extends DrupalWebTestCase { $type_exists = db_query('SELECT 1 FROM {node_type} WHERE type = :type', array(':type' => $content_type_machine))->fetchField(); $this->assertTrue($type_exists, 'The new content type has been created in the database.'); } + } diff --git a/profiles/wcm_base/modules/contrib/link/tests/link.crud_browser.test b/profiles/wcm_base/modules/contrib/link/tests/link.crud_browser.test index be04260914f27fea8a4e9131602b4be3cab34362..dc218573259d5728cb125171082254d57fc34714 100644 --- a/profiles/wcm_base/modules/contrib/link/tests/link.crud_browser.test +++ b/profiles/wcm_base/modules/contrib/link/tests/link.crud_browser.test @@ -6,25 +6,28 @@ */ /** - * Testing that users can not input bad URLs or labels + * Testing that users can not input bad URLs or labels. */ class LinkUITest extends DrupalWebTestcase { /** - * Link supposed to be good + * Link supposed to be good. */ const LINK_INPUT_TYPE_GOOD = 0; /** - * Link supposed to have a bad title + * Link supposed to have a bad title. */ const LINK_INPUT_TYPE_BAD_TITLE = 1; /** - * Link supposed to have a bad URL + * Link supposed to have a bad URL. */ const LINK_INPUT_TYPE_BAD_URL = 2; + /** + * Get Info. + */ public static function getInfo() { return array( 'name' => 'Link CRUD - browser test', @@ -33,26 +36,30 @@ class LinkUITest extends DrupalWebTestcase { ); } - function setUp() { + /** + * Setup. + */ + public function setUp() { parent::setUp('field_ui', 'link'); } /** * Creates a link field for the "page" type and creates a page with a link. */ - function testLinkCreate() { - //libxml_use_internal_errors(true); + public function testLinkCreate() { + // libxml_use_internal_errors(true); $this->web_user = $this->drupalCreateUser(array( 'administer content types', + 'administer fields', 'administer nodes', 'administer filters', 'access content', 'create page content', - 'access administration pages' + 'access administration pages', )); $this->drupalLogin($this->web_user); - // create field + // Create field. $name = strtolower($this->randomName()); $edit = array( 'fields[_add_new_field][label]' => $name, @@ -72,8 +79,8 @@ class LinkUITest extends DrupalWebTestcase { $permission = 'create page content'; $this->checkPermissions(array($permission), TRUE); - // create page form - //$this->drupalGet('node/add'); + // Create page form + // $this->drupalGet('node/add');. $this->drupalGet('node/add/page'); $field_name = 'field_' . $name; $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found'); @@ -84,37 +91,37 @@ class LinkUITest extends DrupalWebTestcase { 'href' => 'http://example.com/' . $this->randomName(), 'label' => $this->randomName(), 'msg' => 'Link found', - 'type' => self::LINK_INPUT_TYPE_GOOD + 'type' => self::LINK_INPUT_TYPE_GOOD, ), array( 'href' => 'http://example.com/' . $this->randomName(), 'label' => $this->randomName() . '<script>alert("hi");</script>', 'msg' => 'js label', - 'type' => self::LINK_INPUT_TYPE_BAD_TITLE + 'type' => self::LINK_INPUT_TYPE_BAD_TITLE, ), array( 'href' => 'http://example.com/' . $this->randomName(), 'label' => $this->randomName() . '<script src="http://devil.site.com"></script>', 'msg' => 'js label', - 'type' => self::LINK_INPUT_TYPE_BAD_TITLE + 'type' => self::LINK_INPUT_TYPE_BAD_TITLE, ), array( 'href' => 'http://example.com/' . $this->randomName(), 'label' => $this->randomName() . '" onmouseover="alert(\'hi\')', 'msg' => 'js label', - 'type' => self::LINK_INPUT_TYPE_BAD_TITLE + 'type' => self::LINK_INPUT_TYPE_BAD_TITLE, ), array( 'href' => 'http://example.com/' . $this->randomName(), 'label' => $this->randomName() . '\' onmouseover="alert(\'hi\')', 'msg' => 'js label', - 'type' => self::LINK_INPUT_TYPE_BAD_TITLE + 'type' => self::LINK_INPUT_TYPE_BAD_TITLE, ), array( 'href' => 'javascript:alert("http://example.com/' . $this->randomName() . '")', 'label' => $this->randomName(), 'msg' => 'js url', - 'type' => self::LINK_INPUT_TYPE_BAD_URL + 'type' => self::LINK_INPUT_TYPE_BAD_URL, ), array( 'href' => 'http://ecs-es.kelkoo.es/ctl/go/sitesearchGo?.ts=1338833010331&.sig=qP9GXeEFH6syBzwmzYkxmsvp1EI-', @@ -143,23 +150,26 @@ class LinkUITest extends DrupalWebTestcase { ); $this->drupalPost(NULL, $edit, t('Save')); if ($input['type'] == self::LINK_INPUT_TYPE_BAD_URL) { - $this->assertRaw(t('The value %value provided for %field is not a valid URL.', array('%field' => $name, '%value' => trim($input['href']))), 'Not a valid URL: ' . $input['href']); + $this->assertRaw(t('The value %value provided for %field is not a valid URL.', array( + '%field' => $name, + '%value' => trim($input['href']), + )), 'Not a valid URL: ' . $input['href']); continue; } else { $this->assertRaw(' ' . t('has been created.', - array('@type' => 'Basic Page', '%title' => $edit['title'])), - 'Page created: ' . $input['href']); + array('@type' => 'Basic Page', '%title' => $edit['title'])), + 'Page created: ' . $input['href']); } $url = $this->getUrl(); - // change to Anonymous user. + // Change to Anonymous user. $this->drupalLogout(); $this->drupalGet($url); - //debug($this); - // If simpletest starts using something to override the error system, this will flag - // us and let us know it's broken. + // debug($this); + // If simpletest starts using something to override the error system, this + // will flag us and let us know it's broken. $this->assertFalse(libxml_use_internal_errors(TRUE)); if (isset($input['expected_href'])) { $path = '//a[@href="' . $input['expected_href'] . '" and text()="' . $input['label'] . '"]'; @@ -171,18 +181,27 @@ class LinkUITest extends DrupalWebTestcase { libxml_use_internal_errors(FALSE); $this->assertIdentical(isset($elements[0]), $input['type'] == self::LINK_INPUT_TYPE_GOOD, $input['msg']); } - //libxml_use_internal_errors(FALSE); + // libxml_use_internal_errors(FALSE); } /** + * Static Link Create. + * * Testing that if you use <strong> in a static title for your link, that the * title actually displays <strong>. */ - function testStaticLinkCreate() { - $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content')); + public function testStaticLinkCreate() { + + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + 'access content', + 'create page content', + )); + $this->drupalLogin($this->web_user); - // create field + // Create field. $name = strtolower($this->randomName()); $field_name = 'field_' . $name; $edit = array( @@ -195,17 +214,18 @@ class LinkUITest extends DrupalWebTestcase { $this->drupalPost(NULL, array(), t('Save field settings')); $this->drupalPost(NULL, array( 'instance[settings][title]' => 'value', - 'instance[settings][title_value]' => '<strong>' . $name . '</strong>'), t('Save settings')); + 'instance[settings][title_value]' => '<strong>' . $name . '</strong>', + ), t('Save settings')); // Is field created? $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added'); - // create page form + // Create page form. $this->drupalGet('node/add/page'); $this->assertField($field_name . '[und][0][url]', 'URL found'); $input = array( - 'href' => 'http://example.com/' . $this->randomName() + 'href' => 'http://example.com/' . $this->randomName(), ); $edit = array( @@ -216,21 +236,32 @@ class LinkUITest extends DrupalWebTestcase { $url = $this->getUrl(); - // change to anonymous user + // Change to anonymous user. $this->drupalLogout(); $this->drupalGet($url); $this->assertRaw(l('<strong>' . $name . '</strong>', $input['href'], array('html' => TRUE))); } - + /** - * Testing that if you have the title but no url, the title is not sanitized twice. + * CRUD Title Only Title No Link. + * + * Testing that if you have the title but no url, the title is not sanitized + * twice. + * + * @codingStandardsIgnoreStart */ - function testCRUDTitleOnlyTitleNoLink() { - $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content')); + public function testCRUDTitleOnlyTitleNoLink() { + // @codingStandardsIgnoreEnd + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + 'access content', + 'create page content', + )); $this->drupalLogin($this->web_user); - // create field + // Create field. $name = strtolower($this->randomName()); $field_name = 'field_' . $name; $edit = array( @@ -247,8 +278,8 @@ class LinkUITest extends DrupalWebTestcase { // Is field created? $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added'); - - // create page form + + // Create page form. $this->drupalGet('node/add/page'); $this->assertField($field_name . '[und][0][url]', 'URL found'); @@ -265,8 +296,8 @@ class LinkUITest extends DrupalWebTestcase { $this->drupalPost(NULL, $edit, t('Save')); $url = $this->getUrl(); - - // change to anonymous user + + // Change to anonymous user. $this->drupalLogout(); $this->drupalGet($url); @@ -274,14 +305,26 @@ class LinkUITest extends DrupalWebTestcase { } /** - * If we're creating a new field and just hit 'save' on the default options, we want to make - * sure they are set to the expected results. + * CRUD Create Field Defaults. + * + * If we're creating a new field and just hit 'save' on the default options, + * we want to make sure they are set to the expected results. + * + * @codingStandardsIgnoreStart */ - function testCRUDCreateFieldDefaults() { - $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content')); + public function testCRUDCreateFieldDefaults() { + // @codingStandardsIgnoreEnd + + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + 'access content', + 'create page content', + )); + $this->drupalLogin($this->web_user); - // create field + // Create field. $name = strtolower($this->randomName()); $edit = array( 'fields[_add_new_field][label]' => $name, @@ -312,16 +355,26 @@ class LinkUITest extends DrupalWebTestcase { $this->assertFalse($instance['settings']['attributes']['class'], 'By default, no class should be set.'); $this->assertFalse($instance['settings']['title_value'], 'By default, no title should be set.'); } - + /** - * If we're creating a new field and just hit 'save' on the default options, we want to make - * sure they are set to the expected results. + * CRUD Create Field With Class. + * + * If we're creating a new field and just hit 'save' on the default options, + * we want to make sure they are set to the expected results. + * + * @codingStandardsIgnoreStart */ - function testCRUDCreateFieldWithClass() { - $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content')); + public function testCRUDCreateFieldWithClass() { + // @codingStandardsIgnoreEnd + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + 'access content', + 'create page content', + )); $this->drupalLogin($this->web_user); - // create field + // Create field. $name = strtolower($this->randomName()); $edit = array( 'fields[_add_new_field][label]' => $name, @@ -356,9 +409,9 @@ class LinkUITest extends DrupalWebTestcase { $this->assertFalse($instance['settings']['attributes']['rel'], 'Rel should be blank by default.'); $this->assertEqual($instance['settings']['attributes']['class'], $link_class_name, 'One class should be set.'); $this->assertFalse($instance['settings']['title_value'], 'By default, no title should be set.'); - + // Now, let's create a node with this field and make sure the link shows up: - // create page form + // create page form. $field_name = 'field_' . $name; $this->drupalGet('node/add/page'); $this->assertField($field_name . '[und][0][url]', 'URL found'); @@ -376,8 +429,8 @@ class LinkUITest extends DrupalWebTestcase { $this->drupalPost(NULL, $edit, t('Save')); $url = $this->getUrl(); - - // change to anonymous user + + // Change to anonymous user. $this->drupalLogout(); $this->drupalGet($url); @@ -385,15 +438,25 @@ class LinkUITest extends DrupalWebTestcase { $this->assertPattern('|class\s?=\s?"' . $link_class_name . '"|', "Class $link_class_name exists on page."); } -/** - * If we're creating a new field and just hit 'save' on the default options, we want to make - * sure they are set to the expected results. + /** + * CRUD Create Field With Two Classes. + * + * If we're creating a new field and just hit 'save' on the default options, + * we want to make sure they are set to the expected results. + * + * @codingStandardsIgnoreStart */ - function testCRUDCreateFieldWithTwoClasses() { - $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content')); + public function testCRUDCreateFieldWithTwoClasses() { + // @codingStandardsIgnoreEnd + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + 'access content', + 'create page content', + )); $this->drupalLogin($this->web_user); - // create field + // Create field. $name = strtolower($this->randomName()); $edit = array( 'fields[_add_new_field][label]' => $name, @@ -428,9 +491,9 @@ class LinkUITest extends DrupalWebTestcase { $this->assertFalse($instance['settings']['attributes']['rel'], 'Rel should be blank by default.'); $this->assertEqual($instance['settings']['attributes']['class'], $link_class_name, 'Two classes should be set.'); $this->assertFalse($instance['settings']['title_value'], 'By default, no title should be set.'); - + // Now, let's create a node with this field and make sure the link shows up: - // create page form + // create page form. $field_name = 'field_' . $name; $this->drupalGet('node/add/page'); $this->assertField($field_name . '[und][0][url]', 'URL found'); @@ -448,12 +511,13 @@ class LinkUITest extends DrupalWebTestcase { $this->drupalPost(NULL, $edit, t('Save')); $url = $this->getUrl(); - - // change to anonymous user + + // Change to anonymous user. $this->drupalLogout(); $this->drupalGet($url); $this->assertRaw('This & That'); $this->assertPattern('|class\s?=\s?"' . $link_class_name . '"|', "Classes $link_class_name exist on page."); } + } diff --git a/profiles/wcm_base/modules/contrib/link/tests/link.entity_token.test b/profiles/wcm_base/modules/contrib/link/tests/link.entity_token.test index 1f51fab43de51ff5e61ea226d686267e9cb4d0da..6c42655f5bae7b965ef12c0539000cf730e658d3 100644 --- a/profiles/wcm_base/modules/contrib/link/tests/link.entity_token.test +++ b/profiles/wcm_base/modules/contrib/link/tests/link.entity_token.test @@ -6,10 +6,13 @@ */ /** - * Testing that tokens can be used in link titles + * Testing that tokens can be used in link titles. */ class LinkEntityTokenTest extends LinkBaseTestClass { + /** + * Get Info. + */ public static function getInfo() { return array( 'name' => 'Link entity tokens test', @@ -19,24 +22,27 @@ class LinkEntityTokenTest extends LinkBaseTestClass { ); } - function setUp($modules = array()) { + /** + * Setup. + */ + public function setUp($modules = array()) { parent::setUp(array('token', 'entity', 'entity_token')); } - + /** * Creates a link field, fills it, then uses a loaded node to test tokens. */ - function testFieldTokenNodeLoaded() { - // create field + public function testFieldTokenNodeLoaded() { + // Create field. $settings = array( 'instance[settings][enable_tokens]' => 0, ); $field_name = $this->createLinkField('page', - $settings); + $settings); - // create page form + // Create page form. $this->drupalGet('node/add/page'); - //$field_name = 'field_' . $name; + // $field_name = 'field_' . $name;. $this->assertField($field_name . '[und][0][title]', 'Title found'); $this->assertField($field_name . '[und][0][url]', 'URL found'); @@ -58,11 +64,11 @@ class LinkEntityTokenTest extends LinkBaseTestClass { 'label' => $this->randomName(), ), ); - //$this->assert('pass', '<pre>' . print_r($token_url_tests, TRUE) . '<pre>'); - + // @codingStandardsIgnoreLine + // $this->assert('pass', '<pre>' . print_r($token_url_tests, TRUE) . '<pre>');. foreach ($token_url_tests as &$input) { $this->drupalGet('node/add/page'); - + $edit = array( 'title' => $input['label'], $field_name . '[und][0][title]' => $input['label'], @@ -73,34 +79,37 @@ class LinkEntityTokenTest extends LinkBaseTestClass { $input['url'] = $url; } - // change to anonymous user + // Change to anonymous user. $this->drupalLogout(); - + foreach ($token_url_tests as $index => $input2) { $node = node_load($index); $this->assertNotEqual(NULL, $node, "Do we have a node?"); $this->assertEqual($node->nid, $index, "Test that we have a node."); $token_name = '[node:' . str_replace('_', '-', $field_name) . ':url]'; $assert_data = token_replace($token_name, - array('node' => $node)); + array('node' => $node)); $this->assertEqual($input2['href'], $assert_data, "Test that the url token has been set to " . $input2['href'] . ' - ' . $assert_data); } } - + /** - * Creates a link field, fills it, then uses a loaded and node_view'd node to test tokens. + * Field Token Node Viewed. + * + * Creates a link field, fills it, then uses a loaded and node_view'd node to + * test tokens. */ - function testFieldTokenNodeViewed() { - // create field + public function testFieldTokenNodeViewed() { + // Create field. $settings = array( 'instance[settings][enable_tokens]' => 0, ); $field_name = $this->createLinkField('page', - $settings); + $settings); - // create page form + // Create page form. $this->drupalGet('node/add/page'); - //$field_name = 'field_' . $name; + // $field_name = 'field_' . $name;. $this->assertField($field_name . '[und][0][title]', 'Title found'); $this->assertField($field_name . '[und][0][url]', 'URL found'); @@ -122,11 +131,12 @@ class LinkEntityTokenTest extends LinkBaseTestClass { 'label' => $this->randomName(), ), ); - //$this->assert('pass', '<pre>' . print_r($token_url_tests, TRUE) . '<pre>'); + //@codingStandardsIgnoreLine + // $this->assert('pass', '<pre>' . print_r($token_url_tests, TRUE) . '<pre>');. foreach ($token_url_tests as &$input) { $this->drupalGet('node/add/page'); - + $edit = array( 'title' => $input['label'], $field_name . '[und][0][title]' => $input['label'], @@ -137,19 +147,18 @@ class LinkEntityTokenTest extends LinkBaseTestClass { $input['url'] = $url; } - // change to anonymous user + // Change to anonymous user. $this->drupalLogout(); - + foreach ($token_url_tests as $index => $input2) { $node = node_load($index); - $node_array = node_view($node, 'full'); $this->assertNotEqual(NULL, $node, "Do we have a node?"); $this->assertEqual($node->nid, $index, "Test that we have a node."); $token_name = '[node:' . str_replace('_', '-', $field_name) . ':url]'; $assert_data = token_replace($token_name, - array('node' => $node)); + array('node' => $node)); $this->assertEqual($input2['href'], $assert_data, "Test that the url token has been set to " . $input2['href'] . ' - ' . $assert_data); } } - -} \ No newline at end of file + +} diff --git a/profiles/wcm_base/modules/contrib/link/tests/link.test b/profiles/wcm_base/modules/contrib/link/tests/link.test index 962197f230cafc229f1c625d71154ea43462c527..dd9adb497c69ba57b488b1f528943a1d5489c0b1 100644 --- a/profiles/wcm_base/modules/contrib/link/tests/link.test +++ b/profiles/wcm_base/modules/contrib/link/tests/link.test @@ -5,10 +5,15 @@ * Link base test file - contains common functions for testing links. */ +/** + * Base Test Class. + */ class LinkBaseTestClass extends DrupalWebTestCase { + protected $permissions = array( 'access content', 'administer content types', + 'administer fields', 'administer nodes', 'administer filters', 'access comments', @@ -17,17 +22,23 @@ class LinkBaseTestClass extends DrupalWebTestCase { 'create page content', ); - function setUp() { + /** + * Setup. + */ + public function setUp() { $modules = func_get_args(); $modules = (isset($modules[0]) && is_array($modules[0]) ? $modules[0] : $modules); $modules[] = 'field_ui'; $modules[] = 'link'; parent::setUp($modules); - + $this->web_user = $this->drupalCreateUser($this->permissions); $this->drupalLogin($this->web_user); } + /** + * Create Link Field. + */ protected function createLinkField($node_type = 'page', $settings = array()) { $name = strtolower($this->randomName()); $edit = array( @@ -48,4 +59,5 @@ class LinkBaseTestClass extends DrupalWebTestCase { return $field_name; } + } diff --git a/profiles/wcm_base/modules/contrib/link/tests/link.token.test b/profiles/wcm_base/modules/contrib/link/tests/link.token.test index 617260e602a4cec41e9ec182f1438823db1b4702..edbb1df5f6c12900a44605a96b92706004251868 100644 --- a/profiles/wcm_base/modules/contrib/link/tests/link.token.test +++ b/profiles/wcm_base/modules/contrib/link/tests/link.token.test @@ -6,10 +6,13 @@ */ /** - * Testing that tokens can be used in link titles + * Testing that tokens can be used in link titles. */ class LinkTokenTest extends LinkBaseTestClass { + /** + * Get Info. + */ public static function getInfo() { return array( 'name' => 'Link tokens - browser test', @@ -19,34 +22,38 @@ class LinkTokenTest extends LinkBaseTestClass { ); } - function setUp($modules = array()) { + /** + * Setup. + */ + public function setUp($modules = array()) { parent::setUp(array('token')); } /** * Creates a link field with a required title enabled for user-entered tokens. + * * Creates a node with a token in the link title and checks the value. */ - function testUserTokenLinkCreate() { - // create field + public function testUserTokenLinkCreate() { + // Create field. $settings = array( 'instance[settings][enable_tokens]' => 1, ); $field_name = $this->createLinkField('page', - $settings); + $settings); - // create page form + // Create page form. $this->drupalGet('node/add/page'); - //$field_name = 'field_' . $name; + // $field_name = 'field_' . $name;. $this->assertField($field_name . '[und][0][title]', 'Title found'); $this->assertField($field_name . '[und][0][url]', 'URL found'); $input = array( - 'href' => 'http://example.com/' . $this->randomName(), - 'label' => $this->randomName(), + 'href' => 'http://example.com/' . $this->randomName(), + 'label' => $this->randomName(), ); - //$this->drupalLogin($this->web_user); + // $this->drupalLogin($this->web_user);. $this->drupalGet('node/add/page'); $edit = array( @@ -57,36 +64,37 @@ class LinkTokenTest extends LinkBaseTestClass { $this->drupalPost(NULL, $edit, t('Save')); $url = $this->getUrl(); - // change to anonymous user + // Change to anonymous user. $this->drupalLogout(); $this->drupalGet($url); $this->assertRaw(l($input['label'] . ' page', $input['href'])); } - /** * Creates a link field with a static title and an admin-entered token. + * * Creates a node with a link and checks the title value. */ - function testStaticTokenLinkCreate() { + public function testStaticTokenLinkCreate() { - // create field + // Create field. $name = $this->randomName(); $settings = array( 'instance[settings][title]' => 'value', - 'instance[settings][title_value]' => $name . ' [node:content-type:machine-name]'); + 'instance[settings][title_value]' => $name . ' [node:content-type:machine-name]', + ); $field_name = $this->createLinkField('page', $settings); - // create page form + // Create page form. $this->drupalGet('node/add/page'); $this->assertField($field_name . '[und][0][url]', 'URL found'); $input = array( - 'href' => 'http://example.com/' . $this->randomName() + 'href' => 'http://example.com/' . $this->randomName(), ); - //$this->drupalLogin($this->web_user); + // $this->drupalLogin($this->web_user);. $this->drupalGet('node/add/page'); $edit = array( @@ -97,7 +105,7 @@ class LinkTokenTest extends LinkBaseTestClass { $url = $this->getUrl(); - // change to anonymous user + // Change to anonymous user. $this->drupalLogout(); $this->drupalGet($url); @@ -106,30 +114,32 @@ class LinkTokenTest extends LinkBaseTestClass { /** * Creates a link field with a static title and an admin-entered token. + * * Creates a node with a link and checks the title value. * * Basically, I want to make sure the [title-raw] token works, because it's a * token that changes from node to node, where [type]'s always going to be the * same. */ - function testStaticTokenLinkCreate2() { + public function testStaticTokenLinkCreate2() { - // create field + // Create field. $name = $this->randomName(); $settings = array( 'instance[settings][title]' => 'value', - 'instance[settings][title_value]' => $name . ' [node:title]'); + 'instance[settings][title_value]' => $name . ' [node:title]', + ); $field_name = $this->createLinkField('page', $settings); - // create page form + // Create page form. $this->drupalGet('node/add/page'); $this->assertField($field_name . '[und][0][url]', 'URL found'); $input = array( - 'href' => 'http://example.com/' . $this->randomName() + 'href' => 'http://example.com/' . $this->randomName(), ); - //$this->drupalLogin($this->web_user); + // $this->drupalLogin($this->web_user);. $this->drupalGet('node/add/page'); $edit = array( @@ -140,27 +150,32 @@ class LinkTokenTest extends LinkBaseTestClass { $url = $this->getUrl(); - // change to anonymous user + // Change to anonymous user. $this->drupalLogout(); $this->drupalGet($url); $this->assertRaw(l($name . ' ' . $name, $input['href'])); } - // This test doesn't seem to actually work, due to lack of 'title' in url. - function _test_Link_With_Title_Attribute_token_url_form() { - /* $this->loginWithPermissions($this->permissions); + /** + * This test doesn't seem to actually work, due to lack of 'title' in url. + * + * @codingStandardsIgnoreStart + */ + public function _test_Link_With_Title_Attribute_token_url_form() { + // @codingStandardsIgnoreEnd + /* $this->loginWithPermissions($this->permissions); $this->acquireContentTypes(1); $field_settings = array( - 'type' => 'link', - 'widget_type' => 'link', - 'type_name' => $this->content_types[0]->name, - 'attributes' => array( - 'class' => '', - 'target' => 'default', - 'rel' => 'nofollow', - 'title' => '', - ), + 'type' => 'link', + 'widget_type' => 'link', + 'type_name' => $this->content_types[0]->name, + 'attributes' => array( + 'class' => '', + 'target' => 'default', + 'rel' => 'nofollow', + 'title' => '', + ), ); $field = $this->createField($field_settings, 0); @@ -170,10 +185,10 @@ class LinkTokenTest extends LinkBaseTestClass { $url_type = str_replace('_', '-', $this->content_types[0]->type); $edit = array('attributes[title]' => '['. $field_name .'-url]', - 'enable_tokens' => TRUE); - + 'enable_tokens' => TRUE); + // @codingStandardsIgnoreLine $this->drupalPost('admin/content/node-type/'. $url_type .'/fields/'. $field['field_name'], - $edit, t('Save field settings')); + $edit, t('Save field settings')); $this->assertText(t('Saved field @field_name', array('@field_name' => $field['field_name'])));*/ $name = $this->randomName(); $settings = array( @@ -183,12 +198,9 @@ class LinkTokenTest extends LinkBaseTestClass { $field_name = $this->createLinkField('page', $settings); // So, having saved this field_name, let's see if it works... - //$this->acquireNodes(1); - - //$node = node_load($this->nodes[0]->nid); - - //$this->drupalGet('node/'. $this->nodes[0]->nid); - + // $this->acquireNodes(1); + // $node = node_load($this->nodes[0]->nid); + // $this->drupalGet('node/'. $this->nodes[0]->nid);. $edit = array(); $test_link_url = 'http://www.example.com/test'; $edit[$field_name . '[und][0][url]'] = $test_link_url; @@ -200,23 +212,28 @@ class LinkTokenTest extends LinkBaseTestClass { $this->drupalPost(NULL, $edit, t('Save')); // Make sure we get a new version! - //$node = node_load($this->nodes[0]->nid, NULL, TRUE); + // $node = node_load($this->nodes[0]->nid, NULL, TRUE);. $this->assertText(t('Basic page @title has been updated.', - array('@title' => $name))); + array('@title' => $name))); - //$this->drupalGet('node/'. $node->nid); + // $this->drupalGet('node/'. $node->nid);. $this->assertText($title, 'Make sure the link title/text shows'); $this->assertRaw(' title="' . $test_link_url . '"', "Do we show the link url as the title attribute?"); $this->assertNoRaw(' title="[' . $field_name . '-url]"'); $this->assertTrue(module_exists('token'), t('Assure that Token Module is enabled.')); - //$this->fail($this->content); + // $this->fail($this->content);. } /** + * Link With Title Attribute token title form. + * * If the title of the link is set to the title attribute, then the title * attribute isn't supposed to show. + * + * @codingStandardsIgnoreStart */ - function _test_Link_With_Title_Attribute_token_title_form() { + public function _test_Link_With_Title_Attribute_token_title_form() { + // @codingStandardsIgnoreEnd $this->loginWithPermissions($this->permissions); $this->acquireContentTypes(1); $field_settings = array( @@ -233,21 +250,20 @@ class LinkTokenTest extends LinkBaseTestClass { $field = $this->createField($field_settings, 0); $field_name = $field['field_name']; - $field_db_info = content_database_info($field); $url_type = str_replace('_', '-', $this->content_types[0]->type); - $edit = array('attributes[title]' => '[' . $field_name . '-title]', - 'enable_tokens' => TRUE); + $edit = array( + 'attributes[title]' => '[' . $field_name . '-title]', + 'enable_tokens' => TRUE, + ); $this->drupalPost('admin/content/node-type/' . $url_type . '/fields/' . $field['field_name'], - $edit, t('Save field settings')); + $edit, t('Save field settings')); $this->assertText(t('Saved field @field_name', array('@field_name' => $field['field_name']))); // So, having saved this field_name, let's see if it works... $this->acquireNodes(1); - $node = node_load($this->nodes[0]->nid); - $this->drupalGet('node/' . $this->nodes[0]->nid); $edit = array(); @@ -260,24 +276,35 @@ class LinkTokenTest extends LinkBaseTestClass { // Make sure we get a new version! $node = node_load($this->nodes[0]->nid, NULL, TRUE); $this->assertText(t('@type @title has been updated.', - array('@title' => $node->title, - '@type' => $this->content_types[0]->name))); + array( + '@title' => $node->title, + '@type' => $this->content_types[0]->name, + ))); $this->drupalGet('node/' . $node->nid); $this->assertText($title, 'Make sure the link title/text shows'); $this->assertNoRaw(' title="' . $title . '"', "We should not show the link title as the title attribute?"); $this->assertNoRaw(' title="[' . $field_name . '-title]"'); - //$this->fail($this->content); + // $this->fail($this->content);. } /** - * Trying to set the url to contain a token. + * Trying to set the url to contain a token. + * + * @codingStandardsIgnoreStart */ - function _testUserTokenLinkCreateInURL() { - $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content')); + public function _testUserTokenLinkCreateInURL() { + //@codingStandardsIgnoreEnd + + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + 'access content', + 'create page content', + )); $this->drupalLogin($this->web_user); - // create field + // Create field. $name = strtolower($this->randomName()); $edit = array( '_add_new_field[label]' => $name, @@ -288,20 +315,21 @@ class LinkTokenTest extends LinkBaseTestClass { $this->drupalPost('admin/content/node-type/page/fields', $edit, t('Save')); $this->drupalPost(NULL, array( 'title' => 'required', - 'enable_tokens' => 1), t('Save field settings')); + 'enable_tokens' => 1, + ), t('Save field settings')); // Is field created? $this->assertRaw(t('Added field %label.', array('%label' => $name)), 'Field added'); - // create page form + // Create page form. $this->drupalGet('node/add/page'); $field_name = 'field_' . $name; $this->assertField($field_name . '[0][title]', 'Title found'); $this->assertField($field_name . '[0][url]', 'URL found'); $input = array( - 'href' => 'http://example.com/' . $this->randomName(), - 'label' => $this->randomName(), + 'href' => 'http://example.com/' . $this->randomName(), + 'label' => $this->randomName(), ); $this->drupalLogin($this->web_user); @@ -315,22 +343,31 @@ class LinkTokenTest extends LinkBaseTestClass { $this->drupalPost(NULL, $edit, t('Save')); $url = $this->getUrl(); - // change to anonymous user + // Change to anonymous user. $this->drupalLogout(); $this->drupalGet($url); $this->assertRaw(l($input['label'], $input['href'] . '/page')); - //$this->fail($this->content); + // $this->fail($this->content);. } /** - * Trying to set the url to contain a token. + * Trying to set the url to contain a token. + * + * @codingStandardsIgnoreStart */ - function _testUserTokenLinkCreateInURL2() { - $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content')); + public function _testUserTokenLinkCreateInURL2() { + // @codingStandardsIgnoreEnd + + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + 'access content', + 'create page content', + )); $this->drupalLogin($this->web_user); - // create field + // Create field. $name = strtolower($this->randomName()); $edit = array( '_add_new_field[label]' => $name, @@ -341,20 +378,21 @@ class LinkTokenTest extends LinkBaseTestClass { $this->drupalPost('admin/content/node-type/page/fields', $edit, t('Save')); $this->drupalPost(NULL, array( 'title' => 'required', - 'enable_tokens' => 1), t('Save field settings')); + 'enable_tokens' => 1, + ), t('Save field settings')); // Is field created? $this->assertRaw(t('Added field %label.', array('%label' => $name)), 'Field added'); - // create page form + // Create page form. $this->drupalGet('node/add/page'); $field_name = 'field_' . $name; $this->assertField($field_name . '[0][title]', 'Title found'); $this->assertField($field_name . '[0][url]', 'URL found'); $input = array( - 'href' => 'http://example.com/' . $this->randomName(), - 'label' => $this->randomName(), + 'href' => 'http://example.com/' . $this->randomName(), + 'label' => $this->randomName(), ); $this->drupalLogin($this->web_user); @@ -368,22 +406,34 @@ class LinkTokenTest extends LinkBaseTestClass { $this->drupalPost(NULL, $edit, t('Save')); $url = $this->getUrl(); - // change to anonymous user + // Change to anonymous user. $this->drupalLogout(); $this->drupalGet($url); $this->assertRaw(l($input['label'], $input['href'] . '/' . $this->web_user->uid)); } - + /** - * Test that if you have a title and no url on a field which does not have tokens enabled, - * that the title is sanitized once. + * CRUD Title Only Title No Link. + * + * Test that if you have a title and no url on a field which does not have + * tokens enabled, that the title is sanitized once. + * + * @codingStandardsIgnoreStart */ - function testCRUDTitleOnlyTitleNoLink2() { - $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content')); + public function testCRUDTitleOnlyTitleNoLink2() { + //@codingStandardsIgnoreEnd + + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + 'access content', + 'create page content', + )); + $this->drupalLogin($this->web_user); - // create field + // Create field. $name = strtolower($this->randomName()); $field_name = 'field_' . $name; $edit = array( @@ -401,8 +451,8 @@ class LinkTokenTest extends LinkBaseTestClass { // Is field created? $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added'); - - // create page form + + // Create page form. $this->drupalGet('node/add/page'); $this->assertField($field_name . '[und][0][url]', 'URL found'); @@ -419,13 +469,12 @@ class LinkTokenTest extends LinkBaseTestClass { $this->drupalPost(NULL, $edit, t('Save')); $url = $this->getUrl(); - - // change to anonymous user + + // Change to anonymous user. $this->drupalLogout(); $this->drupalGet($url); $this->assertRaw('This & That'); } - - + } diff --git a/profiles/wcm_base/modules/contrib/link/tests/link.validate.test b/profiles/wcm_base/modules/contrib/link/tests/link.validate.test index a9ac116ca91619f20d465cb91288ef547ae41b9a..addd7d37d6275a97660576d30cb9420085160d21 100644 --- a/profiles/wcm_base/modules/contrib/link/tests/link.validate.test +++ b/profiles/wcm_base/modules/contrib/link/tests/link.validate.test @@ -5,8 +5,14 @@ * Tests that exercise the validation functions in the link module. */ +/** + * Validate Test Case. + */ class LinkValidateTestCase extends LinkBaseTestClass { + /** + * Create Link. + */ protected function createLink($url, $title, $attributes = array()) { return array( 'url' => $url, @@ -17,8 +23,11 @@ class LinkValidateTestCase extends LinkBaseTestClass { /** * Takes a url, and sees if it can validate that the url is valid. + * + * @codingStandardsIgnoreStart */ protected function link_test_validate_url($url) { + // @codingStandardsIgnoreEnd $field_name = $this->createLinkField(); @@ -26,11 +35,11 @@ class LinkValidateTestCase extends LinkBaseTestClass { $settings = array( 'title' => $label, $field_name => array( - LANGUAGE_NONE=> array( + LANGUAGE_NONE => array( array( 'title' => $label, 'url' => $url, - ) + ), ), ), ); @@ -41,10 +50,17 @@ class LinkValidateTestCase extends LinkBaseTestClass { $this->assertEqual($url, $node->{$field_name}[LANGUAGE_NONE][0]['url']); } + } +/** + * Class for Validate Test. + */ class LinkValidateTest extends LinkValidateTestCase { + /** + * Get Info. + */ public static function getInfo() { return array( 'name' => 'Link Validation Tests', @@ -53,23 +69,35 @@ class LinkValidateTest extends LinkValidateTestCase { ); } - function test_link_validate_basic_url() { + /** + * Validate basic URL. + * + * @codingStandardsIgnoreStart + */ + public function test_link_validate_basic_url() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('http://www.example.com'); } /** * Test if we're stopped from posting a bad url on default validation. + * + * @codingStandardsIgnoreStart */ - function test_link_validate_bad_url_validate_default() { - $this->web_user = $this->drupalCreateUser(array('administer content types', - 'administer nodes', - 'administer filters', - 'access content', - 'create page content', - 'access administration pages')); + public function test_link_validate_bad_url_validate_default() { + // @codingStandardsIgnoreEnd + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + 'administer nodes', + 'administer filters', + 'access content', + 'create page content', + 'access administration pages', + )); $this->drupalLogin($this->web_user); - // create field + // Create field. $name = strtolower($this->randomName()); $edit = array( 'fields[_add_new_field][label]' => $name, @@ -86,35 +114,43 @@ class LinkValidateTest extends LinkValidateTestCase { node_types_rebuild(); menu_rebuild(); - // create page form + // Create page form. $this->drupalGet('node/add/page'); $field_name = 'field_' . $name; $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found'); $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found'); - $edit = array( 'title' => 'Simple Title', $field_name . '[und][0][url]' => 'edik:naw', ); $this->drupalPost(NULL, $edit, t('Save')); - $this->assertText(t('The value @value provided for @field is not a valid URL.', array('@value' => 'edik:naw', '@field' => $name))); + $this->assertText(t('The value @value provided for @field is not a valid URL.', array( + '@value' => 'edik:naw', + '@field' => $name, + ))); } /** * Test if we're stopped from posting a bad url with validation on. + * + * @codingStandardsIgnoreStart */ - function test_link_validate_bad_url_validate_on() { - $this->web_user = $this->drupalCreateUser(array('administer content types', - 'administer nodes', - 'administer filters', - 'access content', - 'create page content', - 'access administration pages')); + public function test_link_validate_bad_url_validate_on() { + // @codingStandardsIgnoreEnd + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + 'administer nodes', + 'administer filters', + 'access content', + 'create page content', + 'access administration pages', + )); $this->drupalLogin($this->web_user); - // create field + // Create field. $name = strtolower($this->randomName()); $edit = array( 'fields[_add_new_field][label]' => $name, @@ -131,36 +167,44 @@ class LinkValidateTest extends LinkValidateTestCase { node_types_rebuild(); menu_rebuild(); - // create page form + // Create page form. $this->drupalGet('node/add/page'); $field_name = 'field_' . $name; $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found'); $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found'); - $edit = array( 'title' => 'Simple Title', $field_name . '[und][0][url]' => 'edik:naw', ); $this->drupalPost(NULL, $edit, t('Save')); - $this->assertText(t('The value @value provided for @field is not a valid URL.', array('@field' => $name, '@value' => 'edik:naw'))); + $this->assertText(t('The value @value provided for @field is not a valid URL.', array( + '@field' => $name, + '@value' => 'edik:naw', + ))); } /** * Test if we can post a bad url if the validation is expressly turned off. + * + * @codingStandardsIgnoreStart */ - function test_link_validate_bad_url_validate_off() { - $this->web_user = $this->drupalCreateUser(array('administer content types', - 'administer nodes', - 'administer filters', - 'access content', - 'create page content', - 'access administration pages')); + public function test_link_validate_bad_url_validate_off() { + // @codingStandardsIgnoreEnd + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + 'administer nodes', + 'administer filters', + 'access content', + 'create page content', + 'access administration pages', + )); $this->drupalLogin($this->web_user); - // create field + // Create field. $name = strtolower($this->randomName()); $edit = array( 'fields[_add_new_field][label]' => $name, @@ -172,6 +216,7 @@ class LinkValidateTest extends LinkValidateTestCase { $this->drupalPost(NULL, array(), t('Save field settings')); $this->drupalPost(NULL, array('instance[settings][validate_url]' => FALSE), t('Save settings')); + // @codingStandardsIgnoreLine /*$instance_details = db_query("SELECT * FROM {field_config_instance} WHERE field_name = :field_name AND bundle = 'page'", array(':field_name' => 'field_'. $name))->fetchObject(); $this->fail('<pre>'. print_r($instance_details, TRUE) .'</pre>'); $this->fail('<pre>'. print_r(unserialize($instance_details->data), TRUE) .'</pre>');*/ @@ -181,51 +226,62 @@ class LinkValidateTest extends LinkValidateTestCase { node_types_rebuild(); menu_rebuild(); - // create page form + // Create page form. $this->drupalGet('node/add/page'); $field_name = 'field_' . $name; $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found'); $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found'); - $edit = array( 'title' => 'Simple Title', $field_name . '[und][0][url]' => 'edik:naw', ); $this->drupalPost(NULL, $edit, t('Save')); - $this->assertNoText(t('The value %value provided for %field is not a valid URL.', array('%field' => $name, '%value' => 'edik:naw'))); + $this->assertNoText(t('The value %value provided for %field is not a valid URL.', array( + '%field' => $name, + '%value' => 'edik:naw', + ))); } /** - * Test if a bad url can sneak through un-filtered if we play with the validation... + * Validate switching between validation status. + * + * Test if a bad url can sneak through un-filtered if we play with the + * validation... + * + * @codingStandardsIgnoreStart */ - function x_test_link_validate_switching_between_validation_status() { + public function x_test_link_validate_switching_between_validation_status() { + // @codingStandardsIgnoreEnd $this->acquireContentTypes(1); - $this->web_user = $this->drupalCreateUser(array('administer content types', - 'administer nodes', - 'access administration pages', - 'access content', - 'create ' . $this->content_types[0]->type . ' content', - 'edit any ' . $this->content_types[0]->type . ' content')); + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + 'administer nodes', + 'access administration pages', + 'access content', + 'create ' . $this->content_types[0]->type . ' content', + 'edit any ' . $this->content_types[0]->type . ' content', + )); $this->drupalLogin($this->web_user); - variable_set('node_options_' . $this->content_types[0]->name, array('status', 'promote')); + variable_set('node_options_' . $this->content_types[0]->name, array( + 'status', + 'promote', + )); $field_settings = array( 'type' => 'link', 'widget_type' => 'link', 'type_name' => $this->content_types[0]->name, - 'attributes' => array(), // <-- This is needed or we have an error + // <-- This is needed or we have an error. + 'attributes' => array(), 'validate_url' => 0, ); $field = $this->createField($field_settings, 0); - //$this->fail('<pre>'. print_r($field, TRUE) .'</pre>'); - $field_db_info = content_database_info($field); $this->acquireNodes(2); - $node = node_load($this->nodes[0]->nid); - $this->drupalGet('node/' . $this->nodes[0]->nid); $edit = array(); @@ -235,8 +291,12 @@ class LinkValidateTest extends LinkValidateTestCase { $edit[$field['field_name'] . '[0][title]'] = $title; $this->drupalPost('node/' . $this->nodes[0]->nid . '/edit', $edit, t('Save')); - //$this->pass($this->content); - $this->assertNoText(t('The value %value provided for %field is not a valid URL.', array('%field' => $name, '%value' => trim($url)))); + // $this->pass($this->content);. + // @codingStandardsIgnoreLine + $this->assertNoText(t('The value %value provided for %field is not a valid URL.', array( + '%field' => $name, + '%value' => trim($url), + ))); // Make sure we get a new version! $node = node_load($this->nodes[0]->nid, NULL, TRUE); @@ -248,8 +308,9 @@ class LinkValidateTest extends LinkValidateTestCase { // Turn the array validation back _on_. $edit = array('validate_url' => TRUE); $node_type_link = str_replace('_', '-', $node->type); - //$this->drupalGet('admin/content/node-type/'. $node_type_link .'/fields'); ///'. $field['field_name']); - //$this->fail($this->content); + // @codingStandardsIgnoreLine + // $this->drupalGet('admin/content/node-type/'. $node_type_link .'/fields'); ///'. $field['field_name']); + // $this->fail($this->content);. $this->drupalPost('admin/content/node-type/' . $node_type_link . '/fields/' . $field['field_name'], $edit, t('Save field settings')); $this->drupalGet('node/' . $node->nid); @@ -257,17 +318,26 @@ class LinkValidateTest extends LinkValidateTestCase { // url() function. But we should have a test that makes sure it continues // to work. $this->assertNoRaw($url, 'Make sure Javascript does not display.'); - //$this->fail($this->content); - + // $this->fail($this->content);. } - // Validate that '<front>' is a valid url. - function test_link_front_url() { + /** + * Validate that '<front>' is a valid url. + * + * @codingStandardsIgnoreStart + */ + public function test_link_front_url() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('<front>'); } - // Validate that an internal url would be accepted. - function test_link_internal_url() { + /** + * Validate that an internal url would be accepted. + * + * @codingStandardsIgnoreStart + */ + public function test_link_internal_url() { + // @codingStandardsIgnoreEnd // Create the content first. $node = $this->drupalCreateNode(); @@ -277,22 +347,46 @@ class LinkValidateTest extends LinkValidateTestCase { $this->assertEqual(LINK_INTERNAL, $type, 'Test ' . $link . ' is an internal link.'); } - // Validate a simple mailto. - function test_link_mailto() { + /** + * Validate a simple mailto. + * + * @codingStandardsIgnoreStart + */ + public function test_link_mailto() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('mailto:jcfiala@gmail.com'); } - function test_link_external_https() { + /** + * Check link external https. + * + * @codingStandardsIgnoreStart + */ + public function test_link_external_https() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('https://www.example.com/'); } - function test_link_ftp() { + /** + * Check link FTP. + * + * @codingStandardsIgnoreStart + */ + public function test_link_ftp() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('ftp://www.example.com/'); } + } +/** + * Validate Test News. + */ class LinkValidateTestNews extends LinkValidateTestCase { + /** + * Get Info. + */ public static function getInfo() { return array( 'name' => 'Link News Validation Tests', @@ -301,18 +395,36 @@ class LinkValidateTestNews extends LinkValidateTestCase { ); } - // Validate a news link to a message group - function test_link_news() { + /** + * Validate a news link to a message group. + * + * @codingStandardsIgnoreStart + */ + public function test_link_news() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('news:comp.infosystems.www.misc'); } - // Validate a news link to a message id. Said ID copied off of google groups. - function test_link_news_message() { + /** + * Validate a news link to a message id. Said ID copied off of google groups. + * + * @codingStandardsIgnoreStart + */ + public function test_link_news_message() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('news:hj0db8$vrm$1@news.eternal-september.org'); } + } +/** + * Validate Specific URL. + */ class LinkValidateSpecificURL extends LinkValidateTestCase { + + /** + * Get Info. + */ public static function getInfo() { return array( 'name' => 'Link Specific URL Validation Tests', @@ -321,24 +433,53 @@ class LinkValidateSpecificURL extends LinkValidateTestCase { ); } - // Lets throw in a lot of umlouts for testing! - function test_umlout_url() { + /** + * Lets throw in a lot of umlouts for testing! + * + * @codingStandardsIgnoreStart + */ + public function test_umlout_url() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('http://üÜü.exämple.com/nöde'); } - function test_umlout_mailto() { + /** + * Check umlout mailto. + * + * @codingStandardsIgnoreStart + */ + public function test_umlout_mailto() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('mailto:Üser@exÅmple.com'); } - function test_german_b_url() { + /** + * Check german b in url. + * + * @codingStandardsIgnoreStart + */ + public function test_german_b_url() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('http://www.test.com/ßstuff'); } - function test_special_n_url() { + /** + * Check Special in url. + * + * @codingStandardsIgnoreStart + */ + public function test_special_n_url() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('http://www.testÑñ.com/'); } - function test_curly_brackets_in_query() { + /** + * Curly Brackets in query. + * + * @codingStandardsIgnoreStart + */ + public function test_curly_brackets_in_query() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('http://www.healthyteennetwork.org/index.asp?Type=B_PR&SEC={2AE1D600-4FC6-4B4D-8822-F1D5F072ED7B}&DE={235FD1E7-208D-4363-9854-4E6775EB8A4C}'); } @@ -346,8 +487,11 @@ class LinkValidateSpecificURL extends LinkValidateTestCase { * Here, we're testing that a very long url is stored properly in the db. * * Basically, trying to test http://drupal.org/node/376818 + * + * @codingStandardsIgnoreStart */ - function testLinkURLFieldIsBig() { + public function testLinkURLFieldIsBig() { + // @codingStandardsIgnoreEnd $long_url = 'http://th.wikipedia.org/wiki/%E0%B9%82%E0%B8%A3%E0%B8%87%E0%B9%80%E0%B8%A3%E0%B8%B5%E0%B8%A2%E0%B8%99%E0%B9%80%E0%B8%9A%E0%B8%8D%E0%B8%88%E0%B8%A1%E0%B8%A3%E0%B8%B2%E0%B8%8A%E0%B8%B9%E0%B8%97%E0%B8%B4%E0%B8%A8_%E0%B8%99%E0%B8%84%E0%B8%A3%E0%B8%A8%E0%B8%A3%E0%B8%B5%E0%B8%98%E0%B8%A3%E0%B8%A3%E0%B8%A1%E0%B8%A3%E0%B8%B2%E0%B8%8A'; $this->link_test_validate_url($long_url); } @@ -355,12 +499,18 @@ class LinkValidateSpecificURL extends LinkValidateTestCase { } /** - * A series of tests of links, only going against the link_validate_url function in link.module. + * Validate Url Light. + * + * A series of tests of links, only going against the link_validate_url function + * in link.module. * * Validation is guided by the rules in http://tools.ietf.org/html/rfc1738 ! */ class LinkValidateUrlLight extends DrupalWebTestCase { + /** + * Get Info. + */ public static function getInfo() { return array( 'name' => 'Link Light Validation Tests', @@ -368,72 +518,107 @@ class LinkValidateUrlLight extends DrupalWebTestCase { 'group' => 'Link', ); } - - function setUp() { + + /** + * Setup. + */ + public function setUp() { parent::setUp('link'); } /** - * Translates the LINK type constants to english for display and debugging of tests + * Name Link Type. + * + * Translates the LINK type constants to english for display and debugging of + * tests. + * + * @codingStandardsIgnoreStart */ - function name_Link_Type($type) { + public function name_Link_Type($type) { + // @codingStandardsIgnoreEnd switch ($type) { case LINK_FRONT: return "Front"; + case LINK_EMAIL: return "Email"; + case LINK_NEWS: return "Newsgroup"; + case LINK_INTERNAL: return "Internal Link"; + case LINK_EXTERNAL: return "External Link"; + case FALSE: return "Invalid Link"; + default: return "Bad Value:" . $type; } } - // Make sure that a link labeled <front> works. - function testValidateFrontLink() { + /** + * Make sure that a link labeled <front> works. + */ + public function testValidateFrontLink() { $valid = link_validate_url('<front>'); $this->assertEqual(LINK_FRONT, $valid, 'Make sure that front link is verified and identified'); } - function testValidateEmailLink() { + /** + * Validate Email Link. + */ + public function testValidateEmailLink() { $valid = link_validate_url('mailto:bob@example.com'); $this->assertEqual(LINK_EMAIL, $valid, "Make sure a basic mailto is verified and identified"); } - function testValidateEmailLinkBad() { + /** + * Validate Email Link Bad. + */ + public function testValidateEmailLinkBad() { $valid = link_validate_url(':bob@example.com'); $this->assertEqual(FALSE, $valid, 'Make sure just a bad address is correctly failed'); } - function testValidateNewsgroupLink() { + /** + * Validate Newsgroup Link. + */ + public function testValidateNewsgroupLink() { $valid = link_validate_url('news:comp.infosystems.www.misc'); $this->assertEqual(LINK_NEWS, $valid, 'Make sure link to newsgroup validates as news.'); } - function testValidateNewsArticleLink() { + /** + * Validate News Article Link. + */ + public function testValidateNewsArticleLink() { $valid = link_validate_url('news:hj0db8$vrm$1@news.eternal-september.org'); $this->assertEqual(LINK_NEWS, $valid, 'Make sure link to specific article validates as news.'); } - function testValidateBadNewsgroupLink() { + /** + * Validate Bad Newsgroup Link. + */ + public function testValidateBadNewsgroupLink() { $valid = link_validate_url('news:comp.bad_name.misc'); $this->assertEqual(FALSE, $valid, 'newsgroup names can\'t contain underscores, so it should come back as invalid.'); } - function testValidateInternalLinks() { + /** + * Validate Internal Links. + */ + public function testValidateInternalLinks() { $tempfile = drupal_tempnam('public://files', 'test'); $links = array( 'rss.xml', file_uri_target($tempfile), drupal_realpath($tempfile), ); - + foreach ($links as $link) { $type = link_url_type($link); $this->assertEqual(LINK_INTERNAL, $type, 'Test ' . $link . ' is an internal link.'); @@ -442,7 +627,10 @@ class LinkValidateUrlLight extends DrupalWebTestCase { } } - function testValidateExternalLinks() { + /** + * Validate External Links. + */ + public function testValidateExternalLinks() { $links = array( 'http://localhost:8080/', 'www.example.com', @@ -458,7 +646,7 @@ class LinkValidateUrlLight extends DrupalWebTestCase { 'www.test-site.com', 'http://example.com/index.php?q=node/123', 'http://example.com/?first_name=Joe Bob&last_name=Smith', - // Anchors + // Anchors. 'http://www.example.com/index.php#test', 'http://www.example.com/index.php#this@that.', 'http://www.example.com/index.php#', @@ -466,8 +654,22 @@ class LinkValidateUrlLight extends DrupalWebTestCase { 'http://www.archive.org/stream/aesopsfables00aesorich#page/n7/mode/2up', 'http://www.example.com/blah/#this@that?', ); + // Test all of the protocols. - $allowed_protocols = variable_get('filter_allowed_protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal')); + $allowed_protocols = variable_get('filter_allowed_protocols', array( + 'http', + 'https', + 'ftp', + 'news', + 'nntp', + 'telnet', + 'mailto', + 'irc', + 'ssh', + 'sftp', + 'webcal', + )); + foreach ($allowed_protocols as $protocol) { if ($protocol !== 'news' && $protocol !== 'mailto') { $links[] = $protocol . '://www.example.com'; @@ -478,25 +680,28 @@ class LinkValidateUrlLight extends DrupalWebTestCase { $this->assertEqual(LINK_EXTERNAL, $type, 'Testing that ' . $link . ' is an external link.'); $valid = link_validate_url($link); $this->assertTrue($valid, 'Test ' . $link . ' is valid external link.'); - // The following two lines are commented out and only used for comparisons. - //$valid2 = valid_url($link, TRUE); - //$this->assertEqual(TRUE, $valid2, "Using valid_url() on $link."); + // The following two lines are commented out and only used for + // comparisons. + // $valid2 = valid_url($link, TRUE); + // $this->assertEqual(TRUE, $valid2, "Using valid_url() on $link.");. } - // Test if we can make a tld valid: - variable_set('link_extra_domains', array('frog')); - $valid = link_validate_url('http://www.example.frog'); - $this->assertEqual(LINK_EXTERNAL, $valid, "Testing that http://www.example.frog is a valid external link if we've added 'frog' to the list of valid domains."); } - function testInvalidExternalLinks() { + /** + * Check Invalid External Links. + */ + public function testInvalidExternalLinks() { $links = array( 'http://www.ex ample.com/', - 'http://25.0.0/', // bad ip! + // Bad ip! + 'http://25.0.0/', 'http://4827.0.0.2/', - '//www.example.com/', - 'http://www.testß.com/', // ß not allowed in domain names! - 'http://www.example.frog/', // Bad TLD - //'http://www.-fudge.com/', // domains can't have sections starting with a dash. + // ß not allowed in domain names! + 'http://www.testß.com/', + // Bad TLD. + 'http://.www.foo.bar./', + // Domains can't have sections starting with a dash. + // 'http://www.-fudge.com/', 'http://example.com/index.php?page=this\that', 'example@example.com', ); @@ -505,4 +710,5 @@ class LinkValidateUrlLight extends DrupalWebTestCase { $this->assertEqual(FALSE, $valid, 'Testing that ' . $link . ' is not a valid link.'); } } + } diff --git a/profiles/wcm_base/modules/contrib/link/views/link.views.inc b/profiles/wcm_base/modules/contrib/link/views/link.views.inc index 27d5182fa85c45b00ad7d86d87238bfa32ec8534..8c080ad11199c980a08f00b8a6e8fbfd700a4f32 100644 --- a/profiles/wcm_base/modules/contrib/link/views/link.views.inc +++ b/profiles/wcm_base/modules/contrib/link/views/link.views.inc @@ -1,4 +1,7 @@ <?php + +// @codingStandardsIgnoreFile + /** * @file * Contains functions handling views integration. diff --git a/profiles/wcm_base/modules/contrib/link/views/link_views_handler_argument_target.inc b/profiles/wcm_base/modules/contrib/link/views/link_views_handler_argument_target.inc index f0622d05c050643cc41193fd66e2b10bf6ef2a36..2fa1715a3d496810d55bc854c059e8dab4ad7cdb 100644 --- a/profiles/wcm_base/modules/contrib/link/views/link_views_handler_argument_target.inc +++ b/profiles/wcm_base/modules/contrib/link/views/link_views_handler_argument_target.inc @@ -7,20 +7,26 @@ /** * Argument handler to filter results by target. + * + * @codingStandardsIgnoreStart */ class link_views_handler_argument_target extends views_handler_argument { /** * Provide defaults for the argument when a new one is created. */ - function options(&$options) { - parent::options($options); - } + function option_definition() { + $options = parent::option_definition(); + return $options; + } /** * Provide a default options form for the argument. + * + * @codingStandardsIgnoreStart */ - function options_form(&$form, &$form_state) { + public function options_form(&$form, &$form_state) { + // @codingStandardsIgnoreEnd $defaults = $this->default_actions(); $form['title'] = array( @@ -52,7 +58,7 @@ class link_views_handler_argument_target extends views_handler_argument { $form['wildcard'] = array( '#prefix' => '<div class="views-right-50">', - // prefix and no suffix means these two items will be grouped together. + // Prefix and no suffix means these two items will be grouped together. '#type' => 'textfield', '#title' => t('Wildcard'), '#size' => 20, @@ -125,8 +131,8 @@ class link_views_handler_argument_target extends views_handler_argument { asort($validate_types); $form['validate_type']['#options'] = $validate_types; - // Show this gadget if *anything* but 'none' is selected + // Show this gadget if *anything* but 'none' is selected. $form['validate_fail'] = array( '#type' => 'select', '#title' => t('Action to take if argument does not validate'), @@ -140,10 +146,11 @@ class link_views_handler_argument_target extends views_handler_argument { * * The argument sent may be found at $this->argument. */ - function query($group_by = FALSE) { + public function query($group_by = FALSE) { $this->ensure_my_table(); // Because attributes are stored serialized, our only option is to also // serialize the data we're searching for and use LIKE to find similar data. $this->query->add_where(0, $this->table_alias . ' . ' . $this->real_field . " LIKE '%%%s%'", serialize(array('target' => $this->argument))); } + } diff --git a/profiles/wcm_base/modules/contrib/link/views/link_views_handler_filter_protocol.inc b/profiles/wcm_base/modules/contrib/link/views/link_views_handler_filter_protocol.inc index a020b4e0e125a3afb8f5624a29616965b5368d5d..ae00c17e90ce793350eb3cbbe01611730585bf77 100644 --- a/profiles/wcm_base/modules/contrib/link/views/link_views_handler_filter_protocol.inc +++ b/profiles/wcm_base/modules/contrib/link/views/link_views_handler_filter_protocol.inc @@ -7,22 +7,30 @@ /** * Filter handler for limiting a view to URLs of a certain protocol. + * + * @codingStandardsIgnoreStart */ class link_views_handler_filter_protocol extends views_handler_filter_string { + /** * Set defaults for the filter options. + * + * @codingStandardsIgnoreEnd */ - function options(&$options) { - parent::options($options); + function option_definition() { + $options = parent::option_definition(); + $options['operator'] = 'OR'; $options['value'] = 'http'; $options['case'] = 0; + + return $options; } /** * Define the operators supported for protocols. */ - function operators() { + public function operators() { $operators = array( 'OR' => array( 'title' => t('Is one of'), @@ -35,7 +43,13 @@ class link_views_handler_filter_protocol extends views_handler_filter_string { return $operators; } - function options_form(&$form, &$form_state) { + /** + * Options form. + * + * @codingStandardsIgnoreStart + */ + public function options_form(&$form, &$form_state) { + //@codingStandardsIgnoreEnd parent::options_form($form, $form_state); $form['case'] = array( '#type' => 'value', @@ -45,8 +59,11 @@ class link_views_handler_filter_protocol extends views_handler_filter_string { /** * Provide a select list to choose the desired protocols. + * + * @codingStandardsIgnoreStart */ - function value_form(&$form, &$form_state) { + public function value_form(&$form, &$form_state) { + // @codingStandardsIgnoreEnd // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only @@ -61,7 +78,19 @@ class link_views_handler_filter_protocol extends views_handler_filter_string { '#type' => 'select', '#title' => t('Protocol'), '#default_value' => $this->value, - '#options' => drupal_map_assoc(variable_get('filter_allowed_protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal'))), + '#options' => drupal_map_assoc(variable_get('filter_allowed_protocols', array( + 'http', + 'https', + 'ftp', + 'news', + 'nntp', + 'telnet', + 'mailto', + 'irc', + 'ssh', + 'sftp', + 'webcal', + ))), '#multiple' => 1, '#size' => 4, '#description' => t('The protocols displayed here are those globally available. You may add more protocols by modifying the <em>filter_allowed_protocols</em> variable in your installation.'), @@ -71,8 +100,11 @@ class link_views_handler_filter_protocol extends views_handler_filter_string { /** * Filter down the query to include only the selected protocols. + * + * @codingStandardsIgnoreStart */ - function op_protocol($field, $upper) { + public function op_protocol($field, $upper) { + // @codingStandardsIgnoreEnd $db_type = db_driver(); $protocols = $this->value; @@ -82,20 +114,25 @@ class link_views_handler_filter_protocol extends views_handler_filter_string { // Simple case, the URL begins with the specified protocol. $condition = $field . ' LIKE \'' . $protocol . '%\''; - // More complex case, no protocol specified but is automatically cleaned up - // by link_cleanup_url(). RegEx is required for this search operation. + // More complex case, no protocol specified but is automatically cleaned + // up by link_cleanup_url(). RegEx is required for this search operation. if ($protocol == 'http') { - $LINK_DOMAINS = _link_domains(); + $link_domains = _link_domains(); if ($db_type == 'pgsql') { - // PostGreSQL code has NOT been tested. Please report any problems to the link issue queue. - // pgSQL requires all slashes to be double escaped in regular expressions. + // PostGreSQL code has NOT been tested. Please report any problems to + // the link issue queue. + // pgSQL requires all slashes to be double escaped in regular + // expressions. + // @codingStandardsIgnoreLine // See http://www.postgresql.org/docs/8.1/static/functions-matching.html#FUNCTIONS-POSIX-REGEXP - $condition .= ' OR ' . $field . ' ~* \'' . '^(([a-z0-9]([a-z0-9\\-_]*\\.)+)(' . $LINK_DOMAINS . '|[a-z][a-z]))' . '\''; + $condition .= ' OR ' . $field . ' ~* \'' . '^(([a-z0-9]([a-z0-9\\-_]*\\.)+)(' . $link_domains . '|[a-z][a-z]))' . '\''; } else { - // mySQL requires backslashes to be double (triple?) escaped within character classes. + // mySQL requires backslashes to be double (triple?) escaped within + // character classes. + // @codingStandardsIgnoreLine // See http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html#operator_regexp - $condition .= ' OR ' . $field . ' REGEXP \'' . '^(([a-z0-9]([a-z0-9\\\-_]*\.)+)(' . $LINK_DOMAINS . '|[a-z][a-z]))' . '\''; + $condition .= ' OR ' . $field . ' REGEXP \'' . '^(([a-z0-9]([a-z0-9\\\-_]*\.)+)(' . $link_domains . '|[a-z][a-z]))' . '\''; } } @@ -104,4 +141,5 @@ class link_views_handler_filter_protocol extends views_handler_filter_string { $this->query->add_where($this->options['group'], implode(' ' . $this->operator . ' ', $where_conditions)); } + } diff --git a/profiles/wcm_base/modules/contrib/tablefield/PATCHES.txt b/profiles/wcm_base/modules/contrib/tablefield/PATCHES.txt deleted file mode 100644 index 2f8bbc7ae4efd22063c69ed7afe266782c8b80a1..0000000000000000000000000000000000000000 --- a/profiles/wcm_base/modules/contrib/tablefield/PATCHES.txt +++ /dev/null @@ -1,4 +0,0 @@ -The following patches have been applied to this project: -- https://www.drupal.org/files/issues/tablefield-7.x-3.1-duplicate-ids-2923462-14.patch - -This file was automatically generated by Drush Make (http://drupal.org/project/drush). diff --git a/profiles/wcm_base/modules/contrib/tablefield/README.txt b/profiles/wcm_base/modules/contrib/tablefield/README.txt index d9fcb2a090bd586b5bc12bf16cf29f1ecbded7a0..7c1fd7a08d4e11a19d9d94153e68b062362245da 100644 --- a/profiles/wcm_base/modules/contrib/tablefield/README.txt +++ b/profiles/wcm_base/modules/contrib/tablefield/README.txt @@ -86,11 +86,11 @@ stated otherwise. This format is intended to provide table data as a service: -- directly by enabling the submodule TableField Themeless. It provides - themeless output of a node's tablefield on the path 'node/%/themeless' (HTML, - JSON or XML). +- directly by enabling the Themeless module + (https://www.drupal.org/project/themeless). It provides themeless output of a + node's tablefield on the path 'node/%/themeless' (HTML, JSON or XML). - using a View (e.g. with https://www.drupal.org/project/views_datasource) that - outputs JSON or XML. The Views field settings includes 'Formatter'. + outputs JSON or XML. The Views field settings includes 'Formatter' - using a custom service (e.g. with https://www.drupal.org/project/services). @@ -125,24 +125,19 @@ service. ### Themeless output ### -Enabling the submodule TableField Themeless provides themeless output of a -node's tablefield on the path 'node/%/themeless' (HTML, JSON or XML). This is -useful to embed the table's HTML elsewhere (as an iFrame) or to provide the -table data as a service (JSON or XML) directly without the need of Views or a -Service. +Themeless module https://www.drupal.org/project/themeless provides themeless +output of a node's tablefield on the path 'node/%/themeless' (HTML, JSON or +XML). This is useful to embed the table's HTML elsewhere (as an iFrame) or to +provide the table data as a service (JSON or XML) directly without the need of +Views or a Service. -- Enable the submodule TableField Themeless. +- Enable the module Themeless. - Go to ../admin/structure/types/manage/[your-content-type]/display. - Uncollapse the CUSTOM DISPLAY SETTINGS and select 'Themeless'. - Save. - Now a new display mode appears besides Default and Teaser. Go and configure. - Save. -Install and enable https://www.drupal.org/project/subpathauto to have the -themeless output available under the alias path like 'some/alias/themeless' -besides 'node/%/themeless'. - - ## CREDITS ## - Original author: Kevin Hankens (http://www.kevinhankens.com) diff --git a/profiles/wcm_base/modules/contrib/tablefield/tablefield.info b/profiles/wcm_base/modules/contrib/tablefield/tablefield.info index 42bc3df664cbaedfbf2100993988151e5f96acc0..f6d33a4187dd8ec03d751714a2efe9814acb4998 100644 --- a/profiles/wcm_base/modules/contrib/tablefield/tablefield.info +++ b/profiles/wcm_base/modules/contrib/tablefield/tablefield.info @@ -7,9 +7,8 @@ package = Fields dependencies[] = field configure = admin/config/content/tablefield -; Information added by Drupal.org packaging script on 2017-06-13 -version = "7.x-3.1" +; Information added by Drupal.org packaging script on 2018-12-08 +version = "7.x-3.2" core = "7.x" project = "tablefield" -datestamp = "1497359647" - +datestamp = "1544293992" diff --git a/profiles/wcm_base/modules/contrib/tablefield/tablefield.install b/profiles/wcm_base/modules/contrib/tablefield/tablefield.install index 4eb31864d4f400de7ef9b4ce85d5d75755311a2f..81de25839fa4771628a20acf116800a95efcfb3f 100644 --- a/profiles/wcm_base/modules/contrib/tablefield/tablefield.install +++ b/profiles/wcm_base/modules/contrib/tablefield/tablefield.install @@ -401,3 +401,16 @@ function tablefield_update_7006() { field_cache_clear(); drupal_set_message(t('All Table Field fields have their field settings converted to widget settings.'), 'warning'); } + +/** + * New Themeless module will subtitute submodule. + */ +function tablefield_update_7007() { + $themeless = l(t('Themeless'), 'https://www.drupal.org/project/themeless', array( + 'attributes' => array( + 'title' => t('Themeless module'), + 'target' => '_blank', + ), + )); + drupal_set_message(t('Module !themeless will substitute tablefield_themeless submodule. If you are using tablefield_themeless submodule then disable it and use !themeless', array('!themeless' => $themeless)), 'status'); +} diff --git a/profiles/wcm_base/modules/contrib/tablefield/tablefield.module b/profiles/wcm_base/modules/contrib/tablefield/tablefield.module index 8ae7491c864bd3d367eba85d5058fe66253d4f36..75c42d7bdb0583a8fedbcdddea6e766e15903128 100644 --- a/profiles/wcm_base/modules/contrib/tablefield/tablefield.module +++ b/profiles/wcm_base/modules/contrib/tablefield/tablefield.module @@ -183,17 +183,57 @@ function tablefield_item_property_info() { 'getter callback' => 'tablefield_get_table_value', ); + $properties['value'] = array( + 'type' => 'text', + 'label' => t('The value column of the table.'), + 'computed' => TRUE, + 'getter callback' => 'tablefield_value_array_get', + // @todo: can we support setting via an array submitted from REST? + // 'setter callback' => 'tablefield_value_array_set', + ); + return $properties; } +/** + * + */ +function tablefield_tablefield_to_array($trat) { + // Translate tablefield to associative array. + $ttrans = array(); + $rowkey = 0; + foreach ($trat as $rowix => $rowvals) { + foreach ($rowvals as $ix => $val) { + $ttrans[$rowkey][] = $val; + } + $rowkey++; + } + return $ttrans; +} + +/** + * Get the value property in formatted array. + */ +function tablefield_value_array_get($data, array $options, $name, $type, $info) { + + if (isset($data['tabledata']['tabledata'])) { + $data['value'] = tablefield_tablefield_to_array($data['tabledata']['tabledata']); + } + elseif (isset($data['tablefield']['tabledata'])) { + $data['value'] = tablefield_tablefield_to_array($data['tablefield']['tabledata']); + } + return $data['value']; +} + /** * Get the property just as it is set in the data. Search API indexing addition. */ function tablefield_get_table_value($data, array $options, $name, $type, $info) { - if (isset($data['tabledata'])) { + + if (isset($data['tabledata']['tabledata'])) { $data['value'] = ''; - foreach ($data['tabledata'] as $rows) { + foreach ($data['tabledata']['tabledata'] as $rows) { $data['value'] .= implode(" ", $rows) . " "; } } @@ -601,7 +641,7 @@ function tablefield_field_formatter_settings_summary($field, $instance, $view_mo 'title' => t('Manage user permissions'), ), )); - $summary[] = t('Show link to export table data as CSV depending on !permission: %tr', array('%tr' => ($settings['hide_cols_skip_head']) ? t('Yes') : t('No'), '!permission' => $permission)); + $summary[] = t('Show link to export table data as CSV depending on !permission: %tr', array('%tr' => ($settings['export_csv']) ? t('Yes') : t('No'), '!permission' => $permission)); } return implode('<br />', $summary);; } @@ -756,6 +796,7 @@ function tablefield_field_formatter_settings_form($field, $instance, $view_mode, ); $element['hide_cols_skip_head'] = array( '#title' => t('Hide empty columns ignoring column header'), + '#description' => t('This will remove the table field completely if all columns are empty including the field label.'), '#type' => 'checkbox', '#default_value' => $settings['hide_cols_skip_head'], ); @@ -779,11 +820,6 @@ function tablefield_field_formatter_settings_form($field, $instance, $view_mode, '#type' => 'checkbox', '#default_value' => $settings['hide_empty_cols'], ); - $element['hide_cols_skip_head'] = array( - '#title' => t('Hide empty columns ignoring column header'), - '#type' => 'checkbox', - '#default_value' => $settings['hide_cols_skip_head'], - ); $permission = l(t('permission'), 'admin/people/permissions', array( 'fragment' => 'module-tablefield', 'attributes' => array( @@ -1121,30 +1157,35 @@ function tablefield_field_formatter_view($entity_type, $entity, $field, $instanc } } - $header = $noheader ? NULL : $header_data; + $header = $noheader ? [] : $header_data; $entity_info = entity_get_info($entity_type); $entity_id = !empty($entity_info['entity keys']['id']) ? $entity->{$entity_info['entity keys']['id']} : NULL; // Remove the first row from the tabledata. - array_shift($tabledata); - // Theme the table for display. - $element[$delta] = array( - '#theme' => 'tablefield_view', - '#caption' => $caption, - '#header_orientation' => isset($settings['header_orientation']) ? $settings['header_orientation'] : 'Horizontal', - '#sticky' => isset($settings['sticky_header']) ? $settings['sticky_header'] : NULL, - '#striping' => isset($settings['striping']) ? $settings['striping'] : NULL, - '#sortable' => isset($settings['sortable']) ? $settings['sortable'] : NULL, - '#header' => $header, - '#rows' => $tabledata, - '#delta' => $delta, - '#export' => isset($settings['export_csv']) ? $settings['export_csv'] : NULL, - '#entity_type' => $entity_type, - '#entity_id' => $entity_id, - '#field_name' => $field['field_name'], - '#langcode' => $langcode, - '#formatter' => $formatter, - ); + if ((empty($settings['hide_header']) && $header_data) || $settings['hide_header']) { + array_shift($tabledata); + } + // Theme the table for display, but only if we have printable + // table data. + if (!$settings['hide_cols_skip_head'] || $tabledata || $header) { + $element[$delta] = array( + '#theme' => 'tablefield_view', + '#caption' => $caption, + '#header_orientation' => isset($settings['header_orientation']) ? $settings['header_orientation'] : 'Horizontal', + '#sticky' => isset($settings['sticky_header']) ? $settings['sticky_header'] : NULL, + '#striping' => isset($settings['striping']) ? $settings['striping'] : NULL, + '#sortable' => isset($settings['sortable']) ? $settings['sortable'] : NULL, + '#header' => $header, + '#rows' => $tabledata, + '#delta' => $delta, + '#export' => isset($settings['export_csv']) ? $settings['export_csv'] : NULL, + '#entity_type' => $entity_type, + '#entity_id' => $entity_id, + '#field_name' => $field['field_name'], + '#langcode' => $langcode, + '#formatter' => $formatter, + ); + } } } } @@ -1438,13 +1479,22 @@ function tablefield_field_widget_form(&$form, &$form_state, $field, $instance, $ '#type' => 'textfield', '#title' => t('Table description'), '#default_value' => '', - '#description' => t('This brief caption will be associated with the table and will help Assitive Technology, like screen readers, better describe the content within.'), + '#description' => t('This brief caption will be associated with the table and will help Assistive Technology, like screen readers, better describe the content within.'), ); - if (isset($items[$delta]['value'])) { + + // Could be the Paragraphs module. + if (isset($items[$delta]['tablefield'])) { + $raw = $items[$delta]['tablefield']; + } + elseif (isset($items[$delta]['value'])) { $raw = unserialize($items[$delta]['value']); - if (isset($raw['caption'])) { - $element['tablefield']['caption']['#default_value'] = check_plain($raw['caption']); - } + } + // If still nothing then get the instance default, but only for delta 0. + elseif ($delta === 0 && isset($instance['default_value'][0]['tablefield'])) { + $raw = $instance['default_value'][0]['tablefield']; + } + if (isset($raw['caption'])) { + $element['tablefield']['caption']['#default_value'] = check_plain($raw['caption']); } // If the user doesn't have rebuild perms, we pass along the data as a value. @@ -1613,6 +1663,17 @@ function tablefield_field_widget_form(&$form, &$form_state, $field, $instance, $ return $element; } +/** + * Implements hook_custom_theme(). + */ +function tablefield_custom_theme() { + // Ensure that if this is a valid POST request that we use the same theme + // used by the referring form. + if (isset($_POST['form_build_id']) && path_is_admin($_GET['q'])) { + return variable_get('admin_theme'); + } +} + /** * Custom callback for a textarea to be processed for linebreaks. */ @@ -1857,9 +1918,10 @@ function tablefield_theme() { function theme_tablefield_view($variables) { $id = $variables['entity_type'] . '-' . $variables['entity_id'] . '-' . $variables['field_name'] . '-' . $variables['delta']; $sortable = $variables['sortable'] ? 'tablesorter' : NULL; + $cols_class = isset($variables['header']) ? 'tablefield-columns-' . count($variables['header']) : NULL; $attributes = array( 'id' => 'tablefield-' . $id, - 'class' => array('tablefield', $sortable), + 'class' => array('tablefield', $sortable, $cols_class), ); // Apply scope property to headers for accessibility. @@ -1985,7 +2047,7 @@ function tablefield_trim($tabledata, $ignore_head = FALSE) { * Whether ignoring header or not. */ function tablefield_rtrim_cols($tabledata, $ignore_head = FALSE) { - $row_num = count($tabledata); + $row_num = !empty($tabledata) ? count($tabledata) : 0; if (!$row_num) { return $tabledata; @@ -2064,7 +2126,7 @@ function tablefield_hide_rows($tabledata, $ignore_head = FALSE) { * Whether ignoring header or not. */ function tablefield_hide_cols($tabledata, $ignore_head = FALSE) { - $row_num = count($tabledata); + $row_num = !empty($tabledata) ? count($tabledata) : 0; if (!$row_num) { return $tabledata; @@ -2100,21 +2162,19 @@ function tablefield_multiple_field_remove_button_field_widgets_alter(&$fieldwidg * Avoid empty tables on multivalue fields with default header values. */ function tablefield_form_alter(&$form, &$form_state, $form_id) { - $instances = field_info_instances(); - $field_names = array(); - foreach ($instances as $entity_type => $entities) { - foreach ($entities as $bundle => $fields) { - foreach ($fields as $field_name => $instance) { - if ($instance['widget']['type'] === 'tablefield') { - $field_info = field_info_field($field_name); - if (empty($field_info['field_name'])) { - return; - } - if (isset($form[$field_info['field_name']]) && $field_info['cardinality'] != 1) { - $field_language = $form[$field_info['field_name']]['#language']; - $max_delta = $form[$field_info['field_name']][$field_language]['#max_delta']; - unset($form[$field_name][$field_language][$max_delta]); - } + if (empty($form_state['field'])) { + return; + } + + foreach (element_children($form_state['field']) as $field_name) { + foreach ($form_state['field'][$field_name] as $lang => $value) { + if (isset($value['instance']) && $value['instance']['widget']['type'] === 'tablefield' && $value['field']['cardinality'] != 1) { + $key_exists = FALSE; + $max_delta = $form[$field_name][$lang]['#max_delta']; + $parents = array_merge($value['array_parents'], array($field_name, $lang)); + $element = &drupal_array_get_nested_value($form, $parents, $key_exists); + if ($key_exists && isset($element[$max_delta])) { + unset($element[$max_delta]); } } } @@ -2227,7 +2287,7 @@ function theme_tablefield($variables) { $header = array(); } // Add sticky headers, if applicable. - if (count($header) && $sticky) { + if (!empty($header) && $sticky) { drupal_add_js('misc/tableheader.js'); // Add 'sticky-enabled' class to the table to identify it for JS. // This is needed to target tables constructed by this function. @@ -2241,7 +2301,7 @@ function theme_tablefield($variables) { } // Format the table columns: - if (count($colgroups)) { + if (!empty($colgroups)) { foreach ($colgroups as $number => $colgroup) { $attributes = array(); @@ -2261,7 +2321,7 @@ function theme_tablefield($variables) { } // Build colgroup. - if (is_array($cols) && count($cols)) { + if (is_array($cols) && !empty($cols)) { $output .= ' <colgroup' . drupal_attributes($attributes) . '>'; $i = 0; foreach ($cols as $col) { @@ -2276,7 +2336,7 @@ function theme_tablefield($variables) { } // Add the 'empty' row message if available. - if (!count($rows) && $empty) { + if (empty($rows) && $empty) { $header_count = 0; foreach ($header as $header_cell) { if (is_array($header_cell)) { @@ -2296,25 +2356,25 @@ function theme_tablefield($variables) { } // Format the table header: - if (count($header)) { + if (!empty($header)) { $ts = tablesort_init($header); // HTML requires that the thead tag has tr tags in it followed by tbody // tags. Using ternary operator to check and see if we have any rows. - $output .= (count($rows) ? ' <thead' . $tooltip . '><tr>' : ' <tr>'); + $output .= !empty($rows) ? ' <thead' . $tooltip . '><tr>' : ' <tr>'; foreach ($header as $cell) { $cell = tablesort_header($cell, $header, $ts); $output .= _theme_table_cell($cell, TRUE); } // Using ternary operator to close the tags based on whether or not there // are rows. - $output .= (count($rows) ? " </tr></thead>\n" : "</tr>\n"); + $output .= !empty($rows) ? " </tr></thead>\n" : "</tr>\n"; } else { $ts = array(); } // Format the table rows: - if (count($rows)) { + if (!empty($rows)) { $output .= "<tbody>\n"; $flip = array('even' => 'odd', 'odd' => 'even'); $class = 'even'; @@ -2333,7 +2393,7 @@ function theme_tablefield($variables) { $cells = $row; $attributes = array(); } - if (count($cells)) { + if (!empty($cells)) { // Add odd/even class. if (!$no_striping) { $class = $flip[$class]; diff --git a/profiles/wcm_base/modules/contrib/tablefield/themeless/README.txt b/profiles/wcm_base/modules/contrib/tablefield/themeless/README.txt deleted file mode 100644 index 4cd777056c9e88342a4521365d9e18a1ba9c9c4f..0000000000000000000000000000000000000000 --- a/profiles/wcm_base/modules/contrib/tablefield/themeless/README.txt +++ /dev/null @@ -1,26 +0,0 @@ -# TableField Themeless # - -Provides themeless output of a node's tablefield on the path 'node/%/themeless'. - - -## INSTALLATION ## - -- Enable the submodule at ../admin/modules. - - -## GET STARTED ## - -- Go to ../admin/structure/types/manage/[your-content-type]/display/themeless - and make sure it includes a TableField field. -- Choose the desired format and format settings. -- Update. -- Save. -- Visit a content page at ../node/%nid/themeless . - - -## TO KEEP IN MIND ## - -- Only the first found TableField field will be included in the output (also - multivalue). -- Enable https://www.drupal.org/project/subpathauto to have URLs with aliases - accessible for the themeless output, e.g. ../my/custom/alias/themeless. diff --git a/profiles/wcm_base/modules/contrib/tablefield/themeless/tablefield_themeless.info b/profiles/wcm_base/modules/contrib/tablefield/themeless/tablefield_themeless.info deleted file mode 100644 index 39d3661fb72f93392783ffbafb8b510b3bdcda42..0000000000000000000000000000000000000000 --- a/profiles/wcm_base/modules/contrib/tablefield/themeless/tablefield_themeless.info +++ /dev/null @@ -1,12 +0,0 @@ -name = TableField Themeless -description = Provides themeless output of a node's tablefield on the path 'node/%/themeless'. -core = 7.x -package = Fields -dependencies[] = tablefield - -; Information added by Drupal.org packaging script on 2017-06-13 -version = "7.x-3.1" -core = "7.x" -project = "tablefield" -datestamp = "1497359647" - diff --git a/profiles/wcm_base/modules/contrib/tablefield/themeless/tablefield_themeless.module b/profiles/wcm_base/modules/contrib/tablefield/themeless/tablefield_themeless.module deleted file mode 100644 index 885dbd0f556f697628a24122efa3dcf636fdbe5e..0000000000000000000000000000000000000000 --- a/profiles/wcm_base/modules/contrib/tablefield/themeless/tablefield_themeless.module +++ /dev/null @@ -1,108 +0,0 @@ -<?php - -/** - * @file - * Themeless output of a node's tablefield on the path 'node/%/themeless'. - */ - -/** - * Implements hook_menu(). - */ -function tablefield_themeless_menu() { - $items = array(); - $items['node/%node/themeless'] = array( - 'title' => 'Themeless TableField', - 'page callback' => 'tablefield_themeless_view', - 'page arguments' => array(1), - 'access arguments' => array('access content'), - ); - - return $items; -} - -/** - * Implements hook_menu_local_tasks_alter(). - */ -function tablefield_themeless_menu_local_tasks_alter(&$data, $router_item, $root_path) { - $node = is_numeric(arg(1)) ? node_load(arg(1)) : NULL; - // Get all fields of entity type. - $fields = $node ? field_info_instances('node', $node->type) : array(); - // Get all table fields. - $tablefield = array(); - foreach ($fields as $key => $value) { - if ($value['widget']['type'] === 'tablefield') { - $tablefield[] = $key; - } - } - // Add a 'Themeless TableField' tab only if the content type has a TableField. - if ($node && $root_path == 'node/%' && isset($tablefield[0]) && !empty($tablefield[0])) { - $data['tabs'][0]['output'][] = array( - '#theme' => 'menu_local_task', - '#link' => array( - 'title' => t('Themeless TableField'), - 'href' => 'node/' . arg(1) . '/themeless', - 'localized_options' => array(), - ), - ); - } -} - -/** - * Get a node by a menucallback and return the first table field as JSON. - * - * @param object $node - * Fully loaded node object. - */ -function tablefield_themeless_view($node) { - // Get all fields of entity type. - $fields = field_info_instances('node', $node->type); - // Get all table fields. - $tablefield = array(); - foreach ($fields as $key => $value) { - if ($value['widget']['type'] === 'tablefield') { - $tablefield[] = $key; - } - } - // Populate $node->content with a render() array. - node_build_content($node, 'themeless'); - - $build = $node->content; - - // Get the field instance of the first found table field. - $instance = isset($tablefield[0]) ? field_info_instance('node', $tablefield[0], $node->type) : NULL; - $settings = isset($instance) ? field_get_display($instance, 'themeless', 'node') : NULL; - // XML. - if (isset($settings['settings']['xml']) && isset($build[$tablefield[0]][0]['#markup']) && $settings['settings']['xml']) { - // We are returning XML, so tell the browser. - drupal_add_http_header('Content-Type', 'application/xml'); - // Render the content of the first found table field. - print $build[$tablefield[0]][0]['#markup']; - } - // JSON. - elseif (isset($build[$tablefield[0]][0]['#markup'])) { - // We are returning JSON, so tell the browser. - drupal_add_http_header('Content-Type', 'application/json'); - // Render the content of the first found table field. - print $build[$tablefield[0]][0]['#markup']; - } - // HTML. - elseif ($tablefield[0] && $settings['type'] !== 'format_themeless') { - $output = field_view_field('node', $node, $tablefield[0], $settings); - print drupal_render($output); - } - else { - $nodata['code'] = $instance ? 204 : 404; - $nodata['message'] = $instance ? t('No Content: the tablefield is empty') : t('Not Found: no tablefield found'); - print drupal_json_output($nodata); - } -} - -/** - * Implements hook_entity_info_alter(). - */ -function tablefield_entity_info_alter(&$entity_info) { - $entity_info['node']['view modes']['themeless'] = array( - 'label' => t('Themeless'), - 'custom settings' => FALSE, - ); -} diff --git a/profiles/wcm_base/modules/contrib/webform/PATCHES.txt b/profiles/wcm_base/modules/contrib/webform/PATCHES.txt deleted file mode 100644 index 6b8809f0f04567dc69f4a30aea87374ee77de086..0000000000000000000000000000000000000000 --- a/profiles/wcm_base/modules/contrib/webform/PATCHES.txt +++ /dev/null @@ -1,4 +0,0 @@ -The following patches have been applied to this project: -- http://drupal.org/files/issues/2018-05-09/webform-component_fieldsets-1147994-37-D7.patch - -This file was automatically generated by Drush Make (http://drupal.org/project/drush). diff --git a/profiles/wcm_base/modules/contrib/webform/THEMING.txt b/profiles/wcm_base/modules/contrib/webform/THEMING.txt index 90ea883299bb5bb459ceb19ee5327339273d2ee5..bf771a03cf9377283f80c366ee4e1fad8a3de21d 100644 --- a/profiles/wcm_base/modules/contrib/webform/THEMING.txt +++ b/profiles/wcm_base/modules/contrib/webform/THEMING.txt @@ -1,9 +1,9 @@ Overview -------- -Webform supports theming similar to the CCK or Views modules. Any webform -may be themed on the server side, though doing so may require a reasonable -amount of knowledge about the Drupal Form API. More information about the Form -API may be found at http://api.drupal.org/api/file/developer/topics/forms_api.html +Webform supports theming similar to the CCK or Views modules. Any webform may be +themed on the server side, though doing so may require a reasonable amount of +knowledge about the Drupal Form API. More information about the Form API may be +found at: http://api.drupal.org/api/file/developer/topics/forms_api.html Theme submission e-mails ----------------------- diff --git a/profiles/wcm_base/modules/contrib/webform/components/date.inc b/profiles/wcm_base/modules/contrib/webform/components/date.inc index cf7150acd437a604e6e448da61364b050386fb09..23a9648e51ec8443a19bc982cddc31423b11298e 100644 --- a/profiles/wcm_base/modules/contrib/webform/components/date.inc +++ b/profiles/wcm_base/modules/contrib/webform/components/date.inc @@ -409,7 +409,8 @@ function theme_webform_date($variables) { function webform_validate_date($element, $form_state) { $field_types = array('day', 'month', 'year'); - // Determine if the user has specified a date. Hidden parts of the date will be submitted automatically. + // Determine if the user has specified a date. Hidden parts of the date will + // be submitted automatically. foreach ($field_types as $field_type) { if (!in_array($field_type, $element['#exclude']) && $element[$field_type]['#value'] !== '') { $field_found = TRUE; diff --git a/profiles/wcm_base/modules/contrib/webform/components/email.inc b/profiles/wcm_base/modules/contrib/webform/components/email.inc index c2df0fa8f2c9d816b687662e589d40048ff10028..bbabf6966867de42c39413ee24c1af43a3fe346e 100644 --- a/profiles/wcm_base/modules/contrib/webform/components/email.inc +++ b/profiles/wcm_base/modules/contrib/webform/components/email.inc @@ -245,9 +245,9 @@ function theme_webform_email($variables) { * Validates the entered values from email components on the client-side form. * Calls a form_set_error if the e-mail is not valid. * - * @param $form_element + * @param array $form_element * The e-mail form element. - * @param $form_state + * @param array $form_state * The full form state for the webform. */ function _webform_validate_email($form_element, &$form_state) { diff --git a/profiles/wcm_base/modules/contrib/webform/components/file.inc b/profiles/wcm_base/modules/contrib/webform/components/file.inc index 69942199d98478ffc46f7f486787ff51fc237eab..b8233e50714d0d5a116e8914ca3edd3a8eac2a9a 100644 --- a/profiles/wcm_base/modules/contrib/webform/components/file.inc +++ b/profiles/wcm_base/modules/contrib/webform/components/file.inc @@ -191,20 +191,6 @@ function _webform_edit_file($component) { '#parents' => array('extra', 'progress_indicator'), ); - // @todo: Make managed_file respect the "size" parameter. - /* - $form['display']['width'] = array( - '#type' => 'textfield', - '#title' => t('Width'), - '#default_value' => $component['extra']['width'], - '#description' => t('Width of the file field.') . ' ' . t('Leaving blank will use the default size.'), - '#size' => 5, - '#maxlength' => 10, - '#weight' => 4, - '#parents' => array('extra', 'width') - ); - */ - return $form; } @@ -391,7 +377,7 @@ function _webform_render_file($component, $value = NULL, $filter = TRUE, $submis * wrapper around the element with the element's id, thereby creating 2 elements * with the same id. * - * @param $variables + * @param array $variables * An associative array containing: * - element: A render element representing the file. * @@ -429,8 +415,9 @@ function _webform_submit_file($component, $value) { $fid = is_array($value) ? (!empty($value['fid']) ? $value['fid'] : '') : (!empty($value) ? $value : ''); - // Extend access to this file, even if the submission has not been saved yet. This may happen when - // previewing a private file which was selected but not explicitly uploaded, and then previewed. + // Extend access to this file, even if the submission has not been saved yet. + // This may happen when previewing a private file which was selected but not + // explicitly uploaded, and then previewed. if ($fid) { $_SESSION['webform_files'][$fid] = $fid; } @@ -645,13 +632,13 @@ function webform_file_rename($node, $submission) { /** * Renames the uploaded file name using tokens. * - * @param $node + * @param object $node * The webform node object. - * @param $submission + * @param object $submission * The webform submission object. - * @param $component + * @param array $component * Component settings array for which fid is going to be processed. - * @param $fid + * @param int $fid * A file id to be processed. */ function webform_file_process_rename($node, $submission, $component, $fid) { diff --git a/profiles/wcm_base/modules/contrib/webform/components/hidden.inc b/profiles/wcm_base/modules/contrib/webform/components/hidden.inc index 6993d4f1da4f9a36c65567e07dfed955c62d4d89..ca6618e00daa45997e25ad75c514644b04cf38c9 100644 --- a/profiles/wcm_base/modules/contrib/webform/components/hidden.inc +++ b/profiles/wcm_base/modules/contrib/webform/components/hidden.inc @@ -158,7 +158,10 @@ function _webform_analysis_hidden($component, $sids = array(), $single = FALSE, $rows[0] = array(t('Empty'), ($submissions - $nonblanks)); $rows[1] = array(t('Non-empty'), $nonblanks); - $other[0] = array(t('Average submission length in words (ex blanks)'), ($nonblanks != 0 ? number_format($wordcount / $nonblanks, 2) : '0')); + $other[0] = array( + t('Average submission length in words (ex blanks)'), + $nonblanks != 0 ? number_format($wordcount / $nonblanks, 2) : '0', + ); return array( 'table_rows' => $rows, diff --git a/profiles/wcm_base/modules/contrib/webform/components/markup.inc b/profiles/wcm_base/modules/contrib/webform/components/markup.inc index dd9d3fb3393b7f0cebc7a36da42e3c19af7b1005..2460e714cb95dab680823ded49df410a90416ae4 100644 --- a/profiles/wcm_base/modules/contrib/webform/components/markup.inc +++ b/profiles/wcm_base/modules/contrib/webform/components/markup.inc @@ -132,7 +132,8 @@ function _webform_render_markup_after_build($form_element, &$form_state) { } $conditional_value = $sorter->componentMarkup($component['cid'], $component['page_num']); if (isset($conditional_value)) { - // Provide original value, should conditional logic no longer set the value. + // Provide original value, should conditional logic no longer set the + // value. $form_element['#wrapper_attributes']['data-webform-markup'] = $value; if (is_string($conditional_value)) { $value = check_markup($conditional_value, $component['extra']['format']); diff --git a/profiles/wcm_base/modules/contrib/webform/components/number.inc b/profiles/wcm_base/modules/contrib/webform/components/number.inc index 7fc039a91b5092c91a741ce1644997b66bc986fc..c2bf76e723d841f75d80ab7e7788a6fc6715808b 100644 --- a/profiles/wcm_base/modules/contrib/webform/components/number.inc +++ b/profiles/wcm_base/modules/contrib/webform/components/number.inc @@ -815,17 +815,18 @@ function _webform_number_format($component, $value) { * This function allows the thousands separator to be optional, but decimal * points must be in the right location. * + * A valid number is: + * 1. optional minus sign. + * 2. optional space. + * 3. the rest of the string can't be just a decimal or blank. + * 4. optional integer portion, with thousands separators. + * 5. optional decimal portion, starting is a decimal separator. + * Don't use preg_quote because a space is a valid thousands separator and + * needs quoting for the 'x' option to preg_match. + * * Based on http://stackoverflow.com/questions/5917082/regular-expression-to-match-numbers-with-or-without-commas-and-decimals-in-text. */ function webform_number_format_match($value, $point, $separator) { - // A valid number is: - // 1. optional minus sign. - // 2. optional space. - // 3. the rest of the string can't be just a decimal or blank. - // 4. optional integer portion, with thousands separators. - // 5. optional decimal portion, starting is a decimal separator. - // Don't use preg_quote because a space is a valid thousands separator and - // needs quoting for the 'x' option to preg_match. $thousands = $separator ? "\\$separator?" : ''; $decimal = "\\$point"; return preg_match("/ diff --git a/profiles/wcm_base/modules/contrib/webform/components/select.inc b/profiles/wcm_base/modules/contrib/webform/components/select.inc index ca875b4a047a7807fdd757842fcf496e73f98efd..2b1b7fff95d76b5207dd43d40b0ad89cbf584d9f 100644 --- a/profiles/wcm_base/modules/contrib/webform/components/select.inc +++ b/profiles/wcm_base/modules/contrib/webform/components/select.inc @@ -965,11 +965,11 @@ function _webform_select_options_info() { /** * Execute a select option callback. * - * @param $name + * @param string $name * The name of the options group. - * @param $component + * @param array $component * The full Webform component. - * @param $flat + * @param bool $flat * Whether the information returned should exclude any nested groups. */ function _webform_select_options_callback($name, $component, $flat = FALSE) { diff --git a/profiles/wcm_base/modules/contrib/webform/components/textarea.inc b/profiles/wcm_base/modules/contrib/webform/components/textarea.inc index d1d0b013eb41dab0e6080f6ebb5a2aca0a44c862..c4556b78c63af16945059b87b8e6357653035789 100644 --- a/profiles/wcm_base/modules/contrib/webform/components/textarea.inc +++ b/profiles/wcm_base/modules/contrib/webform/components/textarea.inc @@ -211,7 +211,10 @@ function _webform_analysis_textarea($component, $sids = array(), $single = FALSE $rows[0] = array(t('Left Blank'), ($submissions - $nonblanks)); $rows[1] = array(t('User entered value'), $nonblanks); - $other[] = array(t('Average submission length in words (ex blanks)'), ($nonblanks != 0 ? number_format($wordcount / $nonblanks, 2) : '0')); + $other[] = array( + t('Average submission length in words (ex blanks)'), + $nonblanks != 0 ? number_format($wordcount / $nonblanks, 2) : '0', + ); return array( 'table_rows' => $rows, diff --git a/profiles/wcm_base/modules/contrib/webform/components/textfield.inc b/profiles/wcm_base/modules/contrib/webform/components/textfield.inc index 3a1cca8eb0ddc0252cefd78258e9df346f9962dd..1bddc466ea018e833defe40125a8c8eec60882f6 100644 --- a/profiles/wcm_base/modules/contrib/webform/components/textfield.inc +++ b/profiles/wcm_base/modules/contrib/webform/components/textfield.inc @@ -158,7 +158,12 @@ function _webform_render_textfield($component, $value = NULL, $filter = TRUE, $s '#description' => $filter ? webform_filter_descriptions($component['extra']['description'], $node) : $component['extra']['description'], '#attributes' => $component['extra']['attributes'], '#theme_wrappers' => array('webform_element'), - '#translatable' => array('title', 'description', 'field_prefix', 'field_suffix'), + '#translatable' => array( + 'title', + 'description', + 'field_prefix', + 'field_suffix', + ), ); if ($component['required']) { @@ -263,7 +268,10 @@ function _webform_analysis_textfield($component, $sids = array(), $single = FALS $rows[0] = array(t('Left Blank'), ($submissions - $nonblanks)); $rows[1] = array(t('User entered value'), $nonblanks); - $other[] = array(t('Average submission length in words (ex blanks)'), ($nonblanks != 0 ? number_format($wordcount / $nonblanks, 2) : '0')); + $other[] = array( + t('Average submission length in words (ex blanks)'), + $nonblanks != 0 ? number_format($wordcount / $nonblanks, 2) : '0', + ); return array( 'table_rows' => $rows, diff --git a/profiles/wcm_base/modules/contrib/webform/components/time.inc b/profiles/wcm_base/modules/contrib/webform/components/time.inc index 07741683af5c3289ee00fd60f3a8239068b84113..aaedb7385d39e4f2d0abda056d58e7c20fadecda 100644 --- a/profiles/wcm_base/modules/contrib/webform/components/time.inc +++ b/profiles/wcm_base/modules/contrib/webform/components/time.inc @@ -130,7 +130,7 @@ function _webform_edit_time_validate($form, &$form_state) { foreach (array('start_time', 'end_time') as $field) { $time[$field] = FALSE; if (trim($form_state['values']['extra'][$field]) && ($time[$field] = strtotime('1-1-1970 UTC ' . $form_state['values']['extra'][$field])) === FALSE) { - form_set_error("extra][$field", t('The @field isn\'t a valid time.', array('@field' => $form['validation'][$field]['#title']))); + form_set_error("extra][$field", t("The @field isn't a valid time.", array('@field' => $form['validation'][$field]['#title']))); } } } @@ -188,7 +188,7 @@ function webform_expand_time($element) { else { $default_values = array( 'hour' => '', - 'minute' => '0', + 'minute' => '', 'second' => '', ); } diff --git a/profiles/wcm_base/modules/contrib/webform/css/webform.css b/profiles/wcm_base/modules/contrib/webform/css/webform.css index 6519506bfc4f36b36e9b936b4d1633da1a7bce1e..956209f0d9106fef016fe9ea12c22ac90fc1a72a 100644 --- a/profiles/wcm_base/modules/contrib/webform/css/webform.css +++ b/profiles/wcm_base/modules/contrib/webform/css/webform.css @@ -34,12 +34,6 @@ html.js input.webform-calendar { .webform-container-inline.webform-component-textarea .form-textarea-wrapper { display: inline-block; } -fieldset.fieldset-invisible { - margin: 0; - padding: 0; - border: none; - background-color: inherit; -} .webform-component-textarea .grippie { display: block; } diff --git a/profiles/wcm_base/modules/contrib/webform/includes/exporters/webform_exporter_excel_xlsx.inc b/profiles/wcm_base/modules/contrib/webform/includes/exporters/webform_exporter_excel_xlsx.inc index 221bfb8c0bd43146da24aa590fce132c3bd9eebb..4410040f607593972217a6277aa43a3e4e184cad 100644 --- a/profiles/wcm_base/modules/contrib/webform/includes/exporters/webform_exporter_excel_xlsx.inc +++ b/profiles/wcm_base/modules/contrib/webform/includes/exporters/webform_exporter_excel_xlsx.inc @@ -178,7 +178,8 @@ class webform_exporter_excel_xlsx extends webform_exporter { // Switch the results file name to the new zip (xlsx) file. unlink($file_uri); if (!@rename($zip_uri, $file_uri)) { - // The file could not be renamed, probably due to different stream wrappers during drush wfx execution. + // The file could not be renamed, probably due to different stream + // wrappers during drush wfx execution. copy($zip_uri, $file_uri); unlink($zip_uri); } diff --git a/profiles/wcm_base/modules/contrib/webform/includes/webform.admin.inc b/profiles/wcm_base/modules/contrib/webform/includes/webform.admin.inc index 799b379e0df3dde0931e3697323e0afbf1547442..aca45fa09c211ebfa9964792cc4860dea9a3f4ac 100644 --- a/profiles/wcm_base/modules/contrib/webform/includes/webform.admin.inc +++ b/profiles/wcm_base/modules/contrib/webform/includes/webform.admin.inc @@ -64,7 +64,7 @@ function webform_admin_settings() { '#type' => 'checkbox', '#title' => t('Use Reply-To header'), '#default_value' => webform_variable_get('webform_email_replyto'), - '#description' => t('Sends all e-mail from the domain of the default address above and sets the "Reply-To" header to the actual sender. Helps prevent e-mail from being flagged as spam.'), + '#description' => t('If the default from name and address are set above, send all e-mail from the default address set the "Reply-To" header to the actual sender. This helps prevent e-mail from being flagged as spam.'), ); $form['email']['webform_email_html_capable'] = array( @@ -255,13 +255,6 @@ function webform_admin_settings() { '#description' => t('When mapping emails addresses to a select component, limit the choice to components with less than the amount of options indicated. This is to avoid flooding the email settings form.'), ); - $form['advanced']['webform_fieldset_wrap'] = array( - '#type' => 'checkbox', - '#title' => t('Use fieldsets for grouped components'), - '#default_value' => webform_variable_get('webform_fieldset_wrap'), - '#description' => t('Components containing multiple fields, such as checkboxes and radio buttons, will be wrapped in fieldsets. This improves the accessibility of webforms and helps them conform to web standards, but may require updates to the CSS of the active theme.'), - ); - $form = system_settings_form($form); $form['#theme'] = 'webform_admin_settings'; array_unshift($form['#submit'], 'webform_admin_settings_submit'); @@ -319,7 +312,8 @@ function theme_webform_admin_settings($variables) { * Menu callback for admin/content/webform. Displays all webforms on the site. */ function webform_admin_content() { - // Determine whether views or hard-coded tables should be used for the webforms table. + // Determine whether views or hard-coded tables should be used for the + // webforms table. if (!webform_variable_get('webform_table')) { $view = views_get_view('webform_webforms'); return $view->preview('default'); diff --git a/profiles/wcm_base/modules/contrib/webform/includes/webform.components.inc b/profiles/wcm_base/modules/contrib/webform/includes/webform.components.inc index 3b2609c5d4ade395d629144826419334b51bbce7..1ded858f3c7bbde87a8fde5872cf879b2dab7499 100644 --- a/profiles/wcm_base/modules/contrib/webform/includes/webform.components.inc +++ b/profiles/wcm_base/modules/contrib/webform/includes/webform.components.inc @@ -463,7 +463,7 @@ function webform_component_edit_form($form, $form_state, $node, $component, $clo 'inline' => t('Inline'), 'none' => t('None'), ), - '#description' => t('Determines the placement of the component\'s label.'), + '#description' => t("Determines the placement of the component's label."), ); } else { @@ -855,7 +855,7 @@ function webform_component_update($component) { } /** - * + * Delete a Webform component. */ function webform_component_delete($node, $component) { // Check if a delete function is available for this component. If so, @@ -919,6 +919,9 @@ function webform_component_delete($node, $component) { // Delete the conditional if this component is the only source / target. if (empty($conditional[$field])) { webform_conditional_delete($node, $conditional); + // Also delete the conditional from the $node so it is not re-created + // later on in webform_node_update(). + unset($node->webform['conditionals'][$conditional['rgid']]); // Loop exit. break; } diff --git a/profiles/wcm_base/modules/contrib/webform/includes/webform.conditionals.inc b/profiles/wcm_base/modules/contrib/webform/includes/webform.conditionals.inc index 9d1b96be1ff377d7160f63aed5415422947c63fe..80c4051d8ba216e565184e96e080400f578d8d77 100644 --- a/profiles/wcm_base/modules/contrib/webform/includes/webform.conditionals.inc +++ b/profiles/wcm_base/modules/contrib/webform/includes/webform.conditionals.inc @@ -34,9 +34,9 @@ function webform_conditionals_form($form, &$form_state, $node) { // Drop PHP reference. unset($conditional); - // Check the current topological sort order for the conditionals and report any errors, - // but only for actual form submissions and not for ajax-related form builds, such as - // adding or removing a condition or conditional group. + // Check the current topological sort order for the conditionals and report + // any errors, but only for actual form submissions and not for ajax-related + // form builds, such as adding or removing a condition or conditional group. if (empty($form_state['triggering_element']['#ajax'])) { $node->webform['conditionals'] = $conditionals; webform_get_conditional_sorter($node)->reportErrors($conditionals); @@ -143,10 +143,11 @@ function webform_conditionals_form($form, &$form_state, $node) { '#submit' => array('webform_conditionals_form_submit'), ); - // Estimate if the form is too long for PHP max_input_vars and detect whether a previous submission was truncated. - // The estimate will be accurate because the form elements for this page are well known. Ajax use of this - // page will not generate user-visible errors, so a preflight may be the only indication to the user that - // the page is too long. + // Estimate if the form is too long for PHP max_input_vars and detect whether + // a previous submission was truncated. The estimate will be accurate because + // the form elements for this page are well known. Ajax use of this page will + // not generate user-visible errors, so a preflight may be the only indication + // to the user that the page is too long. webform_input_vars_check($form, $form_state, 'conditionals', ''); return $form; } @@ -221,7 +222,7 @@ function webform_conditionals_form_validate($form, &$form_state) { $component_type = $node->webform['components'][$action['target']['#value']]['type']; if (!webform_conditional_action_able($component_type, $action['action']['#value'])) { form_set_error('conditionals][' . $conditional_key . '][actions][' . $action_key . '][action', - t('A component of type %type can\'t be %action. (%target)', + t("A component of type %type can't be %action. (%target)", array( '%action' => $action['action']['#options'][$action['action']['#value']], '%type' => $component_options[$component_type], @@ -341,9 +342,11 @@ function theme_webform_conditional_group_row($variables) { * Form API #process function to expand a webform conditional element. */ function _webform_conditional_expand($element) { + $default_operator = 'and'; + $element['#tree'] = TRUE; $element['#default_value'] += array( - 'andor' => 'and', + 'andor' => $default_operator, ); $wrapper_id = drupal_clean_css_identifier(implode('-', $element['#parents'])) . '-ajax'; @@ -381,7 +384,7 @@ function _webform_conditional_expand($element) { 'remove' => _webform_conditional_remove_expand($element, $rid), ); $andor_stack[++$level] = array( - 'value' => $conditional['operator'], + 'value' => isset($conditional['operator']) ? $conditional['operator'] : $default_operator, 'parents' => array_merge($element['#parents'], array('rules', $rid, 'operator')), 'rid' => $rid, 'first' => TRUE, @@ -463,8 +466,7 @@ function _webform_conditional_add_expand($element, $rid, $subconditional) { '#value' => $subconditional ? t('(+)') : t('+'), '#submit' => array('webform_conditional_element_add'), '#subconditional' => $subconditional, - '#name' => implode('_', $element['#parents']) . '_rules_' . $rid . - ($subconditional ? '_add_subconditional' : '_add'), + '#name' => implode('_', $element['#parents']) . '_rules_' . $rid . ($subconditional ? '_add_subconditional' : '_add'), '#attributes' => array('class' => array('webform-conditional-rule-add')), '#ajax' => array( 'progress' => 'none', @@ -546,10 +548,10 @@ function _webform_conditional_action_expand($element, $aid, $action) { ), 'invert' => array( '#type' => 'select', - '#title' => t('Is/Isn\'t'), + '#title' => t("Is/Isn't"), '#options' => array( '0' => t('is'), - '1' => t('isn\'t'), + '1' => t("isn't"), ), '#default_value' => $action['invert'], ), @@ -618,11 +620,11 @@ function _webform_conditional_action_expand($element, $aid, $action) { * ); * @endcode * - forms[$form_key]: A string representing an HTML form for an operator. - * - forms[$form_key][$source]: Or instead of a single form for all components, - * if each component requires its own form, key each component by its source - * value (currently always the component ID). + * - forms[$form_key][$source]: Or instead of a single form for all + * components, if each component requires its own form, key each component + * by its source value (currently always the component ID). * - * @param $node + * @param object $node * The Webform node for which these forms are being generated. */ function _webform_conditional_expand_value_forms($node) { @@ -756,7 +758,7 @@ function webform_conditional_element_add($form, &$form_state) { ); if (empty($button['#subconditional'])) { - $new[0] = $parent_values[$rid]['source_type'] == 'component' ? $parent_values[$rid] : $default_rule; + $new[0] = (isset($parent_values[$rid]['source_type']) && $parent_values[$rid]['source_type'] == 'component') ? $parent_values[$rid] : $default_rule; } else { // The default andor operator is opposite of current subconditional's @@ -1439,8 +1441,9 @@ function webform_conditional_prepare_javascript($node, array $submission_data, $ $source_parents = webform_component_parent_keys($node, $source_component); $source_id = 'webform-component--' . str_replace('_', '-', implode('--', $source_parents)); - // If this source has a value set, add that as a setting. - // NULL or array(NULL) should be sent as an empty array to simplify the jQuery. + // If this source has a value set, add that as a setting. NULL or + // array(NULL) should be sent as an empty array to simplify the + // jQuery. if (isset($submission_data[$source_component['cid']])) { $source_value = $submission_data[$source_component['cid']]; $source_value = is_array($source_value) ? $source_value : array($source_value); diff --git a/profiles/wcm_base/modules/contrib/webform/includes/webform.emails.inc b/profiles/wcm_base/modules/contrib/webform/includes/webform.emails.inc index 5e2141e3caa6e79174e82141e2cf89eee9f6b080..5b8d56a023894bf492bed2e9d144ff711c9832ce 100644 --- a/profiles/wcm_base/modules/contrib/webform/includes/webform.emails.inc +++ b/profiles/wcm_base/modules/contrib/webform/includes/webform.emails.inc @@ -233,13 +233,13 @@ function webform_email_edit_form($form, $form_state, $node, $email = array(), $c case 'from_address': $default_value = webform_replace_tokens(webform_variable_get('webform_default_from_address'), $node); $title = t('E-mail from address'); - $description = t('Any email, select, or hidden form element may be selected as the sender\'s e-mail address.'); + $description = t("Any email, select, or hidden form element may be selected as the sender's e-mail address."); break; case 'from_name': $default_value = webform_replace_tokens(webform_variable_get('webform_default_from_name'), $node); $title = t('E-mail from name'); - $description = t('Any textfield, select, or hidden form element may be selected as the sender\'s name for e-mails.'); + $description = t("Any textfield, select, or hidden form element may be selected as the sender's name for e-mails."); break; } @@ -740,8 +740,8 @@ function webform_email_clone($email) { * other fields from the e-mail form. * * @return false|int - * On success SAVED_NEW or SAVED_UPDATED, depending on the operation performed, - * false on failure. + * On success SAVED_NEW or SAVED_UPDATED, depending on the operation + * performed, FALSE on failure. */ function webform_email_update($email) { $email['excluded_components'] = implode(',', $email['excluded_components']); diff --git a/profiles/wcm_base/modules/contrib/webform/includes/webform.report.inc b/profiles/wcm_base/modules/contrib/webform/includes/webform.report.inc index dc828cba4b5623b6419b0dfe68d66ff281dbc0bd..cd121efe6db8e316e43d6692c5cfd0baaf6d0ed7 100644 --- a/profiles/wcm_base/modules/contrib/webform/includes/webform.report.inc +++ b/profiles/wcm_base/modules/contrib/webform/includes/webform.report.inc @@ -113,7 +113,7 @@ function webform_results_submissions($node, $user_filter, $pager_count) { * @param object $node * Loaded webform node. * @param string $view_id - * machine_id of the view, such as webform_results or webform_submissions. + * The machine_id of the view, such as webform_results or webform_submissions. * * @return object|null * The loaded view. @@ -251,7 +251,7 @@ function webform_results_table($node, $pager_count = 0) { } /** - * + * Theme function for the Webform results table header. */ function theme_webform_results_table_header($variables) { return array( @@ -369,7 +369,7 @@ function webform_results_clear_form($form, $form_state, $node) { } /** - * + * Form submit handler. */ function webform_results_clear_form_submit($form, &$form_state) { $nid = $form_state['values']['nid']; @@ -686,7 +686,8 @@ function webform_results_download_range_validate($element, $form_state) { case 'range_date': // Download Start-end range of submissions. // Start submission time. - $start_date = strtotime($element['start_date']['#value']); + $format = webform_date_format('short'); + $start_date = DateTime::createFromFormat($format, $element['start_date']['#value']); if ($element['start_date']['#value'] == '') { form_error($element['start_date'], t('Start date range is required.')); } @@ -694,7 +695,7 @@ function webform_results_download_range_validate($element, $form_state) { form_error($element['start_date'], t('Start date range is not in a valid format.')); } // End submission time. - $end_date = strtotime($element['end_date']['#value']); + $end_date = DateTime::createFromFormat($format, $element['end_date']['#value']); if ($element['end_date']['#value'] != '') { if ($end_date === FALSE) { form_error($element['end_date'], t('End date range is not in a valid format.')); @@ -1559,10 +1560,10 @@ function webform_results_batch_results($node, $format, $options, &$context) { ); if (isset($_SESSION)) { - // UI exection. Defer resetting last-downloaded sid until download page. - // Set a session variable containing the information referencing the exported - // file. A cookie is also set to allow the browser to ensure the redirect - // to the file only happens one time. + // UI exection. Defer resetting last-downloaded sid until download page. Set + // a session variable containing the information referencing the exported + // file. A cookie is also set to allow the browser to ensure the redirect to + // the file only happens one time. $_SESSION['webform_export_info'] = $export_info; $params = session_get_cookie_params(); setcookie('webform_export_info', '1', REQUEST_TIME + 120, $params['path'], $params['domain'], $params['secure'], FALSE); @@ -1965,14 +1966,15 @@ function webform_download_sids_query($nid, array $range_options, $uid = NULL) { case 'range_date': $date_field = $range_options['completion_type'] == 'finished' ? 'ws.completed' : 'ws.submitted'; - $query->condition($date_field, strtotime($range_options['start_date']), '>='); - if ($range_options['end_date'] != '' && ($end_time = strtotime($range_options['end_date'])) !== FALSE) { - if ($end_time == strtotime('midnight', $end_time)) { - // Full day specified - // 86400 is a full day of seconds. - $end_time += 86399; - } - $query->condition($date_field, $end_time, '<='); + $format = webform_date_format('short'); + $start_date = DateTime::createFromFormat($format, $range_options['start_date']); + $start_date->setTime(0, 0, 0); + $query->condition($date_field, $start_date->getTimestamp(), '>='); + $end_time = DateTime::createFromFormat($format, $range_options['end_date']); + if ($range_options['end_date'] != '' && ($end_time !== FALSE)) { + // Check for the full day's submissions. + $end_time->setTime(23, 59, 59); + $query->condition($date_field, $end_time->getTimestamp(), '<='); } $query->orderBy($date_field, 'ASC'); break; diff --git a/profiles/wcm_base/modules/contrib/webform/includes/webform.submissions.inc b/profiles/wcm_base/modules/contrib/webform/includes/webform.submissions.inc index ce8194b22803dbb30ab5707d897512c8a5df9a35..22a06399f771c3f663a8b7c07d7afdee5d8261e8 100644 --- a/profiles/wcm_base/modules/contrib/webform/includes/webform.submissions.inc +++ b/profiles/wcm_base/modules/contrib/webform/includes/webform.submissions.inc @@ -233,171 +233,199 @@ function webform_submission_delete($node, $submission) { * Number of mail sent. */ function webform_submission_send_mail($node, $submission, $emails = NULL) { - global $user; - // Get the list of e-mails we'll be sending. $emails = isset($emails) ? $emails : $node->webform['emails']; // Create a themed message for mailing. $send_count = 0; foreach ($emails as $eid => $email) { - // Continue with next email recipients array if disabled for current. - if (!$email['status']) { + $mail = _webform_submission_prepare_mail($node, $submission, $email); + if (!$mail) { continue; } - // Set the HTML property based on availablity of MIME Mail. - $email['html'] = ($email['html'] && webform_variable_get('webform_email_html_capable')); + $addresses_final = $mail['addresses_final']; + $send_increment = $mail['send_increment']; + $language = $mail['language']; + $mail_params = $mail['mail_params']; - // Pass through the theme layer if using the default template. - if ($email['template'] == 'default') { - $email['message'] = theme(array('webform_mail_' . $node->nid, 'webform_mail', 'webform_mail_message'), array('node' => $node, 'submission' => $submission, 'email' => $email)); - } - else { - $email['message'] = $email['template']; + // Mail the webform results. + foreach ($addresses_final as $address) { + $message = drupal_mail('webform', 'submission', $address, $language, $mail_params, $email['from']); + if ($message['result']) { + $send_count += $send_increment; + } } + } - // Replace tokens in the message. - $email['message'] = webform_replace_tokens($email['message'], $node, $submission, $email, (boolean) $email['html']); + return $send_count; +} - // Build the e-mail headers. - $email['headers'] = theme(array('webform_mail_headers_' . $node->nid, 'webform_mail_headers'), array('node' => $node, 'submission' => $submission, 'email' => $email)); +/** + * Prepare a submission email for use by webform_submission_send_mail() + * + * @param $node + * The node object containing the current webform. + * @param $submission + * The webform submission object to be used in sending e-mails. + * @param $email + * The e-mail settings to be used. This will have some of its values adjusted. + * + * @return array|null + * An array of the information about the email needed by drupal_mail(). + */ +function _webform_submission_prepare_mail($node, $submission, &$email) { + global $user; - // Assemble the From string. - if (isset($email['headers']['From'])) { - // If a header From is already set, don't override it. - $email['from'] = $email['headers']['From']; - unset($email['headers']['From']); - } - else { - // Format the From address. - $mapping = isset($email['extra']['from_address_mapping']) ? $email['extra']['from_address_mapping'] : NULL; - $email['from'] = webform_format_email_address($email['from_address'], $email['from_name'], $node, $submission, TRUE, TRUE, NULL, $mapping); - } + // Don't process disabled emails. + if (!$email['status']) { + return; + } - // If requested and not already set, set Reply-To to the From and re-format From address. - if (webform_variable_get('webform_email_replyto') && - empty($email['headers']['Reply-To']) && - ($default_from_name = webform_variable_get('webform_default_from_name')) && - ($default_from_address = webform_variable_get('webform_default_from_address')) && - ($default_from_parts = explode('@', $default_from_address)) && - count($default_from_parts) == 2 && - $default_from_parts[1] && - stripos($email['from'], '@' . $default_from_parts[1]) === FALSE) { - // Message is not already being sent from the domain of the default - // webform from address. - $email['headers']['Reply-To'] = $email['from']; - $email['from'] = $default_from_address; - if (webform_variable_get('webform_email_address_format') == 'long') { - $email_parts = webform_parse_email_address($email['headers']['Reply-To']); - $from_name = t('!name via !site_name', - array( - '!name' => strlen($email_parts['name']) ? $email_parts['name'] : $email_parts['address'], - '!site_name' => $default_from_name, - )); - $from_name = implode(' ', array_map('mime_header_encode', explode(' ', $from_name))); - $email['from'] = '"' . $from_name . '" <' . $email['from'] . '>'; - } - } + // Set the HTML property based on availablity of MIME Mail. + $email['html'] = ($email['html'] && webform_variable_get('webform_email_html_capable')); - // Update the subject if set in the themed headers. - if (isset($email['headers']['Subject'])) { - $email['subject'] = $email['headers']['Subject']; - unset($email['headers']['Subject']); - } - else { - $email['subject'] = webform_format_email_subject($email['subject'], $node, $submission); - } + // Pass through the theme layer if using the default template. + if ($email['template'] == 'default') { + $email['message'] = theme(array('webform_mail_' . $node->nid, 'webform_mail', 'webform_mail_message'), array('node' => $node, 'submission' => $submission, 'email' => $email)); + } + else { + $email['message'] = $email['template']; + } - // Update the to e-mail if set in the themed headers. - if (isset($email['headers']['To'])) { - $email['email'] = $email['headers']['To']; - unset($email['headers']['To']); - $addresses = array_filter(explode(',', $email['email'])); - } - else { - // Format the To address(es). - $mapping = isset($email['extra']['email_mapping']) ? $email['extra']['email_mapping'] : NULL; - $addresses = webform_format_email_address($email['email'], NULL, $node, $submission, TRUE, FALSE, NULL, $mapping); - $email['email'] = implode(',', $addresses); - } + // Replace tokens in the message. + $email['message'] = webform_replace_tokens($email['message'], $node, $submission, $email, (boolean) $email['html']); - // Generate the list of addresses that this e-mail will be sent to. - $addresses_final = array_filter($addresses, 'webform_valid_email_address'); + // Build the e-mail headers. + $email['headers'] = theme(array('webform_mail_headers_' . $node->nid, 'webform_mail_headers'), array('node' => $node, 'submission' => $submission, 'email' => $email)); - if (!$addresses_final) { - continue; - } + // Assemble the From string. + if (isset($email['headers']['From'])) { + // If a header From is already set, don't override it. + $email['from'] = $email['headers']['From']; + unset($email['headers']['From']); + } + else { + // Format the From address. + $mapping = isset($email['extra']['from_address_mapping']) ? $email['extra']['from_address_mapping'] : NULL; + $email['from'] = webform_format_email_address($email['from_address'], $email['from_name'], $node, $submission, TRUE, TRUE, NULL, $mapping); + } - // Verify that this submission is not attempting to send any spam hacks. - foreach ($addresses_final as $address) { - if (_webform_submission_spam_check($address, $email['subject'], $email['from'], $email['headers'])) { - watchdog('webform', 'Possible spam attempt from @remote !message', - array('@remote' => ip_address(), '!message' => "<br />\n" . nl2br(htmlentities($email['message'])))); - drupal_set_message(t('Illegal information. Data not submitted.'), 'error'); - return FALSE; - } + // If "Use Reply-To header" is set in Webform settings and the Reply-To + // header is not already set, set Reply-To to the From and set From address + // to webform_default_from_name and webform_default_from_address. + if (webform_variable_get('webform_email_replyto') && + empty($email['headers']['Reply-To']) && + ($default_from_name = webform_variable_get('webform_default_from_name')) && + ($default_from_address = webform_variable_get('webform_default_from_address')) && + $email['from'] !== $default_from_name) { + $email['headers']['Reply-To'] = $email['from']; + $email['from'] = $default_from_address; + if (webform_variable_get('webform_email_address_format') == 'long') { + $email_parts = webform_parse_email_address($email['headers']['Reply-To']); + $from_name = t('!name via !site_name', + array( + '!name' => strlen($email_parts['name']) ? $email_parts['name'] : $email_parts['address'], + '!site_name' => $default_from_name, + )); + $from_name = implode(' ', array_map('mime_header_encode', explode(' ', $from_name))); + $email['from'] = '"' . $from_name . '" <' . $email['from'] . '>'; } + } + + // Update the subject if set in the themed headers. + if (isset($email['headers']['Subject'])) { + $email['subject'] = $email['headers']['Subject']; + unset($email['headers']['Subject']); + } + else { + $email['subject'] = webform_format_email_subject($email['subject'], $node, $submission); + } + + // Update the to e-mail if set in the themed headers. + if (isset($email['headers']['To'])) { + $email['email'] = $email['headers']['To']; + unset($email['headers']['To']); + $addresses = array_filter(explode(',', $email['email'])); + } + else { + // Format the To address(es). + $mapping = isset($email['extra']['email_mapping']) ? $email['extra']['email_mapping'] : NULL; + $addresses = webform_format_email_address($email['email'], NULL, $node, $submission, TRUE, FALSE, NULL, $mapping); + $email['email'] = implode(',', $addresses); + } + + // Generate the list of addresses that this e-mail will be sent to. + $addresses_final = array_filter($addresses, 'webform_valid_email_address'); + + if (!$addresses_final) { + return; + } - // Consolidate addressees into one message if permitted by configuration. - $send_increment = 1; - if (!webform_variable_get('webform_email_address_individual')) { - $send_increment = count($addresses_final); - $addresses_final = array(implode(', ', $addresses_final)); + // Verify that this submission is not attempting to send any spam hacks. + foreach ($addresses_final as $address) { + if (_webform_submission_spam_check($address, $email['subject'], $email['from'], $email['headers'])) { + watchdog('webform', 'Possible spam attempt from @remote !message', + array('@remote' => ip_address(), '!message' => "<br />\n" . nl2br(htmlentities($email['message'])))); + drupal_set_message(t('Illegal information. Data not submitted.'), 'error'); + return; } + } - // Mail the webform results. - foreach ($addresses_final as $address) { + // Consolidate addressees into one message if permitted by configuration. + $send_increment = 1; + if (!webform_variable_get('webform_email_address_individual')) { + $send_increment = count($addresses_final); + $addresses_final = array(implode(', ', $addresses_final)); + } - $language = $user->uid ? user_preferred_language($user) : language_default(); - $mail_params = array( - 'message' => $email['message'], - 'subject' => $email['subject'], - 'headers' => $email['headers'], - 'node' => $node, - 'submission' => $submission, - 'email' => $email, - ); + // Prepare the variables used by drupal_mail(). + $language = $user->uid ? user_preferred_language($user) : language_default(); + $mail_params = array( + 'message' => $email['message'], + 'subject' => $email['subject'], + 'headers' => $email['headers'], + 'node' => $node, + 'submission' => $submission, + 'email' => $email, + ); - if (webform_variable_get('webform_email_html_capable')) { - // Load attachments for the e-mail. - $attachments = array(); - if ($email['attachments']) { - webform_component_include('file'); - foreach ($node->webform['components'] as $component) { - if (webform_component_feature($component['type'], 'attachment') && !empty($submission->data[$component['cid']][0])) { - if (webform_component_implements($component['type'], 'attachments')) { - $files = webform_component_invoke($component['type'], 'attachments', $component, $submission->data[$component['cid']]); - if ($files) { - $attachments = array_merge($attachments, $files); - } - } + if (webform_variable_get('webform_email_html_capable')) { + // Load attachments for the e-mail. + $attachments = array(); + if ($email['attachments']) { + webform_component_include('file'); + foreach ($node->webform['components'] as $component) { + if (webform_component_feature($component['type'], 'attachment') && !empty($submission->data[$component['cid']][0])) { + if (webform_component_implements($component['type'], 'attachments')) { + $files = webform_component_invoke($component['type'], 'attachments', $component, $submission->data[$component['cid']]); + if ($files) { + $attachments = array_merge($attachments, $files); } } } - - // Add the attachments to the mail parameters. - $mail_params['attachments'] = $attachments; - - // Set all other properties for HTML e-mail handling. - $mail_params['plain'] = !$email['html']; - $mail_params['plaintext'] = $email['html'] ? NULL : $email['message']; - $mail_params['headers'] = $email['headers']; - if ($email['html']) { - // MIME Mail requires this header or it will filter all text. - $mail_params['headers']['Content-Type'] = 'text/html; charset=UTF-8'; - } } + } - // Mail the submission. - $message = drupal_mail('webform', 'submission', $address, $language, $mail_params, $email['from']); - if ($message['result']) { - $send_count += $send_increment; - } + // Add the attachments to the mail parameters. + $mail_params['attachments'] = $attachments; + + // Set all other properties for HTML e-mail handling. + $mail_params['plain'] = !$email['html']; + $mail_params['plaintext'] = $email['html'] ? NULL : $email['message']; + $mail_params['headers'] = $email['headers']; + if ($email['html']) { + // MIME Mail requires this header or it will filter all text. + $mail_params['headers']['Content-Type'] = 'text/html; charset=UTF-8'; } } - return $send_count; + return array( + 'addresses_final' => $addresses_final, + 'send_increment' => $send_increment, + 'language' => $language, + 'mail_params' => $mail_params, + ); } /** @@ -435,7 +463,7 @@ function webform_submission_delete_form($form, $form_state, $node, $submission) } /** - * + * Form submit handler. */ function webform_submission_delete_form_submit($form, &$form_state) { $node = node_load($form_state['values']['details']['nid']); @@ -953,7 +981,7 @@ function webform_get_submission($nid, $sid) { } /** - * + * Verify that an email is not attempting to send any spam. */ function _webform_submission_spam_check($to, $subject, $from, $headers = array()) { $headers = implode('\n', (array) $headers); diff --git a/profiles/wcm_base/modules/contrib/webform/includes/webform.webformconditionals.inc b/profiles/wcm_base/modules/contrib/webform/includes/webform.webformconditionals.inc index a92339b121ca37829ea655eea71be4b60f94f6b2..39db0695e87893531e37d9be7fe73f993524691c 100644 --- a/profiles/wcm_base/modules/contrib/webform/includes/webform.webformconditionals.inc +++ b/profiles/wcm_base/modules/contrib/webform/includes/webform.webformconditionals.inc @@ -152,7 +152,7 @@ class WebformConditionals { )); } elseif ($source_component['page_num'] == $page_num && $component['type'] == 'pagebreak') { - $errors[$page_num][] = t('The page break %to can\'t be controlled by %from on the same page.', + $errors[$page_num][] = t("The page break %to can't be controlled by %from on the same page.", array( '%from' => $source_component['name'], '%to' => $component['name'], @@ -437,11 +437,11 @@ class WebformConditionals { // in webform.conditionals.inc. switch ($conditional_type) { case 'numeric': - module_load_include('inc', 'webform', 'components/number'); + webform_component_include('number'); break; case 'select': - module_load_include('inc', 'webform', 'components/select'); + webform_component_include($conditional_type); break; } diff --git a/profiles/wcm_base/modules/contrib/webform/templates/webform-mail.tpl.php b/profiles/wcm_base/modules/contrib/webform/templates/webform-mail.tpl.php index c171e6c6db595621236f8a3d669b306170bf9430..216b7320082a858f68076ae77aa1f51e841546d3 100644 --- a/profiles/wcm_base/modules/contrib/webform/templates/webform-mail.tpl.php +++ b/profiles/wcm_base/modules/contrib/webform/templates/webform-mail.tpl.php @@ -17,8 +17,8 @@ * - $ip_address: The IP address of the user submitting the form or '(unknown)' * for confidential submissions. * - * The $email['email'] variable can be used to send different e-mails to different users - * when using the "default" e-mail template. + * The $email['email'] variable can be used to send different e-mails to + * different users when using the "default" e-mail template. */ ?> <?php print ($email['html'] ? '<p>' : '') . t('Submitted on [submission:date:long]') . ($email['html'] ? '</p>' : ''); ?> diff --git a/profiles/wcm_base/modules/contrib/webform/templates/webform-results-submissions.tpl.php b/profiles/wcm_base/modules/contrib/webform/templates/webform-results-submissions.tpl.php index 8ceb907af9f60bdca67bec7a481e0b099bbcc97b..32218e50f92203e2de594a25698c70d1093f19fd 100644 --- a/profiles/wcm_base/modules/contrib/webform/templates/webform-results-submissions.tpl.php +++ b/profiles/wcm_base/modules/contrib/webform/templates/webform-results-submissions.tpl.php @@ -13,7 +13,8 @@ * - $table: The table[] array consists of three keys: * - $table['#header']: Table header. * - $table['#rows']: Table rows. - * - $table['#operation_total']: Maximum number of operations in the operation column. + * - $table['#operation_total']: Maximum number of operations in the operation + * column. */ ?> diff --git a/profiles/wcm_base/modules/contrib/webform/tests/WebformConditionalsTestCase.test b/profiles/wcm_base/modules/contrib/webform/tests/WebformConditionalsTestCase.test index f384f5ac40d047e3a91d24b47c2c3fbc7b94b682..a43313db8513ebd74c26faf34f7a220af46ab50b 100644 --- a/profiles/wcm_base/modules/contrib/webform/tests/WebformConditionalsTestCase.test +++ b/profiles/wcm_base/modules/contrib/webform/tests/WebformConditionalsTestCase.test @@ -41,6 +41,51 @@ class WebformConditionalsTestCase extends WebformTestCase { } $this->drupalLogout(); + + // Test that the whole conditional is deleted when all source components are + // deleted. Inital setup: Two components. One source (c1) one target (c2). + $node = (object) array( + 'type' => 'webform', + 'title' => 'Conditional test', + ); + $default = array( + 'type' => 'textfield', + 'pid' => 0, + ); + webform_component_defaults($default); + node_object_prepare($node); + $node->webform['components'][1] = array( + 'cid' => 1, + 'form_key' => 'c1', + ) + $default; + $node->webform['components'][2] = array( + 'cid' => 2, + 'form_key' => 'c2', + ) + $default; + $node->webform['conditionals'][0] = array( + 'rgid' => 0, + 'andor' => NULL, + 'weight' => -1, + 'rules' => array(array( + 'source_type' => 'component', + 'source' => 1, + 'operator' => 'not_empty', + ), + ), + 'actions' => array(array( + 'target_type' => 'component', + 'target' => 2, + 'action' => 'show', + ), + ), + ); + node_save($node); + + // Delete the source. + unset($node->webform['components'][1]); + node_save($node); + + $this->assertEqual(array(), $node->webform['conditionals'], 'The whole conditional is deleted when all source components are deleted.'); } /** diff --git a/profiles/wcm_base/modules/contrib/webform/tests/WebformPermissionsTestCase.test b/profiles/wcm_base/modules/contrib/webform/tests/WebformPermissionsTestCase.test index eef158a4eb365b7e693a047b7abe494e9c88d766..4f960b88a98eb28af0a73a4df9aaf0978e056603 100644 --- a/profiles/wcm_base/modules/contrib/webform/tests/WebformPermissionsTestCase.test +++ b/profiles/wcm_base/modules/contrib/webform/tests/WebformPermissionsTestCase.test @@ -38,8 +38,9 @@ class WebformPermissionsTestCase extends WebformTestCase { // The anonymous user should not be able to submit. $this->drupalGet('node/' . $node->nid); - // Note: Should be: You must <a href="!login">login</a> or <a href="!register">register</a> to view this form. - // Something in SimpleTest isn't handling the string correctly. + // Note: Should be: You must <a href="!login">login</a> or + // <a href="!register">register</a> to view this form. Something in + // SimpleTest isn't handling the string correctly. $this->assertText('to view this form.', t('Anonymous user is not allowed to submit form.'), t('Webform')); } diff --git a/profiles/wcm_base/modules/contrib/webform/tests/WebformTestCase.test b/profiles/wcm_base/modules/contrib/webform/tests/WebformTestCase.test index caf662b574f231eb61fad8023e94e64d453de582..d045129ed50b662ce9a89e3e96d355c6bff2da9e 100644 --- a/profiles/wcm_base/modules/contrib/webform/tests/WebformTestCase.test +++ b/profiles/wcm_base/modules/contrib/webform/tests/WebformTestCase.test @@ -99,7 +99,7 @@ class WebformTestCase extends DrupalWebTestCase { } /** - * + * Reset the form. */ public function webformReset() { $this->_webform_node = NULL; @@ -113,7 +113,8 @@ class WebformTestCase extends DrupalWebTestCase { * - A default configuration for the component. * - Values to try setting via POST * - Values that should match the database storage when set via POST - * - Values that should match the database storage when using the default values. + * - Values that should match the database storage when using the default + * values. * * @return array * An array of each component settings. @@ -994,7 +995,7 @@ class WebformTestCase extends DrupalWebTestCase { } /** - * + * Create a sample Webform node. */ public function webformForm() { if (isset($this->_webform_node)) { diff --git a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_area_result_pager.inc b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_area_result_pager.inc index e99db0b26c53b695aff951727a0ef37f10225437..afbc2ba02802176b3a05181f29982d8cbb4181ab 100644 --- a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_area_result_pager.inc +++ b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_area_result_pager.inc @@ -10,7 +10,7 @@ class webform_handler_area_result_pager extends views_handler_area_result { /** - * + * {@inheritdoc} */ public function option_definition() { $options = parent::option_definition(); @@ -20,7 +20,7 @@ class webform_handler_area_result_pager extends views_handler_area_result { } /** - * + * {@inheritdoc} */ public function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); diff --git a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_form_body.inc b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_form_body.inc index 34abd1399092b98621d2700d53f343b0d3c7b47a..0abde7c4ad0604232925516caf1688a589988793 100644 --- a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_form_body.inc +++ b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_form_body.inc @@ -8,7 +8,7 @@ class webform_handler_field_form_body extends views_handler_field { /** - * + * {@inheritdoc} */ public function construct() { parent::construct(); @@ -16,7 +16,7 @@ class webform_handler_field_form_body extends views_handler_field { } /** - * + * {@inheritdoc} */ public function option_definition() { $options = parent::option_definition(); diff --git a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_node_link_edit.inc b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_node_link_edit.inc index c77e82628f3fa62cdb8af655c27cfd1700e986b4..7a462c22499550753b54f9647336e0dbdd1c8419 100644 --- a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_node_link_edit.inc +++ b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_node_link_edit.inc @@ -8,7 +8,7 @@ class webform_handler_field_node_link_edit extends views_handler_field_node_link { /** - * + * {@inheritdoc} */ public function option_definition() { $options = parent::option_definition(); @@ -17,7 +17,7 @@ class webform_handler_field_node_link_edit extends views_handler_field_node_link } /** - * + * {@inheritdoc} */ public function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); diff --git a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_node_link_results.inc b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_node_link_results.inc index 64ab936dd5968f8babfd00ae80b5fd66cf257299..f5c9d62d9a0937c85f68ab14d8c036c8d8d98b47 100644 --- a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_node_link_results.inc +++ b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_node_link_results.inc @@ -8,7 +8,7 @@ class webform_handler_field_node_link_results extends views_handler_field_node_link { /** - * + * {@inheritdoc} */ public function option_definition() { $options = parent::option_definition(); @@ -17,7 +17,7 @@ class webform_handler_field_node_link_results extends views_handler_field_node_l } /** - * + * {@inheritdoc} */ public function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); @@ -33,7 +33,8 @@ class webform_handler_field_node_link_results extends views_handler_field_node_l * Renders the link. */ public function render_link($node, $values) { - // Ensure node is webform-enabled and user has access node's webform results. + // Ensure node is webform-enabled and the user has access node's webform + // results. if (!in_array($node->type, webform_node_types()) || !webform_results_access($node)) { return; } diff --git a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_submission_count.inc b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_submission_count.inc index cf75d1ac0df5a068822c6361aca96da3f43ff428..743279c461186c491292d25897f6dfd82b954604 100644 --- a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_submission_count.inc +++ b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_submission_count.inc @@ -8,7 +8,7 @@ class webform_handler_field_submission_count extends views_handler_field { /** - * + * {@inheritdoc} */ public function construct() { parent::construct(); @@ -24,7 +24,7 @@ class webform_handler_field_submission_count extends views_handler_field { } /** - * + * {@inheritdoc} */ public function option_definition() { $options = parent::option_definition(); diff --git a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_submission_data.inc b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_submission_data.inc index 656a143d7c7662f069fa5f4682823f6b911fba1b..e18bb70ef6311a37c26cd4c0542118b92c89ca89 100644 --- a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_submission_data.inc +++ b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_submission_data.inc @@ -10,7 +10,7 @@ class webform_handler_field_submission_data extends views_handler_field { /** - * + * {@inheritdoc} */ public function construct() { // We need to set this property before calling the construct() chain @@ -20,7 +20,7 @@ class webform_handler_field_submission_data extends views_handler_field { } /** - * + * {@inheritdoc} */ public function option_definition() { $options = parent::option_definition(); @@ -33,7 +33,7 @@ class webform_handler_field_submission_data extends views_handler_field { } /** - * + * {@inheritdoc} */ public function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); @@ -80,7 +80,7 @@ class webform_handler_field_submission_data extends views_handler_field { } /** - * + * {@inheritdoc} */ public function options_validate(&$form, &$form_state) { parent::options_validate($form, $form_state); @@ -90,7 +90,7 @@ class webform_handler_field_submission_data extends views_handler_field { } /** - * + * {@inheritdoc} */ public function options_submit(&$form, &$form_state) { parent::options_submit($form, $form_state); @@ -224,7 +224,8 @@ class webform_handler_field_submission_data extends views_handler_field { $render['#theme_wrappers'] = array(); } else { - // Plain text format is generated via invoking the table output to ensure output is sanitised. + // Plain text format is generated via invoking the table output to + // ensure output is sanitised. $data = isset($submission->data[$component['cid']]) ? $submission->data[$component['cid']] : NULL; $render = webform_component_invoke($component['type'], 'table', $component, $data); } diff --git a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_submission_link.inc b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_submission_link.inc index 1a485d80a0c4a2379244970fc43b7dee5a57af12..9e13c7484d6f899c4d0fd1b5df13e60e84190e1a 100644 --- a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_submission_link.inc +++ b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_submission_link.inc @@ -9,7 +9,7 @@ class webform_handler_field_submission_link extends views_handler_field { public $link_type; /** - * + * {@inheritdoc} */ public function construct() { // We need to set this property before calling the construct() chain @@ -31,7 +31,7 @@ class webform_handler_field_submission_link extends views_handler_field { } /** - * + * {@inheritdoc} */ public function option_definition() { $options = parent::option_definition(); @@ -42,7 +42,7 @@ class webform_handler_field_submission_link extends views_handler_field { } /** - * + * {@inheritdoc} */ public function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); diff --git a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_webform_status.inc b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_webform_status.inc index e6125ead48e5e128358b9ddb3acaaabb4c2fe190..6dd8ee37d1eea79673112b521f9b9cbcf5c3698a 100644 --- a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_webform_status.inc +++ b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_field_webform_status.inc @@ -6,7 +6,7 @@ class webform_handler_field_webform_status extends views_handler_field_boolean { /** - * + * {@inheritdoc} */ public function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); @@ -14,7 +14,7 @@ class webform_handler_field_webform_status extends views_handler_field_boolean { } /** - * + * {@inheritdoc} */ public function option_definition() { $options = parent::option_definition(); diff --git a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_numeric_data.inc b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_numeric_data.inc index 414e1224f6067d46617440fef302a1e9b10a0418..b64a8cf5d643557b45cf665c4f438d68a0b029f8 100644 --- a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_numeric_data.inc +++ b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_numeric_data.inc @@ -15,7 +15,7 @@ class webform_handler_field_numeric_data extends views_handler_field_numeric { public $formula = NULL; /** - * Constructor. + * {@inheritdoc} */ public function construct() { parent::construct(); diff --git a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_relationship_submission_data.inc b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_relationship_submission_data.inc index fc51862725bd0b952e7910cd1b40ddb6917f4872..6c34481127a4f3e5fd40d846637178efee4846ef 100644 --- a/profiles/wcm_base/modules/contrib/webform/views/webform_handler_relationship_submission_data.inc +++ b/profiles/wcm_base/modules/contrib/webform/views/webform_handler_relationship_submission_data.inc @@ -6,17 +6,19 @@ class webform_handler_relationship_submission_data extends views_handler_relationship { /** - * + * {@inheritdoc} */ public function option_definition() { $options = parent::option_definition(); $options['webform_nid'] = array('default' => NULL); $options['webform_cid'] = array('default' => NULL); + $options['webform_form_key'] = array('default' => NULL); + $options['webform_join_by'] = array('default' => 'nid_cid'); return $options; } /** - * + * {@inheritdoc} */ public function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); @@ -27,10 +29,23 @@ class webform_handler_relationship_submission_data extends views_handler_relatio // Helper function provides webform_nid and webform_cid options. _webform_views_options_form($form, $form_state, $nid, $cid); + + $form['webform_join_by'] = array( + '#type' => 'select', + '#title' => t('Relate using'), + '#default_value' => $this->options['webform_join_by'], + '#options' => array( + 'nid_cid' => t('Node and Component ID'), + 'cid' => t('Component ID'), + 'form_key' => t('Component Form Key'), + ), + '#description' => t('Choose <em>Node and Component ID</em> when this view will display data from only this webform.</br>Choose <em>Component ID</em> when this view will display data from other webforms and where the Component ID is identical.</br>Choose <em>Component Form Key</em> when this view will display data from other webforms with varying Component IDs.'), + ); + } /** - * + * {@inheritdoc} */ public function options_validate(&$form, &$form_state) { parent::options_validate($form, $form_state); @@ -38,11 +53,17 @@ class webform_handler_relationship_submission_data extends views_handler_relatio } /** - * + * {@inheritdoc} */ public function options_submit(&$form, &$form_state) { parent::options_submit($form, $form_state); _webform_views_options_submit($form, $form_state); + $options =& $form_state['values']['options']; + $options['webform_form_key'] = $options['webform_join_by_form_key'] == 'form_key' && ($node = node_load($options['webform_nid'])) + ? $node->webform['components'][$options['webform_cid']]['form_key'] + : NULL; + // Drop PHP reference. + unset($options); } /** @@ -51,16 +72,67 @@ class webform_handler_relationship_submission_data extends views_handler_relatio * It respects the given component ids, provided via options form. */ public function query() { - $this->definition['extra'][] = array( - 'table' => NULL, - 'field' => "%alias.nid", - 'value' => $this->options['webform_nid'], - ); - $this->definition['extra'][] = array( - 'table' => NULL, - 'field' => "%alias.cid", - 'value' => $this->options['webform_cid'], - ); + // When defining extra clauses, the 'table' key can be used to specify the + // alias of another table. If NULL is specified, then the field is not + // qualified with a table. Therefore, do NOT specify "'table' => NULL". + switch ($this->options['webform_join_by']) { + case 'form_key': + $form_key = $this->options['webform_form_key']; + $join_type = $this->options['required'] ? 'INNER' : 'LEFT'; + + $this->ensure_my_table(); + $join = new views_join(); + + $join->construct( + // The table to be joined. + 'webform_component', + // The left table (i.e. this table, webform_submission). + $this->table, + // The left field (i.e. the webform node id). + 'nid', + // The field (i.e. webform_components.nid). + 'nid', + // Extra array of additional conditions. + array( + array( + // Extra join of form_key. + 'field' => 'form_key', + // ... = $form_key (operator '=' is default) + 'value' => $form_key, + ), + ), + // Join type is the same as this relationship's join type. + $join_type); + + $alias = $this->query->add_relationship( + // Requested alias for new reliationship. + 'webform_component_' . $form_key, + // Addition join to be added to this relatinship. + $join, + // Base table (i.e. drivingevals_submission) + $this->table_alias, + // Add the view to this relationship. + $this->relationship); + + // The actual alias for this relationship's join is not known yet. Becasue + // of name conflicts, it may have a number appended to the end. %alias is + // substitued when the query is build with the actual alias name. + $this->definition['extra'][] = "%alias.cid = {$alias}.cid"; + break; + + case 'nid_cid': + $this->definition['extra'][] = array( + 'field' => "nid", + 'value' => $this->options['webform_nid'], + ); + // FALL THROUGH. + case 'cid': + $this->definition['extra'][] = array( + 'field' => "cid", + 'value' => $this->options['webform_cid'], + ); + break; + } // The rest of building the join is performed by the parent. parent::query(); diff --git a/profiles/wcm_base/modules/contrib/webform/views/webform_plugin_row_submission_view.inc b/profiles/wcm_base/modules/contrib/webform/views/webform_plugin_row_submission_view.inc index 75ea3b00b3c20fb9fb03adac54b4f178056758c1..74c697ecc7225fde00ec19e1fb48ad843581de5d 100644 --- a/profiles/wcm_base/modules/contrib/webform/views/webform_plugin_row_submission_view.inc +++ b/profiles/wcm_base/modules/contrib/webform/views/webform_plugin_row_submission_view.inc @@ -28,7 +28,7 @@ class webform_views_plugin_row_submission_view extends views_plugin_row { private $nodes = array(); /** - * + * {@inheritdoc} */ public function option_definition() { $options = parent::option_definition(); @@ -39,7 +39,7 @@ class webform_views_plugin_row_submission_view extends views_plugin_row { } /** - * + * {@inheritdoc} */ public function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); @@ -108,7 +108,8 @@ class webform_views_plugin_row_submission_view extends views_plugin_row { } $build['#theme'] = $themes; - // Render built submission, and if unsanitized plain text is used, make it safe for display. + // Render built submission, and if unsanitized plain text is used, make + // it safe for display. $render = drupal_render($build); return $format == 'html' ? $render : nl2br(check_plain($render)); } diff --git a/profiles/wcm_base/modules/contrib/webform/webform.api.php b/profiles/wcm_base/modules/contrib/webform/webform.api.php index 3261692555d466130de1f059cdf3fae747900e64..2df20a65db5851470dfc8fee685d8a29dd5043d1 100644 --- a/profiles/wcm_base/modules/contrib/webform/webform.api.php +++ b/profiles/wcm_base/modules/contrib/webform/webform.api.php @@ -446,6 +446,7 @@ function hook_webform_csv_data_alter(&$data, $component, $submission) { * - conditional * - spam_analysis * - group + * - private * * Note that most of these features do not indicate the default state, but * determine if the component can have this property at all. Setting @@ -542,6 +543,12 @@ function hook_webform_component_info() { // If this component reflects a time range and should use labels such as // "Before" and "After" when exposed as filters in Views module. 'views_range' => FALSE, + + // Set this to FALSE if this component cannot be used as a private + // component. If this is not FALSE, in your implementation of + // _webform_defaults_COMPONENT(), set ['extra']['private'] property to + // TRUE or FALSE. + 'private' => FALSE, ), // Specify the conditional behaviour of this component. @@ -759,7 +766,8 @@ function _webform_attachments_component($component, $value) { * Alter default settings for a newly created webform node. * * @param array $defaults - * Default settings for a newly created webform node as defined by webform_node_defaults(). + * Default settings for a newly created webform node as defined by + * webform_node_defaults(). * * @see webform_node_defaults() */ @@ -932,7 +940,7 @@ function _webform_render_component($component, $value = NULL, $filter = TRUE, $s } /** - * Allow modules to modify a webform component that is going to be rendered in a form. + * Allow modules to modify a webform component that will be rendered in a form. * * @param array $element * The display element as returned by _webform_render_component(). @@ -1410,6 +1418,110 @@ function hook_webform_exporters_alter(array &$exporters) { $exporters['excel']['file'] = drupal_get_path('module', 'yourmodule') . '/includes/customized_excel_exporter.inc'; } +/** + * Declare conditional types and their operators. + * + * Each conditional type defined here may then be referenced in + * hook_webform_component_info(). For each type this hook also declares a set of + * operators that may be applied to a component of this conditional type in + * conditionals. + * + * @return array + * A 2-dimensional array of operator configurations. The configurations are + * keyed first by their conditional type then by operator key. Each operator + * declaration is an array with the following keys: + * - label: Translated label for this operator that is shown in the UI. + * - comparison callback: A callback for server-side evaluation. + * - js comparison callback: A JavaScript callback for client-side evaluation. + * The callback will be looked for in the Drupal.webform object. + * - form callback (optional): A form callback that allows configuring + * additional parameters for this operator. Default: + * 'webform_conditional_operator_text'. + * + * @see hook_webform_component_info() + * @see callback_webform_conditional_comparision_operator() + * @see callback_webform_conditional_rule_value_form() + */ +function hook_webform_conditional_operator_info() { + $operators = array(); + $operators['string']['not_equal'] = array( + 'label' => t('is not'), + 'comparison callback' => 'webform_conditional_operator_string_not_equal', + 'js comparison callback' => 'conditionalOperatorStringNotEqual', + ); + return $operators; +} + +/** + * Alter the list of operators and conditional types. + * + * @param array $operators + * A data structure as described in hook_webform_conditional_operator_info(). + * + * @see hook_webform_conditional_operator_info() + */ +function hook_webform_conditional_operators_alter(array &$operators) { + $operators['string']['not_equal']['label'] = t('not equal'); +} + +/** + * Evaluate the operator for a given set of values. + * + * This function will be called two times with potentially different kinds of + * values: Once in _webform_client_form_validate() before any of the validate + * handlers or the _webform_submit_COMPONENT() callback is called, and once in + * webform_client_form_pages() after those handlers have been called. + * + * @param array $input_values + * The values received from the browser. + * @param mixed $rule_value + * The value as configured in the form callback. + * @param array $component + * The component for which we are evaluating the operator. + * + * @return bool + * The operation result. + */ +function callback_webfom_conditional_comparison_operator(array $input_values, $rule_value, array $component) { + foreach ($input_values as $value) { + if (strcasecmp($value, $rule_value)) { + return TRUE; + } + } + return FALSE; +} + +/** + * Define a form element that configures your operator. + * + * @param object $node + * The node for which the conditionals are being configured. + * + * @return string|string[] + * Either a single rendered form element or a rendered form element per + * component (keyed by cid). Make sure that none of the rendered strings + * contains any HTML IDs as the form element will be rendered multiple times. + * The JavaScript will take care of adding the appropriate name attributes. + * + * @see _webform_conditional_expand_value_forms() + */ +function callback_webform_conditional_rule_value_form($node) { + $forms = []; + foreach ($node->webform['components'] as $cid => $component) { + if (webform_component_property($component['type'], 'conditional_type') == 'newsletter') { + $element = [ + '#type' => 'select', + '#options' => [ + 'yes' => t('Opt-in'), + 'no' => t('No opt-in'), + ], + ]; + $forms[$cid] = drupal_render($element); + } + } + return $forms; +} + /** * @} */ diff --git a/profiles/wcm_base/modules/contrib/webform/webform.info b/profiles/wcm_base/modules/contrib/webform/webform.info index c50a42bf33d39aa46a0eba1370b90a93f93bac82..e3e9549f22259a2f11f97041d6c50fbe511a16d0 100644 --- a/profiles/wcm_base/modules/contrib/webform/webform.info +++ b/profiles/wcm_base/modules/contrib/webform/webform.info @@ -39,8 +39,8 @@ files[] = tests/WebformPermissionsTestCase.test files[] = tests/WebformSubmissionTestCase.test files[] = tests/WebformTestCase.test -; Information added by Drupal.org packaging script on 2018-04-24 -version = "7.x-4.17" +; Information added by Drupal.org packaging script on 2019-01-07 +version = "7.x-4.19" core = "7.x" project = "webform" -datestamp = "1524581893" +datestamp = "1546876989" diff --git a/profiles/wcm_base/modules/contrib/webform/webform.install b/profiles/wcm_base/modules/contrib/webform/webform.install index 409cd9b99b97f085f9a84dc494da9f0f042fb171..0fbd7043a3835ac681b2cd53eeeef4efd3048eee 100644 --- a/profiles/wcm_base/modules/contrib/webform/webform.install +++ b/profiles/wcm_base/modules/contrib/webform/webform.install @@ -796,7 +796,6 @@ function webform_uninstall() { variable_del('webform_default_format'); variable_del('webform_format_override'); variable_del('webform_email_select_max'); - variable_del('webform_fieldset_wrap'); variable_del('webform_node_types_primary'); variable_del('webform_date_type'); variable_del('webform_export_format'); @@ -829,9 +828,9 @@ function webform_uninstall() { file_unmanaged_delete_recursive($filepath); // Delete the content type "webform" if: - // a) there are no existing nodes of type webform and - // b) no additional fields have been defined for node type webform, beyond - // the default body field. + // 1. there are no existing nodes of type webform and + // 2. no additional fields have been defined for node type webform, beyond the + // default body field. $query = new EntityFieldQuery(); $results = $query->entityCondition('entity_type', 'node') ->entityCondition('bundle', 'webform') @@ -862,10 +861,12 @@ function webform_update_dependencies() { $dependencies['webform'][7320] = array( 'system' => 7059, ); - // Ensure rules tables and fields exist before trying to use it. - $dependencies['webform'][7420] = array( - 'rules' => 7213, - ); + if (module_exists('rules')) { + // Ensure rules tables and fields exist before trying to use it. + $dependencies['webform'][7420] = array( + 'rules' => 7213, + ); + } return $dependencies; } @@ -2358,3 +2359,23 @@ function webform_update_7430() { return t('Webform emails may now be disabled.'); } + +/** + * Preserve progress bar as not active for one-page webforms. + */ +function webform_update_7431() { + // Get a list of all Webforms containing a pagebreak. + $multipage_webform_nids = db_select('webform_component'); + $multipage_webform_nids->distinct(); + $multipage_webform_nids->addField('webform_component', 'nid'); + $multipage_webform_nids->condition('type', 'pagebreak'); + + // Remove confirmation page from the progress bar for single-page Webforms. + $updated_count = db_update('webform') + ->fields(array('progressbar_include_confirmation' => 0)) + ->condition('preview', 0) + ->condition('nid', $multipage_webform_nids, 'NOT IN') + ->execute(); + + return t("Disabled progress bar for @count single-page webforms.", array('@count' => $updated_count)); +} diff --git a/profiles/wcm_base/modules/contrib/webform/webform.module b/profiles/wcm_base/modules/contrib/webform/webform.module index 08efd67c9da8c068309bf3e433fe79a91b1c7ab0..07869996be86f192c90a1c8112667744a5880bcd 100644 --- a/profiles/wcm_base/modules/contrib/webform/webform.module +++ b/profiles/wcm_base/modules/contrib/webform/webform.module @@ -636,7 +636,7 @@ function webform_submission_access($node, $submission, $op = 'view', $account = // If access is granted via a token, then allow subsequent submission access // for anonymous users. - if (!$user->uid && $token_access) { + if (!$account->uid && $token_access) { $_SESSION['webform_submission'][$submission->sid] = $node->nid; } @@ -1567,7 +1567,7 @@ function webform_node_insert($node) { } // Flush the block cache if creating a block. - if (function_exists('block_flush_caches') && $node->webform['block']) { + if (module_exists('block') && $node->webform['block']) { block_flush_caches(); } } @@ -2444,7 +2444,7 @@ function webform_block_configure($delta = '') { 1 => t('Display the confirmation page in the block on the same page (no redirect)'), ), '#default_value' => $settings['confirmation_block'], - '#description' => t('This setting overrides the webform\'s configuration and redirection location settings when the webform is submitted via this block.'), + '#description' => t("This setting overrides the webform's configuration and redirection location settings when the webform is submitted via this block."), ); return $form; } @@ -2615,12 +2615,12 @@ function webform_client_form($form, &$form_state, $node, $submission = FALSE, $r // For resuming a previous draft, find the next page after the last // validated page. if (!isset($form_state['storage']['page_num']) && $submission && $submission->is_draft && $submission->highest_valid_page) { - // Find the - // 1) previous/next non-empty page, or - // 2) the preview page, or - // 3) the preview page, forcing its display if the form would - // unexpectedly submit, or - // 4) page 1 even if empty, if no other previous page would be shown. + // Find the: + // 1. previous/next non-empty page, or + // 2. the preview page, or + // 3. the preview page, forcing its display if the form would unexpectedly + // submit, or + // 4. page 1 even if empty, if no other previous page would be shown. $form_state['webform']['page_num'] = $submission->highest_valid_page; do { $form_state['webform']['page_num']++; @@ -2643,7 +2643,7 @@ function webform_client_form($form, &$form_state, $node, $submission = FALSE, $r $page_num = $form_state['webform']['page_num']; $preview = $form_state['webform']['preview']; - if ($page_count > 1) { + if ($node->webform['progressbar_include_confirmation'] || $page_count > 1) { $page_labels = webform_page_labels($node, $form_state); $form['progressbar'] = array( '#theme' => 'webform_progressbar', @@ -3043,14 +3043,14 @@ function _webform_client_form_validate(&$elements, &$form_state, $form_id = NULL $cid = $elements['#webform_component']['cid']; $page_num = $form_state['values']['details']['page_num']; // Webform-specific enhancements: - // 1) Only validate the field if it was used in this submission. + // 1. Only validate the field if it was used in this submission. // This both skips validation on the field and sets the value of the // field to NULL, preventing any dangerous input. Short-circuit // validation for a hidden component (hidden by rules dependent upon // component on previous pages), or a component this is dependent upon // values on the current page, but is hidden based upon their current // values. - // 2) Only validate if the field has not been set by conditionals. + // 2. Only validate if the field has not been set by conditionals. // The user will be unable to fix the validation without surmising the // logic and changing the trigger for the conditional. Also, it isn't // possible to set $element['#value'] without component-specific @@ -3099,10 +3099,12 @@ function _webform_client_form_validate(&$elements, &$form_state, $form_id = NULL if (isset($elements['#needs_validation'])) { // Make sure a value is passed when the field is required. // A simple call to empty() will not cut it here as some fields, like - // checkboxes, can return a valid value of '0'. Instead, check the - // length if it's a string, and the item count if it's an array. For + // checkboxes, can return a valid value of 0. Instead, check the + // length if it's a string, and if it's an array whether it is empty. For // radios, FALSE means that no value was submitted, so check that too. - if ($elements['#required'] && (!count($elements['#value']) || (is_string($elements['#value']) && strlen(trim($elements['#value'])) == 0) || $elements['#value'] === FALSE)) { + $value_is_empty_string = is_string($elements['#value']) && strlen(trim($elements['#value'])) === 0; + $value_is_empty_array = is_array($elements['#value']) && !$elements['#value']; + if ($elements['#required'] && ($value_is_empty_string || $value_is_empty_array || $elements['#value'] === FALSE || $elements['#value'] === NULL)) { form_error($elements, t('!name field is required.', array('!name' => $elements['#title']))); } @@ -3297,12 +3299,12 @@ function webform_client_form_pages($form, &$form_state) { $current_page = $form_state['storage']['page_num']; if (isset($forward)) { - // Find the - // 1) previous/next non-empty page, or - // 2) the preview page, or - // 3) the preview page, forcing its display if the form would - // unexpectedly submit, or - // 4) page 1 even if empty, if no other previous page would be shown. + // Find the: + // 1. previous/next non-empty page, or + // 2. the preview page, or + // 3. the preview page, forcing its display if the form would unexpectedly + // submit, or + // 4. page 1 even if empty, if no other previous page would be shown. $preview_page_num = $form_state['storage']['page_count'] + (int) !$form_state['webform']['preview']; $page_num = $current_page; do { @@ -3601,9 +3603,9 @@ function template_preprocess_webform_confirmation(&$vars) { // Progress bar. $vars['progressbar'] = ''; - $page_labels = webform_page_labels($node); - $page_count = count($page_labels); - if ($node->webform['progressbar_include_confirmation'] && $page_count > 2) { + if ($node->webform['progressbar_include_confirmation']) { + $page_labels = webform_page_labels($node); + $page_count = count($page_labels); $vars['progressbar'] = theme('webform_progressbar', array( 'node' => $node, 'page_num' => $page_count, @@ -3738,7 +3740,6 @@ function theme_webform_element($variables) { $output = '<div ' . drupal_attributes($element['#wrapper_attributes']) . '>' . "\n"; $prefix = isset($element['#field_prefix']) ? '<span class="field-prefix">' . webform_filter_xss($element['#field_prefix']) . '</span> ' : ''; $suffix = isset($element['#field_suffix']) ? ' <span class="field-suffix">' . webform_filter_xss($element['#field_suffix']) . '</span>' : ''; - $children = ' ' . $prefix . $element['#children'] . $suffix; // Generate description for above or below the field. $above = !empty($element['#webform_component']['extra']['description_above']); @@ -3753,55 +3754,29 @@ function theme_webform_element($variables) { $variables['element']['#id'] = NULL; } - // Determine whether or not this element has form control children. If so, wrap them in a fieldset and use legend instead of label - $has_element_children = false; - $webform_fieldset_wrap = variable_get('webform_fieldset_wrap', false); - - if (!empty($webform_fieldset_wrap)) { - foreach (array_keys($element) as $key) { - if (substr($key, 0, 1) !== '#') { - $has_element_children = true; - break; - } - } - } - - if (!empty($has_element_children)) { - $output .= '<fieldset class="fieldset-invisible">'; - } - switch ($element['#title_display']) { case 'inline': + $output .= $description[$above]; + $description[$above] = ''; case 'before': case 'invisible': case 'after': - $output .= ' ' . $description[$above]; - $description[$above] = ''; - - if ($has_element_children) { - $title = '<legend>' . $element['#title']; - - if ($element['#required']) { - $title .= ' <span class="form-required" title="This field is required." aria-hidden="true">*</span>'; - } - - $title .= '</legend>'; - } - else { - $title = ' ' . theme('form_element_label', $variables); - } + $title = ' ' . theme('form_element_label', $variables); break; } + $children = ' ' . $description[$above] . $prefix . $element['#children'] . $suffix; switch ($element['#title_display']) { - case 'inline'; + case 'inline': case 'before': case 'invisible': - $output .= $title . $children; + $output .= $title; + $output .= $children; break; case 'after': - $output .= $children . $title; + $output .= $children; + $output .= $title; break; case 'none': @@ -3810,15 +3785,9 @@ function theme_webform_element($variables) { $output .= $children; break; } - $output .= "\n"; $output .= $description[!$above]; - - if ($has_element_children) { - $output .= '</fieldset>'; - } - $output .= "</div>\n"; return $output; @@ -4445,10 +4414,6 @@ function webform_variable_get($variable) { case 'webform_disabled_components': $result = variable_get('webform_disabled_components', array()); break; - - case 'webform_fieldset_wrap': - $result = variable_get('webform_fieldset_wrap', FALSE); - break; } return $result; } @@ -5219,12 +5184,12 @@ function webform_strtodate($format, $string, $timezone_name = NULL, $reference_t @$timezone = new DateTimeZone($timezone_name); if (isset($reference_timestamp)) { // A reference for relative dates has been provided. - // 1) Convert the reference timestamp (in UTC) to a DateTime. - // 2) Set to time zone to the user or system timezone, recreating - // the reference time in the appropriate time zone. - // 3) Set the time to midnight because when a non-referenced relative + // 1. Convert the reference timestamp (in UTC) to a DateTime. + // 2. Set to time zone to the user or system timezone, recreating the + // reference time in the appropriate time zone. + // 3. Set the time to midnight because when a non-referenced relative // date is created without a time, it is created at midnight (0:00). - // 4) Adjust to the specified relative (or absolute) time. + // 4. Adjust to the specified relative (or absolute) time. @$datetime = new DateTime('@' . $reference_timestamp); @$datetime->setTimezone($timezone) ->setTime(0, 0, 0) diff --git a/profiles/wcm_base/modules/contrib/webform/webform.tokens.inc b/profiles/wcm_base/modules/contrib/webform/webform.tokens.inc index d723cfe8448a09e95aaafeb0ebd1336725c82469..c1c1f1e9724abdafa13d0abe61c4fe7ee8867f35 100644 --- a/profiles/wcm_base/modules/contrib/webform/webform.tokens.inc +++ b/profiles/wcm_base/modules/contrib/webform/webform.tokens.inc @@ -64,15 +64,13 @@ function webform_token_info() { ); $info['tokens']['submission']['values'] = array( 'name' => t('Webform submission values'), - 'description' => '<div>' . t('Webform tokens from submitted data. Replace the "?" with the "form key", including any parent form keys separated by colons. You can append:') . '</div>' . - '<ul>' . + 'description' => '<div>' . t('Webform tokens from submitted data. Replace the "?" with the "form key", including any parent form keys separated by colons. You can append:') . '</div><ul>' . '<li>' . t('the question key for just that one question (grid components).') . '</li>' . '<li>' . t('the option key for just that one option (grid and select components).') . '</li>' . '<li>' . t('<code>@token</code> for the value without the label (the default).', array('@token' => ':nolabel')) . '</li>' . '<li>' . t('<code>@token</code> for just the label.', array('@token' => ':label')) . '</li>' . '<li>' . t('<code>@token</code> for both the label and value together.', array('@token' => ':withlabel')) . '</li>' . - '<li>' . t('<code>@token</code> for just the key in a key|label pair (grid and select components).', array('@token' => ':key')) . '</li>' . - '</ul>', + '<li>' . t('<code>@token</code> for just the key in a key|label pair (grid and select components).', array('@token' => ':key')) . '</li></ul>', 'dynamic' => TRUE, ); diff --git a/profiles/wcm_base/modules/contrib/wysiwyg/editors/ckeditor.inc b/profiles/wcm_base/modules/contrib/wysiwyg/editors/ckeditor.inc index 81c43f33a136c7bc80588ad4f9dbe3ce80b29335..252fa35d882b55ccd7ea0a11ac7e36cf4a5cc673 100644 --- a/profiles/wcm_base/modules/contrib/wysiwyg/editors/ckeditor.inc +++ b/profiles/wcm_base/modules/contrib/wysiwyg/editors/ckeditor.inc @@ -15,8 +15,8 @@ define('WYSIWYG_CKEDITOR_ACF_CUSTOM', 2); function wysiwyg_ckeditor_editor() { $editor['ckeditor'] = array( 'title' => 'CKEditor', - 'vendor url' => 'http://ckeditor.com', - 'download url' => 'http://ckeditor.com/download', + 'vendor url' => 'https://ckeditor.com', + 'download url' => 'https://ckeditor.com/download', 'libraries' => array( '' => array( 'title' => 'Default', @@ -32,7 +32,7 @@ function wysiwyg_ckeditor_editor() { ), ), 'install note callback' => 'wysiwyg_ckeditor_install_note', - 'verified version range' => array('3.0', '4.9.2.95e5d83'), + 'verified version range' => array('3.0', '4.11.2.7f3189e'), 'migrate settings callback' => 'wysiwyg_ckeditor_migrate_settings', 'version callback' => 'wysiwyg_ckeditor_version', 'themes callback' => 'wysiwyg_ckeditor_themes', @@ -444,6 +444,9 @@ function wysiwyg_ckeditor_settings_form_validate_stylessets($element, &$form_sta * script is loaded. */ function wysiwyg_ckeditor_init($editor) { + // Pass Drupal's JS cache-busting string via settings along to CKEditor. + drupal_add_js(array('wysiwyg' => array('ckeditor' => array('timestamp' => variable_get('css_js_query_string', '0')))), 'setting'); + // CKEditor unconditionally searches for its library filename in SCRIPT tags // on the page upon loading the library in order to determine the base path to // itself. When JavaScript aggregation is enabled, this search fails and all diff --git a/profiles/wcm_base/modules/contrib/wysiwyg/editors/epiceditor.inc b/profiles/wcm_base/modules/contrib/wysiwyg/editors/epiceditor.inc index 3565ff11d6c113553200e39f3a116e4d332b96f9..f39c0254023541c918c08cd8f2a9d9e79ae80c2b 100644 --- a/profiles/wcm_base/modules/contrib/wysiwyg/editors/epiceditor.inc +++ b/profiles/wcm_base/modules/contrib/wysiwyg/editors/epiceditor.inc @@ -11,8 +11,8 @@ function wysiwyg_epiceditor_editor() { $editor['epiceditor'] = array( 'title' => 'EpicEditor', - 'vendor url' => 'http://epiceditor.com', - 'download url' => 'http://epiceditor.com', + 'vendor url' => 'https://github.com/OscarGodson/EpicEditor', + 'download url' => 'https://github.com/OscarGodson/EpicEditor/releases/', 'libraries' => array( '' => array( 'title' => 'Minified', @@ -46,14 +46,19 @@ function wysiwyg_epiceditor_editor() { * @return * The installed editor version. */ -function wysiwyg_epiceditor_version($editor) { +function wysiwyg_epiceditor_version(&$editor) { $library = $editor['library path'] . '/js/epiceditor.js'; if (!file_exists($library)) { - return; + $library = $editor['library path'] . '/epiceditor/js/epiceditor.js'; + if (!file_exists($library)) { + return; + } + $editor['library path'] .= '/epiceditor'; + $editor['editor path'] .= '/epiceditor'; } // @todo Do not load the entire file; use fgets() instead. $library = file_get_contents($library, 'r'); - $version = preg_match('%EpicEditor\.version = \'(.*)\'\;%', $library, $matches); + preg_match('%EpicEditor\.version = \'(.*)\'\;%', $library, $matches); if (!isset($matches[1])) { return; } diff --git a/profiles/wcm_base/modules/contrib/wysiwyg/editors/fckeditor.inc b/profiles/wcm_base/modules/contrib/wysiwyg/editors/fckeditor.inc index 0a67a94bd66603146b834a87b434458252333d11..b0ee48d0869abf2174320943fb42b418c3c71102 100644 --- a/profiles/wcm_base/modules/contrib/wysiwyg/editors/fckeditor.inc +++ b/profiles/wcm_base/modules/contrib/wysiwyg/editors/fckeditor.inc @@ -11,8 +11,8 @@ function wysiwyg_fckeditor_editor() { $editor['fckeditor'] = array( 'title' => 'FCKeditor', - 'vendor url' => 'http://www.fckeditor.net', - 'download url' => 'http://www.fckeditor.net/download', + 'vendor url' => 'https://www.fckeditor.net', + 'download url' => 'https://www.fckeditor.net/download', 'libraries' => array( '' => array( 'title' => 'Default', diff --git a/profiles/wcm_base/modules/contrib/wysiwyg/editors/js/ckeditor-3.0.js b/profiles/wcm_base/modules/contrib/wysiwyg/editors/js/ckeditor-3.0.js index 70eebe462f8d1109a861c3bcf5ee4f42907460b1..86e6cb6c7c7429e1f83e9ca08b971242693fc169 100644 --- a/profiles/wcm_base/modules/contrib/wysiwyg/editors/js/ckeditor-3.0.js +++ b/profiles/wcm_base/modules/contrib/wysiwyg/editors/js/ckeditor-3.0.js @@ -21,6 +21,12 @@ var instanceMap; */ Drupal.wysiwyg.editor.init.ckeditor = function(settings, pluginInfo) { instanceMap = {}; + + // Manually set the cache-busting string to the same value as Drupal. + if (Drupal.settings.wysiwyg.ckeditor.hasOwnProperty('timestamp')) { + CKEDITOR.timestamp = Drupal.settings.wysiwyg.ckeditor.timestamp; + } + // Nothing to do here other than register new plugins etc. Drupal.wysiwyg.editor.update.ckeditor(settings, pluginInfo); }; diff --git a/profiles/wcm_base/modules/contrib/wysiwyg/editors/jwysiwyg.inc b/profiles/wcm_base/modules/contrib/wysiwyg/editors/jwysiwyg.inc index 9db269555a5f728ce4e9bafa7d992651f4025717..50b8eca160ac8a744a70f29f45da4e66d4ea61e5 100644 --- a/profiles/wcm_base/modules/contrib/wysiwyg/editors/jwysiwyg.inc +++ b/profiles/wcm_base/modules/contrib/wysiwyg/editors/jwysiwyg.inc @@ -11,8 +11,8 @@ function wysiwyg_jwysiwyg_editor() { $editor['jwysiwyg'] = array( 'title' => 'jWYSIWYG', - 'vendor url' => 'http://github.com/akzhan/jwysiwyg', - 'download url' => 'http://github.com/akzhan/jwysiwyg/tags', + 'vendor url' => 'https://github.com/jwysiwyg/jwysiwyg', + 'download url' => 'https://github.com/jwysiwyg/jwysiwyg/releases', 'libraries' => array( '' => array( 'title' => 'Source', @@ -26,7 +26,7 @@ function wysiwyg_jwysiwyg_editor() { // @todo Wrong property; add separate properties for editor requisites. 'css path' => wysiwyg_get_path('jwysiwyg'), 'versions' => array( - '0.97' => array( + '0.5' => array( 'js files' => array('jwysiwyg.js'), 'css files' => array('jquery.wysiwyg.css'), ), @@ -74,15 +74,20 @@ function wysiwyg_jwysiwyg_settings($editor, $config, $theme) { * @return * The installed editor version. */ -function wysiwyg_jwysiwyg_version($editor) { +function wysiwyg_jwysiwyg_version(&$editor) { $script = $editor['library path'] . '/jquery.wysiwyg.js'; if (!file_exists($script)) { - return; + $script = $editor['library path'] . '/jwysiwyg/jquery.wysiwyg.js'; + if (!file_exists($script)) { + return; + } + $editor['library path'] .= '/jwysiwyg'; + $editor['editor path'] .= '/jwysiwyg'; } $script = fopen($script, 'r'); fgets($script); $line = fgets($script); - if (preg_match('@([0-9\.]+)$@', $line, $version)) { + if (preg_match('@([0-9\.]+)\D*$@', $line, $version)) { fclose($script); return $version[1]; } diff --git a/profiles/wcm_base/modules/contrib/wysiwyg/editors/markitup.inc b/profiles/wcm_base/modules/contrib/wysiwyg/editors/markitup.inc index bb42c19fc22cc09902da04418e5c996cc01e4802..d99aa050d8474d2b41f2a0e1b1956b392386932f 100644 --- a/profiles/wcm_base/modules/contrib/wysiwyg/editors/markitup.inc +++ b/profiles/wcm_base/modules/contrib/wysiwyg/editors/markitup.inc @@ -11,8 +11,8 @@ function wysiwyg_markitup_editor() { $editor['markitup'] = array( 'title' => 'markItUp', - 'vendor url' => 'http://markitup.jaysalvat.com', - 'download url' => 'http://markitup.jaysalvat.com/downloads', + 'vendor url' => 'https://markitup.jaysalvat.com', + 'download url' => 'https://markitup.jaysalvat.com/downloads', 'library path' => wysiwyg_get_path('markitup'), 'libraries' => array( '' => array( diff --git a/profiles/wcm_base/modules/contrib/wysiwyg/editors/tinymce.inc b/profiles/wcm_base/modules/contrib/wysiwyg/editors/tinymce.inc index e60c47665823dca66a140492ca467e1b3fd349c9..a669dafce541ba48ac1091928bd67effab1a9a23 100644 --- a/profiles/wcm_base/modules/contrib/wysiwyg/editors/tinymce.inc +++ b/profiles/wcm_base/modules/contrib/wysiwyg/editors/tinymce.inc @@ -27,7 +27,7 @@ function wysiwyg_tinymce_editor() { ), ), 'version callback' => 'wysiwyg_tinymce_version', - 'verified version range' => array('3.3.9.2', '4.5.7'), + 'verified version range' => array('3.3.9.2', '4.9.3'), 'themes callback' => 'wysiwyg_tinymce_themes', 'settings form callback' => 'wysiwyg_tinymce_settings_form', 'init callback' => 'wysiwyg_tinymce_init', diff --git a/profiles/wcm_base/modules/contrib/wysiwyg/editors/wymeditor.inc b/profiles/wcm_base/modules/contrib/wysiwyg/editors/wymeditor.inc index 0e180cb3140c178beb825c90e8d3452d445d6174..e3fcab14f763c1621656b1c46d1b37fca6781e18 100644 --- a/profiles/wcm_base/modules/contrib/wysiwyg/editors/wymeditor.inc +++ b/profiles/wcm_base/modules/contrib/wysiwyg/editors/wymeditor.inc @@ -11,9 +11,8 @@ function wysiwyg_wymeditor_editor() { $editor['wymeditor'] = array( 'title' => 'WYMeditor', - 'vendor url' => 'http://wymeditor.github.io/wymeditor/', + 'vendor url' => 'https://wymeditor.github.io/wymeditor/', 'download url' => 'https://github.com/wymeditor/wymeditor/releases', - 'library path' => wysiwyg_get_path('wymeditor'), 'libraries' => array( 'min' => array( 'title' => 'Minified', @@ -32,15 +31,9 @@ function wysiwyg_wymeditor_editor() { 'plugin callback' => '_wysiwyg_wymeditor_plugins', 'versions' => array( '0.5-rc1' => array( - 'library path' => wysiwyg_get_path('wymeditor') . '/wymeditor', 'js files' => array('wymeditor.js'), ), '1.0.0a1' => array( - 'library path' => wysiwyg_get_path('wymeditor') . '/wymeditor', - 'js files' => array('wymeditor-1.js'), - 'css files' => array('wymeditor.css'), - ), - '1.0.0b5' => array( 'js files' => array('wymeditor-1.js'), 'css files' => array('wymeditor.css'), ), @@ -58,23 +51,22 @@ function wysiwyg_wymeditor_editor() { * @return * The installed editor version. */ -function wysiwyg_wymeditor_version($editor) { - $script = $editor['library path'] . '/wymeditor/jquery.wymeditor.js'; +function wysiwyg_wymeditor_version(&$editor) { + $script = $editor['library path'] . '/jquery.wymeditor.js'; if (!file_exists($script)) { - $script = $editor['library path'] . '/jquery.wymeditor.js'; + $script = $editor['library path'] . '/wymeditor/jquery.wymeditor.js'; if (!file_exists($script)) { return; } - } - if (!file_exists($script)) { - return; + $editor['library path'] .= '/wymeditor'; + $editor['editor path'] .= '/wymeditor'; } $script = fopen($script, 'r'); for ($i = 0; $i < 189; $i++) { $line = fgets($script); if (preg_match('@version\s+([0-9\.]+(?:-?[a-z0-9\.]+)?[^\.])@', $line, $version)) { fclose($script); - return $version[1]; + return trim($version[1]); } } fclose($script); @@ -148,7 +140,7 @@ function wysiwyg_wymeditor_settings($editor, $config, $theme) { 'skin' => $theme, ); if (version_compare($editor['installed version'], '1.0.0-b5', '>=')) { - drupal_add_css(wysiwyg_get_path('wymeditor') . '/skins/' . $settings['skin'] . '/skin.css'); + drupal_add_css($editor['library path'] . '/skins/' . $settings['skin'] . '/skin.css'); } else { // @todo Does not work in Drupal; jQuery can live anywhere. diff --git a/profiles/wcm_base/modules/contrib/wysiwyg/tests/wysiwyg_test.info b/profiles/wcm_base/modules/contrib/wysiwyg/tests/wysiwyg_test.info index cde50c5b2253dc4631ae9920bf626c25aa01824a..6dba9c68af6b8f9040b8a794234e3c951a2f0258 100644 --- a/profiles/wcm_base/modules/contrib/wysiwyg/tests/wysiwyg_test.info +++ b/profiles/wcm_base/modules/contrib/wysiwyg/tests/wysiwyg_test.info @@ -6,8 +6,8 @@ hidden = TRUE dependencies[] = wysiwyg files[] = wysiwyg_test.module -; Information added by Drupal.org packaging script on 2018-11-11 -version = "7.x-2.5+3-dev" +; Information added by Drupal.org packaging script on 2019-02-10 +version = "7.x-2.5+8-dev" core = "7.x" project = "wysiwyg" -datestamp = "1541897288" +datestamp = "1549817289" diff --git a/profiles/wcm_base/modules/contrib/wysiwyg/wysiwyg.admin.inc b/profiles/wcm_base/modules/contrib/wysiwyg/wysiwyg.admin.inc index 49e9af0c53c2a0ab197000b1e04131cbdc5506a0..aa50d098ce8f9190d08a34b05c871516e0e86133 100644 --- a/profiles/wcm_base/modules/contrib/wysiwyg/wysiwyg.admin.inc +++ b/profiles/wcm_base/modules/contrib/wysiwyg/wysiwyg.admin.inc @@ -543,7 +543,7 @@ function wysiwyg_profile_overview($form, &$form_state) { 'description' => (isset($editor['error']) ? $editor['error'] : ''), ); if (isset($editor['error'])) { - $severity = REQUIREMENT_ERROR; + $status[$name]['severity'] = REQUIREMENT_ERROR; } elseif ($editor['installed']) { $editor_options[$name] = check_plain($editor['title']) . ' ' . check_plain($editor['installed version']); diff --git a/profiles/wcm_base/modules/contrib/wysiwyg/wysiwyg.api.php b/profiles/wcm_base/modules/contrib/wysiwyg/wysiwyg.api.php index 7bc7ac4e4305b7c2fca59a161feb0d9bf85a0f14..77021ce1e1611659d200a36b2b4bb3fd99dd096c 100644 --- a/profiles/wcm_base/modules/contrib/wysiwyg/wysiwyg.api.php +++ b/profiles/wcm_base/modules/contrib/wysiwyg/wysiwyg.api.php @@ -174,6 +174,23 @@ function hook_INCLUDE_plugin() { return $plugins; } +/** + * Alter plugin definitions before loading and further processing. + * + * @param array $info + * The plugin definitions to alter. + * @param string $hook + * The plugin type being loaded. Can be 'editor' or 'plugin'. + */ +function hook_wysiwyg_load_includes_alter(&$info, $hook) { + if ($hook == 'editor' && isset($info['ckeditor'])) { + $info['ckeditor']['version callback'] = 'my_own_version_callback'; + } + elseif ($hook == 'plugin' && isset($info['break'])) { + $info['break']['title'] = t('Summary delimiter'); + } +} + /** * Define a Wysiwyg editor library. * diff --git a/profiles/wcm_base/modules/contrib/wysiwyg/wysiwyg.info b/profiles/wcm_base/modules/contrib/wysiwyg/wysiwyg.info index 51f4bce310988a72949fbe434e01aaf69c2a53f0..5a2ef06f48f445ed62dcfeb6e09b1b390ae52518 100644 --- a/profiles/wcm_base/modules/contrib/wysiwyg/wysiwyg.info +++ b/profiles/wcm_base/modules/contrib/wysiwyg/wysiwyg.info @@ -9,8 +9,8 @@ configure = admin/config/content/wysiwyg files[] = wysiwyg.module files[] = tests/wysiwyg.test -; Information added by Drupal.org packaging script on 2018-11-11 -version = "7.x-2.5+3-dev" +; Information added by Drupal.org packaging script on 2019-02-10 +version = "7.x-2.5+8-dev" core = "7.x" project = "wysiwyg" -datestamp = "1541897288" +datestamp = "1549817289" diff --git a/profiles/wcm_base/modules/contrib/wysiwyg/wysiwyg.module b/profiles/wcm_base/modules/contrib/wysiwyg/wysiwyg.module index c966294c6db381ba1b7f4792292abf90c3cca1f2..b0e946d9dc7e3f4fd0b90ada74a8e55f3e0d871f 100644 --- a/profiles/wcm_base/modules/contrib/wysiwyg/wysiwyg.module +++ b/profiles/wcm_base/modules/contrib/wysiwyg/wysiwyg.module @@ -1087,6 +1087,7 @@ function wysiwyg_get_all_editors() { 'editor path' => wysiwyg_get_path($editors[$editor]['name']), 'library path' => wysiwyg_get_path($editors[$editor]['name']), 'libraries' => array(), + 'installed' => FALSE, 'version callback' => NULL, 'themes callback' => NULL, 'settings form callback' => NULL, @@ -1098,7 +1099,7 @@ function wysiwyg_get_all_editors() { 'css path' => $editors[$editor]['path'] . '/css', ); // Check whether library is present. - if (!($editors[$editor]['installed'] = file_exists($editors[$editor]['library path']))) { + if (!$editors[$editor]['installed'] && !($editors[$editor]['installed'] = file_exists($editors[$editor]['library path']))) { // Find the latest supported version. ksort($editors[$editor]['versions']); $version = key($editors[$editor]['versions']); @@ -1146,9 +1147,7 @@ function wysiwyg_get_all_editors() { $editors[$editor] = array_merge($editors[$editor], $editors[$editor]['versions'][$version]); unset($editors[$editor]['versions']); } - drupal_alter('wysiwyg_editor', $editors); - return $editors; } @@ -1224,6 +1223,7 @@ function wysiwyg_load_includes($type = 'editors', $hook = 'editor', $file = NULL } } } + drupal_alter('wysiwyg_load_includes', $info, $hook); return $info; } diff --git a/profiles/wcm_base/modules/panopoly/panopoly_admin/CHANGELOG.txt b/profiles/wcm_base/modules/panopoly/panopoly_admin/CHANGELOG.txt index cf8e32bfafaae5c8604931f65d37e0db0fb8a86a..8ed31311badc968fd3bc23d7c8e5f326dfc26611 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_admin/CHANGELOG.txt +++ b/profiles/wcm_base/modules/panopoly/panopoly_admin/CHANGELOG.txt @@ -1,3 +1,11 @@ +7.x-1.62, 2019-02-21 +------------------- +- No changes since last release. + +7.x-1.61, 2019-02-13 +------------------- +- Update Administration Menu to admin_menu-7.x-3.0-rc6. + 7.x-1.60, 2019-01-23 ------------------- - No changes since last release. diff --git a/profiles/wcm_base/modules/panopoly/panopoly_admin/panopoly_admin.info b/profiles/wcm_base/modules/panopoly/panopoly_admin/panopoly_admin.info index b1dca7685910c61db51301209fb0514a2d331c66..eedc1e0aecaa34835dd85631ade79d9de320bb27 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_admin/panopoly_admin.info +++ b/profiles/wcm_base/modules/panopoly/panopoly_admin/panopoly_admin.info @@ -37,8 +37,8 @@ features[page_manager_pages][] = panopoly_admin_layout_library features[page_manager_pages][] = panopoly_admin_page_library features[page_manager_pages][] = panopoly_admin_pane_library -; Information added by Drupal.org packaging script on 2019-01-24 -version = "7.x-1.60" +; Information added by Drupal.org packaging script on 2019-02-21 +version = "7.x-1.62" core = "7.x" project = "panopoly_admin" -datestamp = "1548297491" +datestamp = "1550770999" diff --git a/profiles/wcm_base/modules/panopoly/panopoly_admin/panopoly_admin.make b/profiles/wcm_base/modules/panopoly/panopoly_admin/panopoly_admin.make index 181d0616300e1abdfb8f5b07936e3351f6cfc9c4..17bce3d3c48927f4d31770ff2108f68d4244ab21 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_admin/panopoly_admin.make +++ b/profiles/wcm_base/modules/panopoly/panopoly_admin/panopoly_admin.make @@ -40,9 +40,8 @@ projects[navbar][patch][2050559] = http://drupal.org/files/z-index-heart-cools-2 projects[breakpoints][version] = 1.6 projects[breakpoints][subdir] = contrib -projects[admin_menu][version] = 3.0-rc5 +projects[admin_menu][version] = 3.0-rc6 projects[admin_menu][subdir] = contrib -projects[admin_menu][patch][2929025] = https://www.drupal.org/files/issues/admin-menu-2929025-each-function-deprecated-php-7.2.patch ; jQuery Update was moved to Panopoly Core, but is left in Panopoly Admin's ; .make file to retain a stable 1.x branch of Panopoly. See the following URL diff --git a/profiles/wcm_base/modules/panopoly/panopoly_core/CHANGELOG.txt b/profiles/wcm_base/modules/panopoly/panopoly_core/CHANGELOG.txt index 8098f6d7f8bacc1733351dfd99dfbfa10426da6f..c7803635a84a4b5af855d388b87ec7f975a0c791 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_core/CHANGELOG.txt +++ b/profiles/wcm_base/modules/panopoly/panopoly_core/CHANGELOG.txt @@ -1,3 +1,13 @@ +7.x-1.62, 2019-02-21 +------------------- +- Update to link-7.x-1.6. + +7.x-1.61, 2019-02-13 +------------------- +- Update Administration Menu to admin_menu-7.x-3.0-rc6. +- Upgrade Link module to 1.5. +- Update Features to features-7.x-2.11. + 7.x-1.60, 2019-01-23 ------------------- - Update panels_breadcrumbs for SA-CONTRIB-2019-004. diff --git a/profiles/wcm_base/modules/panopoly/panopoly_core/panopoly_core.info b/profiles/wcm_base/modules/panopoly/panopoly_core/panopoly_core.info index be0d4cb56e2b5b45df761dc9a95c9bd0cb2aa285..1d4f8880f0c01c85869850d23b23831b548d3097 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_core/panopoly_core.info +++ b/profiles/wcm_base/modules/panopoly/panopoly_core/panopoly_core.info @@ -82,8 +82,8 @@ features_exclude[variable][panelizer_taxonomy_term:panopoly_categories_allowed_t features_exclude[variable][panelizer_defaults_taxonomy_term_panopoly_categories] = panelizer_defaults_taxonomy_term_panopoly_categories features_exclude[variable][pathauto_taxonomy_term_panopoly_categories_pattern] = pathauto_taxonomy_term_panopoly_categories_pattern -; Information added by Drupal.org packaging script on 2019-01-24 -version = "7.x-1.60" +; Information added by Drupal.org packaging script on 2019-02-21 +version = "7.x-1.62" core = "7.x" project = "panopoly_core" -datestamp = "1548297503" +datestamp = "1550771011" diff --git a/profiles/wcm_base/modules/panopoly/panopoly_core/panopoly_core.make b/profiles/wcm_base/modules/panopoly/panopoly_core/panopoly_core.make index 8ca2c73c6363ca31b07d639772b5aacd9c5a7b58..677a7762625e4e1c2768dd4f6d83b69e8600109c 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_core/panopoly_core.make +++ b/profiles/wcm_base/modules/panopoly/panopoly_core/panopoly_core.make @@ -25,6 +25,7 @@ projects[panelizer][patch][2788851] = https://www.drupal.org/files/issues/paneli projects[fieldable_panels_panes][version] = 1.11 projects[fieldable_panels_panes][subdir] = contrib projects[fieldable_panels_panes][patch][2826205] = https://www.drupal.org/files/issues/fieldable_panels_panes-n2826205-39.patch +projects[fieldable_panels_panes][patch][3019270] = https://www.drupal.org/files/issues/2018-12-10/2848997-cant-access-admin-too-many-redirects.patch projects[pm_existing_pages][version] = 1.4 projects[pm_existing_pages][subdir] = contrib @@ -77,9 +78,9 @@ projects[entityreference][subdir] = contrib projects[field_group][version] = 1.6 projects[field_group][subdir] = contrib -projects[link][version] = 1.4 +projects[link][version] = 1.6 projects[link][subdir] = contrib -projects[link][patch][2666912] = https://www.drupal.org/files/issues/revert-url-validation-2666912.patch +projects[link][patch][2666912] = https://www.drupal.org/files/issues/2019-01-24/link-revert_url_validation-2666912-7.x-1.5.patch ; Harness the Power of Features and Apps with Default Content @@ -87,9 +88,8 @@ projects[apps][version] = 1.1 projects[apps][subdir] = contrib projects[apps][patch][2945929] = https://www.drupal.org/files/issues/apps-php7-compat-2945929.patch -projects[features][version] = 2.10 +projects[features][version] = 2.11 projects[features][subdir] = contrib -projects[features][patch][2931464] = "https://www.drupal.org/files/issues/features-create_function-is-deprecated-2931464-5.patch" projects[strongarm][version] = 2.0 projects[strongarm][subdir] = contrib diff --git a/profiles/wcm_base/modules/panopoly/panopoly_magic/CHANGELOG.txt b/profiles/wcm_base/modules/panopoly/panopoly_magic/CHANGELOG.txt index fb2cc5c4c387c5c3f230b455815041d160995285..12af7822b88e617b2d96da232c266b0262fb3d29 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_magic/CHANGELOG.txt +++ b/profiles/wcm_base/modules/panopoly/panopoly_magic/CHANGELOG.txt @@ -1,3 +1,11 @@ +7.x-1.62, 2019-02-21 +------------------- +- No changes since last release. + +7.x-1.61, 2019-02-13 +------------------- +- Add descriptions to Single Preview mode in Panopoly Magic. + 7.x-1.60, 2019-01-23 ------------------- - No changes since last release. diff --git a/profiles/wcm_base/modules/panopoly/panopoly_magic/css/panopoly-modal.css b/profiles/wcm_base/modules/panopoly/panopoly_magic/css/panopoly-modal.css index 384e27e458d92869e87991d5ce2feb41b6dc691b..bb3e6ddc8a359a6bd9afc94093acceab8c1a7915 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_magic/css/panopoly-modal.css +++ b/profiles/wcm_base/modules/panopoly/panopoly_magic/css/panopoly-modal.css @@ -613,7 +613,7 @@ #modal-content .panopoly-magic-preview-link > a { background: transparent; border: none; - color: #666; + color: inherit; text-shadow: none; margin: 0; padding: 0px 10px 0px 10px; @@ -621,15 +621,15 @@ cursor: pointer; } -#modal-content .panopoly-magic-preview-link > a:hover, -#modal-content .panopoly-magic-preview-link > a:focus { - color: #000; -} - #modal-content .panopoly-magic-preview-link:hover { background-color: #f1f1f1; } +#modal-content .panopoly-magic-preview-link > .help-block { + color: #666; + padding: 0px 10px 0px 10px; +} + #modal-content .panopoly-magic-preview-link:hover .content-type-button a, #modal-content .panopoly-magic-preview-link > a:focus + .content-type-button a, #modal-content .panopoly-magic-preview-link .content-type-button a:focus { diff --git a/profiles/wcm_base/modules/panopoly/panopoly_magic/panopoly_magic.info b/profiles/wcm_base/modules/panopoly/panopoly_magic/panopoly_magic.info index 08c2c4a913d0ece3e9918c2ab113eb254fe2167e..cf44179b06b82e21bb6f5edec86e7add3c200c2f 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_magic/panopoly_magic.info +++ b/profiles/wcm_base/modules/panopoly/panopoly_magic/panopoly_magic.info @@ -15,8 +15,8 @@ stylesheets[all][] = css/panopoly-modal.css features[features_api][] = api:2 files[] = plugins/views/panopoly_magic_plugin_display_panel_pane.inc -; Information added by Drupal.org packaging script on 2019-01-24 -version = "7.x-1.60" +; Information added by Drupal.org packaging script on 2019-02-21 +version = "7.x-1.62" core = "7.x" project = "panopoly_magic" -datestamp = "1548297538" +datestamp = "1550771048" diff --git a/profiles/wcm_base/modules/panopoly/panopoly_magic/panopoly_magic.install b/profiles/wcm_base/modules/panopoly/panopoly_magic/panopoly_magic.install index 454de69943e1a3e5eda7e770905f0363bcb1029e..4b356bf0bc80845f94ef0803e505deed7ad67794 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_magic/panopoly_magic.install +++ b/profiles/wcm_base/modules/panopoly/panopoly_magic/panopoly_magic.install @@ -82,3 +82,12 @@ function panopoly_magic_update_7105() { } } } + +/** + * Preserve the old behavior for showing descriptions in single preview mode. + */ +function panopoly_magic_update_7106() { + if (variable_get('panopoly_magic_pane_show_description', 'not set') === 'not set') { + variable_set('panopoly_magic_pane_show_description', 0); + } +} diff --git a/profiles/wcm_base/modules/panopoly/panopoly_magic/panopoly_magic.module b/profiles/wcm_base/modules/panopoly/panopoly_magic/panopoly_magic.module index cd98ac643a067e9a86661c2231246f1bc294c9d5..42bace16656133e8064932a41eacd7f0273c0fce 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_magic/panopoly_magic.module +++ b/profiles/wcm_base/modules/panopoly/panopoly_magic/panopoly_magic.module @@ -126,7 +126,8 @@ function panopoly_magic_theme($existing, $type, $theme, $path) { 'panopoly_magic_preview_link' => array( 'variables' => array( 'preview_link' => NULL, - 'add_link' => NULL + 'add_link' => NULL, + 'description' => '' ), ), ); @@ -175,6 +176,18 @@ function panopoly_magic_configure_form($form, &$form_state) { '#description' => t('Do you want to automatically generate previews when adding existing panels panes through the IPE?'), ); + $form['panopoly_magic_pane_show_description'] = array( + '#title' => t('Show pane descriptions when previews are in Single mode'), + '#type' => 'checkbox', + '#states' => array( + 'visible' => array( + ':input[name="panopoly_magic_pane_add_preview"]' => array('value' => PANOPOLY_ADD_PREVIEW_SINGLE), + ), + ), + '#default_value' => variable_get('panopoly_magic_pane_show_description', 1), + '#description' => t('Do you want to show text descriptions for available panes in the Add Content dialog when previews are in Single mode?'), + ); + $form['panopoly_magic_show_panels_styles'] = array( '#title' => t('Show seldom used panels pane styles'), '#type' => 'select', @@ -1763,6 +1776,9 @@ function theme_panopoly_magic_preview_link($vars) { $html .= '<div class="' . $classes . '">'; $html .= $vars['preview_link']; $html .= $vars['add_link']; + if (!empty($vars['description'])) { + $html .= '<div class="help-block">' . $vars['description'] . '</div>'; + } $html .= '</div>'; return $html; } @@ -1802,11 +1818,13 @@ function panopoly_magic_process_panels_add_content_modal(&$vars) { $legend_title = !empty($title) ? $title : t('Select a widget to show its preview'); $add_content_link = !empty($title) ? _panopoly_magic_render_add_content_link($vars, $content[$title], $title) : ''; $preview = !empty($vars['preview_single']) ? $vars['preview_single'] : t('No Preview'); + $description = !empty($content[$title]['description']) && variable_get('panopoly_magic_pane_show_description', 1) ? $content[$title]['description'] : ''; $vars['columns'][0] = theme('panopoly_magic_preview', array( 'title' => $legend_title, 'add_link' => $add_content_link, 'preview' => $preview, + 'description' => $description, )); } @@ -1817,11 +1835,13 @@ function panopoly_magic_process_panels_add_content_modal(&$vars) { $legend_title = $content[$title]['title']; $add_content_link = _panopoly_magic_render_add_content_link($vars, $content[$title], $title); + $description = !empty($content[$title]['description']) && variable_get('panopoly_magic_pane_show_description', 1) ? $content[$title]['description'] : ''; if ($use_preview == PANOPOLY_ADD_PREVIEW_SINGLE) { $vars['columns'][$which] .= theme('panopoly_magic_preview_link', array( 'preview_link' => $legend_title, 'add_link' => $add_content_link, + 'description' => $description, )); } else { diff --git a/profiles/wcm_base/modules/panopoly/panopoly_pages/CHANGELOG.txt b/profiles/wcm_base/modules/panopoly/panopoly_pages/CHANGELOG.txt index 7561568496056eddfe307eaa74496d684c492824..5cbaf535ba9f423d1911dfd7b06e259583540b8e 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_pages/CHANGELOG.txt +++ b/profiles/wcm_base/modules/panopoly/panopoly_pages/CHANGELOG.txt @@ -1,3 +1,11 @@ +7.x-1.62, 2019-02-21 +------------------- +- No changes since last release. + +7.x-1.61, 2019-02-13 +------------------- +- No changes since last release. + 7.x-1.60, 2019-01-23 ------------------- - No changes since last release. diff --git a/profiles/wcm_base/modules/panopoly/panopoly_pages/panopoly_pages.info b/profiles/wcm_base/modules/panopoly/panopoly_pages/panopoly_pages.info index 63dc06445d01735153f362e59967cac2b84df36c..30ffe2c05afcc66824cc5fc6ab32ef52589971fc 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_pages/panopoly_pages.info +++ b/profiles/wcm_base/modules/panopoly/panopoly_pages/panopoly_pages.info @@ -81,8 +81,8 @@ features_exclude[variable][pathauto_node_panopoly_landing_page_pattern] = pathau features_exclude[variable][pathauto_node_panopoly_page_pattern] = pathauto_node_panopoly_page_pattern features_exclude[variable][pathauto_taxonomy_term_panopoly_categories_pattern] = pathauto_taxonomy_term_panopoly_categories_pattern -; Information added by Drupal.org packaging script on 2019-01-24 -version = "7.x-1.60" +; Information added by Drupal.org packaging script on 2019-02-21 +version = "7.x-1.62" core = "7.x" project = "panopoly_pages" -datestamp = "1548297550" +datestamp = "1550771065" diff --git a/profiles/wcm_base/modules/panopoly/panopoly_search/CHANGELOG.txt b/profiles/wcm_base/modules/panopoly/panopoly_search/CHANGELOG.txt index 31f7790feaf21d7141b95d7bb24823f0fcfe4291..61267e75f5db464c760a426504e5bd87fa14e655 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_search/CHANGELOG.txt +++ b/profiles/wcm_base/modules/panopoly/panopoly_search/CHANGELOG.txt @@ -1,3 +1,11 @@ +7.x-1.62, 2019-02-21 +------------------- +- No changes since last release. + +7.x-1.61, 2019-02-13 +------------------- +- No changes since last release. + 7.x-1.60, 2019-01-23 ------------------- - No changes since last release. diff --git a/profiles/wcm_base/modules/panopoly/panopoly_search/panopoly_search.info b/profiles/wcm_base/modules/panopoly/panopoly_search/panopoly_search.info index 022e582a6ecd9113785b1d39a7f0e8d4ae20ddd2..14bf82b13931d41a5f370926ed4c2ff915928b57 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_search/panopoly_search.info +++ b/profiles/wcm_base/modules/panopoly/panopoly_search/panopoly_search.info @@ -54,8 +54,8 @@ features[variable][] = search_cron_limit features[views_view][] = panopoly_database_search features[views_view][] = panopoly_search -; Information added by Drupal.org packaging script on 2019-01-24 -version = "7.x-1.60" +; Information added by Drupal.org packaging script on 2019-02-21 +version = "7.x-1.62" core = "7.x" project = "panopoly_search" -datestamp = "1548297561" +datestamp = "1550771081" diff --git a/profiles/wcm_base/modules/panopoly/panopoly_test/CHANGELOG.txt b/profiles/wcm_base/modules/panopoly/panopoly_test/CHANGELOG.txt index 0cbdc461bc5db4c096734fbc75d0ef3f148ce3fe..8072fdba75c7a914861fb8092ce84517aa4d0391 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_test/CHANGELOG.txt +++ b/profiles/wcm_base/modules/panopoly/panopoly_test/CHANGELOG.txt @@ -1,3 +1,11 @@ +7.x-1.62, 2019-02-21 +------------------- +- No changes since last release. + +7.x-1.61, 2019-02-13 +------------------- +- No changes since last release. + 7.x-1.60, 2019-01-23 ------------------- - No changes since last release. diff --git a/profiles/wcm_base/modules/panopoly/panopoly_test/panopoly_test.info b/profiles/wcm_base/modules/panopoly/panopoly_test/panopoly_test.info index 8fb6f8c45d9ba8c2c4cb828f9c48482099db53ea..a4b71f0ef8e5ab0462ff649fc2d799fb8ab7ba05 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_test/panopoly_test.info +++ b/profiles/wcm_base/modules/panopoly/panopoly_test/panopoly_test.info @@ -99,8 +99,8 @@ features_exclude[dependencies][panopoly_pages] = panopoly_pages features_exclude[dependencies][panelizer] = panelizer hidden = 1 -; Information added by Drupal.org packaging script on 2019-01-24 -version = "7.x-1.60" +; Information added by Drupal.org packaging script on 2019-02-21 +version = "7.x-1.62" core = "7.x" project = "panopoly_test" -datestamp = "1548297571" +datestamp = "1550771100" diff --git a/profiles/wcm_base/modules/panopoly/panopoly_theme/CHANGELOG.txt b/profiles/wcm_base/modules/panopoly/panopoly_theme/CHANGELOG.txt index 2f6c9d32aa8dc805be0ab6aab8f84c9f86eb5272..a1e7c78aadddab157aa1be3642536453145658cd 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_theme/CHANGELOG.txt +++ b/profiles/wcm_base/modules/panopoly/panopoly_theme/CHANGELOG.txt @@ -1,3 +1,11 @@ +7.x-1.62, 2019-02-21 +------------------- +- No changes since last release. + +7.x-1.61, 2019-02-13 +------------------- +- No changes since last release. + 7.x-1.60, 2019-01-23 ------------------- - No changes since last release. diff --git a/profiles/wcm_base/modules/panopoly/panopoly_theme/panopoly_theme.info b/profiles/wcm_base/modules/panopoly/panopoly_theme/panopoly_theme.info index e53cc51d350075b69a20ced2953c7058882b8f9e..a2d0601467c292cdcb02df8485a246908e39fe4c 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_theme/panopoly_theme.info +++ b/profiles/wcm_base/modules/panopoly/panopoly_theme/panopoly_theme.info @@ -11,8 +11,8 @@ stylesheets[all][] = css/panopoly-accordian.css stylesheets[all][] = css/panopoly-layouts.css features[features_api][] = api:2 -; Information added by Drupal.org packaging script on 2019-01-24 -version = "7.x-1.60" +; Information added by Drupal.org packaging script on 2019-02-21 +version = "7.x-1.62" core = "7.x" project = "panopoly_theme" -datestamp = "1548297583" +datestamp = "1550771119" diff --git a/profiles/wcm_base/modules/panopoly/panopoly_widgets/CHANGELOG.txt b/profiles/wcm_base/modules/panopoly/panopoly_widgets/CHANGELOG.txt index 0cf51de82cfe18fe12afeabb324eeaafcfd5f8a0..a15ce0f37c9fe20e50391e2083561d2904de75ba 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_widgets/CHANGELOG.txt +++ b/profiles/wcm_base/modules/panopoly/panopoly_widgets/CHANGELOG.txt @@ -1,3 +1,14 @@ +7.x-1.62, 2019-02-21 +------------------- +- No changes since last release. + +7.x-1.61, 2019-02-13 +------------------- +- PHP Errors are generated when deleted FPP objects do not exist. +- Update TableField to tablefield-7.x-3.2. +- Update Menu Block to menu_block-7.x-2.8. +- Upgrade File Entity (file_entity) to 7.x-2.25. + 7.x-1.60, 2019-01-23 ------------------- - No changes since last release. diff --git a/profiles/wcm_base/modules/panopoly/panopoly_widgets/panopoly_widgets.info b/profiles/wcm_base/modules/panopoly/panopoly_widgets/panopoly_widgets.info index afd6023d89c247631b6e314385db098e14369759..a681d4fd1abaef703270c1f63bf1cd6b0825200b 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_widgets/panopoly_widgets.info +++ b/profiles/wcm_base/modules/panopoly/panopoly_widgets/panopoly_widgets.info @@ -125,8 +125,8 @@ features[linkit_profiles][] = content_fields features[views_view][] = panopoly_widgets_general_content features_exclude[dependencies][linkit] = linkit -; Information added by Drupal.org packaging script on 2019-01-24 -version = "7.x-1.60" +; Information added by Drupal.org packaging script on 2019-02-21 +version = "7.x-1.62" core = "7.x" project = "panopoly_widgets" -datestamp = "1548297607" +datestamp = "1550771155" diff --git a/profiles/wcm_base/modules/panopoly/panopoly_widgets/panopoly_widgets.make b/profiles/wcm_base/modules/panopoly/panopoly_widgets/panopoly_widgets.make index 25bad686c6d06ba474e1ca1e1aa1980c9d41da73..18eb74fe3fa712d11fd064bfddaafdb5f2513189 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_widgets/panopoly_widgets.make +++ b/profiles/wcm_base/modules/panopoly/panopoly_widgets/panopoly_widgets.make @@ -5,9 +5,8 @@ core = 7.x ; Panopoly - Contrib - Fields -projects[tablefield][version] = 3.1 +projects[tablefield][version] = 3.2 projects[tablefield][subdir] = contrib -projects[tablefield][patch][2923462] = https://www.drupal.org/files/issues/tablefield-7.x-3.1-duplicate-ids-2923462-14.patch projects[simple_gmap][version] = 1.4 projects[simple_gmap][subdir] = contrib @@ -15,12 +14,12 @@ projects[simple_gmap][patch][2902178] = https://www.drupal.org/files/issues/simp ; Panopoly - Contrib - Widgets -projects[menu_block][version] = 2.7 +projects[menu_block][version] = 2.8 projects[menu_block][subdir] = contrib ; Panopoly - Contrib - Files & Media -projects[file_entity][version] = 2.22 +projects[file_entity][version] = 2.25 projects[file_entity][subdir] = contrib projects[media][version] = 2.21 diff --git a/profiles/wcm_base/modules/panopoly/panopoly_widgets/panopoly_widgets.module b/profiles/wcm_base/modules/panopoly/panopoly_widgets/panopoly_widgets.module index 7083527165a898321b8bf1281497b485e639c264..400fb27168f8679992a605064b6914f50fa2f041 100644 --- a/profiles/wcm_base/modules/panopoly/panopoly_widgets/panopoly_widgets.module +++ b/profiles/wcm_base/modules/panopoly/panopoly_widgets/panopoly_widgets.module @@ -190,32 +190,38 @@ function panopoly_widgets_get_required_file_fields($bundle) { * Render callback for fieldable panels panes. */ function panopoly_widgets_fieldable_panels_pane_render($subtype, $conf, $panels_args = array(), $context = array()) { - $entity = fieldable_panels_panes_load_from_subtype($subtype); - - // If the entity has some required file fields, check them. - $required_file_fields = panopoly_widgets_get_required_file_fields($entity->bundle); - $missing_required = FALSE; - if (!empty($required_file_fields)) { - foreach ($required_file_fields as $required_file_field) { - $items = field_get_items('fieldable_panels_pane', $entity, $required_file_field); - - // Check if the required file field is empty or the file doesn't exist. - if (empty($items[0]) || empty($items[0]['fid']) || !file_load($items[0]['fid'])) { - $missing_required = TRUE; - break; + ctools_include('content'); + $plugin = ctools_get_content_type('fieldable_panels_pane'); + + // Need to first ensure that this is a valid subtype. + $subtype_info = ctools_content_get_subtype($plugin, $subtype); + if (!empty($subtype_info)) { + $entity = fieldable_panels_panes_load_from_subtype($subtype); + + // If the entity has some required file fields, check them. + $required_file_fields = panopoly_widgets_get_required_file_fields($entity->bundle); + $missing_required = FALSE; + if (!empty($required_file_fields)) { + foreach ($required_file_fields as $required_file_field) { + $items = field_get_items('fieldable_panels_pane', $entity, $required_file_field); + + // Check if the required file field is empty or the file doesn't exist. + if (empty($items[0]) || empty($items[0]['fid']) || !file_load($items[0]['fid'])) { + $missing_required = TRUE; + break; + } } } - } - // If a required file field is missing, then we return nothing. - if ($missing_required) { - return NULL; - } + // If a required file field is missing, then we return nothing. + if ($missing_required) { + return NULL; + } - // Otherwise, hand off to the original render callback. - $plugin = ctools_get_content_type('fieldable_panels_pane'); - $original_render_callback = $plugin['original render callback']; - return $original_render_callback($subtype, $conf, $panels_args, $context); + // Otherwise, hand off to the original render callback. + $original_render_callback = $plugin['original render callback']; + return $original_render_callback($subtype, $conf, $panels_args, $context); + } } /** diff --git a/profiles/wcm_base/wcm_base.make b/profiles/wcm_base/wcm_base.make index 33d0cc29d9a9818295011072fc70105b35225445..d9df5b3e1d903bfe7cdd62ddc2e8bdad6be2bd73 100644 --- a/profiles/wcm_base/wcm_base.make +++ b/profiles/wcm_base/wcm_base.make @@ -72,9 +72,8 @@ projects[google_tag][subdir] = contrib projects[jquery_update][version] = 3.0-alpha5 projects[jquery_update][subdir] = contrib -projects[link][version] = 1.4 +projects[link][version] = 1.6 projects[link][subdir] = contrib -projects[link][patch][1993920] = http://drupal.org/files/issues/link.allow-tel-links-1993920-6.patch projects[linkchecker][version] = 1.x-dev projects[linkchecker][subdir] = contrib @@ -191,9 +190,8 @@ projects[views_bulk_operations][subdir] = contrib projects[views_nested_accordion][version] = 1.0 projects[views_nested_accordion][subdir] = contrib -projects[webform][version] = 4.17 +projects[webform][version] = 4.19 projects[webform][subdir] = contrib -projects[webform][patch][1147994] = http://drupal.org/files/issues/2018-05-09/webform-component_fieldsets-1147994-37-D7.patch projects[webform_reply_to] = 2.0 projects[webform_reply_to][subdir] = contrib @@ -486,31 +484,31 @@ libraries[ocio_modernizr][download][branch] = 7.x-1.x ; The Panopoly Foundation -projects[panopoly_core][version] = 1.60 +projects[panopoly_core][version] = 1.62 projects[panopoly_core][subdir] = panopoly -projects[panopoly_theme][version] = 1.60 +projects[panopoly_theme][version] = 1.62 projects[panopoly_theme][subdir] = panopoly -projects[panopoly_magic][version] = 1.60 +projects[panopoly_magic][version] = 1.62 projects[panopoly_magic][subdir] = panopoly -projects[panopoly_widgets][version] = 1.60 +projects[panopoly_widgets][version] = 1.62 projects[panopoly_widgets][subdir] = panopoly -projects[panopoly_admin][version] = 1.60 +projects[panopoly_admin][version] = 1.62 projects[panopoly_admin][subdir] = panopoly ; The Panopoly Toolset -projects[panopoly_pages][version] = 1.60 +projects[panopoly_pages][version] = 1.62 projects[panopoly_pages][subdir] = panopoly -projects[panopoly_search][version] = 1.60 +projects[panopoly_search][version] = 1.62 projects[panopoly_search][subdir] = panopoly ; For running the automated tests. -projects[panopoly_test][version] = 1.60 +projects[panopoly_test][version] = 1.62 projects[panopoly_test][subdir] = panopoly diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php old mode 100644 new mode 100755 index 7c534a4811bab28859e972ec0181c2fccc29176d..da45fc361292b917822909fa1c659c4277fccf17 --- a/sites/default/default.settings.php +++ b/sites/default/default.settings.php @@ -654,3 +654,17 @@ $conf['404_fast_html'] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" * @see drupal_clean_css_identifier() */ # $conf['allow_css_double_underscores'] = TRUE; + +/** + * The default list of directories that will be ignored by Drupal's file API. + * + * By default ignore node_modules and bower_components folders to avoid issues + * with common frontend tools and recursive scanning of directories looking for + * extensions. + * + * @see file_scan_directory() + */ +$conf['file_scan_ignore_directories'] = array( + 'node_modules', + 'bower_components', +);