diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 4adf5a43c5..8a567dc062 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,19 @@ +Drupal 7.xx, xxxx-xx-xx (development version) +----------------------- + +Drupal 7.65, 2019-03-20 +----------------------- +- Fixed security issues: + - SA-CORE-2019-004 + +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 f484fce265..1b5c53408f 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -8,7 +8,7 @@ /** * The current system version. */ -define('VERSION', '7.63'); +define('VERSION', '7.65'); /** * Core API compatibility. diff --git a/includes/common.inc b/includes/common.inc index a7d95656ab..af87660be0 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 155eadac77..5b13aaff48 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -997,8 +997,15 @@ function file_build_uri($path) { * @return * The destination filepath, or FALSE if the file already exists * and FILE_EXISTS_ERROR is specified. + * + * @throws RuntimeException + * Thrown if the filename contains invalid UTF-8. */ function file_destination($destination, $replace) { + $basename = drupal_basename($destination); + if (!drupal_validate_utf8($basename)) { + throw new RuntimeException(sprintf("Invalid filename '%s'", $basename)); + } if (file_exists($destination)) { switch ($replace) { case FILE_EXISTS_REPLACE: @@ -1006,7 +1013,6 @@ function file_destination($destination, $replace) { break; case FILE_EXISTS_RENAME: - $basename = drupal_basename($destination); $directory = drupal_dirname($destination); $destination = file_create_filename($basename, $directory); break; @@ -1222,11 +1228,20 @@ function file_unmunge_filename($filename) { * @return * File path consisting of $directory and a unique filename based off * of $basename. + * + * @throws RuntimeException + * Thrown if the $basename is not valid UTF-8 or another error occurs + * stripping control characters. */ function file_create_filename($basename, $directory) { + $original = $basename; // Strip control characters (ASCII value < 32). Though these are allowed in // some filesystems, not many applications handle them well. $basename = preg_replace('/[\x00-\x1F]/u', '_', $basename); + if (preg_last_error() !== PREG_NO_ERROR) { + throw new RuntimeException(sprintf("Invalid filename '%s'", $original)); + } + if (substr(PHP_OS, 0, 3) == 'WIN') { // These characters are not allowed in Windows filenames $basename = str_replace(array(':', '*', '?', '"', '<', '>', '|'), '_', $basename); @@ -1567,7 +1582,13 @@ function file_save_upload($form_field_name, $validators = array(), $destination if (substr($destination, -1) != '/') { $destination .= '/'; } - $file->destination = file_destination($destination . $file->filename, $replace); + try { + $file->destination = file_destination($destination . $file->filename, $replace); + } + catch (RuntimeException $e) { + drupal_set_message(t('The file %source could not be uploaded because the name is invalid.', array('%source' => $form_field_name)), 'error'); + return FALSE; + } // If file_destination() returns FALSE then $replace == FILE_EXISTS_ERROR and // there's an existing file so we need to bail. if ($file->destination === FALSE) { @@ -2134,9 +2155,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 29a1fca8cc..ee678e891b 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 839da36c37..db225855bf 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 d592381bd5..fc1a1df200 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 f764a90332..849451a558 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 0000000000..e69de29bb2 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 0000000000..e69de29bb2 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 0000000000..e69de29bb2 diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index 3124ffe82a..a0872c234a 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -3012,7 +3012,7 @@ protected function assertRaw($raw, $message = '', $group = 'Other') { 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 @@ protected function assertNoRaw($raw, $message = '', $group = 'Other') { 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 16ac1714f6..effd04bf2f 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/simpletest/tests/file.test b/modules/simpletest/tests/file.test index 55dd1906ee..032f2cbac5 100644 --- a/modules/simpletest/tests/file.test +++ b/modules/simpletest/tests/file.test @@ -957,6 +957,15 @@ class FileDirectoryTest extends FileTestCase { $path = file_create_filename($basename, $directory); $this->assertEqual($path, $expected, format_string('Creating a new filepath from %original equals %new.', array('%new' => $path, '%original' => $original)), 'File'); + try { + $filename = "a\xFFtest\x80€.txt"; + file_create_filename($filename, $directory); + $this->fail('Expected exception not thrown'); + } + catch (RuntimeException $e) { + $this->assertEqual("Invalid filename '$filename'", $e->getMessage()); + } + // @TODO: Finally we copy a file into a directory several times, to ensure a properly iterating filename suffix. } @@ -989,6 +998,14 @@ class FileDirectoryTest extends FileTestCase { $this->assertNotEqual($path, $destination, 'A new filepath destination is created when filepath destination already exists with FILE_EXISTS_RENAME.', 'File'); $path = file_destination($destination, FILE_EXISTS_ERROR); $this->assertEqual($path, FALSE, 'An error is returned when filepath destination already exists with FILE_EXISTS_ERROR.', 'File'); + + try { + file_destination("core/misc/a\xFFtest\x80€.txt", FILE_EXISTS_REPLACE); + $this->fail('Expected exception not thrown'); + } + catch (RuntimeException $e) { + $this->assertEqual("Invalid filename 'a\xFFtest\x80€.txt'", $e->getMessage()); + } } /** diff --git a/modules/system/system.install b/modules/system/system.install index a4f24a75c2..862436429e 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/openasu/CHANGELOG.txt b/profiles/openasu/CHANGELOG.txt index 3b2d7a624f..84b87d39d5 100644 --- a/profiles/openasu/CHANGELOG.txt +++ b/profiles/openasu/CHANGELOG.txt @@ -1,8 +1,53 @@ -Webspark 1.60 (Minnesota) release ---------------------------------- +Webspark 1.64 (California) release, 2019-03-25 +---------------------------------------------- +- Webspark core + + * Drupal (v7.65) + * This release fixes security vulnerabilities. See https://www.drupal.org/project/drupal/releases/7.65 for more details. + * Panopoly (v1.64) + * Multiple Panopoly releases (1.61-1.64) rolled into one update; Includes updates to contrib modules. See https://www.drupal.org/project/panopoly/releases/7.x-1.64 for more info. + +- Web standards components in Webspark + + * ASU Academic Programs (v2.4) + * Fixed issue that malformed the 'Relater Programs' field on the node edit form when there are more than 20 results to select from + * Programs with their own page are now linked to it when listed as a related program on another program page + * Fixed misaligned or missing breadcrumbs on program pages + * Removed the maximum length requirement for the Views exposed filter fields to fix the truncation of the degree program types + * Fixed the text for degree program types used by the Views exposed filter that were truncated + * Added Yavapai, Pima and Cochise campus support + * Fixed data importing for college/department joint programs + * Improved grid rendering support for degree program overview pages to better account for browser screen size + * ASU Brand (v1.20) + * Added check for asu_brand_ci_testing variable which will disable cookie consent for Travis-CI testing + * ASU Local iSearch Directory (v1.11) + * Added queue cleanup update and limits to avoid bloating database + * ASU RFI (v1.14) + * Updated RFI confirmation email wording + * Fixed undefined index notice generated by RFI graduate programs + * Mega Footer (v1.10) + * Updated Mega Footer unit description links with correct color + +- Contrib module updates + + - Managed by Panopoly + + * Administration Menu (v3.0-rc6) + * Features (v2.11) + * File Entity (v2.25) + * Link (v1.6) + * Menu Block (v2.8) + * TableField (v3.2) + * Views (v3.21) + +Webspark 1.60 (Minnesota) release, 2019-01-29 +--------------------------------------------- - Webspark core + + * Drupal (v7.63) + * Includes security updates. See https://www.drupal.org/project/drupal/releases/7.63 for details. * Panopoly (v1.60) - * This release includes a fix for a Moderately Critical security vulnerability in the Panels Breadcrumbs module. + * Multiple Panopoly releases (1.56-1.60) rolled into one update; Includes a fix for a Moderately Critical security vulnerability in the Panels Breadcrumbs module. - Contrib module updates @@ -93,7 +138,7 @@ Webspark 1.55 (Oregon) release, 2018-08-20 * ASU Academic Programs (v2.3) * Added CHANGELOG.txt file to module - * ASU DIRS (v1.10) + * ASU Local iSearch Directory (v1.10) * Fixed mapping of Twitter field for profile imports * Fixed configuration for proper HTML field filtering * Added profile video importing and display functionality diff --git a/profiles/openasu/modules/contrib/admin_menu/README.txt b/profiles/openasu/modules/contrib/admin_menu/README.txt index 136db70991..6fe556d25f 100644 --- a/profiles/openasu/modules/contrib/admin_menu/README.txt +++ b/profiles/openasu/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/openasu/modules/contrib/admin_menu/admin_devel/admin_devel.info b/profiles/openasu/modules/contrib/admin_menu/admin_devel/admin_devel.info index ab3d641ff3..8b09eb1813 100644 --- a/profiles/openasu/modules/contrib/admin_menu/admin_devel/admin_devel.info +++ b/profiles/openasu/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/openasu/modules/contrib/admin_menu/admin_menu-rtl.css b/profiles/openasu/modules/contrib/admin_menu/admin_menu-rtl.css index 9414dcf950..ff9f500843 100644 --- a/profiles/openasu/modules/contrib/admin_menu/admin_menu-rtl.css +++ b/profiles/openasu/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/openasu/modules/contrib/admin_menu/admin_menu.admin.js b/profiles/openasu/modules/contrib/admin_menu/admin_menu.admin.js index 9ee9f36f3a..3753463132 100644 --- a/profiles/openasu/modules/contrib/admin_menu/admin_menu.admin.js +++ b/profiles/openasu/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/openasu/modules/contrib/admin_menu/admin_menu.color.css b/profiles/openasu/modules/contrib/admin_menu/admin_menu.color.css index ea3ef491d5..00cbf651fd 100644 --- a/profiles/openasu/modules/contrib/admin_menu/admin_menu.color.css +++ b/profiles/openasu/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/openasu/modules/contrib/admin_menu/admin_menu.css b/profiles/openasu/modules/contrib/admin_menu/admin_menu.css index 52ae3ff54c..73f15e32a0 100644 --- a/profiles/openasu/modules/contrib/admin_menu/admin_menu.css +++ b/profiles/openasu/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/openasu/modules/contrib/admin_menu/admin_menu.inc b/profiles/openasu/modules/contrib/admin_menu/admin_menu.inc index e6169df700..5721d9adf8 100644 --- a/profiles/openasu/modules/contrib/admin_menu/admin_menu.inc +++ b/profiles/openasu/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'] .= '
' . t('If the Utility module was installed for this purpose, it can be safely disabled and uninstalled.') . ''; + $form['tweaks']['admin_menu_tweak_modules']['#description'] = '
' . t('If the Utility module was installed for this purpose, it can be safely disabled and uninstalled.') . ''; } $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 '' . $variables['alt'] . ''; } - diff --git a/profiles/openasu/modules/contrib/admin_menu/admin_menu.info b/profiles/openasu/modules/contrib/admin_menu/admin_menu.info index c6dbd892b3..ffd22e4422 100644 --- a/profiles/openasu/modules/contrib/admin_menu/admin_menu.info +++ b/profiles/openasu/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/openasu/modules/contrib/admin_menu/admin_menu.js b/profiles/openasu/modules/contrib/admin_menu/admin_menu.js index 2e28b554a2..1e32b3d65e 100644 --- a/profiles/openasu/modules/contrib/admin_menu/admin_menu.js +++ b/profiles/openasu/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/openasu/modules/contrib/admin_menu/admin_menu.map.inc b/profiles/openasu/modules/contrib/admin_menu/admin_menu.map.inc index f86e80cda4..831e3243e4 100644 --- a/profiles/openasu/modules/contrib/admin_menu/admin_menu.map.inc +++ b/profiles/openasu/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/openasu/modules/contrib/admin_menu/admin_menu.module b/profiles/openasu/modules/contrib/admin_menu/admin_menu.module index 795ad21118..f9ce3aede3 100644 --- a/profiles/openasu/modules/contrib/admin_menu/admin_menu.module +++ b/profiles/openasu/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/openasu/modules/contrib/admin_menu/admin_menu.uid1.css b/profiles/openasu/modules/contrib/admin_menu/admin_menu.uid1.css index e375cfe666..105fd2423b 100644 --- a/profiles/openasu/modules/contrib/admin_menu/admin_menu.uid1.css +++ b/profiles/openasu/modules/contrib/admin_menu/admin_menu.uid1.css @@ -1,4 +1,3 @@ - /** * @file * Administration menu color override for uid1. diff --git a/profiles/openasu/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar-rtl.css b/profiles/openasu/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar-rtl.css new file mode 100644 index 0000000000..a159034d01 --- /dev/null +++ b/profiles/openasu/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/openasu/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.css b/profiles/openasu/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.css index a3e9f3e300..f1bc09357f 100644 --- a/profiles/openasu/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.css +++ b/profiles/openasu/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/openasu/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.info b/profiles/openasu/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.info index fa4ca095e8..340ced0705 100644 --- a/profiles/openasu/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.info +++ b/profiles/openasu/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/openasu/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.install b/profiles/openasu/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.install index bf067d7858..f6449dcd46 100644 --- a/profiles/openasu/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.install +++ b/profiles/openasu/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/openasu/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module b/profiles/openasu/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module index c6111bdc4d..0f5c066284 100644 --- a/profiles/openasu/modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module +++ b/profiles/openasu/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/openasu/modules/contrib/admin_menu/tests/admin_menu.test b/profiles/openasu/modules/contrib/admin_menu/tests/admin_menu.test index 4b48c9ab54..b7c611d7a8 100644 --- a/profiles/openasu/modules/contrib/admin_menu/tests/admin_menu.test +++ b/profiles/openasu/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/openasu/modules/contrib/features/features.admin.inc b/profiles/openasu/modules/contrib/features/features.admin.inc index 46752c891d..2dea423efa 100644 --- a/profiles/openasu/modules/contrib/features/features.admin.inc +++ b/profiles/openasu/modules/contrib/features/features.admin.inc @@ -871,7 +871,7 @@ function features_export_build_form_submit($form, &$form_state) { $feature = $form['#feature']; $export = _features_export_build($feature, $form_state); $export = _features_export_generate($export, $form_state, $feature); - $generate = ($form_state['values']['op'] == $form_state['values']['generate']); + $generate = isset($form_state['values']['generate']) && ($form_state['values']['op'] == $form_state['values']['generate']); $module_name = $form_state['values']['module_name']; if ($generate && !user_access('generate features')) { @@ -1628,9 +1628,9 @@ function _features_get_features_list() { $cache = cache_get('features:features_list'); if ($cache) { - $features = $cache->data; + $features = $cache->data; } - + if (empty($features)) { // Clear & rebuild key caches features_get_info(NULL, NULL, TRUE); diff --git a/profiles/openasu/modules/contrib/features/features.drush.inc b/profiles/openasu/modules/contrib/features/features.drush.inc index 696825d6b1..4be5d98cea 100644 --- a/profiles/openasu/modules/contrib/features/features.drush.inc +++ b/profiles/openasu/modules/contrib/features/features.drush.inc @@ -519,7 +519,7 @@ function drush_features_export() { drush_die('Aborting.'); } $export = _drush_features_generate_export($items, $module); - _features_populate($items, $export[info], $export[name]); + _features_populate($items, $export['info'], $export['name']); _drush_features_export($export['info'], $module, $directory); } } diff --git a/profiles/openasu/modules/contrib/features/features.export.inc b/profiles/openasu/modules/contrib/features/features.export.inc index e65216f3ad..340818b30c 100644 --- a/profiles/openasu/modules/contrib/features/features.export.inc +++ b/profiles/openasu/modules/contrib/features/features.export.inc @@ -315,7 +315,7 @@ function features_export_render($export, $module_name, $reset = FALSE) { $code = array_filter($code); foreach ($code as $filename => $contents) { if ($filename != '_files') { - $code[$filename] = "name = $name; $features[$name]->filename = drupal_get_path('module', $name) . '/' . $name . '.module'; $features[$name]->type = 'module'; + $features[$name]->status = module_exists($name); $features[$name]->info = $info + $defaults; } } diff --git a/profiles/openasu/modules/contrib/features/includes/features.field.inc b/profiles/openasu/modules/contrib/features/includes/features.field.inc index 849081ddac..ca305ae1ec 100644 --- a/profiles/openasu/modules/contrib/features/includes/features.field.inc +++ b/profiles/openasu/modules/contrib/features/includes/features.field.inc @@ -274,7 +274,7 @@ function field_base_features_rebuild($module) { // Create or update field. if (isset($existing_fields[$field['field_name']])) { $existing_field = $existing_fields[$field['field_name']]; - $array_diff_result = drupal_array_diff_assoc_recursive($field + $existing_field, $existing_field); + $array_diff_result = features_array_diff_assoc_recursive($field + $existing_field, $existing_field); if (!empty($array_diff_result)) { try { field_update_field($field); @@ -319,7 +319,7 @@ function field_instance_features_rebuild($module) { // Create or update field instance. if (isset($existing_instances[$field_instance['entity_type']][$field_instance['bundle']][$field_instance['field_name']])) { $existing_instance = $existing_instances[$field_instance['entity_type']][$field_instance['bundle']][$field_instance['field_name']]; - if ($field_instance + $existing_instance !== $existing_instance) { + if ($field_instance + $existing_instance != $existing_instance) { try { field_update_instance($field_instance); } @@ -494,7 +494,7 @@ function field_features_rebuild($module) { $field_config = $field['field_config']; if (isset($existing_fields[$field_config['field_name']])) { $existing_field = $existing_fields[$field_config['field_name']]; - $array_diff_result = drupal_array_diff_assoc_recursive($field_config + $existing_field, $existing_field); + $array_diff_result = features_array_diff_assoc_recursive($field_config + $existing_field, $existing_field); if (!empty($array_diff_result)) { try { field_update_field($field_config); @@ -518,7 +518,7 @@ function field_features_rebuild($module) { $field_instance = $field['field_instance']; if (isset($existing_instances[$field_instance['entity_type']][$field_instance['bundle']][$field_instance['field_name']])) { $existing_instance = $existing_instances[$field_instance['entity_type']][$field_instance['bundle']][$field_instance['field_name']]; - if ($field_instance + $existing_instance !== $existing_instance) { + if ($field_instance + $existing_instance != $existing_instance) { field_update_instance($field_instance); } } diff --git a/profiles/openasu/modules/contrib/features/includes/features.image.inc b/profiles/openasu/modules/contrib/features/includes/features.image.inc index b2058b7c48..bf89191d47 100644 --- a/profiles/openasu/modules/contrib/features/includes/features.image.inc +++ b/profiles/openasu/modules/contrib/features/includes/features.image.inc @@ -73,11 +73,17 @@ function image_features_export_render($module_name, $data, $export = NULL) { */ function image_features_revert($module) { if ($default_styles = features_get_default('image', $module)) { - foreach (array_keys($default_styles) as $default_style) { - if ($style = image_style_load($default_style)) { + foreach ($default_styles as $default_style_name => $default_style) { + if ($style = image_style_load($default_style_name)) { if ($style['storage'] != IMAGE_STORAGE_DEFAULT) { image_default_style_revert($style); } + else { + // Verify that the loaded style still matches what's in code. + if ($default_style['effects'] !== $style['effects']) { + image_default_style_revert($style); + } + } } } } diff --git a/profiles/openasu/modules/contrib/features/includes/features.menu.inc b/profiles/openasu/modules/contrib/features/includes/features.menu.inc index 1837dcb61c..84af6231e0 100644 --- a/profiles/openasu/modules/contrib/features/includes/features.menu.inc +++ b/profiles/openasu/modules/contrib/features/includes/features.menu.inc @@ -420,7 +420,12 @@ function features_menu_link_load($identifier) { * Returns a lowercase clean string with only letters, numbers and dashes */ function features_clean_title($str) { - return strtolower(preg_replace_callback('/(\s)|([^a-zA-Z\-0-9])/i', function($matches) { - return $matches[1] ? '-' : ''; - }, $str)); + return strtolower(preg_replace_callback('/(\s)|([^a-zA-Z\-0-9])/i', '_features_clean_title', $str)); +} + +/** + * Callback function for preg_replace_callback() to clean a string. + */ +function _features_clean_title($matches) { + return $matches[1] ? '-' : ''; } diff --git a/profiles/openasu/modules/contrib/features/tests/features.test b/profiles/openasu/modules/contrib/features/tests/features.test index 025ef23c97..743cc1bf99 100644 --- a/profiles/openasu/modules/contrib/features/tests/features.test +++ b/profiles/openasu/modules/contrib/features/tests/features.test @@ -14,6 +14,7 @@ class FeaturesUserTestCase extends DrupalWebTestCase { 'name' => t('Component tests'), 'description' => t('Run tests for components of Features.') , 'group' => t('Features'), + 'dependencies' => array('views', 'strongarm'), ); } @@ -182,6 +183,7 @@ class FeaturesEnableTestCase extends DrupalWebTestCase { 'name' => t('Features enable tests'), 'description' => t('Run tests for enabling of features.') , 'group' => t('Features'), + 'dependencies' => array('views', 'strongarm'), ); } @@ -231,6 +233,7 @@ class FeaturesCtoolsIntegrationTest extends DrupalWebTestCase { 'name' => t('Features Chaos Tools integration'), 'description' => t('Run tests for ctool integration of features.') , 'group' => t('Features'), + 'dependencies' => array('views', 'strongarm'), ); } diff --git a/profiles/openasu/modules/contrib/features/tests/features_test/features_test.info b/profiles/openasu/modules/contrib/features/tests/features_test/features_test.info index 04f01d33b4..cd414ec649 100644 --- a/profiles/openasu/modules/contrib/features/tests/features_test/features_test.info +++ b/profiles/openasu/modules/contrib/features/tests/features_test/features_test.info @@ -21,9 +21,8 @@ features[user_permission][] = create features_test content features[views_view][] = features_test hidden = 1 -; Information added by Drupal.org packaging script on 2016-04-18 -version = "7.x-2.10" +; Information added by Drupal.org packaging script on 2018-11-01 +version = "7.x-2.11" core = "7.x" project = "features" -datestamp = "1461011641" - +datestamp = "1541050686" diff --git a/profiles/openasu/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.module b/profiles/openasu/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.module index 65fc2bde0f..e290434008 100644 --- a/profiles/openasu/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.module +++ b/profiles/openasu/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.module @@ -630,10 +630,10 @@ function fieldable_panels_pane_type_load($type) { if ($type == 'manage' && (arg(5) == 'fields' || arg(5) == 'display')) { drupal_goto('admin/structure/fieldable-panels-panes/' . arg(4) . '/' . arg(5)); } - - // If nothing else was found, redirect to the main FPP admin page. - drupal_set_message(t('Unable to load the "@type" Fieldable Panels Pane type.', array('@type' => $type))); - drupal_goto('admin/structure/fieldable-panels-panes'); + else { + // If nothing else, return false. + return FALSE; + } } } diff --git a/profiles/openasu/modules/contrib/file_entity/README.txt b/profiles/openasu/modules/contrib/file_entity/README.txt new file mode 100644 index 0000000000..fd481adc71 --- /dev/null +++ b/profiles/openasu/modules/contrib/file_entity/README.txt @@ -0,0 +1,27 @@ + +If you want to translate file entities the Drupal 7 entity_translation module needs to be enabled. + +Step 1) download and enable the file_entity module +Step 2) download and enable the entity_translation module +Step 3) enable the locale module and add your additional languages here: +/admin/config/regional/language , be sure to configure language detection as well, I prefer prefix, configure the prefix for all enabled languages. + +Step 4) +go to the /admin/config/regional/entity_translation +page and check off the file entity type underneith "Translatable entity types" +then save, after you have done this, translation options for each enabled language will show up if you also enable the field translation option in the structure of your file entity type for 'managed fields' , so for instance alt field and the title field would be a good thing to enable translatable field option for. + +Step 5) enable field translation on alt and title fields for file entity image type go to : /admin/structure/file-types/manage/image/fields + +Step 6) Once you do this, you will get translation options for the translatable fields that have translatable field option enabled. +so to if you've correctly configured things you'll be able to add the translation in this page here: /file/1/translate + +More translation usage with views: +Translate one file entity alt and title fields + +and then create a view of unformated fields with the article type +add the image field to the view +save the view + +hover your mouse over the image in the default language (most likely english /en) , the default language hover should show the image title in that language +switch language, hover the mouse over the image and this language (in my case French /fr ) the hover should display the image title in french. diff --git a/profiles/openasu/modules/contrib/file_entity/file_entity.admin.inc b/profiles/openasu/modules/contrib/file_entity/file_entity.admin.inc index ae1a1c73f9..5837c760d3 100644 --- a/profiles/openasu/modules/contrib/file_entity/file_entity.admin.inc +++ b/profiles/openasu/modules/contrib/file_entity/file_entity.admin.inc @@ -1174,5 +1174,12 @@ function file_entity_settings_form($form, &$form_state) { '#description' => t('Rename the newly uploaded file to the name of the original file. This action cannot be undone.'), ); + $form['file_entity_protect_repeated_render'] = array( + '#type' => 'checkbox', + '#title' => t('Protect against repeat rendering'), + '#default_value' => variable_get('file_entity_protect_repeated_render', TRUE), + '#description' => t('Avoid rendering the same entity more than 20 times. This can be a sign of an image entity getting caught in a recursive render, but it can also be triggered when the same image is rendered more than 20 times, e.g. in an long content list or data feed.'), + ); + return system_settings_form($form); } diff --git a/profiles/openasu/modules/contrib/file_entity/file_entity.api.php b/profiles/openasu/modules/contrib/file_entity/file_entity.api.php index 01c6e881d6..882edeb99c 100644 --- a/profiles/openasu/modules/contrib/file_entity/file_entity.api.php +++ b/profiles/openasu/modules/contrib/file_entity/file_entity.api.php @@ -405,3 +405,19 @@ function hook_file_metadata_info() { function hook_file_metadata_info_alter() { } + +/** + * Alters skip fields status. + * + * Use this to choose to skip or complete step 4 of the file upload process. + * + * @param bool &$skip_fields + * Set to TRUE to skip the form for editing extra file entity fields. + * @param array $form_state + * State array of the current upload form. + */ +function hook_file_entity_file_upload_skip_fields_alter(&$skip_fields, $form_state) { + if ($form_state['file']->type == 'video') { + $skip_fields = TRUE; + } +} diff --git a/profiles/openasu/modules/contrib/file_entity/file_entity.field.inc b/profiles/openasu/modules/contrib/file_entity/file_entity.field.inc index fa47a03791..8181469b5e 100644 --- a/profiles/openasu/modules/contrib/file_entity/file_entity.field.inc +++ b/profiles/openasu/modules/contrib/file_entity/file_entity.field.inc @@ -346,29 +346,32 @@ function file_entity_field_formatter_view($entity_type, $entity, $field, $instan switch ($display['type']) { case 'file_rendered': foreach ($items as $delta => $item) { - // Protect ourselves from recursive rendering. - static $recursive_render_depth = array(); if (!empty($item)) { - $recursive_render_id = $entity_type . $field['field_name'] . $item['fid']; - if (isset($recursive_render_depth[$recursive_render_id])) { - $recursive_render_depth[$recursive_render_id]++; - } - else { - $recursive_render_depth[$recursive_render_id] = 1; - } + // The repeat-rendering protection may be disabled if necessary. + if (variable_get('file_entity_protect_repeated_render', TRUE)) { + // Protect ourselves from repeated rendering. + static $repeated_render_depth = array(); + $repeated_render_id = $entity_type . $field['field_name'] . $item['fid']; + if (isset($repeated_render_depth[$repeated_render_id])) { + $repeated_render_depth[$repeated_render_id]++; + } + else { + $repeated_render_depth[$repeated_render_id] = 1; + } - if ($recursive_render_depth[$recursive_render_id] > 20) { - watchdog( - 'file_entity', - 'Recursive rendering detected when rendering entity %entity_type: %entity_id, using the %field_name field. Aborting rendering.', - array( - '%entity_type' => 'file', - '%entity_id' => $item['fid'], - '%field_name' => $field['field_name'], - ), - WATCHDOG_ERROR - ); - return $element; + if ($repeated_render_depth[$repeated_render_id] > 20) { + watchdog( + 'file_entity', + 'Repeated rendering detected when rendering entity %entity_type: %entity_id, using the %field_name field. Aborting rendering.', + array( + '%entity_type' => 'file', + '%entity_id' => $item['fid'], + '%field_name' => $field['field_name'], + ), + WATCHDOG_ERROR + ); + return $element; + } } $file = file_load($item['fid']); diff --git a/profiles/openasu/modules/contrib/file_entity/file_entity.info b/profiles/openasu/modules/contrib/file_entity/file_entity.info index 0cf48a9be5..924d0d157b 100644 --- a/profiles/openasu/modules/contrib/file_entity/file_entity.info +++ b/profiles/openasu/modules/contrib/file_entity/file_entity.info @@ -32,8 +32,8 @@ configure = admin/config/media/file-settings ; We have to add a fake version so Git checkouts do not fail Media dependencies version = 7.x-2.x-dev -; Information added by Drupal.org packaging script on 2018-06-14 -version = "7.x-2.22" +; Information added by Drupal.org packaging script on 2018-11-09 +version = "7.x-2.25" core = "7.x" project = "file_entity" -datestamp = "1528996427" +datestamp = "1541794687" diff --git a/profiles/openasu/modules/contrib/file_entity/file_entity.install b/profiles/openasu/modules/contrib/file_entity/file_entity.install index 3fb3051fa3..5f4d14cddd 100644 --- a/profiles/openasu/modules/contrib/file_entity/file_entity.install +++ b/profiles/openasu/modules/contrib/file_entity/file_entity.install @@ -167,7 +167,6 @@ function file_entity_schema_alter(&$schema) { $schema['file_managed']['indexes']['file_type'] = array('type'); } - /** * Implements hook_install(). */ @@ -246,6 +245,7 @@ function file_entity_uninstall() { variable_del('file_entity_file_upload_wizard_skip_file_type'); variable_del('file_entity_file_upload_wizard_skip_scheme'); variable_del('file_entity_file_upload_wizard_skip_fields'); + variable_del('file_entity_protect_repeated_render'); // Remove any items from the file type queue if still there. DrupalQueue::get('file_entity_type_determine')->deleteQueue(); @@ -315,7 +315,11 @@ function file_entity_update_7001() { if (!empty($display)) { db_merge('file_display') ->key(array( - 'name' => implode('__', array($file_type, $view_mode, $formatter_name)), + 'name' => implode('__', array( + $file_type, + $view_mode, + $formatter_name, + )), )) ->fields(array( 'status' => isset($display['status']) ? $display['status'] : 0, @@ -336,7 +340,8 @@ function file_entity_update_7001() { /** * Empty update function to trigger a theme registry rebuild. */ -function file_entity_update_7100() { } +function file_entity_update_7100() { +} /** * Update all files with empty types to use the first part of filemime. @@ -545,7 +550,6 @@ function file_entity_update_7203() { } } - /** * Add title and alt text to image file types. */ @@ -822,7 +826,11 @@ function file_entity_update_7207() { * Add expanded file type permissions to roles with existing file permissions. */ function file_entity_update_7208() { - foreach (array('edit own files', 'edit any files', 'delete own files', 'delete any files', 'download own files', 'download any files') as $old_permission) { + foreach (array( + 'edit own files', 'edit any files', + 'delete own files', 'delete any files', + 'download own files', 'download any files', + ) as $old_permission) { $roles = user_roles(FALSE, $old_permission); foreach ($roles as $rid => $name) { @@ -1004,10 +1012,11 @@ function file_entity_update_7212(&$sandbox) { 'value' => serialize((int) $result->{$key}), ); } - $sandbox['progress'] += count($results); $sandbox['current_fid'] = $result->fid; } + $sandbox['progress'] += count($results); + if (!empty($values)) { $query = db_insert('file_metadata'); $query->fields(array('fid', 'name', 'value')); diff --git a/profiles/openasu/modules/contrib/file_entity/file_entity.module b/profiles/openasu/modules/contrib/file_entity/file_entity.module index 6c8c4068ff..2ca63b8044 100644 --- a/profiles/openasu/modules/contrib/file_entity/file_entity.module +++ b/profiles/openasu/modules/contrib/file_entity/file_entity.module @@ -2334,6 +2334,11 @@ function pathauto_file_update_alias(stdClass $file, $op, array $options = array( return; } + // Skip processing if pathauto_entity module is enabled. + if (module_exists('pathauto_entity')) { + return; + } + module_load_include('inc', 'pathauto'); $uri = entity_uri('file', $file); pathauto_create_alias('file', $op, $uri['path'], array('file' => $file), $file->type, $options['language']); diff --git a/profiles/openasu/modules/contrib/file_entity/file_entity.pages.inc b/profiles/openasu/modules/contrib/file_entity/file_entity.pages.inc index 864e7449f8..79f1d33d36 100644 --- a/profiles/openasu/modules/contrib/file_entity/file_entity.pages.inc +++ b/profiles/openasu/modules/contrib/file_entity/file_entity.pages.inc @@ -435,6 +435,8 @@ function file_entity_add_upload_submit($form, &$form_state) { // Save the file with blanks fields. $save = TRUE; } + // Allow other modules to choose to skip or complete step 4. + drupal_alter('file_entity_file_upload_skip_fields', $save, $form_state); } // Form id's can vary depending on how many other forms are displayed, so we @@ -750,7 +752,7 @@ function file_entity_edit($form, &$form_state, $file) { '#title' => t('Associated with'), '#maxlength' => 60, '#autocomplete_path' => 'user/autocomplete', - '#default_value' => !empty($file->uid) ? user_load($file->uid)->name : '', + '#default_value' => (!empty($file->uid) && $user = user_load($file->uid)) ? $user->name : '', '#weight' => -1, '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous')))), ); @@ -834,6 +836,15 @@ function file_entity_edit_submit($form, &$form_state) { // Check if a replacement file has been uploaded. if (!empty($form_state['values']['replace_upload'])) { $replacement = $form_state['values']['replace_upload']; + // Existing image metadata is stored in $file->height and $file->width. + // Loop through the replacement metadata and update existing values. + if (!empty($replacement->metadata)) { + foreach ($replacement->metadata as $metadata_key => $metadata_value) { + if (isset($file->{$metadata_key})) { + $file->{$metadata_key} = $metadata_value; + } + } + } // Move file from temp to permanent home. if (!empty($form_state['values']['replace_keep_original_filename']) && $form_state['values']['replace_keep_original_filename']) { diff --git a/profiles/openasu/modules/contrib/file_entity/file_entity.pathauto.inc b/profiles/openasu/modules/contrib/file_entity/file_entity.pathauto.inc index 98befe3ac8..553f28a73a 100644 --- a/profiles/openasu/modules/contrib/file_entity/file_entity.pathauto.inc +++ b/profiles/openasu/modules/contrib/file_entity/file_entity.pathauto.inc @@ -20,6 +20,11 @@ function file_entity_path_alias_types() { * Implements hook_pathauto(). */ function file_entity_pathauto($op) { + // Allow Pathauto Entity settings to override File Entity's pathauto. + if (module_exists('pathauto_entity')) { + return; + } + switch ($op) { case 'settings': $settings = array(); diff --git a/profiles/openasu/modules/contrib/file_entity/plugins/content_types/file_display.inc b/profiles/openasu/modules/contrib/file_entity/plugins/content_types/file_display.inc index 922b1e5b3d..0da8dab5df 100644 --- a/profiles/openasu/modules/contrib/file_entity/plugins/content_types/file_display.inc +++ b/profiles/openasu/modules/contrib/file_entity/plugins/content_types/file_display.inc @@ -114,7 +114,12 @@ function file_entity_file_display_content_type_edit_form($form, &$form_state) { $defaults = !empty($formatter['default settings']) ? $formatter['default settings'] : array(); $settings = !empty($conf['displays'][$name]['settings']) ? $conf['displays'][$name]['settings'] : array(); $settings += $defaults; - $settings_form = $function($form, $form_state, $settings, $name, $file_type, $view_mode); + if (strpos($name, 'file_field_') === 0) { + $settings_form = $function($form, $form_state, $settings, $name, '', ''); + } + else { + $settings_form = $function($form, $form_state, $settings); + } if (!empty($settings_form)) { $form['displays']['settings'][$name] = array( '#type' => 'fieldset', diff --git a/profiles/openasu/modules/contrib/file_entity/tests/file_entity_test.info b/profiles/openasu/modules/contrib/file_entity/tests/file_entity_test.info index 8a7c0ff6c3..43a8c4135d 100644 --- a/profiles/openasu/modules/contrib/file_entity/tests/file_entity_test.info +++ b/profiles/openasu/modules/contrib/file_entity/tests/file_entity_test.info @@ -5,8 +5,8 @@ core = 7.x dependencies[] = file_entity hidden = TRUE -; Information added by Drupal.org packaging script on 2018-06-14 -version = "7.x-2.22" +; Information added by Drupal.org packaging script on 2018-11-09 +version = "7.x-2.25" core = "7.x" project = "file_entity" -datestamp = "1528996427" +datestamp = "1541794687" diff --git a/profiles/openasu/modules/contrib/link/README.txt b/profiles/openasu/modules/contrib/link/README.txt index 387cc594f6..a258d4dd86 100644 --- a/profiles/openasu/modules/contrib/link/README.txt +++ b/profiles/openasu/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: 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: + 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 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 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#pager -Anchors and query strings may also be used in any of these cases, including: node/74971/edit?destination=node/74972#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/openasu/modules/contrib/link/link-rtl.css b/profiles/openasu/modules/contrib/link/link-rtl.css index 0359487e2b..613db5da6c 100644 --- a/profiles/openasu/modules/contrib/link/link-rtl.css +++ b/profiles/openasu/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/openasu/modules/contrib/link/link.css b/profiles/openasu/modules/contrib/link/link.css index 1590e7ad51..6250df7f46 100644 --- a/profiles/openasu/modules/contrib/link/link.css +++ b/profiles/openasu/modules/contrib/link/link.css @@ -2,7 +2,6 @@ float: left; width: 48%; } - .link-field-column .form-text { width: 95%; } diff --git a/profiles/openasu/modules/contrib/link/link.diff.inc b/profiles/openasu/modules/contrib/link/link.diff.inc index 9e34123ae4..b01ba6e7de 100644 --- a/profiles/openasu/modules/contrib/link/link.diff.inc +++ b/profiles/openasu/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/openasu/modules/contrib/link/link.info b/profiles/openasu/modules/contrib/link/link.info index 4ff71e2564..351e1782bc 100644 --- a/profiles/openasu/modules/contrib/link/link.info +++ b/profiles/openasu/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/openasu/modules/contrib/link/link.install b/profiles/openasu/modules/contrib/link/link.install index 14e745d421..8125b69912 100644 --- a/profiles/openasu/modules/contrib/link/link.install +++ b/profiles/openasu/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 Token, 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/openasu/modules/contrib/link/link.migrate.inc b/profiles/openasu/modules/contrib/link/link.migrate.inc index fc8363f6d1..4900051007 100644 --- a/profiles/openasu/modules/contrib/link/link.migrate.inc +++ b/profiles/openasu/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/openasu/modules/contrib/link/link.module b/profiles/openasu/modules/contrib/link/link.module index f36c9db39e..e9ba125159 100644 --- a/profiles/openasu/modules/contrib/link/link.module +++ b/profiles/openasu/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 = '

About

'; + $output .= '

' . '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.' . '

'; + $output .= '

' . 'Requirements / Dependencies' . '

'; + $output .= '

' . 'Fields API is provided already by core [no dependencies].' . '

'; + $output .= '

Configuration

'; + $output .= '

' . '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.' . '

'; + 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 rel="nofollow" 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 rel="nofollow" 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 WCAG 1.0 Guidelines 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 WCAG 1.0 Guidelines 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']); } } @@ -371,8 +419,20 @@ function _link_load($field, $item, $instance) { /** * Prepares the item attributes and url for storage. + * + * @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. + * + * @codingStandardsIgnoreStart */ function _link_process(&$item, $delta, $field, $entity) { + // @codingStandardsIgnoreEnd // Trim whitespace from URL. if (!empty($item['url'])) { $item['url'] = trim($item['url']); @@ -403,7 +463,7 @@ function _link_process(&$item, $delta, $field, $entity) { function _link_validate(&$item, $delta, $field, $entity, $instance, $langcode, &$optional_field_found, &$errors) { if ($item['url'] && !(isset($instance['default_value'][$delta]['url']) && $item['url'] === $instance['default_value'][$delta]['url'] && !$instance['required'])) { // Validate the link. - if (!link_validate_url(trim($item['url']), $langcode)) { + if (!link_validate_url(trim($item['url']))) { $errors[$field['field_name']][$langcode][$delta][] = array( 'error' => 'link_required', 'message' => t('The value %value provided for %field is not a valid URL.', array( @@ -430,9 +490,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. @@ -456,8 +517,11 @@ function _link_validate(&$item, $delta, $field, $entity, $instance, $langcode, & * The CCK field definition. * @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; @@ -471,7 +535,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']); @@ -499,10 +563,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, ) ); } @@ -534,15 +599,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. @@ -555,10 +625,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(); @@ -605,7 +690,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})); @@ -616,7 +701,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'])) { @@ -668,7 +766,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) @@ -715,7 +814,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), @@ -802,7 +908,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); @@ -814,7 +921,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. @@ -826,15 +933,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'])) { @@ -871,7 +994,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. @@ -924,6 +1048,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'), @@ -963,8 +1092,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'); @@ -1009,7 +1139,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); @@ -1061,11 +1191,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'])); } /** @@ -1125,7 +1271,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') { @@ -1140,7 +1287,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') { @@ -1168,12 +1316,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); @@ -1183,9 +1331,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; } @@ -1195,6 +1344,31 @@ function link_cleanup_url($url, $protocol = 'http') { return $url; } +/** + * 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; +} + /** * Validates a URL. * @@ -1210,96 +1384,127 @@ function link_cleanup_url($url, $protocol = 'http') { */ function link_validate_url($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')); - $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 . '?$/'; if (strpos($text, '') === 0) { @@ -1314,6 +1519,9 @@ function link_validate_url($text) { 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; } @@ -1325,11 +1533,16 @@ function link_validate_url($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); } /** @@ -1340,7 +1553,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]); } } @@ -1354,7 +1575,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]; } @@ -1365,7 +1594,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']; } } @@ -1409,7 +1646,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); } /** @@ -1422,7 +1659,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', ); @@ -1432,6 +1669,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; } @@ -1446,7 +1688,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/openasu/modules/contrib/link/tests/link.attribute.test b/profiles/openasu/modules/contrib/link/tests/link.attribute.test index 36e6be5e94..f66a0e6eda 100644 --- a/profiles/openasu/modules/contrib/link/tests/link.attribute.test +++ b/profiles/openasu/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('@@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/openasu/modules/contrib/link/tests/link.crud.test b/profiles/openasu/modules/contrib/link/tests/link.crud.test index e9b7db416c..6bc386749e 100644 --- a/profiles/openasu/modules/contrib/link/tests/link.crud.test +++ b/profiles/openasu/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/openasu/modules/contrib/link/tests/link.crud_browser.test b/profiles/openasu/modules/contrib/link/tests/link.crud_browser.test index be04260914..dc21857325 100644 --- a/profiles/openasu/modules/contrib/link/tests/link.crud_browser.test +++ b/profiles/openasu/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() . '', '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() . '', '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 in a static title for your link, that the * title actually displays . */ - 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]' => '' . $name . ''), t('Save settings')); + 'instance[settings][title_value]' => '' . $name . '', + ), 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('' . $name . '', $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/openasu/modules/contrib/link/tests/link.entity_token.test b/profiles/openasu/modules/contrib/link/tests/link.entity_token.test index 1f51fab43d..6c42655f5b 100644 --- a/profiles/openasu/modules/contrib/link/tests/link.entity_token.test +++ b/profiles/openasu/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', '
' . print_r($token_url_tests, TRUE) . '
');
-
+    // @codingStandardsIgnoreLine
+    // $this->assert('pass', '
' . print_r($token_url_tests, TRUE) . '
');.
     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', '
' . print_r($token_url_tests, TRUE) . '
');
 
+    //@codingStandardsIgnoreLine
+    // $this->assert('pass', '
' . print_r($token_url_tests, TRUE) . '
');.
     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/openasu/modules/contrib/link/tests/link.test b/profiles/openasu/modules/contrib/link/tests/link.test
index 962197f230..dd9adb497c 100644
--- a/profiles/openasu/modules/contrib/link/tests/link.test
+++ b/profiles/openasu/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/openasu/modules/contrib/link/tests/link.token.test b/profiles/openasu/modules/contrib/link/tests/link.token.test
index 617260e602..edbb1df5f6 100644
--- a/profiles/openasu/modules/contrib/link/tests/link.token.test
+++ b/profiles/openasu/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/openasu/modules/contrib/link/tests/link.validate.test b/profiles/openasu/modules/contrib/link/tests/link.validate.test
index f8ddcd618d..a8c177681d 100644
--- a/profiles/openasu/modules/contrib/link/tests/link.validate.test
+++ b/profiles/openasu/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();
 
@@ -29,23 +38,29 @@ class LinkValidateTestCase extends LinkBaseTestClass {
 
     $label = $this->randomName();
     $edit = array(
-      'title' => $label,
       $field_name . '[und][0][title]' => $label,
       $field_name . '[und][0][url]' => $url,
     );
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->assertRaw(' has been created.', 'Node created');
 
-    $nid = 1; //$matches[1];
+    $nid = 1;
 
     $node = node_load($nid);
 
     $this->assertEqual($url, $node->{$field_name}['und'][0]['url']);
   }
+
 }
 
+/**
+ * Class for Validate Test.
+ */
 class LinkValidateTest extends LinkValidateTestCase {
 
+  /**
+   * Get Info.
+   */
   public static function getInfo() {
     return array(
       'name' => 'Link Validation Tests',
@@ -54,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,
@@ -87,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,
@@ -132,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,
@@ -173,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('
'. print_r($instance_details, TRUE) .'
'); $this->fail('
'. print_r(unserialize($instance_details->data), TRUE) .'
');*/ @@ -182,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('
'. print_r($field, TRUE) .'
'); - $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(); @@ -236,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); @@ -249,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); @@ -258,36 +318,69 @@ 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 '' is a valid url. - function test_link_front_url() { + /** + * Validate that '' is a valid url. + * + * @codingStandardsIgnoreStart + */ + public function test_link_front_url() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url(''); } - // 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 $this->link_test_validate_url('node/32'); } - // 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', @@ -296,18 +389,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', @@ -316,24 +427,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}'); } @@ -341,8 +481,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); } @@ -350,12 +493,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', @@ -363,79 +512,117 @@ 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 labelled works. - function testValidateFrontLink() { + /** + * Make sure that a link labelled works. + */ + public function testValidateFrontLink() { $valid = link_validate_url(''); - $this->assertEqual(LINK_FRONT, $valid, 'Make sure that front link is verfied and identified'); + $this->assertEqual(LINK_FRONT, $valid, 'Make sure that front link is verified and identified'); } - function testValidateEmailLink() { + /** + * Validate Email Link. + */ + public function testValidateEmailLink() { $valid = link_validate_url('mailto:bob@example.com'); $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 valiates as news.'); + $this->assertEqual(LINK_NEWS, $valid, 'Make sure link to specific article validates as news.'); } - function testValidateBadNewsgroupLink() { + /** + * Validate Bad Newsgroup Link. + */ + public function testValidateBadNewsgroupLink() { $valid = link_validate_url('news:comp.bad_name.misc'); $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() { $links = array( 'node/5', 'rss.xml', 'files/test.jpg', '/var/www/test', ); - + foreach ($links as $link) { $valid = link_validate_url($link); $this->assertEqual(LINK_INTERNAL, $valid, 'Test ' . $link . ' internal link.'); } } - function testValidateExternalLinks() { + /** + * Validate External Links. + */ + public function testValidateExternalLinks() { $links = array( 'http://localhost:8080/', 'www.example.com', @@ -452,7 +639,7 @@ class LinkValidateUrlLight extends DrupalWebTestCase { 'http://example.com/index.php?q=node/123', 'http://example.com/index.php?page=this\that', 'http://example.com/?first_name=Joe Bob&last_name=Smith', - // Anchors + // Anchors. 'http://www.example.com/index.php#test', 'http://www.example.com/index.php#this@that.', 'http://www.example.com/index.php#', @@ -460,8 +647,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'; @@ -470,29 +671,33 @@ class LinkValidateUrlLight extends DrupalWebTestCase { foreach ($links as $link) { $valid = link_validate_url($link); $this->assertEqual(LINK_EXTERNAL, $valid, 'Testing that ' . $link . ' is a valid external link.'); - // The following two lines are commented out and only used for comparisons. - //$valid2 = valid_url($link, TRUE); - //$this->assertEqual(TRUE, $valid2, "Using valid_url() on $link."); + // 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/', ); foreach ($links as $link) { $valid = link_validate_url($link); $this->assertEqual(FALSE, $valid, 'Testing that ' . $link . ' is not a valid link.'); } } + } diff --git a/profiles/openasu/modules/contrib/link/views/link.views.inc b/profiles/openasu/modules/contrib/link/views/link.views.inc index 27d5182fa8..8c080ad111 100644 --- a/profiles/openasu/modules/contrib/link/views/link.views.inc +++ b/profiles/openasu/modules/contrib/link/views/link.views.inc @@ -1,4 +1,7 @@ default_actions(); $form['title'] = array( @@ -52,7 +58,7 @@ class link_views_handler_argument_target extends views_handler_argument { $form['wildcard'] = array( '#prefix' => '
', - // 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/openasu/modules/contrib/link/views/link_views_handler_filter_protocol.inc b/profiles/openasu/modules/contrib/link/views/link_views_handler_filter_protocol.inc index a020b4e0e1..ae00c17e90 100644 --- a/profiles/openasu/modules/contrib/link/views/link_views_handler_filter_protocol.inc +++ b/profiles/openasu/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 filter_allowed_protocols 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/openasu/modules/contrib/menu_block/menu-block-background-display-options.png b/profiles/openasu/modules/contrib/menu_block/css/display-options-background.png similarity index 100% rename from profiles/openasu/modules/contrib/menu_block/menu-block-background-display-options.png rename to profiles/openasu/modules/contrib/menu_block/css/display-options-background.png diff --git a/profiles/openasu/modules/contrib/menu_block/menu-block.admin.css b/profiles/openasu/modules/contrib/menu_block/css/menu-block.admin.css similarity index 96% rename from profiles/openasu/modules/contrib/menu_block/menu-block.admin.css rename to profiles/openasu/modules/contrib/menu_block/css/menu-block.admin.css index 14c36615f7..d23c87715c 100644 --- a/profiles/openasu/modules/contrib/menu_block/menu-block.admin.css +++ b/profiles/openasu/modules/contrib/menu_block/css/menu-block.admin.css @@ -38,7 +38,7 @@ label#item-label { border: 1px solid #666; color: #666; font-weight: bold; - background-image: url(menu-block-background-display-options.png); + background-image: url(display-options-background.png); background-position: left top; background-repeat: no-repeat; } diff --git a/profiles/openasu/modules/contrib/menu_block/menu-block.js b/profiles/openasu/modules/contrib/menu_block/js/menu-block.js similarity index 95% rename from profiles/openasu/modules/contrib/menu_block/menu-block.js rename to profiles/openasu/modules/contrib/menu_block/js/menu-block.js index 73a99adbb9..2d7d85e628 100644 --- a/profiles/openasu/modules/contrib/menu_block/menu-block.js +++ b/profiles/openasu/modules/contrib/menu_block/js/menu-block.js @@ -22,7 +22,7 @@ Drupal.behaviors.menu_block = { } }); - // Syncronize the display of menu and parent item selects. + // Synchronize the display of menu and parent item selects. $('.menu-block-parent-mlid', context).change( function() { var menuItem = $(this).val().split(':'); $('.menu-block-menu-name').val(menuItem[0]); diff --git a/profiles/openasu/modules/contrib/menu_block/menu_block.admin.inc b/profiles/openasu/modules/contrib/menu_block/menu_block.admin.inc index eda4fd621b..04902624c2 100644 --- a/profiles/openasu/modules/contrib/menu_block/menu_block.admin.inc +++ b/profiles/openasu/modules/contrib/menu_block/menu_block.admin.inc @@ -241,8 +241,8 @@ function menu_block_configure_form($form, &$form_state) { } // Build the standard form. - $form['#attached']['js'][] = drupal_get_path('module', 'menu_block') . '/menu-block.js'; - $form['#attached']['css'][] = drupal_get_path('module', 'menu_block') . '/menu-block.admin.css'; + $form['#attached']['js'][] = drupal_get_path('module', 'menu_block') . '/js/menu-block.js'; + $form['#attached']['css'][] = drupal_get_path('module', 'menu_block') . '/css/menu-block.admin.css'; $form['#attached']['library'][] = array('system', 'ui.button'); $form['menu-block-wrapper-start'] = array( @@ -279,6 +279,12 @@ function menu_block_configure_form($form, &$form_state) { ), ); } + $form['display_empty'] = array( + '#type' => 'checkbox', + '#title' => t('Always display title'), + '#description' => t('Display the block with its title even if the block content is empty.'), + '#default_value' => $config['display_empty'], + ); $form['admin_title'] = array( '#type' => 'textfield', '#default_value' => $config['admin_title'], @@ -395,10 +401,12 @@ function menu_block_configure_form($form, &$form_state) { $form['menu-block-wrapper-close'] = array('#markup' => '
'); // Set visibility of advanced options. - foreach (array('title_link', 'follow', 'depth_relative', 'follow_parent', 'expanded', 'sort', 'parent') as $key) { + foreach (array('title_link', 'display_empty', 'follow', 'depth_relative', 'follow_parent', 'expanded', 'sort', 'parent') as $key) { $form[$key]['#states']['visible'][':input[name=display_options]'] = array('value' => 'advanced'); } - if ($config['title_link'] || $follow || $config['expanded'] || $config['sort'] || $config['parent_mlid']) { + // depth_relative and follow_parent aren't listed below because they require + // $follow to be true. + if ($config['title_link'] || $config['display_empty'] || $follow || $config['expanded'] || $config['sort'] || $config['parent_mlid']) { $form['display_options']['#default_value'] = 'advanced'; } @@ -443,6 +451,7 @@ function _menu_block_block_save($delta = '', $edit = array()) { variable_set("menu_block_{$delta}_parent", $edit['parent']); variable_set("menu_block_{$delta}_level", $edit['level']); variable_set("menu_block_{$delta}_follow", $edit['follow']); + variable_set("menu_block_{$delta}_display_empty", $edit['display_empty']); variable_set("menu_block_{$delta}_depth", $edit['depth']); variable_set("menu_block_{$delta}_depth_relative", $edit['depth_relative']); variable_set("menu_block_{$delta}_expanded", $edit['expanded']); diff --git a/profiles/openasu/modules/contrib/menu_block/menu_block.info b/profiles/openasu/modules/contrib/menu_block/menu_block.info index f64bcf4da5..5a845ab34b 100644 --- a/profiles/openasu/modules/contrib/menu_block/menu_block.info +++ b/profiles/openasu/modules/contrib/menu_block/menu_block.info @@ -6,9 +6,8 @@ dependencies[] = menu (>7.11) configure = admin/config/user-interface/menu-block -; Information added by Drupal.org packaging script on 2015-06-30 -version = "7.x-2.7" +; Information added by Drupal.org packaging script on 2018-12-04 +version = "7.x-2.8" core = "7.x" project = "menu_block" -datestamp = "1435676232" - +datestamp = "1543950483" diff --git a/profiles/openasu/modules/contrib/menu_block/menu_block.module b/profiles/openasu/modules/contrib/menu_block/menu_block.module index a5bf3964f5..705fc85c0f 100644 --- a/profiles/openasu/modules/contrib/menu_block/menu_block.module +++ b/profiles/openasu/modules/contrib/menu_block/menu_block.module @@ -5,7 +5,7 @@ */ /** - * Denotes that the tree should use the menu picked by the curent page. + * Denotes that the tree should use the menu picked by the current page. */ define('MENU_TREE__CURRENT_PAGE_MENU', '_active'); @@ -241,6 +241,7 @@ function menu_block_default_config() { 'admin_title' => '', 'level' => 1, 'follow' => 0, + 'display_empty' => 0, 'depth' => 0, 'depth_relative' => 0, 'expanded' => 0, @@ -532,13 +533,18 @@ function menu_tree_build(array &$config) { $data['subject_array'] = $title; $data['subject'] = drupal_render($title); $data['content'] = array(); - if (!empty($tree) && $output = menu_block_tree_output($tree, $config)) { - $data['content']['#content'] = $output; - $data['content']['#theme'] = array( - 'menu_block_wrapper__' . str_replace('-', '_', $config['delta']), - 'menu_block_wrapper__' . str_replace('-', '_', $config['menu_name']), - 'menu_block_wrapper' - ); + if (!empty($tree) || !empty($config['display_empty'])) { + if ($output = menu_block_tree_output($tree, $config)) { + $data['content']['#content'] = $output; + $data['content']['#theme'] = array( + 'menu_block_wrapper__' . str_replace('-', '_', $config['delta']), + 'menu_block_wrapper__' . str_replace('-', '_', $config['menu_name']), + 'menu_block_wrapper' + ); + } + else { + $data['content']['#content'] = NULL; + } $data['content']['#config'] = $config; $data['content']['#delta'] = $config['delta']; } diff --git a/profiles/openasu/modules/contrib/menu_block/menu_block_export.info b/profiles/openasu/modules/contrib/menu_block/menu_block_export.info index 996c9ac54c..167a62c0fe 100644 --- a/profiles/openasu/modules/contrib/menu_block/menu_block_export.info +++ b/profiles/openasu/modules/contrib/menu_block/menu_block_export.info @@ -9,9 +9,8 @@ files[] = menu_block_export.admin.inc configure = admin/config/user-interface/menu-block/export -; Information added by Drupal.org packaging script on 2015-06-30 -version = "7.x-2.7" +; Information added by Drupal.org packaging script on 2018-12-04 +version = "7.x-2.8" core = "7.x" project = "menu_block" -datestamp = "1435676232" - +datestamp = "1543950483" diff --git a/profiles/openasu/modules/contrib/menu_block/plugins/content_types/menu_tree/menu_tree.inc b/profiles/openasu/modules/contrib/menu_block/plugins/content_types/menu_tree/menu_tree.inc index e57eded279..a31b41793b 100644 --- a/profiles/openasu/modules/contrib/menu_block/plugins/content_types/menu_tree/menu_tree.inc +++ b/profiles/openasu/modules/contrib/menu_block/plugins/content_types/menu_tree/menu_tree.inc @@ -33,8 +33,8 @@ function menu_block_menu_tree_content_type_content_types() { 'defaults' => menu_block_get_config(), // JavaScript and CSS for the config form. - 'js' => array(drupal_get_path('module', 'menu_block') . '/menu-block.js'), - 'css' => array(drupal_get_path('module', 'menu_block') . '/menu-block-admin.css'), + 'js' => array(drupal_get_path('module', 'menu_block') . '/js/menu-block.js'), + 'css' => array(drupal_get_path('module', 'menu_block') . '/css/menu-block.admin.css'), ); $menus = menu_block_get_all_menus(); diff --git a/profiles/openasu/modules/contrib/tablefield/README.txt b/profiles/openasu/modules/contrib/tablefield/README.txt index d9fcb2a090..7c1fd7a08d 100644 --- a/profiles/openasu/modules/contrib/tablefield/README.txt +++ b/profiles/openasu/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/openasu/modules/contrib/tablefield/tablefield.info b/profiles/openasu/modules/contrib/tablefield/tablefield.info index 42bc3df664..f6d33a4187 100644 --- a/profiles/openasu/modules/contrib/tablefield/tablefield.info +++ b/profiles/openasu/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/openasu/modules/contrib/tablefield/tablefield.install b/profiles/openasu/modules/contrib/tablefield/tablefield.install index 4eb31864d4..81de25839f 100644 --- a/profiles/openasu/modules/contrib/tablefield/tablefield.install +++ b/profiles/openasu/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/openasu/modules/contrib/tablefield/tablefield.module b/profiles/openasu/modules/contrib/tablefield/tablefield.module index 8ae7491c86..75c42d7bdb 100644 --- a/profiles/openasu/modules/contrib/tablefield/tablefield.module +++ b/profiles/openasu/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('
', $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 .= ' '; $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) ? ' ' : ' '); + $output .= !empty($rows) ? ' ' : ' '; 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) ? " \n" : "\n"); + $output .= !empty($rows) ? " \n" : "\n"; } else { $ts = array(); } // Format the table rows: - if (count($rows)) { + if (!empty($rows)) { $output .= "\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/openasu/modules/contrib/tablefield/themeless/README.txt b/profiles/openasu/modules/contrib/tablefield/themeless/README.txt deleted file mode 100644 index 4cd777056c..0000000000 --- a/profiles/openasu/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/openasu/modules/contrib/tablefield/themeless/tablefield_themeless.info b/profiles/openasu/modules/contrib/tablefield/themeless/tablefield_themeless.info deleted file mode 100644 index 39d3661fb7..0000000000 --- a/profiles/openasu/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/openasu/modules/contrib/tablefield/themeless/tablefield_themeless.module b/profiles/openasu/modules/contrib/tablefield/themeless/tablefield_themeless.module deleted file mode 100644 index 885dbd0f55..0000000000 --- a/profiles/openasu/modules/contrib/tablefield/themeless/tablefield_themeless.module +++ /dev/null @@ -1,108 +0,0 @@ - '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/openasu/modules/contrib/tb_megamenu/templates/tb-megamenu-item.tpl.php b/profiles/openasu/modules/contrib/tb_megamenu/templates/tb-megamenu-item.tpl.php index 050c9f3457..2f61cc15b3 100644 --- a/profiles/openasu/modules/contrib/tb_megamenu/templates/tb-megamenu-item.tpl.php +++ b/profiles/openasu/modules/contrib/tb_megamenu/templates/tb-megamenu-item.tpl.php @@ -1,8 +1,8 @@ -
  • class="" role="listitem" aria-level=""> +
  • class="" aria-level=""> " aria-haspopup="true"> - + diff --git a/profiles/openasu/modules/contrib/tb_megamenu/templates/tb-megamenu-nav.tpl.php b/profiles/openasu/modules/contrib/tb_megamenu/templates/tb-megamenu-nav.tpl.php index b4cb221ec2..b4a263ab40 100644 --- a/profiles/openasu/modules/contrib/tb_megamenu/templates/tb-megamenu-nav.tpl.php +++ b/profiles/openasu/modules/contrib/tb_megamenu/templates/tb-megamenu-nav.tpl.php @@ -1,3 +1,3 @@ -