diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 0bd51e04..c015fb4f 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,4 +1,23 @@ +Drupal 7.54, 2017-02-01 +----------------------- +- Modules are now able to define theme engines (API addition: + https://www.drupal.org/node/2826480). +- Logging of searches can now be disabled (new option in the administrative + interface). +- Added menu tree render structure to (pre-)process hooks for theme_menu_tree() + (API addition: https://www.drupal.org/node/2827134). +- Added new function for determining whether an HTTPS request is being served + (API addition: https://www.drupal.org/node/2824590). +- Fixed incorrect default value for short and medium date formats on the date + type configuration page. +- File validation error message is now removed after subsequent upload of valid + file. +- Numerous bug fixes. +- Numerous API documentation improvements. +- Additional performance improvements. +- Additional automated test coverage. + Drupal 7.53, 2016-12-07 ----------------------- - Fixed drag and drop support on newer Chrome/IE 11+ versions after 7.51 update diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index ed6d864c..99a5ac84 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -8,7 +8,7 @@ /** * The current system version. */ -define('VERSION', '7.53'); +define('VERSION', '7.54'); /** * Core API compatibility. @@ -718,6 +718,16 @@ function drupal_valid_http_host($host) { && preg_match('/^\[?(?:[a-zA-Z0-9-:\]_]+\.?)+$/', $host); } +/** + * Checks whether an HTTPS request is being served. + * + * @return bool + * TRUE if the request is HTTPS, FALSE otherwise. + */ +function drupal_is_https() { + return isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on'; +} + /** * Sets the base URL, cookie domain, and session name from configuration. */ @@ -731,7 +741,7 @@ function drupal_settings_initialize() { if (file_exists(DRUPAL_ROOT . '/' . conf_path() . '/settings.php')) { include_once DRUPAL_ROOT . '/' . conf_path() . '/settings.php'; } - $is_https = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on'; + $is_https = drupal_is_https(); if (isset($base_url)) { // Parse fixed base URL from settings.php. diff --git a/includes/cache.inc b/includes/cache.inc index 4c2bed32..945dd663 100644 --- a/includes/cache.inc +++ b/includes/cache.inc @@ -122,7 +122,12 @@ function cache_get_multiple(array &$cids, $bin = 'cache') { * the administrator panel. * - cache_path: Stores the system paths that have an alias. * @param $expire - * (optional) One of the following values: + * (optional) Controls the maximum lifetime of this cache entry. Note that + * caches might be subject to clearing at any time, so this setting does not + * guarantee a minimum lifetime. With this in mind, the cache should not be + * used for data that must be kept during a cache clear, like sessions. + * + * Use one of the following values: * - CACHE_PERMANENT: Indicates that the item should never be removed unless * explicitly told to using cache_clear_all() with a cache ID. * - CACHE_TEMPORARY: Indicates that the item should be removed at the next @@ -262,7 +267,12 @@ interface DrupalCacheInterface { * 1MB in size to be stored by default. When caching large arrays or * similar, take care to ensure $data does not exceed this size. * @param $expire - * (optional) One of the following values: + * (optional) Controls the maximum lifetime of this cache entry. Note that + * caches might be subject to clearing at any time, so this setting does not + * guarantee a minimum lifetime. With this in mind, the cache should not be + * used for data that must be kept during a cache clear, like sessions. + * + * Use one of the following values: * - CACHE_PERMANENT: Indicates that the item should never be removed unless * explicitly told to using cache_clear_all() with a cache ID. * - CACHE_TEMPORARY: Indicates that the item should be removed at the next diff --git a/includes/common.inc b/includes/common.inc index 339a69b3..da8996a1 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -3986,7 +3986,11 @@ function drupal_html_id($id) { // be merged with content already on the base page. The HTML IDs must be // unique for the fully merged content. Therefore, initialize $seen_ids to // take into account IDs that are already in use on the base page. - $seen_ids_init = &drupal_static(__FUNCTION__ . ':init'); + static $drupal_static_fast; + if (!isset($drupal_static_fast['seen_ids_init'])) { + $drupal_static_fast['seen_ids_init'] = &drupal_static(__FUNCTION__ . ':init'); + } + $seen_ids_init = &$drupal_static_fast['seen_ids_init']; if (!isset($seen_ids_init)) { // Ideally, Drupal would provide an API to persist state information about // prior page requests in the database, and we'd be able to add this @@ -4031,7 +4035,10 @@ function drupal_html_id($id) { } } } - $seen_ids = &drupal_static(__FUNCTION__, $seen_ids_init); + if (!isset($drupal_static_fast['seen_ids'])) { + $drupal_static_fast['seen_ids'] = &drupal_static(__FUNCTION__, $seen_ids_init); + } + $seen_ids = &$drupal_static_fast['seen_ids']; $id = strtr(drupal_strtolower($id), array(' ' => '-', '_' => '-', '[' => '-', ']' => '')); diff --git a/includes/date.inc b/includes/date.inc index 01ab131b..9e68fee4 100644 --- a/includes/date.inc +++ b/includes/date.inc @@ -12,11 +12,6 @@ function system_default_date_formats() { $formats = array(); // Short date formats. - $formats[] = array( - 'type' => 'short', - 'format' => 'Y-m-d H:i', - 'locales' => array(), - ); $formats[] = array( 'type' => 'short', 'format' => 'm/d/Y - H:i', @@ -37,6 +32,11 @@ function system_default_date_formats() { 'format' => 'd.m.Y - H:i', 'locales' => array('de-ch', 'de-de', 'de-lu', 'fi-fi', 'fr-ch', 'is-is', 'pl-pl', 'ro-ro', 'ru-ru'), ); + $formats[] = array( + 'type' => 'short', + 'format' => 'Y-m-d H:i', + 'locales' => array(), + ); $formats[] = array( 'type' => 'short', 'format' => 'm/d/Y - g:ia', @@ -84,11 +84,6 @@ function system_default_date_formats() { ); // Medium date formats. - $formats[] = array( - 'type' => 'medium', - 'format' => 'D, Y-m-d H:i', - 'locales' => array(), - ); $formats[] = array( 'type' => 'medium', 'format' => 'D, m/d/Y - H:i', @@ -104,6 +99,11 @@ function system_default_date_formats() { 'format' => 'D, Y/m/d - H:i', 'locales' => array('en-ca', 'fr-ca', 'no-no', 'sv-se'), ); + $formats[] = array( + 'type' => 'medium', + 'format' => 'D, Y-m-d H:i', + 'locales' => array(), + ); $formats[] = array( 'type' => 'medium', 'format' => 'F j, Y - H:i', diff --git a/includes/form.inc b/includes/form.inc index 130775f4..e749239e 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -1176,7 +1176,7 @@ function drupal_validate_form($form_id, &$form, &$form_state) { // If the session token was set by drupal_prepare_form(), ensure that it // matches the current user's session. This is duplicate to code in // form_builder() but left to protect any custom form handling code. - if (isset($form['#token'])) { + if (!empty($form['#token'])) { if (!drupal_valid_token($form_state['values']['form_token'], $form['#token']) || !empty($form_state['invalid_token'])) { _drupal_invalid_token_set_form_error(); // Stop here and don't run any further validation handlers, because they @@ -1837,7 +1837,7 @@ function form_builder($form_id, &$element, &$form_state) { // If the session token was set by drupal_prepare_form(), ensure that it // matches the current user's session. $form_state['invalid_token'] = FALSE; - if (isset($element['#token'])) { + if (!empty($element['#token'])) { if (empty($form_state['input']['form_token']) || !drupal_valid_token($form_state['input']['form_token'], $element['#token'])) { // Set an early form error to block certain input processing since that // opens the door for CSRF vulnerabilities. diff --git a/includes/menu.inc b/includes/menu.inc index 05ecac06..4664d27e 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -1606,6 +1606,7 @@ function _menu_tree_data(&$links, $parents, $depth) { * Implements template_preprocess_HOOK() for theme_menu_tree(). */ function template_preprocess_menu_tree(&$variables) { + $variables['#tree'] = $variables['tree']; $variables['tree'] = $variables['tree']['#children']; } @@ -2682,7 +2683,7 @@ function menu_link_load($mlid) { } /** - * Clears the cached cached data for a single named menu. + * Clears the cached data for a single named menu. */ function menu_cache_clear($menu_name = 'navigation') { $cache_cleared = &drupal_static(__FUNCTION__, array()); diff --git a/includes/stream_wrappers.inc b/includes/stream_wrappers.inc index 48829388..232ff143 100644 --- a/includes/stream_wrappers.inc +++ b/includes/stream_wrappers.inc @@ -133,7 +133,7 @@ interface DrupalStreamWrapperInterface extends StreamWrapperInterface { * @param $uri * A string containing the URI that should be used for this instance. */ - function setUri($uri); + public function setUri($uri); /** * Returns the stream resource URI. @@ -219,7 +219,6 @@ interface DrupalStreamWrapperInterface extends StreamWrapperInterface { public function dirname($uri = NULL); } - /** * Drupal stream wrapper base class for local files. * @@ -549,6 +548,155 @@ abstract class DrupalLocalStreamWrapper implements DrupalStreamWrapperInterface return fclose($this->handle); } + /** + * Sets metadata on the stream. + * + * WARNING: Do not call this method directly! It will be called internally by + * PHP itself when one of the following functions is called on a stream URL: + * + * @param string $uri + * A string containing the URI to the file to set metadata on. + * @param int $option + * One of: + * - STREAM_META_TOUCH: The method was called in response to touch(). + * - STREAM_META_OWNER_NAME: The method was called in response to chown() + * with string parameter. + * - STREAM_META_OWNER: The method was called in response to chown(). + * - STREAM_META_GROUP_NAME: The method was called in response to chgrp(). + * - STREAM_META_GROUP: The method was called in response to chgrp(). + * - STREAM_META_ACCESS: The method was called in response to chmod(). + * @param mixed $value + * If option is: + * - STREAM_META_TOUCH: Array consisting of two arguments of the touch() + * function. + * - STREAM_META_OWNER_NAME or STREAM_META_GROUP_NAME: The name of the owner + * user/group as string. + * - STREAM_META_OWNER or STREAM_META_GROUP: The value of the owner + * user/group as integer. + * - STREAM_META_ACCESS: The argument of the chmod() as integer. + * + * @return bool + * Returns TRUE on success or FALSE on failure. If $option is not + * implemented, FALSE should be returned. + * + * @see touch() + * @see chmod() + * @see chown() + * @see chgrp() + * @link http://php.net/manual/streamwrapper.stream-metadata.php + */ + public function stream_metadata($uri, $option, $value) { + $target = $this->getLocalPath($uri); + $return = FALSE; + switch ($option) { + case STREAM_META_TOUCH: + if (!empty($value)) { + $return = touch($target, $value[0], $value[1]); + } + else { + $return = touch($target); + } + break; + + case STREAM_META_OWNER_NAME: + case STREAM_META_OWNER: + $return = chown($target, $value); + break; + + case STREAM_META_GROUP_NAME: + case STREAM_META_GROUP: + $return = chgrp($target, $value); + break; + + case STREAM_META_ACCESS: + $return = chmod($target, $value); + break; + } + if ($return) { + // For convenience clear the file status cache of the underlying file, + // since metadata operations are often followed by file status checks. + clearstatcache(TRUE, $target); + } + return $return; + } + + /** + * Truncate stream. + * + * Will respond to truncation; e.g., through ftruncate(). + * + * @param int $new_size + * The new size. + * + * @return bool + * TRUE on success, FALSE otherwise. + */ + public function stream_truncate($new_size) { + return ftruncate($this->handle, $new_size); + } + + /** + * Retrieve the underlying stream resource. + * + * This method is called in response to stream_select(). + * + * @param int $cast_as + * Can be STREAM_CAST_FOR_SELECT when stream_select() is calling + * stream_cast() or STREAM_CAST_AS_STREAM when stream_cast() is called for + * other uses. + * + * @return resource|false + * The underlying stream resource or FALSE if stream_select() is not + * supported. + * + * @see stream_select() + * @link http://php.net/manual/streamwrapper.stream-cast.php + */ + public function stream_cast($cast_as) { + return $this->handle ? $this->handle : FALSE; + } + + /** + * Change stream options. + * + * This method is called to set options on the stream. + * + * Since Windows systems do not allow it and it is not needed for most use + * cases anyway, this method is not supported on local files and will trigger + * an error and return false. If needed, custom subclasses can provide + * OS-specific implementations for advanced use cases. + * + * @param int $option + * One of: + * - STREAM_OPTION_BLOCKING: The method was called in response to + * stream_set_blocking(). + * - STREAM_OPTION_READ_TIMEOUT: The method was called in response to + * stream_set_timeout(). + * - STREAM_OPTION_WRITE_BUFFER: The method was called in response to + * stream_set_write_buffer(). + * @param int $arg1 + * If option is: + * - STREAM_OPTION_BLOCKING: The requested blocking mode: + * - 1 means blocking. + * - 0 means not blocking. + * - STREAM_OPTION_READ_TIMEOUT: The timeout in seconds. + * - STREAM_OPTION_WRITE_BUFFER: The buffer mode, STREAM_BUFFER_NONE or + * STREAM_BUFFER_FULL. + * @param int $arg2 + * If option is: + * - STREAM_OPTION_BLOCKING: This option is not set. + * - STREAM_OPTION_READ_TIMEOUT: The timeout in microseconds. + * - STREAM_OPTION_WRITE_BUFFER: The requested buffer size. + * + * @return bool + * TRUE on success, FALSE otherwise. If $option is not implemented, FALSE + * should be returned. + */ + public function stream_set_option($option, $arg1, $arg2) { + trigger_error('stream_set_option() not supported for local file based stream wrappers', E_USER_WARNING); + return FALSE; + } + /** * Support for unlink(). * diff --git a/modules/aggregator/aggregator.info b/modules/aggregator/aggregator.info index b7582352..67ebdc00 100644 --- a/modules/aggregator/aggregator.info +++ b/modules/aggregator/aggregator.info @@ -7,8 +7,8 @@ files[] = aggregator.test configure = admin/config/services/aggregator/settings stylesheets[all][] = aggregator.css -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/aggregator/tests/aggregator_test.info b/modules/aggregator/tests/aggregator_test.info index 8418e88b..49838960 100644 --- a/modules/aggregator/tests/aggregator_test.info +++ b/modules/aggregator/tests/aggregator_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/block/block.info b/modules/block/block.info index 8ecff8ad..9e47f1ff 100644 --- a/modules/block/block.info +++ b/modules/block/block.info @@ -6,8 +6,8 @@ core = 7.x files[] = block.test configure = admin/structure/block -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/block/tests/block_test.info b/modules/block/tests/block_test.info index 514b33b1..ef1f7138 100644 --- a/modules/block/tests/block_test.info +++ b/modules/block/tests/block_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/block/tests/themes/block_test_theme/block_test_theme.info b/modules/block/tests/themes/block_test_theme/block_test_theme.info index 8e6826cb..be82747e 100644 --- a/modules/block/tests/themes/block_test_theme/block_test_theme.info +++ b/modules/block/tests/themes/block_test_theme/block_test_theme.info @@ -13,8 +13,8 @@ regions[footer] = Footer regions[highlighted] = Highlighted regions[help] = Help -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/blog/blog.info b/modules/blog/blog.info index a3989510..0302f22f 100644 --- a/modules/blog/blog.info +++ b/modules/blog/blog.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x files[] = blog.test -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/book/book.info b/modules/book/book.info index 9575ff64..396bd669 100644 --- a/modules/book/book.info +++ b/modules/book/book.info @@ -7,8 +7,8 @@ files[] = book.test configure = admin/content/book/settings stylesheets[all][] = book.css -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/color/color.info b/modules/color/color.info index 3ecf3752..2b588106 100644 --- a/modules/color/color.info +++ b/modules/color/color.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x files[] = color.test -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/color/color.test b/modules/color/color.test index 09043250..f29c0c26 100644 --- a/modules/color/color.test +++ b/modules/color/color.test @@ -122,7 +122,7 @@ class ColorTestCase extends DrupalWebTestCase { $edit['palette[bg]'] = $color; $this->drupalPost($settings_path, $edit, t('Save configuration')); - if($is_valid) { + if ($is_valid) { $this->assertText('The configuration options have been saved.'); } else { diff --git a/modules/comment/comment.info b/modules/comment/comment.info index 749da0d0..69885dbb 100644 --- a/modules/comment/comment.info +++ b/modules/comment/comment.info @@ -9,8 +9,8 @@ files[] = comment.test configure = admin/content/comment stylesheets[all][] = comment.css -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/comment/comment.test b/modules/comment/comment.test index 534b2c13..e087a717 100644 --- a/modules/comment/comment.test +++ b/modules/comment/comment.test @@ -11,7 +11,13 @@ class CommentHelperCase extends DrupalWebTestCase { protected $node; function setUp() { - parent::setUp('comment', 'search'); + $modules = func_get_args(); + if (isset($modules[0]) && is_array($modules[0])) { + $modules = $modules[0]; + } + $modules[] = 'comment'; + parent::setUp($modules); + // Create users and test node. $this->admin_user = $this->drupalCreateUser(array('administer content types', 'administer comments', 'administer blocks', 'administer actions', 'administer fields')); $this->web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'create article content', 'edit own comments')); @@ -1490,7 +1496,7 @@ class CommentNodeAccessTest extends CommentHelperCase { } function setUp() { - DrupalWebTestCase::setUp('comment', 'search', 'node_access_test'); + parent::setUp('search', 'node_access_test'); node_access_rebuild(); // Create users and test node. diff --git a/modules/contact/contact.info b/modules/contact/contact.info index 6279557a..464c2246 100644 --- a/modules/contact/contact.info +++ b/modules/contact/contact.info @@ -6,8 +6,8 @@ core = 7.x files[] = contact.test configure = admin/structure/contact -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/contextual/contextual.info b/modules/contextual/contextual.info index 3a670c0c..b57e9f67 100644 --- a/modules/contextual/contextual.info +++ b/modules/contextual/contextual.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x files[] = contextual.test -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/dashboard/dashboard.info b/modules/dashboard/dashboard.info index ceb38247..d17a9740 100644 --- a/modules/dashboard/dashboard.info +++ b/modules/dashboard/dashboard.info @@ -7,8 +7,8 @@ files[] = dashboard.test dependencies[] = block configure = admin/dashboard/customize -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/dblog/dblog.admin.inc b/modules/dblog/dblog.admin.inc index 0d5780cb..f8a00c26 100644 --- a/modules/dblog/dblog.admin.inc +++ b/modules/dblog/dblog.admin.inc @@ -420,6 +420,6 @@ function dblog_clear_log_form($form) { */ function dblog_clear_log_submit() { $_SESSION['dblog_overview_filter'] = array(); - db_delete('watchdog')->execute(); + db_truncate('watchdog')->execute(); drupal_set_message(t('Database log cleared.')); } diff --git a/modules/dblog/dblog.info b/modules/dblog/dblog.info index e9edca59..89b66c11 100644 --- a/modules/dblog/dblog.info +++ b/modules/dblog/dblog.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x files[] = dblog.test -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/field/field.info b/modules/field/field.info index 2157d242..d19c29d1 100644 --- a/modules/field/field.info +++ b/modules/field/field.info @@ -11,8 +11,8 @@ dependencies[] = field_sql_storage required = TRUE stylesheets[all][] = theme/field.css -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/field/modules/field_sql_storage/field_sql_storage.info b/modules/field/modules/field_sql_storage/field_sql_storage.info index 13bf2640..a35372a8 100644 --- a/modules/field/modules/field_sql_storage/field_sql_storage.info +++ b/modules/field/modules/field_sql_storage/field_sql_storage.info @@ -7,8 +7,8 @@ dependencies[] = field files[] = field_sql_storage.test required = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/field/modules/list/list.info b/modules/field/modules/list/list.info index 658433a4..0cd4939c 100644 --- a/modules/field/modules/list/list.info +++ b/modules/field/modules/list/list.info @@ -7,8 +7,8 @@ dependencies[] = field dependencies[] = options files[] = tests/list.test -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/field/modules/list/tests/list_test.info b/modules/field/modules/list/tests/list_test.info index a15b62b1..4bd2dae2 100644 --- a/modules/field/modules/list/tests/list_test.info +++ b/modules/field/modules/list/tests/list_test.info @@ -5,8 +5,8 @@ package = Testing version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/field/modules/number/number.info b/modules/field/modules/number/number.info index 104e32a2..d3c995e5 100644 --- a/modules/field/modules/number/number.info +++ b/modules/field/modules/number/number.info @@ -6,8 +6,8 @@ core = 7.x dependencies[] = field files[] = number.test -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/field/modules/number/number.module b/modules/field/modules/number/number.module index 0b8660dc..2538bdd1 100644 --- a/modules/field/modules/number/number.module +++ b/modules/field/modules/number/number.module @@ -164,6 +164,15 @@ function number_field_presave($entity_type, $entity, $field, $instance, $langcod } } } + if ($field['type'] == 'number_float') { + // Remove the decimal point from float values with decimal + // point but no decimal numbers. + foreach ($items as $delta => $item) { + if (isset($item['value'])) { + $items[$delta]['value'] = floatval($item['value']); + } + } + } } /** diff --git a/modules/field/modules/number/number.test b/modules/field/modules/number/number.test index c88b4c18..839da36c 100644 --- a/modules/field/modules/number/number.test +++ b/modules/field/modules/number/number.test @@ -152,4 +152,50 @@ class NumberFieldTestCase extends DrupalWebTestCase { ); $this->drupalPost(NULL, $edit, t('Save')); } + + /** + * Test number_float field. + */ + function testNumberFloatField() { + $this->field = array( + 'field_name' => drupal_strtolower($this->randomName()), + 'type' => 'number_float', + 'settings' => array( + 'precision' => 8, 'scale' => 4, 'decimal_separator' => '.', + ) + ); + field_create_field($this->field); + $this->instance = array( + 'field_name' => $this->field['field_name'], + 'entity_type' => 'test_entity', + 'bundle' => 'test_bundle', + 'widget' => array( + 'type' => 'number', + ), + 'display' => array( + 'default' => array( + 'type' => 'number_float', + ), + ), + ); + field_create_instance($this->instance); + + $langcode = LANGUAGE_NONE; + $value = array( + '9.' => '9', + '.' => '0', + '123.55' => '123.55', + '.55' => '0.55', + '-0.55' => '-0.55', + ); + foreach($value as $key => $value) { + $edit = array( + "{$this->field['field_name']}[$langcode][0][value]" => $key, + ); + $this->drupalPost('test-entity/add/test-bundle', $edit, t('Save')); + $this->assertNoText("PDOException"); + $this->assertRaw($value, 'Correct value is displayed.'); + } + } + } diff --git a/modules/field/modules/options/options.info b/modules/field/modules/options/options.info index d3198a3a..d395377a 100644 --- a/modules/field/modules/options/options.info +++ b/modules/field/modules/options/options.info @@ -6,8 +6,8 @@ core = 7.x dependencies[] = field files[] = options.test -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/field/modules/options/options.test b/modules/field/modules/options/options.test index 1cbb3854..321c2a4b 100644 --- a/modules/field/modules/options/options.test +++ b/modules/field/modules/options/options.test @@ -23,8 +23,15 @@ class OptionsWidgetsTestCase extends FieldTestCase { 'type' => 'list_integer', 'cardinality' => 1, 'settings' => array( - // Make sure that 0 works as an option. - 'allowed_values' => array(0 => 'Zero', 1 => 'One', 2 => 'Some & unescaped markup', 3 => 'Some HTML encoded markup with < & >'), + 'allowed_values' => array( + // Make sure that 0 works as an option. + 0 => 'Zero', + 1 => 'One', + // Make sure that option text is properly sanitized. + 2 => 'Some & unescaped markup', + // Make sure that HTML entities in option text are not double-encoded. + 3 => 'Some HTML encoded markup with < & >', + ), ), ); $this->card_1 = field_create_field($this->card_1); @@ -35,8 +42,13 @@ class OptionsWidgetsTestCase extends FieldTestCase { 'type' => 'list_integer', 'cardinality' => 2, 'settings' => array( - // Make sure that 0 works as an option. - 'allowed_values' => array(0 => 'Zero', 1 => 'One', 2 => 'Some & unescaped markup'), + 'allowed_values' => array( + // Make sure that 0 works as an option. + 0 => 'Zero', + 1 => 'One', + // Make sure that option text is properly sanitized. + 2 => 'Some & unescaped markup', + ), ), ); $this->card_2 = field_create_field($this->card_2); @@ -47,8 +59,12 @@ class OptionsWidgetsTestCase extends FieldTestCase { 'type' => 'list_boolean', 'cardinality' => 1, 'settings' => array( - // Make sure that 0 works as a 'on' value'. - 'allowed_values' => array(1 => 'Zero', 0 => 'Some & unescaped markup'), + 'allowed_values' => array( + // Make sure that 1 works as a 'on' value'. + 1 => 'Zero', + // Make sure that option text is properly sanitized. + 0 => 'Some & unescaped markup', + ), ), ); $this->bool = field_create_field($this->bool); diff --git a/modules/field/modules/text/text.info b/modules/field/modules/text/text.info index 54cc28d6..678bdab3 100644 --- a/modules/field/modules/text/text.info +++ b/modules/field/modules/text/text.info @@ -7,8 +7,8 @@ dependencies[] = field files[] = text.test required = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/field/tests/field_test.info b/modules/field/tests/field_test.info index 7c0e5b7d..07eed538 100644 --- a/modules/field/tests/field_test.info +++ b/modules/field/tests/field_test.info @@ -6,8 +6,8 @@ files[] = field_test.entity.inc version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/field_ui/field_ui.info b/modules/field_ui/field_ui.info index 5df082c9..7f2c4be3 100644 --- a/modules/field_ui/field_ui.info +++ b/modules/field_ui/field_ui.info @@ -6,8 +6,8 @@ core = 7.x dependencies[] = field files[] = field_ui.test -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/file/file.info b/modules/file/file.info index 4bf08121..d15ad9e2 100644 --- a/modules/file/file.info +++ b/modules/file/file.info @@ -6,8 +6,8 @@ core = 7.x dependencies[] = field files[] = tests/file.test -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/file/file.module b/modules/file/file.module index bf7b07d8..18ed2654 100644 --- a/modules/file/file.module +++ b/modules/file/file.module @@ -280,7 +280,8 @@ function file_ajax_upload() { $form['#suffix'] .= ''; } - $output = theme('status_messages') . drupal_render($form); + $form['#prefix'] .= theme('status_messages'); + $output = drupal_render($form); $js = drupal_add_js(); $settings = call_user_func_array('array_merge_recursive', $js['settings']['data']); diff --git a/modules/file/tests/file.test b/modules/file/tests/file.test index 1510a697..41e97cdf 100644 --- a/modules/file/tests/file.test +++ b/modules/file/tests/file.test @@ -596,6 +596,56 @@ class FileFieldWidgetTestCase extends FileFieldTestCase { $this->doTestTemporaryFileRemovalExploit($victim_uid, $attacker_uid); } + /** + * Tests validation with the Upload button. + */ + function testWidgetValidation() { + $type_name = 'article'; + $field_name = strtolower($this->randomName()); + $this->createFileField($field_name, $type_name); + $this->updateFileField($field_name, $type_name, array('file_extensions' => 'txt')); + + foreach (array('nojs', 'js') as $type) { + // Create node and prepare files for upload. + $node = $this->drupalCreateNode(array('type' => 'article')); + $nid = $node->nid; + $this->drupalGet("node/$nid/edit"); + $test_file_text = $this->getTestFile('text'); + $test_file_image = $this->getTestFile('image'); + $field = field_info_field($field_name); + $name = 'files[' . $field_name . '_' . LANGUAGE_NONE . '_0]'; + + // Upload file with incorrect extension, check for validation error. + $edit[$name] = drupal_realpath($test_file_image->uri); + switch ($type) { + case 'nojs': + $this->drupalPost(NULL, $edit, t('Upload')); + break; + + case 'js': + $button = $this->xpath('//input[@type="submit" and @value="' . t('Upload') . '"]'); + $this->drupalPostAJAX(NULL, $edit, array((string) $button[0]['name'] => (string) $button[0]['value'])); + break; + } + $error_message = t('Only files with the following extensions are allowed: %files-allowed.', array('%files-allowed' => 'txt')); + $this->assertRaw($error_message, t('Validation error when file with wrong extension uploaded (JSMode=%type).', array('%type' => $type))); + + // Upload file with correct extension, check that error message is removed. + $edit[$name] = drupal_realpath($test_file_text->uri); + switch ($type) { + case 'nojs': + $this->drupalPost(NULL, $edit, t('Upload')); + break; + + case 'js': + $button = $this->xpath('//input[@type="submit" and @value="' . t('Upload') . '"]'); + $this->drupalPostAJAX(NULL, $edit, array((string) $button[0]['name'] => (string) $button[0]['value'])); + break; + } + $this->assertNoRaw($error_message, t('Validation error removed when file with correct extension uploaded (JSMode=%type).', array('%type' => $type))); + } + } + /** * Helper for testing exploiting the temporary file removal using fid. * diff --git a/modules/file/tests/file_module_test.info b/modules/file/tests/file_module_test.info index a6ad129a..cd04aba8 100644 --- a/modules/file/tests/file_module_test.info +++ b/modules/file/tests/file_module_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/filter/filter.info b/modules/filter/filter.info index a513f5fc..b2ddb26c 100644 --- a/modules/filter/filter.info +++ b/modules/filter/filter.info @@ -7,8 +7,8 @@ files[] = filter.test required = TRUE configure = admin/config/content/formats -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/filter/filter.module b/modules/filter/filter.module index c710ee70..e9fd01d3 100644 --- a/modules/filter/filter.module +++ b/modules/filter/filter.module @@ -1638,7 +1638,7 @@ function _filter_url_escape_comments($match, $escape = NULL) { // Replace all HTML coments with a '' placeholder. if ($mode) { $content = $match[1]; - $hash = md5($content); + $hash = hash('sha256', $content); $comments[$hash] = $content; return ""; } diff --git a/modules/forum/forum.info b/modules/forum/forum.info index 74cc2d03..bbc9012c 100644 --- a/modules/forum/forum.info +++ b/modules/forum/forum.info @@ -9,8 +9,8 @@ files[] = forum.test configure = admin/structure/forum stylesheets[all][] = forum.css -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/help/help.info b/modules/help/help.info index 062b30e6..4812b883 100644 --- a/modules/help/help.info +++ b/modules/help/help.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x files[] = help.test -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/image/image.info b/modules/image/image.info index 47fb5a5a..376d4611 100644 --- a/modules/image/image.info +++ b/modules/image/image.info @@ -7,8 +7,8 @@ dependencies[] = file files[] = image.test configure = admin/config/media/image-styles -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/image/tests/image_module_test.info b/modules/image/tests/image_module_test.info index f9f3f484..b18449ce 100644 --- a/modules/image/tests/image_module_test.info +++ b/modules/image/tests/image_module_test.info @@ -6,8 +6,8 @@ core = 7.x files[] = image_module_test.module hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/locale/locale.info b/modules/locale/locale.info index 520d4ecd..bb5cc735 100644 --- a/modules/locale/locale.info +++ b/modules/locale/locale.info @@ -6,8 +6,8 @@ core = 7.x files[] = locale.test configure = admin/config/regional/language -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/locale/tests/locale_test.info b/modules/locale/tests/locale_test.info index b51de9f3..ea78ef1b 100644 --- a/modules/locale/tests/locale_test.info +++ b/modules/locale/tests/locale_test.info @@ -5,8 +5,8 @@ package = Testing version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/menu/menu.info b/modules/menu/menu.info index 9c6a8d19..9e2dfe55 100644 --- a/modules/menu/menu.info +++ b/modules/menu/menu.info @@ -6,8 +6,8 @@ core = 7.x files[] = menu.test configure = admin/structure/menu -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/node/node.info b/modules/node/node.info index a8c61fb3..e37828c2 100644 --- a/modules/node/node.info +++ b/modules/node/node.info @@ -9,8 +9,8 @@ required = TRUE configure = admin/structure/types stylesheets[all][] = node.css -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/node/tests/node_access_test.info b/modules/node/tests/node_access_test.info index 7ba4455b..21e4f41c 100644 --- a/modules/node/tests/node_access_test.info +++ b/modules/node/tests/node_access_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/node/tests/node_test.info b/modules/node/tests/node_test.info index 67de1b36..3047c17d 100644 --- a/modules/node/tests/node_test.info +++ b/modules/node/tests/node_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/node/tests/node_test_exception.info b/modules/node/tests/node_test_exception.info index 387ccde2..55928729 100644 --- a/modules/node/tests/node_test_exception.info +++ b/modules/node/tests/node_test_exception.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/openid/openid.info b/modules/openid/openid.info index f1d0a5a5..4444ac81 100644 --- a/modules/openid/openid.info +++ b/modules/openid/openid.info @@ -5,8 +5,8 @@ package = Core core = 7.x files[] = openid.test -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/openid/tests/openid_test.info b/modules/openid/tests/openid_test.info index 48520267..a69c60ad 100644 --- a/modules/openid/tests/openid_test.info +++ b/modules/openid/tests/openid_test.info @@ -6,8 +6,8 @@ core = 7.x dependencies[] = openid hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/overlay/overlay.info b/modules/overlay/overlay.info index dd1f3f4b..8f893e5b 100644 --- a/modules/overlay/overlay.info +++ b/modules/overlay/overlay.info @@ -4,8 +4,8 @@ package = Core version = VERSION core = 7.x -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/path/path.info b/modules/path/path.info index f17fdaf1..9e6c3598 100644 --- a/modules/path/path.info +++ b/modules/path/path.info @@ -6,8 +6,8 @@ core = 7.x files[] = path.test configure = admin/config/search/path -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/php/php.info b/modules/php/php.info index 0247be60..f008c113 100644 --- a/modules/php/php.info +++ b/modules/php/php.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x files[] = php.test -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/poll/poll.info b/modules/poll/poll.info index c4734261..9cfaf544 100644 --- a/modules/poll/poll.info +++ b/modules/poll/poll.info @@ -6,8 +6,8 @@ core = 7.x files[] = poll.test stylesheets[all][] = poll.css -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/profile/profile.info b/modules/profile/profile.info index dfa174c5..7ea0b262 100644 --- a/modules/profile/profile.info +++ b/modules/profile/profile.info @@ -11,8 +11,8 @@ configure = admin/config/people/profile ; See user_system_info_alter(). hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/rdf/rdf.info b/modules/rdf/rdf.info index 44f04bd0..85e4cd29 100644 --- a/modules/rdf/rdf.info +++ b/modules/rdf/rdf.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x files[] = rdf.test -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/rdf/tests/rdf_test.info b/modules/rdf/tests/rdf_test.info index 8195c999..33ca1c44 100644 --- a/modules/rdf/tests/rdf_test.info +++ b/modules/rdf/tests/rdf_test.info @@ -6,8 +6,8 @@ core = 7.x hidden = TRUE dependencies[] = blog -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/search/search.admin.inc b/modules/search/search.admin.inc index a609485a..a37d37b9 100644 --- a/modules/search/search.admin.inc +++ b/modules/search/search.admin.inc @@ -125,6 +125,16 @@ function search_admin_settings($form) { '#options' => $module_options, '#description' => t('Choose which search module is the default.') ); + $form['logging'] = array( + '#type' => 'fieldset', + '#title' => t('Logging') + ); + $form['logging']['search_logging'] = array( + '#type' => 'checkbox', + '#title' => t('Log searches'), + '#default_value' => variable_get('search_logging', 1), + '#description' => t('If checked, all searches will be logged. Uncheck to skip logging. Logging may affect performance.'), + ); $form['#validate'][] = 'search_admin_settings_validate'; $form['#submit'][] = 'search_admin_settings_submit'; diff --git a/modules/search/search.info b/modules/search/search.info index a092ea9e..c8844f25 100644 --- a/modules/search/search.info +++ b/modules/search/search.info @@ -8,8 +8,8 @@ files[] = search.test configure = admin/config/search/settings stylesheets[all][] = search.css -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/search/search.install b/modules/search/search.install index f0113b3f..c91283c4 100644 --- a/modules/search/search.install +++ b/modules/search/search.install @@ -12,6 +12,7 @@ function search_uninstall() { variable_del('minimum_word_size'); variable_del('overlap_cjk'); variable_del('search_cron_limit'); + variable_del('search_logging'); } /** diff --git a/modules/search/search.pages.inc b/modules/search/search.pages.inc index 2123dd75..b24de8ed 100644 --- a/modules/search/search.pages.inc +++ b/modules/search/search.pages.inc @@ -57,9 +57,10 @@ function search_view($module = NULL, $keys = '') { } // Only search if there are keywords or non-empty conditions. if ($keys || !empty($conditions)) { - // Log the search keys. - watchdog('search', 'Searched %type for %keys.', array('%keys' => $keys, '%type' => $info['title']), WATCHDOG_NOTICE, l(t('results'), 'search/' . $info['path'] . '/' . $keys)); - + if (variable_get('search_logging', TRUE)) { + // Log the search keys. + watchdog('search', 'Searched %type for %keys.', array('%keys' => $keys, '%type' => $info['title']), WATCHDOG_NOTICE, l(t('results'), 'search/' . $info['path'] . '/' . $keys)); + } // Collect the search results. $results = search_data($keys, $info['module'], $conditions); } diff --git a/modules/search/search.test b/modules/search/search.test index 913d1989..d3a60b49 100644 --- a/modules/search/search.test +++ b/modules/search/search.test @@ -1453,7 +1453,7 @@ class SearchConfigSettingsForm extends DrupalWebTestCase { parent::setUp('search', 'search_extra_type'); // Login as a user that can create and search content. - $this->search_user = $this->drupalCreateUser(array('search content', 'administer search', 'administer nodes', 'bypass node access', 'access user profiles', 'administer users', 'administer blocks')); + $this->search_user = $this->drupalCreateUser(array('search content', 'administer search', 'administer nodes', 'bypass node access', 'access user profiles', 'administer users', 'administer blocks', 'access site reports')); $this->drupalLogin($this->search_user); // Add a single piece of content and index it. @@ -1502,6 +1502,19 @@ class SearchConfigSettingsForm extends DrupalWebTestCase { ); $this->drupalPost('admin/config/search/settings', $edit, t('Save configuration')); $this->assertNoText(t('The configuration options have been saved.'), 'Form does not save with an invalid word length.'); + + // Test logging setting. It should be on by default. + $text = $this->randomName(5); + $this->drupalPost('search/node', array('keys' => $text), t('Search')); + $this->drupalGet('admin/reports/dblog'); + $this->assertLink('Searched Content for ' . $text . '.', 0, 'Search was logged'); + + // Turn off logging. + variable_set('search_logging', FALSE); + $text = $this->randomName(5); + $this->drupalPost('search/node', array('keys' => $text), t('Search')); + $this->drupalGet('admin/reports/dblog'); + $this->assertNoLink('Searched Content for ' . $text . '.', 'Search was not logged'); } /** diff --git a/modules/search/tests/search_embedded_form.info b/modules/search/tests/search_embedded_form.info index 6423cef5..0618b032 100644 --- a/modules/search/tests/search_embedded_form.info +++ b/modules/search/tests/search_embedded_form.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/search/tests/search_extra_type.info b/modules/search/tests/search_extra_type.info index 0ae00a58..bc911a48 100644 --- a/modules/search/tests/search_extra_type.info +++ b/modules/search/tests/search_extra_type.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/search/tests/search_node_tags.info b/modules/search/tests/search_node_tags.info index b2cc66ab..138fda4b 100644 --- a/modules/search/tests/search_node_tags.info +++ b/modules/search/tests/search_node_tags.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/shortcut/shortcut.info b/modules/shortcut/shortcut.info index c12f11e4..e23210ac 100644 --- a/modules/shortcut/shortcut.info +++ b/modules/shortcut/shortcut.info @@ -6,8 +6,8 @@ core = 7.x files[] = shortcut.test configure = admin/config/user-interface/shortcut -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index 08452f31..51407991 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -1374,10 +1374,11 @@ class DrupalWebTestCase extends DrupalTestCase { * @see DrupalWebTestCase::tearDown() */ protected function prepareEnvironment() { - global $user, $language, $conf; + global $user, $language, $language_url, $conf; // Store necessary current values before switching to prefixed database. $this->originalLanguage = $language; + $this->originalLanguageUrl = $language_url; $this->originalLanguageDefault = variable_get('language_default'); $this->originalFileDirectory = variable_get('file_public_path', conf_path() . '/files'); $this->originalProfile = drupal_get_profile(); @@ -1387,7 +1388,7 @@ class DrupalWebTestCase extends DrupalTestCase { // Set to English to prevent exceptions from utf8_truncate() from t() // during install if the current language is not 'en'. // The following array/object conversion is copied from language_default(). - $language = (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => ''); + $language_url = $language = (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => ''); // Save and clean the shutdown callbacks array because it is static cached // and will be changed by the test run. Otherwise it will contain callbacks @@ -1445,7 +1446,7 @@ class DrupalWebTestCase extends DrupalTestCase { * @see DrupalWebTestCase::prepareEnvironment() */ protected function setUp() { - global $user, $language, $conf; + global $user, $language, $language_url, $conf; // Create the database prefix for this test. $this->prepareDatabasePrefix(); @@ -1542,7 +1543,7 @@ class DrupalWebTestCase extends DrupalTestCase { // Set up English language. unset($conf['language_default']); - $language = language_default(); + $language_url = $language = language_default(); // Use the test mail class instead of the default mail handler class. variable_set('mail_system', array('default-system' => 'TestingMailSystem')); @@ -1636,7 +1637,7 @@ class DrupalWebTestCase extends DrupalTestCase { * and reset the database prefix. */ protected function tearDown() { - global $user, $language; + global $user, $language, $language_url; // In case a fatal error occurred that was not in the test process read the // log to pick up any fatal errors. @@ -1701,6 +1702,7 @@ class DrupalWebTestCase extends DrupalTestCase { // Reset language. $language = $this->originalLanguage; + $language_url = $this->originalLanguageUrl; if ($this->originalLanguageDefault) { $GLOBALS['conf']['language_default'] = $this->originalLanguageDefault; } diff --git a/modules/simpletest/simpletest.info b/modules/simpletest/simpletest.info index d613ff2d..b9468ff1 100644 --- a/modules/simpletest/simpletest.info +++ b/modules/simpletest/simpletest.info @@ -57,8 +57,8 @@ files[] = tests/upgrade/update.trigger.test files[] = tests/upgrade/update.field.test files[] = tests/upgrade/update.user.test -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/actions_loop_test.info b/modules/simpletest/tests/actions_loop_test.info index 71cd14f3..d9460ea4 100644 --- a/modules/simpletest/tests/actions_loop_test.info +++ b/modules/simpletest/tests/actions_loop_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/ajax_forms_test.info b/modules/simpletest/tests/ajax_forms_test.info index c9d9cb6d..2c2e56a8 100644 --- a/modules/simpletest/tests/ajax_forms_test.info +++ b/modules/simpletest/tests/ajax_forms_test.info @@ -5,8 +5,8 @@ package = Testing version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/ajax_test.info b/modules/simpletest/tests/ajax_test.info index f572a005..da8f4a73 100644 --- a/modules/simpletest/tests/ajax_test.info +++ b/modules/simpletest/tests/ajax_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/batch_test.info b/modules/simpletest/tests/batch_test.info index dc2aae56..f768254e 100644 --- a/modules/simpletest/tests/batch_test.info +++ b/modules/simpletest/tests/batch_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/boot_test_1.info b/modules/simpletest/tests/boot_test_1.info index 85a5ea65..f424504c 100644 --- a/modules/simpletest/tests/boot_test_1.info +++ b/modules/simpletest/tests/boot_test_1.info @@ -5,8 +5,8 @@ package = Testing version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/boot_test_2.info b/modules/simpletest/tests/boot_test_2.info index 0bc815c7..83b05cb3 100644 --- a/modules/simpletest/tests/boot_test_2.info +++ b/modules/simpletest/tests/boot_test_2.info @@ -5,8 +5,8 @@ package = Testing version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/common_test.info b/modules/simpletest/tests/common_test.info index 7d466800..7ed1bcb7 100644 --- a/modules/simpletest/tests/common_test.info +++ b/modules/simpletest/tests/common_test.info @@ -7,8 +7,8 @@ stylesheets[all][] = common_test.css stylesheets[print][] = common_test.print.css hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/common_test_cron_helper.info b/modules/simpletest/tests/common_test_cron_helper.info index 55dbd67a..d64b41b0 100644 --- a/modules/simpletest/tests/common_test_cron_helper.info +++ b/modules/simpletest/tests/common_test_cron_helper.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/database_test.info b/modules/simpletest/tests/database_test.info index 0e31a226..44666698 100644 --- a/modules/simpletest/tests/database_test.info +++ b/modules/simpletest/tests/database_test.info @@ -5,8 +5,8 @@ package = Testing version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/drupal_autoload_test/drupal_autoload_test.info b/modules/simpletest/tests/drupal_autoload_test/drupal_autoload_test.info index 18044661..86a9bd68 100644 --- a/modules/simpletest/tests/drupal_autoload_test/drupal_autoload_test.info +++ b/modules/simpletest/tests/drupal_autoload_test/drupal_autoload_test.info @@ -7,8 +7,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info b/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info index 2b8c34c6..42049fcb 100644 --- a/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info +++ b/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info b/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info index ce9e1918..adec2c1e 100644 --- a/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info +++ b/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/entity_cache_test.info b/modules/simpletest/tests/entity_cache_test.info index eb38854e..29405ad9 100644 --- a/modules/simpletest/tests/entity_cache_test.info +++ b/modules/simpletest/tests/entity_cache_test.info @@ -6,8 +6,8 @@ core = 7.x dependencies[] = entity_cache_test_dependency hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/entity_cache_test_dependency.info b/modules/simpletest/tests/entity_cache_test_dependency.info index 0c433546..de7dc01a 100644 --- a/modules/simpletest/tests/entity_cache_test_dependency.info +++ b/modules/simpletest/tests/entity_cache_test_dependency.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/entity_crud_hook_test.info b/modules/simpletest/tests/entity_crud_hook_test.info index bb99125c..990f326f 100644 --- a/modules/simpletest/tests/entity_crud_hook_test.info +++ b/modules/simpletest/tests/entity_crud_hook_test.info @@ -5,8 +5,8 @@ package = Testing version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/entity_query_access_test.info b/modules/simpletest/tests/entity_query_access_test.info index 7ab70ddc..38432ab0 100644 --- a/modules/simpletest/tests/entity_query_access_test.info +++ b/modules/simpletest/tests/entity_query_access_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/error_test.info b/modules/simpletest/tests/error_test.info index d01fea3f..b308e5e7 100644 --- a/modules/simpletest/tests/error_test.info +++ b/modules/simpletest/tests/error_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/file_test.info b/modules/simpletest/tests/file_test.info index 6f8d7529..2ed5dc39 100644 --- a/modules/simpletest/tests/file_test.info +++ b/modules/simpletest/tests/file_test.info @@ -6,8 +6,8 @@ core = 7.x files[] = file_test.module hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/filter_test.info b/modules/simpletest/tests/filter_test.info index 315b0472..9b69cf85 100644 --- a/modules/simpletest/tests/filter_test.info +++ b/modules/simpletest/tests/filter_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/form.test b/modules/simpletest/tests/form.test index 6bf2d9e8..a441ceeb 100644 --- a/modules/simpletest/tests/form.test +++ b/modules/simpletest/tests/form.test @@ -690,6 +690,14 @@ class FormValidationTestCase extends DrupalWebTestCase { $this->assertText('The form has become outdated. Copy any unsaved work in the form below'); } + /** + * Tests that a form with a disabled CSRF token can be validated. + */ + function testDisabledToken() { + $this->drupalPost('form-test/validate-no-token', array(), 'Save'); + $this->assertText('The form_test_validate_no_token form has been submitted successfully.'); + } + /** * Tests partial form validation through #limit_validation_errors. */ diff --git a/modules/simpletest/tests/form_test.info b/modules/simpletest/tests/form_test.info index c2b36e78..deaecc67 100644 --- a/modules/simpletest/tests/form_test.info +++ b/modules/simpletest/tests/form_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/form_test.module b/modules/simpletest/tests/form_test.module index 4fd708f1..097e5884 100644 --- a/modules/simpletest/tests/form_test.module +++ b/modules/simpletest/tests/form_test.module @@ -37,6 +37,13 @@ function form_test_menu() { 'access callback' => TRUE, 'type' => MENU_CALLBACK, ); + $items['form-test/validate-no-token'] = array( + 'title' => 'Form validation without a CSRF token', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('form_test_validate_no_token'), + 'access callback' => TRUE, + 'type' => MENU_CALLBACK, + ); $items['form-test/limit-validation-errors'] = array( 'title' => 'Form validation with some error suppression', 'page callback' => 'drupal_get_form', @@ -454,6 +461,27 @@ function form_test_validate_required_form_no_title_submit($form, &$form_state) { drupal_set_message('The form_test_validate_required_form_no_title form was submitted successfully.'); } +/** + * Form builder for testing submission of a form without a CSRF token. + */ +function form_test_validate_no_token($form, &$form_state) { + $form['submit'] = array( + '#type' => 'submit', + '#value' => 'Save', + ); + + $form['#token'] = FALSE; + + return $form; +} + +/** + * Form submission handler for form_test_validate_no_token(). + */ +function form_test_validate_no_token_submit($form, &$form_state) { + drupal_set_message('The form_test_validate_no_token form has been submitted successfully.'); +} + /** * Builds a simple form with a button triggering partial validation. */ diff --git a/modules/simpletest/tests/image_test.info b/modules/simpletest/tests/image_test.info index a6efccb6..b4ac873a 100644 --- a/modules/simpletest/tests/image_test.info +++ b/modules/simpletest/tests/image_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/menu_test.info b/modules/simpletest/tests/menu_test.info index 92e04302..a55861a1 100644 --- a/modules/simpletest/tests/menu_test.info +++ b/modules/simpletest/tests/menu_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/module_test.info b/modules/simpletest/tests/module_test.info index d8eeddfb..8b0f74c9 100644 --- a/modules/simpletest/tests/module_test.info +++ b/modules/simpletest/tests/module_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/path_test.info b/modules/simpletest/tests/path_test.info index c2f07a0d..ef1a5525 100644 --- a/modules/simpletest/tests/path_test.info +++ b/modules/simpletest/tests/path_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/psr_0_test/psr_0_test.info b/modules/simpletest/tests/psr_0_test/psr_0_test.info index 3f0ce970..34f914f2 100644 --- a/modules/simpletest/tests/psr_0_test/psr_0_test.info +++ b/modules/simpletest/tests/psr_0_test/psr_0_test.info @@ -5,8 +5,8 @@ core = 7.x hidden = TRUE package = Testing -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/psr_4_test/psr_4_test.info b/modules/simpletest/tests/psr_4_test/psr_4_test.info index 53abc66f..0a64a28d 100644 --- a/modules/simpletest/tests/psr_4_test/psr_4_test.info +++ b/modules/simpletest/tests/psr_4_test/psr_4_test.info @@ -5,8 +5,8 @@ core = 7.x hidden = TRUE package = Testing -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/requirements1_test.info b/modules/simpletest/tests/requirements1_test.info index 6a3a6f8e..8909f690 100644 --- a/modules/simpletest/tests/requirements1_test.info +++ b/modules/simpletest/tests/requirements1_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/requirements2_test.info b/modules/simpletest/tests/requirements2_test.info index b9738f95..7b8630af 100644 --- a/modules/simpletest/tests/requirements2_test.info +++ b/modules/simpletest/tests/requirements2_test.info @@ -7,8 +7,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/session_test.info b/modules/simpletest/tests/session_test.info index 20b846cf..3d3f0183 100644 --- a/modules/simpletest/tests/session_test.info +++ b/modules/simpletest/tests/session_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/system_dependencies_test.info b/modules/simpletest/tests/system_dependencies_test.info index 1e74f9de..4a2891ad 100644 --- a/modules/simpletest/tests/system_dependencies_test.info +++ b/modules/simpletest/tests/system_dependencies_test.info @@ -6,8 +6,8 @@ core = 7.x hidden = TRUE dependencies[] = _missing_dependency -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.info b/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.info index d918475f..b46bf515 100644 --- a/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.info +++ b/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.info @@ -6,8 +6,8 @@ core = 7.x hidden = TRUE dependencies[] = system_incompatible_core_version_test -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/system_incompatible_core_version_test.info b/modules/simpletest/tests/system_incompatible_core_version_test.info index 1a8adc4a..8f7abbab 100644 --- a/modules/simpletest/tests/system_incompatible_core_version_test.info +++ b/modules/simpletest/tests/system_incompatible_core_version_test.info @@ -5,8 +5,8 @@ version = VERSION core = 5.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/system_incompatible_module_version_dependencies_test.info b/modules/simpletest/tests/system_incompatible_module_version_dependencies_test.info index b081db4e..93958c01 100644 --- a/modules/simpletest/tests/system_incompatible_module_version_dependencies_test.info +++ b/modules/simpletest/tests/system_incompatible_module_version_dependencies_test.info @@ -7,8 +7,8 @@ hidden = TRUE ; system_incompatible_module_version_test declares version 1.0 dependencies[] = system_incompatible_module_version_test (>2.0) -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/system_incompatible_module_version_test.info b/modules/simpletest/tests/system_incompatible_module_version_test.info index 80440861..282695cf 100644 --- a/modules/simpletest/tests/system_incompatible_module_version_test.info +++ b/modules/simpletest/tests/system_incompatible_module_version_test.info @@ -5,8 +5,8 @@ version = 1.0 core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/system_project_namespace_test.info b/modules/simpletest/tests/system_project_namespace_test.info index d248a099..e8fcc2e2 100644 --- a/modules/simpletest/tests/system_project_namespace_test.info +++ b/modules/simpletest/tests/system_project_namespace_test.info @@ -6,8 +6,8 @@ core = 7.x hidden = TRUE dependencies[] = drupal:filter -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/system_test.info b/modules/simpletest/tests/system_test.info index f99edb18..ec19e460 100644 --- a/modules/simpletest/tests/system_test.info +++ b/modules/simpletest/tests/system_test.info @@ -6,8 +6,8 @@ core = 7.x files[] = system_test.module hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/taxonomy_test.info b/modules/simpletest/tests/taxonomy_test.info index 1dffb58c..e18004c3 100644 --- a/modules/simpletest/tests/taxonomy_test.info +++ b/modules/simpletest/tests/taxonomy_test.info @@ -6,8 +6,8 @@ core = 7.x hidden = TRUE dependencies[] = taxonomy -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/theme.test b/modules/simpletest/tests/theme.test index f5ddfa9b..5f095bd5 100644 --- a/modules/simpletest/tests/theme.test +++ b/modules/simpletest/tests/theme.test @@ -646,3 +646,34 @@ class ThemeDebugMarkupTestCase extends DrupalWebTestCase { } } + +/** + * Tests module-provided theme engines. + */ +class ModuleProvidedThemeEngineTestCase extends DrupalWebTestCase { + + public static function getInfo() { + return array( + 'name' => 'Theme engine test', + 'description' => 'Tests module-provided theme engines.', + 'group' => 'Theme', + ); + } + + function setUp() { + parent::setUp('theme_test'); + theme_enable(array('test_theme', 'test_theme_nyan_cat')); + } + + /** + * Ensures that the module provided theme engine is found and used by core. + */ + function testEngineIsFoundAndWorking() { + variable_set('theme_default', 'test_theme_nyan_cat'); + variable_set('admin_theme', 'test_theme_nyan_cat'); + + $this->drupalGet('theme-test/engine-info-test'); + $this->assertText('Miaou'); + } + +} diff --git a/modules/simpletest/tests/theme_test.info b/modules/simpletest/tests/theme_test.info index ab7d0b70..485af1af 100644 --- a/modules/simpletest/tests/theme_test.info +++ b/modules/simpletest/tests/theme_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/theme_test.module b/modules/simpletest/tests/theme_test.module index 948d8175..1dbc3b95 100644 --- a/modules/simpletest/tests/theme_test.module +++ b/modules/simpletest/tests/theme_test.module @@ -27,9 +27,18 @@ function theme_test_system_theme_info() { $themes['test_theme'] = drupal_get_path('module', 'theme_test') . '/themes/test_theme/test_theme.info'; $themes['test_basetheme'] = drupal_get_path('module', 'theme_test') . '/themes/test_basetheme/test_basetheme.info'; $themes['test_subtheme'] = drupal_get_path('module', 'theme_test') . '/themes/test_subtheme/test_subtheme.info'; + $themes['test_theme_nyan_cat'] = drupal_get_path('module', 'theme_test') . '/themes/test_theme_nyan_cat/test_theme_nyan_cat.info'; return $themes; } +/** + * Implements hook_system_theme_engine_info(). + */ +function theme_test_system_theme_engine_info() { + $theme_engines['nyan_cat'] = drupal_get_path('module', 'theme_test') . '/themes/engines/nyan_cat/nyan_cat.engine'; + return $theme_engines; +} + /** * Implements hook_menu(). */ @@ -58,6 +67,12 @@ function theme_test_menu() { 'access callback' => TRUE, 'type' => MENU_CALLBACK, ); + $items['theme-test/engine-info-test'] = array( + 'description' => "Serves a simple page rendered using a Nyan Cat theme engine template.", + 'page callback' => '_theme_test_engine_info_test', + 'access callback' => TRUE, + 'type' => MENU_CALLBACK, + ); return $items; } @@ -139,6 +154,15 @@ function _theme_test_drupal_add_region_content() { return 'Hello'; } +/** + * Serves a simple page renderered using a Nyan Cat theme engine template. + */ +function _theme_test_engine_info_test() { + return array( + '#markup' => theme('theme_test_template_test'), + ); +} + /** * Theme function for testing theme('theme_test_foo'). */ diff --git a/modules/simpletest/tests/themes/engines/nyan_cat/nyan_cat.engine b/modules/simpletest/tests/themes/engines/nyan_cat/nyan_cat.engine new file mode 100644 index 00000000..1b8ffef8 --- /dev/null +++ b/modules/simpletest/tests/themes/engines/nyan_cat/nyan_cat.engine @@ -0,0 +1,53 @@ +filename) . '/template.theme'; + if (file_exists($file)) { + include_once DRUPAL_ROOT . '/' . $file; + } +} + +/** + * Implements hook_theme(). + */ +function nyan_cat_theme($existing, $type, $theme, $path) { + $templates = drupal_find_theme_functions($existing, array($theme)); + $templates += drupal_find_theme_templates($existing, '.nyan-cat.html', $path); + return $templates; +} + +/** + * Implements hook_extension(). + */ +function nyan_cat_extension() { + return '.nyan-cat.html'; +} + +/** + * Implements hook_render_template(). + * + * @param string $template_file + * The filename of the template to render. + * @param mixed[] $variables + * A keyed array of variables that will appear in the output. + * + * @return string + * The output generated by the template. + */ +function nyan_cat_render_template($template_file, $variables) { + $output = str_replace('div', 'nyancat', file_get_contents(DRUPAL_ROOT . '/' . $template_file)); + foreach ($variables as $key => $variable) { + if (strpos($output, '9' . $key) !== FALSE) { + $output = str_replace('9' . $key, $variable, $output); + } + } + return $output; +} diff --git a/modules/simpletest/tests/themes/test_basetheme/test_basetheme.info b/modules/simpletest/tests/themes/test_basetheme/test_basetheme.info index ea39d8e9..d5a40e18 100644 --- a/modules/simpletest/tests/themes/test_basetheme/test_basetheme.info +++ b/modules/simpletest/tests/themes/test_basetheme/test_basetheme.info @@ -6,8 +6,8 @@ hidden = TRUE settings[basetheme_only] = base theme value settings[subtheme_override] = base theme value -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/themes/test_subtheme/test_subtheme.info b/modules/simpletest/tests/themes/test_subtheme/test_subtheme.info index 60bb4e5c..9ed77625 100644 --- a/modules/simpletest/tests/themes/test_subtheme/test_subtheme.info +++ b/modules/simpletest/tests/themes/test_subtheme/test_subtheme.info @@ -6,8 +6,8 @@ hidden = TRUE settings[subtheme_override] = subtheme value -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/themes/test_theme/test_theme.info b/modules/simpletest/tests/themes/test_theme/test_theme.info index 0370bc6a..01ab6979 100644 --- a/modules/simpletest/tests/themes/test_theme/test_theme.info +++ b/modules/simpletest/tests/themes/test_theme/test_theme.info @@ -17,8 +17,8 @@ stylesheets[all][] = system.base.css settings[theme_test_setting] = default value -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/themes/test_theme_nyan_cat/templates/theme_test_template_test.nyan-cat.html b/modules/simpletest/tests/themes/test_theme_nyan_cat/templates/theme_test_template_test.nyan-cat.html new file mode 100644 index 00000000..7202dd48 --- /dev/null +++ b/modules/simpletest/tests/themes/test_theme_nyan_cat/templates/theme_test_template_test.nyan-cat.html @@ -0,0 +1 @@ +Miaou \ No newline at end of file diff --git a/modules/simpletest/tests/themes/test_theme_nyan_cat/test_theme_nyan_cat.info b/modules/simpletest/tests/themes/test_theme_nyan_cat/test_theme_nyan_cat.info new file mode 100644 index 00000000..c66cf730 --- /dev/null +++ b/modules/simpletest/tests/themes/test_theme_nyan_cat/test_theme_nyan_cat.info @@ -0,0 +1,11 @@ +name = Nyan cat engine based test theme +description = Theme for testing the module-provided theme engines. +core = 7.x +hidden = TRUE +engine = nyan_cat + +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" +project = "drupal" +datestamp = "1485986921" + diff --git a/modules/simpletest/tests/update_script_test.info b/modules/simpletest/tests/update_script_test.info index af18d119..9e027718 100644 --- a/modules/simpletest/tests/update_script_test.info +++ b/modules/simpletest/tests/update_script_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/update_test_1.info b/modules/simpletest/tests/update_test_1.info index b64ad361..5534275a 100644 --- a/modules/simpletest/tests/update_test_1.info +++ b/modules/simpletest/tests/update_test_1.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/update_test_2.info b/modules/simpletest/tests/update_test_2.info index b64ad361..5534275a 100644 --- a/modules/simpletest/tests/update_test_2.info +++ b/modules/simpletest/tests/update_test_2.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/update_test_3.info b/modules/simpletest/tests/update_test_3.info index b64ad361..5534275a 100644 --- a/modules/simpletest/tests/update_test_3.info +++ b/modules/simpletest/tests/update_test_3.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/url_alter_test.info b/modules/simpletest/tests/url_alter_test.info index f7924d30..b0c1216e 100644 --- a/modules/simpletest/tests/url_alter_test.info +++ b/modules/simpletest/tests/url_alter_test.info @@ -5,8 +5,8 @@ package = Testing version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/simpletest/tests/xmlrpc_test.info b/modules/simpletest/tests/xmlrpc_test.info index cbc93637..a7d0bf9a 100644 --- a/modules/simpletest/tests/xmlrpc_test.info +++ b/modules/simpletest/tests/xmlrpc_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/statistics/statistics.info b/modules/statistics/statistics.info index 03d8a30f..4a601cad 100644 --- a/modules/statistics/statistics.info +++ b/modules/statistics/statistics.info @@ -6,8 +6,8 @@ core = 7.x files[] = statistics.test configure = admin/config/system/statistics -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/syslog/syslog.info b/modules/syslog/syslog.info index 00ad4ff7..e0273e09 100644 --- a/modules/syslog/syslog.info +++ b/modules/syslog/syslog.info @@ -6,8 +6,8 @@ core = 7.x files[] = syslog.test configure = admin/config/development/logging -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/system/system.api.php b/modules/system/system.api.php index 3152139a..f1855b96 100644 --- a/modules/system/system.api.php +++ b/modules/system/system.api.php @@ -2050,6 +2050,22 @@ function hook_system_theme_info() { return $themes; } +/** + * Return additional theme engines provided by modules. + * + * This hook is invoked from _system_rebuild_theme_data() and allows modules to + * register additional theme engines outside of the regular 'themes/engines' + * directories of a Drupal installation. + * + * @return + * An associative array. Each key is the system name of a theme engine and + * each value is the corresponding path to the theme engine's .engine file. + */ +function hook_system_theme_engine_info() { + $theme_engines['izumi'] = drupal_get_path('module', 'mymodule') . '/izumi/izumi.engine'; + return $theme_engines; +} + /** * Alter the information parsed from module and theme .info files * diff --git a/modules/system/system.info b/modules/system/system.info index 5aa40c95..cdc4ba37 100644 --- a/modules/system/system.info +++ b/modules/system/system.info @@ -12,8 +12,8 @@ files[] = system.test required = TRUE configure = admin/config/system -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/system/system.module b/modules/system/system.module index ae7c4323..53844d87 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -2521,6 +2521,16 @@ function _system_rebuild_theme_data() { // Find theme engines $engines = drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.engine$/', 'themes/engines'); + // Allow modules to add further theme engines. + if ($module_engines = module_invoke_all('system_theme_engine_info')) { + foreach ($module_engines as $name => $theme_engine_path) { + $engines[$name] = (object) array( + 'uri' => $theme_engine_path, + 'filename' => basename($theme_engine_path), + 'name' => $name, + ); + } + } // Set defaults for theme info. $defaults = array( diff --git a/modules/system/system.test b/modules/system/system.test index ec71093d..9eaf562b 100644 --- a/modules/system/system.test +++ b/modules/system/system.test @@ -1461,6 +1461,60 @@ class DateTimeFunctionalTest extends DrupalWebTestCase { } } +/** + * Tests date format configuration. + */ +class DateFormatTestCase extends DrupalWebTestCase { + public static function getInfo() { + return array( + 'name' => 'Date format', + 'description' => 'Test date format configuration and defaults.', + 'group' => 'System', + ); + } + + function setUp() { + parent::setUp(); + + // Create admin user and log in admin user. + $this->admin_user = $this->drupalCreateUser(array('administer site configuration')); + $this->drupalLogin($this->admin_user); + } + + /** + * Test the default date type formats are consistent. + */ + function testDefaultDateFormats() { + // These are the default format values from format_date(). + $default_formats = array( + 'short' => 'm/d/Y - H:i', + 'medium' => 'D, m/d/Y - H:i', + 'long' => 'l, F j, Y - H:i', + ); + + // Clear the date format variables. + variable_del('date_format_short'); + variable_del('date_format_medium'); + variable_del('date_format_long'); + + $this->drupalGet('admin/config/regional/date-time'); + + foreach ($default_formats as $format_name => $format_value) { + $id = 'edit-date-format-' . $format_name; + // Check that the configuration fields match the default format. + $this->assertOptionSelected( + $id, + $format_value, + format_string('The @type format type matches the expected format @format.', + array( + '@type' => $format_name, + '@format' => $format_value, + ) + )); + } + } +} + class PageTitleFiltering extends DrupalWebTestCase { protected $content_user; protected $saved_title; diff --git a/modules/system/tests/cron_queue_test.info b/modules/system/tests/cron_queue_test.info index 13fefda3..896f53ed 100644 --- a/modules/system/tests/cron_queue_test.info +++ b/modules/system/tests/cron_queue_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/system/tests/system_cron_test.info b/modules/system/tests/system_cron_test.info index ed37d109..be1c9ac7 100644 --- a/modules/system/tests/system_cron_test.info +++ b/modules/system/tests/system_cron_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/taxonomy/taxonomy.info b/modules/taxonomy/taxonomy.info index bd613c4b..e8861c92 100644 --- a/modules/taxonomy/taxonomy.info +++ b/modules/taxonomy/taxonomy.info @@ -8,8 +8,8 @@ files[] = taxonomy.module files[] = taxonomy.test configure = admin/structure/taxonomy -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/toolbar/toolbar.info b/modules/toolbar/toolbar.info index 3b0675fa..b6548208 100644 --- a/modules/toolbar/toolbar.info +++ b/modules/toolbar/toolbar.info @@ -4,8 +4,8 @@ core = 7.x package = Core version = VERSION -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/tracker/tracker.info b/modules/tracker/tracker.info index 2b643cda..861949f7 100644 --- a/modules/tracker/tracker.info +++ b/modules/tracker/tracker.info @@ -6,8 +6,8 @@ version = VERSION core = 7.x files[] = tracker.test -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/translation/tests/translation_test.info b/modules/translation/tests/translation_test.info index 1976f1c1..1c8f63e3 100644 --- a/modules/translation/tests/translation_test.info +++ b/modules/translation/tests/translation_test.info @@ -5,8 +5,8 @@ package = Testing version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/translation/translation.info b/modules/translation/translation.info index 6b3a2f17..2b947da6 100644 --- a/modules/translation/translation.info +++ b/modules/translation/translation.info @@ -6,8 +6,8 @@ version = VERSION core = 7.x files[] = translation.test -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/trigger/tests/trigger_test.info b/modules/trigger/tests/trigger_test.info index 8ee06149..759b642f 100644 --- a/modules/trigger/tests/trigger_test.info +++ b/modules/trigger/tests/trigger_test.info @@ -4,8 +4,8 @@ package = Testing core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/trigger/trigger.info b/modules/trigger/trigger.info index 517536de..425e1545 100644 --- a/modules/trigger/trigger.info +++ b/modules/trigger/trigger.info @@ -6,8 +6,8 @@ core = 7.x files[] = trigger.test configure = admin/structure/trigger -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/update/tests/aaa_update_test.info b/modules/update/tests/aaa_update_test.info index 9c69bde6..eccae6fa 100644 --- a/modules/update/tests/aaa_update_test.info +++ b/modules/update/tests/aaa_update_test.info @@ -4,8 +4,8 @@ package = Testing core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/update/tests/bbb_update_test.info b/modules/update/tests/bbb_update_test.info index 7327e7f0..2346781e 100644 --- a/modules/update/tests/bbb_update_test.info +++ b/modules/update/tests/bbb_update_test.info @@ -4,8 +4,8 @@ package = Testing core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/update/tests/ccc_update_test.info b/modules/update/tests/ccc_update_test.info index 3a876fc3..d93e640d 100644 --- a/modules/update/tests/ccc_update_test.info +++ b/modules/update/tests/ccc_update_test.info @@ -4,8 +4,8 @@ package = Testing core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/update/tests/themes/update_test_admintheme/update_test_admintheme.info b/modules/update/tests/themes/update_test_admintheme/update_test_admintheme.info index 00c1dd6b..7ceefdaf 100644 --- a/modules/update/tests/themes/update_test_admintheme/update_test_admintheme.info +++ b/modules/update/tests/themes/update_test_admintheme/update_test_admintheme.info @@ -3,8 +3,8 @@ description = Test theme which is used as admin theme. core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/update/tests/themes/update_test_basetheme/update_test_basetheme.info b/modules/update/tests/themes/update_test_basetheme/update_test_basetheme.info index 6a858fd9..b8036c85 100644 --- a/modules/update/tests/themes/update_test_basetheme/update_test_basetheme.info +++ b/modules/update/tests/themes/update_test_basetheme/update_test_basetheme.info @@ -3,8 +3,8 @@ description = Test theme which acts as a base theme for other test subthemes. core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/update/tests/themes/update_test_subtheme/update_test_subtheme.info b/modules/update/tests/themes/update_test_subtheme/update_test_subtheme.info index b579bb51..3df44583 100644 --- a/modules/update/tests/themes/update_test_subtheme/update_test_subtheme.info +++ b/modules/update/tests/themes/update_test_subtheme/update_test_subtheme.info @@ -4,8 +4,8 @@ core = 7.x base theme = update_test_basetheme hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/update/tests/update_test.info b/modules/update/tests/update_test.info index 657b2c1c..7f9dd93a 100644 --- a/modules/update/tests/update_test.info +++ b/modules/update/tests/update_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/update/update.info b/modules/update/update.info index 1efa370b..30305573 100644 --- a/modules/update/update.info +++ b/modules/update/update.info @@ -6,8 +6,8 @@ core = 7.x files[] = update.test configure = admin/reports/updates/settings -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/user/tests/user_form_test.info b/modules/user/tests/user_form_test.info index 921bd89e..32c8f45c 100644 --- a/modules/user/tests/user_form_test.info +++ b/modules/user/tests/user_form_test.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/modules/user/user.info b/modules/user/user.info index 2136902b..4a760ecc 100644 --- a/modules/user/user.info +++ b/modules/user/user.info @@ -9,8 +9,8 @@ required = TRUE configure = admin/config/people stylesheets[all][] = user.css -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/profiles/minimal/minimal.info b/profiles/minimal/minimal.info index ebc9f129..ff2ae9cc 100644 --- a/profiles/minimal/minimal.info +++ b/profiles/minimal/minimal.info @@ -5,8 +5,8 @@ core = 7.x dependencies[] = block dependencies[] = dblog -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/profiles/standard/standard.info b/profiles/standard/standard.info index bc743d50..aa7654c0 100644 --- a/profiles/standard/standard.info +++ b/profiles/standard/standard.info @@ -24,8 +24,8 @@ dependencies[] = field_ui dependencies[] = file dependencies[] = rdf -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info b/profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info index f0f43f33..8097aac1 100644 --- a/profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info +++ b/profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info @@ -6,8 +6,8 @@ core = 7.x hidden = TRUE files[] = drupal_system_listing_compatible_test.test -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info b/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info index 17434350..c59eecda 100644 --- a/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info +++ b/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info @@ -8,8 +8,8 @@ version = VERSION core = 6.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/profiles/testing/testing.info b/profiles/testing/testing.info index 020330eb..7a9e217f 100644 --- a/profiles/testing/testing.info +++ b/profiles/testing/testing.info @@ -4,8 +4,8 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/sites/all/modules/contrib/admin/token/tests/token_test.info b/sites/all/modules/contrib/admin/token/tests/token_test.info index 9e0b2368..02d93794 100644 --- a/sites/all/modules/contrib/admin/token/tests/token_test.info +++ b/sites/all/modules/contrib/admin/token/tests/token_test.info @@ -5,9 +5,9 @@ core = 7.x files[] = token_test.module hidden = TRUE -; Information added by Drupal.org packaging script on 2015-02-28 -version = "7.x-1.6" +; Information added by Drupal.org packaging script on 2017-01-25 +version = "7.x-1.7" core = "7.x" project = "token" -datestamp = "1425149060" +datestamp = "1485316088" diff --git a/sites/all/modules/contrib/admin/token/token.info b/sites/all/modules/contrib/admin/token/token.info index a9efec27..afa8c62e 100644 --- a/sites/all/modules/contrib/admin/token/token.info +++ b/sites/all/modules/contrib/admin/token/token.info @@ -3,9 +3,9 @@ description = Provides a user interface for the Token API and some missing core core = 7.x files[] = token.test -; Information added by Drupal.org packaging script on 2015-02-28 -version = "7.x-1.6" +; Information added by Drupal.org packaging script on 2017-01-25 +version = "7.x-1.7" core = "7.x" project = "token" -datestamp = "1425149060" +datestamp = "1485316088" diff --git a/sites/all/modules/contrib/admin/token/token.install b/sites/all/modules/contrib/admin/token/token.install index c2b57fd0..24d09f32 100644 --- a/sites/all/modules/contrib/admin/token/token.install +++ b/sites/all/modules/contrib/admin/token/token.install @@ -21,18 +21,12 @@ function token_requirements($phase = 'runtime') { $problems = array_unique($problem['problems']); $problems = array_map('check_plain', $problems); $token_problems[$problem_key] = $problem['label'] . theme('item_list', array('items' => $problems)); + $requirements['token-' . $problem_key] = array( + 'title' => $problem['label'], + 'value' => theme('item_list', array('items' => $problems)), + 'severity' => $problem['severity'], + ); } - else { - unset($token_problems[$problem_key]); - } - } - if (!empty($token_problems)) { - $requirements['token_problems'] = array( - 'title' => $t('Tokens'), - 'value' => $t('Problems detected'), - 'severity' => REQUIREMENT_WARNING, - 'description' => '

' . implode('

', $token_problems) . '

', //theme('item_list', array('items' => $token_problems)), - ); } } @@ -272,19 +266,24 @@ function token_get_token_problems() { $token_info = token_info(); $token_problems = array( 'not-array' => array( - 'label' => t('The following tokens or token types are not defined as arrays:'), + 'label' => t('Tokens or token types not defined as arrays'), + 'severity' => REQUIREMENT_ERROR, ), 'missing-info' => array( - 'label' => t('The following tokens or token types are missing required name and/or description information:'), + 'label' => t('Tokens or token types missing name property'), + 'severity' => REQUIREMENT_WARNING, ), 'type-no-tokens' => array( - 'label' => t('The following token types do not have any tokens defined:'), + 'label' => t('Token types do not have any tokens defined'), + 'severity' => REQUIREMENT_INFO, ), 'tokens-no-type' => array( - 'label' => t('The following token types are not defined but have tokens:'), + 'label' => t('Token types are not defined but have tokens'), + 'severity' => REQUIREMENT_INFO, ), 'duplicate' => array( - 'label' => t('The following token or token types are defined by multiple modules:') + 'label' => t('Token or token types are defined by multiple modules'), + 'severity' => REQUIREMENT_ERROR, ), ); @@ -295,9 +294,12 @@ function token_get_token_problems() { $token_problems['not-array']['problems'][] = "\$info['types']['$type']"; continue; } - elseif (!isset($type_info['name']) || !isset($type_info['description'])) { + elseif (!isset($type_info['name'])) { $token_problems['missing-info']['problems'][] = "\$info['types']['$type']"; } + elseif (is_array($type_info['name'])) { + $token_problems['duplicate']['problems'][] = "\$info['types']['$type']"; + } elseif (empty($token_info['tokens'][$real_type])) { $token_problems['type-no-tokens']['problems'][] = "\$info['tokens']['$real_type']"; } @@ -315,10 +317,10 @@ function token_get_token_problems() { $token_problems['not-array']['problems'][] = "\$info['tokens']['$type']['$token']"; continue; } - elseif (!isset($tokens[$token]['name']) || !isset($tokens[$token]['description'])) { + elseif (!isset($tokens[$token]['name'])) { $token_problems['missing-info']['problems'][] = "\$info['tokens']['$type']['$token']"; } - elseif (is_array($tokens[$token]['name']) || is_array($tokens[$token]['description'])) { + elseif (is_array($tokens[$token]['name'])) { $token_problems['duplicate']['problems'][] = "\$info['tokens']['$type']['$token']"; } } diff --git a/sites/all/modules/contrib/admin/token/token.module b/sites/all/modules/contrib/admin/token/token.module index 269f3765..bbca2aab 100644 --- a/sites/all/modules/contrib/admin/token/token.module +++ b/sites/all/modules/contrib/admin/token/token.module @@ -274,7 +274,11 @@ function token_form_block_admin_configure_alter(&$form, $form_state) { */ function token_field_widget_form_alter(&$element, &$form_state, $context) { if (!empty($element['#description']) && !empty($context['instance']['description'])) { - $element['#description'] = filter_xss_admin(token_replace($context['instance']['description'])); + $instance = $context['instance']; + if (module_exists('i18n_field')) { + $instance = i18n_string_object_translate('field_instance', $instance); + } + $element['#description'] = field_filter_xss(token_replace($instance['description'])); } } @@ -719,15 +723,13 @@ function token_element_validate(&$element, &$form_state) { // Validate if an element must have a minimum number of tokens. if (isset($element['#min_tokens']) && count($tokens) < $element['#min_tokens']) { - // @todo Change this error message to include the minimum number. - $error = format_plural($element['#min_tokens'], 'The %element-title cannot contain fewer than one token.', 'The %element-title must contain at least @count tokens.', array('%element-title' => $title)); + $error = format_plural($element['#min_tokens'], '%name must contain at least one token.', '%name must contain at least @count tokens.', array('%name' => $title)); form_error($element, $error); } // Validate if an element must have a maximum number of tokens. if (isset($element['#max_tokens']) && count($tokens) > $element['#max_tokens']) { - // @todo Change this error message to include the maximum number. - $error = format_plural($element['#max_tokens'], 'The %element-title must contain as most one token.', 'The %element-title must contain at most @count tokens.', array('%element-title' => $title)); + $error = format_plural($element['#max_tokens'], '%name must contain at most one token.', '%name must contain at most @count tokens.', array('%name' => $title)); form_error($element, $error); } @@ -735,7 +737,7 @@ function token_element_validate(&$element, &$form_state) { if (isset($element['#token_types'])) { $invalid_tokens = token_get_invalid_tokens_by_context($tokens, $element['#token_types']); if ($invalid_tokens) { - form_error($element, t('The %element-title is using the following invalid tokens: @invalid-tokens.', array('%element-title' => $title, '@invalid-tokens' => implode(', ', $invalid_tokens)))); + form_error($element, t('%name is using the following invalid tokens: @invalid-tokens.', array('%name' => $title, '@invalid-tokens' => implode(', ', $invalid_tokens)))); } } @@ -983,7 +985,7 @@ function _token_build_tree($token_type, array $options) { // parent. $token_parents[] = $token_type; } - elseif (in_array($token, array_slice($token_parents, 1))) { + elseif (in_array($token, array_slice($token_parents, 1), TRUE)) { // Prevent duplicate recursive tokens. For example, this will prevent // the tree from generating the following tokens or deeper: // [comment:parent:parent] diff --git a/sites/all/modules/contrib/admin/token/token.pages.inc b/sites/all/modules/contrib/admin/token/token.pages.inc index f7615475..4fe39684 100644 --- a/sites/all/modules/contrib/admin/token/token.pages.inc +++ b/sites/all/modules/contrib/admin/token/token.pages.inc @@ -199,7 +199,7 @@ function _token_token_tree_format_row($token, array $token_info, $is_group = FAL $row = $defaults; $row['id'] = _token_clean_css_identifier($token); $row['data']['name'] = $token_info['name']; - $row['data']['description'] = $token_info['description']; + $row['data']['description'] = isset($token_info['description']) ? $token_info['description'] : ''; if ($is_group) { // This is a token type/group. @@ -207,6 +207,7 @@ function _token_token_tree_format_row($token, array $token_info, $is_group = FAL } else { // This is a token. + $row['data']['token'] = array(); $row['data']['token']['data'] = $token; $row['data']['token']['class'][] = 'token-key'; if (isset($token_info['value'])) { diff --git a/sites/all/modules/contrib/admin/token/token.tokens.inc b/sites/all/modules/contrib/admin/token/token.tokens.inc index e0c0b5e9..f584bdaf 100644 --- a/sites/all/modules/contrib/admin/token/token.tokens.inc +++ b/sites/all/modules/contrib/admin/token/token.tokens.inc @@ -1392,7 +1392,6 @@ function field_token_info_alter(&$info) { */ function field_tokens($type, $tokens, array $data = array(), array $options = array()) { $replacements = array(); - $sanitize = !empty($options['sanitize']); $langcode = isset($options['language']) ? $options['language']->language : NULL; // Entity tokens. @@ -1437,7 +1436,7 @@ function field_tokens($type, $tokens, array $data = array(), array $options = ar /** * Pre-render callback for field output used with tokens. */ -function token_pre_render_field_token(&$elements) { +function token_pre_render_field_token($elements) { // Remove the field theme hook, attachments, and JavaScript states. unset($elements['#theme']); unset($elements['#states']); diff --git a/sites/all/modules/contrib/localisation/i18n/i18n.info b/sites/all/modules/contrib/localisation/i18n/i18n.info index 882e650f..93db483e 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n.info +++ b/sites/all/modules/contrib/localisation/i18n/i18n.info @@ -8,9 +8,9 @@ files[] = i18n_object.inc files[] = i18n.test configure = admin/config/regional/i18n -; Information added by Drupal.org packaging script on 2016-10-22 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2017-01-31 +version = "7.x-1.15" core = "7.x" project = "i18n" -datestamp = "1477154943" +datestamp = "1485834792" diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_block/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_block/README.txt new file mode 100644 index 00000000..5d0ddb87 --- /dev/null +++ b/sites/all/modules/contrib/localisation/i18n/i18n_block/README.txt @@ -0,0 +1,74 @@ +CONTENTS OF THIS FILE +--------------------- + +* Introduction +* Requirements +* Recommended modules +* Installation +* Configuration +* Troubleshooting +* Maintainers + + +INTRODUCTION +------------ + +The Block languages module, part of the Internationalization (https://www.drupal.org/project/i18n) package, allows the user to configure for which languages each block is visible. + +* For a full description of the module, visit https://www.drupal.org/node/1279698 + +* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n + + +REQUIREMENTS +------------ + +This module requires the following modules: + +Internationalization - https://www.drupal.org/project/i18n + + +RECOMMENDED MODULES +------------------- + +* Internationalization Views - https://www.drupal.org/project/i18nviews +* Language Icons - https://www.drupal.org/project/languageicons +* Translation Overview - https://www.drupal.org/project/translation_overview +* Localization Client - https://www.drupal.org/project/l10n_client +* Internationalization contributions - https://www.drupal.org/project/i18n_contrib + + +INSTALLATION +------------ + +* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information. + + +CONFIGURATION +------------- + +The settings for visibility per language are provided under Visibility Settings via the Languages tab when configuring a block. + +The Languages tab also provides a setting for whether the block is translatable. For custom blocks, the block title and the block content will be translatable. For blocks defined by modules, only the block title will be translatable. If "Make this block translatable" is selected, a Translate tab will appear for that block. This tab provides a UI for adding translations of the block in each available language. + + +TROUBLESHOOTING +--------------- + +Conflicts with Context + +The Block languages module conflicts with the Context module, which alters how blocks are rendered. This issue can be tracked in the Internationalization issue queue: http://drupal.org/node/1343044 + +String Errors + +The user must allow your used string format to be translated on admin/config/regional/i18n/strings or you are going to have a error message like "The string blocks:block:1:body for textgroup blocks is not allowed for translation because of its text format." + + +MAINTAINERS +----------- + +* Jose Reyero - https://www.drupal.org/u/jose-reyero +* Florian Weber (webflo) - https://www.drupal.org/u/webflo +* Peter Philipp - https://www.drupal.org/u/das-peter +* Joseph Olstad - https://www.drupal.org/u/joseph.olstad +* Nathaniel Catchpole - https://www.drupal.org/u/catch diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.info b/sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.info index 725e30c6..093f1315 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.info +++ b/sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.info @@ -8,9 +8,9 @@ files[] = i18n_block.inc files[] = i18n_block.test -; Information added by Drupal.org packaging script on 2016-10-22 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2017-01-31 +version = "7.x-1.15" core = "7.x" project = "i18n" -datestamp = "1477154943" +datestamp = "1485834792" diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_contact/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_contact/README.txt new file mode 100644 index 00000000..cc62ab7f --- /dev/null +++ b/sites/all/modules/contrib/localisation/i18n/i18n_contact/README.txt @@ -0,0 +1,67 @@ +CONTENTS OF THIS FILE +--------------------- + +* Introduction +* Requirements +* Recommended modules +* Installation +* Configuration +* Maintainers + + +INTRODUCTION +------------ + +The Contact translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, helps with the multilingual configuration of the site contact forms. This module makes contact categories and replies available for translation. + +* For a full description of the module, visit https://www.drupal.org/node/1396984 + +* To submit bug reports and feature suggestions, or to track changes, visit https://www.drupal.org/project/issues/i18n + + +REQUIREMENTS +------------ + +This module requires the following modules: + +Internationalization (https://www.drupal.org/project/i18n) + + +RECOMMENDED MODULES +------------------- + +* Internationalization Views (https://www.drupal.org/project/i18nviews) +* Language Icons (https://www.drupal.org/project/languageicons) +* Translation Overview (https://www.drupal.org/project/translation_overview) +* Localization Client (https://www.drupal.org/project/l10n_client) +* Internationalization contributions (https://www.drupal.org/project/i18n_contrib) + + +INSTALLATION +------------ + +* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. See https://drupal.org/documentation/install/modules-themes/modules-7 for further information. + + +CONFIGURATION +------------- + +1. Enable the Contact translation module included with the Internationalization module. +2. Go to Administration > Structure > Contact form. +3. Click edit for the form to configure. +4. Click the Translate tab. +5. Click the translate link for a language. +6. Translate the Category and Auto-reply text. +7. Click Save translation. +8. Repeat steps 5 to 7 for each language. +9. Repeat steps 2 to 8 for all forms. + + +MAINTAINERS +----------- + +* Jose Reyero - https://www.drupal.org/u/jose-reyero +* Florian Weber (webflo) - https://www.drupal.org/u/webflo +* Peter Philipp - https://www.drupal.org/u/das-peter +* Joseph Olstad - https://www.drupal.org/u/joseph.olstad +* Nathaniel Catchpole - https://www.drupal.org/u/catch diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_contact/i18n_contact.info b/sites/all/modules/contrib/localisation/i18n/i18n_contact/i18n_contact.info index 15f84d8d..a0946833 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_contact/i18n_contact.info +++ b/sites/all/modules/contrib/localisation/i18n/i18n_contact/i18n_contact.info @@ -5,9 +5,9 @@ dependencies[] = i18n_string package = Multilingual - Internationalization core = 7.x -; Information added by Drupal.org packaging script on 2016-10-22 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2017-01-31 +version = "7.x-1.15" core = "7.x" project = "i18n" -datestamp = "1477154943" +datestamp = "1485834792" diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_field/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_field/README.txt new file mode 100644 index 00000000..cb7a5e5e --- /dev/null +++ b/sites/all/modules/contrib/localisation/i18n/i18n_field/README.txt @@ -0,0 +1,65 @@ +CONTENTS OF THIS FILE +--------------------- + +* Introduction +* Requirements +* Recommended modules +* Installation +* Configuration +* Maintainers + + +INTRODUCTION +------------ + +The Field translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, allows for translation of text associated with a field's settings including the label, help text, default value, and list options. + +* For a full description of the module, visit this page https://www.drupal.org/node/1279346 + +* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n + + +REQUIREMENTS +------------ + +This module requires the following modules: + +Internationalization (https://www.drupal.org/project/i18n) + + +RECOMMENDED MODULES +------------------- + +* Internationalization Views (https://www.drupal.org/project/i18nviews) +* Language Icons (https://www.drupal.org/project/languageicons) +* Translation Overview (https://www.drupal.org/project/translation_overview) +* Localization Client (https://www.drupal.org/project/l10n_client) +* Internationalization contributions (https://www.drupal.org/project/i18n_contrib) + + +INSTALLATION +------------ + +* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://drupal.org/documentation/install/modules-themes/modules-7 for further information. + + +CONFIGURATION +------------- + +1. Enable the Field translation module included with Internationalization. +2. Go to Administration > Configuration > Regional and language > Translate interface. +3. Click on Filter Translatable Strings field set and limit search to fields. +4. Edit the desired field and Save. +For the translation to be displayed, you need to use some of the Field Formatters provided by this module whose name usually ends up in 'translated'. For most core fields it is Default translated. + +Note: The Field Translation module does not provide content translation for fields. This functionality is provided by the Entity Translation (ET) module. + + +MAINTAINERS +----------- + +* Jose Reyero - https://www.drupal.org/u/jose-reyero +* Florian Weber (webflo) - https://www.drupal.org/u/webflo +* Peter Philipp - https://www.drupal.org/u/das-peter +* Joseph Olstad - https://www.drupal.org/u/joseph.olstad +* Nathaniel Catchpole - https://www.drupal.org/u/catch diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.info b/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.info index 6554eb18..e9c20f06 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.info +++ b/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.info @@ -6,9 +6,9 @@ package = Multilingual - Internationalization core = 7.x files[] = i18n_field.inc files[] = i18n_field.test -; Information added by Drupal.org packaging script on 2016-10-22 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2017-01-31 +version = "7.x-1.15" core = "7.x" project = "i18n" -datestamp = "1477154943" +datestamp = "1485834792" diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.module b/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.module index eadd2f5c..f78f9c0e 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.module +++ b/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.module @@ -446,3 +446,69 @@ function i18n_field_type_info($type = NULL, $property = NULL) { return $info; } } + +/** + * Implements hook_field_info_alter(). + */ +function i18n_field_field_info_alter(&$field_info) { + foreach(array_keys($field_info) as $type) { + $field_info[$type]['property_callbacks'][] = 'i18n_field_entity_property_callback'; + } +} + +/** + * Callback to translate entity property info for a fields. + * + * @see entity_metadata_field_entity_property_info() + * @see entity_metadata_field_default_property_callback() + * @see i18n_field_i18n_object_info_alter() + * @see hook_module_implements_alter() + */ +function i18n_field_entity_property_callback(&$info, $entity_type, $field, $instance, $field_type) { + global $language; + + // This could create a endless recursion if it's called during rebuilding the + // cache for i18n_object_info(). So if the cache of i18n_object_info isn't + // available yet we assume the worst case, leave the info alone but trigger a + // rebuild of the property when hook_i18n_object_info_alter is invoked. At + // that point the info is available and we can rely on it. + if (!$info = &drupal_static('i18n_object_info')) { + $i18n_field_entity_property_callback_fallback = &drupal_static(__FUNCTION__); + $i18n_field_entity_property_callback_fallback = TRUE; + return; + } + + $name = $field['field_name']; + $property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$name]; + $property['label'] = i18n_field_translate_property($instance, 'label', $language->language); +} + +/** + * Implements hook_i18n_object_info_alter(). + */ +function i18n_field_i18n_object_info_alter(&$info) { + if (drupal_static('i18n_field_entity_property_callback')) { + if ($info = drupal_static('i18n_object_info')) { + // Clean static and permanent cache of the data and then re-run the property + // building. + drupal_static_reset('entity_get_property_info'); + cache_clear_all('entity_property_info:' . $GLOBALS['language']->language, 'cache'); + entity_get_property_info(); + } + else { + watchdog('i18n_field', 'Unable to run fall-back handling for entity property translation due missing "i18n_object_info" cache', array(), WATCHDOG_WARNING); + } + } +} + +/** + * Implements hook_module_implements_alter(). + */ +function i18n_field_module_implements_alter(&$implementations, $hook) { + if ($hook == 'i18n_object_info_alter') { + // Move our hook implementation to the bottom. + $group = $implementations['i18n_field']; + unset($implementations['i18n_field']); + $implementations['i18n_field'] = $group; + } +} \ No newline at end of file diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_forum/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_forum/README.txt new file mode 100644 index 00000000..e8ab6bf4 --- /dev/null +++ b/sites/all/modules/contrib/localisation/i18n/i18n_forum/README.txt @@ -0,0 +1,80 @@ +CONTENTS OF THIS FILE +--------------------- + +* Introduction +* Requirements +* Recommended modules +* Installation +* Configuration +* Maintainers + + +INTRODUCTION +------------ + +The Multilingual forum module, part of the Internationalization (https://www.drupal.org/project/i18n) package, helps with the multilingual configuration of the site’s forums. + +* For a full description of the module visit https://www.drupal.org/node/1396988 + +* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n + + +REQUIREMENTS +------------ + +This module requires the following modules: + +* Internationalization (https://www.drupal.org/project/i18n) + + +RECOMMENDED MODULES +------------------- + +* Internationalization Views (https://www.drupal.org/project/i18nviews) +* Language Icons (https://www.drupal.org/project/languageicons) +* Translation Overview (https://www.drupal.org/project/translation_overview) +* Localization Client (https://www.drupal.org/project/l10n_client) +* Internationalization contributions (https://www.drupal.org/project/i18n_contrib) + +INSTALLATION + +------------ + +* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. See https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information. + + +CONFIGURATION +------------- + +To configure forum vocabulary + +1. Enable the Multilingual forum module included with Internationalization. +2. Go to Administration > Structure > Taxonomy. +3. Click "edit vocabulary" for the Forums vocabulary. +4. Choose the translation mode (Localize or Translate). +5. Click "Save and translate" button. +6. Click "translate" link for a language. +7. Translate the "Name" and "Description" for the forum. +8. Click "Save translation" button. +9. Repeat steps 6 to 8 for each language. + +To configure forum terms + +1. Go to Administration > Structure > Forums. +2. Click "edit" link for a forum or container. +3. Click "Translate" tab. +4. Click "translate" link for a language. +5. Translate the "Name" and "Description" for the term. +6. Click "Save translation" button. +7. Repeat steps 4 to 6 for each language. +8. Repeat all steps for all terms. + + +MAINTAINERS +----------- + +* Jose Reyero - https://www.drupal.org/u/jose-reyero +* Florian Weber (webflo) - https://www.drupal.org/u/webflo +* Peter Philipp - https://www.drupal.org/u/das-peter +* Joseph Olstad - https://www.drupal.org/u/joseph.olstad +* Nathaniel Catchpole - https://www.drupal.org/u/catch diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_forum/i18n_forum.info b/sites/all/modules/contrib/localisation/i18n/i18n_forum/i18n_forum.info index 972dff16..32548a50 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_forum/i18n_forum.info +++ b/sites/all/modules/contrib/localisation/i18n/i18n_forum/i18n_forum.info @@ -7,9 +7,9 @@ package = Multilingual - Internationalization core = 7.x files[] = i18n_forum.test -; Information added by Drupal.org packaging script on 2016-10-22 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2017-01-31 +version = "7.x-1.15" core = "7.x" project = "i18n" -datestamp = "1477154943" +datestamp = "1485834792" diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_menu/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_menu/README.txt new file mode 100644 index 00000000..76eef55e --- /dev/null +++ b/sites/all/modules/contrib/localisation/i18n/i18n_menu/README.txt @@ -0,0 +1,89 @@ +CONTENTS OF THIS FILE +--------------------- + +* Introduction +* Requirements +* Recommended modules +* Installation +* Configuration +* Troubleshooting +* Maintainers + + +INTRODUCTION +------------ + +The Menu translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, allows users to select a translation mode for each menu. + +* For a full description of the module, visit this page: +https://www.drupal.org/node/1113982 + +* To submit bug reports and feature suggestions, or to track changes: +https://www.drupal.org/project/issues/i18n + + +REQUIREMENTS +------------ + +This module requires the following modules: + +* Internationalization (https://www.drupal.org/project/i18n) + + +RECOMMENDED MODULES +------------------- + +* Internationalization Views (https://www.drupal.org/project/i18nviews) +* Language Icons (https://www.drupal.org/project/languageicons) +* Translation Overview (https://www.drupal.org/project/translation_overview) +* Localization Client (https://www.drupal.org/project/l10n_client) +* Internationalization contributions (https://www.drupal.org/project/i18n_contrib) + +To link menu item menus to nodes, it is useful to have the following modules: + +* Entity translation i18n menu module, a sub module of Entity translation (https://www.drupal.org/project/entity_translation) +* Menu translation node module (https://www.drupal.org/project/i18n_menu_node) + + +INSTALLATION +------------ + +* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information + + +CONFIGURATION +------------- + +Language-specific menus +1. To create or edit a menu, navigate to Structure > Menus > (menu to edit) > Edit. +2. In the Translation mode section, choose Fixed Language and a Language field will appear. +3. Select a language, select Save, and add or update the menu items as needed. +The menu block will only appear when viewing content in the same language. + +There are three modes available: + +Translate and Localize: +You can create one menu for all languages, and translate or localize each menu item. There are two ways that menu items will be translated. +1. You can set a language when creating a custom menu item so that the menu item will only show up for that language. Menu items that link to nodes in a particular language will be treated this way. +2. You can localize other custom menu items without a language (for example, menu items linking to Views pages). Use the Translate tab to translate the menu item title and description. Translators can also use the "Translate interface" pages to translate these menu items. + +Fixed Language: +If you choose Fixed Language, you'll have to set up a separate menu in each language. This could become tedious if have a lot of languages enabled on your site, but is useful if the content or menu structure is different for each language. + +No Multilingual Options: +Only the menu will be translatable. + +TROUBLESHOOTING +--------------- + +A menu item linked to a node will be displayed only when the node language matches the page language. This is due to how the menu system works and the "Language selection" feature in i18n. Therefore, to get translated menus items that link to nodes, you first need translated content. For more information visit https://www.drupal.org/docs/7/multilingual/translating-content. + + +MAINTAINERS +----------- + +* Jose Reyero - https://www.drupal.org/u/jose-reyero +* Florian Weber (webflo) - https://www.drupal.org/u/webflo +* Peter Philipp - https://www.drupal.org/u/das-peter +* Joseph Olstad - https://www.drupal.org/u/joseph.olstad +* Nathaniel Catchpole - https://www.drupal.org/u/catch diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.info b/sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.info index 05e7d9cd..c4fe9f97 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.info +++ b/sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.info @@ -10,9 +10,9 @@ core = 7.x files[] = i18n_menu.inc files[] = i18n_menu.test -; Information added by Drupal.org packaging script on 2016-10-22 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2017-01-31 +version = "7.x-1.15" core = "7.x" project = "i18n" -datestamp = "1477154943" +datestamp = "1485834792" diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.module b/sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.module index fecb6106..9a05ba74 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.module +++ b/sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.module @@ -53,6 +53,24 @@ function i18n_menu_menu_alter(&$items) { $items['admin/structure/menu/item/%menu_link'] = $items['admin/structure/menu/item/%menu_link/edit']; $items['admin/structure/menu/item/%menu_link']['type'] = MENU_CALLBACK; $items['admin/structure/menu/item/%menu_link/edit']['type'] = MENU_DEFAULT_LOCAL_TASK; + $items['admin/structure/menu/manage/%menu']['title callback'] = 'i18n_menu_menu_overview_title'; +} + +/** + * Preprocess theme_menu_admin_overview to translate menu name and description + * + * @param $variables + */ +function i18n_menu_preprocess_menu_admin_overview(&$variables) { + $variables['title'] = i18n_string(array('menu', 'menu', $variables['name'], 'title'), $variables['title']); + $variables['description'] = i18n_string(array('menu', 'menu', $variables['name'], 'description'), $variables['description']); +} + +/** + * Title callback for the menu overview page and links. + */ +function i18n_menu_menu_overview_title($menu) { + return i18n_string(array('menu', 'menu', $menu['menu_name'], 'title'), $menu['title']); } /** @@ -726,15 +744,19 @@ function i18n_menu_form_menu_edit_item_alter(&$form, &$form_state) { * Add a "translate" link in operations column for each menu item. */ function i18n_menu_form_menu_overview_form_alter(&$form, &$form_state) { - foreach (element_children($form) as $element) { - if (substr($element, 0, 5) == 'mlid:') { - $mlid = $form[$element]['#item']['mlid']; - if (i18n_get_object('menu', $mlid)->get_translate_access()) { - $form[$element]['operations']['translate'] = array( - '#type' => 'link', - '#title' => t('translate'), - '#href' => "admin/structure/menu/item/{$mlid}/translate", - ); + if (i18n_menu_mode($form['#menu']['menu_name'], I18N_MODE_MULTIPLE)) { + foreach (element_children($form) as $element) { + if (substr($element, 0, 5) == 'mlid:') { + $item = $form[$element]["#item"]; + $mlid = $form[$element]['#item']['mlid']; + if (i18n_get_object('menu', $mlid)->get_translate_access()) { + $form[$element]['operations']['translate'] = array( + '#type' => 'link', + '#title' => t('translate'), + '#href' => "admin/structure/menu/item/{$mlid}/translate", + ); + $form[$element]['title']['#markup'] = l(_i18n_menu_link_title($item), $item['href'], $item['localized_options']); + } } } } @@ -901,93 +923,25 @@ function i18n_menu_query_features_menu_link_alter($query) { } /** - * Implements hook_init(). + * Implements hook_query_TAG_alter() + * + * Using tag 'preferred_menu_links' added in menu_link_get_preferred(). + * See http://drupal.org/node/1854134 */ -function i18n_menu_init() { +function i18n_menu_query_preferred_menu_links_alter(QueryAlterableInterface $query) { + global $language; + // Get queried tables. + $tables = $query->getTables(); - // The only way to override the default preferred menu link for a path is to - // inject it into the static cache of the function menu_link_get_preferred(). - - // The problem with the default implementation is that it does not take the - // language of a menu link into account. Whe having different menu trees for - // different menus, this means that the active trail will not work for all but - // one language. - - // The code below is identical to the mentioned function except the added - // language condition on the query. - - // TODO: Adding an alter tag to the query would allow to do this with a simple - // hook_query_alter() implementation. - - $preferred_links = &drupal_static('menu_link_get_preferred'); - - $path = $_GET['q']; - - // Look for the correct menu link by building a list of candidate paths, - // which are ordered by priority (translated hrefs are preferred over - // untranslated paths). Afterwards, the most relevant path is picked from - // the menus, ordered by menu preference. - $item = menu_get_item($path); - $path_candidates = array(); - // 1. The current item href. - $path_candidates[$item['href']] = $item['href']; - // 2. The tab root href of the current item (if any). - if ($item['tab_parent'] && ($tab_root = menu_get_item($item['tab_root_href']))) { - $path_candidates[$tab_root['href']] = $tab_root['href']; - } - // 3. The current item path (with wildcards). - $path_candidates[$item['path']] = $item['path']; - // 4. The tab root path of the current item (if any). - if (!empty($tab_root)) { - $path_candidates[$tab_root['path']] = $tab_root['path']; - } - // Retrieve a list of menu names, ordered by preference. - $menu_names = menu_get_active_menu_names(); - // Use an illegal menu name as the key for the preferred menu link. - $selected_menu = MENU_PREFERRED_LINK; - // Put the selected menu at the front of the list. - array_unshift($menu_names, $selected_menu); - - $query = db_select('menu_links', 'ml', array('fetch' => PDO::FETCH_ASSOC)); - $query->leftJoin('menu_router', 'm', 'm.path = ml.router_path'); - $query->fields('ml'); - // Weight must be taken from {menu_links}, not {menu_router}. - $query->addField('ml', 'weight', 'link_weight'); - $query->fields('m'); - $query->condition('ml.link_path', $path_candidates, 'IN'); - - // Only look menu links with none or the current language. - $query->condition('ml.language', array(LANGUAGE_NONE, i18n_language_interface()->language), 'IN'); - - // Sort candidates by link path and menu name. - $candidates = array(); - foreach ($query->execute() as $candidate) { - $candidate['weight'] = $candidate['link_weight']; - $candidates[$candidate['link_path']][$candidate['menu_name']] = $candidate; - // Add any menus not already in the menu name search list. - if (!in_array($candidate['menu_name'], $menu_names)) { - $menu_names[] = $candidate['menu_name']; - } - } - - // Store the most specific link for each menu. Also save the most specific - // link of the most preferred menu in $preferred_link. - foreach ($path_candidates as $link_path) { - if (isset($candidates[$link_path])) { - foreach ($menu_names as $menu_name) { - if (empty($preferred_links[$path][$menu_name]) && isset($candidates[$link_path][$menu_name])) { - $candidate_item = $candidates[$link_path][$menu_name]; - $map = explode('/', $path); - _menu_translate($candidate_item, $map); - if ($candidate_item['access']) { - $preferred_links[$path][$menu_name] = $candidate_item; - if (empty($preferred_links[$path][MENU_PREFERRED_LINK])) { - // Store the most specific link. - $preferred_links[$path][MENU_PREFERRED_LINK] = $candidate_item; - } - } - } + foreach ($tables as $alias => $table) { + if ($table['table'] == 'menu_links') { + // Add language filter, ensuring that we don't have any collision when + // determining the active menu trail when there are multiple menu items + // with same link path but different languages. + if ($language) { + $query->condition('language', array($language->language, LANGUAGE_NONE), 'IN'); } + break; } } } diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_node/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_node/README.txt new file mode 100644 index 00000000..2c4bc402 --- /dev/null +++ b/sites/all/modules/contrib/localisation/i18n/i18n_node/README.txt @@ -0,0 +1,71 @@ +CONTENTS OF THIS FILE +--------------------- + +* Introduction +* Requirements +* Recommended modules +* Installation +* Configuration +* Maintainers + + +INTRODUCTION +------------ + +The Multilingual content module, part of the Internationalization (https://www.drupal.org/project/i18n) package, provides extended multilingual options for nodes. These options help accommodate a variety of translation workflows by controlling how the language for nodes is set. + +Note that the Multilingual content module lives in the i18n_node directory in the Internationalization package. Don't confuse this module with the core Content translation module. + +* For a full description of the module visit https://www.drupal.org/node/1279644 + +* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n + + +REQUIREMENTS +------------ + +This module requires the following modules: + +* Internationalization (https://www.drupal.org/project/i18n) + + +RECOMMENDED MODULES +------------------- + +* Internationalization Views (https://www.drupal.org/project/i18nviews) +* Language Icons (https://www.drupal.org/project/languageicons) +* Translation Overview (https://www.drupal.org/project/translation_overview) +* Localization Client (https://www.drupal.org/project/l10n_client) +* Internationalization contributions (https://www.drupal.org/project/i18n_contrib) + + +INSTALLATION + +------------ + +* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. See https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information. + + +CONFIGURATION +------------- + +For each content type, the following Extended language options are available under the Multilingual Settings tab +1. "Set current language as default for new content" can be useful for content that is community-generated. +2. "Require language" prevents users from creating 'Language neutral' nodes. +3. "Lock language" prevents users from changing the language of a node after it's created. + +Site-wide Settings for Node Translation +1. There are also site-wide settings provided to help streamline how multilingual content is created. Navigate to Config > Regional and language > Multilingual settings > Node Options. +2. "Switch interface for translating" switches the language of the user interface to the chosen language when a user translates a node. This is useful if users speak the language in which the translation is written. It means that after the node translation is saved, the language of the UI will match the language of the node. +3. "Hide content translation links" will prevent the language switcher links from appearing in nodes and teasers. This is useful if a language switcher block is enabled on the site. +4.You can also select the default language for new nodes if the corresponding content type doesn't have language support. By default, it is set to be in the default language of the site, but this can be changed to be language neutral. This is a useful option when thinking about forward compatibility for adding multilingual support to these content types in the future. + + +MAINTAINERS +----------- + +* Jose Reyero - https://www.drupal.org/u/jose-reyero +* Florian Weber (webflo) - https://www.drupal.org/u/webflo +* Peter Philipp - https://www.drupal.org/u/das-peter +* Joseph Olstad - https://www.drupal.org/u/joseph.olstad +* Nathaniel Catchpole - https://www.drupal.org/u/catch diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.info b/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.info index a637f0db..07d38f65 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.info +++ b/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.info @@ -9,9 +9,9 @@ configure = admin/config/regional/i18n/node files[]=i18n_node.test files[]=i18n_node.variable.inc -; Information added by Drupal.org packaging script on 2016-10-22 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2017-01-31 +version = "7.x-1.15" core = "7.x" project = "i18n" -datestamp = "1477154943" +datestamp = "1485834792" diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.module b/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.module index 8c2e38e3..e5bd68b4 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.module +++ b/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.module @@ -506,8 +506,11 @@ function _i18n_node_form_node_form_alter($form, &$form_state) { } } elseif (variable_get('i18n_node_default_language_none', 0) && !isset($form['#node']->nid)) { - // Override locale module setting default language to nodes. It is already in form_state. - $form['language']['#value'] = $form_state['values']['language'] = LANGUAGE_NONE; + // Only do this if the language is really disabled + if (variable_get('language_content_type_' . $node->type, 0) == 0) { + // Override locale module setting default language to nodes. It is already in form_state. + $form['language']['#value'] = $form_state['values']['language'] = LANGUAGE_NONE; + } } // Translate field names for title and body for the node edit form. if (!empty($form['title']['#title'])) { diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_path/i18n_path.info b/sites/all/modules/contrib/localisation/i18n/i18n_path/i18n_path.info index 30c8c3b9..5767d8b8 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_path/i18n_path.info +++ b/sites/all/modules/contrib/localisation/i18n/i18n_path/i18n_path.info @@ -6,9 +6,9 @@ core = 7.x files[] = i18n_path.inc files[] = i18n_path.test -; Information added by Drupal.org packaging script on 2016-10-22 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2017-01-31 +version = "7.x-1.15" core = "7.x" project = "i18n" -datestamp = "1477154943" +datestamp = "1485834792" diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_redirect/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_redirect/README.txt new file mode 100644 index 00000000..3d10403b --- /dev/null +++ b/sites/all/modules/contrib/localisation/i18n/i18n_redirect/README.txt @@ -0,0 +1,68 @@ +CONTENTS OF THIS FILE +--------------------------- + +* Introduction +* Requirements +* Recommended modules +* Installation +* Configuration +* Maintainers + + +INTRODUCTION +------------ + +The Redirect translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, improves search engine optimization (SEO) for multilingual websites. + +It redirects anonymous users (including web crawlers) to the translation of the page in the requested language, if it exists, using a 301 redirect code. + +* For a full description of the module, visit this page: +https://www.drupal.org/node/1280468 + +* To submit bug reports and feature suggestions, or to track changes: +https://www.drupal.org/project/issues/i18n + + +REQUIREMENTS +------------ + +This module requires the following modules: + +* Internationalization (https://www.drupal.org/project/i18n) + +The Translation redirect module requires the implementation of hook_i18n_translate_path by another module for the redirect page to be determined. Currently, the Multilingual content, Path translation, and Taxonomy translation modules implement this hook. + + +RECOMMENDED MODULES +------------------- + +* Internationalization Views (https://www.drupal.org/project/i18nviews) +* Language Icons (https://www.drupal.org/project/languageicons) +* Translation Overview (https://www.drupal.org/project/translation_overview) +* Localization Client (https://www.drupal.org/project/l10n_client) +* Internationalization contributions (https://www.drupal.org/project/i18n_contrib) + + +INSTALLATION +------------ + +* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information. + + +CONFIGURATION +------------- + +No configuration is necessary. + +For node translation, enable the Multilingual content and the Translation redirect modules. For non-node pages, the redirection hook must be implemented by the relevant module. +For example, for taxonomy pages, you should enable the Taxonomy translation module because the module provides the necessary hook code. If you are using the Path translation module to create translation sets for non-node pages, then it implements the hook code for determining the redirection page. + + +MAINTAINERS +----------- + +* Jose Reyero - https://www.drupal.org/u/jose-reyero +* Florian Weber (webflo) - https://www.drupal.org/u/webflo +* Peter Philipp - https://www.drupal.org/u/das-peter +* Joseph Olstad - https://www.drupal.org/u/joseph.olstad +* Nathaniel Catchpole - https://www.drupal.org/u/catch diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_redirect/i18n_redirect.info b/sites/all/modules/contrib/localisation/i18n/i18n_redirect/i18n_redirect.info index ad48edb7..229a3966 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_redirect/i18n_redirect.info +++ b/sites/all/modules/contrib/localisation/i18n/i18n_redirect/i18n_redirect.info @@ -4,9 +4,9 @@ dependencies[] = i18n package = Multilingual - Internationalization core = 7.x -; Information added by Drupal.org packaging script on 2016-10-22 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2017-01-31 +version = "7.x-1.15" core = "7.x" project = "i18n" -datestamp = "1477154943" +datestamp = "1485834792" diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_select/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_select/README.txt new file mode 100644 index 00000000..8f13ddf0 --- /dev/null +++ b/sites/all/modules/contrib/localisation/i18n/i18n_select/README.txt @@ -0,0 +1,67 @@ +CONTENTS OF THIS FILE +--------------------- + +* Introduction +* Requirements +* Recommended modules +* Installation +* Configuration +* Maintainers + + +INTRODUCTION +------------ + +The Multilingual select module, part of the Internationalization (https://www.drupal.org/project/i18n) package, allows the user to define whether content is filtered by language on pages provided by Drupal core. + +* For a full description of the module visit https://www.drupal.org/node/1279512 + +* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n + + +REQUIREMENTS +------------ + +This module requires the following modules: + +* Internationalization (https://www.drupal.org/project/i18n) +* Variable (https://www.drupal.org/project/variable) + + +RECOMMENDED MODULES +------------------- + +* Internationalization Views (https://www.drupal.org/project/i18nviews) +* Language Icons (https://www.drupal.org/project/languageicons) +* Translation Overview (https://www.drupal.org/project/translation_overview) +* Localization Client (https://www.drupal.org/project/l10n_client) +* Internationalization contributions (https://www.drupal.org/project/i18n_contrib) + + +INSTALLATION +------------ + +* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. See https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information. + + +CONFIGURATION +------------- + +The module allows you to configure whether or not to filter pages by the current language. If the Taxonomy translation submodule is also enabled, an option will be available for how taxonomy term pages are filtered. It also allows the exclusion of the module’s language selection handling for some elements and certain paths. + +1. Enable the Multilingual select module included with Internationalization. +2. Go to Configuration > Regional and language > Multilingual settings > Selection. +3. Select nodes and taxonomy can be filtered by language in the Content to Filter by Language field set. +4. The "Content Selection Mode" allows content with specific tags to be skipped by entering a list of tags. +5. The "Enable for Specific Pages" field set allows specific pages to be included by path. +6. After making choices click Save configuration. + + +MAINTAINERS +----------- + +* Jose Reyero - https://www.drupal.org/u/jose-reyero +* Florian Weber (webflo) - https://www.drupal.org/u/webflo +* Peter Philipp - https://www.drupal.org/u/das-peter +* Joseph Olstad - https://www.drupal.org/u/joseph.olstad +* Nathaniel Catchpole - https://www.drupal.org/u/catch diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_select/i18n_select.info b/sites/all/modules/contrib/localisation/i18n/i18n_select/i18n_select.info index d24b3767..74455ffd 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_select/i18n_select.info +++ b/sites/all/modules/contrib/localisation/i18n/i18n_select/i18n_select.info @@ -6,9 +6,9 @@ core = 7.x configure = admin/config/regional/i18n/select files[] = i18n_select.test -; Information added by Drupal.org packaging script on 2016-10-22 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2017-01-31 +version = "7.x-1.15" core = "7.x" project = "i18n" -datestamp = "1477154943" +datestamp = "1485834792" diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_string/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_string/README.txt new file mode 100644 index 00000000..0e6645ae --- /dev/null +++ b/sites/all/modules/contrib/localisation/i18n/i18n_string/README.txt @@ -0,0 +1,72 @@ +CONTENTS OF THIS FILE +--------------------- + +* Introduction +* Requirements +* Recommended modules +* Installation +* Configuration +* Maintainers + + +INTRODUCTION +------------ + +The String translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, provides support for other modules to translate user-defined strings. This is an API module that must be enabled only when required by other modules in the i18n package. + + +* For a full description of the module, visit this page: +https://www.drupal.org/node/1279668 + +* To submit bug reports and feature suggestions, or to track changes: +https://www.drupal.org/project/issues/i18n + + +REQUIREMENTS +------------ + +This module requires the following modules: + +Internationalization (https://www.drupal.org/project/i18n) + + +RECOMMENDED MODULES +------------------- + +* Internationalization Views (https://www.drupal.org/project/i18nviews) +* Language Icons (https://www.drupal.org/project/languageicons) +* Translation Overview (https://www.drupal.org/project/translation_overview) +* Localization Client (https://www.drupal.org/project/l10n_client) +* Internationalization contributions (https://www.drupal.org/project/i18n_contrib) + + +INSTALLATION +------------ + +* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information. + + +CONFIGURATION +------------- + +Strings will be translated from the source languages. By default the source language is the site's default language, so changing the default language could break these translations. + +1. You can set which language is used as the source language via Administration > Configuration > Regional and language > Multilingual settings > Strings. By default, only plain strings are enabled, so regular blocks are not fully translatable. +2. To allow Filtered HTML, Full HTML or Plain text select the appropriate radio box(es) and Save configuration. +3. To select the strings to be translated navigate to Administration > Configuration > Regional and language > Translate interface and select on Stings vertical tab. From here you can select which text groups to translate and select the Refresh strings tab. + + +FAQ +--- + +The String translation module allows you to configure which text formats are translatable. Formats like PHP Filter and Full HTML are translated before they are processed, so allowing a translator to edit these can be a security risk. This is particularly problematic when importing translations in bulk from a CSV file, since the translator's access to the import formats isn't verified by Drupal. After updating this setting, be sure to refresh the strings via Administration > Configuration > Regional and language > Translate interface > Strings so that strings in forbidden formats are deleted. + + +MAINTAINERS +----------- + +* Jose Reyero - https://www.drupal.org/u/jose-reyero +* Florian Weber (webflo) - https://www.drupal.org/u/webflo +* Peter Philipp - https://www.drupal.org/u/das-peter +* Joseph Olstad - https://www.drupal.org/u/joseph.olstad +* Nathaniel Catchpole - https://www.drupal.org/u/catch diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.info b/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.info index 64ab698e..b6961b4e 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.info +++ b/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.info @@ -10,9 +10,9 @@ files[] = i18n_string.inc files[] = i18n_string.test configure = admin/config/regional/i18n/strings -; Information added by Drupal.org packaging script on 2016-10-22 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2017-01-31 +version = "7.x-1.15" core = "7.x" project = "i18n" -datestamp = "1477154943" +datestamp = "1485834792" diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_sync/i18n_sync.info b/sites/all/modules/contrib/localisation/i18n/i18n_sync/i18n_sync.info index c6b644b7..c91f89ed 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_sync/i18n_sync.info +++ b/sites/all/modules/contrib/localisation/i18n/i18n_sync/i18n_sync.info @@ -10,9 +10,9 @@ files[] = i18n_sync.install files[] = i18n_sync.module.inc files[] = i18n_sync.node.inc files[] = i18n_sync.test -; Information added by Drupal.org packaging script on 2016-10-22 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2017-01-31 +version = "7.x-1.15" core = "7.x" project = "i18n" -datestamp = "1477154943" +datestamp = "1485834792" diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/README.txt new file mode 100644 index 00000000..0813883a --- /dev/null +++ b/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/README.txt @@ -0,0 +1,86 @@ +CONTENTS OF THIS FILE +--------------------- + +* Introduction +* Requirements +* Recommended modules +* Installation +* Configuration +* Maintainers + + +INTRODUCTION +------------ + +The Taxonomy translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, provides multiple options to translate taxonomy vocabularies and terms. For each vocabulary, there are four types of behaviors to choose from: Language-independent terms, Language-specific terms, Localized terms, and Mixed-language vocabulary. + +* For a full description of the module visit https://www.drupal.org/node/1114016 + +* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n + + +REQUIREMENTS +------------ + +This module requires the following modules: + +* Internationalization - https://www.drupal.org/project/i18n + + +RECOMMENDED MODULES +------------------- + +* Internationalization Views - https://www.drupal.org/project/i18nviews +* Language Icons - https://www.drupal.org/project/languageicons +* Translation Overview - https://www.drupal.org/project/translation_overview +* Localization Client - https://www.drupal.org/project/l10n_client +* Internationalization contributions - https://www.drupal.org/project/i18n_contrib + + +INSTALLATION +------------ + +* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information. + + +CONFIGURATION +------------- + +Language-independent terms - only vocabulary will be translatable. +1. Navigate to Structure > Taxonomy. +2. Select the "edit vocabulary" link. +3. Select the "No multilingual options for terms". + +Language-specific terms - vocabulary is only used for content in that language. The terms will only be available if the term language matches the UI language. +1. Navigate to Structure > Taxonomy and select the "edit vocabulary link". +2. Choose "Fixed Language" and a Language drop-down field will be displayed. +3. Select the language. +4. Select "Fixed Language" and Save. + +Localized terms - Terms are common for all languages, but their name and description may be localized. +1. Navigate to Structure > Taxonomy > vocabulary-to-edit > Edit. +2. Select "Localize" and select Save. +3. Edit a term and there will be a Translate tab. Select this tab. +4. Select Translate, translate the Name and Description, select "Save translation", and repeat for all languages. +5. Repeat the process for all terms. +6. Navigate to Structure > Content types > term-to-edit > Manage display. +7. By default, the term reference is set to Link. Change this to "Link (localized)" and Save. +The vocabulary will be appropriate for the language. + +Mixed-language vocabulary - Use for vocabularies with terms in multiple languages. +1. Navigate to Structure > Taxonomy > vocabulary-to-edit > Edit. +2. Select the Translate radio button and Save. +3. Edit a vocabulary term and there will be a new Language field. Choose a language and then select Save and translate. +4. There are two options, the user can either select "Add translation link" or the user can select an existing term in the Select translations form. +5. Create translations for the terms and add terms for specific languages only. +Now if the user edits a node associated with this vocabulary, only the relevant terms will appear. + + +MAINTAINERS +----------- + +* Jose Reyero - https://www.drupal.org/u/jose-reyero +* Florian Weber (webflo) - https://www.drupal.org/u/webflo +* Peter Philipp - https://www.drupal.org/u/das-peter +* Joseph Olstad - https://www.drupal.org/u/joseph.olstad +* Nathaniel Catchpole - https://www.drupal.org/u/catch diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.info b/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.info index 300b8407..59a0ca03 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.info +++ b/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.info @@ -11,9 +11,9 @@ files[] = i18n_taxonomy.pages.inc files[] = i18n_taxonomy.admin.inc files[] = i18n_taxonomy.test -; Information added by Drupal.org packaging script on 2016-10-22 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2017-01-31 +version = "7.x-1.15" core = "7.x" project = "i18n" -datestamp = "1477154943" +datestamp = "1485834792" diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.module b/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.module index 920e0105..d4d86f6e 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.module +++ b/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.module @@ -1096,7 +1096,7 @@ function i18n_taxonomy_get_tree($vid, $langcode, $parent = 0, $max_depth = NULL, $query->join('taxonomy_term_hierarchy', 'h', 'h.tid = t.tid'); $result = $query ->addTag('translatable') - ->addTag('term_access') + ->addTag('taxonomy_term_access') ->fields('t') ->fields('h', array('parent')) ->condition('t.vid', $vid) @@ -1270,3 +1270,22 @@ function i18n_taxonomy_modules_enabled($modules) { } } } + +/** + * Implements hook_views_pre_render(). + */ +function i18n_taxonomy_views_pre_render(&$view) { + if(!module_exists('rules_scheduler')) { + global $language; + + foreach ($view->result as $delta => $term){ + if (isset($term->tid)) { + i18n_string_translate_langcode($language->language); + $localized_term = i18n_taxonomy_localize_terms(taxonomy_term_load($term->tid)); + $term->tid = $localized_term->tid; + $term->taxonomy_term_data_name = $localized_term->name; + $term->taxonomy_term_data_description = $localized_term->description; + } + } + } +} diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.pages.inc b/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.pages.inc index ab77cbc1..8d8f8c6f 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.pages.inc +++ b/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.pages.inc @@ -100,7 +100,7 @@ function _i18n_taxonomy_autocomplete($langcode, $vids, $tags_typed = '') { $query = db_select('taxonomy_term_data', 't') ->fields('t', array('tid', 'name')); $query->addTag('translatable'); - $query->addTag('term_access'); + $query->addTag('taxonomy_term_access'); // Disable i18n_select for this query $query->addTag('i18n_select'); // Add language condition diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_translation/i18n_translation.info b/sites/all/modules/contrib/localisation/i18n/i18n_translation/i18n_translation.info index d09c7add..e2fcc56a 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_translation/i18n_translation.info +++ b/sites/all/modules/contrib/localisation/i18n/i18n_translation/i18n_translation.info @@ -6,9 +6,9 @@ core = 7.x files[] = i18n_translation.inc -; Information added by Drupal.org packaging script on 2016-10-22 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2017-01-31 +version = "7.x-1.15" core = "7.x" project = "i18n" -datestamp = "1477154943" +datestamp = "1485834792" diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_user/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_user/README.txt new file mode 100644 index 00000000..67eedcc1 --- /dev/null +++ b/sites/all/modules/contrib/localisation/i18n/i18n_user/README.txt @@ -0,0 +1,63 @@ +CONTENTS OF THIS FILE +--------------------- + +* Introduction +* Requirements +* Recommended modules +* Installation +* Configuration +* Maintainers + + +INTRODUCTION +------------ + +The User mail translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, translates emails sent from the User module. + +* For a full description of the module, visit this page: +https://www.drupal.org/node/133977 + +* To submit bug reports and feature suggestions, or to track changes: +https://www.drupal.org/project/issues/i18n + + +REQUIREMENTS +------------ + +This module requires the following modules: + +Internationalization (https://www.drupal.org/project/i18n) + + +RECOMMENDED MODULES +------------------- + +* Internationalization Views (https://www.drupal.org/project/i18nviews) +* Language Icons (https://www.drupal.org/project/languageicons) +* Translation Overview (https://www.drupal.org/project/translation_overview) +* Localization Client (https://www.drupal.org/project/l10n_client) +* Internationalization contributions (https://www.drupal.org/project/i18n_contrib) + + +INSTALLATION +------------ + +* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information. + + +CONFIGURATION +------------- + +To configure email translations +1. Navigate to Administration > Configuration > Regional and language > Multilingual settings and select the variables tab. +2. Select the "User emails" tab. Select the variables you would like translated and Save configuration. + + +MAINTAINERS +----------- + +* Jose Reyero - https://www.drupal.org/u/jose-reyero +* Florian Weber (webflo) - https://www.drupal.org/u/webflo +* Peter Philipp - https://www.drupal.org/u/das-peter +* Joseph Olstad - https://www.drupal.org/u/joseph.olstad +* Nathaniel Catchpole - https://www.drupal.org/u/catch diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.info b/sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.info index e784248e..a5051f18 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.info +++ b/sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.info @@ -4,9 +4,9 @@ core = 7.x package = Multilingual - Internationalization dependencies[] = i18n_variable -; Information added by Drupal.org packaging script on 2016-10-22 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2017-01-31 +version = "7.x-1.15" core = "7.x" project = "i18n" -datestamp = "1477154943" +datestamp = "1485834792" diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.module b/sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.module index 9c61b814..bd7d5dda 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.module +++ b/sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.module @@ -9,7 +9,7 @@ */ function i18n_user_mail_alter(&$message) { if ($message['module'] == 'user') { - $language = $message['language']; + $language = (isset($message['language']) ? $message['language'] : language_default()); $variables = array('user' => $message['params']['account']); $key = $message['key']; diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_variable/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_variable/README.txt new file mode 100644 index 00000000..39e0f2bb --- /dev/null +++ b/sites/all/modules/contrib/localisation/i18n/i18n_variable/README.txt @@ -0,0 +1,67 @@ +CONTENTS OF THIS FILE +--------------------- + +* Introduction +* Requirements +* Recommended modules +* Installation +* Configuration +* Maintainers + +INTRODUCTION +------------ + +The Variable translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, allows the user to translate text and settings that are stored in Drupal as variables. These variables include text such as 'site name' and 'site slogan', as well as settings like 'Default front page' and 'Default 404 page'. + +* For a full description of the module, visit https://www.drupal.org/node/1113374 + +* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n + + +REQUIREMENTS +------------ + +This module requires the following modules: + +* Internationalization (https://www.drupal.org/project/i18n) +* Variable (https://www.drupal.org/project/variable) + + +RECOMMENDED MODULES +------------------- + +* Internationalization Views (https://www.drupal.org/project/i18nviews) +* Language Icons (https://www.drupal.org/project/languageicons) +* Translation Overview (https://www.drupal.org/project/translation_overview) +* Localization Client (https://www.drupal.org/project/l10n_client) +* Internationalization contributions (https://www.drupal.org/project/i18n_contrib) + + +INSTALLATION +------------ + +* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. See https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information. + + +CONFIGURATION +------------- + +To enable multilingual variables + +1. Enable the Variable translation module included with the Internationalization package. +2. Go to Administration > Configuration > Regional and language > Multilingual settings. +3. Click on the Variables tab. +4. Select the variables that will be multilingual. +5. Click Save configuration button. + +Once you have the correct settings, they'll be marked with "This is a multilingual variable" when you go to the corresponding administration pages. You must switch the site language while in the administration pages to set the variables for each language. A language switcher link will appear at the top of each administrative page that has multilingual variables. + + +MAINTAINERS +----------- + +* Jose Reyero - https://www.drupal.org/u/jose-reyero +* Florian Weber (webflo) - https://www.drupal.org/u/webflo +* Peter Philipp - https://www.drupal.org/u/das-peter +* Joseph Olstad - https://www.drupal.org/u/joseph.olstad +* Nathaniel Catchpole - https://www.drupal.org/u/catch diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_variable/i18n_variable.info b/sites/all/modules/contrib/localisation/i18n/i18n_variable/i18n_variable.info index 3dbcd3c8..16f79a32 100644 --- a/sites/all/modules/contrib/localisation/i18n/i18n_variable/i18n_variable.info +++ b/sites/all/modules/contrib/localisation/i18n/i18n_variable/i18n_variable.info @@ -10,9 +10,9 @@ configure = admin/config/regional/i18n/variable files[] = i18n_variable.class.inc files[] = i18n_variable.test -; Information added by Drupal.org packaging script on 2016-10-22 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2017-01-31 +version = "7.x-1.15" core = "7.x" project = "i18n" -datestamp = "1477154943" +datestamp = "1485834792" diff --git a/sites/all/modules/contrib/localisation/i18n/tests/i18n_test.info b/sites/all/modules/contrib/localisation/i18n/tests/i18n_test.info index 2f7a00c4..7aaba8ce 100644 --- a/sites/all/modules/contrib/localisation/i18n/tests/i18n_test.info +++ b/sites/all/modules/contrib/localisation/i18n/tests/i18n_test.info @@ -7,9 +7,9 @@ package = Testing core = 6.x hidden = TRUE -; Information added by Drupal.org packaging script on 2016-10-22 -version = "7.x-1.14" +; Information added by Drupal.org packaging script on 2017-01-31 +version = "7.x-1.15" core = "7.x" project = "i18n" -datestamp = "1477154943" +datestamp = "1485834792" diff --git a/sites/all/modules/contrib/views/views/includes/handlers.inc b/sites/all/modules/contrib/views/views/includes/handlers.inc index 6c1e8879..680a54de 100644 --- a/sites/all/modules/contrib/views/views/includes/handlers.inc +++ b/sites/all/modules/contrib/views/views/includes/handlers.inc @@ -1588,7 +1588,7 @@ class views_join { $extras[] = $extra; } // Otherwise - and if we have a value - use it for a field-to-value condition. - elseif (!empty($info['value'])) { + elseif (isset($info['value'])) { // Convert a single-valued array of values to the single-value case, // and transform from IN() notation to = notation if (is_array($info['value']) && count($info['value']) == 1) { diff --git a/sites/all/modules/contrib/views/views/js/base.js b/sites/all/modules/contrib/views/views/js/base.js index 5855dceb..65bc4d51 100644 --- a/sites/all/modules/contrib/views/views/js/base.js +++ b/sites/all/modules/contrib/views/views/js/base.js @@ -64,6 +64,11 @@ Drupal.Views.parseQueryString = function (query) { * Helper function to return a view's arguments based on a path. */ Drupal.Views.parseViewArgs = function (href, viewPath) { + + // Provide language prefix. + if (Drupal.settings.pathPrefix) { + var viewPath = Drupal.settings.pathPrefix + viewPath; + } var returnObj = {}; var path = Drupal.Views.getPath(href); // Ensure we have a correct path. diff --git a/sites/all/modules/contrib/views/views/modules/taxonomy/views_handler_argument_term_node_tid.inc b/sites/all/modules/contrib/views/views/modules/taxonomy/views_handler_argument_term_node_tid.inc index f47f08a8..58d18592 100644 --- a/sites/all/modules/contrib/views/views/modules/taxonomy/views_handler_argument_term_node_tid.inc +++ b/sites/all/modules/contrib/views/views/modules/taxonomy/views_handler_argument_term_node_tid.inc @@ -38,6 +38,7 @@ class views_handler_argument_term_node_tid extends views_handler_argument_many_t function title_query() { $titles = array(); $result = db_select('taxonomy_term_data', 'td') + ->addTag('term_access') ->fields('td', array('name')) ->condition('td.tid', $this->value) ->execute(); diff --git a/sites/all/modules/contrib/views/views/modules/taxonomy/views_handler_field_taxonomy.inc b/sites/all/modules/contrib/views/views/modules/taxonomy/views_handler_field_taxonomy.inc index 48da283d..9dacb0da 100644 --- a/sites/all/modules/contrib/views/views/modules/taxonomy/views_handler_field_taxonomy.inc +++ b/sites/all/modules/contrib/views/views/modules/taxonomy/views_handler_field_taxonomy.inc @@ -22,6 +22,7 @@ class views_handler_field_taxonomy extends views_handler_field { parent::construct(); $this->additional_fields['vid'] = 'vid'; $this->additional_fields['tid'] = 'tid'; + $this->additional_fields['name'] = 'name'; $this->additional_fields['vocabulary_machine_name'] = array( 'table' => 'taxonomy_vocabulary', 'field' => 'machine_name', @@ -65,9 +66,13 @@ class views_handler_field_taxonomy extends views_handler_field { $term = new stdClass(); $term->tid = $tid; $term->vid = $this->get_value($values, 'vid'); + $term->name = $this->get_value($values, 'name'); $term->vocabulary_machine_name = $values->{$this->aliases['vocabulary_machine_name']}; $this->options['alter']['make_link'] = TRUE; $uri = entity_uri('taxonomy_term', $term); + if (isset($uri['options'])) { + $this->options['alter'] = array_merge($this->options['alter'], $uri['options']); + } $this->options['alter']['path'] = $uri['path']; } diff --git a/sites/all/modules/contrib/views/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc b/sites/all/modules/contrib/views/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc index 435db0dd..0765d72a 100644 --- a/sites/all/modules/contrib/views/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc +++ b/sites/all/modules/contrib/views/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc @@ -139,6 +139,7 @@ class views_plugin_argument_validate_taxonomy_term extends views_plugin_argument // if unverified tids left - verify them and cache results if (count($test)) { $query = db_select('taxonomy_term_data', 'td'); + $query->addTag('term_access'); $query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid'); $query->fields('td'); $query->fields('tv', array('machine_name')); @@ -167,6 +168,7 @@ class views_plugin_argument_validate_taxonomy_term extends views_plugin_argument case 'name': case 'convert': $query = db_select('taxonomy_term_data', 'td'); + $query->addTag('term_access'); $query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid'); $query->fields('td'); $query->fields('tv', array('machine_name')); @@ -202,6 +204,7 @@ class views_plugin_argument_validate_taxonomy_term extends views_plugin_argument $arg_keys = array_flip($args); $query = db_select('taxonomy_term_data', 'td'); + $query->addTag('term_access'); $query->condition('tid', $args); $query->addField('td', 'tid', 'tid'); if (!empty($vocabularies)) { diff --git a/sites/all/modules/contrib/views/views/plugins/views_plugin_cache.inc b/sites/all/modules/contrib/views/views/plugins/views_plugin_cache.inc index 0dfc9114..d5d785f3 100644 --- a/sites/all/modules/contrib/views/views/plugins/views_plugin_cache.inc +++ b/sites/all/modules/contrib/views/views/plugins/views_plugin_cache.inc @@ -289,7 +289,14 @@ class views_plugin_cache extends views_plugin { function get_results_key() { if (!isset($this->_results_key)) { - $this->_results_key = $this->view->name . ':' . $this->display->id . ':results:' . $this->get_cache_key(); + $key_data = array(); + foreach (array('exposed_info', 'page', 'sort', 'order', 'items_per_page', 'offset') as $key) { + if (isset($_GET[$key])) { + $key_data[$key] = $_GET[$key]; + } + } + + $this->_results_key = $this->view->name . ':' . $this->display->id . ':results:' . $this->get_cache_key($key_data); } return $this->_results_key; @@ -298,6 +305,7 @@ class views_plugin_cache extends views_plugin { function get_output_key() { if (!isset($this->_output_key)) { $key_data = array( + 'result' => $this->view->result, 'theme' => $GLOBALS['theme'], ); $this->_output_key = $this->view->name . ':' . $this->display->id . ':output:' . $this->get_cache_key($key_data); diff --git a/sites/all/modules/contrib/views/views/plugins/views_plugin_cache_time.inc b/sites/all/modules/contrib/views/views/plugins/views_plugin_cache_time.inc index d3ab7f92..c11a1925 100644 --- a/sites/all/modules/contrib/views/views/plugins/views_plugin_cache_time.inc +++ b/sites/all/modules/contrib/views/views/plugins/views_plugin_cache_time.inc @@ -41,7 +41,7 @@ class views_plugin_cache_time extends views_plugin_cache { '#maxlength' => '30', '#description' => t('Length of time in seconds raw query results should be cached.'), '#default_value' => $this->options['results_lifespan_custom'], - '#process' => array('form_process_select','ctools_dependent_process'), + '#process' => array('ctools_dependent_process'), '#dependency' => array( 'edit-cache-options-results-lifespan' => array('custom'), ), @@ -60,7 +60,7 @@ class views_plugin_cache_time extends views_plugin_cache { '#maxlength' => '30', '#description' => t('Length of time in seconds rendered HTML output should be cached.'), '#default_value' => $this->options['output_lifespan_custom'], - '#process' => array('form_process_select','ctools_dependent_process'), + '#process' => array('ctools_dependent_process'), '#dependency' => array( 'edit-cache-options-output-lifespan' => array('custom'), ), diff --git a/sites/all/modules/contrib/views/views/plugins/views_plugin_display_page.inc b/sites/all/modules/contrib/views/views/plugins/views_plugin_display_page.inc index 4bcec0bc..832bc6b5 100644 --- a/sites/all/modules/contrib/views/views/plugins/views_plugin_display_page.inc +++ b/sites/all/modules/contrib/views/views/plugins/views_plugin_display_page.inc @@ -118,6 +118,8 @@ class views_plugin_display_page extends views_plugin_display { 'access arguments' => $access_arguments, // Identify URL embedded arguments and correlate them to a handler 'load arguments' => array($this->view->name, $this->display->id, '%index'), + // Make sure the menu router knows where views_page is. + 'module' => 'views', ); $menu = $this->get_option('menu'); if (empty($menu)) { @@ -182,6 +184,8 @@ class views_plugin_display_page extends views_plugin_display { 'title' => $tab_options['title'], 'description' => $tab_options['description'], 'menu_name' => $tab_options['name'], + // Make sure the menu router knows where views_page is. + 'module' => 'views', ); switch ($tab_options['type']) { default: diff --git a/sites/all/modules/contrib/views/views/plugins/views_plugin_style_jump_menu.inc b/sites/all/modules/contrib/views/views/plugins/views_plugin_style_jump_menu.inc index 1de90f79..b82facd7 100644 --- a/sites/all/modules/contrib/views/views/plugins/views_plugin_style_jump_menu.inc +++ b/sites/all/modules/contrib/views/views/plugins/views_plugin_style_jump_menu.inc @@ -146,7 +146,7 @@ class views_plugin_style_jump_menu extends views_plugin_style { $lookup_options = array(); // We need to check if the path is absolute // or else language is not taken in account. - if ($this->view->display[$this->view->current_display]->display_options['fields'][$this->options['path']]['absolute']) { + if (!empty($this->view->display[$this->view->current_display]->display_options['fields'][$this->options['path']]['absolute'])) { $lookup_options['absolute'] = TRUE; } $lookup_url = url($_GET['q'], $lookup_options); diff --git a/sites/all/modules/contrib/views/views/tests/views_test.info b/sites/all/modules/contrib/views/views/tests/views_test.info index 6e9008ed..25cdf02e 100644 --- a/sites/all/modules/contrib/views/views/tests/views_test.info +++ b/sites/all/modules/contrib/views/views/tests/views_test.info @@ -5,9 +5,9 @@ core = 7.x dependencies[] = views hidden = TRUE -; Information added by Drupal.org packaging script on 2016-06-15 -version = "7.x-3.14" +; Information added by Drupal.org packaging script on 2017-02-22 +version = "7.x-3.15" core = "7.x" project = "views" -datestamp = "1466019588" +datestamp = "1487784193" diff --git a/sites/all/modules/contrib/views/views/views.info b/sites/all/modules/contrib/views/views/views.info index 0b425f17..5d7320a9 100644 --- a/sites/all/modules/contrib/views/views/views.info +++ b/sites/all/modules/contrib/views/views/views.info @@ -328,9 +328,9 @@ files[] = tests/views_cache.test files[] = tests/views_view.test files[] = tests/views_ui.test -; Information added by Drupal.org packaging script on 2016-06-15 -version = "7.x-3.14" +; Information added by Drupal.org packaging script on 2017-02-22 +version = "7.x-3.15" core = "7.x" project = "views" -datestamp = "1466019588" +datestamp = "1487784193" diff --git a/sites/all/modules/contrib/views/views/views_ui.info b/sites/all/modules/contrib/views/views/views_ui.info index cbe65b06..ebf2edbb 100644 --- a/sites/all/modules/contrib/views/views/views_ui.info +++ b/sites/all/modules/contrib/views/views/views_ui.info @@ -7,9 +7,9 @@ dependencies[] = views files[] = views_ui.module files[] = plugins/views_wizard/views_ui_base_views_wizard.class.php -; Information added by Drupal.org packaging script on 2016-06-15 -version = "7.x-3.14" +; Information added by Drupal.org packaging script on 2017-02-22 +version = "7.x-3.15" core = "7.x" project = "views" -datestamp = "1466019588" +datestamp = "1487784193" diff --git a/sites/all/modules/contrib/views/views_bulk_operations/actions/archive.action.inc b/sites/all/modules/contrib/views/views_bulk_operations/actions/archive.action.inc index f0055274..ef36acd5 100644 --- a/sites/all/modules/contrib/views/views_bulk_operations/actions/archive.action.inc +++ b/sites/all/modules/contrib/views/views_bulk_operations/actions/archive.action.inc @@ -3,10 +3,14 @@ /** * @file * Provides an action for creating a zip archive of selected files. + * * An entry in the {file_managed} table is created for the newly created archive, * and it is marked as permanent or temporary based on the operation settings. */ +/** + * Implements hook_action_info(). + */ function views_bulk_operations_archive_action_info() { $actions = array(); if (function_exists('zip_open')) { @@ -71,6 +75,10 @@ function views_bulk_operations_archive_action($file, $context) { $archive_file->filemime = file_get_mimetype($destination); $archive_file->uid = $user->uid; $archive_file->status = $context['settings']['temporary'] ? FALSE : FILE_STATUS_PERMANENT; + // Clear filesize() cache to avoid private file system differences in + // filesize. + // @see https://www.drupal.org/node/2743999 + clearstatcache(); file_save($archive_file); $url = file_create_url($archive_file->uri); @@ -100,8 +108,11 @@ function views_bulk_operations_archive_action_form($context) { } /** - * Assembles a sanitized and unique URI for the archive, and returns it for - * usage by the action callback (views_bulk_operations_archive_action). + * Assembles a sanitized and unique URI for the archive. + * + * @returns array + * A URI array used by the action callback + * (views_bulk_operations_archive_action). */ function views_bulk_operations_archive_action_submit($form, $form_state) { // Validate the scheme, fallback to public if it's somehow invalid. @@ -156,10 +167,12 @@ function views_bulk_operations_archive_action_views_bulk_operations_form($option /** * Create a sanitized and unique version of the provided filename. * - * @param $filename - * String filename + * @param string $filename + * The filename to create. + * @param array $archive_list + * The list of files already in the archive. * - * @return + * @return string * The new filename. */ function _views_bulk_operations_archive_action_create_filename($filename, $archive_list) { @@ -167,7 +180,7 @@ function _views_bulk_operations_archive_action_create_filename($filename, $archi // some filesystems, not many applications handle them well. $filename = preg_replace('/[\x00-\x1F]/u', '_', $filename); if (substr(PHP_OS, 0, 3) == 'WIN') { - // These characters are not allowed in Windows filenames + // These characters are not allowed in Windows filenames. $filename = str_replace(array(':', '*', '?', '"', '<', '>', '|'), '_', $filename); } diff --git a/sites/all/modules/contrib/views/views_bulk_operations/actions/change_owner.action.inc b/sites/all/modules/contrib/views/views_bulk_operations/actions/change_owner.action.inc new file mode 100644 index 00000000..697670db --- /dev/null +++ b/sites/all/modules/contrib/views/views_bulk_operations/actions/change_owner.action.inc @@ -0,0 +1,65 @@ + array( + 'type' => 'entity', + 'label' => t('Change owner'), + 'configurable' => TRUE, + 'behavior' => array('changes_property'), + 'triggers' => array('any'), + ), + ); +} + +/** + * Action function. + */ +function views_bulk_operations_change_owner_action($entity, $context) { + $entity->uid = $context['owner_uid']; +} + +/** + * Action form function. + */ +function views_bulk_operations_change_owner_action_form($context, &$form_state) { + $form['owner_username'] = array( + '#type' => 'textfield', + '#maxlength' => USERNAME_MAX_LENGTH, + '#title' => t('Owner'), + '#required' => TRUE, + '#description' => t('Choose the user you would like to set as the owner.'), + '#autocomplete_path' => 'user/autocomplete', + ); + + return $form; +} + +/** + * Action form validate function. + * + * Checks that the submitted text is a valid username. + */ +function views_bulk_operations_change_owner_action_validate($form, $form_state) { + if (!user_load_by_name($form_state['values']['owner_username'])) { + form_set_error('owner_username', t('Valid username required.')); + } +} + +/** + * Action form submit function. + * + * Pass submitted username back to views_bulk_operations_change_owner. + */ +function views_bulk_operations_change_owner_action_submit($form, $form_state) { + $user = user_load_by_name($form_state['values']['owner_username']); + return array('owner_uid' => $user->uid); +} diff --git a/sites/all/modules/contrib/views/views_bulk_operations/actions/delete.action.inc b/sites/all/modules/contrib/views/views_bulk_operations/actions/delete.action.inc index 52c72d2f..439a504d 100644 --- a/sites/all/modules/contrib/views/views_bulk_operations/actions/delete.action.inc +++ b/sites/all/modules/contrib/views/views_bulk_operations/actions/delete.action.inc @@ -24,11 +24,46 @@ function views_bulk_operations_delete_action_info() { ); } +function views_bulk_operations_delete_item_views_bulk_operations_form($settings) { + $form = array(); + $form['log'] = array( + '#type' => 'checkbox', + '#title' => t('Log individual deletions'), + '#description' => t('Note: Deleting large amounts of entities will generate large amounts of log messages.'), + '#default_value' => !empty($settings['log']), + ); + + return $form; +} + function views_bulk_operations_delete_item($entity, $context) { $info = entity_get_info($context['entity_type']); $entity_id = $entity->{$info['entity keys']['id']}; entity_delete($context['entity_type'], $entity_id); + + // Add a message to the watchdog if we've been configured to do so. + if (!empty($context['settings']['log'])) { + // Log an appropriate message for this entity type, using the format from + // the node, taxonomy and user module for their entity types. + switch ($context['entity_type']) { + case 'node': + watchdog('content', '@type: deleted %title.', array('@type' => $entity->type, '%title' => $entity->title)); + break; + + case 'taxonomy_term': + watchdog('taxonomy', 'Deleted term %name.', array('%name' => $entity->name), WATCHDOG_NOTICE); + break; + + case 'user': + watchdog('user', 'Deleted user: %name %email.', array('%name' => $entity->name, '%email' => '<' . $entity->mail . '>'), WATCHDOG_NOTICE); + break; + + default: + watchdog('entity', 'Deleted @type %label.', array('@type' => $context['entity_type'], '%label' => entity_label($context['entity_type'], $entity))); + break; + } + } } function views_bulk_operations_delete_revision($entity, $context) { diff --git a/sites/all/modules/contrib/views/views_bulk_operations/actions/modify.action.inc b/sites/all/modules/contrib/views/views_bulk_operations/actions/modify.action.inc index 301b17b2..06fa46dc 100644 --- a/sites/all/modules/contrib/views/views_bulk_operations/actions/modify.action.inc +++ b/sites/all/modules/contrib/views/views_bulk_operations/actions/modify.action.inc @@ -1,24 +1,30 @@ array( - 'type' => 'entity', - 'label' => t('Modify entity values'), - 'behavior' => array('changes_property'), - // This action only works when invoked through VBO. That's why it's - // declared as non-configurable to prevent it from being shown in the - // "Create an advanced action" dropdown on admin/config/system/actions. - 'configurable' => FALSE, - 'vbo_configurable' => TRUE, - 'triggers' => array('any'), - )); + return array( + 'views_bulk_operations_modify_action' => array( + 'type' => 'entity', + 'label' => t('Modify entity values'), + 'behavior' => array('changes_property'), + // This action only works when invoked through VBO. That's why it's + // declared as non-configurable to prevent it from being shown in the + // "Create an advanced action" dropdown on admin/config/system/actions. + 'configurable' => FALSE, + 'vbo_configurable' => TRUE, + 'triggers' => array('any'), + ), + ); } /** @@ -28,7 +34,7 @@ function views_bulk_operations_modify_action_info() { * replacing the existing values, or appending to them (based on user input). */ function views_bulk_operations_modify_action($entity, $context) { - list(,,$bundle_name) = entity_extract_ids($context['entity_type'], $entity); + list(,, $bundle_name) = entity_extract_ids($context['entity_type'], $entity); // Handle Field API fields. if (!empty($context['selected']['bundle_' . $bundle_name])) { // The pseudo entity is cloned so that changes to it don't get carried @@ -38,7 +44,7 @@ function views_bulk_operations_modify_action($entity, $context) { // Get this field's language. We can just pull it from the pseudo entity // as it was created using field_attach_form and entity_language so it's // already been figured out if this field is translatable or not and - // applied the appropriate language code to the field + // applied the appropriate language code to the field. $language = key($pseudo_entity->{$key}); // Replace any tokens that might exist in the field columns. foreach ($pseudo_entity->{$key}[$language] as $delta => &$item) { @@ -58,9 +64,11 @@ function views_bulk_operations_modify_action($entity, $context) { if ($field_info['cardinality'] != FIELD_CARDINALITY_UNLIMITED && $field_count > $field_info['cardinality']) { $entity_label = entity_label($context['entity_type'], $entity); $warning = t('Tried to set !field_count values for field !field_name that supports a maximum of !cardinality.', - array('!field_count' => $field_count, - '!field_name' => $field_info['field_name'], - '!cardinality' => $field_info['cardinality'])); + array( + '!field_count' => $field_count, + '!field_name' => $field_info['field_name'], + '!cardinality' => $field_info['cardinality'], + )); drupal_set_message($warning, 'warning', FALSE); } @@ -76,11 +84,17 @@ function views_bulk_operations_modify_action($entity, $context) { } // Handle properties. + // Use the wrapper to set property values, since some properties need + // additional massaging by their setter callbacks. + // The wrapper will automatically modify $entity itself. + $wrapper = entity_metadata_wrapper($context['entity_type'], $entity); + // The default setting for 'revision' property (create new revisions) should + // be respected for nodes. This requires some special treatment. + if ($context['entity_type'] == 'node' && in_array('revision', variable_get('node_options_' . $bundle_name)) && !in_array('revision', $context['selected']['properties'])) { + $wrapper->revision->set(1); + } + if (!empty($context['selected']['properties'])) { - // Use the wrapper to set property values, since some properties need - // additional massaging by their setter callbacks. - // The wrapper will automatically modify $entity itself. - $wrapper = entity_metadata_wrapper($context['entity_type'], $entity); foreach ($context['selected']['properties'] as $key) { if (!$wrapper->$key->access('update')) { // No access. @@ -113,7 +127,8 @@ function views_bulk_operations_modify_action($entity, $context) { * entity bundle, as provided by field_attach_form(). */ function views_bulk_operations_modify_action_form($context, &$form_state) { - // This action form uses admin-provided settings. If they were not set, pull the defaults now. + // This action form uses admin-provided settings. If they were not set, pull + // the defaults now. if (!isset($context['settings'])) { $context['settings'] = views_bulk_operations_modify_action_views_bulk_operations_form_options(); } @@ -126,7 +141,8 @@ function views_bulk_operations_modify_action_form($context, &$form_state) { // and filled with form data. // After submit, the pseudo-entities get passed to the actual action // (views_bulk_operations_modify_action()) which copies the data from the - // relevant pseudo-entity constructed here to the actual entity being modified. + // relevant pseudo-entity constructed here to the actual entity being + // modified. $form_state['entities'] = array(); $info = entity_get_info($entity_type); @@ -151,7 +167,16 @@ function views_bulk_operations_modify_action_form($context, &$form_state) { '#title' => $property['label'], ); - $determined_type = ($property['type'] == 'boolean') ? 'checkbox' : 'textfield'; + // According to _views_bulk_operations_modify_action_get_properties + // we have fixed list of supported types. Most of these types are string + // and only some of them has options list. + if (isset($property['options list'])) { + $determined_type = ($property['type'] == 'list') ? 'checkboxes' : 'select'; + } + else { + $determined_type = ($property['type'] == 'boolean') ? 'checkbox' : 'textfield'; + } + $form['properties'][$key] = array( '#type' => $determined_type, '#title' => $property['label'], @@ -189,7 +214,7 @@ function views_bulk_operations_modify_action_form($context, &$form_state) { } } - // Going to need this for multilingual nodes + // Going to need this for multilingual nodes. global $language; foreach ($bundles as $bundle_name => $bundle) { $bundle_key = $info['entity keys']['bundle']; @@ -202,8 +227,8 @@ function views_bulk_operations_modify_action_form($context, &$form_state) { $entity = entity_create($context['entity_type'], $default_values); $form_state['entities'][$bundle_name] = $entity; - // Show the more detailed label only if the entity type has multiple bundles. - // Otherwise, it would just be confusing. + // Show the more detailed label only if the entity type has multiple + // bundles. Otherwise, it would just be confusing. if (count($info['bundles']) > 1) { $label = t('Fields for @bundle_key @label', array('@bundle_key' => $bundle_key, '@label' => $bundle['label'])); } @@ -417,9 +442,9 @@ function views_bulk_operations_modify_action_submit($form, $form_state) { * Properties that can't be changed are entity keys, timestamps, and the ones * without a setter callback. * - * @param $entity_type + * @param string $entity_type * The entity type whose properties will be fetched. - * @param $display_values + * @param array $display_values * An optional, admin-provided list of properties and fields that should be * displayed for editing, used to filter the returned list of properties. */ @@ -435,8 +460,17 @@ function _views_bulk_operations_modify_action_get_properties($entity_type, $disp } } // List of supported types. - $supported_types = array('text', 'token', 'integer', 'decimal', 'date', 'duration', - 'boolean', 'uri', 'list'); + $supported_types = array( + 'text', + 'token', + 'integer', + 'decimal', + 'date', + 'duration', + 'boolean', + 'uri', + 'list', + ); $property_info = entity_get_property_info($entity_type); if (empty($property_info['properties'])) { // Stop here if no properties were found. @@ -484,9 +518,9 @@ function _views_bulk_operations_modify_action_get_properties($entity_type, $disp * (through the action settings) then only bundles that have at least one field * selected are returned. * - * @param $entity_type + * @param string $entity_type * The entity type whose bundles will be fetched. - * @param $context + * @param array $context * The VBO context variable. */ function _views_bulk_operations_modify_action_get_bundles($entity_type, $context) { @@ -594,8 +628,8 @@ function views_bulk_operations_modify_action_views_bulk_operations_form($options } foreach ($info['bundles'] as $bundle_name => $bundle) { $bundle_key = $info['entity keys']['bundle']; - // Show the more detailed label only if the entity type has multiple bundles. - // Otherwise, it would just be confusing. + // Show the more detailed label only if the entity type has multiple + // bundles. Otherwise, it would just be confusing. if (count($info['bundles']) > 1) { $label = t('Fields for @bundle_key @label', array('@bundle_key' => $bundle_key, '@label' => $bundle['label'])); } diff --git a/sites/all/modules/contrib/views/views_bulk_operations/actions/user_cancel.action.inc b/sites/all/modules/contrib/views/views_bulk_operations/actions/user_cancel.action.inc index 147d2920..3637e39c 100644 --- a/sites/all/modules/contrib/views/views_bulk_operations/actions/user_cancel.action.inc +++ b/sites/all/modules/contrib/views/views_bulk_operations/actions/user_cancel.action.inc @@ -1,17 +1,19 @@ array( - 'type' => 'user', - 'label' => t('Cancel user account'), - 'configurable' => TRUE, - 'behavior' => array('deletes_property'), - 'triggers' => array('any'), - )); + return array( + 'views_bulk_operations_user_cancel_action' => array( + 'type' => 'user', + 'label' => t('Cancel user account'), + 'configurable' => TRUE, + 'behavior' => array('deletes_property'), + 'triggers' => array('any'), + ), + ); } function views_bulk_operations_user_cancel_action_form($context) { @@ -75,7 +77,17 @@ function views_bulk_operations_user_cancel_action($account, $context) { if (!empty($context['user_cancel_notify'])) { _user_mail_notify('status_canceled', $account); } - user_delete($account->uid); + // In cases when nodes are to be reassigned to UID 0, the user_delete must + // not run until *after* the user_cancel has been invoked, otherwise the + // nodes are deleted before they can be reassigned. Adding the user delete + // to the batch queue ensures things happen in the correct sequence. + $batch = array( + 'operations' => array( + array('user_delete', array($account->uid)), + ), + 'file' => drupal_get_path('module', 'node') . '/node.admin.inc', + ); + batch_set($batch); watchdog('user', 'Deleted user: %name %email.', array('%name' => $account->name, '%email' => '<' . $account->mail . '>'), WATCHDOG_NOTICE); break; } diff --git a/sites/all/modules/contrib/views/views_bulk_operations/actions_permissions.info b/sites/all/modules/contrib/views/views_bulk_operations/actions_permissions.info index 658d1adc..11ff5235 100644 --- a/sites/all/modules/contrib/views/views_bulk_operations/actions_permissions.info +++ b/sites/all/modules/contrib/views/views_bulk_operations/actions_permissions.info @@ -3,9 +3,9 @@ description = Provides permission-based access control for actions. Used by View package = Administration core = 7.x -; Information added by Drupal.org packaging script on 2015-07-01 -version = "7.x-3.3" +; Information added by Drupal.org packaging script on 2017-02-21 +version = "7.x-3.4" core = "7.x" project = "views_bulk_operations" -datestamp = "1435764542" +datestamp = "1487698687" diff --git a/sites/all/modules/contrib/views/views_bulk_operations/css/views_bulk_operations.css b/sites/all/modules/contrib/views/views_bulk_operations/css/views_bulk_operations.css index a93cf22a..d26da62e 100644 --- a/sites/all/modules/contrib/views/views_bulk_operations/css/views_bulk_operations.css +++ b/sites/all/modules/contrib/views/views_bulk_operations/css/views_bulk_operations.css @@ -1,4 +1,5 @@ -.vbo-select-all-markup, .vbo-table-select-all-markup { +.vbo-select-all-markup, +.vbo-table-select-all-markup { display: none; } @@ -15,9 +16,10 @@ .views-table-row-select-all td { text-align: center; } -.vbo-table-select-all-pages, .vbo-table-select-this-page { - margin: 0 !important; - padding: 2px 5px !important; +.vbo-views-form .vbo-table-select-all-pages, +.vbo-views-form .vbo-table-select-this-page { + margin: 0; + padding: 2px 5px; } /* Generic "select all" */ @@ -30,6 +32,6 @@ margin-bottom: 0; } .vbo-fieldset-select-all div { - padding: 0 !important; - margin: 0 !important; + padding: 0; + margin: 0; } diff --git a/sites/all/modules/contrib/views/views_bulk_operations/js/views_bulk_operations.js b/sites/all/modules/contrib/views/views_bulk_operations/js/views_bulk_operations.js index ca76df86..a4e8237a 100644 --- a/sites/all/modules/contrib/views/views_bulk_operations/js/views_bulk_operations.js +++ b/sites/all/modules/contrib/views/views_bulk_operations/js/views_bulk_operations.js @@ -1,9 +1,17 @@ (function ($) { + // Polyfill for jQuery less than 1.6. + if (typeof $.fn.prop != 'function') { + jQuery.fn.extend({ + prop: jQuery.fn.attr + }); + } + Drupal.behaviors.vbo = { attach: function(context) { $('.vbo-views-form', context).each(function() { Drupal.vbo.initTableBehaviors(this); Drupal.vbo.initGenericBehaviors(this); + Drupal.vbo.toggleButtonsState(this); }); } } @@ -32,7 +40,8 @@ // This is the "select all" checkbox in (each) table header. $('.vbo-table-select-all', form).click(function() { var table = $(this).closest('table')[0]; - $('input[id^="edit-views-bulk-operations"]:not(:disabled)', table).attr('checked', this.checked); + $('input[id^="edit-views-bulk-operations"]:not(:disabled)', table).prop('checked', this.checked); + Drupal.vbo.toggleButtonsState(form); // Toggle the visibility of the "select all" row (if any). if (this.checked) { @@ -83,35 +92,43 @@ $('.vbo-select-all-markup', form).show(); $('.vbo-select-this-page', form).click(function() { - $('input[id^="edit-views-bulk-operations"]', form).attr('checked', this.checked); - $('.vbo-select-all-pages', form).attr('checked', false); + $('input[id^="edit-views-bulk-operations"]', form).prop('checked', this.checked); + Drupal.vbo.toggleButtonsState(form); + $('.vbo-select-all-pages', form).prop('checked', false); // Toggle the "select all" checkbox in grouped tables (if any). - $('.vbo-table-select-all', form).attr('checked', this.checked); + $('.vbo-table-select-all', form).prop('checked', this.checked); }); $('.vbo-select-all-pages', form).click(function() { - $('input[id^="edit-views-bulk-operations"]', form).attr('checked', this.checked); - $('.vbo-select-this-page', form).attr('checked', false); + $('input[id^="edit-views-bulk-operations"]', form).prop('checked', this.checked); + Drupal.vbo.toggleButtonsState(form); + $('.vbo-select-this-page', form).prop('checked', false); // Toggle the "select all" checkbox in grouped tables (if any). - $('.vbo-table-select-all', form).attr('checked', this.checked); + $('.vbo-table-select-all', form).prop('checked', this.checked); // Modify the value of the hidden form field. $('.select-all-rows', form).val(this.checked); }); + // Toggle submit buttons' "disabled" states with the state of the operation + // selectbox. + $('select[name="operation"]', form).change(function () { + Drupal.vbo.toggleButtonsState(form); + }); + $('.vbo-select', form).click(function() { // If a checkbox was deselected, uncheck any "select all" checkboxes. if (!this.checked) { - $('.vbo-select-this-page', form).attr('checked', false); - $('.vbo-select-all-pages', form).attr('checked', false); + $('.vbo-select-this-page', form).prop('checked', false); + $('.vbo-select-all-pages', form).prop('checked', false); // Modify the value of the hidden form field. $('.select-all-rows', form).val('0') var table = $(this).closest('table')[0]; if (table) { // Uncheck the "select all" checkbox in the table header. - $('.vbo-table-select-all', table).attr('checked', false); + $('.vbo-table-select-all', table).prop('checked', false); // If there's a "select all" row, hide it. if ($('.vbo-table-select-this-page', table).length) { @@ -121,7 +138,24 @@ } } } + + Drupal.vbo.toggleButtonsState(form); }); } + Drupal.vbo.toggleButtonsState = function(form) { + // If no rows are checked, disable any form submit actions. + var selectbox = $('select[name="operation"]', form); + var checkedCheckboxes = $('.vbo-select:checked', form); + var buttons = $('[id^="edit-select"] input[type="submit"]', form); + + if (selectbox.length) { + var has_selection = checkedCheckboxes.length && selectbox.val() !== '0'; + buttons.prop('disabled', !has_selection); + } + else { + buttons.prop('disabled', !checkedCheckboxes.length); + } + }; + })(jQuery); diff --git a/sites/all/modules/contrib/views/views_bulk_operations/views/views_bulk_operations.views.inc b/sites/all/modules/contrib/views/views_bulk_operations/views/views_bulk_operations.views.inc index 1c7078a5..e6c685a0 100644 --- a/sites/all/modules/contrib/views/views_bulk_operations/views/views_bulk_operations.views.inc +++ b/sites/all/modules/contrib/views/views_bulk_operations/views/views_bulk_operations.views.inc @@ -6,7 +6,8 @@ function views_bulk_operations_views_data_alter(&$data) { foreach (entity_get_info() as $entity_type => $info) { if (isset($info['base table']) && isset($data[$info['base table']]['table'])) { - $data[$info['base table']]['views_bulk_operations'] = array( + $data[$info['base table']]['views_bulk_operations']['moved to'] = array('views_entity_' . $entity_type, 'views_bulk_operations'); + $data['views_entity_' . $entity_type]['views_bulk_operations'] = array( 'title' => $data[$info['base table']]['table']['group'], 'group' => t('Bulk operations'), 'help' => t('Provide a checkbox to select the row for bulk operations.'), diff --git a/sites/all/modules/contrib/views/views_bulk_operations/views/views_bulk_operations_handler_field_operations.inc b/sites/all/modules/contrib/views/views_bulk_operations/views/views_bulk_operations_handler_field_operations.inc index 61886d48..dcfd5342 100644 --- a/sites/all/modules/contrib/views/views_bulk_operations/views/views_bulk_operations_handler_field_operations.inc +++ b/sites/all/modules/contrib/views/views_bulk_operations/views/views_bulk_operations_handler_field_operations.inc @@ -6,7 +6,7 @@ * Implements the Views Form API. */ -class views_bulk_operations_handler_field_operations extends views_handler_field { +class views_bulk_operations_handler_field_operations extends views_handler_field_entity { var $revision = FALSE; function init(&$view, &$options) { @@ -46,6 +46,12 @@ class views_bulk_operations_handler_field_operations extends views_handler_field unset($operation_options['use_queue']); } } + + // Check whether this is a revision. + $table_data = views_fetch_data($this->table); + if (!empty($table_data['table']['revision'])) { + $this->revision = TRUE; + } } function option_definition() { @@ -186,6 +192,14 @@ class views_bulk_operations_handler_field_operations extends views_handler_field $dom_id . '-selected' => array(1), ), ); + $form['vbo_operations'][$operation_id]['skip_permission_check'] = array( + '#type' => 'checkbox', + '#title' => t('Skip permission step'), + '#default_value' => !empty($operation_options['skip_permission_check']), + '#dependency' => array( + $dom_id . '-selected' => array(1), + ), + ); $form['vbo_operations'][$operation_id] += $operation->adminOptionsForm($dom_id, $this); } @@ -263,19 +277,20 @@ class views_bulk_operations_handler_field_operations extends views_handler_field // At this point, the query has already been run, so we can access the results // in order to get the base key value (for example, nid for nodes). foreach ($this->view->result as $row_index => $row) { - $entity_id = $this->get_value($row); + $this->view->row_index = $row_index; + $id = $this->get_value($row, $this->real_field); if ($this->options['vbo_settings']['force_single']) { $form[$this->options['id']][$row_index] = array( '#type' => 'radio', '#parents' => array($this->options['id']), - '#return_value' => $entity_id, + '#return_value' => $id, ); } else { $form[$this->options['id']][$row_index] = array( '#type' => 'checkbox', - '#return_value' => $entity_id, + '#return_value' => $id, '#default_value' => FALSE, '#attributes' => array('class' => array('vbo-select')), ); @@ -293,9 +308,12 @@ class views_bulk_operations_handler_field_operations extends views_handler_field if (empty($options['selected'])) { continue; } - $operation = views_bulk_operations_get_operation($operation_id, $entity_type, $options); - if (!$operation || !$operation->access($user)) { + if (!$operation) { + continue; + } + $skip_permission_check = $operation->getAdminOption('skip_permission_check', FALSE); + if (!$operation->access($user) && !$skip_permission_check) { continue; } $selected[$operation_id] = $operation; @@ -318,29 +336,7 @@ class views_bulk_operations_handler_field_operations extends views_handler_field * the entity type that VBO is operating on. */ public function get_entity_type() { - $base_table = $this->view->base_table; - - // If the current field is under a relationship you can't be sure that the - // base table of the view is the base table of the current field. - // For example a field from a node author on a node view does have users as base table. - if (!empty($this->options['relationship']) && $this->options['relationship'] != 'none') { - $relationships = $this->view->display_handler->get_option('relationships'); - $options = $relationships[$this->options['relationship']]; - $data = views_fetch_data($options['table']); - $base_table = $data[$options['field']]['relationship']['base']; - } - // The base table is now known, use it to determine the entity type. - foreach (entity_get_info() as $entity_type => $info) { - if (isset($info['base table']) && $info['base table'] == $base_table) { - return $entity_type; - } - elseif (isset($info['revision table']) && $info['revision table'] == $base_table) { - $this->revision = TRUE; - return $entity_type; - } - } - // This should never happen. - _views_bulk_operations_report_error("Could not determine the entity type for VBO field on views base table %table", array('%table' => $base_table)); - return FALSE; + return $this->entity_type; } + } diff --git a/sites/all/modules/contrib/views/views_bulk_operations/views_bulk_operations.drush.inc b/sites/all/modules/contrib/views/views_bulk_operations/views_bulk_operations.drush.inc index 09c4fb63..e9ca1929 100644 --- a/sites/all/modules/contrib/views/views_bulk_operations/views_bulk_operations.drush.inc +++ b/sites/all/modules/contrib/views/views_bulk_operations/views_bulk_operations.drush.inc @@ -154,7 +154,7 @@ function views_bulk_operations_drush_execute($vid = NULL, $operation_id = NULL) $current = 1; foreach ($view->result as $row_index => $result) { $rows[$row_index] = array( - 'entity_id' => $vbo->get_value($result), + 'entity_id' => $result->{$vbo->real_field}, 'views_row' => array(), 'position' => array( 'current' => $current++, diff --git a/sites/all/modules/contrib/views/views_bulk_operations/views_bulk_operations.info b/sites/all/modules/contrib/views/views_bulk_operations/views_bulk_operations.info index 8fbdffaa..b16bf0e0 100644 --- a/sites/all/modules/contrib/views/views_bulk_operations/views_bulk_operations.info +++ b/sites/all/modules/contrib/views/views_bulk_operations/views_bulk_operations.info @@ -1,7 +1,7 @@ name = Views Bulk Operations description = Provides a way of selecting multiple rows and applying operations to them. dependencies[] = entity -dependencies[] = views +dependencies[] = views (>=3.12) package = Views core = 7.x php = 5.2.9 @@ -9,9 +9,9 @@ php = 5.2.9 files[] = plugins/operation_types/base.class.php files[] = views/views_bulk_operations_handler_field_operations.inc -; Information added by Drupal.org packaging script on 2015-07-01 -version = "7.x-3.3" +; Information added by Drupal.org packaging script on 2017-02-21 +version = "7.x-3.4" core = "7.x" project = "views_bulk_operations" -datestamp = "1435764542" +datestamp = "1487698687" diff --git a/sites/all/modules/contrib/views/views_bulk_operations/views_bulk_operations.module b/sites/all/modules/contrib/views/views_bulk_operations/views_bulk_operations.module index e74eeb1d..9b17c444 100644 --- a/sites/all/modules/contrib/views/views_bulk_operations/views_bulk_operations.module +++ b/sites/all/modules/contrib/views/views_bulk_operations/views_bulk_operations.module @@ -45,6 +45,7 @@ function views_bulk_operations_load_action_includes() { 'archive.action', 'argument_selector.action', 'book.action', + 'change_owner.action', 'delete.action', 'modify.action', 'script.action', @@ -75,7 +76,7 @@ function views_bulk_operations_load_action_includes() { */ function views_bulk_operations_cron() { db_delete('queue') - ->condition('name', db_like('views_bulk_operations_active_queue_'), 'LIKE') + ->condition('name', db_like('views_bulk_operations_active_queue_') . '%', 'LIKE') ->condition('created', REQUEST_TIME - 86400, '<') ->execute(); } @@ -214,7 +215,12 @@ function views_bulk_operations_get_operation_info($operation_id = NULL) { function views_bulk_operations_get_operation($operation_id, $entity_type, $options) { $operations = &drupal_static(__FUNCTION__); - if (!isset($operations[$operation_id])) { + // Create a unique hash of the options. + $cid = md5(serialize($options)); + + // See if there's a cached copy of the operation, including entity type and + // options. + if (!isset($operations[$operation_id][$entity_type][$cid])) { // Intentionally not using views_bulk_operations_get_operation_info() here // since it's an expensive function that loads all the operations on the // system, despite the fact that we might only need a few. @@ -223,14 +229,14 @@ function views_bulk_operations_get_operation($operation_id, $entity_type, $optio $operation_info = $plugin['list callback']($operation_id); if ($operation_info) { - $operations[$operation_id] = new $plugin['handler']['class']($operation_id, $entity_type, $operation_info, $options); + $operations[$operation_id][$entity_type][$cid] = new $plugin['handler']['class']($operation_id, $entity_type, $operation_info, $options); } else { - $operations[$operation_id] = FALSE; + $operations[$operation_id][$entity_type][$cid] = FALSE; } } - return $operations[$operation_id]; + return $operations[$operation_id][$entity_type][$cid]; } /** @@ -638,11 +644,11 @@ function theme_views_bulk_operations_confirmation($variables) { // All rows on all pages have been selected, so show a count of additional items. if ($select_all_pages) { $more_count = $vbo->view->total_rows - count($vbo->view->result); - $items[] = t('...and !count more.', array('!count' => $more_count)); + $items[] = t('...and %count more.', array('%count' => $more_count)); } $count = format_plural(count($entities), 'item', '@count items'); - $output = theme('item_list', array('items' => $items, 'title' => t('You selected the following !count:', array('!count' => $count)))); + $output = theme('item_list', array('items' => $items, 'title' => t('You selected the following %count:', array('%count' => $count)))); return $output; } @@ -902,10 +908,16 @@ function views_bulk_operations_adjust_selection($queue_name, $operation, $option } $vbo = _views_bulk_operations_get_field($view); + + // Call views_handler_field_entity::pre_render() to get the entities. + $vbo->pre_render($view->result); + $rows = array(); foreach ($view->result as $row_index => $result) { + // Set the row index. + $view->row_index = $row_index; $rows[$row_index] = array( - 'entity_id' => $vbo->get_value($result), + 'entity_id' => $vbo->get_value($result, $vbo->real_field), 'views_row' => array(), 'position' => array( 'current' => ++$context['sandbox']['progress'], @@ -1075,7 +1087,8 @@ function views_bulk_operations_queue_item_process($queue_item_data, &$log = NULL } // If the current entity can't be accessed, skip it and log a notice. - if (!_views_bulk_operations_entity_access($operation, $entity_type, $entity, $account)) { + $skip_permission_check = $operation->getAdminOption('skip_permission_check'); + if (!$skip_permission_check && !_views_bulk_operations_entity_access($operation, $entity_type, $entity, $account)) { $message = 'Skipped %operation on @type %title due to insufficient permissions.'; $arguments = array( '%operation' => $operation->label(), @@ -1127,12 +1140,22 @@ function views_bulk_operations_direct_adjust(&$selection, $vbo) { if ($field_name != $vbo->options['id']) { unset($view->field[$field_name]); } + else { + // Get hold of the new VBO field. + $new_vbo = $view->field[$field_name]; + } } $view->execute($vbo->view->current_display); + + // Call views_handler_field_entity::pre_render() to get the entities. + $new_vbo->pre_render($view->result); + $results = array(); foreach ($view->result as $row_index => $result) { - $results[$row_index] = $vbo->get_value($result); + // Set the row index. + $view->row_index = $row_index; + $results[$row_index] = $new_vbo->get_value($result, $new_vbo->real_field); } $selection = $results; } @@ -1160,9 +1183,10 @@ function views_bulk_operations_direct_process($operation, $rows, $options) { } $entities = _views_bulk_operations_entity_load($entity_type, $entity_ids, $options['revision']); + $skip_permission_check = $operation->getAdminOption('skip_permission_check'); // Filter out entities that can't be accessed. foreach ($entities as $id => $entity) { - if (!_views_bulk_operations_entity_access($operation, $entity_type, $entity)) { + if (!$skip_permission_check && !_views_bulk_operations_entity_access($operation, $entity_type, $entity, $account)) { $context['results']['log'][] = t('Skipped %operation on @type %title due to insufficient permissions.', array( '%operation' => $operation->label(), '@type' => $entity_type, diff --git a/sites/all/modules/contrib/views/views_bulk_operations/views_bulk_operations.rules.inc b/sites/all/modules/contrib/views/views_bulk_operations/views_bulk_operations.rules.inc index b3a64184..1273552e 100644 --- a/sites/all/modules/contrib/views/views_bulk_operations/views_bulk_operations.rules.inc +++ b/sites/all/modules/contrib/views/views_bulk_operations/views_bulk_operations.rules.inc @@ -114,15 +114,25 @@ function views_bulk_operations_rules_action_info() { function views_bulk_operations_views_list() { $selectable_displays = array(); foreach (views_get_enabled_views() as $name => $base_view) { + $view = $base_view->clone_view(); foreach ($base_view->display as $display_name => $display) { - $view = $base_view->clone_view(); - $view->build($display_name); - $vbo = _views_bulk_operations_get_field($view); - if ($vbo) { - $selectable_displays[$view->name . '|' . $display_name] = check_plain($view->human_name) . ' | ' . check_plain($display->display_title); + if (!$view->set_display($display_name)) { + continue; + } + + // Initialize the style plugin and only continue to initialize handlers + // if the style uses fields. + if (!$view->init_style() || !$view->style_plugin->uses_fields()) { + continue; + } + + $view->init_handlers($display_name); + if (_views_bulk_operations_get_field($view)) { + $selectable_displays[$view->name . '|' . $display_name] = check_plain($view->human_name . ' | ' . $display->display_title); } } } + return $selectable_displays; } diff --git a/themes/bartik/bartik.info b/themes/bartik/bartik.info index 007d0a53..e2cff220 100644 --- a/themes/bartik/bartik.info +++ b/themes/bartik/bartik.info @@ -34,8 +34,8 @@ regions[footer] = Footer settings[shortcut_module_link] = 0 -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/themes/garland/garland.info b/themes/garland/garland.info index 00920141..c573f6a6 100644 --- a/themes/garland/garland.info +++ b/themes/garland/garland.info @@ -7,8 +7,8 @@ stylesheets[all][] = style.css stylesheets[print][] = print.css settings[garland_width] = fluid -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/themes/seven/seven.info b/themes/seven/seven.info index 85e22afd..a7878569 100644 --- a/themes/seven/seven.info +++ b/themes/seven/seven.info @@ -13,8 +13,8 @@ regions[page_bottom] = Page bottom regions[sidebar_first] = First sidebar regions_hidden[] = sidebar_first -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921" diff --git a/themes/stark/stark.info b/themes/stark/stark.info index 651c4fa7..bd8cdae2 100644 --- a/themes/stark/stark.info +++ b/themes/stark/stark.info @@ -5,8 +5,8 @@ version = VERSION core = 7.x stylesheets[all][] = layout.css -; Information added by Drupal.org packaging script on 2016-12-07 -version = "7.53" +; Information added by Drupal.org packaging script on 2017-02-01 +version = "7.54" project = "drupal" -datestamp = "1481152423" +datestamp = "1485986921"