diff --git a/PATCH_LIST.txt b/PATCH_LIST.md similarity index 78% rename from PATCH_LIST.txt rename to PATCH_LIST.md index fdf87e58..0dde4cca 100644 --- a/PATCH_LIST.txt +++ b/PATCH_LIST.md @@ -6,22 +6,12 @@ https://www.drupal.org/node/1754162 //includes/entity.inc //see https://www.drupal.org/node/1003788 - # Modules : - -// link : allow any tld (https://www.drupal.org/node/2299657#comment-11414075) commited in dev cer contentadminrelink -// entity_translation_search_api entityreference feedback -// field_group filter_path_alias -// flag_lists -// nodeformcols -// search_api -// search_api_page -// search_api_solr termreferencetree ?? views wysiwyg diff --git a/sites/all/modules/contrib/dev/ctools/CHANGELOG.txt b/sites/all/modules/contrib/dev/ctools/CHANGELOG.txt deleted file mode 100644 index c5bd5e6d..00000000 --- a/sites/all/modules/contrib/dev/ctools/CHANGELOG.txt +++ /dev/null @@ -1,82 +0,0 @@ -Current API VERSION: 2.0. See API.txt for more information. - -ctools 7.x-1.x-dev -================== -#1008120: "New custom content" shows empty form if custom content panes module is not enabled. -#999302 by troky: Fix jump menu. Apparently this wasn't actually committed the last time it was committed. -#1065976 by tekante and David_Rothstein: Reset plugin static cache during module enable to prevent stale data from harming export ui. -#1016510 by EclipseGC: Make the taxonomy system page functional. - -ctools 7.x-1.x-alpha2 (05-Jan-2011) -=================================== - -#911396 by alex_b: Prevent notices in export UI. -#919768 by mikey_p: Allow url options to be sent to ctools_ajax_command_url(). -#358953 by cedarm: Allow term context to return lowercase, spaces to dashes versions of terms. -#931434 by EclipseGc: Argument plugin for node revision ID. -#910656: CTools AJAX sample wizard demo "domesticated" checkbox value not stored. -#922442 by EugenMayer, neclimdul and voxpelli: Make sure ctools_include can handle '' or NULL directory. -#919956 by traviss359: Correct example in wizard advanced help. -#942968: Fix taxonomy term access rule with tag term vocabs. -#840344: node add argument had crufty code causing notices. -#944462 by longhairedgit: Invalid character in regex causes rare notice. -#938778 by dereine: Fix profile content type for D7 updates. -Add detach event to modal close so that wysiwyg can detach the editor. -Variant titles showing up as blank if more than one variant on a page. -#940016: token support was not yet updated for D7. -#940446: Skip validation on back and cancel buttons in all wizards. -#954492: Redirect not always working in wizard.inc -#955348: Lack of redirect on "Update" button in Page Manager causing data loss sometimes. -#941778: Update and save button should not appear in the "Add variant" path. -#955070 by EclipseGc: Update ctools internal page tokens to work properly on content all content. -#956890 by EclipseGc: Update views_content to not use views dependency since that is gone. -#954728 by EclipseGc: Update node template page function name to not collide with new hook_node_view(). -#946534 by EclipseGc: Add support for field content on all entitities. -#952586 by EclipseGc: Fix node_author content type. -#959206: If a context is not set when rendering content, attempt to guess the context (fixes Views panes where "From context" was added but pane was never edited.) -#961654 by benshell: drupal_alter() only supports 4 arguments. -#911362 by alex_b: Facilitate plugin cache resets for tests. -#945360 by naxoc: node_tag_new() not updated to D7. -#953804 by EclipseGc: Fix node comment rendering. -#953542 by EclipseGc: Fix node rendering. -#953776 by EclipseGc: Fix node link rendering. -#954772 by EclipseGc: Fix node build mode selection in node content type. -#954762 by EclipseGc: Fix comment forbidden theme call. -#954894 by EclipseGc: Fix breadcrumb content type. -#955180 by EclipseGc: Fix page primary navigation type. -#957190 by EclipseGc: Fix page secondary navigation type. -#957194 by EclipseGc: Remove mission content type, since D7 no longer has a site mission. -#957348 by EclipseGc: Fix search form URL path. -#952586 by andypost: Use format_username for displaying unlinked usernames. -#963800 by benshell: Fix query to fetch custom block title. -#983496 by Amitaibu: Fix term argument to use proper load function. -#989484 by Amitaibu: Fix notice in views plugin. -#982496: Fix token context. -#995026: Fix export UI during enable/disable which would throw notices and not properly set/unset menu items. -#998870 by Amitaibu: Fix notice when content has no icon by using function already designed for that. -#983576 by Amitaibu: Node view fallback task showed white screen. -#1004644 by pillarsdotnet: Update a missed theme() call to D7. -#1006162 by aspilicious: .info file cleanup. -#998312 by dereine: Support the expanded/hidden options that Views did for dependent.js -#955030: Remove no longer supported footer message content type. -Fix broken query in term context config. -#992022 by pcambra: Fix node autocomplete. -#946302 by BerdArt and arywyr: Fix PHP 5.3 reference error. -#980528 by das-peter: Notice fix with entity settings. -#999302 by troky: ctools_jump_menu() needed updating to new form parameters. -#964174: stylizer plugin theme delegation was in the wrong place, causing errors. -#991658 by burlap: Fully load the "user" context for the logged in user because not all fields are in $user. -#1014866 by das-peter: Smarter title panes, notice fix on access plugin descriptions. -#1015662 by troky: plugin .info files were not using correct filepaths. -#941780 by EclipseGc: Restore the "No blocks" functionality. -#951048 by EclipseGc: Tighter entity integration so that new entities are automatic contexts and relationships. -#941800 by me and aspilicious: Use Drupal 7 #machine_name automation on page manager pages and all export_ui defaults. -Disabled exportables and pages not properly greyed out. -#969208 by me and benshell: Get user_view and user profile working. -#941796: Recategorize blocks - -ctools 7.x-1.x-alpha1 -===================== - -Changelog reset for 7.x -Basic conversion done during sprint. diff --git a/sites/all/modules/contrib/dev/ctools/UPGRADE.txt b/sites/all/modules/contrib/dev/ctools/UPGRADE.txt index 844ecce4..2fbfa4f7 100644 --- a/sites/all/modules/contrib/dev/ctools/UPGRADE.txt +++ b/sites/all/modules/contrib/dev/ctools/UPGRADE.txt @@ -60,4 +60,4 @@ Upgrading from ctools-6.x-1.x to ctools-7.x-2.x: For all of these forms, the separate settings #trees in the form are now gone, so form ids may be adjusted. Also, these are now all real forms - using CTools form wizard instead of fake subforms as previously. \ No newline at end of file + using CTools form wizard instead of fake subforms as previously. diff --git a/sites/all/modules/contrib/dev/ctools/bulk_export/bulk_export.info b/sites/all/modules/contrib/dev/ctools/bulk_export/bulk_export.info index 22dc566a..9bb33944 100644 --- a/sites/all/modules/contrib/dev/ctools/bulk_export/bulk_export.info +++ b/sites/all/modules/contrib/dev/ctools/bulk_export/bulk_export.info @@ -3,12 +3,9 @@ description = Performs bulk exporting of data objects known about by Chaos tools core = 7.x dependencies[] = ctools package = Chaos tool suite -version = CTOOLS_MODULE_VERSION - -; Information added by Drupal.org packaging script on 2016-11-22 -version = "7.x-1.12" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1479787162" - +datestamp = "1549603691" diff --git a/sites/all/modules/contrib/dev/ctools/bulk_export/bulk_export.module b/sites/all/modules/contrib/dev/ctools/bulk_export/bulk_export.module index afb15b9e..1050caa6 100644 --- a/sites/all/modules/contrib/dev/ctools/bulk_export/bulk_export.module +++ b/sites/all/modules/contrib/dev/ctools/bulk_export/bulk_export.module @@ -137,7 +137,7 @@ function bulk_export_export($cli = FALSE, $options = array()) { // Add hook_ctools_plugin_api at the top of the module code, if there is any. if ($api_code) { foreach ($api_code as $api_hook => $text) { - $api = "\n/**\n"; + $api = "\n/**\n"; $api .= " * Implements hook_$api_hook().\n"; $api .= " */\n"; $api .= "function {$module_name}_$api_hook(\$module, \$api) {\n"; @@ -148,7 +148,7 @@ function bulk_export_export($cli = FALSE, $options = array()) { } if ($module_code) { - $module = "conf['css_id'] = 'my-id'; +} + /** * @} End of "addtogroup hooks". */ diff --git a/sites/all/modules/contrib/dev/ctools/ctools.info b/sites/all/modules/contrib/dev/ctools/ctools.info index 3a2d031e..188b55dd 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools.info +++ b/sites/all/modules/contrib/dev/ctools/ctools.info @@ -12,13 +12,15 @@ files[] = tests/context.test files[] = tests/css.test files[] = tests/css_cache.test files[] = tests/ctools.plugins.test +files[] = tests/ctools.test files[] = tests/math_expression.test files[] = tests/math_expression_stack.test files[] = tests/object_cache.test +files[] = tests/object_cache_unit.test +files[] = tests/page_tokens.test -; Information added by Drupal.org packaging script on 2016-11-22 -version = "7.x-1.12" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1479787162" - +datestamp = "1549603691" diff --git a/sites/all/modules/contrib/dev/ctools/ctools.install b/sites/all/modules/contrib/dev/ctools/ctools.install index e96c7432..d50bc9f8 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools.install +++ b/sites/all/modules/contrib/dev/ctools/ctools.install @@ -12,24 +12,25 @@ function ctools_requirements($phase) { $requirements = array(); if ($phase == 'runtime') { + $t = get_t(); $requirements['ctools_css_cache'] = array( - 'title' => t('CTools CSS Cache'), + 'title' => $t('CTools CSS Cache'), 'severity' => REQUIREMENT_OK, - 'value' => t('Exists'), + 'value' => $t('Exists'), ); $path = 'public://ctools/css'; if (!file_prepare_directory($path, FILE_CREATE_DIRECTORY)) { - $requirements['ctools_css_cache']['description'] = t('The CTools CSS cache directory, %path could not be created due to a misconfigured files directory. Please ensure that the files directory is correctly configured and that the webserver has permission to create directories.', array('%path' => file_uri_target($path))); + $requirements['ctools_css_cache']['description'] = $t('The CTools CSS cache directory, %path could not be created due to a misconfigured files directory. Please ensure that the files directory is correctly configured and that the webserver has permission to create directories.', array('%path' => file_uri_target($path))); $requirements['ctools_css_cache']['severity'] = REQUIREMENT_ERROR; - $requirements['ctools_css_cache']['value'] = t('Unable to create'); + $requirements['ctools_css_cache']['value'] = $t('Unable to create'); } if (!function_exists('error_get_last')) { - $requirements['ctools_php_52']['title'] = t('CTools PHP requirements'); - $requirements['ctools_php_52']['description'] = t('CTools requires certain features only available in PHP 5.2.0 or higher.'); + $requirements['ctools_php_52']['title'] = $t('CTools PHP requirements'); + $requirements['ctools_php_52']['description'] = $t('CTools requires certain features only available in PHP 5.2.0 or higher.'); $requirements['ctools_php_52']['severity'] = REQUIREMENT_WARNING; - $requirements['ctools_php_52']['value'] = t('PHP !version', array('!version' => phpversion())); + $requirements['ctools_php_52']['value'] = $t('PHP !version', array('!version' => phpversion())); } } @@ -40,7 +41,19 @@ function ctools_requirements($phase) { * Implements hook_schema(). */ function ctools_schema() { - return ctools_schema_3(); + return ctools_schema_4(); +} + +/** + * Version 4 of the CTools schema. + */ +function ctools_schema_4() { + $schema = ctools_schema_3(); + + // Removed due to alternative database configuration issues. + // @see https://www.drupal.org/project/ctools/issues/2941920 + + return $schema; } /** @@ -49,7 +62,7 @@ function ctools_schema() { function ctools_schema_3() { $schema = ctools_schema_2(); - // update the 'obj' field to be 128 bytes long: + // Update the 'obj' field to be 128 bytes long: $schema['ctools_object_cache']['fields']['obj']['length'] = 128; return $schema; @@ -61,7 +74,7 @@ function ctools_schema_3() { function ctools_schema_2() { $schema = ctools_schema_1(); - // update the 'name' field to be 128 bytes long: + // Update the 'name' field to be 128 bytes long: $schema['ctools_object_cache']['fields']['name']['length'] = 128; // Update the 'data' field to be type 'blob'. @@ -95,10 +108,10 @@ function ctools_schema_2() { 'serialize' => TRUE, ), 'filter' => array( - 'type' => 'int', - 'size' => 'tiny', - 'description' => 'Whether or not this CSS needs to be filtered.', - ), + 'type' => 'int', + 'size' => 'tiny', + 'description' => 'Whether or not this CSS needs to be filtered.', + ), ), 'primary key' => array('cid'), ); @@ -197,7 +210,7 @@ function ctools_update_6003() { if ($result) { db_delete('system')->condition('name', 'panels_views')->execute(); module_enable(array('views_content'), TRUE); - } + } } /** @@ -216,7 +229,7 @@ function ctools_update_6005() { } /** - * ctools_custom_content table was originally here, but is now moved to + * The ctools_custom_content table was originally here, but is now moved to * its own module. */ function ctools_update_6007() { @@ -230,18 +243,18 @@ function ctools_update_6007() { } /** - * ctools_object_cache needs to be defined as a blob. + * The ctools_object_cache needs to be defined as a blob. */ function ctools_update_6008() { db_delete('ctools_object_cache') ->execute(); db_change_field('ctools_object_cache', 'data', 'data', array( - 'type' => 'blob', - 'size' => 'big', - 'description' => 'Serialized data being stored.', - 'serialize' => TRUE, - ) + 'type' => 'blob', + 'size' => 'big', + 'description' => 'Serialized data being stored.', + 'serialize' => TRUE, + ) ); } @@ -263,3 +276,24 @@ function ctools_update_7001() { 'description' => 'The type of the object this cache is attached to; this essentially represents the owner so that several sub-systems can use this cache.', )); } + +/** + * Increase the length of the ctools_object_cache.name column to 255. + */ +function ctools_update_7002() { + // Removed due to alternative database configuration issues. + // @see https://www.drupal.org/project/ctools/issues/2941920 +} + +/** + * Revert the length of the ctools_object_cache.name column back to 128. + */ +function ctools_update_7003() { + db_delete('ctools_object_cache')->execute(); + db_change_field('ctools_object_cache', 'name', 'name', array( + 'type' => 'varchar', + 'length' => '128', + 'not null' => TRUE, + 'description' => 'The name of the object this cache is attached to.', + )); +} diff --git a/sites/all/modules/contrib/dev/ctools/ctools.module b/sites/all/modules/contrib/dev/ctools/ctools.module index 78ac26bc..62f29192 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools.module +++ b/sites/all/modules/contrib/dev/ctools/ctools.module @@ -22,8 +22,11 @@ define('CTOOLS_API_VERSION', '2.0.9'); * simply include a dependency line in that module's info file, e.g.: * ; Requires CTools v7.x-1.4 or newer. * dependencies[] = ctools (>=1.4) + * + * @deprecated in CTools 1.15 and will be removed before CTools 2.0.0. + * Use the version provided by the drupal.org packaging system. */ -define('CTOOLS_MODULE_VERSION', '7.x-1.11'); +define('CTOOLS_MODULE_VERSION', '7.x-1.13'); /** * Test the CTools API version. @@ -75,6 +78,9 @@ define('CTOOLS_MODULE_VERSION', '7.x-1.11'); * The minimum version of CTools necessary for your software to run with it. * @param $maximum * The maximum version of CTools allowed for your software to run with it. + * + * @return bool + * TRUE if the running ctools is usable, FALSE otherwise. */ function ctools_api_version($minimum, $maximum = NULL) { if (version_compare(CTOOLS_API_VERSION, $minimum, '<')) { @@ -89,8 +95,7 @@ function ctools_api_version($minimum, $maximum = NULL) { } // ----------------------------------------------------------------------- -// General utility functions - +// General utility functions. /** * Include .inc files as necessary. * @@ -118,6 +123,7 @@ function ctools_api_version($minimum, $maximum = NULL) { * @param $dir * Optional subdirectory containing the include file. */ + function ctools_include($file, $module = 'ctools', $dir = 'includes') { static $used = array(); @@ -147,8 +153,8 @@ function ctools_form_include(&$form_state, $file, $module = 'ctools', $dir = 'in /** * Add an arbitrary path to the $form_state so it can work with form cache. * - * module_load_include uses an unfortunately annoying syntax to work, making it - * difficult to translate the more simple $path + $file syntax. + * The module_load_include() function uses an unfortunately annoying syntax to + * work, making it difficult to translate the more simple $path + $file syntax. */ function ctools_form_include_file(&$form_state, $filename) { if (!isset($form_state['build_info']['args'])) { @@ -172,6 +178,9 @@ function ctools_form_include_file(&$form_state, $filename) { * Optional module containing the include. * @param $dir * Optional subdirectory containing the include file. + * + * @return string + * A string containing the appropriate path from drupal root. */ function ctools_image_path($image, $module = 'ctools', $dir = 'images') { return drupal_get_path('module', $module) . "/$dir/" . $image; @@ -211,6 +220,9 @@ function ctools_add_css($file, $module = 'ctools', $dir = 'css') { * Optional module containing the include. * @param $dir * Optional subdirectory containing the include file. + * + * @return string + * A string containing the appropriate path from drupal root. */ function ctools_attach_css($file, $module = 'ctools', $dir = 'css') { return drupal_get_path('module', $module) . "/$dir/$file.css"; @@ -249,6 +261,9 @@ function ctools_add_js($file, $module = 'ctools', $dir = 'js') { * Optional module containing the include. * @param $dir * Optional subdirectory containing the include file. + * + * @return string + * A string containing the appropriate path from drupal root. */ function ctools_attach_js($file, $module = 'ctools', $dir = 'js') { return drupal_get_path('module', $module) . "/$dir/$file.js"; @@ -267,16 +282,29 @@ function ctools_get_roles() { return user_roles(); } -/* - * Break x,y,z and x+y+z into an array. Numeric only. +/** + * Parse integer sequences of the form "x,y,z" or "x+y+z" into separate values. + * + * A string with integers separated by comma (,) is reported as an 'and' set; + * separation by a plus sign (+) or a space ( ) is an 'or' set. The meaning + * of this is up to the caller. Negative or fractional numbers are not + * recognised. + * + * Additional space characters within or around the sequence are not allowed. * * @param $str * The string to parse. * - * @return $object - * An object containing - * - operator: Either 'and' or 'or' - * - value: An array of numeric values. + * @return object + * An object containing the properties: + * + * - operator: Either 'and' or 'or' when there are multiple matched values. + * Absent when invalid_input is TRUE or there is only one value. + * - value: An array of integers (never strings) from $str. An empty array is + * returned if the input is empty. A single integer input is returned + * as a single value, but no 'operator' is defined. + * - invalid_input: TRUE if input could not be parsed and the values array + * will contain just -1. This property is otherwise absent. */ function ctools_break_phrase($str) { $object = new stdClass(); @@ -286,7 +314,7 @@ function ctools_break_phrase($str) { $object->operator = 'or'; $object->value = preg_split('/[+ ]/', $str); } - else if (preg_match('/^([0-9]+,)*[0-9]+$/', $str)) { + elseif (preg_match('/^([0-9]+,)*[0-9]+$/', $str)) { $object->operator = 'and'; $object->value = explode(',', $str); } @@ -304,7 +332,7 @@ function ctools_break_phrase($str) { // Doubly ensure that all values are numeric only. foreach ($object->value as $id => $value) { - $object->value[$id] = intval($value); + $object->value[$id] = (int) $value; } return $object; @@ -314,23 +342,29 @@ function ctools_break_phrase($str) { * Set a token/value pair to be replaced later in the request, specifically in * ctools_page_token_processing(). * - * @param $token + * @param string $token * The token to be replaced later, during page rendering. This should - * ideally be a string inside of an HTML comment, so that if there is - * no replacement, the token will not render on the page. - * @param $type + * ideally be a string inside of an HTML comment, so that if there is + * no replacement, the token will not render on the page. + * If $token is NULL, the token set is not changed, but is still + * returned. + * @param string $type * The type of the token. Can be either 'variable', which will pull data - * directly from the page variables - * @param $argument - * If $type == 'variable' then argument should be the key to fetch from - * the $variables. If $type == 'callback' then it should either be the - * callback, or an array that will be sent to call_user_func_array(). + * directly from the page variables, or 'callback', which causes a function + * to be called to calculate the value. No other values are supported. + * @param string|array $argument + * For $type of: + * - 'variable': argument should be the key to fetch from the $variables. + * - 'callback': then it should either be the callback function name as a + * string, or an array that will be sent to call_user_func_array(). Argument + * arrays must not use array keys (i.e. $a[0] is the first and $a[1] the + * second element, etc.) * - * @return + * @return array * A array of token/variable names to be replaced. */ function ctools_set_page_token($token = NULL, $type = NULL, $argument = NULL) { - static $tokens = array(); + $tokens = &drupal_static('ctools_set_page_token', array()); if (isset($token)) { $tokens[$token] = array($type, $argument); @@ -339,13 +373,32 @@ function ctools_set_page_token($token = NULL, $type = NULL, $argument = NULL) { } /** - * Easily set a token from the page variables. + * Reset the defined page tokens within this request. + * + * Introduced for simpletest purposes. Normally not needed. + */ +function ctools_reset_page_tokens() { + drupal_static_reset('ctools_set_page_token'); +} + +/** + * Set a replacement token from the containing element's children during #post_render. * * This function can be used like this: - * $token = ctools_set_variable_token('tabs'); + * $token = ctools_set_variable_token('tabs'); * - * $token will then be a simple replacement for the 'tabs' about of the - * variables available in the page template. + * The token "" would then be replaced by the value of + * this element's (sibling) render array key 'tabs' during post-render (or be + * deleted if there was no such key by that point). + * + * @param string $token + * The token string for the page callback, e.g. 'title'. + * + * @return string + * The constructed token. + * + * @see ctools_set_callback_token() + * @see ctools_page_token_processing() */ function ctools_set_variable_token($token) { $string = ''; @@ -354,10 +407,45 @@ function ctools_set_variable_token($token) { } /** - * Easily set a token from the page variables. + * Set a replacement token from the value of a function during #post_render. * * This function can be used like this: - * $token = ctools_set_variable_token('id', 'mymodule_myfunction'); + * $token = ctools_set_callback_token('id', 'mymodule_myfunction'); + * + * Or this (from its use in ctools_page_title_content_type_render): + * $token = ctools_set_callback_token('title', array( + * 'ctools_page_title_content_type_token', $conf['markup'], $conf['id'], $conf['class'] + * ) + * ); + * + * The token (e.g: "") + * would then be replaced during post-render by the return value of: + * + * ctools_page_title_content_type_token($value_markup, $value_id, $value_class); + * + * @param string $token + * The token string for the page callback, e.g. 'title'. + * + * @param string|array $callback + * For callback functions that require no args, the name of the function as a + * string; otherwise an array of two or more elements: the function name + * followed by one or more function arguments. + * + * NB: the value of $callback must be a procedural (non-class) function that + * passes the php function_exists() check. + * + * The callback function itself will be called with args dependent + * on $callback. If: + * - $callback is a string, the function is called with a reference to the + * render array; + * - $callback is an array, the function is called with $callback merged + * with an array containing a reference to the render array. + * + * @return string + * The constructed token. + * + * @see ctools_set_variable_token() + * @see ctools_page_token_processing() */ function ctools_set_callback_token($token, $callback) { // If the callback uses arguments they are considered in the token. @@ -384,9 +472,9 @@ function ctools_set_no_blocks($blocks = FALSE) { /** * Wrapper function to create UUIDs via ctools, falls back on UUID module * if it is enabled. This code is a copy of uuid.inc from the uuid module. + * * @see http://php.net/uniqid#65879 */ - function ctools_uuid_generate() { if (!module_exists('uuid')) { ctools_include('uuid'); @@ -413,6 +501,7 @@ function ctools_uuid_generate() { /** * Check that a string appears to be in the format of a UUID. + * * @see http://drupal.org/project/uuid * * @param $uuid @@ -468,6 +557,8 @@ function ctools_class_add($classes, $hook = 'html') { */ function ctools_class_remove($classes, $hook = 'html') { if (!is_array($classes)) { + // @todo Consider using explode(' ', $classes); + // @todo Consider checking that $classes is a string before adding. $classes = array($classes); } @@ -480,12 +571,35 @@ function ctools_class_remove($classes, $hook = 'html') { } } -// ----------------------------------------------------------------------- -// Drupal core hooks +/** + * Reset the storage used for ctools_class_add and ctools_class_remove. + * + * @see ctools_class_add() + * @see ctools_class_remove() + */ +function ctools_class_reset() { + drupal_static_reset('ctools_process_classes'); +} +/** + * Return the classes for the body (added by ctools_class_add). + * + * @return array + * A copy of the array of classes to add to the body tag. If none have been + * added, this will be an empty array. + * + * @see ctools_class_add() + */ +function ctools_get_classes() { + return drupal_static('ctools_process_classes', array()); +} + +// ----------------------------------------------------------------------- +// Drupal core hooks. /** * Implement hook_init to keep our global CSS at the ready. */ + function ctools_init() { ctools_add_css('ctools'); // If we are sure that CTools' AJAX is in use, change the error handling. @@ -504,7 +618,7 @@ function ctools_init() { * Shutdown handler used during ajax operations to help catch fatal errors. */ function ctools_shutdown_handler() { - if (function_exists('error_get_last') AND ($error = error_get_last())) { + if (function_exists('error_get_last') && ($error = error_get_last())) { switch ($error['type']) { case E_ERROR: case E_CORE_ERROR: @@ -583,7 +697,6 @@ function ctools_flush_caches() { /** * Implements hook_element_info_alter(). - * */ function ctools_element_info_alter(&$type) { ctools_include('dependent'); @@ -619,10 +732,10 @@ function ctools_registry_files_alter(&$files, $indexed_modules) { // ----------------------------------------------------------------------- // FAPI hooks that must be in the .module file. - /** * Alter the comment form to get a little more control over it. */ + function ctools_form_comment_form_alter(&$form, &$form_state) { if (!empty($form_state['ctools comment alter'])) { // Force the form to post back to wherever we are. @@ -640,11 +753,11 @@ function ctools_node_comment_form_submit(&$form, &$form_state) { // ----------------------------------------------------------------------- // CTools hook implementations. - /** * Implementation of hook_ctools_plugin_directory() to let the system know * where all our own plugins are. */ + function ctools_ctools_plugin_directory($owner, $plugin_type) { if ($owner == 'ctools') { return 'plugins/' . $plugin_type; @@ -665,11 +778,11 @@ function ctools_ctools_plugin_type() { // ----------------------------------------------------------------------- // Drupal theme preprocess hooks that must be in the .module file. - /** * A theme preprocess function to automatically allow panels-based node * templates based upon input when the panel was configured. */ + function ctools_preprocess_node(&$vars) { // The 'ctools_template_identifier' attribute of the node is added when the pane is // rendered. @@ -679,14 +792,13 @@ function ctools_preprocess_node(&$vars) { } } - /** * Implements hook_page_alter(). * * Last ditch attempt to remove sidebar regions if the "no blocks" * functionality has been activated. * - * @see ctools_block_list_alter(). + * @see ctools_block_list_alter() */ function ctools_page_alter(&$page) { $check = drupal_static('ctools_set_no_blocks', TRUE); @@ -716,6 +828,7 @@ function ctools_page_token_processing($children, $elements) { case 'variable': $tokens[$token] = isset($elements[$argument]) ? $elements[$argument] : ''; break; + case 'callback': if (is_string($argument) && function_exists($argument)) { $tokens[$token] = $argument($elements); @@ -744,7 +857,7 @@ function ctools_process(&$variables, $hook) { return; } - $classes = drupal_static('ctools_process_classes', array()); + $classes = ctools_get_classes(); // Process the classses to add. if (!empty($classes[$hook]['add'])) { @@ -758,12 +871,6 @@ function ctools_process(&$variables, $hook) { $variables['classes_array'] = array_diff($variables['classes_array'], $remove_classes); } - // Update the classes within the attributes array to match the classes array - if (isset($variables['attributes_array']['class'])) { - $variables['attributes_array']['class'] = array_unique(array_merge($variables['classes_array'], $variables['attributes_array']['class'])); - $variables['attributes'] = $variables['attributes_array'] ? drupal_attributes($variables['attributes_array']) : ''; - } - // Since this runs after template_process(), we need to re-implode the // classes array. $variables['classes'] = implode(' ', $variables['classes_array']); @@ -771,7 +878,6 @@ function ctools_process(&$variables, $hook) { // ----------------------------------------------------------------------- // Menu callbacks that must be in the .module file. - /** * Determine if the current user has access via a plugin. * @@ -795,6 +901,7 @@ function ctools_process(&$variables, $hook) { * @return * TRUE if access is granted, false if otherwise. */ + function ctools_access_menu($access) { // Short circuit everything if there are no access tests. if (empty($access['plugins'])) { @@ -823,7 +930,7 @@ function ctools_access_menu($access) { * An indexed array of zero or more permission strings to be checked by * user_access(). * - * @return + * @return bool * Iff all checks pass will this function return TRUE. If an invalid argument * is passed (e.g., not a string), this function errs on the safe said and * returns FALSE. @@ -885,7 +992,6 @@ function ctools_export_ui_load($item_name, $plugin_name) { // ----------------------------------------------------------------------- // Caching callbacks on behalf of export-ui. - /** * Menu access callback for various tasks of export-ui. */ @@ -929,7 +1035,7 @@ function ctools_export_ui_ctools_access_get($argument) { } /** - * Callback for access control ajax form on behalf of export ui + * Callback for access control ajax form on behalf of export ui. * * Returns the cached access config and contexts used. * Note that this is assuming that access will be in $item->access -- if it @@ -962,8 +1068,9 @@ function ctools_menu_local_tasks_alter(&$data, $router_item, $root_path) { } /** - * Implement hook_block_list_alter() to potentially remove blocks. + * Implements hook_block_list_alter(). * + * Used to potentially remove blocks. * This exists in order to replicate Drupal 6's "no blocks" functionality. */ function ctools_block_list_alter(&$blocks) { @@ -1026,6 +1133,7 @@ function ctools_ctools_entity_context_alter(&$plugin, &$entity, $plugin_id) { case 'entity_id:taxonomy_term': $plugin['no ui'] = TRUE; break; + case 'entity:user': $plugin = ctools_get_context('user'); unset($plugin['no ui']); @@ -1059,18 +1167,21 @@ function ctools_field_create_field($field) { function ctools_field_create_instance($instance) { ctools_flush_field_caches(); } + /** * Implements hook_field_delete_field(). */ function ctools_field_delete_field($field) { ctools_flush_field_caches(); } + /** * Implements hook_field_delete_instance(). */ function ctools_field_delete_instance($instance) { ctools_flush_field_caches(); } + /** * Implements hook_field_update_field(). */ diff --git a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/ctools_access_ruleset.info b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/ctools_access_ruleset.info index bfa17834..3fc35564 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/ctools_access_ruleset.info +++ b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/ctools_access_ruleset.info @@ -2,12 +2,10 @@ name = Custom rulesets description = Create custom, exportable, reusable access rulesets for applications like Panels. core = 7.x package = Chaos tool suite -version = CTOOLS_MODULE_VERSION dependencies[] = ctools -; Information added by Drupal.org packaging script on 2016-11-22 -version = "7.x-1.12" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1479787162" - +datestamp = "1549603691" diff --git a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/ctools_access_ruleset.install b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/ctools_access_ruleset.install index 3f008772..70afb3c6 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/ctools_access_ruleset.install +++ b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/ctools_access_ruleset.install @@ -1,5 +1,9 @@ t('Custom rulesets are combinations of access plugins you can use for access control, selection criteria and pane visibility.'), ); - // Load all mini panels and their displays. + // Load all mini panels and their displays. ctools_include('export'); $items = ctools_export_crud_load_all('ctools_access_ruleset'); $count = 0; diff --git a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/access/ruleset.inc b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/access/ruleset.inc index f8abea6d..95f32c37 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/access/ruleset.inc +++ b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/access/ruleset.inc @@ -35,7 +35,7 @@ function ctools_ruleset_ctools_access_merge_plugin($plugin, $parent, $item) { $plugin['required context'] = array(); foreach ($item->requiredcontexts as $context) { $info = ctools_get_context($context['name']); - // TODO: allow an optional setting + // TODO: allow an optional setting. $plugin['required context'][] = new ctools_context_required($context['identifier'], $info['context name']); } } @@ -72,7 +72,7 @@ function ctools_ruleset_ctools_access_get_children($plugin, $parent) { } /** - * Settings form for the 'by ruleset' access plugin + * Settings form for the 'by ruleset' access plugin. */ function ctools_ruleset_ctools_access_settings(&$form, &$form_state, $conf) { if (!empty($form_state['plugin']['ruleset']->admin_description)) { @@ -106,4 +106,3 @@ function ctools_ruleset_ctools_access_summary($conf, $context, $plugin) { return check_plain($plugin['ruleset']->admin_title); } } - diff --git a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset.inc b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset.inc index d2a1c605..2589ac38 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset.inc +++ b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset.inc @@ -1,5 +1,9 @@ 'ctools_access_ruleset', 'access' => 'administer ctools access ruleset', @@ -26,4 +30,3 @@ $plugin = array( ), ), ); - diff --git a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php index b1814645..c9f8c20f 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php +++ b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php @@ -2,7 +2,7 @@ class ctools_access_ruleset_ui extends ctools_export_ui { - function edit_form_context(&$form, &$form_state) { + public function edit_form_context(&$form, &$form_state) { ctools_include('context-admin'); ctools_context_admin_includes(); ctools_add_css('ruleset'); @@ -27,7 +27,7 @@ class ctools_access_ruleset_ui extends ctools_export_ui { ctools_context_add_relationship_form($module, $form, $form_state, $form['right']['relationships_table'], $form_state['item'], $name); } - function edit_form_rules(&$form, &$form_state) { + public function edit_form_rules(&$form, &$form_state) { // The 'access' UI passes everything via $form_state, unlike the 'context' UI. // The main difference is that one is about 3 years newer than the other. ctools_include('context'); @@ -43,11 +43,12 @@ class ctools_access_ruleset_ui extends ctools_export_ui { $form = ctools_access_admin_form($form, $form_state); } - function edit_form_rules_submit(&$form, &$form_state) { + public function edit_form_rules_submit(&$form, &$form_state) { $form_state['item']->access['logic'] = $form_state['values']['logic']; } - function edit_form_submit(&$form, &$form_state) { + public function edit_form_submit(&$form, &$form_state) { parent::edit_form_submit($form, $form_state); } + } diff --git a/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/css/ctools-ajax-sample.css b/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/css/ctools-ajax-sample.css index 8df17de5..c312e991 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/css/ctools-ajax-sample.css +++ b/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/css/ctools-ajax-sample.css @@ -1,52 +1,52 @@ div.ctools-sample-modal-content { - background:none; - border:0; - color:#000000; - margin:0; - padding:0; - text-align:left; + background: none; + border: 0; + color: #000; + margin: 0; + padding: 0; + text-align: left; } -div.ctools-sample-modal-content .modal-scroll{ - overflow:hidden; - overflow-y:auto; +div.ctools-sample-modal-content .modal-scroll { + overflow: hidden; + overflow-y: auto; } div.ctools-sample-modal-content #popups-overlay { - background-color:transparent; + background-color: transparent; } div.ctools-sample-modal-content #popups-loading { - width:248px; - position:absolute; - display:none; - opacity:1; + width: 248px; + position: absolute; + display: none; + opacity: 1; -moz-border-radius: 8px; -webkit-border-radius: 8px; - z-index:99; + z-index: 99; } div.ctools-sample-modal-content #popups-loading span.popups-loading-message { - background:#FFF url(../images/loading-large.gif) no-repeat 8px center; - display:block; - color:#444444; - font-family:Arial; - font-size:22px; - font-weight:bold; - height:36px; - line-height:36px; - padding:0 40px; + background: #fff url(../images/loading-large.gif) no-repeat 8px center; + display: block; + color: #444; + font-family: Arial, serif; + font-size: 22px; + font-weight: bold; + height: 36px; + line-height: 36px; + padding: 0 40px; } div.ctools-sample-modal-content #popups-loading table, div.ctools-sample-modal-content .popups-box table { - margin:0px; + margin: 0; } div.ctools-sample-modal-content #popups-loading tbody, div.ctools-sample-modal-content .popups-box tbody { - border:none; + border: none; } div.ctools-sample-modal-content .popups-box tr { - background-color:transparent; + background-color: transparent; } div.ctools-sample-modal-content td.popups-border { background: url(../images/popups-border.png); - background-color:transparent; + background-color: transparent; border: none; } div.ctools-sample-modal-content td.popups-tl, @@ -54,79 +54,94 @@ div.ctools-sample-modal-content td.popups-tr, div.ctools-sample-modal-content td.popups-bl, div.ctools-sample-modal-content td.popups-br { background-repeat: no-repeat; - height:10px; - padding:0px; + height: 10px; + padding: 0; +} +div.ctools-sample-modal-content td.popups-tl { + background-position: 0 0; } -div.ctools-sample-modal-content td.popups-tl { background-position: 0px 0px; } div.ctools-sample-modal-content td.popups-t, div.ctools-sample-modal-content td.popups-b { - background-position: 0px -40px; + background-position: 0 -40px; background-repeat: repeat-x; } -div.ctools-sample-modal-content td.popups-tr { background-position: 0px -10px; width: 10px; } +div.ctools-sample-modal-content td.popups-tr { + background-position: 0 -10px; + width: 10px; +} div.ctools-sample-modal-content td.popups-cl, div.ctools-sample-modal-content td.popups-cr { background-position: -10px 0; background-repeat: repeat-y; - width:10px; + width: 10px; } div.ctools-sample-modal-content td.popups-cl, div.ctools-sample-modal-content td.popups-cr, -div.ctools-sample-modal-content td.popups-c { padding:0; border: none; } -div.ctools-sample-modal-content td.popups-c { background:#fff; } -div.ctools-sample-modal-content td.popups-bl { background-position: 0px -20px; } -div.ctools-sample-modal-content td.popups-br { background-position: 0px -30px; width: 10px; } +div.ctools-sample-modal-content td.popups-c { + padding: 0; + border: none; +} +div.ctools-sample-modal-content td.popups-c { + background: #fff; +} +div.ctools-sample-modal-content td.popups-bl { + background-position: 0 -20px; +} +div.ctools-sample-modal-content td.popups-br { + background-position: 0 -30px; + width: 10px; +} div.ctools-sample-modal-content .popups-box, div.ctools-sample-modal-content #popups-loading { - border: 0px solid #454545; - opacity:1; - overflow:hidden; - padding:0; - background-color:transparent; + border: 0 solid #454545; + opacity: 1; + overflow: hidden; + padding: 0; + background-color: transparent; } div.ctools-sample-modal-content .popups-container { - overflow:hidden; - height:100%; - background-color:#fff; + overflow: hidden; + height: 100%; + background-color: #fff; } div.ctools-sample-modal-content div.popups-title { - -moz-border-radius-topleft: 0px; - -webkit-border-radius-topleft: 0px; - margin-bottom:0px; - background-color:#ff7200; - border:1px solid #ce5c00; - padding:4px 10px 5px; - color:white; - font-size:1em; - font-weight:bold; + -moz-border-radius-topleft: 0; + -webkit-border-radius-topleft: 0; + margin-bottom: 0; + background-color: #ff7200; + border: 1px solid #ce5c00; + padding: 4px 10px 5px; + color: white; + font-size: 1em; + font-weight: bold; } div.ctools-sample-modal-content .popups-body { - background-color:#fff; - padding:8px; + background-color: #fff; + padding: 8px; } div.ctools-sample-modal-content .popups-box .popups-buttons, div.ctools-sample-modal-content .popups-box .popups-footer { - background-color:#fff; + background-color: #fff; } div.ctools-sample-modal-content .popups-title a.close { color: #fff; - text-decoration:none; + text-decoration: none; } div.ctools-sample-modal-content .popups-close { - font-size:120%; - float:right; - text-align:right; + font-size: 120%; + float: right; + text-align: right; } div.ctools-sample-modal-content .modal-loading-wrapper { - width:220px; - height:19px; - margin:0 auto; - margin-top:2%; + width: 220px; + height: 19px; + margin: 0 auto; + margin-top: 2%; } -div.ctools-sample-modal-content tbody{ - border:none; +div.ctools-sample-modal-content tbody { + border: none; } div.ctools-sample-modal-content .modal-content .modal-throbber-wrapper img { diff --git a/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/ctools_ajax_sample.info b/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/ctools_ajax_sample.info index 52126d51..c2a52df4 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/ctools_ajax_sample.info +++ b/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/ctools_ajax_sample.info @@ -1,13 +1,11 @@ name = Chaos Tools (CTools) AJAX Example description = Shows how to use the power of Chaos AJAX. package = Chaos tool suite -version = CTOOLS_MODULE_VERSION dependencies[] = ctools core = 7.x -; Information added by Drupal.org packaging script on 2016-11-22 -version = "7.x-1.12" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1479787162" - +datestamp = "1549603691" diff --git a/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/ctools_ajax_sample.install b/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/ctools_ajax_sample.install index 04325dbf..e0fdfc6f 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/ctools_ajax_sample.install +++ b/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/ctools_ajax_sample.install @@ -1,18 +1,18 @@ 'Chaos Tools AJAX Demo', - 'page callback' => 'ctools_ajax_sample_page', - 'access callback' => TRUE, - 'type' => MENU_NORMAL_ITEM, + 'title' => 'Chaos Tools AJAX Demo', + 'page callback' => 'ctools_ajax_sample_page', + 'access callback' => TRUE, + 'type' => MENU_NORMAL_ITEM, ); $items['ctools_ajax_sample/simple_form'] = array( 'title' => 'Simple Form', @@ -26,39 +26,39 @@ function ctools_ajax_sample_menu() { 'type' => MENU_CALLBACK, ); $items['ctools_ajax_sample/%ctools_js/hello'] = array( - 'title' => 'Hello World', - 'page callback' => 'ctools_ajax_sample_hello', - 'page arguments' => array(1), - 'access callback' => TRUE, - 'type' => MENU_CALLBACK, + 'title' => 'Hello World', + 'page callback' => 'ctools_ajax_sample_hello', + 'page arguments' => array(1), + 'access callback' => TRUE, + 'type' => MENU_CALLBACK, ); $items['ctools_ajax_sample/%ctools_js/tablenix/%'] = array( - 'title' => 'Hello World', - 'page callback' => 'ctools_ajax_sample_tablenix', - 'page arguments' => array(1, 3), - 'access callback' => TRUE, - 'type' => MENU_CALLBACK, + 'title' => 'Hello World', + 'page callback' => 'ctools_ajax_sample_tablenix', + 'page arguments' => array(1, 3), + 'access callback' => TRUE, + 'type' => MENU_CALLBACK, ); $items['ctools_ajax_sample/%ctools_js/login'] = array( - 'title' => 'Login', - 'page callback' => 'ctools_ajax_sample_login', - 'page arguments' => array(1), - 'access callback' => TRUE, - 'type' => MENU_CALLBACK, + 'title' => 'Login', + 'page callback' => 'ctools_ajax_sample_login', + 'page arguments' => array(1), + 'access callback' => TRUE, + 'type' => MENU_CALLBACK, ); $items['ctools_ajax_sample/%ctools_js/animal'] = array( - 'title' => 'Animal', - 'page callback' => 'ctools_ajax_sample_animal', - 'page arguments' => array(1), - 'access callback' => TRUE, - 'type' => MENU_CALLBACK, + 'title' => 'Animal', + 'page callback' => 'ctools_ajax_sample_animal', + 'page arguments' => array(1), + 'access callback' => TRUE, + 'type' => MENU_CALLBACK, ); $items['ctools_ajax_sample/%ctools_js/login/%'] = array( - 'title' => 'Post-Login Action', - 'page callback' => 'ctools_ajax_sample_login_success', - 'page arguments' => array(1, 3), - 'access callback' => TRUE, - 'type' => MENU_CALLBACK, + 'title' => 'Post-Login Action', + 'page callback' => 'ctools_ajax_sample_login_success', + 'page arguments' => array(1, 3), + 'access callback' => TRUE, + 'type' => MENU_CALLBACK, ); $items['ctools_ajax_sample/jumped'] = array( 'title' => 'Successful Jumping', @@ -104,11 +104,11 @@ function ctools_ajax_sample_theme() { } // --------------------------------------------------------------------------- -// Page callbacks - +// Page callbacks. /** * Page callback to display links and render a container for AJAX stuff. */ + function ctools_ajax_sample_page() { global $user; @@ -156,14 +156,14 @@ function ctools_ajax_sample_page() { // The extra class points to the info in ctools-sample-style which we added // to the settings, prefixed with 'ctools-modal'. - $links[] = ctools_modal_text_button(t('Modal Login (custom style)'), 'ctools_ajax_sample/nojs/login', t('Login via modal'), 'ctools-modal-ctools-sample-style'); + $links[] = ctools_modal_text_button(t('Modal Login (custom style)'), 'ctools_ajax_sample/nojs/login', t('Login via modal'), 'ctools-modal-ctools-sample-style'); } // Four ways to do our animal picking wizard. $button_form = ctools_ajax_sample_ajax_button_form(); $links[] = l(t('Wizard (no modal)'), 'ctools_ajax_sample/nojs/animal'); $links[] = ctools_modal_text_button(t('Wizard (default modal)'), 'ctools_ajax_sample/nojs/animal', t('Pick an animal')); - $links[] = ctools_modal_text_button(t('Wizard (custom modal)'), 'ctools_ajax_sample/nojs/animal', t('Pick an animal'), 'ctools-modal-ctools-sample-style'); + $links[] = ctools_modal_text_button(t('Wizard (custom modal)'), 'ctools_ajax_sample/nojs/animal', t('Pick an animal'), 'ctools-modal-ctools-sample-style'); $links[] = drupal_render($button_form); $links[] = ctools_ajax_text_button(t('Hello world!'), "ctools_ajax_sample/nojs/hello", t('Replace text with "hello world"')); @@ -176,9 +176,9 @@ function ctools_ajax_sample_page() { // Create a table that we can have data removed from via AJAX. $header = array(t('Row'), t('Content'), t('Actions')); $rows = array(); - for($i = 1; $i < 11; $i++) { + for ($i = 1; $i < 11; $i++) { $rows[] = array( - 'class' => array('ajax-sample-row-'. $i), + 'class' => array('ajax-sample-row-' . $i), 'data' => array( $i, md5($i), @@ -189,10 +189,10 @@ function ctools_ajax_sample_page() { $output .= theme('table', array('header' => $header, 'rows' => $rows, array('class' => array('ajax-sample-table')))); - // Show examples of ctools javascript widgets - $output .= '
function ctools_ajax_hello_world($js) { $title = t('Greetings'); - $output = '<p>' . t('Hello world') . ''</p>'; + $output = '<p>' . t('Hello world') . '</p>'; if ($js) { ctools_modal_render($title, $output); } diff --git a/sites/all/modules/contrib/dev/ctools/help/plugins-creating.html b/sites/all/modules/contrib/dev/ctools/help/plugins-creating.html index 23237058..6d5b35f6 100644 --- a/sites/all/modules/contrib/dev/ctools/help/plugins-creating.html +++ b/sites/all/modules/contrib/dev/ctools/help/plugins-creating.html @@ -26,7 +26,7 @@ The following information can be specified for each plugin type:
TRUE
. Do not include <?php ?>. Note that executing incorrect PHP-code can break your Drupal site. All contexts will be available in the $contexts variable.'),
+ '#description' => t('Access will be granted if the following PHP code returns TRUE
. Do not include <?php ?>. Note that executing incorrect PHP-code can break your Drupal site. All contexts will be available in the $contexts variable.'),
);
if (!user_access('use PHP for settings')) {
$form['settings']['php']['#disabled'] = TRUE;
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/query_string_exists.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/query_string_exists.inc
index abec5f7a..fb3b4334 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/access/query_string_exists.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/access/query_string_exists.inc
@@ -23,7 +23,7 @@ function ctools_query_string_exists_ctools_access_settings($form, &$form_state,
'#description' => t('Enter the key of the query string.'),
'#type' => 'textfield',
'#required' => TRUE,
- '#default_value' => $config['key']
+ '#default_value' => $config['key'],
);
return $form;
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/role.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/role.inc
index b6332544..4d8cbae1 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/access/role.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/access/role.inc
@@ -21,7 +21,7 @@ $plugin = array(
);
/**
- * Settings form for the 'by role' access plugin
+ * Settings form for the 'by role' access plugin.
*/
function ctools_role_ctools_access_settings($form, &$form_state, $conf) {
$form['settings']['rids'] = array(
@@ -76,4 +76,3 @@ function ctools_role_ctools_access_summary($conf, $context) {
return format_plural(count($names), '@identifier has role "@roles"', '@identifier has one of "@roles"', array('@roles' => implode(', ', $names), '@identifier' => $context->identifier));
}
-
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/site_language.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/site_language.inc
index 9ff2f70c..5b7b724c 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/access/site_language.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/access/site_language.inc
@@ -22,7 +22,7 @@ if (module_exists('locale')) {
}
/**
- * Settings form for the 'by site_language' access plugin
+ * Settings form for the 'by site_language' access plugin.
*/
function ctools_site_language_ctools_access_settings($form, &$form_state, $conf) {
$options = array(
@@ -84,4 +84,3 @@ function ctools_site_language_ctools_access_summary($conf, $context) {
return format_plural(count($names), 'Site language is "@languages"', 'Site language is one of "@languages"', array('@languages' => implode(', ', $names)));
}
-
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/string_equal.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/string_equal.inc
index ad1c88d8..feb48e9c 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/access/string_equal.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/access/string_equal.inc
@@ -2,7 +2,7 @@
/**
* @file
- * Plugin to provide access control/visibility based on specified context string matching user-specified string
+ * Plugin to provide access control/visibility based on specified context string matching user-specified string.
*/
$plugin = array(
@@ -16,7 +16,7 @@ $plugin = array(
);
/**
- * Settings form
+ * Settings form.
*/
function ctools_string_equal_ctools_access_settings($form, &$form_state, $conf) {
$form['settings']['operator'] = array(
@@ -47,7 +47,7 @@ function ctools_string_equal_ctools_access_settings($form, &$form_state, $conf)
}
/**
- * Check for access
+ * Check for access.
*/
function ctools_string_equal_ctools_access_check($conf, $context) {
if (empty($context) || empty($context->data)) {
@@ -66,29 +66,34 @@ function ctools_string_equal_ctools_access_check($conf, $context) {
switch ($conf['operator']) {
case '=':
return $string === $value;
+
case '!=':
return $string !== $value;
+
case 'regex':
return preg_match($value, $string);
+
case '!regex':
return !preg_match($value, $string);
}
}
/**
- * Provide a summary description based upon the specified context
+ * Provide a summary description based upon the specified context.
*/
function ctools_string_equal_ctools_access_summary($conf, $context) {
$values = array('@identifier' => $context->identifier, '@value' => $conf['value']);
switch ($conf['operator']) {
case '=':
return t('@identifier is "@value"', $values);
+
case '!=':
return t('@identifier is not "@value"', $values);
+
case 'regex':
return t('@identifier matches "@value"', $values);
+
case '!regex':
return t('@identifier does not match "@value"', $values);
}
}
-
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/string_length.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/string_length.inc
index 91abf227..3af504b9 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/access/string_length.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/access/string_length.inc
@@ -57,14 +57,19 @@ function ctools_string_length_ctools_access_check($conf, $context) {
switch ($conf['operator']) {
case '<':
return $length < $conf['length'];
+
case '<=':
return $length <= $conf['length'];
+
case '=':
return $length == $conf['length'];
+
case '!=':
return $length != $conf['length'];
+
case '>':
return $length > $conf['length'];
+
case '>=':
return $length >= $conf['length'];
}
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/term.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/term.inc
index 36e70de4..50ec0d90 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/access/term.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/access/term.inc
@@ -22,7 +22,7 @@ $plugin = array(
);
/**
- * Settings form for the 'by term' access plugin
+ * Settings form for the 'by term' access plugin.
*/
function ctools_term_ctools_access_settings($form, &$form_state, $conf) {
// If no configuration was saved before, set some defaults.
@@ -51,7 +51,6 @@ function ctools_term_ctools_access_settings($form, &$form_state, $conf) {
// A note: Dependency works strangely on these forms as they have never been
// updated to a more modern system so they are not individual forms of their
// own like the content types.
-
$form['settings']['#tree'] = TRUE;
// Loop over each of the configured vocabularies.
@@ -124,6 +123,8 @@ function ctools_term_ctools_access_summary($conf, $context) {
return format_plural(count($terms),
'@term can be the term "@terms"',
'@term can be one of these terms: @terms',
- array('@terms' => implode(', ', $terms),
- '@term' => $context->identifier));
+ array(
+ '@terms' => implode(', ', $terms),
+ '@term' => $context->identifier,
+ ));
}
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/term_has_parent.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/term_has_parent.inc
index a079e92a..16f4fbf6 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/access/term_has_parent.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/access/term_has_parent.inc
@@ -1,4 +1,5 @@
!empty($conf['vid_' . $vid]) ? $conf['vid_' . $vid] : '',
'#size' => 10,
'#multiple' => TRUE,
- //@todo: Remove the following workaround when the following patch is in core. {@see:http://drupal.org/node/1117526}
+ // @todo: Remove the following workaround when the following patch is in core. {@see:http://drupal.org/node/1117526}
'#name' => sprintf("settings[%u][]", $vid),
'#attributes' => array('multiple' => 'multiple'),
);
@@ -71,7 +71,6 @@ function ctools_term_has_parent_ctools_access_settings($form, &$form_state, $con
foreach (taxonomy_get_tree($vocabulary->vid) as $term) {
$terms[$term->tid] = str_repeat('-', $term->depth) . ($term->depth ? ' ' : '') . $term->name;
}
- //$form['settings']['vid_' . $vid]['#type'] = 'select';
$form['settings']['vid_' . $vid]['#type'] = 'checkboxes';
$form['settings']['vid_' . $vid]['#options'] = $terms;
unset($terms);
@@ -116,37 +115,36 @@ function ctools_term_has_parent_ctools_access_check($conf, $context) {
// we'll start looking up the hierarchy from our context term id.
$current_term = $context->data->tid;
- $term='';
+ $term = '';
- // scan up the tree.
- while (true) {
- // select parent as term_parent to avoid PHP5 complications with the parent keyword
- //@todo: Find a way to reduce the number of queries required for really deep hierarchies.
- $term = db_query("SELECT parent AS term_parent, tid AS tid FROM {taxonomy_term_hierarchy} th WHERE th.tid = :tid", array(':tid'=>$current_term))->fetchObject();
+ // Scan up the tree.
+ while (TRUE) {
+ // Select parent as term_parent to avoid PHP5 complications with the parent keyword.
+ // @todo: Find a way to reduce the number of queries required for really deep hierarchies.
+ $term = db_query("SELECT parent AS term_parent, tid AS tid FROM {taxonomy_term_hierarchy} th WHERE th.tid = :tid", array(':tid' => $current_term))->fetchObject();
- // if no term is found, get out of the loop
+ // If no term is found, get out of the loop.
if (!$term || empty($term->tid)) {
break;
}
- // check the term selected, if the user asked it to.
+ // Check the term selected, if the user asked it to.
if (!empty($conf['include_self']) && isset($conf['vid_' . $vid][$term->tid])) {
return TRUE;
}
- // did we find the parent TID we were looking for?
+ // Did we find the parent TID we were looking for?
if (isset($conf['vid_' . $vid][$term->tid])) {
// YES, we're done!
return TRUE;
}
// Nope, we didn't find it.
-
// If this is the top of the hierarchy, stop scanning.
- if ($term->term_parent==0) {
+ if ($term->term_parent == 0) {
break;
}
- // update the parent, and keep scanning.
+ // Update the parent, and keep scanning.
$current_term = $term->term_parent;
}
@@ -157,7 +155,7 @@ function ctools_term_has_parent_ctools_access_check($conf, $context) {
* Provide a summary description based upon the checked terms.
*/
function ctools_term_has_parent_ctools_access_summary($conf, $context) {
- $vid = (int)$conf['vid'];
+ $vid = (int) $conf['vid'];
$terms = array();
foreach ($conf['vid_' . $vid] as $tid) {
$term = taxonomy_term_load($tid);
@@ -167,6 +165,8 @@ function ctools_term_has_parent_ctools_access_summary($conf, $context) {
return format_plural(count($terms),
'@term can have the parent "@terms"',
'@term can have one of these parents: @terms',
- array('@terms' => implode(', ', $terms),
- '@term' => $context->identifier));
+ array(
+ '@terms' => implode(', ', $terms),
+ '@term' => $context->identifier,
+ ));
}
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/term_parent.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/term_parent.inc
index acbaf872..27375dfa 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/access/term_parent.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/access/term_parent.inc
@@ -22,7 +22,7 @@ $plugin = array(
);
/**
- * Settings form for the 'by parent term' access plugin
+ * Settings form for the 'by parent term' access plugin.
*/
function ctools_term_parent_ctools_access_settings($form, &$form_state, $conf) {
// If no configuration was saved before, set some defaults.
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/term_vocabulary.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/term_vocabulary.inc
index b003138d..8e9a0caf 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/access/term_vocabulary.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/access/term_vocabulary.inc
@@ -2,7 +2,7 @@
/**
* @file
- * Plugin to provide access control based upon term vocabulary
+ * Plugin to provide access control based upon term vocabulary.
*/
/**
@@ -20,12 +20,12 @@ $plugin = array(
'required context' => new ctools_context_required(t('Vocabulary'), array(
'taxonomy_term',
'terms',
- 'taxonomy_vocabulary'
+ 'taxonomy_vocabulary',
)),
);
/**
- * Settings form for the 'by term_vocabulary' access plugin
+ * Settings form for the 'by term_vocabulary' access plugin.
*/
function ctools_term_vocabulary_ctools_access_settings($form, &$form_state, $conf) {
$options = array();
@@ -101,7 +101,7 @@ function ctools_term_vocabulary_ctools_access_summary($conf, $context) {
return format_plural(count($names), '@identifier vocabulary is "@machine_names"', '@identifier vocabulary is one of "@machine_names"', array(
'@machine_names' => implode(', ', $names),
- '@identifier' => $context->identifier
+ '@identifier' => $context->identifier,
));
}
@@ -123,5 +123,3 @@ function _ctools_term_vocabulary_ctools_access_map_vids(&$conf) {
}
}
}
-
-
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/theme.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/theme.inc
index 4f4be6de..67e3e6f0 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/access/theme.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/access/theme.inc
@@ -19,7 +19,7 @@ $plugin = array(
);
/**
- * Settings form for the 'by theme' access plugin
+ * Settings form for the 'by theme' access plugin.
*/
function ctools_theme_ctools_access_settings($form, &$form_state, $conf) {
$themes = array();
@@ -44,10 +44,10 @@ function ctools_theme_ctools_access_check($conf, $context) {
if (!empty($GLOBALS['theme'])) {
$theme = $GLOBALS['theme'];
}
- else if (!empty($GLOBALS['custom_theme'])) {
+ elseif (!empty($GLOBALS['custom_theme'])) {
$theme = $GLOBALS['custom_theme'];
}
- else if (!empty($GLOBALS['user']->theme)) {
+ elseif (!empty($GLOBALS['user']->theme)) {
$theme = $GLOBALS['user']->theme;
}
else {
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/entity_id.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/entity_id.inc
index 3063fefd..73bfe1e1 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/entity_id.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/entity_id.inc
@@ -2,7 +2,6 @@
/**
* @file
- *
* Plugin to provide an argument handler for all entity ids.
*/
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/nid.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/nid.inc
index 9aaec0e1..cbb56d3e 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/nid.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/nid.inc
@@ -2,8 +2,7 @@
/**
* @file
- *
- * Plugin to provide an argument handler for a node id
+ * Plugin to provide an argument handler for a node id.
*/
/**
@@ -47,4 +46,3 @@ function ctools_argument_nid_context($arg = NULL, $conf = NULL, $empty = FALSE)
return ctools_context_create('node', $node);
}
-
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/node_add.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/node_add.inc
index c811311b..f249a945 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/node_add.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/node_add.inc
@@ -2,8 +2,7 @@
/**
* @file
- *
- * Plugin to provide an argument handler for a Node add form
+ * Plugin to provide an argument handler for a Node add form.
*/
/**
@@ -12,7 +11,7 @@
*/
$plugin = array(
'title' => t("Node add form: node type"),
- // keyword to use for %substitution
+ // Keyword to use for %substitution.
'keyword' => 'node_type',
'description' => t('Creates a node add form context from a node type argument.'),
'context' => 'ctools_node_add_context',
@@ -29,4 +28,3 @@ function ctools_node_add_context($arg = NULL, $conf = NULL, $empty = FALSE) {
return ctools_context_create('node_add_form', $arg);
}
-
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/node_edit.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/node_edit.inc
index c7cdf29e..8bd07689 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/node_edit.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/node_edit.inc
@@ -2,8 +2,7 @@
/**
* @file
- *
- * Plugin to provide an argument handler for a Node edit form
+ * Plugin to provide an argument handler for a Node edit form.
*/
/**
@@ -12,7 +11,7 @@
*/
$plugin = array(
'title' => t("Node edit form: node ID"),
- // keyword to use for %substitution
+ // Keyword to use for %substitution.
'keyword' => 'node',
'description' => t('Creates a node edit form context from a node ID argument.'),
'context' => 'ctools_node_edit_context',
@@ -48,4 +47,3 @@ function ctools_node_edit_context($arg = NULL, $conf = NULL, $empty = FALSE) {
// This will perform a node_access check, so we don't have to.
return ctools_context_create('node_edit_form', $node);
}
-
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/rid.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/rid.inc
index 2661153b..d0cc30c4 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/rid.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/rid.inc
@@ -2,8 +2,7 @@
/**
* @file
- *
- * Plugin to provide an argument handler for a node revision id
+ * Plugin to provide an argument handler for a node revision id.
*/
/**
@@ -47,4 +46,3 @@ function ctools_argument_rid_context($arg = NULL, $conf = NULL, $empty = FALSE)
return ctools_context_create('node', $node);
}
-
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/string.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/string.inc
index ed4ffbb6..005e40ea 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/string.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/string.inc
@@ -2,16 +2,16 @@
/**
* @file
- *
- * Plugin to provide an argument handler for a raw string
+ * Plugin to provide an argument handler for a raw string.
*/
+
/**
* Plugins are described by creating a $plugin array which will be used
* by the system that includes this file.
*/
$plugin = array(
'title' => t("String"),
- // keyword to use for %substitution
+ // Keyword to use for %substitution.
'keyword' => 'string',
'description' => t('A string is a minimal context that simply holds a string that can be used for some other purpose.'),
'settings form' => 'ctools_string_settings_form',
@@ -20,7 +20,8 @@ $plugin = array(
'#type' => 'textfield',
'#description' => t('Enter a value for this argument'),
),
- 'path placeholder' => 'ctools_string_path_placeholder', // This is in pagemanager.
+// This is in pagemanager.
+ 'path placeholder' => 'ctools_string_path_placeholder',
);
/**
@@ -39,7 +40,7 @@ function ctools_string_context($arg = NULL, $conf = NULL, $empty = FALSE) {
}
/**
- * Settings form for the argument
+ * Settings form for the argument.
*/
function ctools_string_settings_form(&$form, &$form_state, $conf) {
$form['settings']['use_tail'] = array(
@@ -48,7 +49,6 @@ function ctools_string_settings_form(&$form, &$form_state, $conf) {
'#default_value' => !empty($conf['use_tail']),
'#description' => t('If checked, this string will include all arguments. For example, if the path is "path/%" and the user visits "path/foo/bar", if this is not checked the string will be "foo". If it is checked the string will be "foo/bar".'),
);
-// return $form;
}
/**
@@ -61,4 +61,4 @@ function ctools_string_path_placeholder($argument) {
else {
return '%pm_arg_tail';
}
-}
\ No newline at end of file
+}
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/term.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/term.inc
index 65c87ac7..f72e93da 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/term.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/term.inc
@@ -2,8 +2,7 @@
/**
* @file
- *
- * Plugin to provide an argument handler for a Taxonomy term
+ * Plugin to provide an argument handler for a Taxonomy term.
*/
/**
@@ -12,7 +11,7 @@
*/
$plugin = array(
'title' => t("Taxonomy term: ID"),
- // keyword to use for %substitution
+ // Keyword to use for %substitution.
'keyword' => 'term',
'description' => t('Creates a single taxonomy term from a taxonomy ID or taxonomy term name.'),
'context' => 'ctools_term_context',
@@ -67,7 +66,7 @@ function ctools_term_context($arg = NULL, $conf = NULL, $empty = FALSE) {
foreach ($vocabularies as $machine_name) {
if ($potential->vocabulary_machine_name == $machine_name) {
$term = $potential;
- // break out of the foreaches AND the case
+ // Break out of the foreaches AND the case.
break 3;
}
}
@@ -92,7 +91,7 @@ function ctools_term_context($arg = NULL, $conf = NULL, $empty = FALSE) {
}
/**
- * Settings form for the argument
+ * Settings form for the argument.
*/
function ctools_term_settings_form(&$form, &$form_state, $conf) {
// @todo allow synonym use like Views does.
@@ -137,10 +136,9 @@ function ctools_term_settings_form(&$form, &$form_state, $conf) {
'#type' => 'checkbox',
'#default_value' => !empty($conf['transform']),
);
-// return $form;
}
-function ctools_term_settings_form_validate (&$form, &$form_state) {
+function ctools_term_settings_form_validate(&$form, &$form_state) {
// Filter the selected vocabularies to avoid storing redundant data.
$vocabularies = array_filter($form_state['values']['settings']['vocabularies']);
form_set_value($form['settings']['vocabularies'], $vocabularies, $form_state);
@@ -157,6 +155,7 @@ function ctools_term_ctools_argument_placeholder($conf) {
'#type' => 'textfield',
'#description' => t('Enter a taxonomy term ID.'),
);
+
case 'term':
return array(
'#type' => 'textfield',
@@ -190,13 +189,14 @@ function ctools_term_breadcrumb($conf, $context) {
*
* @param array $vids
* Array of either vids.
+ *
* @return array
* A keyed array of machine names.
*/
function _ctools_term_vocabulary_machine_name_convert($vids) {
$vocabularies = taxonomy_vocabulary_load_multiple($vids);
$return = array();
- foreach($vocabularies as $vocabulary) {
+ foreach ($vocabularies as $vocabulary) {
$return[$vocabulary->machine_name] = $vocabulary->machine_name;
}
return $return;
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/terms.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/terms.inc
index d31f28de..b816e1cb 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/terms.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/terms.inc
@@ -2,8 +2,7 @@
/**
* @file
- *
- * Plugin to provide an argument handler for a Taxonomy term
+ * Plugin to provide an argument handler for a Taxonomy term.
*/
/**
@@ -12,7 +11,7 @@
*/
$plugin = array(
'title' => t("Taxonomy term (multiple): ID"),
- // keyword to use for %substitution
+ // Keyword to use for %substitution.
'keyword' => 'term',
'description' => t('Creates a group of taxonomy terms from a list of tids separated by a comma or a plus sign. In general the first term of the list will be used for panes.'),
'context' => 'ctools_terms_context',
@@ -45,7 +44,7 @@ function ctools_terms_context($arg = NULL, $conf = NULL, $empty = FALSE) {
}
/**
- * Settings form for the argument
+ * Settings form for the argument.
*/
function ctools_terms_settings_form(&$form, &$form_state, $conf) {
$form['settings']['breadcrumb'] = array(
@@ -54,7 +53,6 @@ function ctools_terms_settings_form(&$form, &$form_state, $conf) {
'#default_value' => !empty($conf['breadcrumb']),
'#description' => t('If checked, taxonomy term parents will appear in the breadcrumb trail.'),
);
-// return $form;
}
/**
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/uid.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/uid.inc
index f9d5315c..c6ca3ccc 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/uid.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/uid.inc
@@ -2,8 +2,7 @@
/**
* @file
- *
- * Plugin to provide an argument handler for a user id
+ * Plugin to provide an argument handler for a user id.
*/
/**
@@ -12,7 +11,7 @@
*/
$plugin = array(
'title' => t("User: ID"),
- // keyword to use for %substitution
+ // Keyword to use for %substitution.
'keyword' => 'user',
'description' => t('Creates a user context from a user ID argument.'),
'context' => 'ctools_argument_uid_context',
@@ -21,7 +20,8 @@ $plugin = array(
'#description' => t('Enter the user ID of a user for this argument'),
),
'default' => array('to_arg' => TRUE),
- 'path placeholder' => '%pm_uid_arg', // This is in pagemanager.
+// This is in pagemanager.
+ 'path placeholder' => '%pm_uid_arg',
'path placeholder to_arg' => TRUE,
'no ui' => TRUE,
);
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/user_edit.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/user_edit.inc
index 32b2b812..9c52b589 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/user_edit.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/user_edit.inc
@@ -2,8 +2,7 @@
/**
* @file
- *
- * Plugin to provide an argument handler for a Taxonomy term
+ * Plugin to provide an argument handler for a Taxonomy term.
*/
/**
@@ -12,7 +11,7 @@
*/
$plugin = array(
'title' => t("User edit form: User ID"),
- // keyword to use for %substitution
+ // Keyword to use for %substitution.
'keyword' => 'user',
'description' => t('Creates a user edit form context from a user ID argument.'),
'context' => 'ctools_user_edit_context',
@@ -30,18 +29,18 @@ function ctools_user_edit_context($arg = NULL, $conf = NULL, $empty = FALSE) {
if ($empty) {
return ctools_context_create_empty('user_edit_form');
}
- if(is_object($arg)){
+ if (is_object($arg)) {
return ctools_context_create('user_edit_form', $arg);
}
if (!is_numeric($arg)) {
return FALSE;
}
- $account= user_load($arg);
+ $account = user_load($arg);
if (!$account) {
return NULL;
}
// This will perform a node_access check, so we don't have to.
return ctools_context_create('user_edit_form', $account);
-}
\ No newline at end of file
+}
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/user_name.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/user_name.inc
index f6f3b463..ed74d9d8 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/user_name.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/user_name.inc
@@ -2,8 +2,7 @@
/**
* @file
- *
- * Plugin to provide an argument handler for a username
+ * Plugin to provide an argument handler for a username.
*/
/**
@@ -12,7 +11,7 @@
*/
$plugin = array(
'title' => t("User: name"),
- // keyword to use for %substitution
+ // Keyword to use for %substitution.
'keyword' => 'user',
'description' => t('Creates a user context from a user name.'),
'context' => 'ctools_argument_user_name_context',
@@ -42,6 +41,3 @@ function ctools_argument_user_name_context($arg = NULL, $conf = NULL, $empty = F
}
return ctools_context_create('user', $account);
}
-
-
-
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/vid.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/vid.inc
index 064b22d0..db68acd7 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/vid.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/vid.inc
@@ -2,8 +2,7 @@
/**
* @file
- *
- * Plugin to provide an argument handler for a vocabulary id
+ * Plugin to provide an argument handler for a vocabulary id.
*/
/**
@@ -12,7 +11,7 @@
*/
$plugin = array(
'title' => t("Vocabulary: ID"),
- // keyword to use for %substitution
+ // Keyword to use for %substitution.
'keyword' => 'vocabulary',
'description' => t('Creates a vocabulary context from a vocabulary ID argument.'),
'context' => 'ctools_vid_context',
@@ -43,4 +42,3 @@ function ctools_vid_context($arg = NULL, $conf = NULL, $empty = FALSE) {
return ctools_context_create('vocabulary', $vocabulary);
}
-
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/cache/export_ui.inc b/sites/all/modules/contrib/dev/ctools/plugins/cache/export_ui.inc
index 53483a53..f21af100 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/cache/export_ui.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/cache/export_ui.inc
@@ -6,7 +6,7 @@
*/
$plugin = array(
- // cache plugins are the rare plugin types that have no real UI but
+ // Cache plugins are the rare plugin types that have no real UI but
// we're providing a title just in case.
'title' => t('Export UI wizard cache'),
'cache get' => 'ctools_cache_export_ui_cache_get',
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/cache/simple.inc b/sites/all/modules/contrib/dev/ctools/plugins/cache/simple.inc
index 570398ba..c44d7983 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/cache/simple.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/cache/simple.inc
@@ -6,7 +6,7 @@
*/
$plugin = array(
- // cache plugins are the rare plugin types that have no real UI but
+ // Cache plugins are the rare plugin types that have no real UI but
// we're providing a title just in case.
'title' => t('Simple'),
'cache get' => 'ctools_cache_simple_cache_get',
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/block/block.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/block/block.inc
index 46b02e9e..ff75c750 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/block/block.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/block/block.inc
@@ -51,7 +51,7 @@ function ctools_block_content_type_content_types() {
if ($module_blocks) {
foreach ($module_blocks as $delta => $block) {
$info = _ctools_block_content_type_content_type($module, $delta, $block);
- // this check means modules can remove their blocks; particularly useful
+ // This check means modules can remove their blocks; particularly useful
// if they offer the block some other way (like we do for views)
if ($info) {
$types["$module-$delta"] = $info;
@@ -168,7 +168,7 @@ function ctools_block_content_type_render($subtype, $conf) {
if ($module == 'block' && !empty($info) && isset($info->title)) {
$block->title = $info->title;
}
- else if (isset($block->subject)) {
+ elseif (isset($block->subject)) {
$block->title = $block->subject;
}
else {
@@ -208,70 +208,6 @@ function ctools_block_content_type_edit_form_submit($form, &$form_state) {
}
}
-/**
- * Returns an edit form for a block.
- */
-//function ctools_block_content_type_edit_form($id, $parents, $conf) {
-// if (user_access('administer advanced pane settings')) {
-// $form['block_visibility'] = array(
-// '#type' => 'checkbox',
-// '#title' => t('Use block visibility settings (see block config)'),
-// '#default_value' => !empty($conf['block_visibility']),
-// '#description' => t('If checked, the block visibility settings for this block will apply to this block.'),
-// );
-// // Module-specific block configurations.
-// if ($settings = module_invoke($module, 'block', 'configure', $delta)) {
-// // Specifically modify a couple of core block forms.
-// if ($module == 'block') {
-// unset($settings['submit']);
-// $settings['info']['#type'] = 'value';
-// $settings['info']['#value'] = $settings['info']['#default_value'];
-// }
-// ctools_admin_fix_block_tree($settings);
-// $form['block_settings'] = array(
-// '#type' => 'fieldset',
-// '#title' => t('Block settings'),
-// '#description' => t('Settings in this section are global and are for all blocks of this type, anywhere in the system.'),
-// '#tree' => FALSE,
-// );
-//
-//
-// $form['block_settings'] += $settings;
-// }
-// }
-//
-// return $form;
-//}
-
-//function ctools_admin_submit_block(&$form_values) {
-// if (!empty($form_values['block_settings'])) {
-// module_invoke($form_values['module'], 'block', 'save', $form_values['delta'], $form_values['block_settings']);
-// }
-//}
-//
-///**
-// * Because form api cannot collapse just part of a tree, and the block settings
-// * assume no tree, we have to collapse the tree ourselves.
-// */
-//function ctools_admin_fix_block_tree(&$form, $key = NULL) {
-// if ($key) {
-// if (!empty($form['#parents'])) {
-// $form['#parents'] = array_merge(array('configuration', 'block_settings'), $form['#parents']);
-// }
-// else if (empty($form['#tree'])) {
-// $form['#parents'] = array('configuration', 'block_settings', $key);
-// }
-// }
-//
-// if (isset($form['#type']) && $form['#type'] == 'textarea' && !empty($form['#rows']) && $form['#rows'] > 10) {
-// $form['#rows'] = 10;
-// }
-//
-// foreach (element_children($form) as $key) {
-// ctools_admin_fix_block_tree($form[$key], $key);
-// }
-//}
-
/**
* Returns the administrative title for a type.
*/
@@ -338,8 +274,10 @@ function ctools_default_block_info($module, $delta, &$info) {
}
}
-// These are all on behalf of modules that don't implement ctools but that
-// we care about.
+/**
+ * These are all on behalf of modules that don't implement ctools but that
+ * we care about.
+ */
function menu_ctools_block_info($module, $delta, &$info) {
$info['icon'] = 'icon_core_block_menu.png';
$info['category'] = t('Menus');
@@ -360,7 +298,7 @@ function forum_ctools_block_info($module, $delta, &$info) {
break;
default:
- // safety net
+ // Safety net.
ctools_default_block_info($module, $delta, $info);
}
}
@@ -455,7 +393,7 @@ function user_ctools_block_info($module, $delta, &$info) {
break;
default:
- // safety net
+ // Safety net.
ctools_default_block_info($module, $delta, $info);
}
}
@@ -508,7 +446,7 @@ function ctools_user_login_pane_render($subtype, $conf, $panel_args, $contexts)
return;
}
- $info = new stdClass;
+ $info = new stdClass();
$info->module = $module;
$info->delta = $delta;
@@ -537,7 +475,7 @@ function ctools_user_login_pane_render($subtype, $conf, $panel_args, $contexts)
if ($module == 'block') {
$block->title = $info->title;
}
- else if (isset($block->subject)) {
+ elseif (isset($block->subject)) {
$block->title = $block->subject;
}
else {
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_created.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_created.inc
index 62944e71..b3f454a6 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_created.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_created.inc
@@ -1,9 +1,11 @@
TRUE,
'title' => t('Comment created date'),
@@ -28,7 +30,7 @@ function ctools_comment_created_content_type_render($subtype, $conf, $panel_args
$comment = $context->data;
// Build the content type block.
- $block = new stdClass();
+ $block = new stdClass();
$block->module = 'comment_created';
$block->title = t('Created date');
$block->content = format_date($comment->created, $conf['format']);
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_links.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_links.inc
index fcca9703..ed454f94 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_links.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_links.inc
@@ -1,9 +1,11 @@
TRUE,
'title' => t('Comment links'),
@@ -29,7 +31,7 @@ function ctools_comment_links_content_type_render($subtype, $conf, $panel_args,
$comment = isset($context->data) ? clone $context->data : NULL;
$block = new stdClass();
$block->module = 'comment';
- $block->delta = $comment->cid;
+ $block->delta = $comment->cid;
if (empty($comment)) {
$block->delta = 'placeholder';
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_reply_form.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_reply_form.inc
index bccba9a2..a18ece9a 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_reply_form.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_reply_form.inc
@@ -2,7 +2,7 @@
/**
* @file
- * Ctools content-type plugin to provide a comment-reply form (replying either
+ * CTools content-type plugin to provide a comment-reply form (replying either
* to a node or to another comment).
*/
@@ -14,12 +14,12 @@ if (module_exists('comment')) {
'icon' => 'icon_comment.png',
'description' => t('A form to add a new comment reply.'),
'required context' => array(
- new ctools_context_required(t('Node'), 'node'),
- new ctools_context_optional(t('Comment'), 'comment'),
- ),
+ new ctools_context_required(t('Node'), 'node'),
+ new ctools_context_optional(t('Comment'), 'comment'),
+ ),
'category' => t('Comment'),
'render callback' => 'ctools_comment_reply_form_content_type_render',
- 'defaults' => array('anon_links' => false),
+ 'defaults' => array('anon_links' => FALSE),
);
}
@@ -28,7 +28,9 @@ function ctools_comment_reply_form_content_type_render($subtype, $conf, $panel_a
$comment = ($context[1]->identifier == t('No context')) ? NULL : clone $context[1]->data;
$block = new stdClass();
$block->module = 'comments';
- if ($comment) $block->delta = $comment->cid;
+ if ($comment) {
+ $block->delta = $comment->cid;
+ }
$block->title = t('Add comment');
$node = $context[0]->data;
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/contact/contact.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/contact/contact.inc
index 63283f59..bac30c47 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/contact/contact.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/contact/contact.inc
@@ -1,5 +1,9 @@
module = 'contact';
- $block->delta = 'form';
- $block->title = t('Contact');
+ $block = new stdClass();
+ $block->module = 'contact';
+ $block->delta = 'form';
+ $block->title = t('Contact');
module_load_include('inc', 'contact', 'contact.pages');
$block->content = drupal_get_form('contact_site_form');
@@ -45,11 +49,6 @@ function ctools_contact_content_type_edit_form($form, &$form_state) {
*/
function ctools_contact_content_type_edit_form_submit($form, &$form_state) {
// Copy everything from our defaults.
-/*
- foreach (array_keys($form_state['plugin']['defaults']) as $key) {
- $form_state['conf'][$key] = $form_state['values'][$key];
- }
-*/
}
/**
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/contact/user_contact.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/contact/user_contact.inc
index 9b3726ab..5bd36572 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/contact/user_contact.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/contact/user_contact.inc
@@ -1,5 +1,9 @@
module = 'contact';
- $block->delta = 'form';
- $block->title = t('Contact @name', array('@name' => $context->data->name));
+ $block = new stdClass();
+ $block->module = 'contact';
+ $block->delta = 'form';
+ $block->title = t('Contact @name', array('@name' => $context->data->name));
module_load_include('inc', 'contact', 'contact.pages');
$block->content = drupal_get_form('contact_personal_form', $context->data);
@@ -51,11 +55,6 @@ function ctools_user_contact_content_type_edit_form($form, &$form_state) {
*/
function ctools_user_contact_content_type_edit_form_submit(&$form, &$form_state) {
// Copy everything from our defaults.
-/*
- foreach (array_keys($form_state['plugin']['defaults']) as $key) {
- $form_state['conf'][$key] = $form_state['values'][$key];
- }
-*/
}
/**
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/custom/custom.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/custom/custom.inc
index d9ac79f5..84fe3c55 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/custom/custom.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/custom/custom.inc
@@ -178,12 +178,11 @@ function ctools_custom_content_type_render($subtype, $conf, $args, $contexts) {
static $delta = 0;
- $block = new stdClass();
- $block->subtype = ++$delta;
- $block->title = filter_xss_admin($settings['title']);
+ $block = new stdClass();
+ $block->subtype = ++$delta;
+ $block->title = filter_xss_admin($settings['title']);
$block->title_heading = isset($settings['title_heading']) ? $settings['title_heading'] : 'h2';
-
// Add keyword substitutions if we were configured to do so.
$content = $settings['body'];
if (!empty($contexts) && !empty($settings['substitute'])) {
@@ -270,7 +269,8 @@ function ctools_custom_content_type_edit_form($form, &$form_state) {
$form_state['settings'] = $settings;
if ($settings['custom_type'] == 'fixed') {
- return $form; // no form for this case.
+ // No form for this case.
+ return $form;
}
$form['admin_title'] = array(
@@ -320,7 +320,7 @@ function ctools_custom_content_type_edit_form($form, &$form_state) {
);
if (!empty($form_state['contexts'])) {
- // Set extended description if both CCK and Token modules are enabled, notifying of unlisted keywords
+ // Set extended description if both CCK and Token modules are enabled, notifying of unlisted keywords.
if (module_exists('content') && module_exists('token')) {
$description = t('If checked, context keywords will be substituted in this content. Note that CCK fields may be used as keywords using patterns like %node:field_name-formatted.');
}
@@ -417,7 +417,7 @@ function ctools_custom_content_type_edit_form_validate(&$form, &$form_state) {
form_error($form['name'], t('Name is required.'));
}
- // Check for string identifier sanity
+ // Check for string identifier sanity.
if (!preg_match('!^[a-z0-9_]+$!', $form_state['values']['name'])) {
form_error($form['name'], t('The name can only consist of lowercase letters, underscores, and numbers.'));
return;
@@ -427,7 +427,7 @@ function ctools_custom_content_type_edit_form_validate(&$form, &$form_state) {
return;
}
- // Check for name collision
+ // Check for name collision.
if ($form_state['values']['name'] == 'custom' || (ctools_export_crud_load('ctools_custom_content', $form_state['values']['name']))) {
form_error($form['name'], t('Content with this name already exists. Please choose another name or delete the existing item before creating a new one.'));
}
@@ -447,7 +447,7 @@ function ctools_custom_content_type_edit_form_submit($form, &$form_state) {
}
// If the 'reusable' checkbox was checked, we will create a new
// custom content and give it the proper values.
- else if (!empty($form_state['values']['reusable'])) {
+ elseif (!empty($form_state['values']['reusable'])) {
$content = ctools_export_crud_new('ctools_custom_content');
$content->name = $form_state['values']['name'];
_ctools_custom_content_type_edit_save($content, $form_state);
@@ -455,7 +455,6 @@ function ctools_custom_content_type_edit_form_submit($form, &$form_state) {
}
else {
// Otherwise, just save values into $conf normally.
-
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
$form_state['conf'][$key] = isset($form_state['values'][$key]) ? $form_state['values'][$key] : $form_state['plugin']['defaults'][$key];
}
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/entity_context/entity_field.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/entity_context/entity_field.inc
index a70a8d9e..80d24ef1 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/entity_context/entity_field.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/entity_context/entity_field.inc
@@ -96,8 +96,8 @@ function ctools_entity_field_content_type_content_types() {
}
/**
-* Render the custom content type.
-*/
+ * Render the custom content type.
+ */
function ctools_entity_field_content_type_render($subtype, $conf, $panel_args, $context) {
if (empty($context) || empty($context->data)) {
return;
@@ -157,13 +157,17 @@ function ctools_entity_field_content_type_render($subtype, $conf, $panel_args, $
$field_output = field_view_field($entity_type, $clone, $field_name, $field_settings, $language);
- if (!empty($field_output) && !empty($conf['override_title'])) {
- $field_output['#title'] = filter_xss_admin($conf['override_title_text']);
+ if (!empty($field_output)) {
+ if (!empty($conf['override_title'])) {
+ $field_output['#title'] = filter_xss_admin($conf['override_title_text']);
+ }
+ $field_output['#ctools_context'] = $context;
+ $field_output['#post_render'][] = 'ctools_entity_field_content_type_substitute_keywords';
}
// Build the content type block.
$block = new stdClass();
- $block->module = 'entity_field';
+ $block->module = 'entity_field';
if ($conf['label'] == 'title' && isset($field_output['#title'])) {
$block->title = $field_output['#title'];
}
@@ -175,8 +179,15 @@ function ctools_entity_field_content_type_render($subtype, $conf, $panel_args, $
}
/**
-* Returns an edit form for custom type settings.
-*/
+ * Replace context keywords.
+ */
+function ctools_entity_field_content_type_substitute_keywords($markup, array $element) {
+ return ctools_context_keyword_substitute($markup, array(), array($element['#ctools_context']));
+}
+
+/**
+ * Returns an edit form for custom type settings.
+ */
function ctools_entity_field_content_type_formatter_options($form, &$form_state) {
if (empty($form_state['conf']['formatter_settings'])) {
$form_state['conf']['formatter_settings'] = array();
@@ -230,6 +241,11 @@ function ctools_entity_field_content_type_formatter_styles($form, &$form_state)
ctools_form_include($form_state, 'field_ui.admin', 'field_ui', '');
ctools_form_include($form_state, 'fields');
+ $form['ctools_keywords'] = array(
+ '#type' => 'item',
+ '#description' => t('You may use keywords for substitutions.'),
+ );
+
$form['ctools_field_list'] = array(
'#type' => 'value',
'#value' => array(),
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/entity_context/entity_field_extra.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/entity_context/entity_field_extra.inc
index 6a59ed4c..efc7f4ff 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/entity_context/entity_field_extra.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/entity_context/entity_field_extra.inc
@@ -1,5 +1,9 @@
t('Entity extra field'),
'defaults' => array('view_mode' => NULL),
@@ -119,7 +123,7 @@ function ctools_entity_field_extra_content_type_render($subtype, $conf, $panel_a
if (isset($entity->content[$field_name])) {
// Build the content type block.
- $block = new stdClass();
+ $block = new stdClass();
$block->module = 'entity_field_extra';
$block->content = $entity->content[$field_name];
$block->delta = $id;
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/form/entity_form_field.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/form/entity_form_field.inc
index 582bd785..b4d83381 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/form/entity_form_field.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/form/entity_form_field.inc
@@ -38,10 +38,13 @@ function ctools_entity_form_field_content_type_content_types() {
$types = array();
$content_types = array();
$entities = entity_get_info();
-
+ $field_instances = field_info_instances();
foreach ($entities as $entity_type => $entity) {
foreach ($entity['bundles'] as $type => $bundle) {
- foreach (field_info_instances($entity_type, $type) as $field_name => $field) {
+ if (!isset($field_instances[$entity_type][$type])) {
+ continue;
+ }
+ foreach ($field_instances[$entity_type][$type] as $field_name => $field) {
if (!isset($types[$entity_type . ':' . $field_name])) {
$types[$entity_type . ':' . $field_name] = array(
'category' => t('Form'),
@@ -72,7 +75,7 @@ function ctools_entity_form_field_content_type_content_types() {
}
$content_types[$entity_type . ':' . $group_name]['types'][$type] = $bundle['label'];
}
- }
+ }
}
}
}
@@ -90,8 +93,8 @@ function ctools_entity_form_field_content_type_content_types() {
}
/**
-* Render the custom content type.
-*/
+ * Render the custom content type.
+ */
function ctools_entity_form_field_content_type_render($subtype, $conf, $panel_args, $context) {
if (empty($context) || empty($context->data)) {
return;
@@ -146,8 +149,8 @@ function ctools_entity_form_field_content_type_render($subtype, $conf, $panel_ar
}
/**
-* Returns the administrative title for a type.
-*/
+ * Returns the administrative title for a type.
+ */
function ctools_entity_form_field_content_type_admin_title($subtype, $conf, $context) {
list($entity_type, $field_name) = explode(':', $subtype, 2);
@@ -162,6 +165,6 @@ function ctools_entity_form_field_content_type_admin_title($subtype, $conf, $con
}
function ctools_entity_form_field_content_type_edit_form($form, &$form_state) {
- // provide a blank form so we have a place to have context setting.
+ // Provide a blank form so we have a place to have context setting.
return $form;
}
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/form/form.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/form/form.inc
index 73f7c780..ef8cc65a 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/form/form.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/form/form.inc
@@ -1,11 +1,13 @@
TRUE,
'render last' => TRUE,
'title' => t('General form'),
@@ -43,7 +45,7 @@ function ctools_form_content_type_render($subtype, $conf, $panel_args, &$context
$block->delta = $context->form_id;
}
else {
- $block->title = t('Form');
+ $block->title = t('Form');
$block->content = t('Form goes here.');
$block->delta = 'unknown';
}
@@ -56,7 +58,7 @@ function ctools_form_content_type_admin_title($subtype, $conf, $context) {
}
function ctools_form_content_type_edit_form($form, &$form_state) {
- // provide a blank form so we have a place to override title
+ // Provide a blank form so we have a place to override title
// and stuff.
return $form;
}
diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node/node.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node/node.inc
index c49a71a6..a1141201 100644
--- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node/node.inc
+++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node/node.inc
@@ -46,10 +46,10 @@ function ctools_node_content_type_render($subtype, $conf, $panel_args) {
}
}
- // Support node translation
+ // Support node translation.
if (module_exists('translation')) {
if ($translations = module_invoke('translation', 'node_get_translations', $nid)) {
- if (isset($translations[$GLOBALS['language']->language])) {
+ if (isset($translations[$GLOBALS['language']->language])) {
$nid = $translations[$GLOBALS['language']->language]->nid;
}
}
@@ -121,7 +121,6 @@ function ctools_node_content_type_edit_form($form, &$form_state) {
'#description' => t('Check this box if you would like your pane title to link to the node.'),
);
-
if ($form_state['op'] == 'add') {
$form['nid'] = array(
'#prefix' => 'Unfiltered: ' . $filename1 . ' ' . $match . ''; -// $output .= '
' . file_get_contents($filename1) . ''; $this->assertEqual($filename2, ctools_css_retrieve('filtered-css-test'), 'Filtered css file succcesfully fetched'); $file_contents = file_get_contents($filename2); $this->assertEqual($filtered_css, $file_contents, 'Filtered css file contents are correct'); - // $match = $filename2 == ctools_css_retrieve('filtered-css-test') ? 'Match' : 'No match'; -// $output .= '
Filtered: ' . $filename2 . ' ' . $match . ''; -// $output .= '
' . file_get_contents($filename2) . ''; -// -// drupal_add_css($filename2, array('type' => 'file')); -// return array('#markup' => $output); + } + /** + * Test that Stored CSS snippets can be correctly overwritten. + */ + public function testCssStoreOverwrite() { + $css1 = "#some-id .some-class {\n color: black;\n illegal-key: foo;\n}"; - // Test that in case that url can be used, the value surives when a colon is in it. + $css2 = "#other-id .other-class {\n color: blue;\n illegal-key: foo;\n}"; + $filtered_css2 = '#other-id .other-class{color:blue;}'; + + ctools_css_store('unfiltered-css-test', $css1, FALSE); + ctools_css_store('filtered-css-test', $css1, TRUE); + + // Now overwrite the first css with the second version. + $filename3 = ctools_css_store('unfiltered-css-test', $css2, FALSE); + $filename4 = ctools_css_store('filtered-css-test', $css2, TRUE); + + $file_contents3 = file_get_contents($filename3); + $file_contents4 = file_get_contents($filename4); + + $this->assertEqual($css2, $file_contents3, 'Unfiltered CSS has overwritten earlier contents.'); + $this->assertEqual($filtered_css2, $file_contents4, 'Filtered CSS has overwritten earlier contents.'); + } + + /** + * Test that in case that url is used, the colons survives filtering. + */ + public function testCssFilterURLHandling() { $css = "#some-id {\n background-image: url(http://example.com/example.gif);\n}"; $css_data = ctools_css_disassemble($css); $empty_array = array(); $disallowed_values_regex = '/(expression)/'; - $filtered = ctools_css_assemble(ctools_css_filter_css_data($css_data, $empty_array, $empty_array, '', $disallowed_values_regex)); + + $intermediate = ctools_css_filter_css_data($css_data, $empty_array, $empty_array, '', $disallowed_values_regex); + $filtered = ctools_css_assemble($intermediate); + $url = (strpos($filtered, 'http://example.com/example.gif') !== FALSE); $this->assertTrue($url, 'CSS with multiple colons can survive.'); + } - // Test that in case the CSS has two properties defined are merged. + /** + * Test that when the CSS has two properties defined they are merged. + */ + public function testCssFilterMergeProperties() { $css = "#some-id {\n font-size: 12px;\n}\n#some-id {\n color: blue;\n}"; $filtered = ctools_css_filter($css); $font_size = (strpos($filtered, 'font-size:12px;') !== FALSE); @@ -78,4 +111,5 @@ class CtoolsCssTestCase extends DrupalWebTestCase { $color = (strpos($filtered, 'color:red') !== FALSE); $this->assertTrue($font_size && $color, 'Multiple properties are retained.'); } + } diff --git a/sites/all/modules/contrib/dev/ctools/tests/css_cache.test b/sites/all/modules/contrib/dev/ctools/tests/css_cache.test index 0b3528da..2aaa304d 100644 --- a/sites/all/modules/contrib/dev/ctools/tests/css_cache.test +++ b/sites/all/modules/contrib/dev/ctools/tests/css_cache.test @@ -1,30 +1,28 @@ 'Ctools CSS cache', + 'name' => 'CSS cache', 'description' => 'Tests the custom CSS cache handler.', 'group' => 'ctools', + 'dependencies' => array('ctools'), ); } /** * {@inheritdoc} */ - public function setUp() { - parent::setUp('ctools'); + public function setUp(array $modules = array()) { + $modules[] = 'ctools'; + parent::setUp($modules); } /** diff --git a/sites/all/modules/contrib/dev/ctools/tests/ctools.drush.sh b/sites/all/modules/contrib/dev/ctools/tests/ctools.drush.sh old mode 100644 new mode 100755 diff --git a/sites/all/modules/contrib/dev/ctools/tests/ctools.plugins.test b/sites/all/modules/contrib/dev/ctools/tests/ctools.plugins.test index 7e866b16..a12d06af 100644 --- a/sites/all/modules/contrib/dev/ctools/tests/ctools.plugins.test +++ b/sites/all/modules/contrib/dev/ctools/tests/ctools.plugins.test @@ -1,26 +1,43 @@ 'Get plugin info', 'description' => 'Verify that plugin type definitions can properly set and overide values.', 'group' => 'ctools', + 'dependencies' => array('ctools'), ); } - function setUp() { - // Additionally enable contact module. - parent::setUp('ctools', 'ctools_plugin_test'); + /** + * {@inheritdoc} + */ + public function setUp(array $modules = array()) { + $modules[] = 'ctools'; + $modules[] = 'ctools_plugin_test'; + parent::setUp($modules); } + /** + * Assert helper to check that a specific plugin function exists. + * + * @param $module + * The module that owns the plugin. + * @param $type + * The type of plugin. + * @param $id + * The id of the specific plugin to load. + * @param $function + * The identifier of the function. For example, 'settings form'. + */ protected function assertPluginFunction($module, $type, $id, $function = 'function') { $func = ctools_plugin_load_function($module, $type, $id, $function); $this->assertTrue(function_exists($func), t('Plugin @plugin of plugin type @module:@type successfully retrieved @retrieved for @function.', array( @@ -32,6 +49,18 @@ class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase { ))); } + /** + * Assert helper to check that a specific plugin function does NOT exist. + * + * @param $module + * The module that owns the plugin. + * @param $type + * The type of plugin. + * @param $id + * The id of the specific plugin to load. + * @param $function + * The identifier of the function. For example, 'settings form'. + */ protected function assertPluginMissingFunction($module, $type, $id, $function = 'function') { $func = ctools_plugin_load_function($module, $type, $id, $function); $this->assertEqual($func, NULL, t('Plugin @plugin of plugin type @module:@type for @function with missing function successfully failed.', array( @@ -42,6 +71,18 @@ class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase { ))); } + /** + * Assert helper to check that a plugin can be loaded using a named class. + * + * @param $module + * The module that owns the plugin. + * @param $type + * The type of plugin. + * @param $id + * The id of the specific plugin to load. + * @param string $class + * The name of the PHP class to load. + */ protected function assertPluginClass($module, $type, $id, $class = 'handler') { $class_name = ctools_plugin_load_class($module, $type, $id, $class); $this->assertTrue(class_exists($class_name), t('Plugin @plugin of plugin type @module:@type successfully retrieved @retrieved for @class.', array( @@ -53,6 +94,18 @@ class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase { ))); } + /** + * Assert helper to check that a plugin DOES NOT contain the named class. + * + * @param $module + * The module that owns the plugin. + * @param $type + * The type of plugin. + * @param $id + * The id of the specific plugin to load. + * @param string $class + * The name of the PHP class to load. + */ protected function assertPluginMissingClass($module, $type, $id, $class = 'handler') { $class_name = ctools_plugin_load_class($module, $type, $id, $class); $this->assertEqual($class_name, NULL, t('Plugin @plugin of plugin type @module:@type for @class with missing class successfully failed.', array( @@ -66,7 +119,7 @@ class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase { /** * Test that plugins are loaded correctly. */ - function testPluginLoading() { + public function testPluginLoading() { ctools_include('plugins'); $module = 'ctools_plugin_test'; $type = 'not_cached'; @@ -81,7 +134,7 @@ class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase { $this->assertPluginClass($module, $type, 'plugin_array', 'handler'); $this->assertPluginClass($module, $type, 'plugin_array2', 'handler'); $this->assertPluginMissingClass($module, $type, 'plugin_array_dne', 'handler'); - // TODO Test big hook plugins. + // @todo Test big hook plugins. $type = 'cached'; @@ -95,6 +148,7 @@ class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase { $this->assertPluginClass($module, $type, 'plugin_array', 'handler'); $this->assertPluginClass($module, $type, 'plugin_array2', 'handler'); $this->assertPluginMissingClass($module, $type, 'plugin_array_dne', 'handler'); - // TODO Test big hook plugins. + // @todo Test big hook plugins. } + } diff --git a/sites/all/modules/contrib/dev/ctools/tests/ctools.test b/sites/all/modules/contrib/dev/ctools/tests/ctools.test new file mode 100644 index 00000000..4d748c09 --- /dev/null +++ b/sites/all/modules/contrib/dev/ctools/tests/ctools.test @@ -0,0 +1,239 @@ + 'Ctools module functions tests', + 'description' => 'Check functions in the ctools.module not otherwise tested.', + 'group' => 'ctools', + 'dependencies' => array('ctools'), + ); + } + + /** + * {@inheritdoc} + */ + public function setUp(array $modules = array()) { + $modules[] = 'ctools'; + parent::setUp($modules); + } + + /** + * Test that the break phrase function behaves as expected. + */ + public function testBreakPhrase() { + $tests = array( + NULL => array('value' => array()), + '' => array('value' => array()), + '1' => array('operator' => 'and', 'value' => array(1)), + '99' => array('operator' => 'and', 'value' => array(99)), + '+1' => array('invalid_input' => TRUE, 'value' => array(-1)), + ' 1' => array('invalid_input' => TRUE, 'value' => array(-1)), + '1 ' => array('invalid_input' => TRUE, 'value' => array(-1)), + '-1' => array('invalid_input' => TRUE, 'value' => array(-1)), + '-99' => array('invalid_input' => TRUE, 'value' => array(-1)), + '1,2' => array('operator' => 'and', 'value' => array(1, 2)), + '1 2' => array('operator' => 'or', 'value' => array(1, 2)), + '1+2' => array('operator' => 'or', 'value' => array(1, 2)), + '1,2,3' => array('operator' => 'and', 'value' => array(1, 2, 3)), + '1 2 3' => array('operator' => 'or', 'value' => array(1, 2, 3)), + '1+2+3' => array('operator' => 'or', 'value' => array(1, 2, 3)), + '1 , 2 , 3' => array('invalid_input' => TRUE, 'value' => array(-1)), + '1 + 2 + 3' => array('invalid_input' => TRUE, 'value' => array(-1)), + '1,2,3,4,5,6,7,8,9' => array( + 'operator' => 'and', + 'value' => array(1, 2, 3, 4, 5, 6, 7, 8, 9), + ), + '1 2,3,4 5 6 7 8 9' => array('invalid_input' => TRUE, 'value' => array(-1)), + ); + + foreach ($tests as $string => $expected) { + $result = ctools_break_phrase($string); + $expected = (object) $expected; + $this->assertEqual($result, $expected, 'Break Phrase test patterns: ' . $string); + } + } + + /** + * Test that the (deprecated) getuserroles returns expected array. + */ + public function testGetUserRoles() { + $result = ctools_get_roles(); + $this->assertTrue(is_array($result), 'get_roles returns an array'); + + // A key-value array of integers. + foreach ($result as $k => $v) { + $this->assertTrue(is_numeric($k), 'Role key is numeric; ' . $k); + $this->assertTrue(is_string($v), 'Role id is string; ' . $v); + } + } + + /** + * Test the ctools_attach_js function returns the expected paths. + */ + public function testAttachJs() { + $taxonomy_path = drupal_get_path('module', 'taxonomy'); + $ctools_path = drupal_get_path('module', 'ctools'); + + // Func should probably do a different thing but this is current behaviour. + $path = ctools_attach_js(''); + $this->assertEqual($path, $ctools_path . '/js/.js', 'Attach an empty string'); + + $path = ctools_attach_js('foo'); + $this->assertEqual($path, $ctools_path . '/js/foo.js', 'Attach simple string'); + + $path = ctools_attach_js('foo', 'ctools', ''); + $this->assertEqual($path, $ctools_path . '//foo.js', 'Attach string with empty subdir'); + + $path = ctools_attach_js('foo', 'ctools', 'javascript'); + $this->assertEqual($path, $ctools_path . '/javascript/foo.js', 'Attach string with alternate subdir'); + + $path = ctools_attach_js('foo', 'taxonomy', 'javascript'); + $this->assertEqual($path, $taxonomy_path . '/javascript/foo.js', 'Attach string from different module'); + } + + /** + * Test the ctools_attach_css function returns the expected paths. + */ + public function testAttachCss() { + $taxonomy_path = drupal_get_path('module', 'taxonomy'); + $ctools_path = drupal_get_path('module', 'ctools'); + + // Func should probably do a different thing but this is current behaviour. + $path = ctools_attach_css(''); + $this->assertEqual($path, $ctools_path . '/css/.css', 'Attach empty string'); + + $path = ctools_attach_css('foo'); + $this->assertEqual($path, $ctools_path . '/css/foo.css', 'Attach simple string'); + + $path = ctools_attach_css('foo', 'ctools', ''); + $this->assertEqual($path, $ctools_path . '//foo.css', 'Attach string with empty subdir'); + + $path = ctools_attach_css('foo', 'ctools', 'theme'); + $this->assertEqual($path, $ctools_path . '/theme/foo.css', 'Attach string with alternate subdir'); + + $path = ctools_attach_css('foo', 'taxonomy', 'theme'); + $this->assertEqual($path, $taxonomy_path . '/theme/foo.css', 'Attach string from different module'); + } + + /** + * Test the ctools version compare function. + */ + public function testApiVersionCompare() { + // We're beyond version 1. + $ok = ctools_api_version('1.0'); + $this->assertTrue($ok, 'Check API version 1.0 is ok'); + + // We're beyond version 1.0.1 too. + $ok = ctools_api_version('1.0.1'); + $this->assertTrue($ok, 'Check API version 1.0.1 is ok'); + + // Not (yet) on api version 10. + $ok = ctools_api_version('10.0'); + $this->assertFalse($ok, 'Check API version 10.0 is not ok'); + + // We are (currently) between version 1.1 and version 4.0. + $ok = ctools_api_version('1.1', '4.0'); + $this->assertTrue($ok, 'Check API is between 1 and 4'); + } + + /** + * Test that the ctools_classs_add works. + */ + public function testClassesAdd() { + ctools_class_reset(); + + ctools_class_add('testclass'); + + $classes = ctools_get_classes(); + $this->assertEqual(is_array($classes), 1, 'Classes should be an array'); + $this->assertEqual(count($classes), 1, 'Classes array has one element'); + $this->assertEqual(count($classes['html']), 1, 'Classes array has element: html'); + $this->assertTrue(isset($classes['html']['add']), 'Classes array has element: html/add'); + $this->assertEqual($classes['html']['add'], array('testclass'), 'Classes array has expected value'); + + ctools_class_add('class2 class3'); + + $classes = ctools_get_classes(); + $this->assertEqual(is_array($classes), 1, 'Classes should be an array'); + $this->assertEqual(count($classes['html']), 1, 'Classes array has element: html'); + // TODO: An undesirable result: array('testclass', 'class2', 'class3') is better. + $this->assertEqual($classes['html']['add'], array( + 'testclass', + 'class2 class3', + ), 'Classes array has expected value'); + } + + /** + * Test that the ctools_classs_remove works. + */ + public function testClassesRemove() { + ctools_class_reset(); + + ctools_class_remove('testclass'); + + $classes = ctools_get_classes(); + $this->assertEqual(is_array($classes), 1, 'Classes should be an array'); + $this->assertEqual(count($classes), 1, 'Classes array has one element'); + $this->assertEqual(count($classes['html']), 1, 'Classes array has element: html'); + $this->assertTrue(isset($classes['html']['remove']), 'Classes array has element: html/remove'); + $this->assertEqual($classes['html']['remove'], array('testclass'), 'Classes array has expected value'); + + ctools_class_remove('class2 class3'); + + $classes = ctools_get_classes(); + $this->assertEqual(count($classes), 1, 'Classes array has one element'); + $this->assertEqual(count($classes['html']), 1, 'Classes array has element: html'); + // This is an undesirable result, is array('testclass', 'class2', 'class3') better. + $this->assertEqual($classes['html']['remove'], array( + 'testclass', + 'class2 class3', + ), 'Classes array has expected value'); + } + + /** + * Test that the ctools_classs_add and ctools_classs_remove interact well. + */ + public function testClassesAddRemove() { + ctools_class_reset(); + + ctools_class_add('testclass'); + ctools_class_remove('testclass'); + + $classes = ctools_get_classes(); + $this->assertTrue(isset($classes['html']['add']), 'Classes array has an add set'); + $this->assertEqual($classes['html']['add'], array('testclass'), 'testclass is in the add set'); + $this->assertTrue(isset($classes['html']['remove']), 'Classes array has a remove set'); + // TODO: Is it really good to let this happen? + $this->assertEqual($classes['html']['remove'], array('testclass'), 'testclass is in the remove set'); + } + + /** + * Test that the ctools_classs_add and ctools_classs_remove interact well .. 2. + */ + public function testClassesAddRemove2() { + ctools_class_reset(); + + ctools_class_add('class2 class3'); + ctools_class_remove('class3'); + + $classes = ctools_get_classes(); + $this->assertTrue(isset($classes['html']['add']), 'Classes array has an add set'); + $this->assertEqual($classes['html']['add'], array('class2 class3'), 'Added class2 class3 is in add set'); + $this->assertTrue(isset($classes['html']['remove']), 'Classes array has a remove set'); + // TODO: Is it really good to let this happen? + $this->assertEqual($classes['html']['remove'], array('class3'), 'class3 in remove set'); + } + +} diff --git a/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export.test b/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export.test index 6a062de7..ebeee496 100644 --- a/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export.test +++ b/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export.test @@ -1,32 +1,34 @@ 'CTools export CRUD tests', + 'name' => 'Export CRUD', 'description' => 'Test the CRUD functionality for the ctools export system.', 'group' => 'ctools', ); } - protected function setUp() { - parent::setUp('ctools_export_test'); - $this->resetAll(); + /** + * {@inheritdoc} + */ + public function setUp(array $modules = array()) { + $modules[] = 'ctools'; + $modules[] = 'ctools_export_test'; + parent::setUp($modules); } /** * Tests CRUD operation: Load. */ - function testCrudExportLoad() { + public function testCrudExportLoad() { $loaded_export = ctools_export_crud_load('ctools_export_test', 'database_test'); $expected_export = new stdClass(); @@ -47,7 +49,7 @@ class CtoolsExportCrudTestCase extends DrupalWebTestCase { /** * Tests CRUD operation: Load multiple. */ - function testCrudExportLoadMultiple() { + public function testCrudExportLoadMultiple() { $exportable_names = array('database_test', 'overridden_test', 'default_test'); $loaded_exports = ctools_export_crud_load_multiple('ctools_export_test', $exportable_names); @@ -57,7 +59,7 @@ class CtoolsExportCrudTestCase extends DrupalWebTestCase { /** * Tests CRUD operation: Load all. */ - function testCrudExportLoadAll() { + public function testCrudExportLoadAll() { $loaded_exports = ctools_export_crud_load_all('ctools_export_test'); $this->assertEqual(count($loaded_exports), 3, 'All exportables have been loaded.'); @@ -66,10 +68,10 @@ class CtoolsExportCrudTestCase extends DrupalWebTestCase { /** * Tests CRUD operation: Save. */ - function testCrudExportSave() { + public function testCrudExportSave() { $default_export = ctools_export_crud_load('ctools_export_test', 'default_test'); - $this->assertTrue($default_export->in_code_only,'The loaded exportable is in code only.'); + $this->assertTrue($default_export->in_code_only, 'The loaded exportable is in code only.'); ctools_export_crud_save('ctools_export_test', $default_export); @@ -84,7 +86,7 @@ class CtoolsExportCrudTestCase extends DrupalWebTestCase { /** * Tests CRUD operation: New. */ - function testCrudExportNew() { + public function testCrudExportNew() { // Default exportable with defualt values. $new_export = ctools_export_crud_new('ctools_export_test'); @@ -113,7 +115,7 @@ class CtoolsExportCrudTestCase extends DrupalWebTestCase { /** * Tests CRUD operation: Revert. */ - function testCrudExportRevert() { + public function testCrudExportRevert() { // Load exportable, will come from database. $original_export = ctools_export_crud_load('ctools_export_test', 'overridden_test'); @@ -135,14 +137,15 @@ class CtoolsExportCrudTestCase extends DrupalWebTestCase { // Check the exportable is now in_code_only. $this->assertTrue($default_export->in_code_only, 'The loaded exportable is in the database only.'); - // Make sure the default object loaded matches the same overridden one in the database. + // Make sure the default object loaded matches the same overridden one in + // the database. $this->assertEqual($original_export->machine, $default_export->machine, 'The default exportable has been loaded and matches the overridden exportable.'); } /** * Tests CRUD operation: Delete. */ - function testCrudExportDelete() { + public function testCrudExportDelete() { // Create a stub entry save it and delete it from the database. $new_export = ctools_export_crud_new('ctools_export_test'); ctools_export_crud_save('ctools_export_test', $new_export); @@ -158,6 +161,7 @@ class CtoolsExportCrudTestCase extends DrupalWebTestCase { $machine = $database_export->machine; ctools_export_crud_delete('ctools_export_test', $database_export); + // Clear the exportable caches as it's been loaded above. ctools_export_load_object_reset('ctools_export_test'); $result = ctools_export_crud_load('ctools_export_test', $machine); @@ -168,7 +172,7 @@ class CtoolsExportCrudTestCase extends DrupalWebTestCase { /** * Tests CRUD operation: Set status. */ - function testCrudExportSetStatus() { + public function testCrudExportSetStatus() { // Database only object. $database_export = ctools_export_crud_load('ctools_export_test', 'database_test'); ctools_export_crud_disable('ctools_export_test', $database_export); diff --git a/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export_test.default_ctools_export_tests.inc b/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export_test.default_ctools_export_tests.inc index 9f2dd6c6..2f5ca584 100644 --- a/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export_test.default_ctools_export_tests.inc +++ b/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export_test.default_ctools_export_tests.inc @@ -1,5 +1,9 @@ 'CTools export test data table', - 'export' => array( + 'description' => 'CTools export test data table', + 'export' => array( 'key' => 'machine', 'identifier' => 'ctools_export_test', 'default hook' => 'default_ctools_export_tests', @@ -53,7 +57,7 @@ function ctools_export_test_schema() { } /** - * Implments hook_install(); + * Implements hook_install(). */ function ctools_export_test_install() { $ctools_export_tests = array(); diff --git a/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export_test.module b/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export_test.module index 80f1adbb..9cd803ce 100644 --- a/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export_test.module +++ b/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export_test.module @@ -1,5 +1,9 @@ array( 'defaults' => array( - 'bool' => true, + 'bool' => TRUE, 'string' => 'string', 'array' => array('some value'), ), @@ -50,6 +55,11 @@ function ctools_plugin_test_ctools_plugin_type() { ); } +/** + * Plugin callback. + * + * @see ctools_plugin_test_ctools_plugin_type() + */ function ctools_plugin_test_ctools_plugin_test_big_hook_cached() { return array( 'test1' => array( @@ -59,6 +69,11 @@ function ctools_plugin_test_ctools_plugin_test_big_hook_cached() { ); } +/** + * Plugin callback. + * + * @see ctools_plugin_test_ctools_plugin_type() + */ function ctools_plugin_test_ctools_plugin_test_big_hook_not_cached() { return array( 'test1' => array( @@ -68,5 +83,18 @@ function ctools_plugin_test_ctools_plugin_test_big_hook_not_cached() { ); } -function ctools_plugin_test_hook_cached_test() {} -function ctools_plugin_test_hook_not_cached_test() {} +/** + * Callback for the big_hook_cached plugin. + * + * @see ctools_plugin_test_ctools_plugin_test_big_hook_cached + */ +function ctools_plugin_test_hook_cached_test() { +} + +/** + * Callback for the big_hook_not_cached plugin. + * + * @see ctools_plugin_test_ctools_plugin_test_big_hook_not_cached() + */ +function ctools_plugin_test_hook_not_cached_test() { +} diff --git a/sites/all/modules/contrib/dev/ctools/tests/math_expression.test b/sites/all/modules/contrib/dev/ctools/tests/math_expression.test index 8810e8c4..b34fafb9 100644 --- a/sites/all/modules/contrib/dev/ctools/tests/math_expression.test +++ b/sites/all/modules/contrib/dev/ctools/tests/math_expression.test @@ -1,24 +1,29 @@ 'CTools math expression tests', + 'name' => 'Math expressions', 'description' => 'Test the math expression library of ctools.', 'group' => 'ctools', + 'dependencies' => array('ctools'), ); } - public function setUp() { - parent::setUp('ctools', 'ctools_plugin_test'); + /** + * {@inheritdoc} + */ + public function setUp(array $modules = array()) { + $modules[] = 'ctools'; + $modules[] = 'ctools_plugin_test'; + parent::setUp($modules); } /** @@ -35,6 +40,9 @@ class CtoolsMathExpressionTestCase extends DrupalWebTestCase { return $this->assert(abs($first - $second) <= $delta, $message ? $message : t('Value @first is equal to value @second.', array('@first' => var_export($first, TRUE), '@second' => var_export($second, TRUE))), $group); } + /** + * Test some arithmetic handling. + */ public function testArithmetic() { $math_expression = new ctools_math_expr(); @@ -66,10 +74,13 @@ class CtoolsMathExpressionTestCase extends DrupalWebTestCase { $this->assertEqual(pow($random_number_a, $random_number_b), $math_expression->e("$random_number_a ^ $random_number_b")); } + /** + * Test the basic built-in functions in the math expression library. + */ public function testBuildInFunctions() { $math_expression = new ctools_math_expr(); - // @todo: maybe run this code multiple times to test different values. + // @todo Maybe run this code multiple times to test different values. $random_double = $this->rand01(); $random_int = rand(5, 10); $this->assertFloat(sin($random_double), $math_expression->e("sin($random_double)")); @@ -94,6 +105,9 @@ class CtoolsMathExpressionTestCase extends DrupalWebTestCase { // $this->assertFloat(min($random_double_a, $random_double_b), $math_expression->e("min($random_double_a, $random_double_b)")); } + /** + * Test variable handling. + */ public function testVariables() { $math_expression = new ctools_math_expr(); @@ -108,6 +122,9 @@ class CtoolsMathExpressionTestCase extends DrupalWebTestCase { $this->assertEqual($random_number_a / $random_number_b, $math_expression->e("var / $random_number_b")); } + /** + * Test custom function handling. + */ public function testCustomFunctions() { $math_expression = new ctools_math_expr(); @@ -126,4 +143,5 @@ class CtoolsMathExpressionTestCase extends DrupalWebTestCase { // Use a custom function in another function. $this->assertEqual(($random_number_a * 2 + $random_number_b) * 2, $math_expression->e("f(g($random_number_a, $random_number_b))")); } + } diff --git a/sites/all/modules/contrib/dev/ctools/tests/math_expression_stack.test b/sites/all/modules/contrib/dev/ctools/tests/math_expression_stack.test index bdd46959..e1e587a2 100644 --- a/sites/all/modules/contrib/dev/ctools/tests/math_expression_stack.test +++ b/sites/all/modules/contrib/dev/ctools/tests/math_expression_stack.test @@ -1,26 +1,34 @@ 'CTools math expression stack tests', + 'name' => 'Math expressions stack', 'description' => 'Test the stack class of the math expression library.', 'group' => 'ctools', + 'dependencies' => array('ctools'), ); } - public function setUp() { - parent::setUp('ctools', 'ctools_plugin_test'); + /** + * {@inheritdoc} + */ + public function setUp(array $modules = array()) { + $modules[] = 'ctools'; + $modules[] = 'ctools_plugin_test'; + parent::setUp($modules); } + /** + * Test the math expression stack system. + */ public function testStack() { $stack = new ctools_math_expr_stack(); @@ -35,13 +43,15 @@ class CtoolsMathExpressionStackTestCase extends DrupalWebTestCase { $this->assertIdentical($value, $stack->pop()); $this->assertNull($stack->pop()); - // Add multiple elements and see whether they are returned in the right order. + // Add multiple elements and see whether they are returned in the right + // order. $values = array($this->randomName(), $this->randomName(), $this->randomName()); foreach ($values as $value) { $stack->push($value); } - // Test the different elements at different positions with the last() method. + // Test the different elements at different positions with the last() + // method. $count = count($values); foreach ($values as $key => $value) { $this->assertEqual($value, $stack->last($count - $key)); @@ -58,6 +68,6 @@ class CtoolsMathExpressionStackTestCase extends DrupalWebTestCase { $this->assertEqual($stack->pop(), $value); } $this->assertNull($stack->pop()); - } + } diff --git a/sites/all/modules/contrib/dev/ctools/tests/object_cache.test b/sites/all/modules/contrib/dev/ctools/tests/object_cache.test index 2e714d6b..87fa4153 100644 --- a/sites/all/modules/contrib/dev/ctools/tests/object_cache.test +++ b/sites/all/modules/contrib/dev/ctools/tests/object_cache.test @@ -1,27 +1,34 @@ 'Ctools object cache storage', + 'name' => 'Object cache storage (UI tests)', 'description' => 'Verify that objects are written, readable and lockable.', 'group' => 'ctools', + 'dependencies' => array('ctools'), ); } - public function setUp() { - // Additionally enable ctools module. - parent::setUp('ctools'); + /** + * {@inheritdoc} + */ + public function setUp(array $modules = array()) { + $modules[] = 'ctools'; + parent::setUp($modules); } + public function testObjectStorage() { + ctools_include('cache'); + $account1 = $this->drupalCreateUser(array()); $this->drupalLogin($account1); @@ -36,11 +43,11 @@ class CtoolsObjectCache extends DrupalWebTestCase { // TODO Test object locking somehow. // Object locking/testing works on session_id but simpletest uses // $this->session_id so can't be tested ATM. - ctools_object_cache_clear('testdata', 'one'); $this->assertFalse(ctools_object_cache_get('testdata', 'one'), 'Object cache data successfully cleared'); // TODO Test ctools_object_cache_clear_all somehow... // ctools_object_cache_clear_all requires session_id funtionality as well. } + } diff --git a/sites/all/modules/contrib/dev/ctools/tests/object_cache_unit.test b/sites/all/modules/contrib/dev/ctools/tests/object_cache_unit.test new file mode 100644 index 00000000..68b73503 --- /dev/null +++ b/sites/all/modules/contrib/dev/ctools/tests/object_cache_unit.test @@ -0,0 +1,141 @@ + 'Object cache storage (unit tests)', + 'description' => 'Verify that objects are written, readable and lockable.', + 'group' => 'ctools', + 'dependencies' => array('ctools'), + ); + } + + /** + * {@inheritdoc} + */ + public function setUp(array $modules = array()) { + $modules[] = 'ctools'; + parent::setUp($modules); + } + + /** + * Check that the supplied array looks like a ctools cache plugin. + * + * @param mixed $p + * The value to check. + * @param string $msg + * Prefix of the assertion message. + */ + public function assertValidCachePlugin($p, $msg) { + $this->assertTrue(is_array($p), $msg . ': plugin is an array'); + + $this->assertEqual($p['plugin type'], 'cache', $msg . ': type is cache'); + + $this->assertTrue(array_key_exists('title', $p), $msg . ': title element exists'); + $this->assertTrue(!empty($p['title']) && is_string($p['title']), $msg . ': title is a string'); + + $this->assertTrue(array_key_exists('cache get', $p), $msg . ': has a get function'); + $this->assertTrue(!empty($p['cache get']) && is_callable($p['cache get']), $msg . ': get is executable'); + + $this->assertTrue(array_key_exists('cache set', $p), $msg . ': has a set function'); + $this->assertTrue(!empty($p['cache set']) && is_callable($p['cache set']), $msg . ': set is executable'); + + // @todo Clear is required by the spec (cache.inc:40..48): but export_ui + // cache doesn't implement it. Enable the assertions when that problem is + // solved. + // $this->assertTrue(array_key_exists('cache clear', $p), $msg . ': has a clear function'); + // $this->assertTrue(is_callable($p['cache clear']), $msg . ': clear is executable'); + // @todo Break is optional acc'd to spec but does anything implement it? + $this->assertTrue(!array_key_exists('cache break', $p) || is_callable($p['cache break']), $msg . ': break is executable'); + + // @todo Finalize is optional so don't fail if not there?? + $this->assertTrue(!array_key_exists('cache finalize', $p) || is_callable($p['cache finalize']), $msg . ': finalize is executable'); + } + + /** + * Check the return value of the ctools_cache_find_plugin function. + * + * @param mixed $p + * The value to check. + * @param string $msg + * Prefix of the assertion message. + */ + public function assertPluginNotFound($p, $msg) { + $this->assertTrue(is_array($p), $msg . ': is an array'); + $plugin = array_shift($p); + $this->assertNull($plugin, $msg . ': no plugin info'); + $data = array_shift($p); + $this->assertTrue(empty($data) || is_string($data), $msg . ': data string-like'); + $this->assertTrue(empty($p), $msg . ': just two elements'); + } + + /** + * Check the return value of the ctools_cache_find_plugin function. + * + * @param mixed $p + * The value to check. + * @param string $msg + * Prefix of the assertion message. + */ + public function assertPluginFound($p, $msg) { + $this->assertTrue(is_array($p), $msg . ': is an array'); + $plugin = array_shift($p); + $this->assertTrue(is_array($plugin), $msg . ': has plugin data'); + $data = array_shift($p); + $this->assertTrue(empty($data) || is_string($data), $msg . ': data is string-like'); + $this->assertTrue(empty($p), $msg . ': just two elements'); + } + + /** + * Test to see that we can find the standard simple plugin. + */ + public function testFindSimpleCachePlugin() { + ctools_include('cache'); + + // The simple plugin. + $plugin = ctools_cache_find_plugin('simple'); + $this->assertPluginFound($plugin, 'The Simple Cache plugin is present'); + $this->assertValidCachePlugin($plugin[0], 'The Simple Cache plugin'); + + // The simple plugin, with ::. + $plugin = ctools_cache_find_plugin('simple::data'); + $this->assertPluginFound($plugin, 'The Simple Cache plugin is present, with data'); + } + + /** + * Test to see that we can find the standard export_ui plugin. + */ + public function testFindExportUICachePlugin() { + ctools_include('cache'); + + // The export plugin. + $plugin = ctools_cache_find_plugin('export_ui'); + $this->assertPluginFound($plugin, 'The Export UI Cache plugin is present'); + $this->assertValidCachePlugin($plugin[0], 'The Export Cache plugin'); + + // The export plugin, with ::. + $plugin = ctools_cache_find_plugin('export_ui::data'); + $this->assertTrue(is_array($plugin), 'The Export UI Cache plugin is present, with data'); + } + + /** + * Test to see that we don't find plugins that aren't there. + */ + public function testFindFoobarbazCachePlugin() { + ctools_include('cache'); + + // An imaginary foobarbaz plugin. + $plugin = ctools_cache_find_plugin('foobarbaz'); + $this->assertPluginNotFound($plugin, 'The Foobarbaz Cache plugin is absent'); + $plugin = ctools_cache_find_plugin('foobarbaz::data'); + $this->assertPluginNotFound($plugin, 'The Foobarbaz Cache plugin is absent, with data'); + } + +} diff --git a/sites/all/modules/contrib/dev/ctools/tests/page_tokens.test b/sites/all/modules/contrib/dev/ctools/tests/page_tokens.test new file mode 100644 index 00000000..7d95d9ae --- /dev/null +++ b/sites/all/modules/contrib/dev/ctools/tests/page_tokens.test @@ -0,0 +1,136 @@ + 'Page token processing', + 'description' => 'Verify that page tokens can be set and read.', + 'group' => 'ctools', + 'dependencies' => array('ctools'), + ); + } + + /** + * {@inheritdoc} + */ + public function setUp(array $modules = array()) { + $modules[] = 'ctools'; + parent::setUp($modules); + + // Start each test anew. + ctools_reset_page_tokens(); + } + + /** + * Test that we can set page tokens. + */ + public function testSetPageToken() { + ctools_set_page_token('id', 'variable', 'test'); + + $tokens = ctools_set_page_token(); + $this->assertTrue(is_array($tokens) && count($tokens) === 1, 'Page tokens no longer empty.'); + $this->assertEqual($tokens['id'], array('variable', 'test'), 'Page token has correct value.'); + } + + /** + * Test that we can set page tokens. + */ + public function testSetVariableToken() { + $string = ctools_set_variable_token('title'); + $tokens = ctools_set_page_token(); + + $this->assertTrue(is_array($tokens) && count($tokens) === 1, 'Page tokens no longer empty'); + $this->assertEqual($tokens[$string], array('variable', 'title'), 'Page tokens no longer empty'); + } + + /** + * Test that we can set page tokens. + */ + public function testReplaceVariableToken() { + $string = ctools_set_variable_token('title'); + $this->assertEqual($string, '', 'Expected form of token was found'); + + $elements = array( + '#type' => 'container', + '#attributes' => array('class' => array('test')), + 'title' => '
@fields
. To set the value of the field, set @entity_field
. For multi-value computed fields continue with @entity_field_multi
. Here\'s a simple example which sets the computed field\'s value to the value of the sum of the number fields (@field_a
and @field_b
) in a node entity:@example
The first pop fetches the last (or only) item from the field while the second pop fetches its [\'value\']
contents (assuming it\'s the only key that\'s set).
Alternately, this code can be supplied by your own custom function named: @compute_func(&$entity_field, $entity_type, $entity, $field, $instance, $langcode, $items)
',
- array('@fields' => '&$entity_field, $entity_type, $entity, $field, $instance, $langcode, and $items',
- '@entity_field' => '$entity_field[0][\'value\']',
- '@entity_field_multi' => '$entity_field[1][\'value\']',
- '@field_a' => 'field_a',
- '@field_b' => 'field_b',
- '@example' => '$entity_field[0][\'value\'] = array_pop(array_pop(field_get_items($entity_type, $entity, \'field_a\'))) + array_pop(array_pop(field_get_items($entity_type, $entity, \'field_b\')));',
- '@compute_func' => $compute_func)),
+ '#description' => t('
The variables available to your code include: @fields
. To set the value of the field, set @entity_field
. For multi-value computed fields continue with @entity_field_multi
. Here\'s a simple example which sets the computed field\'s value to the value of the sum of the number fields (@field_a
and @field_b
) in a node entity:
Alternately, this code can be supplied by your own custom function named: @compute_func(&$entity_field, $entity_type, $entity, $field, $instance, $langcode, $items)
.
$field_a = field_get_items($entity_type, $entity, "field_a");
+ $field_b = field_get_items($entity_type, $entity, "field_b");
+ $entity_field[0]["value"] = $field_a[0]["value"] + $field_b[0]["value"];
@display_output
variable, which will be printed when the field is displayed. The raw computed value of the field is in @value
. Note: this code has no effect if you use the "Raw computed value" display formatter. Alternately, this code can be supplied by your own custom function named: @display_func($field, $entity_field_item, $entity_lang, $langcode, $entity)
. Return the value to be displayed. Original value is in $entity_field_item[\'value\'].',
- array('@display_output' => '$display_output',
- '@value' => '$entity_field_item[\'value\']',
- '@display_func' => $display_func)),
+ '#description' => t('This code should assign a string to the @display_output
variable, which will be printed when the field is displayed. The raw computed value of the field is in @value
. Note: this code has no effect if you use the "Raw computed value" display formatter.
Alternately, this code can be supplied by your own custom function named: @display_func($field, $entity_field_item, $entity_lang, $langcode, $entity)
. Return the value to be displayed. Original value is in $entity_field_item[\'value\'].', array(
+ '@display_output' => '$display_output',
+ '@value' => '$entity_field_item[\'value\']',
+ '@display_func' => $display_func,
+ )),
'#default_value' => !empty($settings['display_format']) ? $settings['display_format'] : '$display_output = $entity_field_item[\'value\'];',
'#access' => !function_exists($display_func),
);
@@ -100,8 +113,14 @@ function computed_field_field_settings_form($field, $instance, $has_data) {
$form['display_func'] = array(
'#type' => 'item',
'#markup' => t('This field is DISPLAYED using @display_func()
.', array('@display_func' => $display_func)),
- );
+ );
}
+ $form['recalculate'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Recalculate the field value every time.'),
+ '#description' => t('By default, Drupal will cache the value of this field even if it is not stored in the database (and even if Page Caching is disabled). This option will cause computed_field to recalculate the value every time this field is displayed. For example, a time-based calculated value may change more often than field cache is cleared. (Note that Drupal page caching will still cache the field value.)'),
+ '#default_value' => is_numeric($settings['recalculate']) ? $settings['recalculate'] : FALSE,
+ );
$form['store'] = array(
'#type' => 'checkbox',
'#title' => t('Store value in the database'),
@@ -122,7 +141,14 @@ function computed_field_field_settings_form($field, $instance, $has_data) {
'#title' => t('Data Type'),
'#description' => t('The SQL datatype to store this field in.'),
'#default_value' => !empty($settings['database']['data_type']) ? $settings['database']['data_type'] : 'varchar',
- '#options' => array('varchar' => 'varchar', 'text' => 'text', 'longtext' => 'longtext', 'int' => 'int', 'float' => 'float', 'numeric' => 'decimal'),
+ '#options' => array(
+ 'varchar' => 'varchar',
+ 'text' => 'text',
+ 'longtext' => 'longtext',
+ 'int' => 'int',
+ 'float' => 'float',
+ 'numeric' => 'decimal',
+ ),
'#required' => FALSE,
'#disabled' => $has_data,
);
@@ -139,7 +165,13 @@ function computed_field_field_settings_form($field, $instance, $has_data) {
'#title' => t('Data Size (int/float)'),
'#description' => t('Only valid for int or float fields. The size of the field stored in the database.'),
'#default_value' => !empty($settings['database']['data_size']) ? $settings['database']['data_size'] : 'normal',
- '#options' => array('tiny' => 'tiny', 'small' => 'small', 'medium' => 'medium', 'normal' => 'normal', 'big' => 'big'),
+ '#options' => array(
+ 'tiny' => 'tiny',
+ 'small' => 'small',
+ 'medium' => 'medium',
+ 'normal' => 'normal',
+ 'big' => 'big',
+ ),
'#required' => FALSE,
'#disabled' => $has_data,
);
@@ -184,8 +216,8 @@ function computed_field_field_settings_form($field, $instance, $has_data) {
}
/**
-* Implements the #element_validate callback for computed_field_field_settings_form().
-*/
+ * #element_validate callback for computed_field_field_settings_form().
+ */
function computed_field_field_settings_form_validate($element, &$form_state) {
$settings = $form_state['values']['field']['settings'];
if ($settings['store']) {
@@ -202,11 +234,11 @@ function computed_field_field_settings_form_validate($element, &$form_state) {
}
/**
- * Implements field hook_field_load().
+ * Implements hook_field_load().
*/
function computed_field_field_load($entity_type, $entities, $field, $instances, $langcode, &$items, $age) {
$settings = $field['settings'];
- // Compute field values on load if they aren't stored in the database
+ // Compute field values on load if they aren't stored in the database.
if (!$settings['store']) {
foreach ($entities as $etid => $entity) {
_computed_field_compute_value($entity_type, $entity, $field, $instances, $langcode, $items[$etid]);
@@ -215,33 +247,34 @@ function computed_field_field_load($entity_type, $entities, $field, $instances,
}
/**
- * Implements field hook_field_prepare_view().
+ * Implements hook_field_prepare_view().
*/
function computed_field_field_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items) {
- // Compute field values in case user is "previewing" an entity
+ $settings = $field['settings'];
+ // Compute field values in case user is "previewing" an entity.
foreach ($entities as $etid => $entity) {
- if (isset($entity->op) && $entity->op == 'Preview') {
+ if ((isset($entity->op) && $entity->op == 'Preview') || $settings['recalculate']) {
_computed_field_compute_value($entity_type, $entity, $field, $instances, $langcode, $items[$etid]);
}
}
}
/**
- * Implements field hook_field_insert().
+ * Implements hook_field_insert().
*/
function computed_field_field_insert($entity_type, $entity, $field, $instance, $langcode, &$items) {
_computed_field_compute_value($entity_type, $entity, $field, $instance, $langcode, $items);
}
/**
- * Implements field hook_field_update().
+ * Implements hook_field_update().
*/
function computed_field_field_update($entity_type, $entity, $field, $instance, $langcode, &$items) {
_computed_field_compute_value($entity_type, $entity, $field, $instance, $langcode, $items);
}
/**
- * Implements field hook_field_widget_info().
+ * Implements hook_field_widget_info().
*/
function computed_field_field_widget_info() {
return array(
@@ -257,14 +290,15 @@ function computed_field_field_widget_info() {
}
/**
- * Implements field hook_field_widget_form().
+ * Implements hook_field_widget_form().
*/
-
function computed_field_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
// If there are no items yet, add a null item value to avoid
- // preview errors when selecting a different language
- if (empty($items)) $items[0]['value'] = NULL;
+ // preview errors when selecting a different language.
+ if (empty($items)) {
+ $items[0]['value'] = NULL;
+ }
foreach ($items as $item_delta => $item) {
$element[$item_delta]['value'] = array(
@@ -305,37 +339,45 @@ function computed_field_field_formatter_info() {
*/
function computed_field_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$element = array();
+ $data_to_display = FALSE;
- // Special case formatter that returns the raw computed values without any display code processing
+ // Special case formatter that returns the raw computed values without any display code processing.
if ($display['type'] == "computed_field_computed_value") {
foreach ($items as $delta => $item) {
- if (!isset($entity_field_item['value'])) $entity_field_item['value'] = NULL;
+ if (!isset($entity_field_item['value'])) {
+ $entity_field_item['value'] = NULL;
+ }
$element[$delta] = array('#markup' => $item['value']);
}
return $element;
}
- // Other display formatters which run through display code processing
- // Check if the value is to be formatted by a display function outside the DB
+ // Other display formatters which run through display code processing.
+ // Check if the value is to be formatted by a display function outside the DB.
$display_func = 'computed_field_' . $field['field_name'] . '_display';
- if (function_exists($display_func)) $display_in_code = TRUE;
- else $display_in_code = FALSE;
+ $display_in_code = function_exists($display_func) ? TRUE : FALSE;
- // Loop the items to display
+ // Loop the items to display.
foreach ($items as $delta => $item) {
- // For "some" backwards compatibility
+ // For "some" backwards compatibility.
$entity_field_item = $item;
- // Setup a variable with the entity language if available
- if (isset($entity->language)) $entity_lang = $entity->language;
- else $entity_lang = LANGUAGE_NONE;
+ // Setup a variable with the entity language if available.
+ if (isset($entity->language)) {
+ $entity_lang = $entity->language;
+ }
+ else {
+ $entity_lang = LANGUAGE_NONE;
+ }
- // If there are value "holes" in the field array let's set the value to NULL
- // to avoid undefined index errors in typical PHP display code
- if (!isset($entity_field_item['value'])) $entity_field_item['value'] = NULL;
+ // If there are value "holes" in the field array let's set the value to NULL.
+ // to avoid undefined index errors in typical PHP display code.
+ if (!isset($entity_field_item['value'])) {
+ $entity_field_item['value'] = NULL;
+ }
- // Execute the display code
+ // Execute the display code.
$display_output = NULL;
if ($display_in_code) {
$display_output = $display_func($field, $entity_field_item, $entity_lang, $langcode, $entity);
@@ -344,31 +386,59 @@ function computed_field_field_formatter_view($entity_type, $entity, $field, $ins
eval($field['settings']['display_format']);
}
- // Output the formatted display item
+ // Track if any of our items produce non-empty output.
+ if (!empty($display_output) || is_numeric($display_output)) {
+ $data_to_display = TRUE;
+ }
+
+ // Output the formatted display item.
switch ($display['type']) {
case 'computed_field_unsanitized':
$element[$delta] = array('#markup' => $display_output);
break;
+
case 'computed_field_plain':
$element[$delta] = array('#markup' => check_plain($display_output));
break;
+
case 'computed_field_markup':
$element[$delta] = array('#markup' => check_markup($display_output));
break;
}
}
+ // If all items are empty then we should not return anything. This helps
+ // ensure that empty fields are not displayed at all. This check does not
+ // apply to fields stored in the DB as those are instead checked on save.
+ if (isset($field['settings']['store']) && !$field['settings']['store'] && !$data_to_display) {
+ return;
+ }
return $element;
}
/**
- * Implements field hook_field_is_empty().
+ * Implements hook_field_is_empty().
*/
function computed_field_field_is_empty($item, $field) {
- $data_type = $field['settings']['database']['data_type'];
- if ($data_type == 'int' || $data_type == 'float') {
- return !is_numeric($item['value']);
+ unset($empty);
+
+ // This will depend on the class of data type.
+ switch ($field['settings']['database']['data_type']) {
+
+ case 'int':
+ case 'float':
+ case 'numeric':
+ // For numbers, the field is empty if the value isn't numeric.
+ $empty = !is_numeric($item['value']);
+ break;
+
+ case 'varchar':
+ case 'text':
+ case 'longtext':
+ // For strings, the field is empty if it doesn't match the empty string.
+ $empty = ($item['value'] === "");
+ break;
}
- return empty($item['value']);
+ return $empty;
}
/**
@@ -377,14 +447,18 @@ function computed_field_field_is_empty($item, $field) {
function _computed_field_compute_value($entity_type, $entity, $field, $instance, $langcode, &$items) {
$settings = $field['settings'];
- // Setup a variable with the field values
+ // Setup a variable with the field values.
$entity_field =& $items;
- // Setup a variable with the entity language if available
- if (isset($entity->language)) $entity_lang = $entity->language;
- else $entity_lang = LANGUAGE_NONE;
+ // Setup a variable with the entity language if available.
+ if (isset($entity->language)) {
+ $entity_lang = $entity->language;
+ }
+ else {
+ $entity_lang = LANGUAGE_NONE;
+ }
- // Allow the value to be computed from code not stored in DB
+ // Allow the value to be computed from code not stored in DB.
$compute_func = 'computed_field_' . $field['field_name'] . '_compute';
if (function_exists($compute_func)) {
$compute_func($entity_field, $entity_type, $entity, $field, $instance, $langcode, $items);
@@ -395,4 +469,3 @@ function _computed_field_compute_value($entity_type, $entity, $field, $instance,
}
}
}
-
diff --git a/sites/all/modules/contrib/theming/colorbox/colorbox.admin.inc b/sites/all/modules/contrib/theming/colorbox/colorbox.admin.inc
index 44b030a2..2122650f 100644
--- a/sites/all/modules/contrib/theming/colorbox/colorbox.admin.inc
+++ b/sites/all/modules/contrib/theming/colorbox/colorbox.admin.inc
@@ -145,6 +145,12 @@ function colorbox_admin_settings() {
'#default_value' => variable_get('colorbox_overlayclose', 1),
'#description' => t('Enable closing Colorbox by clicking on the background overlay.'),
);
+ $form['colorbox_custom_settings']['colorbox_returnfocus'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Return focus'),
+ '#default_value' => variable_get('colorbox_returnfocus', 1),
+ '#description' => t('Return focus when Colorbox exits to the element it was launched from.'),
+ );
$form['colorbox_custom_settings']['colorbox_maxwidth'] = array(
'#type' => 'textfield',
'#title' => t('Max width'),
@@ -266,10 +272,10 @@ function colorbox_admin_settings() {
);
$form['colorbox_advanced_settings']['colorbox_mobile_device_width'] = array(
'#type' => 'textfield',
- '#title' => t('Device with'),
+ '#title' => t('Device width'),
'#default_value' => variable_get('colorbox_mobile_device_width', '480px'),
'#size' => 30,
- '#description' => t('Set the mobile device max with. Default: 480px.'),
+ '#description' => t('Set the mobile device max width. Default: 480px.'),
'#states' => array(
'visible' => array(
':input[name="colorbox_mobile_detect"]' => array('value' => '1'),
diff --git a/sites/all/modules/contrib/theming/colorbox/colorbox.info b/sites/all/modules/contrib/theming/colorbox/colorbox.info
index 23b153d3..e72aad31 100644
--- a/sites/all/modules/contrib/theming/colorbox/colorbox.info
+++ b/sites/all/modules/contrib/theming/colorbox/colorbox.info
@@ -6,9 +6,9 @@ configure = admin/config/media/colorbox
files[] = views/colorbox_handler_field_colorbox.inc
-; Information added by Drupal.org packaging script on 2016-06-06
-version = "7.x-2.12"
+; Information added by Drupal.org packaging script on 2017-04-04
+version = "7.x-2.13"
core = "7.x"
project = "colorbox"
-datestamp = "1465255741"
+datestamp = "1491291489"
diff --git a/sites/all/modules/contrib/theming/colorbox/colorbox.module b/sites/all/modules/contrib/theming/colorbox/colorbox.module
index 23e2a037..4d16400d 100644
--- a/sites/all/modules/contrib/theming/colorbox/colorbox.module
+++ b/sites/all/modules/contrib/theming/colorbox/colorbox.module
@@ -44,7 +44,7 @@ function colorbox_theme() {
'node' => NULL, // Left for legacy support.
'field' => array(),
'display_settings' => array(),
- 'delta' => null,
+ 'delta' => NULL,
),
'file' => 'colorbox.theme.inc',
),
@@ -167,7 +167,7 @@ function _colorbox_doheader() {
return; // Don't add the JavaScript and CSS multiple times.
}
- // Insert options and translated strings as javascript settings.
+ // Insert options and translated strings as JavaScript settings.
if (variable_get('colorbox_custom_settings_activate', 0)) {
$js_settings = array(
'transition' => variable_get('colorbox_transition_type', 'elastic'),
@@ -183,6 +183,7 @@ function _colorbox_doheader() {
'next' => strip_tags(variable_get('colorbox_text_next', 'Next ยป')),
'close' => strip_tags(variable_get('colorbox_text_close', 'Close')),
'overlayClose' => variable_get('colorbox_overlayclose', 1) ? TRUE : FALSE,
+ 'returnFocus' => variable_get('colorbox_returnfocus', 1) ? TRUE : FALSE,
'maxWidth' => variable_get('colorbox_maxwidth', '98%'),
'maxHeight' => variable_get('colorbox_maxheight', '98%'),
'initialWidth' => variable_get('colorbox_initialwidth', '300'),
@@ -364,11 +365,18 @@ function colorbox_field_formatter_settings_form($field, $instance, $view_mode, $
// Allow users to hide or set a custom recursion limit.
// The module token_tweaks sets a global recursion limit that can not be bypassed.
if (module_exists('token') && $recursion_limit = min(variable_get('token_tree_recursion_limit', 3), variable_get('colorbox_token_recursion_limit', 3))) {
+ // File entities do not have $field, only $instance.
+ if (!empty($field)) {
+ $token_types = array_merge(array_keys($field['bundles']), array('file'));
+ }
+ else {
+ $token_types = array($instance['entity_type'], 'file');
+ }
$element['colorbox_token'] = array(
'#type' => 'fieldset',
'#title' => t('Replacement patterns'),
'#theme' => 'token_tree',
- '#token_types' => array_merge(array_keys($field['bundles']),array('file')),
+ '#token_types' => $token_types,
'#recursion_limit' => $recursion_limit,
'#dialog' => TRUE,
'#states' => array(
diff --git a/sites/all/modules/contrib/theming/colorbox/colorbox.theme.inc b/sites/all/modules/contrib/theming/colorbox/colorbox.theme.inc
index 76c4c0c3..cd4a2375 100644
--- a/sites/all/modules/contrib/theming/colorbox/colorbox.theme.inc
+++ b/sites/all/modules/contrib/theming/colorbox/colorbox.theme.inc
@@ -66,7 +66,7 @@ function theme_colorbox_image_formatter($variables) {
$entity_title = entity_label($entity_type, $entity);
switch ($settings['colorbox_caption']) {
- case 'auto':
+ case 'auto':
// If the title is empty use alt or the entity title in that order.
if (!empty($image['title'])) {
$caption = $image['title'];
@@ -81,18 +81,23 @@ function theme_colorbox_image_formatter($variables) {
$caption = '';
}
break;
+
case 'title':
$caption = $image['title'];
break;
+
case 'alt':
$caption = $image['alt'];
break;
+
case 'node_title':
$caption = $entity_title;
break;
+
case 'custom':
$caption = token_replace($settings['colorbox_caption_custom'], array($entity_type => $entity, 'file' => (object) $item), array('clear' => TRUE));
break;
+
default:
$caption = '';
}
@@ -111,18 +116,23 @@ function theme_colorbox_image_formatter($variables) {
case 'post':
$gallery_id = 'gallery-' . $entity_id;
break;
+
case 'page':
$gallery_id = 'gallery-all';
break;
+
case 'field_post':
$gallery_id = 'gallery-' . $entity_id . '-' . $field['field_name'];
break;
+
case 'field_page':
$gallery_id = 'gallery-' . $field['field_name'];
break;
+
case 'custom':
$gallery_id = $settings['colorbox_gallery_custom'];
break;
+
default:
$gallery_id = '';
}
@@ -183,6 +193,7 @@ function theme_colorbox_imagefield($variables) {
'title' => $variables['title'],
'class' => $class,
'data-colorbox-gallery' => $variables['gid'],
+ 'data-cbox-img-attrs' => '{"title": "' . $variables['image']['title'] . '", "alt": "' . $variables['image']['alt'] . '"}',
),
);
@@ -240,6 +251,7 @@ function template_preprocess_colorbox_insert_image(&$variables) {
case 2:
$variables['gallery_id'] = 'gallery-all';
break;
+
case 3:
$variables['gallery_id'] = '';
break;
diff --git a/sites/all/modules/contrib/theming/colorbox/drush/colorbox.drush.inc b/sites/all/modules/contrib/theming/colorbox/drush/colorbox.drush.inc
index 2ff34424..56df55c5 100644
--- a/sites/all/modules/contrib/theming/colorbox/drush/colorbox.drush.inc
+++ b/sites/all/modules/contrib/theming/colorbox/drush/colorbox.drush.inc
@@ -90,39 +90,45 @@ function drush_colorbox_plugin() {
drush_log(dt('Directory @path was created', array('@path' => $path)), 'notice');
}
- // Set the directory to the download location.
- $olddir = getcwd();
- chdir($path);
+ // Download colorbox plugin only if path is writable.
+ if (is_writable($path)) {
+ // Set the directory to the download location.
+ $olddir = getcwd();
+ chdir($path);
- // Download the zip archive
- if ($filepath = drush_download_file(COLORBOX_DOWNLOAD_URI)) {
- $filename = basename($filepath);
- $dirname = COLORBOX_DOWNLOAD_PREFIX . basename($filepath, '.zip');
+ // Download the zip archive
+ if ($filepath = drush_download_file(COLORBOX_DOWNLOAD_URI)) {
+ $filename = basename($filepath);
+ $dirname = COLORBOX_DOWNLOAD_PREFIX . basename($filepath, '.zip');
- // Remove any existing Colorbox plugin directory
- if (is_dir($dirname) || is_dir('colorbox')) {
- drush_delete_dir($dirname, TRUE);
- drush_delete_dir('colorbox', TRUE);
- drush_log(dt('A existing Colorbox plugin was deleted from @path', array('@path' => $path)), 'notice');
+ // Remove any existing Colorbox plugin directory.
+ if (is_dir($dirname) || is_dir('colorbox')) {
+ drush_delete_dir($dirname, TRUE);
+ drush_delete_dir('colorbox', TRUE);
+ drush_log(dt('A existing Colorbox plugin was deleted from @path', array('@path' => $path)), 'notice');
+ }
+
+ // Decompress the zip archive
+ drush_tarball_extract($filename);
+
+ // Change the directory name to "colorbox" if needed.
+ if ($dirname != 'colorbox') {
+ drush_move_dir($dirname, 'colorbox', TRUE);
+ $dirname = 'colorbox';
+ }
}
- // Decompress the zip archive
- drush_tarball_extract($filename);
-
- // Change the directory name to "colorbox" if needed.
- if ($dirname != 'colorbox') {
- drush_move_dir($dirname, 'colorbox', TRUE);
- $dirname = 'colorbox';
+ if (is_dir($dirname)) {
+ drush_log(dt('Colorbox plugin has been installed in @path', array('@path' => $path)), 'success');
+ }
+ else {
+ drush_log(dt('Drush was unable to install the Colorbox plugin to @path', array('@path' => $path)), 'error');
}
- }
- if (is_dir($dirname)) {
- drush_log(dt('Colorbox plugin has been installed in @path', array('@path' => $path)), 'success');
+ // Set working directory back to the previous working directory.
+ chdir($olddir);
}
else {
- drush_log(dt('Drush was unable to install the Colorbox plugin to @path', array('@path' => $path)), 'error');
+ drush_log(dt('Drush was unable to install the Colorbox plugin because @path is not writable. If you enable the colorbox module before you install the plugin library, you may find that colorbox does not work until you reinstall the colorbox module.', array('@path' => $path)), 'warning');
}
-
- // Set working directory back to the previous working directory.
- chdir($olddir);
}
diff --git a/sites/all/modules/contrib/theming/colorbox/js/colorbox.js b/sites/all/modules/contrib/theming/colorbox/js/colorbox.js
index d17133b4..567ad381 100644
--- a/sites/all/modules/contrib/theming/colorbox/js/colorbox.js
+++ b/sites/all/modules/contrib/theming/colorbox/js/colorbox.js
@@ -1,3 +1,8 @@
+/**
+ * @file
+ * Colorbox module init js.
+ */
+
(function ($) {
Drupal.behaviors.initColorbox = {
diff --git a/sites/all/modules/contrib/theming/colorbox/js/colorbox_admin_settings.js b/sites/all/modules/contrib/theming/colorbox/js/colorbox_admin_settings.js
index 46608f81..79de0833 100644
--- a/sites/all/modules/contrib/theming/colorbox/js/colorbox_admin_settings.js
+++ b/sites/all/modules/contrib/theming/colorbox/js/colorbox_admin_settings.js
@@ -1,3 +1,8 @@
+/**
+ * @file
+ * Colorbox module admin settings js.
+ */
+
(function ($) {
Drupal.behaviors.initColorboxAdminSettings = {
diff --git a/sites/all/modules/contrib/theming/colorbox/js/colorbox_inline.js b/sites/all/modules/contrib/theming/colorbox/js/colorbox_inline.js
index 2354ef87..c06c588a 100644
--- a/sites/all/modules/contrib/theming/colorbox/js/colorbox_inline.js
+++ b/sites/all/modules/contrib/theming/colorbox/js/colorbox_inline.js
@@ -1,3 +1,8 @@
+/**
+ * @file
+ * Colorbox module inline js.
+ */
+
(function ($) {
Drupal.behaviors.initColorboxInline = {
diff --git a/sites/all/modules/contrib/theming/colorbox/js/colorbox_load.js b/sites/all/modules/contrib/theming/colorbox/js/colorbox_load.js
index 6d3c6767..bf2e924b 100644
--- a/sites/all/modules/contrib/theming/colorbox/js/colorbox_load.js
+++ b/sites/all/modules/contrib/theming/colorbox/js/colorbox_load.js
@@ -1,3 +1,7 @@
+/**
+ * @file
+ * Colorbox module load js.
+ */
(function ($) {
Drupal.behaviors.initColorboxLoad = {
@@ -17,7 +21,7 @@ Drupal.behaviors.initColorboxLoad = {
$.urlParams = function (url) {
var p = {},
e,
- a = /\+/g, // Regex for replacing addition symbol with a space
+ a = /\+/g, // Regex for replacing addition symbol with a space.
r = /([^&=]+)=?([^&]*)/g,
d = function (s) { return decodeURIComponent(s.replace(a, ' ')); },
q = url.split('?');
diff --git a/sites/all/modules/contrib/theming/colorbox/styles/default/colorbox_style.js b/sites/all/modules/contrib/theming/colorbox/styles/default/colorbox_style.js
index 47875ffd..d3e3c56f 100644
--- a/sites/all/modules/contrib/theming/colorbox/styles/default/colorbox_style.js
+++ b/sites/all/modules/contrib/theming/colorbox/styles/default/colorbox_style.js
@@ -1,3 +1,8 @@
+/**
+ * @file
+ * Colorbox module style js.
+ */
+
(function ($) {
Drupal.behaviors.initColorboxDefaultStyle = {
diff --git a/sites/all/modules/contrib/theming/colorbox/styles/plain/colorbox_style.js b/sites/all/modules/contrib/theming/colorbox/styles/plain/colorbox_style.js
index 19d8e66e..df6b5d6c 100644
--- a/sites/all/modules/contrib/theming/colorbox/styles/plain/colorbox_style.js
+++ b/sites/all/modules/contrib/theming/colorbox/styles/plain/colorbox_style.js
@@ -1,3 +1,8 @@
+/**
+ * @file
+ * Colorbox module style js.
+ */
+
(function ($) {
Drupal.behaviors.initColorboxPlainStyle = {
diff --git a/sites/all/modules/contrib/theming/colorbox/styles/stockholmsyndrome/colorbox_style.js b/sites/all/modules/contrib/theming/colorbox/styles/stockholmsyndrome/colorbox_style.js
index db3ab3ef..450c3536 100644
--- a/sites/all/modules/contrib/theming/colorbox/styles/stockholmsyndrome/colorbox_style.js
+++ b/sites/all/modules/contrib/theming/colorbox/styles/stockholmsyndrome/colorbox_style.js
@@ -1,3 +1,8 @@
+/**
+ * @file
+ * Colorbox module style js.
+ */
+
(function ($) {
Drupal.behaviors.initColorboxStockholmsyndromeStyle = {
diff --git a/sites/all/modules/contrib/theming/colorbox/views/colorbox.views.inc b/sites/all/modules/contrib/theming/colorbox/views/colorbox.views.inc
index 40f90a51..2731d7b8 100644
--- a/sites/all/modules/contrib/theming/colorbox/views/colorbox.views.inc
+++ b/sites/all/modules/contrib/theming/colorbox/views/colorbox.views.inc
@@ -6,7 +6,7 @@
*/
/**
- * Implementation of hook_views_data()
+ * Implements hook_views_data()
*/
function colorbox_views_data() {
diff --git a/sites/all/modules/contrib/theming/colorbox/views/colorbox_handler_field_colorbox.inc b/sites/all/modules/contrib/theming/colorbox/views/colorbox_handler_field_colorbox.inc
index 205d0995..49b6af78 100644
--- a/sites/all/modules/contrib/theming/colorbox/views/colorbox_handler_field_colorbox.inc
+++ b/sites/all/modules/contrib/theming/colorbox/views/colorbox_handler_field_colorbox.inc
@@ -67,7 +67,7 @@ If you would like to have the characters %5B and %5D please use the html entity
$patterns .= theme('item_list',
array(
'items' => $items,
- 'type' => $type
+ 'type' => $type,
));
}
}
@@ -183,11 +183,11 @@ If you would like to have the characters %5B and %5D please use the html entity
'width' => $width,
'height' => $height,
'title' => $caption,
- 'inline' => 'true'
+ 'inline' => 'true',
),
'attributes' => array(
'class' => array('colorbox-inline'),
- 'rel' => $gallery_id
+ 'rel' => $gallery_id,
)
);
// Remove any parameters that aren't set.
diff --git a/sites/all/modules/contrib/theming/extlink/README.txt b/sites/all/modules/contrib/theming/extlink/README.txt
index db8bc097..c75b887e 100644
--- a/sites/all/modules/contrib/theming/extlink/README.txt
+++ b/sites/all/modules/contrib/theming/extlink/README.txt
@@ -1,4 +1,5 @@
-
+INTRODUCTION
+------------
The External Links module is a very simple approach to adding icons to links
to external websites or e-mail addresses. It is a purely JavaScript
implementation, so the icons are only shown to users that have JavaScript
@@ -7,8 +8,12 @@ enabled.
External Links was written by Nathan Haug.
Built by Robots: http://www.lullabot.com
-Install
--------
+REQUIREMENTS
+------------
+No special requirements.
+
+INSTALLATION
+------------
Simply install External Links like you would any other module.
1) Copy the extlink folder to the modules folder in your installation.
@@ -18,7 +23,13 @@ Simply install External Links like you would any other module.
3) No additional configuration is necessary though you may fine-tune settings at
Administer -> Site configuration -> External Links (/admin/settings/extlink).
-A note about the CSS
+CONFIGURATION
+-------------
+No additional configuration is necessary though you may fine-tune settings at
+Manage -> Configuration -> External Links
+(/admin/config/user-interface/extlink).
+
+A NOTE ABOUT THE CSS
--------------------
This module adds a CSS file that is only a few lines in length. You may choose
to move this CSS to your theme to prevent the file from needing to be loaded
@@ -33,3 +44,10 @@ separately. To do this:
Note that you DO NOT need to make a extlink.css file. Specifying the file in the
info file is enough to tell Drupal not to load the original file.
+
+MAINTAINERS
+-----------
+Current maintainers:
+
+- Lachlan Ennis (elachlan) - https://www.drupal.org/u/elachlan
+- Nate Haug (quicksketch) - https://www.drupal.org/u/quicksketch
diff --git a/sites/all/modules/contrib/theming/extlink/extlink.css b/sites/all/modules/contrib/theming/extlink/extlink.css
index f912d8b8..90820648 100644
--- a/sites/all/modules/contrib/theming/extlink/extlink.css
+++ b/sites/all/modules/contrib/theming/extlink/extlink.css
@@ -15,7 +15,8 @@ span.mailto {
/* Hide the extra spans when printing. */
@media print {
- span.ext, span.mailto {
+ span.ext,
+ span.mailto {
display: none;
padding: 0;
}
diff --git a/sites/all/modules/contrib/theming/extlink/extlink.info b/sites/all/modules/contrib/theming/extlink/extlink.info
index 00d732fe..034b8bb9 100644
--- a/sites/all/modules/contrib/theming/extlink/extlink.info
+++ b/sites/all/modules/contrib/theming/extlink/extlink.info
@@ -6,9 +6,8 @@ configure = admin/config/user-interface/extlink
stylesheets[all][] = extlink.css
files[] = extlink.test
-; Information added by Drupal.org packaging script on 2014-07-25
-version = "7.x-1.18"
+; Information added by Drupal.org packaging script on 2018-04-20
+version = "7.x-1.20"
core = "7.x"
project = "extlink"
-datestamp = "1406278728"
-
+datestamp = "1524215285"
diff --git a/sites/all/modules/contrib/theming/extlink/extlink.install b/sites/all/modules/contrib/theming/extlink/extlink.install
index eb7662be..4c8146cd 100644
--- a/sites/all/modules/contrib/theming/extlink/extlink.install
+++ b/sites/all/modules/contrib/theming/extlink/extlink.install
@@ -1,18 +1,40 @@
fields(array('weight' => 1))
+ ->condition('name', 'extlink', '=')
+ ->execute();
}
/**
* Implements hook_uninstall().
*/
function extlink_uninstall() {
- db_query("DELETE FROM {variable} WHERE name LIKE 'extlink_%'");
+ variable_del('extlink_alert');
+ variable_del('extlink_alert_text');
+ variable_del('extlink_class');
+ variable_del('extlink_css_exclude');
+ variable_del('extlink_css_explicit');
+ variable_del('extlink_exclude');
+ variable_del('extlink_icon_placement');
+ variable_del('extlink_img_class');
+ variable_del('extlink_include');
+ variable_del('extlink_label');
+ variable_del('extlink_mailto_class');
+ variable_del('extlink_mailto_label');
+ variable_del('extlink_subdomains');
+ variable_del('extlink_target');
+
cache_clear_all('variables', 'cache');
}
diff --git a/sites/all/modules/contrib/theming/extlink/extlink.js b/sites/all/modules/contrib/theming/extlink/extlink.js
index dadcf381..77716d7f 100644
--- a/sites/all/modules/contrib/theming/extlink/extlink.js
+++ b/sites/all/modules/contrib/theming/extlink/extlink.js
@@ -1,161 +1,204 @@
+/**
+ * @file
+ */
+
(function ($) {
-Drupal.extlink = Drupal.extlink || {};
-
-Drupal.extlink.attach = function (context, settings) {
- if (!settings.hasOwnProperty('extlink')) {
- return;
- }
-
- // Strip the host name down, removing ports, subdomains, or www.
- var pattern = /^(([^\/:]+?\.)*)([^\.:]{4,})((\.[a-z]{1,4})*)(:[0-9]{1,5})?$/;
- var host = window.location.host.replace(pattern, '$3$4');
- var subdomain = window.location.host.replace(pattern, '$1');
-
- // Determine what subdomains are considered internal.
- var subdomains;
- if (settings.extlink.extSubdomains) {
- subdomains = "([^/]*\\.)?";
- }
- else if (subdomain == 'www.' || subdomain == '') {
- subdomains = "(www\\.)?";
- }
- else {
- subdomains = subdomain.replace(".", "\\.");
- }
-
- // Build regular expressions that define an internal link.
- var internal_link = new RegExp("^https?://" + subdomains + host, "i");
-
- // Extra internal link matching.
- var extInclude = false;
- if (settings.extlink.extInclude) {
- extInclude = new RegExp(settings.extlink.extInclude.replace(/\\/, '\\'), "i");
- }
-
- // Extra external link matching.
- var extExclude = false;
- if (settings.extlink.extExclude) {
- extExclude = new RegExp(settings.extlink.extExclude.replace(/\\/, '\\'), "i");
- }
-
- // Extra external link CSS selector exclusion.
- var extCssExclude = false;
- if (settings.extlink.extCssExclude) {
- extCssExclude = settings.extlink.extCssExclude;
- }
-
- // Extra external link CSS selector explicit.
- var extCssExplicit = false;
- if (settings.extlink.extCssExplicit) {
- extCssExplicit = settings.extlink.extCssExplicit;
- }
-
- // Find all links which are NOT internal and begin with http as opposed
- // to ftp://, javascript:, etc. other kinds of links.
- // When operating on the 'this' variable, the host has been appended to
- // all links by the browser, even local ones.
- // In jQuery 1.1 and higher, we'd use a filter method here, but it is not
- // available in jQuery 1.0 (Drupal 5 default).
- var external_links = new Array();
- var mailto_links = new Array();
- $("a:not(." + settings.extlink.extClass + ", ." + settings.extlink.mailtoClass + "), area:not(." + settings.extlink.extClass + ", ." + settings.extlink.mailtoClass + ")", context).each(function(el) {
- try {
- var url = this.href.toLowerCase();
- if (url.indexOf('http') == 0
- && ((!url.match(internal_link) && !(extExclude && url.match(extExclude))) || (extInclude && url.match(extInclude)))
- && !(extCssExclude && $(this).parents(extCssExclude).length > 0)
- && !(extCssExplicit && $(this).parents(extCssExplicit).length < 1)) {
- external_links.push(this);
- }
- // Do not include area tags with begin with mailto: (this prohibits
- // icons from being added to image-maps).
- else if (this.tagName != 'AREA'
- && url.indexOf('mailto:') == 0
- && !(extCssExclude && $(this).parents(extCssExclude).length > 0)
- && !(extCssExplicit && $(this).parents(extCssExplicit).length < 1)) {
- mailto_links.push(this);
- }
- }
- // IE7 throws errors often when dealing with irregular links, such as:
- // Empty tags.
- // example User:pass syntax.
- catch (error) {
- return false;
- }
- });
-
- if (settings.extlink.extClass) {
- Drupal.extlink.applyClassAndSpan(external_links, settings.extlink.extClass);
- }
-
- if (settings.extlink.mailtoClass) {
- Drupal.extlink.applyClassAndSpan(mailto_links, settings.extlink.mailtoClass);
- }
-
- if (settings.extlink.extTarget) {
- // Apply the target attribute to all links.
- $(external_links).attr('target', settings.extlink.extTarget);
- }
+ 'use strict';
Drupal.extlink = Drupal.extlink || {};
- // Set up default click function for the external links popup. This should be
- // overridden by modules wanting to alter the popup.
- Drupal.extlink.popupClickHandler = Drupal.extlink.popupClickHandler || function() {
- if (settings.extlink.extAlert) {
- return confirm(settings.extlink.extAlertText);
+ Drupal.extlink.attach = function (context, settings) {
+ if (!settings.hasOwnProperty('extlink')) {
+ return;
}
- }
- $(external_links).click(function(e) {
- return Drupal.extlink.popupClickHandler(e);
- });
-};
+ // Strip the host name down, removing ports, subdomains, or www.
+ var pattern = /^(([^\/:]+?\.)*)([^\.:]{1,})((\.[a-z0-9]{1,253})*)(:[0-9]{1,5})?$/;
+ var host = window.location.host.replace(pattern, '$2$3');
+ var subdomain = window.location.host.replace(host, '');
-/**
- * Apply a class and a trailing to all links not containing images.
- *
- * @param links
- * An array of DOM elements representing the links.
- * @param class_name
- * The class to apply to the links.
- */
-Drupal.extlink.applyClassAndSpan = function (links, class_name) {
- var $links_to_process;
- if (Drupal.settings.extlink.extImgClass){
- $links_to_process = $(links);
- }
- else {
- var links_with_images = $(links).find('img').parents('a');
- $links_to_process = $(links).not(links_with_images);
- }
- $links_to_process.addClass(class_name);
- var i;
- var length = $links_to_process.length;
- for (i = 0; i < length; i++) {
- var $link = $($links_to_process[i]);
- if ($link.css('display') == 'inline' || $link.css('display') == 'inline-block') {
- if (class_name == Drupal.settings.extlink.mailtoClass) {
- $link.append(' ' + Drupal.settings.extlink.mailtoLabel + '');
+ // Determine what subdomains are considered internal.
+ var subdomains;
+ if (settings.extlink.extSubdomains) {
+ subdomains = '([^/]*\\.)?';
+ }
+ else if (subdomain === 'www.' || subdomain === '') {
+ subdomains = '(www\\.)?';
+ }
+ else {
+ subdomains = subdomain.replace('.', '\\.');
+ }
+
+ // Build regular expressions that define an internal link.
+ var internal_link = new RegExp('^https?://([^@]*@)?' + subdomains + host, 'i');
+
+ // Extra internal link matching.
+ var extInclude = false;
+ if (settings.extlink.extInclude) {
+ extInclude = new RegExp(settings.extlink.extInclude.replace(/\\/, '\\'), 'i');
+ }
+
+ // Extra external link matching.
+ var extExclude = false;
+ if (settings.extlink.extExclude) {
+ extExclude = new RegExp(settings.extlink.extExclude.replace(/\\/, '\\'), 'i');
+ }
+
+ // Extra external link CSS selector exclusion.
+ var extCssExclude = false;
+ if (settings.extlink.extCssExclude) {
+ extCssExclude = settings.extlink.extCssExclude;
+ }
+
+ // Extra external link CSS selector explicit.
+ var extCssExplicit = false;
+ if (settings.extlink.extCssExplicit) {
+ extCssExplicit = settings.extlink.extCssExplicit;
+ }
+
+ // Define the jQuery method (either 'append' or 'prepend') of placing the icon, defaults to 'append'.
+ var extIconPlacement = settings.extlink.extIconPlacement || 'append';
+
+ // Find all links which are NOT internal and begin with http as opposed
+ // to ftp://, javascript:, etc. other kinds of links.
+ // When operating on the 'this' variable, the host has been appended to
+ // all links by the browser, even local ones.
+ // In jQuery 1.1 and higher, we'd use a filter method here, but it is not
+ // available in jQuery 1.0 (Drupal 5 default).
+ var external_links = [];
+ var mailto_links = [];
+ $('a:not(.' + settings.extlink.extClass + ', .' + settings.extlink.mailtoClass + '), area:not(.' + settings.extlink.extClass + ', .' + settings.extlink.mailtoClass + ')', context).each(function (el) {
+ try {
+ var url = '';
+ if (typeof this.href == 'string') {
+ url = this.href.toLowerCase();
+ }
+ // Handle SVG links (xlink:href).
+ else if (typeof this.href == 'object') {
+ url = this.href.baseVal;
+ }
+ if (url.indexOf('http') === 0
+ && ((!url.match(internal_link) && !(extExclude && url.match(extExclude))) || (extInclude && url.match(extInclude)))
+ && !(extCssExclude && $(this).is(extCssExclude))
+ && !(extCssExclude && $(this).parents(extCssExclude).length > 0)
+ && !(extCssExplicit && $(this).parents(extCssExplicit).length < 1)) {
+ external_links.push(this);
+ }
+ // Do not include area tags with begin with mailto: (this prohibits
+ // icons from being added to image-maps).
+ else if (this.tagName !== 'AREA'
+ && url.indexOf('mailto:') === 0
+ && !(extCssExclude && $(this).parents(extCssExclude).length > 0)
+ && !(extCssExplicit && $(this).parents(extCssExplicit).length < 1)) {
+ mailto_links.push(this);
+ }
}
- else {
- $link.append(' ' + Drupal.settings.extlink.extLabel + '');
+ // IE7 throws errors often when dealing with irregular links, such as:
+ // Empty tags.
+ // example User:pass syntax.
+ catch (error) {
+ return false;
+ }
+ });
+
+ if (settings.extlink.extClass) {
+ Drupal.extlink.applyClassAndSpan(external_links, settings.extlink.extClass, extIconPlacement);
+ }
+
+ if (settings.extlink.mailtoClass) {
+ Drupal.extlink.applyClassAndSpan(mailto_links, settings.extlink.mailtoClass, extIconPlacement);
+ }
+
+ if (settings.extlink.extTarget) {
+ // Apply the target attribute to all links.
+ $(external_links).attr('target', settings.extlink.extTarget);
+ // Add rel attributes noopener and noreferrer.
+ $(external_links).attr('rel', function (i, val) {
+ // If no rel attribute is present, create one with the values noopener and noreferrer.
+ if (val == null) {
+ return 'noopener noreferrer';
+ }
+ // Check to see if rel contains noopener or noreferrer. Add what doesn't exist.
+ if (val.indexOf('noopener') > -1 || val.indexOf('noreferrer') > -1) {
+ if (val.indexOf('noopener') === -1) {
+ return val + ' noopener';
+ }
+ if (val.indexOf('noreferrer') === -1) {
+ return val + ' noreferrer';
+ }
+ // Both noopener and noreferrer exist. Nothing needs to be added.
+ else {
+ return val;
+ }
+ }
+ // Else, append noopener and noreferrer to val.
+ else {
+ return val + ' noopener noreferrer';
+ }
+ });
+ }
+
+ Drupal.extlink = Drupal.extlink || {};
+
+ // Set up default click function for the external links popup. This should be
+ // overridden by modules wanting to alter the popup.
+ Drupal.extlink.popupClickHandler = Drupal.extlink.popupClickHandler || function () {
+ if (settings.extlink.extAlert) {
+ return confirm(settings.extlink.extAlertText);
+ }
+ };
+
+ $(external_links).click(function (e) {
+ return Drupal.extlink.popupClickHandler(e, this);
+ });
+ };
+
+ /**
+ * Apply a class and a trailing to all links not containing images.
+ *
+ * @param {object[]} links
+ * An array of DOM elements representing the links.
+ * @param {string} class_name
+ * The class to apply to the links.
+ * @param {string} icon_placement
+ * 'append' or 'prepend' the icon to the link.
+ */
+ Drupal.extlink.applyClassAndSpan = function (links, class_name, icon_placement) {
+ var $links_to_process;
+ if (Drupal.settings.extlink.extImgClass) {
+ $links_to_process = $(links);
+ }
+ else {
+ var links_with_images = $(links).find('img').parents('a');
+ $links_to_process = $(links).not(links_with_images);
+ }
+ $links_to_process.addClass(class_name);
+ var i;
+ var length = $links_to_process.length;
+ for (i = 0; i < length; i++) {
+ var $link = $($links_to_process[i]);
+ if ($link.css('display') === 'inline' || $link.css('display') === 'inline-block') {
+ if (class_name === Drupal.settings.extlink.mailtoClass) {
+ $link[icon_placement]('');
+ }
+ else {
+ $link[icon_placement]('');
+ }
}
}
- }
-};
+ };
-Drupal.behaviors.extlink = Drupal.behaviors.extlink || {};
-Drupal.behaviors.extlink.attach = function (context, settings) {
- // Backwards compatibility, for the benefit of modules overriding extlink
- // functionality by defining an "extlinkAttach" global function.
- if (typeof extlinkAttach === 'function') {
- extlinkAttach(context);
- }
- else {
- Drupal.extlink.attach(context, settings);
- }
-};
+ Drupal.behaviors.extlink = Drupal.behaviors.extlink || {};
+ Drupal.behaviors.extlink.attach = function (context, settings) {
+ // Backwards compatibility, for the benefit of modules overriding extlink
+ // functionality by defining an "extlinkAttach" global function.
+ if (typeof extlinkAttach === 'function') {
+ extlinkAttach(context);
+ }
+ else {
+ Drupal.extlink.attach(context, settings);
+ }
+ };
})(jQuery);
diff --git a/sites/all/modules/contrib/theming/extlink/extlink.module b/sites/all/modules/contrib/theming/extlink/extlink.module
index fcaae5b5..6d933f8a 100644
--- a/sites/all/modules/contrib/theming/extlink/extlink.module
+++ b/sites/all/modules/contrib/theming/extlink/extlink.module
@@ -1,4 +1,22 @@
' . t('External Links is used to differentiate between internal and external links. Using jQuery, it will find all external links on a page and add an external icon indicating it will take you offsite or a mail icon for mailto links.') . '
' . t('External links uses patterns (regular expressions) to match the "href" property of links.') . '
' . - t('Here are some common patterns.') . - theme('item_list', array('items' => $patterns)) . - t('Common special characters:') . - theme('item_list', array('items' => $wildcards)) . - '' . t('All special characters (!characters) must also be escaped with backslashes. Patterns are not case-sensitive. Any pattern supported by JavaScript may be used.', array('!characters' => '^ $ . ? ( ) | * +
')) . '
' . t('External links uses patterns (regular expressions) to match the "href" property of links.') . '
' . t('Here are some common patterns.') . + theme('item_list', array('items' => $patterns)) . t('Common special characters:') . + theme('item_list', array('items' => $wildcards)) . '' . t('All special characters (!characters) must also be escaped with backslashes. Patterns are not case-sensitive. Any pattern supported by JavaScript may be used.', array('!characters' => '^ $ . ? ( ) | * +
')) . '
' . t('Use CSS selectors to exclude entirely or only look inside explicitly specified classes and IDs for external links. These will be passed straight to jQuery for matching.') . '
', + '' . t('Use CSS selectors to exclude entirely or only look inside explicitly specified classes and IDs for external links. These will be passed straight to jQuery for matching.') . '
', ); $form['css_matching']['extlink_css_exclude'] = array( @@ -173,22 +218,25 @@ function extlink_admin_settings() { return system_settings_form($form); } +/** + * Validation handler for admin settings form. + */ function extlink_admin_settings_validate($form, &$form_state) { - // Check if the exclude pattern is a valid regular expression + // Check if the exclude pattern is a valid regular expression. if ($exclude = $form_state['values']['extlink_exclude']) { - // Testing the regex via replace + // Testing the regex via replace. $regexeval = @preg_replace('/' . $exclude . '/', '', 'Lorem ipsum'); - // If the regex returns NULL, then throw an error and reset the variable + // If the regex returns NULL, then throw an error and reset the variable. if ($regexeval === NULL) { form_set_error('extlink_exclude', t('Invalid regular expression.')); variable_set('extlink_exclude', ''); } } - // Check if the include pattern is a valid regular expression + // Check if the include pattern is a valid regular expression. if ($include = $form_state['values']['extlink_include']) { - // Testing the regex via replace - $regexeval = @preg_replace('/' . $include . '/', '', 'Lorem ipsum'); - // If the regex returns NULL, then throw an error and reset the variable + // Testing the regex via replace. + $regexeval = @preg_replace('/' . $include . '/', '', 'Lorem ipsum'); + // If the regex returns NULL, then throw an error and reset the variable. if ($regexeval === NULL) { form_set_error('extlink_include', t('Invalid regular expression.')); variable_set('extlink_include', ''); diff --git a/sites/all/modules/contrib/theming/extlink/extlink.test b/sites/all/modules/contrib/theming/extlink/extlink.test index 2459125b..16a5c299 100644 --- a/sites/all/modules/contrib/theming/extlink/extlink.test +++ b/sites/all/modules/contrib/theming/extlink/extlink.test @@ -1,28 +1,39 @@ normal_user = $this->drupalCreateUser($permissions); + $this->normalUser = $this->drupalCreateUser($permissions); // Create an admin user. $permissions[] = 'administer site configuration'; $permissions[] = 'administer permissions'; $permissions[] = 'administer content types'; - $this->admin_user = $this->drupalCreateUser($permissions); - } - - protected function getNodeFormValues() { - $edit = array( - 'title' => 'node_title ' . $this->randomName(32), - 'body[' . LANGUAGE_NONE . '][0][value]' => 'node_body ' . $this->randomName(256) . ' Google!', - ); - return $edit; - } - - /** - * Test if External Link is present - */ - protected function assertExternalLinkPresence() { - $elements = $this->xpath('//span[@class="ext"]'); - if (count($elements) > 0) - $this->pass('There should be an External Link on the form.', 'External Links'); - else - $this->fail('There should be an External Link on the form.', 'External Links'); - } -} - -class ExtlinkTestCase extends ExtlinkBaseWebTestCase { - public static function getInfo() { - return array( - 'name' => t('General External Links functionality'), - 'description' => t('Testing the basic functionality of External Links'), - 'group' => t('External Links'), - ); + $this->adminUser = $this->drupalCreateUser($permissions); } + } +/** + * Test Case for External Links administration functionality. + */ class ExtlinkAdminTestCase extends ExtlinkBaseWebTestCase { + + /** + * Get test info. + */ public static function getInfo() { return array( 'name' => t('External Links administration functionality'), @@ -82,16 +72,14 @@ class ExtlinkAdminTestCase extends ExtlinkBaseWebTestCase { /** * Test access to the admin pages. */ - function testAdminAccess() { - $this->drupalLogin($this->normal_user); + public function testAdminAccess() { + $this->drupalLogin($this->normalUser); $this->drupalGet(self::EXTLINK_ADMIN_PATH); - file_put_contents('tmp.simpletest.html', $this->drupalGetContent()); $this->assertText(t('Access denied'), 'Normal users should not be able to access the External Links admin pages', 'External Links'); - $this->drupalLogin($this->admin_user); + $this->drupalLogin($this->adminUser); $this->drupalGet(self::EXTLINK_ADMIN_PATH); - file_put_contents('tmp.simpletest.html', $this->drupalGetContent()); $this->assertNoText(t('Access denied'), 'Admin users should be able to access the External Links admin pages', 'External Links'); } + } -?> \ No newline at end of file