diff --git a/core/MAINTAINERS.txt b/core/MAINTAINERS.txt index a7e346e42a1419906d64c2d942ae72b28c935d03..2417e8ed611fad21f7260dc709df7b2359dd5568 100644 --- a/core/MAINTAINERS.txt +++ b/core/MAINTAINERS.txt @@ -58,7 +58,7 @@ Database system - Károly Négyesi 'chx' <http://drupal.org/user/9446> Database update system -- ? +- Ashok Modi 'btmash' <http://drupal.org/user/60422> Entity system - Wolfgang Ziegler 'fago' <http://drupal.org/user/16747> diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 6954c4d9b45bcc5220e5198552f8dae1b28824a7..c26ec86293be5eac7a4bab8b336a50514258b252 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -265,7 +265,7 @@ /** * Regular expression to match PHP function names. * - * @see http://php.net/manual/en/language.functions.php + * @see http://php.net/manual/language.functions.php */ const DRUPAL_PHP_FUNCTION_PATTERN = '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'; @@ -3029,8 +3029,8 @@ function registry_update() { * However, the above line of code does not work, because PHP only allows static * variables to be initializied by literal values, and does not allow static * variables to be assigned to references. - * - http://php.net/manual/en/language.variables.scope.php#language.variables.scope.static - * - http://php.net/manual/en/language.variables.scope.php#language.variables.scope.references + * - http://php.net/manual/language.variables.scope.php#language.variables.scope.static + * - http://php.net/manual/language.variables.scope.php#language.variables.scope.references * The example below shows the syntax needed to work around both limitations. * For benchmarks and more information, see http://drupal.org/node/619666. * diff --git a/core/includes/common.inc b/core/includes/common.inc index 5a146a8b097e128aac2c8949dd9b2df337b2f1c7..70395ba8c4baf1cc53d7829bb031bd8e7fd09f01 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -1059,7 +1059,7 @@ function _fix_gpc_magic(&$item) { * @param $key * The key for the item within $_FILES. * - * @see http://php.net/manual/en/features.file-upload.php#42280 + * @see http://php.net/manual/features.file-upload.php#42280 */ function _fix_gpc_magic_files(&$item, $key) { if ($key != 'tmp_name') { @@ -1883,7 +1883,7 @@ function format_interval($interval, $granularity = 2, $langcode = NULL) { * get interpreted as date format characters. * @param $timezone * (optional) Time zone identifier, as described at - * http://php.net/manual/en/timezones.php Defaults to the time zone used to + * http://php.net/manual/timezones.php Defaults to the time zone used to * display the page. * @param $langcode * (optional) Language code to translate to. Defaults to the language used to @@ -3644,7 +3644,7 @@ function drupal_load_stylesheet_content($contents, $optimize = FALSE) { // Remove certain whitespace. // There are different conditions for removing leading and trailing // whitespace. - // @see http://php.net/manual/en/regexp.reference.subpatterns.php + // @see http://php.net/manual/regexp.reference.subpatterns.php $contents = preg_replace('< # Strip leading and trailing whitespace. \s*([@{};,])\s* @@ -5193,7 +5193,7 @@ function _drupal_bootstrap_full() { * client without gzip support. * * Page compression requires the PHP zlib extension - * (http://php.net/manual/en/ref.zlib.php). + * (http://php.net/manual/ref.zlib.php). * * @see drupal_page_header() */ @@ -6984,6 +6984,9 @@ function drupal_common_theme() { 'textarea' => array( 'render element' => 'element', ), + 'search' => array( + 'render element' => 'element', + ), 'password' => array( 'render element' => 'element', ), diff --git a/core/includes/errors.inc b/core/includes/errors.inc index bfdd712475443e92a1c68f9f51c2de7d306aa517..0524170dfbf307d07aa84c0ca9960c2be2a18b4a 100644 --- a/core/includes/errors.inc +++ b/core/includes/errors.inc @@ -24,7 +24,7 @@ * Maps PHP error constants to watchdog severity levels. * * The error constants are documented at - * http://php.net/manual/en/errorfunc.constants.php + * http://php.net/manual/errorfunc.constants.php * * @ingroup logging_severity_levels */ diff --git a/core/includes/file.inc b/core/includes/file.inc index 2771f62cab9f0ce26b9fb44b3d24c0c6f063b34c..eaff634e2778885e46c6ba35d591ecc229ce6893 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -1494,7 +1494,7 @@ function file_save_upload($source, $validators = array(), $destination = FALSE, // Check for file upload errors and return FALSE if a lower level system // error occurred. For a complete list of errors: - // See http://php.net/manual/en/features.file-upload.errors.php. + // See http://php.net/manual/features.file-upload.errors.php. switch ($_FILES['files']['error'][$source]) { case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: @@ -2253,7 +2253,7 @@ function drupal_chmod($uri, $mode = NULL) { * @param $uri * A URI or pathname. * @param $context - * Refer to http://php.net/manual/en/ref.stream.php + * Refer to http://php.net/manual/ref.stream.php * * @return * Boolean TRUE on success, or FALSE on failure. @@ -2388,7 +2388,7 @@ function drupal_basename($uri, $suffix = NULL) { * @param $recursive * Default to FALSE. * @param $context - * Refer to http://php.net/manual/en/ref.stream.php + * Refer to http://php.net/manual/ref.stream.php * * @return * Boolean TRUE on success, or FALSE on failure. @@ -2419,7 +2419,7 @@ function drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL) { * @param $uri * A URI or pathname. * @param $context - * Refer to http://php.net/manual/en/ref.stream.php + * Refer to http://php.net/manual/ref.stream.php * * @return * Boolean TRUE on success, or FALSE on failure. diff --git a/core/includes/form.inc b/core/includes/form.inc index c3571f4e5279134af76bb0a22bb6702079042947..65c462a866dfb8f8797479d328b5494760207eeb 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -3094,7 +3094,7 @@ function form_pre_render_conditional_form_element($element) { $element['#attributes']['title'] = $element['#title']; if (!empty($element['#required'])) { // Append an indication that this field is required. - $element['#attributes']['title'] .= ' (' . t('Required') . ')'; + $element['#attributes']['title'] .= ' (' . $t('Required') . ')'; } } @@ -3104,6 +3104,19 @@ function form_pre_render_conditional_form_element($element) { return $element; } +/** + * Processes a form button element. + */ +function form_process_button($element, $form_state) { + // If this is a button intentionally allowing incomplete form submission + // (e.g., a "Previous" or "Add another item" button), then also skip + // client-side validation. + if (isset($element['#limit_validation_errors']) && $element['#limit_validation_errors'] !== FALSE) { + $element['#attributes']['formnovalidate'] = 'formnovalidate'; + } + return $element; +} + /** * Sets the #checked property of a checkbox element. */ @@ -3930,6 +3943,42 @@ function theme_url($variables) { return $output . $extra; } +/** + * Returns HTML for a search form element. + * + * @param $variables + * An associative array containing: + * - element: An associative array containing the properties of the element. + * Properties used: #title, #value, #description, #size, #maxlength, + * #placeholder, #required, #attributes, #autocomplete_path. + * + * @ingroup themeable + */ +function theme_search($variables) { + $element = $variables['element']; + $element['#attributes']['type'] = 'search'; + element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength', 'placeholder')); + _form_set_class($element, array('form-search')); + + $extra = ''; + if ($element['#autocomplete_path'] && drupal_valid_path($element['#autocomplete_path'])) { + drupal_add_library('system', 'drupal.autocomplete'); + $element['#attributes']['class'][] = 'form-autocomplete'; + + $attributes = array(); + $attributes['type'] = 'hidden'; + $attributes['id'] = $element['#attributes']['id'] . '-autocomplete'; + $attributes['value'] = url($element['#autocomplete_path'], array('absolute' => TRUE)); + $attributes['disabled'] = 'disabled'; + $attributes['class'][] = 'autocomplete'; + $extra = '<input' . drupal_attributes($attributes) . ' />'; + } + + $output = '<input' . drupal_attributes($element['#attributes']) . ' />'; + + return $output . $extra; +} + /** * Form element validation handler for #type 'url'. * @@ -4276,6 +4325,10 @@ function _form_set_class(&$element, $class = array()) { // form_builder(). if (!empty($element['#required'])) { $element['#attributes']['class'][] = 'required'; + // @todo Rename the _form_set_class() function to reflect that we're setting + // non-class attributes too. + $element['#attributes']['required'] = 'required'; + $element['#attributes']['aria-required'] = 'true'; } if (isset($element['#parents']) && form_get_error($element)) { $element['#attributes']['class'][] = 'error'; diff --git a/core/includes/menu.inc b/core/includes/menu.inc index 2121619db5fd72df3295b0d9d7d9e2778fb0eaea..511c5d09dfc5c86668f5bbca8de3e2b2c0525a29 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -2292,6 +2292,9 @@ function menu_get_active_menu_names() { */ function menu_set_active_item($path) { $_GET['q'] = $path; + // Since the active item has changed, the active menu trail may also be out + // of date. + drupal_static_reset('menu_set_active_trail'); } /** @@ -2377,7 +2380,7 @@ function menu_set_active_trail($new_trail = NULL) { // appending either the preferred link or the menu router item for the // current page. Exclude it if we are on the front page. $last = end($trail); - if ($last['href'] != $preferred_link['href'] && !drupal_is_front_page()) { + if ($preferred_link && $last['href'] != $preferred_link['href'] && !drupal_is_front_page()) { $trail[] = $preferred_link; } } @@ -3102,10 +3105,10 @@ function menu_link_save(&$item, $existing_item = array(), $parent_candidates = a } // If every value in $existing_item is the same in the $item, there is no // reason to run the update queries or clear the caches. We use - // array_intersect_assoc() with the $item as the first parameter because + // array_intersect_key() with the $item as the first parameter because // $item may have additional keys left over from building a router entry. // The intersect removes the extra keys, allowing a meaningful comparison. - if (!$existing_item || (array_intersect_assoc($item, $existing_item)) != $existing_item) { + if (!$existing_item || (array_intersect_key($item, $existing_item)) != $existing_item) { db_update('menu_links') ->fields(array( 'menu_name' => $item['menu_name'], diff --git a/core/lib/Drupal/Core/Config/DrupalConfig.php b/core/lib/Drupal/Core/Config/DrupalConfig.php index 2f688b44d71156faf4ce6ee16073d31e229e6a89..9fc33aac20f9571c8c5b617e288425993ed2c557 100644 --- a/core/lib/Drupal/Core/Config/DrupalConfig.php +++ b/core/lib/Drupal/Core/Config/DrupalConfig.php @@ -81,7 +81,7 @@ public function isOverridden($key) { * cause issues with Booleans, which are casted to "1" (TRUE) or "0" (FALSE). * In particular, code relying on === or !== will no longer function properly. * - * @see http://php.net/manual/en/language.operators.comparison.php. + * @see http://php.net/manual/language.operators.comparison.php. * * @return * The data that was requested. diff --git a/core/lib/Drupal/Core/Database/Connection.php b/core/lib/Drupal/Core/Database/Connection.php index 6e9e44aec14605fc8b6f902a49e2937ef0b03126..3805864926f90f0019154e354c188a6135c0d4a6 100644 --- a/core/lib/Drupal/Core/Database/Connection.php +++ b/core/lib/Drupal/Core/Database/Connection.php @@ -21,7 +21,7 @@ * concrete implementation of it to support special handling required by that * database. * - * @see http://php.net/manual/en/book.pdo.php + * @see http://php.net/manual/book.pdo.php */ abstract class Connection extends PDO { diff --git a/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php b/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php index 3b62fa703a09b99f94f8bf510ebea33cbe9bbfe8..0e7ab721ef31988e0b4a143f216a78f4b24615f6 100644 --- a/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php +++ b/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php @@ -55,8 +55,6 @@ public function __construct(array $connection_options = array()) { PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => TRUE, // Because MySQL's prepared statements skip the query cache, because it's dumb. PDO::ATTR_EMULATE_PREPARES => TRUE, - // Force column names to lower case. - PDO::ATTR_CASE => PDO::CASE_LOWER, ); parent::__construct($dsn, $connection_options['username'], $connection_options['password'], $connection_options['pdo']); diff --git a/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php b/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php index 24c3b4a6b11ac9125df1e8c1dab57df603773b41..f5e493d962361fcd995fa58d208a2d7243a508d7 100644 --- a/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php +++ b/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php @@ -390,7 +390,7 @@ public function indexExists($table, $name) { // Returns one row for each column in the index. Result is string or FALSE. // Details at http://dev.mysql.com/doc/refman/5.0/en/show-index.html $row = $this->connection->query('SHOW INDEX FROM {' . $table . "} WHERE key_name = '$name'")->fetchAssoc(); - return isset($row['key_name']); + return isset($row['Key_name']); } public function addPrimaryKey($table, $fields) { diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php index 6903a141991d02d143e89f6589a60c73ed8ea731..129ca42fec0c28c8d6cd96646f9ec35a261dd92c 100644 --- a/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php +++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php @@ -71,8 +71,6 @@ public function __construct(array $connection_options = array()) { PDO::ATTR_EMULATE_PREPARES => TRUE, // Convert numeric values to strings when fetching. PDO::ATTR_STRINGIFY_FETCHES => TRUE, - // Force column names to lower case. - PDO::ATTR_CASE => PDO::CASE_LOWER, ); parent::__construct($dsn, $connection_options['username'], $connection_options['password'], $connection_options['pdo']); diff --git a/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php b/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php index 1587a632dd0812e27e694a503ae9956ffaff3cd4..02a55a4530a53b070158cd03a44e1b19fc2e560a 100644 --- a/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php +++ b/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php @@ -73,8 +73,6 @@ public function __construct(array $connection_options = array()) { 'pdo' => array(), ); $connection_options['pdo'] += array( - // Force column names to lower case. - PDO::ATTR_CASE => PDO::CASE_LOWER, // Convert numeric values to strings when fetching. PDO::ATTR_STRINGIFY_FETCHES => TRUE, ); diff --git a/core/lib/Drupal/Core/Database/Statement.php b/core/lib/Drupal/Core/Database/Statement.php index 7b23ed3d6a04e29f8032e6713fe0821ba1a6313d..c5b1735e33c876b7f9b3ca236456089e45be5b1e 100644 --- a/core/lib/Drupal/Core/Database/Statement.php +++ b/core/lib/Drupal/Core/Database/Statement.php @@ -19,7 +19,7 @@ * driver needs to set a custom statement class, it may do so in its * constructor. * - * @see http://us.php.net/pdostatement + * @see http://php.net/pdostatement */ class Statement extends PDOStatement implements StatementInterface { diff --git a/core/lib/Drupal/Core/Database/StatementInterface.php b/core/lib/Drupal/Core/Database/StatementInterface.php index 2fb57fcf14a752b4452c38d021c6737a78a3c024..7f1ca4a09172da3d71c6f4e55b0f882b783d9004 100644 --- a/core/lib/Drupal/Core/Database/StatementInterface.php +++ b/core/lib/Drupal/Core/Database/StatementInterface.php @@ -64,7 +64,7 @@ public function rowCount(); /** * Sets the default fetch mode for this statement. * - * See http://php.net/manual/en/pdo.constants.php for the definition of the + * See http://php.net/manual/pdo.constants.php for the definition of the * constants used. * * @param $mode @@ -83,7 +83,7 @@ public function rowCount(); /** * Fetches the next row from a result set. * - * See http://php.net/manual/en/pdo.constants.php for the definition of the + * See http://php.net/manual/pdo.constants.php for the definition of the * constants used. * * @param $mode diff --git a/core/lib/Drupal/Core/Database/StatementPrefetch.php b/core/lib/Drupal/Core/Database/StatementPrefetch.php index f860a9ff0909bf9e0d67bdba91a3a2afe13e7068..18dd5826a66a0c61a47ecc1480971619317d8ba8 100644 --- a/core/lib/Drupal/Core/Database/StatementPrefetch.php +++ b/core/lib/Drupal/Core/Database/StatementPrefetch.php @@ -291,7 +291,7 @@ public function current() { $class_name = $this->fetchOptions['class']; } if (count($this->fetchOptions['constructor_args'])) { - $reflector = new ReflectionClass($class_name); + $reflector = new \ReflectionClass($class_name); $result = $reflector->newInstanceArgs($this->fetchOptions['constructor_args']); } else { diff --git a/core/lib/Drupal/Core/StreamWrapper/LocalStream.php b/core/lib/Drupal/Core/StreamWrapper/LocalStream.php index 9f2b95ded36d83455237ca256c988c56956ff8de..0cd76e0c8c1d2a186d6038ee009f27b030ff0b7a 100644 --- a/core/lib/Drupal/Core/StreamWrapper/LocalStream.php +++ b/core/lib/Drupal/Core/StreamWrapper/LocalStream.php @@ -189,7 +189,7 @@ protected function getLocalPath($uri = NULL) { * @return bool * Returns TRUE if file was opened successfully. * - * @see http://php.net/manual/en/streamwrapper.stream-open.php + * @see http://php.net/manual/streamwrapper.stream-open.php */ public function stream_open($uri, $mode, $options, &$opened_path) { $this->uri = $uri; @@ -217,7 +217,7 @@ public function stream_open($uri, $mode, $options, &$opened_path) { * @return bool * Always returns TRUE at the present time. * - * @see http://php.net/manual/en/streamwrapper.stream-lock.php + * @see http://php.net/manual/streamwrapper.stream-lock.php */ public function stream_lock($operation) { if (in_array($operation, array(LOCK_SH, LOCK_EX, LOCK_UN, LOCK_NB))) { @@ -236,7 +236,7 @@ public function stream_lock($operation) { * @return string|bool * The string that was read, or FALSE in case of an error. * - * @see http://php.net/manual/en/streamwrapper.stream-read.php + * @see http://php.net/manual/streamwrapper.stream-read.php */ public function stream_read($count) { return fread($this->handle, $count); @@ -251,7 +251,7 @@ public function stream_read($count) { * @return int * The number of bytes written. * - * @see http://php.net/manual/en/streamwrapper.stream-write.php + * @see http://php.net/manual/streamwrapper.stream-write.php */ public function stream_write($data) { return fwrite($this->handle, $data); @@ -263,7 +263,7 @@ public function stream_write($data) { * @return bool * TRUE if end-of-file has been reached. * - * @see http://php.net/manual/en/streamwrapper.stream-eof.php + * @see http://php.net/manual/streamwrapper.stream-eof.php */ public function stream_eof() { return feof($this->handle); @@ -280,7 +280,7 @@ public function stream_eof() { * @return bool * TRUE on success. * - * @see http://php.net/manual/en/streamwrapper.stream-seek.php + * @see http://php.net/manual/streamwrapper.stream-seek.php */ public function stream_seek($offset, $whence) { // fseek returns 0 on success and -1 on a failure. @@ -294,7 +294,7 @@ public function stream_seek($offset, $whence) { * @return bool * TRUE if data was successfully stored (or there was no data to store). * - * @see http://php.net/manual/en/streamwrapper.stream-flush.php + * @see http://php.net/manual/streamwrapper.stream-flush.php */ public function stream_flush() { return fflush($this->handle); @@ -306,7 +306,7 @@ public function stream_flush() { * @return bool * The current offset in bytes from the beginning of file. * - * @see http://php.net/manual/en/streamwrapper.stream-tell.php + * @see http://php.net/manual/streamwrapper.stream-tell.php */ public function stream_tell() { return ftell($this->handle); @@ -319,7 +319,7 @@ public function stream_tell() { * An array with file status, or FALSE in case of an error - see fstat() * for a description of this array. * - * @see http://php.net/manual/en/streamwrapper.stream-stat.php + * @see http://php.net/manual/streamwrapper.stream-stat.php */ public function stream_stat() { return fstat($this->handle); @@ -331,7 +331,7 @@ public function stream_stat() { * @return bool * TRUE if stream was successfully closed. * - * @see http://php.net/manual/en/streamwrapper.stream-close.php + * @see http://php.net/manual/streamwrapper.stream-close.php */ public function stream_close() { return fclose($this->handle); @@ -346,7 +346,7 @@ public function stream_close() { * @return bool * TRUE if resource was successfully deleted. * - * @see http://php.net/manual/en/streamwrapper.unlink.php + * @see http://php.net/manual/streamwrapper.unlink.php */ public function unlink($uri) { $this->uri = $uri; @@ -364,7 +364,7 @@ public function unlink($uri) { * @return bool * TRUE if file was successfully renamed. * - * @see http://php.net/manual/en/streamwrapper.rename.php + * @see http://php.net/manual/streamwrapper.rename.php */ public function rename($from_uri, $to_uri) { return rename($this->getLocalPath($from_uri), $this->getLocalPath($to_uri)); @@ -410,7 +410,7 @@ public function dirname($uri = NULL) { * @return bool * TRUE if directory was successfully created. * - * @see http://php.net/manual/en/streamwrapper.mkdir.php + * @see http://php.net/manual/streamwrapper.mkdir.php */ public function mkdir($uri, $mode, $options) { $this->uri = $uri; @@ -442,7 +442,7 @@ public function mkdir($uri, $mode, $options) { * @return bool * TRUE if directory was successfully removed. * - * @see http://php.net/manual/en/streamwrapper.rmdir.php + * @see http://php.net/manual/streamwrapper.rmdir.php */ public function rmdir($uri, $options) { $this->uri = $uri; @@ -466,7 +466,7 @@ public function rmdir($uri, $options) { * An array with file status, or FALSE in case of an error - see fstat() * for a description of this array. * - * @see http://php.net/manual/en/streamwrapper.url-stat.php + * @see http://php.net/manual/streamwrapper.url-stat.php */ public function url_stat($uri, $flags) { $this->uri = $uri; @@ -492,7 +492,7 @@ public function url_stat($uri, $flags) { * @return bool * TRUE on success. * - * @see http://php.net/manual/en/streamwrapper.dir-opendir.php + * @see http://php.net/manual/streamwrapper.dir-opendir.php */ public function dir_opendir($uri, $options) { $this->uri = $uri; @@ -507,7 +507,7 @@ public function dir_opendir($uri, $options) { * @return string * The next filename, or FALSE if there are no more files in the directory. * - * @see http://php.net/manual/en/streamwrapper.dir-readdir.php + * @see http://php.net/manual/streamwrapper.dir-readdir.php */ public function dir_readdir() { return readdir($this->handle); @@ -519,7 +519,7 @@ public function dir_readdir() { * @return bool * TRUE on success. * - * @see http://php.net/manual/en/streamwrapper.dir-rewinddir.php + * @see http://php.net/manual/streamwrapper.dir-rewinddir.php */ public function dir_rewinddir() { rewinddir($this->handle); @@ -535,7 +535,7 @@ public function dir_rewinddir() { * @return bool * TRUE on success. * - * @see http://php.net/manual/en/streamwrapper.dir-closedir.php + * @see http://php.net/manual/streamwrapper.dir-closedir.php */ public function dir_closedir() { closedir($this->handle); diff --git a/core/lib/Drupal/Core/StreamWrapper/PhpStreamWrapperInterface.php b/core/lib/Drupal/Core/StreamWrapper/PhpStreamWrapperInterface.php index 4cf41e08730afb3f423b712f05183b4b8ad926e2..fad393fb00119e2d6f1ca39227fd80e12701f4fe 100644 --- a/core/lib/Drupal/Core/StreamWrapper/PhpStreamWrapperInterface.php +++ b/core/lib/Drupal/Core/StreamWrapper/PhpStreamWrapperInterface.php @@ -10,7 +10,7 @@ /** * Defines a generic PHP stream wrapper interface. * - * @see http://www.php.net/manual/en/class.streamwrapper.php + * @see http://www.php.net/manual/class.streamwrapper.php */ interface PhpStreamWrapperInterface { public function stream_open($uri, $mode, $options, &$opened_url); diff --git a/core/lib/Drupal/Core/Utility/CacheArray.php b/core/lib/Drupal/Core/Utility/CacheArray.php index 8f98b72f0d7a34f6895aec07bb8e75695aca6823..b730db2b7f0a54c2bab0301a6d6a8f2afeb8981c 100644 --- a/core/lib/Drupal/Core/Utility/CacheArray.php +++ b/core/lib/Drupal/Core/Utility/CacheArray.php @@ -39,7 +39,7 @@ * error, and $var will be populated with the contents of $object['foo'], but * that data will be passed by value, not reference. For more information on * the PHP limitation, see the note in the official PHP documentation atá - * http://php.net/manual/en/arrayaccess.offsetget.php on + * http://php.net/manual/arrayaccess.offsetget.php on * ArrayAccess::offsetGet(). * * By default, the class accounts for caches where calling functions might diff --git a/core/modules/block/block.api.php b/core/modules/block/block.api.php index bad08f976f198f00d21630c05d5c2f2756f56763..a3d59b0fc0542800a1e0aa66060d9b6291fcaa9d 100644 --- a/core/modules/block/block.api.php +++ b/core/modules/block/block.api.php @@ -20,11 +20,11 @@ * identifier referred to as "delta" (the array key in the return value). Delta * values only need to be unique within your module, and they are used in the * following ways: - * - Passed into the other block hooks in your module as an argument to - * identify the block being configured or viewed. + * - Passed into the other block hooks in your module as an argument to identify + * the block being configured or viewed. * - Used to construct the default HTML ID of "block-MODULE-DELTA" applied to - * each block when it is rendered (which can then be used for CSS styling or - * JavaScript programming). + * each block when it is rendered. This ID may then be used for CSS styling or + * JavaScript programming. * - Used to define a theming template suggestion of block__MODULE__DELTA, for * advanced theming possibilities. * - Used by other modules to identify your block in hook_block_info_alter() and @@ -39,10 +39,10 @@ * An associative array whose keys define the delta for each block and whose * values contain the block descriptions. Each block description is itself an * associative array, with the following key-value pairs: - * - 'info': (required) The human-readable administrative name of the block. + * - info: (required) The human-readable administrative name of the block. * This is used to identify the block on administration screens, and * is not displayed to non-administrative users. - * - 'cache': (optional) A bitmask describing what kind of caching is + * - cache: (optional) A bitmask describing what kind of caching is * appropriate for the block. Drupal provides the following bitmask * constants for defining cache granularity: * - DRUPAL_CACHE_PER_ROLE (default): The block can change depending on the @@ -56,28 +56,28 @@ * - DRUPAL_CACHE_GLOBAL: The block is the same for every user on every * page where it is visible. * - DRUPAL_NO_CACHE: The block should not get cached. - * - 'properties': (optional) Array of additional metadata to add to the - * block. Common properties include: - * - 'administrative': Boolean which categorizes this block as usable in - * an administrative context. This might include blocks which help an - * administrator approve/deny comments, or view recently created - * user accounts. - * - 'weight': (optional) Initial value for the ordering weight of this block. + * - properties: (optional) Array of additional metadata to add to the block. + * Common properties include: + * - administrative: Boolean that categorizes this block as usable in an + * administrative context. This might include blocks that help an + * administrator approve/deny comments, or view recently created user + * accounts. + * - weight: (optional) Initial value for the ordering weight of this block. * Most modules do not provide an initial value, and any value provided can * be modified by a user on the block configuration screen. - * - 'status': (optional) Initial value for block enabled status. (1 = - * enabled, 0 = disabled). An initial value for 'region' is required for - * 'status' to take effect. + * - status: (optional) Initial value for block enabled status. (1 = enabled, + * 0 = disabled). An initial value for 'region' is required for 'status' to + * take effect. * Most modules do not provide an initial value, and any value provided can * be modified by a user on the block configuration screen. - * - 'region': (optional) Initial value for theme region within which this - * block is set. If the specified region is not available in a theme, the - * block will be disabled. The initial value for 'status' must be enabled or - * the initial region value is ignored. + * - region: (optional) Initial value for theme region within which this block + * is set. If the specified region is not available in a theme, the block + * will be disabled. The initial value for 'status' must be enabled or the + * initial region value is ignored. * Most modules do not provide an initial value, and any value provided can * be modified by a user on the block configuration screen. - * - 'visibility': (optional) Initial value for the visibility flag, which - * tells how to interpret the 'pages' value. Possible values are: + * - visibility: (optional) Initial value for the visibility flag, which tells + * how to interpret the 'pages' value. Possible values are: * - BLOCK_VISIBILITY_NOTLISTED: Show on all pages except listed pages. * 'pages' lists the paths where the block should not be shown. * - BLOCK_VISIBILITY_LISTED: Show only on listed pages. 'pages' lists the @@ -87,7 +87,14 @@ * Most modules do not provide an initial value for 'visibility' or 'pages', * and any value provided can be modified by a user on the block * configuration screen. - * - 'pages': (optional) See 'visibility' above. + * - pages: (optional) See 'visibility' above. A string that contains one or + * more page paths separated by '\n', '\r', or '\r\n' when 'visibility' is + * set to BLOCK_VISIBILITY_NOTLISTED or BLOCK_VISIBILITY_LISTED, or custom + * PHP code when 'visibility' is set to BLOCK_VISIBILITY_PHP. Paths may use + * '*' as a wildcard (matching any number of characters); '<front>' + * designates the site's front page. For BLOCK_VISIBILITY_PHP, the PHP + * code's return value should be TRUE if the block is to be made visible or + * FALSE if the block should not be visible. * * For a detailed usage example, see block_example.module. * diff --git a/core/modules/entity/entity.class.inc b/core/modules/entity/entity.class.inc index 1dec8ee263782828afd0ca4a865ac45e9757aa97..9b13256c41d2de44c2d5d5eb194e663f0857a00f 100644 --- a/core/modules/entity/entity.class.inc +++ b/core/modules/entity/entity.class.inc @@ -279,7 +279,7 @@ public function entityInfo() { /** * Serializes only what is necessary. * - * See @link http://www.php.net/manual/en/language.oop5.magic.php#language.oop5.magic.sleep PHP Magic Methods @endlink. + * See @link http://www.php.net/manual/language.oop5.magic.php#language.oop5.magic.sleep PHP Magic Methods @endlink. */ public function __sleep() { $vars = get_object_vars($this); @@ -292,7 +292,7 @@ public function __sleep() { /** * Invokes setUp() on unserialization. * - * See @link http://www.php.net/manual/en/language.oop5.magic.php#language.oop5.magic.sleep PHP Magic Methods @endlink + * See @link http://www.php.net/manual/language.oop5.magic.php#language.oop5.magic.sleep PHP Magic Methods @endlink */ public function __wakeup() { $this->setUp(); diff --git a/core/modules/file/file.install b/core/modules/file/file.install index 47ee4fd0014b3f29c87da274968a1d969d61224a..dff930b5f1d108abc1fe31c6a34551b2e663ca21 100644 --- a/core/modules/file/file.install +++ b/core/modules/file/file.install @@ -74,11 +74,11 @@ function file_requirements($phase) { } elseif (!$implementation) { $value = t('Not enabled'); - $description = t('Your server is capable of displaying file upload progress, but does not have the required libraries. It is recommended to install the <a href="http://pecl.php.net/package/uploadprogress">PECL uploadprogress library</a> (preferred) or to install <a href="http://us2.php.net/apc">APC</a>.'); + $description = t('Your server is capable of displaying file upload progress, but does not have the required libraries. It is recommended to install the <a href="http://pecl.php.net/package/uploadprogress">PECL uploadprogress library</a> (preferred) or to install <a href="http://php.net/apc">APC</a>.'); $severity = REQUIREMENT_INFO; } elseif ($implementation == 'apc') { - $value = t('Enabled (<a href="http://php.net/manual/en/apc.configuration.php#ini.apc.rfc1867">APC RFC1867</a>)'); + $value = t('Enabled (<a href="http://php.net/manual/apc.configuration.php#ini.apc.rfc1867">APC RFC1867</a>)'); $description = t('Your server is capable of displaying file upload progress using APC RFC1867. Note that only one upload at a time is supported. It is recommended to use the <a href="http://pecl.php.net/package/uploadprogress">PECL uploadprogress library</a> if possible.'); $severity = REQUIREMENT_OK; } diff --git a/core/modules/filter/filter.admin.inc b/core/modules/filter/filter.admin.inc index b4a700853521d0bddbf1b8593c6d3ba4e03fee3c..40a5eabe9465557817be6646337eeedb77e60eeb 100644 --- a/core/modules/filter/filter.admin.inc +++ b/core/modules/filter/filter.admin.inc @@ -121,7 +121,7 @@ function filter_admin_format_form($form, &$form_state, $format) { $form['#format'] = $format; $form['#tree'] = TRUE; $form['#attached']['js'][] = drupal_get_path('module', 'filter') . '/filter.admin.js'; - $form['#attached']['css'][] = drupal_get_path('module', 'filter') . '/filter.css'; + $form['#attached']['css'][] = drupal_get_path('module', 'filter') . '/filter.admin.css'; $form['name'] = array( '#type' => 'textfield', diff --git a/core/modules/filter/filter.css b/core/modules/filter/filter.css deleted file mode 100644 index f7317338176b16896c60541826fc3a97395857ea..0000000000000000000000000000000000000000 --- a/core/modules/filter/filter.css +++ /dev/null @@ -1,53 +0,0 @@ - -.text-format-wrapper .form-item { - margin-bottom: 0; -} -.filter-wrapper { - border-top: 0; - margin: 0; - padding: 1.5em 0 1.5em; -} -.filter-wrapper .form-item { - float: left; - padding: 0 0 0.5em 1.5em; -} -.filter-wrapper .form-item label { - display: inline; -} -.filter-help { - float: right; - padding: 0 1.5em 0.5em; -} -.filter-help p { - margin: 0; -} -.filter-help a { - background: transparent url(../../misc/help.png) right center no-repeat; - padding: 0 20px; -} -.filter-guidelines { - clear: left; - padding: 0 1.5em; -} -.text-format-wrapper .description { - margin-top: 0.5em; -} - -#filter-order tr .form-item { - padding: 0.5em 0 0 3em; - white-space: normal; -} -#filter-order tr .form-type-checkbox .description { - padding: 0 0 0 2.5em; -} -input#edit-filters-filter-html-settings-allowed-html { - width: 100%; -} - -.tips { - margin-top: 0; - margin-bottom: 0; - padding-top: 0; - padding-bottom: 0; - font-size: 0.9em; -} diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 7d50adf9306297fb41cad0c63c1023776d4706a7..5fe4caa92e383886192a80512ba0171e97f33385 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -839,7 +839,7 @@ function filter_process_format($element) { // Turn original element into a text format wrapper. $path = drupal_get_path('module', 'filter'); $element['#attached']['js'][] = $path . '/filter.js'; - $element['#attached']['css'][] = $path . '/filter.css'; + $element['#attached']['css'][] = $path . '/filter.admin.css'; // Setup child container for the text format widget. $element['format'] = array( diff --git a/core/modules/locale/locale.pages.inc b/core/modules/locale/locale.pages.inc index 0d59f421f09ac68f98f84f46c0b19dbf2636f2bc..3df28324035b3865235b80725b95d8d000aeca59 100644 --- a/core/modules/locale/locale.pages.inc +++ b/core/modules/locale/locale.pages.inc @@ -196,7 +196,7 @@ function locale_translation_filter_form() { // Special case for 'string' filter. if ($key == 'string') { $form['filters']['status']['string'] = array( - '#type' => 'textfield', + '#type' => 'search', '#title' => $filter['title'], '#description' => $filter['description'], ); diff --git a/core/modules/menu/menu.admin.inc b/core/modules/menu/menu.admin.inc index 354261d8707edc08812ce5ed3be5cfc844bf2609..2e1725d199e4dab6e5439b57ec9bd838ff3907d4 100644 --- a/core/modules/menu/menu.admin.inc +++ b/core/modules/menu/menu.admin.inc @@ -260,6 +260,16 @@ function menu_edit_item($form, &$form_state, $type, $item, $menu) { // This is an add form, initialize the menu link. $item = array('link_title' => '', 'mlid' => 0, 'plid' => 0, 'menu_name' => $menu['menu_name'], 'weight' => 0, 'link_path' => '', 'options' => array(), 'module' => 'menu', 'expanded' => 0, 'hidden' => 0, 'has_children' => 0); } + else { + // Get the human-readable menu title from the given menu name. + $titles = menu_get_menus(); + $current_title = $titles[$item['menu_name']]; + + // Get the current breadcrumb and add a link to that menu's overview page. + $breadcrumb = menu_get_active_breadcrumb(); + $breadcrumb[] = l($current_title, 'admin/structure/menu/manage/' . $item['menu_name']); + drupal_set_breadcrumb($breadcrumb); + } $form['actions'] = array('#type' => 'actions'); $form['link_title'] = array( '#type' => 'textfield', diff --git a/core/modules/openid/openid.install b/core/modules/openid/openid.install index 2df39aa6969f609815ffcce64e2ed01044821e3d..830f9905f17636a4b9ce0ab55f1bf86a2d6c3fc5 100644 --- a/core/modules/openid/openid.install +++ b/core/modules/openid/openid.install @@ -95,14 +95,14 @@ function openid_requirements($phase) { $requirements['openid_math'] = array( 'value' => t('Not installed'), 'severity' => REQUIREMENT_ERROR, - 'description' => t('OpenID suggests the use of either the <a href="@gmp">GMP Math</a> (recommended for performance) or <a href="@bc">BC Math</a> libraries to enable OpenID associations.', array('@gmp' => 'http://php.net/manual/en/book.gmp.php', '@bc' => 'http://www.php.net/manual/en/book.bc.php')), + 'description' => t('OpenID suggests the use of either the <a href="@gmp">GMP Math</a> (recommended for performance) or <a href="@bc">BC Math</a> libraries to enable OpenID associations.', array('@gmp' => 'http://php.net/manual/book.gmp.php', '@bc' => 'http://www.php.net/manual/book.bc.php')), ); } elseif (!function_exists('gmp_add')) { $requirements['openid_math'] = array( 'value' => t('Not optimized'), 'severity' => REQUIREMENT_WARNING, - 'description' => t('OpenID suggests the use of the GMP Math library for PHP for optimal performance. Check the <a href="@url">GMP Math Library documentation</a> for installation instructions.', array('@url' => 'http://www.php.net/manual/en/book.gmp.php')), + 'description' => t('OpenID suggests the use of the GMP Math library for PHP for optimal performance. Check the <a href="@url">GMP Math Library documentation</a> for installation instructions.', array('@url' => 'http://www.php.net/manual/book.gmp.php')), ); } else { diff --git a/core/modules/path/path.admin.inc b/core/modules/path/path.admin.inc index fe122cc3320c10951068e737ebf30ec7daaf982e..24921b8f1f7468963d7854f14e87972982f46983 100644 --- a/core/modules/path/path.admin.inc +++ b/core/modules/path/path.admin.inc @@ -6,7 +6,7 @@ */ /** - * Return a listing of all defined URL aliases. + * Returns a listing of all defined URL aliases. * * When filter key passed, perform a standard search on the given key, * and return the list of matching URL aliases. @@ -88,7 +88,15 @@ function path_admin_overview($keys = NULL) { } /** - * Menu callback; handles pages for creating and editing URL aliases. + * Page callback: Returns a form creating or editing a path alias. + * + * @param $path + * An array containing the path ID, source, alias, and language code. + * + * @return + * A form for adding or editing a URL alias. + * + * @see path_menu() */ function path_admin_edit($path = array()) { if ($path) { @@ -103,11 +111,15 @@ function path_admin_edit($path = array()) { } /** - * Return a form for editing or creating an individual URL alias. + * Form constructor for the path administration form. + * + * @param $path + * An array containing the path ID, source, alias, and language code. * * @ingroup forms * @see path_admin_form_validate() * @see path_admin_form_submit() + * @see path_admin_form_delete_submit() */ function path_admin_form($form, &$form_state, $path = array('source' => '', 'alias' => '', 'langcode' => LANGUAGE_NOT_SPECIFIED, 'pid' => NULL)) { $form['source'] = array( @@ -177,7 +189,10 @@ function path_admin_form($form, &$form_state, $path = array('source' => '', 'ali } /** - * Submit function for the 'Delete' button on the URL alias editing form. + * Form submission handler for the 'Delete' button on path_admin_form(). + * + * @see path_admin_form_validate() + * @see path_admin_form_submit() */ function path_admin_form_delete_submit($form, &$form_state) { $destination = array(); @@ -189,7 +204,10 @@ function path_admin_form_delete_submit($form, &$form_state) { } /** - * Verify that a URL alias is valid + * Form validation handler for path_admin_form(). + * + * @see path_admin_form_submit() + * @see path_admin_form_delete_submit() */ function path_admin_form_validate($form, &$form_state) { $source = &$form_state['values']['source']; @@ -216,7 +234,10 @@ function path_admin_form_validate($form, &$form_state) { } /** - * Save a URL alias to the database. + * Form submission handler for path_admin_form(). + * + * @see path_admin_form_validate() + * @see path_admin_form_delete_submit() */ function path_admin_form_submit($form, &$form_state) { // Remove unnecessary values. @@ -229,7 +250,12 @@ function path_admin_form_submit($form, &$form_state) { } /** - * Menu callback; confirms deleting an URL alias + * Form constructor for the path deletion form. + * + * @param $path + * The path alias that will be deleted. + * + * @see path_admin_delete_confirm_submit() */ function path_admin_delete_confirm($form, &$form_state, $path) { if (user_access('administer url aliases')) { @@ -245,7 +271,7 @@ function path_admin_delete_confirm($form, &$form_state, $path) { } /** - * Execute URL alias deletion + * Form submission handler for path_admin_delete_confirm(). */ function path_admin_delete_confirm_submit($form, &$form_state) { if ($form_state['values']['confirm']) { @@ -255,10 +281,11 @@ function path_admin_delete_confirm_submit($form, &$form_state) { } /** - * Return a form to filter URL aliases. + * Form constructor for the path admin overview filter form. * * @ingroup forms - * @see path_admin_filter_form_submit() + * @see path_admin_filter_form_submit_filter() + * @see path_admin_filter_form_submit_reset() */ function path_admin_filter_form($form, &$form_state, $keys = '') { $form['#attributes'] = array('class' => array('search-form')); @@ -267,7 +294,7 @@ function path_admin_filter_form($form, &$form_state, $keys = '') { '#attributes' => array('class' => array('container-inline')), ); $form['basic']['filter'] = array( - '#type' => 'textfield', + '#type' => 'search', '#title' => 'Path alias', '#title_display' => 'invisible', '#default_value' => $keys, @@ -290,14 +317,18 @@ function path_admin_filter_form($form, &$form_state, $keys = '') { } /** - * Process filter form submission when the Filter button is pressed. + * Form submission handler for the path_admin_filter_form() Filter button. + * + * @see path_admin_filter_form_submit_reset() */ function path_admin_filter_form_submit_filter($form, &$form_state) { $form_state['redirect'] = 'admin/config/search/path/list/' . trim($form_state['values']['filter']); } /** - * Process filter form submission when the Reset button is pressed. + * Form submission handler for the path_admin_filter_form() Reset button. + * + * @see path_admin_filter_form_submit_filter() */ function path_admin_filter_form_submit_reset($form, &$form_state) { $form_state['redirect'] = 'admin/config/search/path/list'; diff --git a/core/modules/path/path.api.php b/core/modules/path/path.api.php index 1df7ee5305c6d10035388eaa02cb49292dd6df48..f2c5ecef745e02680c7344979eb924c1302c12c7 100644 --- a/core/modules/path/path.api.php +++ b/core/modules/path/path.api.php @@ -10,9 +10,8 @@ * @{ */ - /** - * Allow modules to respond to a path being inserted. + * Respond to a path being inserted. * * @param $path * An associative array containing the following keys: @@ -33,7 +32,7 @@ function hook_path_insert($path) { } /** - * Allow modules to respond to a path being updated. + * Respond to a path being updated. * * @param $path * An associative array containing the following keys: @@ -52,7 +51,7 @@ function hook_path_update($path) { } /** - * Allow modules to respond to a path being deleted. + * Respond to a path being deleted. * * @param $path * An associative array containing the following keys: diff --git a/core/modules/path/path.js b/core/modules/path/path.js index fcc0acc413fad48f25086eeb894c1d6afffc2bc6..c4f3cd0018a1307fe46ac3a74e50ff68b5a2ec50 100644 --- a/core/modules/path/path.js +++ b/core/modules/path/path.js @@ -1,4 +1,9 @@ +/** + * @file + * Attaches behaviors for the Path module. + */ + (function ($) { Drupal.behaviors.pathFieldsetSummaries = { diff --git a/core/modules/path/path.module b/core/modules/path/path.module index f89927aa1edc6bf1017744d199b767b16df61f96..67fc536acd1b0a82c922ff25ec65ff34ae3b67f2 100644 --- a/core/modules/path/path.module +++ b/core/modules/path/path.module @@ -91,7 +91,9 @@ function path_menu() { } /** - * Implements hook_form_BASE_FORM_ID_alter(). + * Implements hook_form_BASE_FORM_ID_alter() for node_form(). + * + * @see path_form_element_validate() */ function path_form_node_form_alter(&$form, $form_state) { $path = array(); @@ -145,6 +147,8 @@ function path_form_node_form_alter(&$form, $form_state) { /** * Form element validation handler for URL alias form element. + * + * @see path_form_node_form_alter() */ function path_form_element_validate($element, &$form_state, $complete_form) { if (!empty($form_state['values']['path']['alias'])) { @@ -225,7 +229,7 @@ function path_node_predelete($node) { } /** - * Implements hook_form_FORM_ID_alter(). + * Implements hook_form_FORM_ID_alter() for taxonomy_form_term(). */ function path_form_taxonomy_form_term_alter(&$form, $form_state) { // Make sure this does not show up on the delete confirmation form. diff --git a/core/modules/path/path.test b/core/modules/path/path.test index 32220ee469b992fbdc01e2ad07ee1d135f80dd43..d65265495981d2d2243386e1413f12fa09625390 100644 --- a/core/modules/path/path.test +++ b/core/modules/path/path.test @@ -2,9 +2,12 @@ /** * @file - * Tests for path.module. + * Tests for the Path module. */ +/** + * Provides a base class for testing the Path module. + */ class PathTestCase extends DrupalWebTestCase { function setUp() { $modules = func_get_args(); @@ -23,6 +26,9 @@ class PathTestCase extends DrupalWebTestCase { } } +/** + * Tests path alias functionality. + */ class PathAliasTestCase extends PathTestCase { public static function getInfo() { return array( @@ -41,7 +47,7 @@ class PathAliasTestCase extends PathTestCase { } /** - * Test the path cache. + * Tests the path cache. */ function testPathCache() { // Create test node. @@ -66,7 +72,7 @@ class PathAliasTestCase extends PathTestCase { } /** - * Test alias functionality through the admin interfaces. + * Tests alias functionality through the admin interfaces. */ function testAdminAlias() { // Create test node. @@ -125,7 +131,7 @@ class PathAliasTestCase extends PathTestCase { } /** - * Test alias functionality through the node interfaces. + * Tests alias functionality through the node interfaces. */ function testNodeAlias() { // Create test node. @@ -177,6 +183,15 @@ class PathAliasTestCase extends PathTestCase { $this->assertResponse(404); } + /** + * Returns the path ID. + * + * @param $alias + * A string containing an aliased path. + * + * @return int + * Integer representing the path ID. + */ function getPID($alias) { return db_query("SELECT pid FROM {url_alias} WHERE alias = :alias", array(':alias' => $alias))->fetchField(); } @@ -200,7 +215,7 @@ class PathAliasTestCase extends PathTestCase { } /** - * Test URL aliases for taxonomy terms. + * Tests URL aliases for taxonomy terms. */ class PathTaxonomyTermTestCase extends PathTestCase { public static function getInfo() { @@ -227,7 +242,7 @@ class PathTaxonomyTermTestCase extends PathTestCase { } /** - * Test alias functionality through the admin interfaces. + * Tests alias functionality through the admin interfaces. */ function testTermAlias() { // Create a term in the default 'Tags' vocabulary with URL alias. @@ -270,6 +285,9 @@ class PathTaxonomyTermTestCase extends PathTestCase { } } +/** + * Tests URL aliases for translated nodes. + */ class PathLanguageTestCase extends PathTestCase { public static function getInfo() { return array( diff --git a/core/modules/search/search.module b/core/modules/search/search.module index 0bbdd0d9ee2086c1bfb80f2f1a3871ec6f1bea1c..587ef43636a6b97e0ba40c905ed08bc43fda6cf6 100644 --- a/core/modules/search/search.module +++ b/core/modules/search/search.module @@ -991,7 +991,7 @@ function search_form($form, &$form_state, $action = '', $keys = '', $module = NU $form['module'] = array('#type' => 'value', '#value' => $module); $form['basic'] = array('#type' => 'container', '#attributes' => array('class' => array('container-inline'))); $form['basic']['keys'] = array( - '#type' => 'textfield', + '#type' => 'search', '#title' => $prompt, '#default_value' => $keys, '#size' => $prompt ? 40 : 20, @@ -1013,7 +1013,7 @@ function search_form($form, &$form_state, $action = '', $keys = '', $module = NU */ function search_box($form, &$form_state, $form_id) { $form[$form_id] = array( - '#type' => 'textfield', + '#type' => 'search', '#title' => t('Search'), '#title_display' => 'invisible', '#size' => 15, @@ -1271,6 +1271,11 @@ function search_simplify_excerpt_match($key, $text, $offset, $boundary) { $simplified_key = search_simplify($key); $simplified_text = search_simplify($text); + // Return immediately if simplified key or text are empty. + if (!$simplified_key || !$simplified_text) { + return FALSE; + } + // Check if we have a match after simplification in the text. if (!preg_match('/' . $boundary . $simplified_key . $boundary . '/iu', $simplified_text, $match, PREG_OFFSET_CAPTURE, $offset)) { return FALSE; diff --git a/core/modules/search/search.test b/core/modules/search/search.test index 376c8e1b242e49aa1337f424822547bf5cb8107f..8b67b0bdf8ba52bb0b5bc807d70e4d7767222c81 100644 --- a/core/modules/search/search.test +++ b/core/modules/search/search.test @@ -1655,6 +1655,21 @@ class SearchExcerptTestCase extends DrupalUnitTestCase { $result = preg_replace('| +|', ' ', search_excerpt('"abc def"', $text)); $this->assertTrue(strpos($result, '<strong>abc,def</strong>') !== FALSE, 'Phrase with keyword simplified into two separate words is highlighted with simplified match'); + + // Test phrases with characters which are being truncated. + $result = preg_replace('| +|', ' ', search_excerpt('"ipsum _"', $text)); + $this->assertTrue(strpos($result, '<strong>ipsum </strong>') !== FALSE, 'Only valid part of the phrase is highlighted and invalid part containing "_" is ignored.'); + + $result = preg_replace('| +|', ' ', search_excerpt('"ipsum 0000"', $text)); + $this->assertTrue(strpos($result, '<strong>ipsum </strong>') !== FALSE, 'Only valid part of the phrase is highlighted and invalid part "0000" is ignored.'); + + // Test combination of the valid keyword and keyword containing only + // characters which are being truncated during simplification. + $result = preg_replace('| +|', ' ', search_excerpt('ipsum _', $text)); + $this->assertTrue(strpos($result, '<strong>ipsum</strong>') !== FALSE, 'Only valid keyword is highlighted and invalid keyword "_" is ignored.'); + + $result = preg_replace('| +|', ' ', search_excerpt('ipsum 0000', $text)); + $this->assertTrue(strpos($result, '<strong>ipsum</strong>') !== FALSE, 'Only valid keyword is highlighted and invalid keyword "0000" is ignored.'); } } diff --git a/core/modules/shortcut/shortcut-rtl.css b/core/modules/shortcut/shortcut-rtl.css deleted file mode 100644 index bbae1b976014676ef6a9d85dcd8b8bc2dcbd8aec..0000000000000000000000000000000000000000 --- a/core/modules/shortcut/shortcut-rtl.css +++ /dev/null @@ -1,46 +0,0 @@ - -#toolbar #edit-shortcuts { - position: absolute; - left: 0; - top: 0; - padding: 5px 5px 5px 10px; -} -#toolbar .toolbar-shortcuts ul { - float: none; - margin-right: 5px; - margin-left: 10em; -} -#toolbar .toolbar-shortcuts ul li a { - margin-left: 5px; - margin-right: 0; - padding: 0 5px; -} -#toolbar .toolbar-shortcuts span.icon { - float: right; -} -.add-or-remove-shortcuts a span.icon { - float: right; - margin-right: 8px; - margin-left: 0; -} -.add-or-remove-shortcuts a span.text { - float: right; - padding-right: 10px; - padding-left: 0; -} -.add-or-remove-shortcuts a:focus span.text, -.add-or-remove-shortcuts a:hover span.text { - -moz-border-radius: 5px 0 0 5px; - border-radius: 5px 0 0 5px; - padding-left: 6px; -} -#shortcut-set-switch .form-item-new { - padding-right: 17px; - padding-left: 0; -} -.add-shortcut a:hover span.icon { - background-position: 0 -24px; -} -.remove-shortcut a:hover span.icon { - background-position: -12px -24px; -} diff --git a/core/modules/shortcut/shortcut.admin.css b/core/modules/shortcut/shortcut.admin.css index 8ca03be87358adce63912325e9ed84d8bc1dcdac..17d3bab36d10ff55b524a1f5e61099b2d36e5eec 100644 --- a/core/modules/shortcut/shortcut.admin.css +++ b/core/modules/shortcut/shortcut.admin.css @@ -1,8 +1,9 @@ +/** + * @file + * Admin styling for shortcut module. + */ + .shortcut-slot-hidden { display: none; } - -div.form-item-set div.form-item-new { - display: inline; -} diff --git a/core/modules/shortcut/shortcut.base-rtl.css b/core/modules/shortcut/shortcut.base-rtl.css new file mode 100644 index 0000000000000000000000000000000000000000..c236f47ea511e02734cf69ef1d962b9457ff1024 --- /dev/null +++ b/core/modules/shortcut/shortcut.base-rtl.css @@ -0,0 +1,28 @@ + +/** + * @file + * Generic RTL base styles for shortcut module. + */ + +/** + * Toolbar. + */ +#edit-shortcuts { + left: 0; + position: absolute; + top: 0; +} +#shortcut-toolbar ul { + float: none; +} +#shortcut-toolbar .icon { + float: right; +} + +/** + * Add/remove links. + */ +.add-or-remove-shortcuts .icon, +.add-or-remove-shortcuts .text { + float: right; +} diff --git a/core/modules/shortcut/shortcut.base.css b/core/modules/shortcut/shortcut.base.css new file mode 100644 index 0000000000000000000000000000000000000000..90a1046f38df3de1a61f26b80d515bcbaad1b03d --- /dev/null +++ b/core/modules/shortcut/shortcut.base.css @@ -0,0 +1,34 @@ + +/** + * @file + * Generic base styles for shortcut module. + */ + +/** + * Toolbar. + */ +#edit-shortcuts { + float: right; /* LTR */ +} +#shortcut-toolbar ul { + float: left; /* LTR */ +} +#shortcut-toolbar .icon { + float: left; /* LTR */ +} + +/** + * Add/remove links. + */ +.add-or-remove-shortcuts .icon { + display: block; + float: left; /* LTR */ +} +.add-or-remove-shortcuts .text { + display: none; + float: left; /* LTR */ +} +.add-or-remove-shortcuts a:focus .text, +.add-or-remove-shortcuts a:hover .text { + display: block; +} diff --git a/core/modules/shortcut/shortcut.css b/core/modules/shortcut/shortcut.css deleted file mode 100644 index acc5e55ab4bc1c531ec8b847780b3e295f4f6b62..0000000000000000000000000000000000000000 --- a/core/modules/shortcut/shortcut.css +++ /dev/null @@ -1,102 +0,0 @@ -#toolbar #edit-shortcuts { - float: right; - padding: 5px 10px 5px 5px; - line-height: 24px; - color: #fefefe; -} -#toolbar #edit-shortcuts:focus, -#toolbar #edit-shortcuts:hover, -#toolbar #edit-shortcuts.active { - color: #fff; - text-decoration: underline; -} - -#toolbar .toolbar-shortcuts ul { - padding: 5px 0 2px 0; - height: 28px; - line-height: 24px; - float: left; /* LTR */ - margin-left:5px; /* LTR */ -} - -#toolbar .toolbar-shortcuts ul li a { - padding: 0 5px 0 5px; - margin-right: 5px; /* LTR */ - -moz-border-radius: 5px; - border-radius: 5px; -} - -#toolbar .toolbar-shortcuts ul li a:focus, -#toolbar .toolbar-shortcuts ul li a:hover, -#toolbar .toolbar-shortcuts ul li a.active:focus { - background: #555; -} - -#toolbar .toolbar-shortcuts ul li a.active:hover, -#toolbar .toolbar-shortcuts ul li a.active { - background: #000; -} - -#toolbar .toolbar-shortcuts span.icon { - float: left; /* LTR */ - background: #444; - width: 30px; - height: 30px; - margin-right: 5px; /* LTR */ - -moz-border-radius: 5px; - border-radius: 5px; -} - -.add-or-remove-shortcuts { - padding-top: 5px; -} - -.add-or-remove-shortcuts a span.icon { - display: block; - width: 12px; - background: transparent url(shortcut.png) no-repeat scroll 0 0; - height: 12px; - float: left; - margin-left:8px; -} - -.add-shortcut a:focus span.icon, -.add-shortcut a:hover span.icon { - background-position: 0 -12px; -} -.remove-shortcut a span.icon { - background-position: -12px 0; -} -.remove-shortcut a:focus span.icon, -.remove-shortcut a:hover span.icon { - background-position: -12px -12px; -} - -.add-or-remove-shortcuts a span.text { - float: left; - padding-left:10px; - display: none; -} - -.add-or-remove-shortcuts a:focus span.text, -.add-or-remove-shortcuts a:hover span.text { - font-size: 10px; - line-height: 12px; - color: #fff; - background-color: #5f605b; - display: block; - padding-right: 6px; /* LTR */ - cursor: pointer; - -moz-border-radius: 0 5px 5px 0; /* LTR */ - border-radius: 0 5px 5px 0; /* LTR */ -} - -#shortcut-set-switch .form-type-radios { - padding-bottom: 0; - margin-bottom: 0; -} - -#shortcut-set-switch .form-item-new { - padding-top: 0; - padding-left: 17px; /* LTR */ -} diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index 3602822299c1d43eef7a0a6152766060d4c03283..aa43503da3468de8e3402d40d00d292669665bf3 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -692,10 +692,15 @@ function shortcut_preprocess_page(&$variables) { if (theme_get_setting('shortcut_module_link')) { $variables['title_suffix']['add_or_remove_shortcut'] = array( - '#attached' => array('css' => array(drupal_get_path('module', 'shortcut') . '/shortcut.css')), + '#attached' => array( + 'css' => array( + drupal_get_path('module', 'shortcut') . '/shortcut.base.css', + drupal_get_path('module', 'shortcut') . '/shortcut.theme.css', + ), + ), '#prefix' => '<div class="add-or-remove-shortcuts ' . $link_mode . '-shortcut">', '#type' => 'link', - '#title' => '<span class="icon"></span><span class="text">' . $link_text . '</span>', + '#title' => '<span class="icon">'. t('Add or remove shortcut') .'</span><span class="text">' . $link_text . '</span>', '#href' => $link_path, '#options' => array('query' => $query, 'html' => TRUE), '#suffix' => '</div>', @@ -720,8 +725,13 @@ function shortcut_page_alter(&$page) { */ function shortcut_toolbar_pre_render($toolbar) { $links = shortcut_renderable_links(); - $links['#attached'] = array('css' => array(drupal_get_path('module', 'shortcut') . '/shortcut.css')); - $links['#prefix'] = '<div class="toolbar-shortcuts">'; + $links['#attached'] = array( + 'css' => array( + drupal_get_path('module', 'shortcut') . '/shortcut.base.css', + drupal_get_path('module', 'shortcut') . '/shortcut.theme.css', + ), + ); + $links['#prefix'] = '<div id="shortcut-toolbar">'; $links['#suffix'] = '</div>'; $shortcut_set = shortcut_current_displayed_set(); $configure_link = NULL; diff --git a/core/modules/shortcut/shortcut.theme-rtl.css b/core/modules/shortcut/shortcut.theme-rtl.css new file mode 100644 index 0000000000000000000000000000000000000000..981466f9c159ae8f3163b97cca484ad7341dd2ba --- /dev/null +++ b/core/modules/shortcut/shortcut.theme-rtl.css @@ -0,0 +1,45 @@ + +/** + * @file + * RTL styling for the shortcut module. + */ + +/** + * Toolbar. + */ +#shortcut-toolbar ul { + margin-left: 0; + margin-right: 5px; +} +#shortcut-toolbar a { + margin-left: 5px; + margin-right: 0; +} +#shortcut-toolbar .icon { + margin-left: 5px; + margin-right: 0; +} + +/** + * Add/remove links. + */ +.add-or-remove-shortcuts .icon { + margin-left: 0; + margin-right: 8px; +} +.add-shortcut a:focus .icon, +.add-shortcut a:hover .icon { + background-position: 0 -24px; +} +.remove-shortcut a:focus .icon, +.remove-shortcut a:hover .icon { + background-position: -12px -24px; +} +.add-or-remove-shortcuts .text { + padding: 0 10px 0 6px; +} +.add-or-remove-shortcuts a:focus .text, +.add-or-remove-shortcuts a:hover .text { + -moz-border-radius: 5px 0 0 5px; + border-radius: 5px 0 0 5px; +} diff --git a/core/modules/shortcut/shortcut.theme.css b/core/modules/shortcut/shortcut.theme.css new file mode 100644 index 0000000000000000000000000000000000000000..eff3e936fc020bf348689c771406cc936b4faba5 --- /dev/null +++ b/core/modules/shortcut/shortcut.theme.css @@ -0,0 +1,82 @@ + +/** + * @file + * Styling for the shortcut module. + */ + +/** + * Toolbar. + */ +.toolbar #edit-shortcuts { + line-height: 24px; + padding: 5px 10px; +} +#edit-shortcuts:focus, +#edit-shortcuts:hover, +#edit-shortcuts.active { + text-decoration: underline; +} +#shortcut-toolbar ul { + line-height: 24px; + margin-left: 5px; /* LTR */ + padding: 5px 0; +} +#shortcut-toolbar a { + -moz-border-radius: 5px; + border-radius: 5px; + margin-right: 5px; /* LTR */ + padding: 0 5px; +} +#shortcut-toolbar a:focus, +#shortcut-toolbar a:hover, +#shortcut-toolbar a.active:focus { + background: #555; +} +#shortcut-toolbar a.active:hover, +#shortcut-toolbar a.active { + background-color: #000; +} +#shortcut-toolbar .icon { + background-color: #444; + -moz-border-radius: 5px; + border-radius: 5px; + height: 30px; + margin-right: 5px; /* LTR */ + width: 30px; +} + +/** + * Add/remove links. + */ +.add-or-remove-shortcuts .icon { + background: transparent url(shortcut.png) no-repeat; + height: 12px; + margin-left: 8px; /* LTR */ + overflow: hidden; + text-indent: 12px; + width: 12px; +} +.add-shortcut a:focus .icon, +.add-shortcut a:hover .icon { + background-position: 0 -12px; /* LTR */ +} +.remove-shortcut .icon { + background-position: -12px 0; +} +.remove-shortcut a:focus .icon, +.remove-shortcut a:hover .icon { + background-position: -12px -12px; /* LTR */ +} +.add-or-remove-shortcuts .text { + padding: 0 6px 0 10px; /* LTR */ +} +.add-or-remove-shortcuts a:focus .text, +.add-or-remove-shortcuts a:hover .text { + background-color: #5f605b; + -moz-border-radius: 0 5px 5px 0; /* LTR */ + border-radius: 0 5px 5px 0; /* LTR */ + color: #fff; + cursor: pointer; + font-size: 10px; + line-height: 12px; +} diff --git a/core/modules/simpletest/drupal_web_test_case.php b/core/modules/simpletest/drupal_web_test_case.php index ded4ad0da0cdcb3ba71ff8725cf1a4057ac09138..a2d85cba4e237cd08f7ff8c4ca692671bad51c65 100644 --- a/core/modules/simpletest/drupal_web_test_case.php +++ b/core/modules/simpletest/drupal_web_test_case.php @@ -2266,6 +2266,7 @@ protected function handleForm(&$post, &$edit, &$upload, $submit, $form) { case 'hidden': case 'password': case 'email': + case 'search': $post[$name] = $edit[$name]; unset($edit[$name]); break; @@ -2429,7 +2430,7 @@ protected function buildXPathQuery($xpath, array $args = array()) { * @return * The return value of the xpath search. For details on the xpath string * format and return values see the SimpleXML documentation, - * http://us.php.net/manual/function.simplexml-element-xpath.php. + * http://php.net/manual/function.simplexml-element-xpath.php. */ protected function xpath($xpath, array $arguments = array()) { if ($this->parse()) { diff --git a/core/modules/simpletest/simpletest.install b/core/modules/simpletest/simpletest.install index 96cc0112f7f9b695bfd93a94d1bf21580022673b..f8f4d87acfccac04630213dfe1ce1e2384ff92b7 100644 --- a/core/modules/simpletest/simpletest.install +++ b/core/modules/simpletest/simpletest.install @@ -28,7 +28,7 @@ function simpletest_requirements($phase) { ); if (!$has_curl) { $requirements['curl']['severity'] = REQUIREMENT_ERROR; - $requirements['curl']['description'] = $t('The testing framework could not be installed because the PHP <a href="@curl_url">cURL</a> library is not available.', array('@curl_url' => 'http://php.net/manual/en/curl.setup.php')); + $requirements['curl']['description'] = $t('The testing framework could not be installed because the PHP <a href="@curl_url">cURL</a> library is not available.', array('@curl_url' => 'http://php.net/manual/curl.setup.php')); } $requirements['hash'] = array( 'title' => $t('hash'), @@ -36,7 +36,7 @@ function simpletest_requirements($phase) { ); if (!$has_hash) { $requirements['hash']['severity'] = REQUIREMENT_ERROR; - $requirements['hash']['description'] = $t('The testing framework could not be installed because the PHP <a href="@hash_url">hash</a> extension is disabled.', array('@hash_url' => 'http://php.net/manual/en/book.hash.php')); + $requirements['hash']['description'] = $t('The testing framework could not be installed because the PHP <a href="@hash_url">hash</a> extension is disabled.', array('@hash_url' => 'http://php.net/manual/book.hash.php')); } $requirements['php_domdocument'] = array( @@ -57,7 +57,7 @@ function simpletest_requirements($phase) { ); if ($open_basedir) { $requirements['php_open_basedir']['severity'] = REQUIREMENT_ERROR; - $requirements['php_open_basedir']['description'] = $t('The testing framework requires the PHP <a href="@open_basedir-url">open_basedir</a> restriction to be disabled. Check your webserver configuration or contact your web host.', array('@open_basedir-url' => 'http://php.net/manual/en/ini.core.php#ini.open-basedir')); + $requirements['php_open_basedir']['description'] = $t('The testing framework requires the PHP <a href="@open_basedir-url">open_basedir</a> restriction to be disabled. Check your webserver configuration or contact your web host.', array('@open_basedir-url' => 'http://php.net/manual/ini.core.php#ini.open-basedir')); } // Check the current memory limit. If it is set too low, SimpleTest will fail diff --git a/core/modules/simpletest/tests/ajax.test b/core/modules/simpletest/tests/ajax.test index 3184add156ca8b5ed9cc9bae6d3b62cea52eb181..4f254f81f38236e1476a5302ee159272acb07a2e 100644 --- a/core/modules/simpletest/tests/ajax.test +++ b/core/modules/simpletest/tests/ajax.test @@ -44,7 +44,7 @@ class AJAXTestCase extends DrupalWebTestCase { // If the command has additional data that we're not testing for, do not // consider that a failure. Also, == instead of ===, because we don't // require the key/value pairs to be in any particular order - // (http://www.php.net/manual/en/language.operators.array.php). + // (http://www.php.net/manual/language.operators.array.php). if (array_intersect_key($command, $needle) == $needle) { $found = TRUE; break; diff --git a/core/modules/simpletest/tests/file.test b/core/modules/simpletest/tests/file.test index 5b6a6f456aecbcc3d6e1c954db58269ca73858ec..c5eced152c1f3863ea28ca8a0692affd22e27faa 100644 --- a/core/modules/simpletest/tests/file.test +++ b/core/modules/simpletest/tests/file.test @@ -2413,7 +2413,7 @@ class FileDownloadTest extends FileTestCase { // Tilde (~) is excluded from this test because it is encoded by // rawurlencode() in PHP 5.2 but not in PHP 5.3, as per RFC 3986. - // @see http://www.php.net/manual/en/function.rawurlencode.php#86506 + // @see http://www.php.net/manual/function.rawurlencode.php#86506 $basename = " -._!$'\"()*@[]?&+%#,;=:\n\x00" . // "Special" ASCII characters. "%23%25%26%2B%2F%3F" . // Characters that look like a percent-escaped string. "éøïвβä¸åœ‹æ›¸Ûž"; // Characters from various non-ASCII alphabets. diff --git a/core/modules/simpletest/tests/form.test b/core/modules/simpletest/tests/form.test index 582b473b50f0a9b9e008bc9f9a9b9a6cc6f4bc78..e79983c25f8a720dd03c8b2991c6ac7fe9386ed9 100644 --- a/core/modules/simpletest/tests/form.test +++ b/core/modules/simpletest/tests/form.test @@ -53,6 +53,9 @@ class FormsTestCase extends DrupalWebTestCase { $elements['url']['element'] = array('#title' => $this->randomName(), '#type' => 'url'); $elements['url']['empty_values'] = $empty_strings; + $elements['search']['element'] = array('#title' => $this->randomName(), '#type' => 'search'); + $elements['search']['empty_values'] = $empty_strings; + $elements['password']['element'] = array('#title' => $this->randomName(), '#type' => 'password'); $elements['password']['empty_values'] = $empty_strings; @@ -340,7 +343,7 @@ class FormsTestCase extends DrupalWebTestCase { // All the elements should be marked as disabled, including the ones below // the disabled container. - $this->assertEqual(count($disabled_elements), 36, 'The correct elements have the disabled property in the HTML code.'); + $this->assertEqual(count($disabled_elements), 37, 'The correct elements have the disabled property in the HTML code.'); $this->drupalPost(NULL, $edit, t('Submit')); $returned_values['hijacked'] = drupal_json_decode($this->content); @@ -448,6 +451,29 @@ class FormsTestCase extends DrupalWebTestCase { $this->drupalPost(NULL, array('checkboxes[one]' => TRUE, 'checkboxes[two]' => TRUE), t('Submit')); $this->assertText('An illegal choice has been detected.', t('Input forgery was detected.')); } + + /** + * Tests required attribute. + */ + function testRequiredAttribute() { + $this->drupalGet('form-test/required-attribute'); + $expected = 'required'; + // Test to make sure the elements have the proper required attribute. + foreach (array('textfield', 'password') as $type) { + $element = $this->xpath('//input[@id=:id and @required=:expected]', array( + ':id' => 'edit-' . $type, + ':expected' => $expected, + )); + $this->assertTrue(!empty($element), t('The @type has the proper required attribute.', array('@type' => $type))); + } + + // Test to make sure textarea has the proper required attribute. + $element = $this->xpath('//textarea[@id=:id and @required=:expected]', array( + ':id' => 'edit-textarea', + ':expected' => $expected, + )); + $this->assertTrue(!empty($element), t('The textarea has the proper required attribute.')); + } } /** @@ -630,6 +656,25 @@ class FormValidationTestCase extends DrupalWebTestCase { ); $path = 'form-test/limit-validation-errors'; + // Render the form, and verify that the buttons with limited server-side + // validation have the proper 'formnovalidate' attribute (to prevent + // client-side validation by the browser). + $this->drupalGet($path); + $expected = 'formnovalidate'; + foreach (array('partial', 'partial-numeric-index', 'substring') as $type) { + $element = $this->xpath('//input[@id=:id and @formnovalidate=:expected]', array( + ':id' => 'edit-' . $type, + ':expected' => $expected, + )); + $this->assertTrue(!empty($element), t('The @type button has the proper formnovalidate attribute.', array('@type' => $type))); + } + // The button with full server-side validation should not have the + // 'formnovalidate' attribute. + $element = $this->xpath('//input[@id=:id and not(@formnovalidate)]', array( + ':id' => 'edit-full', + )); + $this->assertTrue(!empty($element), t('The button with full server-side validation does not have the formnovalidate attribute.')); + // Submit the form by pressing the 'Partial validate' button (uses // #limit_validation_errors) and ensure that the title field is not // validated, but the #element_validate handler for the 'test' field @@ -740,11 +785,6 @@ class FormsElementsLabelsTestCase extends DrupalWebTestCase { $elements = $this->xpath('//div[@id="form-test-textfield-title-suffix"]/preceding-sibling::div[contains(@class, \'form-item-form-textfield-test-title\')]'); $this->assertTrue(isset($elements[0]), t("Properly places the #suffix element before the form item.")); - - // Check that required checkboxes with #title_display attribute have - // a description but no title is displayed. - $this->assertFieldByXPath('//div[contains(@class, "form-item-form-checkboxes-test-title-display-attribute")]/div[contains(@class, "description")]', NULL, 'Description displayed for #title_display attribute.'); - $this->assertNoFieldByXPath('//label[@for="edit-form-checkboxes-test-title-display-attribute"]', NULL, 'No title displayed for #title_display attribute.'); } } diff --git a/core/modules/simpletest/tests/form_test.module b/core/modules/simpletest/tests/form_test.module index ef553e40173b5d413c81d5d1531e08c58e362bed..3dcd24742dd5c8b64ab2ce9a1a695787567c300d 100644 --- a/core/modules/simpletest/tests/form_test.module +++ b/core/modules/simpletest/tests/form_test.module @@ -229,6 +229,13 @@ function form_test_menu() { 'type' => MENU_CALLBACK, ); + $items['form-test/required-attribute'] = array( + 'title' => 'Required', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('form_test_required_attribute'), + 'access callback' => TRUE, + ); + return $items; } @@ -821,15 +828,6 @@ function form_label_test_form() { $form['form_textfield_test_title_no_show'] = array( '#type' => 'textfield', ); - // Test required checkboxes with #title_display attribute and a description. - $form['form_checkboxes_test_title_display_attribute'] = array( - '#type' => 'checkboxes', - '#title' => 'Checkboxes, #title_display attribute', - '#title_display' => 'attribute', - '#required' => TRUE, - '#description' => 'Required checkboxes with #title_display attribute and a description.', - '#options' => drupal_map_assoc(array('foo', 'bar', 'baz')), - ); return $form; } @@ -1101,7 +1099,7 @@ function form_test_select_submit($form, &$form_state) { * Builds a form to test the placeholder attribute. */ function form_test_placeholder_test($form, &$form_state) { - foreach (array('textfield', 'textarea', 'url', 'password', 'tel', 'email') as $type) { + foreach (array('textfield', 'textarea', 'url', 'password', 'search', 'tel', 'email') as $type) { $form[$type] = array( '#type' => $type, '#title' => $type, @@ -1242,7 +1240,7 @@ function form_test_url_submit($form, &$form_state) { */ function _form_test_disabled_elements($form, &$form_state) { // Elements that take a simple default value. - foreach (array('textfield', 'textarea', 'tel', 'hidden') as $type) { + foreach (array('textfield', 'textarea', 'search', 'tel', 'hidden') as $type) { $form[$type] = array( '#type' => $type, '#title' => $type, @@ -1839,3 +1837,18 @@ function form_test_checkboxes_zero($form, &$form_state, $json = TRUE) { function _form_test_checkboxes_zero_no_redirect($form, &$form_state) { $form_state['redirect'] = FALSE; } + +/** + * Builds a form to test the required attribute. + */ +function form_test_required_attribute($form, &$form_state) { + foreach (array('textfield', 'textarea', 'password') as $type) { + $form[$type] = array( + '#type' => $type, + '#required' => TRUE, + '#title' => $type, + ); + } + + return $form; +} diff --git a/core/modules/simpletest/tests/menu.test b/core/modules/simpletest/tests/menu.test index 97e329d56dc394248ebb540aa519fa1c687981dc..8d1d6516118075a07674b9b3e833cec469909de9 100644 --- a/core/modules/simpletest/tests/menu.test +++ b/core/modules/simpletest/tests/menu.test @@ -1127,6 +1127,7 @@ class MenuBreadcrumbTestCase extends MenuWebTestCase { $trail += array( 'admin/structure/menu/manage/navigation' => t('Navigation'), ); + $this->assertBreadcrumb("admin/structure/menu/item/6/edit", $trail); $this->assertBreadcrumb('admin/structure/menu/manage/navigation/edit', $trail); $this->assertBreadcrumb('admin/structure/menu/manage/navigation/add', $trail); @@ -1626,4 +1627,97 @@ class MenuTrailTestCase extends MenuWebTestCase { variable_set('menu_test_menu_tree_set_path', $test_menu_path); $this->assertBreadcrumb('admin/config/development/menu-trail', $override_breadcrumb, t('Menu trail - Case 2'), $override_tree); } + + /** + * Tests that the active trail works correctly on custom 403 and 404 pages. + */ + function testCustom403And404Pages() { + // Set the custom 403 and 404 pages we will use. + variable_set('site_403', 'menu-test/custom-403-page'); + variable_set('site_404', 'menu-test/custom-404-page'); + + // Define the paths we'll visit to trigger 403 and 404 responses during + // this test, and the expected active trail for each case. + $paths = array( + 403 => 'admin/config', + 404 => $this->randomName(), + ); + // For the 403 page, the initial trail during the Drupal bootstrap should + // include the page that the user is trying to visit, while the final trail + // should reflect the custom 403 page that the user was redirected to. + $expected_trail[403]['initial'] = array( + '<front>' => 'Home', + 'admin/config' => 'Configuration', + ); + $expected_trail[403]['final'] = array( + '<front>' => 'Home', + 'menu-test' => 'Menu test root', + 'menu-test/custom-403-page' => 'Custom 403 page', + ); + // For the 404 page, the initial trail during the Drupal bootstrap should + // only contain the link back to "Home" (since the page the user is trying + // to visit doesn't have any menu items associated with it), while the + // final trail should reflect the custom 404 page that the user was + // redirected to. + $expected_trail[404]['initial'] = array( + '<front>' => 'Home', + ); + $expected_trail[404]['final'] = array( + '<front>' => 'Home', + 'menu-test' => 'Menu test root', + 'menu-test/custom-404-page' => 'Custom 404 page', + ); + + // Visit each path as an anonymous user so that we will actually get a 403 + // on admin/config. + $this->drupalLogout(); + foreach (array(403, 404) as $status_code) { + // Before visiting the page, trigger the code in the menu_test module + // that will record the active trail (so we can check it in this test). + variable_set('menu_test_record_active_trail', TRUE); + $this->drupalGet($paths[$status_code]); + $this->assertResponse($status_code); + + // Check that the initial trail (during the Drupal bootstrap) matches + // what we expect. + $initial_trail = variable_get('menu_test_active_trail_initial', array()); + $this->assertEqual(count($initial_trail), count($expected_trail[$status_code]['initial']), t('The initial active trail for a @status_code page contains the expected number of items (expected: @expected, found: @found).', array( + '@status_code' => $status_code, + '@expected' => count($expected_trail[$status_code]['initial']), + '@found' => count($initial_trail), + ))); + foreach (array_keys($expected_trail[$status_code]['initial']) as $index => $path) { + $this->assertEqual($initial_trail[$index]['href'], $path, t('Element number @number of the initial active trail for a @status_code page contains the correct path (expected: @expected, found: @found)', array( + '@number' => $index + 1, + '@status_code' => $status_code, + '@expected' => $path, + '@found' => $initial_trail[$index]['href'], + ))); + } + + // Check that the final trail (after the user has been redirected to the + // custom 403/404 page) matches what we expect. + $final_trail = variable_get('menu_test_active_trail_final', array()); + $this->assertEqual(count($final_trail), count($expected_trail[$status_code]['final']), t('The final active trail for a @status_code page contains the expected number of items (expected: @expected, found: @found).', array( + '@status_code' => $status_code, + '@expected' => count($expected_trail[$status_code]['final']), + '@found' => count($final_trail), + ))); + foreach (array_keys($expected_trail[$status_code]['final']) as $index => $path) { + $this->assertEqual($final_trail[$index]['href'], $path, t('Element number @number of the final active trail for a @status_code page contains the correct path (expected: @expected, found: @found)', array( + '@number' => $index + 1, + '@status_code' => $status_code, + '@expected' => $path, + '@found' => $final_trail[$index]['href'], + ))); + } + + // Check that the breadcrumb displayed on the final custom 403/404 page + // matches what we expect. (The last item of the active trail represents + // the current page, which is not supposed to appear in the breadcrumb, + // so we need to remove it from the array before checking.) + array_pop($expected_trail[$status_code]['final']); + $this->assertBreadcrumb(NULL, $expected_trail[$status_code]['final']); + } + } } diff --git a/core/modules/simpletest/tests/menu_test.module b/core/modules/simpletest/tests/menu_test.module index c42aca60fe67a0851d5177ebbd6e8c97b31b8781..0b954ae1cbadeef629a9bf451025dd1aac6b0361 100644 --- a/core/modules/simpletest/tests/menu_test.module +++ b/core/modules/simpletest/tests/menu_test.module @@ -230,6 +230,16 @@ function menu_test_menu() { 'page callback' => 'menu_test_menu_trail_callback', 'access arguments' => array('access administration pages'), ); + $items['menu-test/custom-403-page'] = array( + 'title' => 'Custom 403 page', + 'page callback' => 'menu_test_custom_403_404_callback', + 'access arguments' => array('access content'), + ); + $items['menu-test/custom-404-page'] = array( + 'title' => 'Custom 404 page', + 'page callback' => 'menu_test_custom_403_404_callback', + 'access arguments' => array('access content'), + ); // File inheritance tests. This menu item should inherit the page callback // system_admin_menu_block_page() and therefore render its children as links @@ -369,6 +379,32 @@ function menu_test_menu_trail_callback() { return 'This is menu_test_menu_trail_callback().'; } +/** + * Implements hook_init(). + */ +function menu_test_init() { + // When requested by one of the MenuTrailTestCase tests, record the initial + // active trail during Drupal's bootstrap (before the user is redirected to a + // custom 403 or 404 page). See menu_test_custom_403_404_callback(). + if (variable_get('menu_test_record_active_trail', FALSE)) { + variable_set('menu_test_active_trail_initial', menu_get_active_trail()); + } +} + +/** + * Callback for our custom 403 and 404 pages. + */ +function menu_test_custom_403_404_callback() { + // When requested by one of the MenuTrailTestCase tests, record the final + // active trail now that the user has been redirected to the custom 403 or + // 404 page. See menu_test_init(). + if (variable_get('menu_test_record_active_trail', FALSE)) { + variable_set('menu_test_active_trail_final', menu_get_active_trail()); + } + + return 'This is menu_test_custom_403_404_callback().'; +} + /** * Page callback to use when testing the theme callback functionality. * diff --git a/core/modules/simpletest/tests/pager.test b/core/modules/simpletest/tests/pager.test new file mode 100644 index 0000000000000000000000000000000000000000..6fdeec5bf48195db40c4c30fe615fd458d6389fb --- /dev/null +++ b/core/modules/simpletest/tests/pager.test @@ -0,0 +1,159 @@ +<?php + +/** + * @file + * Tests for pager functionality. + */ + +/** + * Tests pager functionality. + */ +class PagerFunctionalWebTestCase extends DrupalWebTestCase { + protected $profile = 'testing'; + + public static function getInfo() { + return array( + 'name' => 'Pager functionality', + 'description' => 'Tests pager functionality.', + 'group' => 'Pager', + ); + } + + function setUp() { + parent::setUp(array('dblog')); + + // Insert 300 log messages. + for ($i = 0; $i < 300; $i++) { + watchdog('pager_test', $this->randomString(), NULL, WATCHDOG_DEBUG); + } + + $this->admin_user = $this->drupalCreateUser(array( + 'access site reports', + )); + $this->drupalLogin($this->admin_user); + } + + /** + * Tests markup and CSS classes of pager links. + */ + function testActiveClass() { + // Verify first page. + $this->drupalGet('admin/reports/dblog'); + $current_page = 0; + $this->assertPagerItems($current_page); + + // Verify any page but first/last. + $current_page++; + $this->drupalGet('admin/reports/dblog', array('query' => array('page' => $current_page))); + $this->assertPagerItems($current_page); + + // Verify last page. + $elements = $this->xpath('//li[contains(@class, :class)]/a', array(':class' => 'pager-last')); + preg_match('@page=(\d+)@', $elements[0]['href'], $matches); + $current_page = (int) $matches[1]; + $this->drupalGet($GLOBALS['base_root'] . $elements[0]['href'], array('external' => TRUE)); + $this->assertPagerItems($current_page); + } + + /** + * Asserts pager items and links. + * + * @param int $current_page + * The current pager page the internal browser is on. + */ + protected function assertPagerItems($current_page) { + $elements = $this->xpath('//ul[@class=:class]/li', array(':class' => 'pager')); + $this->assertTrue(!empty($elements), 'Pager found.'); + + // Make current page 1-based. + $current_page++; + + // Extract first/previous and next/last items. + // first/previous only exist, if the current page is not the first. + if ($current_page > 1) { + $first = array_shift($elements); + $previous = array_shift($elements); + } + // next/last always exist, unless the current page is the last. + if ($current_page != count($elements)) { + $last = array_pop($elements); + $next = array_pop($elements); + } + + // Verify items and links to pages. + foreach ($elements as $page => $element) { + // Make item/page index 1-based. + $page++; + if ($current_page == $page) { + $this->assertClass($element, 'pager-current', 'Item for current page has .pager-current class.'); + $this->assertFalse(isset($element->a), 'Item for current page has no link.'); + } + else { + $this->assertNoClass($element, 'pager-current', "Item for page $page has no .pager-current class."); + $this->assertClass($element, 'pager-item', "Item for page $page has .pager-item class."); + $this->assertTrue($element->a, "Link to page $page found."); + $this->assertNoClass($element->a, 'active', "Link to page $page is not active."); + } + unset($elements[--$page]); + } + // Verify that no other items remain untested. + $this->assertTrue(empty($elements), 'All expected items found.'); + + // Verify first/previous and next/last items and links. + if (isset($first)) { + $this->assertClass($first, 'pager-first', "Item for first page has .pager-first class."); + $this->assertTrue($first->a, "Link to first page found."); + $this->assertNoClass($first->a, 'active', "Link to first page is not active."); + } + if (isset($previous)) { + $this->assertClass($previous, 'pager-previous', "Item for first page has .pager-previous class."); + $this->assertTrue($previous->a, "Link to previous page found."); + $this->assertNoClass($previous->a, 'active', "Link to previous page is not active."); + } + if (isset($next)) { + $this->assertClass($next, 'pager-next', "Item for next page has .pager-next class."); + $this->assertTrue($next->a, "Link to next page found."); + $this->assertNoClass($next->a, 'active', "Link to next page is not active."); + } + if (isset($last)) { + $this->assertClass($last, 'pager-last', "Item for last page has .pager-last class."); + $this->assertTrue($last->a, "Link to last page found."); + $this->assertNoClass($last->a, 'active', "Link to last page is not active."); + } + } + + /** + * Asserts that an element has a given class. + * + * @param SimpleXMLElement $element + * The element to test. + * @param string $class + * The class to assert. + * @param string $message + * (optional) A verbose message to output. + */ + protected function assertClass(SimpleXMLElement $element, $class, $message = NULL) { + if (!isset($message)) { + $message = "Class .$class found."; + } + $this->assertTrue(strpos($element['class'], $class) !== FALSE, $message); + } + + /** + * Asserts that an element does not have a given class. + * + * @param SimpleXMLElement $element + * The element to test. + * @param string $class + * The class to assert. + * @param string $message + * (optional) A verbose message to output. + */ + protected function assertNoClass(SimpleXMLElement $element, $class, $message = NULL) { + if (!isset($message)) { + $message = "Class .$class not found."; + } + $this->assertTrue(strpos($element['class'], $class) === FALSE, $message); + } +} + diff --git a/core/modules/system/page.tpl.php b/core/modules/system/page.tpl.php index 578c56a24813e3c7b32ee2f3572601633bca9020..f77fdad07070fafad93fe78ad503c5721461ed71 100644 --- a/core/modules/system/page.tpl.php +++ b/core/modules/system/page.tpl.php @@ -4,6 +4,9 @@ * @file * Default theme implementation to display a single Drupal page. * + * The doctype, html, head and body tags are not in this template. Instead they + * can be found in the html.tpl.php template in this directory. + * * Available variables: * * General utility variables: @@ -64,6 +67,7 @@ * @see template_preprocess() * @see template_preprocess_page() * @see template_process() + * @see html.tpl.php */ ?> diff --git a/core/modules/system/system.admin-rtl.css b/core/modules/system/system.admin-rtl.css index 362a406c59c774639970b2fc642fb1442f326b83..e597e633f19e5f180c4d01728ba893340d9c47b6 100644 --- a/core/modules/system/system.admin-rtl.css +++ b/core/modules/system/system.admin-rtl.css @@ -1,4 +1,3 @@ - /** * @file * RTL styles for administration pages. @@ -10,15 +9,17 @@ div.admin-panel .body { padding: 0 8px 2px 4px; } -div.admin .left { - float: right; - margin-left: 0; - margin-right: 1em; -} -div.admin .right { - float: left; - margin-left: 1em; - margin-right: 0; +@media screen and (min-width: 40em) { + div.admin .left { + float: right; + margin-left: 0; + margin-right: 1em; + } + div.admin .right { + float: left; + margin-left: 1em; + margin-right: 0; + } } div.admin .expert-link { margin-right: 0; diff --git a/core/modules/system/system.admin.css b/core/modules/system/system.admin.css index 7299484c38d85f2242702863614d10e02714d052..0f3c0e53a9589808f8722ba6d6c3ee5194be68bd 100644 --- a/core/modules/system/system.admin.css +++ b/core/modules/system/system.admin.css @@ -1,4 +1,3 @@ - /** * @file * Styles for administration pages. @@ -21,15 +20,17 @@ div.admin-panel .body { div.admin { padding-top: 15px; } -div.admin .left { - float: left; /* LTR */ - width: 47%; - margin-left: 1em; /* LTR */ -} -div.admin .right { - float: right; /* LTR */ - width: 47%; - margin-right: 1em; /* LTR */ +@media screen and (min-width: 40em) { + div.admin .left { + float: left; /* LTR */ + width: 47%; + margin-left: 1em; /* LTR */ + } + div.admin .right { + float: right; /* LTR */ + width: 47%; + margin-right: 1em; /* LTR */ + } } div.admin .expert-link { text-align: right; /* LTR */ diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index 5d600110447a92009090c36a1bcab26d50a15a0d..00c75c749f0639b88158519b9457c62b29b70b08 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -3613,7 +3613,7 @@ function hook_date_format_types_alter(&$types) { * declared in an implementation of hook_date_format_types(). * - 'format': A PHP date format string to use when formatting dates. It * can contain any of the formatting options described at - * http://php.net/manual/en/function.date.php + * http://php.net/manual/function.date.php * - 'locales': (optional) An array of 2 and 5 character locale codes, * defining which locales this format applies to (for example, 'en', * 'en-us', etc.). If your date format is not language-specific, leave this diff --git a/core/modules/system/system.module b/core/modules/system/system.module index fd571ce58740f43b5b76bb1c83069ff7157aed52..98e32e8e28d25ac213f5d11e9e1e7bd55fca24f8 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -333,7 +333,7 @@ function system_element_info() { '#button_type' => 'submit', '#executes_submit_callback' => TRUE, '#limit_validation_errors' => FALSE, - '#process' => array('ajax_process_form'), + '#process' => array('form_process_button', 'ajax_process_form'), '#theme_wrappers' => array('button'), ); $types['button'] = array( @@ -342,7 +342,7 @@ function system_element_info() { '#button_type' => 'submit', '#executes_submit_callback' => FALSE, '#limit_validation_errors' => FALSE, - '#process' => array('ajax_process_form'), + '#process' => array('form_process_button', 'ajax_process_form'), '#theme_wrappers' => array('button'), ); $types['image_button'] = array( @@ -350,7 +350,7 @@ function system_element_info() { '#button_type' => 'submit', '#executes_submit_callback' => TRUE, '#limit_validation_errors' => FALSE, - '#process' => array('ajax_process_form'), + '#process' => array('form_process_button', 'ajax_process_form'), '#return_value' => TRUE, '#has_garbage_value' => TRUE, '#src' => NULL, @@ -394,6 +394,15 @@ function system_element_info() { '#theme' => 'url', '#theme_wrappers' => array('form_element'), ); + $types['search'] = array( + '#input' => TRUE, + '#size' => 60, + '#maxlength' => 128, + '#autocomplete_path' => FALSE, + '#process' => array('ajax_process_form'), + '#theme' => 'search', + '#theme_wrappers' => array('form_element'), + ); $types['machine_name'] = array( '#input' => TRUE, '#default_value' => NULL, @@ -3287,7 +3296,7 @@ function system_goto_action_form($context) { $form['url'] = array( '#type' => 'textfield', '#title' => t('URL'), - '#description' => t('The URL to which the user should be redirected. This can be an internal URL like node/1234 or an external URL like http://drupal.org.'), + '#description' => t('The URL to which the user should be redirected. This can be an internal URL like node/1234 or an external URL like @url.', array('@url' => 'http://drupal.org')), '#default_value' => isset($context['url']) ? $context['url'] : '', '#required' => TRUE, ); diff --git a/core/modules/system/system.tokens.inc b/core/modules/system/system.tokens.inc index fa95661eda3a74720ece3896790531a66d52918b..249289077e1a18b39b797e55b7f06ba438bb8d76 100644 --- a/core/modules/system/system.tokens.inc +++ b/core/modules/system/system.tokens.inc @@ -67,7 +67,7 @@ function system_token_info() { ); $date['custom'] = array( 'name' => t("Custom format"), - 'description' => t("A date in a custom format. See !php-date for details.", array('!php-date' => l(t('the PHP documentation'), 'http://php.net/manual/en/function.date.php'))), + 'description' => t("A date in a custom format. See !php-date for details.", array('!php-date' => l(t('the PHP documentation'), 'http://php.net/manual/function.date.php'))), ); $date['since'] = array( 'name' => t("Time-since"), diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 016fa367b4782adfbde82cd6c6001cdcbc04623e..865f17b3b3e182f1056b15deabe4cdae2bbc144c 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -456,6 +456,10 @@ function user_save($account, $edit = array()) { file_delete($account->original->picture); } } + elseif (isset($edit['picture_delete']) && $edit['picture_delete']) { + file_usage_delete($account->original->picture, 'user', 'user', $account->uid); + file_delete($account->original->picture); + } $account->picture = empty($account->picture->fid) ? 0 : $account->picture->fid; // Do not allow 'uid' to be changed. @@ -3671,6 +3675,14 @@ function user_register_form($form, &$form_state) { $admin = user_access('administer users'); + // Pass access information to the submit handler. Running an access check + // inside the submit function interferes with form processing and breaks + // hook_form_alter(). + $form['administer_users'] = array( + '#type' => 'value', + '#value' => $admin, + ); + // If we aren't admin but already logged on, go to the user page instead. if (!$admin && $user->uid) { drupal_goto('user/' . $user->uid); @@ -3728,7 +3740,7 @@ function user_register_validate($form, &$form_state) { * @see user_register_form() */ function user_register_submit($form, &$form_state) { - $admin = user_access('administer users'); + $admin = $form_state['values']['administer_users']; if (!variable_get('user_email_verification', TRUE) || $admin) { $pass = $form_state['values']['pass']; diff --git a/core/modules/user/user.test b/core/modules/user/user.test index 81d3e07127680fed2ba5291c8d90be2cad095afc..3a07e1cec7ff51da7f5015a5c6bf2de77e56e3e4 100644 --- a/core/modules/user/user.test +++ b/core/modules/user/user.test @@ -1074,6 +1074,50 @@ class UserPictureTestCase extends DrupalWebTestCase { $this->assertEqual($pic_path, (string) $elements[0]['src'], t("User picture source is correct: " . $pic_path . " " . print_r($elements, TRUE))); } + /** + * Tests deletion of user pictures. + */ + function testDeletePicture() { + $this->drupalLogin($this->user); + + $image = current($this->drupalGetTestFiles('image')); + $info = image_get_info($image->uri); + + // Set new variables: valid dimensions, valid filesize (0 = no limit). + $test_dim = ($info['width'] + 10) . 'x' . ($info['height'] + 10); + variable_set('user_picture_dimensions', $test_dim); + variable_set('user_picture_file_size', 0); + + // Save a new picture. + $edit = array('files[picture_upload]' => drupal_realpath($image->uri)); + $this->drupalPost('user/' . $this->user->uid . '/edit', $edit, t('Save')); + + // Load actual user data from database. + $account = user_load($this->user->uid, TRUE); + $pic_path = isset($account->picture) ? $account->picture->uri : NULL; + + // Check if image is displayed in user's profile page. + $this->drupalGet('user'); + $this->assertRaw(file_uri_target($pic_path), "Image is displayed in user's profile page"); + + // Check if file is located in proper directory. + $this->assertTrue(is_file($pic_path), 'File is located in proper directory'); + + $edit = array('picture_delete' => 1); + $this->drupalPost('user/' . $this->user->uid . '/edit', $edit, t('Save')); + + // Load actual user data from database. + $account1 = user_load($this->user->uid, TRUE); + $this->assertNull($account1->picture, 'User object has no picture'); + + $file = file_load($account->picture->fid); + $this->assertFalse($file, 'File is removed from database'); + + // Clear out PHP's file stat cache so we see the current value. + clearstatcache(); + $this->assertFalse(is_file($pic_path), 'File is removed from file system'); + } + function saveUserPicture($image) { $edit = array('files[picture_upload]' => drupal_realpath($image->uri)); $this->drupalPost('user/' . $this->user->uid . '/edit', $edit, t('Save')); diff --git a/core/themes/bartik/css/style.css b/core/themes/bartik/css/style.css index 8fbe5aa1fd8bf224b98a9c8de13fe930de93ca0b..ca37fae144290d49e77f4c852e750364e856f477 100644 --- a/core/themes/bartik/css/style.css +++ b/core/themes/bartik/css/style.css @@ -800,7 +800,7 @@ ul.links { #triptych-last #block-node-syndicate { text-align: right; } -#triptych #block-search-form .form-type-textfield input { +#triptych #block-search-form .form-type-search input { width: 185px; } #triptych-middle #block-system-powered-by { @@ -1191,6 +1191,7 @@ input.form-text, input.form-tel, input.form-email, input.form-url, +input.form-search, textarea.form-textarea, select.form-select { border: 1px solid #ccc; @@ -1374,11 +1375,20 @@ div.vertical-tabs .vertical-tabs-panes fieldset.vertical-tabs-pane { #block-search-form .content { margin-top: 0; } +#search-form input[type="search"], +#block-search-form input[type="search"] { + box-sizing: border-box; + padding: 4px; + -webkit-appearance: textfield; +} +#search-form input[type="search"]::-webkit-search-decoration, +#block-search-form input[type="search"]::-webkit-search-decoration { + display: none; +} #search-form input#edit-keys, #block-search-form .form-item-search-block-form input { float: left; /* LTR */ font-size: 1em; - height: 1.143em; margin-right: 5px; width: 9em; } diff --git a/core/themes/bartik/templates/page.tpl.php b/core/themes/bartik/templates/page.tpl.php index 44e9ceae68bffed964e89791b16d6698a50c0daf..954232c47f620dd36de2c8b39b83657beefbf5ba 100644 --- a/core/themes/bartik/templates/page.tpl.php +++ b/core/themes/bartik/templates/page.tpl.php @@ -6,7 +6,7 @@ * * The doctype, html, head and body tags are not in this template. Instead they * can be found in the html.tpl.php template normally located in the - * modules/system folder. + * core/modules/system directory. * * Available variables: * @@ -82,6 +82,7 @@ * @see template_preprocess_page() * @see template_process() * @see bartik_process_page() + * @see html.tpl.php */ ?> <div id="page-wrapper"><div id="page"> diff --git a/core/themes/seven/style.css b/core/themes/seven/style.css index f5c4aabb8872beb8bf727ab10a477d6e4d8b38f1..b298d1c63e2cf74cd2d9db8aac0be22c9ace0cc8 100644 --- a/core/themes/seven/style.css +++ b/core/themes/seven/style.css @@ -1,4 +1,3 @@ - /** * Generic elements. */ @@ -604,6 +603,7 @@ div.teaser-checkbox .form-item, .form-disabled input.form-tel, .form-disabled input.form-email, .form-disabled input.form-url, +.form-disabled input.form-search, .form-disabled input.form-file, .form-disabled textarea.form-textarea, .form-disabled select.form-select { @@ -693,6 +693,7 @@ input.form-text, input.form-tel, input.form-email, input.form-url, +input.form-search, input.form-file, textarea.form-textarea, select.form-select { @@ -709,6 +710,7 @@ input.form-text:focus, input.form-tel:focus, input.form-email:focus, input.form-url:focus, +input.form-search:focus, input.form-file:focus, textarea.form-textarea:focus, select.form-select:focus { @@ -750,10 +752,12 @@ div.filter-options select { /** * System. */ -div.admin .right, -div.admin .left { - width: 49%; - margin: 0; +@media screen and (min-width: 40em) { + div.admin .right, + div.admin .left { + width: 49%; + margin: 0; + } } div.admin-panel, div.admin-panel .body { diff --git a/profiles/minimal/minimal.info b/profiles/minimal/minimal.info index f2219481d2890bc47a110689d1847ab4a552d729..506df4256667b764ca9dcb566e1ee4b792ac1074 100644 --- a/profiles/minimal/minimal.info +++ b/profiles/minimal/minimal.info @@ -5,4 +5,3 @@ core = 8.x dependencies[] = node dependencies[] = block dependencies[] = dblog -files[] = minimal.profile diff --git a/profiles/standard/standard.info b/profiles/standard/standard.info index e21c18c89e2b0fb5a3f976332842135b1b33fc4b..4332a59597a1476c55a0d1fa9a279d18e37d3b1b 100644 --- a/profiles/standard/standard.info +++ b/profiles/standard/standard.info @@ -24,4 +24,3 @@ dependencies[] = overlay dependencies[] = field_ui dependencies[] = file dependencies[] = rdf -files[] = standard.profile diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php index 7531a98ac24c77cffad15e5f7740ae8b86a76fa4..4f3fab8ad699aeabf3c0c38d3d2b51614662fb43 100755 --- a/sites/default/default.settings.php +++ b/sites/default/default.settings.php @@ -285,7 +285,7 @@ * * To see what PHP settings are possible, including whether they can be set at * runtime (by using ini_set()), read the PHP documentation: - * http://www.php.net/manual/en/ini.list.php + * http://php.net/manual/ini.list.php * See drupal_initialize_variables() in includes/bootstrap.inc for required * runtime settings and the .htaccess file for non-runtime settings. Settings * defined there should not be duplicated here so as to avoid conflict issues. @@ -321,7 +321,7 @@ * output filter may not have sufficient memory to process it. If you * experience this issue, you may wish to uncomment the following two lines * and increase the limits of these variables. For more information, see - * http://php.net/manual/en/pcre.configuration.php. + * http://php.net/manual/pcre.configuration.php. */ # ini_set('pcre.backtrack_limit', 200000); # ini_set('pcre.recursion_limit', 200000);