From 56d2664a904119f73e7df4fb355e4c525e040b70 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 14 Apr 2008 17:48:46 +0000 Subject: - Patch #245115 by kkaefer, John Morahan, JohnAlbin et al: after a long discussion we've decided to make the concatenation operator consistent with the other operators. --- includes/actions.inc | 4 +- includes/batch.inc | 8 +- includes/bootstrap.inc | 24 +++--- includes/cache.inc | 18 ++--- includes/common.inc | 158 ++++++++++++++++++------------------- includes/database.inc | 20 ++--- includes/database.mysql-common.inc | 66 ++++++++-------- includes/database.mysql.inc | 26 +++--- includes/database.mysqli.inc | 24 +++--- includes/database.pgsql.inc | 104 ++++++++++++------------ includes/file.inc | 40 +++++----- includes/form.inc | 154 ++++++++++++++++++------------------ includes/image.gd.inc | 4 +- includes/image.inc | 6 +- includes/install.inc | 44 +++++------ includes/install.mysql.inc | 2 +- includes/install.pgsql.inc | 10 +-- includes/language.inc | 2 +- includes/locale.inc | 84 ++++++++++---------- includes/mail.inc | 26 +++--- includes/menu.inc | 90 ++++++++++----------- includes/module.inc | 10 +-- includes/path.inc | 2 +- includes/session.inc | 2 +- includes/tablesort.inc | 4 +- includes/theme.inc | 154 ++++++++++++++++++------------------ includes/theme.maintenance.inc | 24 +++--- includes/unicode.inc | 4 +- includes/xmlrpc.inc | 24 +++--- includes/xmlrpcs.inc | 10 +-- 30 files changed, 574 insertions(+), 574 deletions(-) (limited to 'includes') diff --git a/includes/actions.inc b/includes/actions.inc index 8eeca815d..8811383a0 100644 --- a/includes/actions.inc +++ b/includes/actions.inc @@ -65,8 +65,8 @@ function actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a if ($where) { $where_clause = implode(' ', $where); // Strip off leading 'OR '. - $where_clause = '('. strstr($where_clause, " ") .')'; - $result_db = db_query('SELECT * FROM {actions} WHERE '. $where_clause, $where_values); + $where_clause = '(' . strstr($where_clause, " ") . ')'; + $result_db = db_query('SELECT * FROM {actions} WHERE ' . $where_clause, $where_values); while ($action = db_fetch_object($result_db)) { $actions[$action->aid] = $action->parameters ? unserialize($action->parameters) : array(); $actions[$action->aid]['callback'] = $action->callback; diff --git a/includes/batch.inc b/includes/batch.inc index cd2127f0b..798d2b3eb 100644 --- a/includes/batch.inc +++ b/includes/batch.inc @@ -78,7 +78,7 @@ function _batch_progress_page_js() { $url = url($batch['url'], array('query' => array('id' => $batch['id']))); $js_setting = array( 'batch' => array( - 'errorMessage' => $current_set['error_message'] .'
'. $batch['error_message'], + 'errorMessage' => $current_set['error_message'] . '
' . $batch['error_message'], 'initMessage' => $current_set['init_message'], 'uri' => $url, ), @@ -132,7 +132,7 @@ function _batch_progress_page_nojs() { // function), it will output whatever is in the output buffer, // followed by the error message. ob_start(); - $fallback = $current_set['error_message'] .'
'. $batch['error_message']; + $fallback = $current_set['error_message'] . '
' . $batch['error_message']; $fallback = theme('maintenance_page', $fallback, FALSE, FALSE); // We strip the end of the page using a marker in the template, so any @@ -153,7 +153,7 @@ function _batch_progress_page_nojs() { } $url = url($batch['url'], array('query' => array('id' => $batch['id'], 'op' => $new_op))); - drupal_set_html_head(''); + drupal_set_html_head(''); $output = theme('progress_bar', $percentage, $message); return $output; } @@ -243,7 +243,7 @@ function _batch_process() { '@current' => floor($current), '@percentage' => $percentage, ); - $message = strtr($progress_message, $values) .'
'; + $message = strtr($progress_message, $values) . '
'; $message .= $task_message ? $task_message : ' '; return array($percentage, $message); diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 106320c25..49659f8ca 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -277,8 +277,8 @@ function conf_init() { global $db_url, $db_prefix, $cookie_domain, $conf, $installed_profile, $update_free_access; $conf = array(); - if (file_exists('./'. conf_path() .'/settings.php')) { - include_once './'. conf_path() .'/settings.php'; + if (file_exists('./' . conf_path() . '/settings.php')) { + include_once './' . conf_path() . '/settings.php'; } if (isset($base_url)) { @@ -287,7 +287,7 @@ function conf_init() { if (!isset($parts['path'])) { $parts['path'] = ''; } - $base_path = $parts['path'] .'/'; + $base_path = $parts['path'] . '/'; // Build $base_root (everything until first slash after "scheme://"). $base_root = substr($base_url, 0, strlen($base_url) - strlen($parts['path'])); } @@ -297,7 +297,7 @@ function conf_init() { // As $_SERVER['HTTP_HOST'] is user input, ensure it only contains // characters allowed in hostnames. - $base_url = $base_root .= '://'. preg_replace('/[^a-z0-9-:._]/i', '', $_SERVER['HTTP_HOST']); + $base_url = $base_root .= '://' . preg_replace('/[^a-z0-9-:._]/i', '', $_SERVER['HTTP_HOST']); // $_SERVER['SCRIPT_NAME'] can, in contrast to $_SERVER['PHP_SELF'], not // be modified by a visitor. @@ -330,13 +330,13 @@ function conf_init() { $cookie_domain = substr($cookie_domain, 4); } $cookie_domain = explode(':', $cookie_domain); - $cookie_domain = '.'. $cookie_domain[0]; + $cookie_domain = '.' . $cookie_domain[0]; // Per RFC 2109, cookie domains must contain at least one dot other than the // first. For hosts such as 'localhost' or IP Addresses we don't set a cookie domain. if (count(explode('.', $cookie_domain)) > 2 && !is_numeric(str_replace('.', '', $cookie_domain))) { ini_set('session.cookie_domain', $cookie_domain); } - session_name('SESS'. md5($session_name)); + session_name('SESS' . md5($session_name)); } /** @@ -566,7 +566,7 @@ function drupal_load($type, $name) { */ function drupal_page_header() { header("Expires: Sun, 19 Nov 1978 05:00:00 GMT"); - header("Last-Modified: ". gmdate("D, d M Y H:i:s") ." GMT"); + header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", FALSE); } @@ -582,8 +582,8 @@ function drupal_page_header() { */ function drupal_page_cache_header($cache) { // Set default values: - $last_modified = gmdate('D, d M Y H:i:s', $cache->created) .' GMT'; - $etag = '"'. md5($last_modified) .'"'; + $last_modified = gmdate('D, d M Y H:i:s', $cache->created) . ' GMT'; + $etag = '"' . md5($last_modified) . '"'; // See if the client has provided the required HTTP headers: $if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE']) : FALSE; @@ -720,10 +720,10 @@ function request_uri() { } else { if (isset($_SERVER['argv'])) { - $uri = $_SERVER['SCRIPT_NAME'] .'?'. $_SERVER['argv'][0]; + $uri = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['argv'][0]; } elseif (isset($_SERVER['QUERY_STRING'])) { - $uri = $_SERVER['SCRIPT_NAME'] .'?'. $_SERVER['QUERY_STRING']; + $uri = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING']; } else { $uri = $_SERVER['SCRIPT_NAME']; @@ -955,7 +955,7 @@ function _drupal_bootstrap($phase) { // Deny access to blocked IP addresses - t() is not yet available. if (drupal_is_denied(ip_address())) { header('HTTP/1.1 403 Forbidden'); - print 'Sorry, '. check_plain(ip_address()) .' has been banned.'; + print 'Sorry, ' . check_plain(ip_address()) . ' has been banned.'; exit(); } break; diff --git a/includes/cache.inc b/includes/cache.inc index 9fe7602c0..06b03fe2c 100644 --- a/includes/cache.inc +++ b/includes/cache.inc @@ -20,10 +20,10 @@ function cache_get($cid, $table = 'cache') { // Reset the variable immediately to prevent a meltdown in heavy load situations. variable_set('cache_flush', 0); // Time to flush old cache data - db_query("DELETE FROM {". $table ."} WHERE expire != %d AND expire <= %d", CACHE_PERMANENT, $cache_flush); + db_query("DELETE FROM {" . $table . "} WHERE expire != %d AND expire <= %d", CACHE_PERMANENT, $cache_flush); } - $cache = db_fetch_object(db_query("SELECT data, created, headers, expire, serialized FROM {". $table ."} WHERE cid = '%s'", $cid)); + $cache = db_fetch_object(db_query("SELECT data, created, headers, expire, serialized FROM {" . $table . "} WHERE cid = '%s'", $cid)); if (isset($cache->data)) { // If the data is permanent or we're not enforcing a minimum cache lifetime // always return the cached data. @@ -106,9 +106,9 @@ function cache_set($cid, $data, $table = 'cache', $expire = CACHE_PERMANENT, $he $serialized = 1; } $created = time(); - db_query("UPDATE {". $table ."} SET data = %b, created = %d, expire = %d, headers = '%s', serialized = %d WHERE cid = '%s'", $data, $created, $expire, $headers, $serialized, $cid); + db_query("UPDATE {" . $table . "} SET data = %b, created = %d, expire = %d, headers = '%s', serialized = %d WHERE cid = '%s'", $data, $created, $expire, $headers, $serialized, $cid); if (!db_affected_rows()) { - @db_query("INSERT INTO {". $table ."} (cid, data, created, expire, headers, serialized) VALUES ('%s', %b, %d, %d, '%s', %d)", $cid, $data, $created, $expire, $headers, $serialized); + @db_query("INSERT INTO {" . $table . "} (cid, data, created, expire, headers, serialized) VALUES ('%s', %b, %d, %d, '%s', %d)", $cid, $data, $created, $expire, $headers, $serialized); } } @@ -157,26 +157,26 @@ function cache_clear_all($cid = NULL, $table = NULL, $wildcard = FALSE) { else if (time() > ($cache_flush + variable_get('cache_lifetime', 0))) { // Clear the cache for everyone, cache_flush_delay seconds have // passed since the first request to clear the cache. - db_query("DELETE FROM {". $table ."} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time()); + db_query("DELETE FROM {" . $table . "} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time()); variable_set('cache_flush', 0); } } else { // No minimum cache lifetime, flush all temporary cache entries now. - db_query("DELETE FROM {". $table ."} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time()); + db_query("DELETE FROM {" . $table . "} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time()); } } else { if ($wildcard) { if ($cid == '*') { - db_query("DELETE FROM {". $table ."}"); + db_query("DELETE FROM {" . $table . "}"); } else { - db_query("DELETE FROM {". $table ."} WHERE cid LIKE '%s%%'", $cid); + db_query("DELETE FROM {" . $table . "} WHERE cid LIKE '%s%%'", $cid); } } else { - db_query("DELETE FROM {". $table ."} WHERE cid = '%s'", $cid); + db_query("DELETE FROM {" . $table . "} WHERE cid = '%s'", $cid); } } } diff --git a/includes/common.inc b/includes/common.inc index 721091bad..371f3443f 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -105,7 +105,7 @@ function drupal_set_html_head($data = NULL) { static $stored_head = ''; if (!is_null($data)) { - $stored_head .= $data ."\n"; + $stored_head .= $data . "\n"; } return $stored_head; } @@ -209,7 +209,7 @@ function drupal_query_string_encode($query, $exclude = array(), $parent = '') { foreach ($query as $key => $value) { $key = drupal_urlencode($key); if ($parent) { - $key = $parent .'['. $key .']'; + $key = $parent . '[' . $key . ']'; } if (in_array($key, $exclude)) { @@ -220,7 +220,7 @@ function drupal_query_string_encode($query, $exclude = array(), $parent = '') { $params[] = drupal_query_string_encode($value, $exclude, $key); } else { - $params[] = $key .'='. drupal_urlencode($value); + $params[] = $key . '=' . drupal_urlencode($value); } } @@ -239,16 +239,16 @@ function drupal_query_string_encode($query, $exclude = array(), $parent = '') { */ function drupal_get_destination() { if (isset($_REQUEST['destination'])) { - return 'destination='. urlencode($_REQUEST['destination']); + return 'destination=' . urlencode($_REQUEST['destination']); } else { // Use $_GET here to retrieve the original path in source form. $path = isset($_GET['q']) ? $_GET['q'] : ''; $query = drupal_query_string_encode($_GET, array('q')); if ($query != '') { - $path .= '?'. $query; + $path .= '?' . $query; } - return 'destination='. urlencode($path); + return 'destination=' . urlencode($path); } } @@ -316,7 +316,7 @@ function drupal_goto($path = '', $query = NULL, $fragment = NULL, $http_response // need all session data written to the database before redirecting. session_write_close(); - header('Location: '. $url, TRUE, $http_response_code); + header('Location: ' . $url, TRUE, $http_response_code); // The "Location" header sends a redirect status code to the HTTP daemon. In // some cases this can be wrong, so we make sure none of the code below the @@ -438,17 +438,17 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data = switch ($uri['scheme']) { case 'http': $port = isset($uri['port']) ? $uri['port'] : 80; - $host = $uri['host'] . ($port != 80 ? ':'. $port : ''); + $host = $uri['host'] . ($port != 80 ? ':' . $port : ''); $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15); break; case 'https': // Note: Only works for PHP 4.3 compiled with OpenSSL. $port = isset($uri['port']) ? $uri['port'] : 443; - $host = $uri['host'] . ($port != 443 ? ':'. $port : ''); - $fp = @fsockopen('ssl://'. $uri['host'], $port, $errno, $errstr, 20); + $host = $uri['host'] . ($port != 443 ? ':' . $port : ''); + $fp = @fsockopen('ssl://' . $uri['host'], $port, $errno, $errstr, 20); break; default: - $result->error = 'invalid schema '. $uri['scheme']; + $result->error = 'invalid schema ' . $uri['scheme']; return $result; } @@ -464,7 +464,7 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data = // Construct the path to act on. $path = isset($uri['path']) ? $uri['path'] : '/'; if (isset($uri['query'])) { - $path .= '?'. $uri['query']; + $path .= '?' . $uri['query']; } // Create HTTP request. @@ -474,23 +474,23 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data = // host that do not take into account the port number. 'Host' => "Host: $host", 'User-Agent' => 'User-Agent: Drupal (+http://drupal.org/)', - 'Content-Length' => 'Content-Length: '. strlen($data) + 'Content-Length' => 'Content-Length: ' . strlen($data) ); // If the server url has a user then attempt to use basic authentication if (isset($uri['user'])) { - $defaults['Authorization'] = 'Authorization: Basic '. base64_encode($uri['user'] . (!empty($uri['pass']) ? ":". $uri['pass'] : '')); + $defaults['Authorization'] = 'Authorization: Basic ' . base64_encode($uri['user'] . (!empty($uri['pass']) ? ":" . $uri['pass'] : '')); } foreach ($headers as $header => $value) { - $defaults[$header] = $header .': '. $value; + $defaults[$header] = $header . ': ' . $value; } - $request = $method .' '. $path ." HTTP/1.0\r\n"; + $request = $method . ' ' . $path . " HTTP/1.0\r\n"; $request .= implode("\r\n", $defaults); $request .= "\r\n\r\n"; if ($data) { - $request .= $data ."\r\n"; + $request .= $data . "\r\n"; } $result->request = $request; @@ -516,7 +516,7 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data = if (isset($result->headers[$header]) && $header == 'Set-Cookie') { // RFC 2109: the Set-Cookie response header comprises the token Set- // Cookie:, followed by a comma-separated list of one or more cookies. - $result->headers[$header] .= ','. trim($value); + $result->headers[$header] .= ',' . trim($value); } else { $result->headers[$header] = trim($value); @@ -599,7 +599,7 @@ function drupal_error_handler($errno, $message, $filename, $line, $context) { } } - $entry = $types[$errno] .': '. $message .' in '. $filename .' on line '. $line .'.'; + $entry = $types[$errno] . ': ' . $message . ' in ' . $filename . ' on line ' . $line . '.'; // Force display of error messages in update.php. if (variable_get('error_level', 1) == 1 || strstr($_SERVER['SCRIPT_NAME'], 'update.php')) { @@ -719,7 +719,7 @@ function fix_gpc_magic() { * * Here is an example of t() used correctly: * @code - * $output .= '

'. t('Go to the contact page.', array('@contact-page' => url('contact'))) .'

'; + * $output .= '

' . t('Go to the contact page.', array('@contact-page' => url('contact'))) . '

'; * @endcode * * Also avoid escaping quotation marks wherever possible. @@ -761,7 +761,7 @@ function t($string, $args = array(), $langcode = NULL) { // handful of string replacements. See settings.php for examples. // Cache the $custom_strings variable to improve performance. if (!isset($custom_strings[$langcode])) { - $custom_strings[$langcode] = variable_get('locale_custom_strings_'. $langcode, array()); + $custom_strings[$langcode] = variable_get('locale_custom_strings_' . $langcode, array()); } // Custom strings work for English too, even if locale module is disabled. if (isset($custom_strings[$langcode][$string])) { @@ -838,10 +838,10 @@ function valid_email_address($mail) { function valid_url($url, $absolute = FALSE) { $allowed_characters = '[a-z0-9\/:_\-_\.\?\$,;~=#&%\+]'; if ($absolute) { - return preg_match("/^(http|https|ftp):\/\/". $allowed_characters ."+$/i", $url); + return preg_match("/^(http|https|ftp):\/\/" . $allowed_characters . "+$/i", $url); } else { - return preg_match("/^". $allowed_characters ."+$/i", $url); + return preg_match("/^" . $allowed_characters . "+$/i", $url); } } @@ -904,14 +904,14 @@ function format_rss_channel($title, $link, $description, $items, $langcode = NUL $langcode = $langcode ? $langcode : $language->language; $output = "\n"; - $output .= ' '. check_plain($title) ."\n"; - $output .= ' '. check_url($link) ."\n"; + $output .= ' ' . check_plain($title) . "\n"; + $output .= ' ' . check_url($link) . "\n"; // The RSS 2.0 "spec" doesn't indicate HTML can be used in the description. // We strip all HTML tags, but need to prevent double encoding from properly // escaped source data (such as & becoming &amp;). - $output .= ' '. check_plain(decode_entities(strip_tags($description))) ."\n"; - $output .= ' '. check_plain($langcode) ."\n"; + $output .= ' ' . check_plain(decode_entities(strip_tags($description))) . "\n"; + $output .= ' ' . check_plain($langcode) . "\n"; $output .= format_xml_elements($args); $output .= $items; $output .= "\n"; @@ -926,9 +926,9 @@ function format_rss_channel($title, $link, $description, $items, $langcode = NUL */ function format_rss_item($title, $link, $description, $args = array()) { $output = "\n"; - $output .= ' '. check_plain($title) ."\n"; - $output .= ' '. check_url($link) ."\n"; - $output .= ' '. check_plain($description) ."\n"; + $output .= ' ' . check_plain($title) . "\n"; + $output .= ' ' . check_url($link) . "\n"; + $output .= ' ' . check_plain($description) . "\n"; $output .= format_xml_elements($args); $output .= "\n"; @@ -954,13 +954,13 @@ function format_xml_elements($array) { foreach ($array as $key => $value) { if (is_numeric($key)) { if ($value['key']) { - $output .= ' <'. $value['key']; + $output .= ' <' . $value['key']; if (isset($value['attributes']) && is_array($value['attributes'])) { $output .= drupal_attributes($value['attributes']); } if ($value['value'] != '') { - $output .= '>'. (is_array($value['value']) ? format_xml_elements($value['value']) : check_plain($value['value'])) .'\n"; + $output .= '>' . (is_array($value['value']) ? format_xml_elements($value['value']) : check_plain($value['value'])) . '\n"; } else { $output .= " />\n"; @@ -968,7 +968,7 @@ function format_xml_elements($array) { } } else { - $output .= ' <'. $key .'>'. (is_array($value) ? format_xml_elements($value) : check_plain($value)) ."\n"; + $output .= ' <' . $key . '>' . (is_array($value) ? format_xml_elements($value) : check_plain($value)) . "\n"; } } return $output; @@ -1040,8 +1040,8 @@ function format_plural($count, $singular, $plural, $args = array(), $langcode = return t($plural, $args, $langcode); default: unset($args['@count']); - $args['@count['. $index .']'] = $count; - return t(strtr($plural, array('@count' => '@count['. $index .']')), $args, $langcode); + $args['@count[' . $index . ']'] = $count; + return t(strtr($plural, array('@count' => '@count[' . $index . ']')), $args, $langcode); } } } @@ -1187,7 +1187,7 @@ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NUL // Special treatment for long month names: May is both an abbreviation // and a full month name in English, but other languages have // different abbreviations. - $date .= trim(t('!long-month-name '. gmdate($c, $timestamp), array('!long-month-name' => ''), $langcode)); + $date .= trim(t('!long-month-name ' . gmdate($c, $timestamp), array('!long-month-name' => ''), $langcode)); } else if (strpos('BdgGhHiIjLmnsStTUwWYyz', $c) !== FALSE) { $date .= gmdate($c, $timestamp); @@ -1276,7 +1276,7 @@ function url($path = NULL, $options = array()) { language_url_rewrite($path, $options); } if ($options['fragment']) { - $options['fragment'] = '#'. $options['fragment']; + $options['fragment'] = '#' . $options['fragment']; } if (is_array($options['query'])) { $options['query'] = drupal_query_string_encode($options['query']); @@ -1287,7 +1287,7 @@ function url($path = NULL, $options = array()) { if (strpos($path, '#') !== FALSE) { list($path, $old_fragment) = explode('#', $path, 2); if (isset($old_fragment) && !$options['fragment']) { - $options['fragment'] = '#'. $old_fragment; + $options['fragment'] = '#' . $old_fragment; } } // Append the query. @@ -1335,14 +1335,14 @@ function url($path = NULL, $options = array()) { custom_url_rewrite_outbound($path, $options, $original_path); } - $base = $options['absolute'] ? $options['base_url'] .'/' : base_path(); + $base = $options['absolute'] ? $options['base_url'] . '/' : base_path(); $prefix = empty($path) ? rtrim($options['prefix'], '/') : $options['prefix']; $path = drupal_urlencode($prefix . $path); if ($clean_url) { // With Clean URLs. if ($options['query']) { - return $base . $path .'?'. $options['query'] . $options['fragment']; + return $base . $path . '?' . $options['query'] . $options['fragment']; } else { return $base . $path . $options['fragment']; @@ -1352,13 +1352,13 @@ function url($path = NULL, $options = array()) { // Without Clean URLs. $variables = array(); if (!empty($path)) { - $variables[] = 'q='. $path; + $variables[] = 'q=' . $path; } if (!empty($options['query'])) { $variables[] = $options['query']; } if ($query = join('&', $variables)) { - return $base . $script .'?'. $query . $options['fragment']; + return $base . $script . '?' . $query . $options['fragment']; } else { return $base . $options['fragment']; @@ -1378,7 +1378,7 @@ function drupal_attributes($attributes = array()) { if (is_array($attributes)) { $t = ''; foreach ($attributes as $key => $value) { - $t .= " $key=".'"'. check_plain($value) .'"'; + $t .= " $key=" . '"' . check_plain($value) . '"'; } return $t; } @@ -1450,7 +1450,7 @@ function l($text, $path, $options = array()) { $options['attributes']['title'] = strip_tags($options['attributes']['title']); } - return ''. ($options['html'] ? $text : check_plain($text)) .''; + return '' . ($options['html'] ? $text : check_plain($text)) . ''; } /** @@ -1534,7 +1534,7 @@ function drupal_eval($code) { } ob_start(); - print eval('?>'. $code); + print eval('?>' . $code); $output = ob_get_contents(); ob_end_clean(); @@ -1571,7 +1571,7 @@ function base_path() { * Add a tag to the page's HEAD. */ function drupal_add_link($attributes) { - drupal_set_html_head('\n"); + drupal_set_html_head('\n"); } /** @@ -1688,7 +1688,7 @@ function drupal_get_css($css = NULL) { // browser-caching. The string changes on every update or full cache // flush, forcing browsers to load a new copy of the files, as the // URL changed. - $query_string = '?'. substr(variable_get('css_js_query_string', '0'), 0, 1); + $query_string = '?' . substr(variable_get('css_js_query_string', '0'), 0, 1); foreach ($css as $media => $types) { // If CSS preprocessing is off, we still need to output the styles. @@ -1713,24 +1713,24 @@ function drupal_get_css($css = NULL) { // If a CSS file is not to be preprocessed and it's a module CSS file, it needs to *always* appear at the *top*, // regardless of whether preprocessing is on or off. if (!$preprocess && $type == 'module') { - $no_module_preprocess .= ''."\n"; + $no_module_preprocess .= '' . "\n"; } // If a CSS file is not to be preprocessed and it's a theme CSS file, it needs to *always* appear at the *bottom*, // regardless of whether preprocessing is on or off. else if (!$preprocess && $type == 'theme') { - $no_theme_preprocess .= ''."\n"; + $no_theme_preprocess .= '' . "\n"; } else { - $output .= ''."\n"; + $output .= '' . "\n"; } } } } if ($is_writable && $preprocess_css) { - $filename = md5(serialize($types) . $query_string) .'.css'; + $filename = md5(serialize($types) . $query_string) . '.css'; $preprocess_file = drupal_build_css_cache($types, $filename); - $output .= ''."\n"; + $output .= '' . "\n"; } } @@ -1755,14 +1755,14 @@ function drupal_build_css_cache($types, $filename) { $csspath = file_create_path('css'); file_check_directory($csspath, FILE_CREATE_DIRECTORY); - if (!file_exists($csspath .'/'. $filename)) { + if (!file_exists($csspath . '/' . $filename)) { // Build aggregate CSS file. foreach ($types as $type) { foreach ($type as $file => $cache) { if ($cache) { $contents = drupal_load_stylesheet($file, TRUE); // Return the path to where this CSS file originated from. - $base = base_path() . dirname($file) .'/'; + $base = base_path() . dirname($file) . '/'; _drupal_build_css_path(NULL, $base); // Prefix all paths within this CSS file, ignoring external and absolute paths. $data .= preg_replace_callback('/url\([\'"]?(?![a-z]+:|\/+)([^\'")]+)[\'"]?\)/i', '_drupal_build_css_path', $contents); @@ -1778,9 +1778,9 @@ function drupal_build_css_cache($types, $filename) { $data = implode('', $matches[0]) . $data; // Create the CSS file. - file_save_data($data, $csspath .'/'. $filename, FILE_EXISTS_REPLACE); + file_save_data($data, $csspath . '/' . $filename, FILE_EXISTS_REPLACE); } - return $csspath .'/'. $filename; + return $csspath . '/' . $filename; } /** @@ -1802,7 +1802,7 @@ function _drupal_build_css_path($matches, $base = NULL) { $last = $path; $path = preg_replace('`(^|/)(?!../)([^/]+)/../`', '$1', $path); } - return 'url('. $path .')'; + return 'url(' . $path . ')'; } /** @@ -1872,7 +1872,7 @@ function _drupal_load_stylesheet($matches) { // Load the imported stylesheet and replace @import commands in there as well. $file = drupal_load_stylesheet($filename); // Alter all url() paths, but not external. - return preg_replace('/url\(([\'"]?)(?![a-z]+:)([^\'")]+)[\'"]?\)?;/i', 'url(\1'. dirname($filename) .'/', $file); + return preg_replace('/url\(([\'"]?)(?![a-z]+:)([^\'")]+)[\'"]?\)?;/i', 'url(\1' . dirname($filename) . '/', $file); } /** @@ -2039,7 +2039,7 @@ function drupal_get_js($scope = 'header', $javascript = NULL) { // URL changed. Files that should not be cached (see drupal_add_js()) // get time() as query-string instead, to enforce reload on every // page request. - $query_string = '?'. substr(variable_get('css_js_query_string', '0'), 0, 1); + $query_string = '?' . substr(variable_get('css_js_query_string', '0'), 0, 1); foreach ($javascript as $type => $data) { @@ -2047,11 +2047,11 @@ function drupal_get_js($scope = 'header', $javascript = NULL) { switch ($type) { case 'setting': - $output .= '\n"; + $output .= '\n"; break; case 'inline': foreach ($data as $info) { - $output .= '\n"; + $output .= '\n"; } break; default: @@ -2059,7 +2059,7 @@ function drupal_get_js($scope = 'header', $javascript = NULL) { // Additionally, go through any remaining scripts if JS preprocessing is on and output the non-cached ones. foreach ($data as $path => $info) { if (!$info['preprocess'] || !$is_writable || !$preprocess_js) { - $no_preprocess[$type] .= '\n"; + $no_preprocess[$type] .= '\n"; } else { $files[$path] = $info; @@ -2070,9 +2070,9 @@ function drupal_get_js($scope = 'header', $javascript = NULL) { // Aggregate any remaining JS files that haven't already been output. if ($is_writable && $preprocess_js && count($files) > 0) { - $filename = md5(serialize($files) . $query_string) .'.js'; + $filename = md5(serialize($files) . $query_string) . '.js'; $preprocess_file = drupal_build_js_cache($files, $filename); - $preprocessed .= ''."\n"; + $preprocessed .= '' . "\n"; } // Keep the order of JS files consistent as some are preprocessed and others are not. @@ -2131,16 +2131,16 @@ function drupal_get_js($scope = 'header', $javascript = NULL) { * the block regions on the admin/build/block page), a separate subgroup class * must also be added to differentiate the groups. * @code - * $form['my_elements'][$region][$delta]['weight']['#attributes']['class'] = "my-elements-weight my-elements-weight-". $region; + * $form['my_elements'][$region][$delta]['weight']['#attributes']['class'] = "my-elements-weight my-elements-weight-" . $region; * @endcode * * $group is still 'my-element-weight', and the additional $subgroup variable - * will be passed in as 'my-elements-weight-'. $region. This also means that + * will be passed in as 'my-elements-weight-' . $region. This also means that * you'll need to call drupal_add_tabledrag() once for every region added. * * @code * foreach ($regions as $region) { - * drupal_add_tabledrag('my-module-table', 'order', 'sibling', 'my-elements-weight', 'my-elements-weight-'. $region); + * drupal_add_tabledrag('my-module-table', 'order', 'sibling', 'my-elements-weight', 'my-elements-weight-' . $region); * } * @endcode * @@ -2227,20 +2227,20 @@ function drupal_build_js_cache($files, $filename) { $jspath = file_create_path('js'); file_check_directory($jspath, FILE_CREATE_DIRECTORY); - if (!file_exists($jspath .'/'. $filename)) { + if (!file_exists($jspath . '/' . $filename)) { // Build aggregate JS file. foreach ($files as $path => $info) { if ($info['preprocess']) { // Append a ';' after each JS file to prevent them from running together. - $contents .= file_get_contents($path) .';'; + $contents .= file_get_contents($path) . ';'; } } // Create the JS file. - file_save_data($contents, $jspath .'/'. $filename, FILE_EXISTS_REPLACE); + file_save_data($contents, $jspath . '/' . $filename, FILE_EXISTS_REPLACE); } - return $jspath .'/'. $filename; + return $jspath . '/' . $filename; } /** @@ -2598,7 +2598,7 @@ function drupal_system_listing($mask, $directory, $key = 'name', $min_depth = 1) $files = array(); // Always search sites/all/* as well as the global directories - $searchdir[] = 'sites/all/'. $directory; + $searchdir[] = 'sites/all/' . $directory; // The 'profiles' directory contains pristine collections of modules and // themes as organized by a distribution. It is pristine in the same way @@ -2663,8 +2663,8 @@ function drupal_alter($type, &$data) { array_shift($additional_args); $args = array_merge($args, $additional_args); - foreach (module_implements($type .'_alter') as $module) { - $function = $module .'_'. $type .'_alter'; + foreach (module_implements($type . '_alter') as $module) { + $function = $module . '_' . $type . '_alter'; call_user_func_array($function, $args); } } @@ -3293,7 +3293,7 @@ function drupal_write_record($table, &$object, $update = array()) { // Build the SQL. $query = ''; if (!count($update)) { - $query = "INSERT INTO {". $table ."} (". implode(', ', $fields) .') VALUES ('. implode(', ', $placeholders) .')'; + $query = "INSERT INTO {" . $table . "} (" . implode(', ', $fields) . ') VALUES (' . implode(', ', $placeholders) . ')'; $return = SAVED_NEW; } else { @@ -3302,15 +3302,15 @@ function drupal_write_record($table, &$object, $update = array()) { if ($query) { $query .= ', '; } - $query .= $field .' = '. $placeholders[$id]; + $query .= $field . ' = ' . $placeholders[$id]; } foreach ($update as $key){ - $conditions[] = "$key = ". db_type_placeholder($schema['fields'][$key]['type']); + $conditions[] = "$key = " . db_type_placeholder($schema['fields'][$key]['type']); $values[] = $object->$key; } - $query = "UPDATE {". $table ."} SET $query WHERE ". implode(' AND ', $conditions); + $query = "UPDATE {" . $table . "} SET $query WHERE " . implode(' AND ', $conditions); $return = SAVED_UPDATED; } @@ -3510,7 +3510,7 @@ function drupal_implode_tags($tags) { foreach ($tags as $tag) { // Commas and quotes in tag names are special cases, so encode them. if (strpos($tag, ',') !== FALSE || strpos($tag, '"') !== FALSE) { - $tag = '"'. str_replace('"', '""', $tag) .'"'; + $tag = '"' . str_replace('"', '""', $tag) . '"'; } $encoded_tags[] = $tag; diff --git a/includes/database.inc b/includes/database.inc index d3de06cd8..145290ab0 100644 --- a/includes/database.inc +++ b/includes/database.inc @@ -87,13 +87,13 @@ function db_prefix_tables($sql) { $tmp = $db_prefix; unset($tmp['default']); foreach ($tmp as $key => $val) { - $sql = strtr($sql, array('{'. $key .'}' => $val . $key)); + $sql = strtr($sql, array('{' . $key . '}' => $val . $key)); } return strtr($sql, array('{' => $db_prefix['default'], '}' => '')); } else { foreach ($db_prefix as $key => $val) { - $sql = strtr($sql, array('{'. $key .'}' => $val . $key)); + $sql = strtr($sql, array('{' . $key . '}' => $val . $key)); } return strtr($sql, array('{' => '', '}' => '')); } @@ -146,7 +146,7 @@ function db_set_active($name = 'default') { include_once $handler; } else { - _db_error_page("The database type '". $db_type ."' is unsupported. Please use either 'mysql' or 'mysqli' for MySQL, or 'pgsql' for PostgreSQL databases."); + _db_error_page("The database type '" . $db_type . "' is unsupported. Please use either 'mysql' or 'mysqli' for MySQL, or 'pgsql' for PostgreSQL databases."); } $db_conns[$name] = db_connect($connect_url); @@ -180,7 +180,7 @@ function _db_error_page($error = '') { $message .= '

If you are the maintainer of this site, please check your database settings in the settings.php file and ensure that your hosting provider\'s database server is running. For more help, see the handbook, or contact your hosting provider.

'; if ($error && ini_get('display_errors')) { - $message .= '

The '. theme('placeholder', $db_type) .' error was: '. theme('placeholder', $error) .'.

'; + $message .= '

The ' . theme('placeholder', $db_type) . ' error was: ' . theme('placeholder', $error) . '.

'; } print theme('maintenance_page', $message); @@ -282,7 +282,7 @@ function _db_rewrite_sql($query = '', $primary_table = 'n', $primary_field = 'ni } } - $where = empty($where) ? '' : '('. implode(') AND (', $where) .')'; + $where = empty($where) ? '' : '(' . implode(') AND (', $where) . ')'; $join = empty($join) ? '' : implode(' ', $join); return array($join, $where, $distinct); @@ -331,7 +331,7 @@ function db_rewrite_sql($query, $primary_table = 'n', $primary_field = 'nid', $ if ($where) { $n = strlen($matches[1]); $second_part = substr($query, $n); - $first_part = substr($matches[1], 0, $n - 5) ." $join WHERE $where AND ( "; + $first_part = substr($matches[1], 0, $n - 5) . " $join WHERE $where AND ( "; // PHP 4 does not support strrpos for strings. We emulate it. $haystack_reverse = strrev($second_part); // No need to use strrev on the needle, we supply GROUP, ORDER, LIMIT @@ -345,14 +345,14 @@ function db_rewrite_sql($query, $primary_table = 'n', $primary_field = 'nid', $ } } if ($pos === FALSE) { - $query = $first_part . $second_part .')'; + $query = $first_part . $second_part . ')'; } else { - $query = $first_part . substr($second_part, 0, -$pos) .')'. substr($second_part, -$pos); + $query = $first_part . substr($second_part, 0, -$pos) . ')' . substr($second_part, -$pos); } } else { - $query = $matches[1] ." $join ". substr($query, strlen($matches[1])); + $query = $matches[1] . " $join " . substr($query, strlen($matches[1])); } } @@ -564,7 +564,7 @@ function db_type_placeholder($type) { // There is no safe value to return here, so return something that // will cause the query to fail. - return 'unsupported type '. $type .'for db_type_placeholder'; + return 'unsupported type ' . $type . 'for db_type_placeholder'; } /** diff --git a/includes/database.mysql-common.inc b/includes/database.mysql-common.inc index 73ae6395e..dc834349a 100644 --- a/includes/database.mysql-common.inc +++ b/includes/database.mysql-common.inc @@ -63,21 +63,21 @@ function db_create_table_sql($name, $table) { $table['mysql_suffix'] = "/*!40100 DEFAULT CHARACTER SET UTF8 */"; } - $sql = "CREATE TABLE {". $name ."} (\n"; + $sql = "CREATE TABLE {" . $name . "} (\n"; // Add the SQL statement for each field. foreach ($table['fields'] as $field_name => $field) { - $sql .= _db_create_field_sql($field_name, _db_process_field($field)) .", \n"; + $sql .= _db_create_field_sql($field_name, _db_process_field($field)) . ", \n"; } // Process keys & indexes. $keys = _db_create_keys_sql($table); if (count($keys)) { - $sql .= implode(", \n", $keys) .", \n"; + $sql .= implode(", \n", $keys) . ", \n"; } // Remove the last comma and space. - $sql = substr($sql, 0, -3) ."\n) "; + $sql = substr($sql, 0, -3) . "\n) "; $sql .= $table['mysql_suffix']; @@ -88,16 +88,16 @@ function _db_create_keys_sql($spec) { $keys = array(); if (!empty($spec['primary key'])) { - $keys[] = 'PRIMARY KEY ('. _db_create_key_sql($spec['primary key']) .')'; + $keys[] = 'PRIMARY KEY (' . _db_create_key_sql($spec['primary key']) . ')'; } if (!empty($spec['unique keys'])) { foreach ($spec['unique keys'] as $key => $fields) { - $keys[] = 'UNIQUE KEY '. $key .' ('. _db_create_key_sql($fields) .')'; + $keys[] = 'UNIQUE KEY ' . $key . ' (' . _db_create_key_sql($fields) . ')'; } } if (!empty($spec['indexes'])) { foreach ($spec['indexes'] as $index => $fields) { - $keys[] = 'INDEX '. $index .' ('. _db_create_key_sql($fields) .')'; + $keys[] = 'INDEX ' . $index . ' (' . _db_create_key_sql($fields) . ')'; } } @@ -108,7 +108,7 @@ function _db_create_key_sql($fields) { $ret = array(); foreach ($fields as $field) { if (is_array($field)) { - $ret[] = $field[0] .'('. $field[1] .')'; + $ret[] = $field[0] . '(' . $field[1] . ')'; } else { $ret[] = $field; @@ -132,7 +132,7 @@ function _db_process_field($field) { // Set the correct database-engine specific datatype. if (!isset($field['mysql_type'])) { $map = db_type_map(); - $field['mysql_type'] = $map[$field['type'] .':'. $field['size']]; + $field['mysql_type'] = $map[$field['type'] . ':' . $field['size']]; } if ($field['type'] == 'serial') { @@ -154,13 +154,13 @@ function _db_process_field($field) { * The field specification, as per the schema data structure format. */ function _db_create_field_sql($name, $spec) { - $sql = "`". $name ."` ". $spec['mysql_type']; + $sql = "`" . $name . "` " . $spec['mysql_type']; if (isset($spec['length'])) { - $sql .= '('. $spec['length'] .')'; + $sql .= '(' . $spec['length'] . ')'; } elseif (isset($spec['precision']) && isset($spec['scale'])) { - $sql .= '('. $spec['precision'] .', '. $spec['scale'] .')'; + $sql .= '(' . $spec['precision'] . ', ' . $spec['scale'] . ')'; } if (!empty($spec['unsigned'])) { @@ -177,9 +177,9 @@ function _db_create_field_sql($name, $spec) { if (isset($spec['default'])) { if (is_string($spec['default'])) { - $spec['default'] = "'". $spec['default'] ."'"; + $spec['default'] = "'" . $spec['default'] . "'"; } - $sql .= ' DEFAULT '. $spec['default']; + $sql .= ' DEFAULT ' . $spec['default']; } if (empty($spec['not null']) && !isset($spec['default'])) { @@ -246,7 +246,7 @@ function db_type_map() { * The new name for the table. */ function db_rename_table(&$ret, $table, $new_name) { - $ret[] = update_sql('ALTER TABLE {'. $table .'} RENAME TO {'. $new_name .'}'); + $ret[] = update_sql('ALTER TABLE {' . $table . '} RENAME TO {' . $new_name . '}'); } /** @@ -258,7 +258,7 @@ function db_rename_table(&$ret, $table, $new_name) { * The table to be dropped. */ function db_drop_table(&$ret, $table) { - $ret[] = update_sql('DROP TABLE {'. $table .'}'); + $ret[] = update_sql('DROP TABLE {' . $table . '}'); } /** @@ -290,17 +290,17 @@ function db_add_field(&$ret, $table, $field, $spec, $keys_new = array()) { $fixnull = TRUE; $spec['not null'] = FALSE; } - $query = 'ALTER TABLE {'. $table .'} ADD '; + $query = 'ALTER TABLE {' . $table . '} ADD '; $query .= _db_create_field_sql($field, _db_process_field($spec)); if (count($keys_new)) { - $query .= ', ADD '. implode(', ADD ', _db_create_keys_sql($keys_new)); + $query .= ', ADD ' . implode(', ADD ', _db_create_keys_sql($keys_new)); } $ret[] = update_sql($query); if (isset($spec['initial'])) { // All this because update_sql does not support %-placeholders. - $sql = 'UPDATE {'. $table .'} SET '. $field .' = '. db_type_placeholder($spec['type']); + $sql = 'UPDATE {' . $table . '} SET ' . $field . ' = ' . db_type_placeholder($spec['type']); $result = db_query($sql, $spec['initial']); - $ret[] = array('success' => $result !== FALSE, 'query' => check_plain($sql .' ('. $spec['initial'] .')')); + $ret[] = array('success' => $result !== FALSE, 'query' => check_plain($sql . ' (' . $spec['initial'] . ')')); } if ($fixnull) { $spec['not null'] = TRUE; @@ -319,7 +319,7 @@ function db_add_field(&$ret, $table, $field, $spec, $keys_new = array()) { * The field to be dropped. */ function db_drop_field(&$ret, $table, $field) { - $ret[] = update_sql('ALTER TABLE {'. $table .'} DROP '. $field); + $ret[] = update_sql('ALTER TABLE {' . $table . '} DROP ' . $field); } /** @@ -342,7 +342,7 @@ function db_field_set_default(&$ret, $table, $field, $default) { $default = is_string($default) ? "'$default'" : $default; } - $ret[] = update_sql('ALTER TABLE {'. $table .'} ALTER COLUMN '. $field .' SET DEFAULT '. $default); + $ret[] = update_sql('ALTER TABLE {' . $table . '} ALTER COLUMN ' . $field . ' SET DEFAULT ' . $default); } /** @@ -356,7 +356,7 @@ function db_field_set_default(&$ret, $table, $field, $default) { * The field to be altered. */ function db_field_set_no_default(&$ret, $table, $field) { - $ret[] = update_sql('ALTER TABLE {'. $table .'} ALTER COLUMN '. $field .' DROP DEFAULT'); + $ret[] = update_sql('ALTER TABLE {' . $table . '} ALTER COLUMN ' . $field . ' DROP DEFAULT'); } /** @@ -370,8 +370,8 @@ function db_field_set_no_default(&$ret, $table, $field) { * Fields for the primary key. */ function db_add_primary_key(&$ret, $table, $fields) { - $ret[] = update_sql('ALTER TABLE {'. $table .'} ADD PRIMARY KEY ('. - _db_create_key_sql($fields) .')'); + $ret[] = update_sql('ALTER TABLE {' . $table . '} ADD PRIMARY KEY (' . + _db_create_key_sql($fields) . ')'); } /** @@ -383,7 +383,7 @@ function db_add_primary_key(&$ret, $table, $fields) { * The table to be altered. */ function db_drop_primary_key(&$ret, $table) { - $ret[] = update_sql('ALTER TABLE {'. $table .'} DROP PRIMARY KEY'); + $ret[] = update_sql('ALTER TABLE {' . $table . '} DROP PRIMARY KEY'); } /** @@ -399,8 +399,8 @@ function db_drop_primary_key(&$ret, $table) { * An array of field names. */ function db_add_unique_key(&$ret, $table, $name, $fields) { - $ret[] = update_sql('ALTER TABLE {'. $table .'} ADD UNIQUE KEY '. - $name .' ('. _db_create_key_sql($fields) .')'); + $ret[] = update_sql('ALTER TABLE {' . $table . '} ADD UNIQUE KEY ' . + $name . ' (' . _db_create_key_sql($fields) . ')'); } /** @@ -414,7 +414,7 @@ function db_add_unique_key(&$ret, $table, $name, $fields) { * The name of the key. */ function db_drop_unique_key(&$ret, $table, $name) { - $ret[] = update_sql('ALTER TABLE {'. $table .'} DROP KEY '. $name); + $ret[] = update_sql('ALTER TABLE {' . $table . '} DROP KEY ' . $name); } /** @@ -430,7 +430,7 @@ function db_drop_unique_key(&$ret, $table, $name) { * An array of field names. */ function db_add_index(&$ret, $table, $name, $fields) { - $query = 'ALTER TABLE {'. $table .'} ADD INDEX '. $name .' ('. _db_create_key_sql($fields) .')'; + $query = 'ALTER TABLE {' . $table . '} ADD INDEX ' . $name . ' (' . _db_create_key_sql($fields) . ')'; $ret[] = update_sql($query); } @@ -445,7 +445,7 @@ function db_add_index(&$ret, $table, $name, $fields) { * The name of the index. */ function db_drop_index(&$ret, $table, $name) { - $ret[] = update_sql('ALTER TABLE {'. $table .'} DROP INDEX '. $name); + $ret[] = update_sql('ALTER TABLE {' . $table . '} DROP INDEX ' . $name); } /** @@ -512,10 +512,10 @@ function db_drop_index(&$ret, $table, $name) { */ function db_change_field(&$ret, $table, $field, $field_new, $spec, $keys_new = array()) { - $sql = 'ALTER TABLE {'. $table .'} CHANGE '. $field .' '. + $sql = 'ALTER TABLE {' . $table . '} CHANGE ' . $field . ' ' . _db_create_field_sql($field_new, _db_process_field($spec)); if (count($keys_new)) { - $sql .= ', ADD '. implode(', ADD ', _db_create_keys_sql($keys_new)); + $sql .= ', ADD ' . implode(', ADD ', _db_create_keys_sql($keys_new)); } $ret[] = update_sql($sql); } diff --git a/includes/database.mysql.inc b/includes/database.mysql.inc index e8f831d71..81b1308cb 100644 --- a/includes/database.mysql.inc +++ b/includes/database.mysql.inc @@ -65,7 +65,7 @@ function db_connect($url) { // Allow for non-standard MySQL port. if (isset($url['port'])) { - $url['host'] = $url['host'] .':'. $url['port']; + $url['host'] = $url['host'] . ':' . $url['port']; } // - TRUE makes mysql_connect() always open a new link, even if @@ -103,13 +103,13 @@ function _db_query($query, $debug = 0) { $name = $user->uid ? $user->name : variable_get('anonymous', 'Anonymous'); // str_replace() to prevent SQL injection via username or anonymous name. $name = str_replace(array('*', '/'), '', $name); - $query = '/* '. $name .' : '. $bt[2]['function'] .' */ '. $query; + $query = '/* ' . $name . ' : ' . $bt[2]['function'] . ' */ ' . $query; } $result = mysql_query($query, $active_db); if (variable_get('dev_query', 0)) { - $query = $bt[2]['function'] ."\n". $query; + $query = $bt[2]['function'] . "\n" . $query; list($usec, $sec) = explode(' ', microtime()); $stop = (float)$usec + (float)$sec; $diff = $stop - $timer; @@ -117,7 +117,7 @@ function _db_query($query, $debug = 0) { } if ($debug) { - print '

query: '. $query .'
error:'. mysql_error($active_db) .'

'; + print '

query: ' . $query . '
error:' . mysql_error($active_db) . '

'; } if (!mysql_errno($active_db)) { @@ -126,7 +126,7 @@ function _db_query($query, $debug = 0) { else { // Indicate to drupal_error_handler that this is a database error. ${DB_ERROR} = TRUE; - trigger_error(check_plain(mysql_error($active_db) ."\nquery: ". $query), E_USER_WARNING); + trigger_error(check_plain(mysql_error($active_db) . "\nquery: " . $query), E_USER_WARNING); return FALSE; } } @@ -239,7 +239,7 @@ function db_query_range($query) { } _db_query_callback($args, TRUE); $query = preg_replace_callback(DB_QUERY_REGEXP, '_db_query_callback', $query); - $query .= ' LIMIT '. (int)$from .', '. (int)$count; + $query .= ' LIMIT ' . (int)$from . ', ' . (int)$count; return _db_query($query); } @@ -280,7 +280,7 @@ function db_query_temporary($query) { $tablename = array_pop($args); array_shift($args); - $query = preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE '. $tablename .' Engine=HEAP SELECT', db_prefix_tables($query)); + $query = preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE ' . $tablename . ' Engine=HEAP SELECT', db_prefix_tables($query)); if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax $args = $args[0]; } @@ -299,7 +299,7 @@ function db_query_temporary($query) { */ function db_encode_blob($data) { global $active_db; - return "'". mysql_real_escape_string($data, $active_db) ."'"; + return "'" . mysql_real_escape_string($data, $active_db) . "'"; } /** @@ -326,7 +326,7 @@ function db_escape_string($text) { * Lock a table. */ function db_lock_table($table) { - db_query('LOCK TABLES {'. db_escape_table($table) .'} WRITE'); + db_query('LOCK TABLES {' . db_escape_table($table) . '} WRITE'); } /** @@ -340,14 +340,14 @@ function db_unlock_tables() { * Check if a table exists. */ function db_table_exists($table) { - return (bool) db_fetch_object(db_query("SHOW TABLES LIKE '{". db_escape_table($table) ."}'")); + return (bool) db_fetch_object(db_query("SHOW TABLES LIKE '{" . db_escape_table($table) . "}'")); } /** * Check if a column exists in the given table. */ function db_column_exists($table, $column) { - return (bool) db_fetch_object(db_query("SHOW COLUMNS FROM {". db_escape_table($table) ."} LIKE '". db_escape_table($column) ."'")); + return (bool) db_fetch_object(db_query("SHOW COLUMNS FROM {" . db_escape_table($table) . "} LIKE '" . db_escape_table($column) . "'")); } /** @@ -362,9 +362,9 @@ function db_column_exists($table, $column) { * @return SQL query with the DISTINCT wrapper surrounding the given table.field. */ function db_distinct_field($table, $field, $query) { - $field_to_select = 'DISTINCT('. $table .'.'. $field .')'; + $field_to_select = 'DISTINCT(' . $table . '.' . $field . ')'; // (?uid ? $user->name : variable_get('anonymous', 'Anonymous'); // str_replace() to prevent SQL injection via username or anonymous name. $name = str_replace(array('*', '/'), '', $name); - $query = '/* '. $name .' : '. $bt[2]['function'] .' */ '. $query; + $query = '/* ' . $name . ' : ' . $bt[2]['function'] . ' */ ' . $query; } $result = mysqli_query($active_db, $query); if (variable_get('dev_query', 0)) { - $query = $bt[2]['function'] ."\n". $query; + $query = $bt[2]['function'] . "\n" . $query; list($usec, $sec) = explode(' ', microtime()); $stop = (float)$usec + (float)$sec; $diff = $stop - $timer; @@ -118,7 +118,7 @@ function _db_query($query, $debug = 0) { } if ($debug) { - print '

query: '. $query .'
error:'. mysqli_error($active_db) .'

'; + print '

query: ' . $query . '
error:' . mysqli_error($active_db) . '

'; } if (!mysqli_errno($active_db)) { @@ -127,7 +127,7 @@ function _db_query($query, $debug = 0) { else { // Indicate to drupal_error_handler that this is a database error. ${DB_ERROR} = TRUE; - trigger_error(check_plain(mysqli_error($active_db) ."\nquery: ". $query), E_USER_WARNING); + trigger_error(check_plain(mysqli_error($active_db) . "\nquery: " . $query), E_USER_WARNING); return FALSE; } } @@ -242,7 +242,7 @@ function db_query_range($query) { } _db_query_callback($args, TRUE); $query = preg_replace_callback(DB_QUERY_REGEXP, '_db_query_callback', $query); - $query .= ' LIMIT '. (int)$from .', '. (int)$count; + $query .= ' LIMIT ' . (int)$from . ', ' . (int)$count; return _db_query($query); } @@ -283,7 +283,7 @@ function db_query_temporary($query) { $tablename = array_pop($args); array_shift($args); - $query = preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE '. $tablename .' Engine=HEAP SELECT', db_prefix_tables($query)); + $query = preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE ' . $tablename . ' Engine=HEAP SELECT', db_prefix_tables($query)); if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax $args = $args[0]; } @@ -302,7 +302,7 @@ function db_query_temporary($query) { */ function db_encode_blob($data) { global $active_db; - return "'". mysqli_real_escape_string($active_db, $data) ."'"; + return "'" . mysqli_real_escape_string($active_db, $data) . "'"; } /** @@ -329,7 +329,7 @@ function db_escape_string($text) { * Lock a table. */ function db_lock_table($table) { - db_query('LOCK TABLES {'. db_escape_table($table) .'} WRITE'); + db_query('LOCK TABLES {' . db_escape_table($table) . '} WRITE'); } /** @@ -343,14 +343,14 @@ function db_unlock_tables() { * Check if a table exists. */ function db_table_exists($table) { - return (bool) db_fetch_object(db_query("SHOW TABLES LIKE '{". db_escape_table($table) ."}'")); + return (bool) db_fetch_object(db_query("SHOW TABLES LIKE '{" . db_escape_table($table) . "}'")); } /** * Check if a column exists in the given table. */ function db_column_exists($table, $column) { - return (bool) db_fetch_object(db_query("SHOW COLUMNS FROM {". db_escape_table($table) ."} LIKE '". db_escape_table($column) ."'")); + return (bool) db_fetch_object(db_query("SHOW COLUMNS FROM {" . db_escape_table($table) . "} LIKE '" . db_escape_table($column) . "'")); } /** @@ -365,9 +365,9 @@ function db_column_exists($table, $column) { * @return SQL query with the DISTINCT wrapper surrounding the given table.field. */ function db_distinct_field($table, $field, $query) { - $field_to_select = 'DISTINCT('. $table .'.'. $field .')'; + $field_to_select = 'DISTINCT(' . $table . '.' . $field . ')'; // (?query: '. $query .'
error:'. pg_last_error($active_db) .'

'; + print '

query: ' . $query . '
error:' . pg_last_error($active_db) . '

'; } if ($last_result !== FALSE) { @@ -156,7 +156,7 @@ function _db_query($query, $debug = 0) { else { // Indicate to drupal_error_handler that this is a database error. ${DB_ERROR} = TRUE; - trigger_error(check_plain(pg_last_error($active_db) ."\nquery: ". $query), E_USER_WARNING); + trigger_error(check_plain(pg_last_error($active_db) . "\nquery: " . $query), E_USER_WARNING); return FALSE; } } @@ -228,7 +228,7 @@ function db_error() { * The name of the autoincrement field. */ function db_last_insert_id($table, $field) { - return db_result(db_query("SELECT CURRVAL('{". db_escape_table($table) ."}_". db_escape_table($field) ."_seq')")); + return db_result(db_query("SELECT CURRVAL('{" . db_escape_table($table) . "}_" . db_escape_table($field) . "_seq')")); } /** @@ -280,7 +280,7 @@ function db_query_range($query) { } _db_query_callback($args, TRUE); $query = preg_replace_callback(DB_QUERY_REGEXP, '_db_query_callback', $query); - $query .= ' LIMIT '. (int)$count .' OFFSET '. (int)$from; + $query .= ' LIMIT ' . (int)$count . ' OFFSET ' . (int)$from; return _db_query($query); } @@ -321,7 +321,7 @@ function db_query_temporary($query) { $tablename = array_pop($args); array_shift($args); - $query = preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE '. $tablename .' AS SELECT', db_prefix_tables($query)); + $query = preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE ' . $tablename . ' AS SELECT', db_prefix_tables($query)); if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax $args = $args[0]; } @@ -340,7 +340,7 @@ function db_query_temporary($query) { * Encoded data. */ function db_encode_blob($data) { - return "'". pg_escape_bytea($data) ."'"; + return "'" . pg_escape_bytea($data) . "'"; } /** @@ -369,7 +369,7 @@ function db_escape_string($text) { * This function automatically starts a transaction. */ function db_lock_table($table) { - db_query('BEGIN; LOCK TABLE {'. db_escape_table($table) .'} IN EXCLUSIVE MODE'); + db_query('BEGIN; LOCK TABLE {' . db_escape_table($table) . '} IN EXCLUSIVE MODE'); } /** @@ -384,14 +384,14 @@ function db_unlock_tables() { * Check if a table exists. */ function db_table_exists($table) { - return (bool) db_result(db_query("SELECT COUNT(*) FROM pg_class WHERE relname = '{". db_escape_table($table) ."}'")); + return (bool) db_result(db_query("SELECT COUNT(*) FROM pg_class WHERE relname = '{" . db_escape_table($table) . "}'")); } /** * Check if a column exists in the given table. */ function db_column_exists($table, $column) { - return (bool) db_result(db_query("SELECT COUNT(pg_attribute.attname) FROM pg_class, pg_attribute WHERE pg_attribute.attrelid = pg_class.oid AND pg_class.relname = '{". db_escape_table($table) ."}' AND attname = '". db_escape_table($column) ."'")); + return (bool) db_result(db_query("SELECT COUNT(pg_attribute.attname) FROM pg_class, pg_attribute WHERE pg_attribute.attrelid = pg_class.oid AND pg_class.relname = '{" . db_escape_table($table) . "}' AND attname = '" . db_escape_table($column) . "'")); } /** @@ -418,10 +418,10 @@ function db_check_setup() { * @return SQL query with the DISTINCT wrapper surrounding the given table.field. */ function db_distinct_field($table, $field, $query) { - $field_to_select = 'DISTINCT ON ('. $table .'.'. $field .") $table.$field"; + $field_to_select = 'DISTINCT ON (' . $table . '.' . $field . ") $table.$field"; // (? $key) { - $sql_keys[] = 'CONSTRAINT {'. $name .'}_'. $key_name .'_key UNIQUE ('. implode(', ', $key) .')'; + $sql_keys[] = 'CONSTRAINT {' . $name . '}_' . $key_name . '_key UNIQUE (' . implode(', ', $key) . ')'; } } - $sql = "CREATE TABLE {". $name ."} (\n\t"; + $sql = "CREATE TABLE {" . $name . "} (\n\t"; $sql .= implode(",\n\t", $sql_fields); if (count($sql_keys) > 0) { $sql .= ",\n\t"; @@ -525,8 +525,8 @@ function db_create_table_sql($name, $table) { } function _db_create_index_sql($table, $name, $fields) { - $query = 'CREATE INDEX {'. $table .'}_'. $name .'_idx ON {'. $table .'} ('; - $query .= _db_create_key_sql($fields) .')'; + $query = 'CREATE INDEX {' . $table . '}_' . $name . '_idx ON {' . $table . '} ('; + $query .= _db_create_key_sql($fields) . ')'; return $query; } @@ -534,7 +534,7 @@ function _db_create_key_sql($fields) { $ret = array(); foreach ($fields as $field) { if (is_array($field)) { - $ret[] = 'substr('. $field[0] .', 1, '. $field[1] .')'; + $ret[] = 'substr(' . $field[0] . ', 1, ' . $field[1] . ')'; } else { $ret[] = $field; @@ -572,7 +572,7 @@ function _db_process_field($field) { // Set the correct database-engine specific datatype. if (!isset($field['pgsql_type'])) { $map = db_type_map(); - $field['pgsql_type'] = $map[$field['type'] .':'. $field['size']]; + $field['pgsql_type'] = $map[$field['type'] . ':' . $field['size']]; } if ($field['type'] == 'serial') { unset($field['not null']); @@ -592,7 +592,7 @@ function _db_process_field($field) { * The field specification, as per the schema data structure format. */ function _db_create_field_sql($name, $spec) { - $sql = $name .' '. $spec['pgsql_type']; + $sql = $name . ' ' . $spec['pgsql_type']; if ($spec['type'] == 'serial') { unset($spec['not null']); @@ -607,17 +607,17 @@ function _db_create_field_sql($name, $spec) { } if (!empty($spec['length'])) { - $sql .= '('. $spec['length'] .')'; + $sql .= '(' . $spec['length'] . ')'; } elseif (isset($spec['precision']) && isset($spec['scale'])) { - $sql .= '('. $spec['precision'] .', '. $spec['scale'] .')'; + $sql .= '(' . $spec['precision'] . ', ' . $spec['scale'] . ')'; } if (isset($spec['not null']) && $spec['not null']) { $sql .= ' NOT NULL'; } if (isset($spec['default'])) { - $default = is_string($spec['default']) ? "'". $spec['default'] ."'" : $spec['default']; + $default = is_string($spec['default']) ? "'" . $spec['default'] . "'" : $spec['default']; $sql .= " default $default"; } @@ -635,7 +635,7 @@ function _db_create_field_sql($name, $spec) { * The new name for the table. */ function db_rename_table(&$ret, $table, $new_name) { - $ret[] = update_sql('ALTER TABLE {'. $table .'} RENAME TO {'. $new_name .'}'); + $ret[] = update_sql('ALTER TABLE {' . $table . '} RENAME TO {' . $new_name . '}'); } /** @@ -647,7 +647,7 @@ function db_rename_table(&$ret, $table, $new_name) { * The table to be dropped. */ function db_drop_table(&$ret, $table) { - $ret[] = update_sql('DROP TABLE {'. $table .'}'); + $ret[] = update_sql('DROP TABLE {' . $table . '}'); } /** @@ -679,17 +679,17 @@ function db_add_field(&$ret, $table, $field, $spec, $new_keys = array()) { $fixnull = TRUE; $spec['not null'] = FALSE; } - $query = 'ALTER TABLE {'. $table .'} ADD COLUMN '; + $query = 'ALTER TABLE {' . $table . '} ADD COLUMN '; $query .= _db_create_field_sql($field, _db_process_field($spec)); $ret[] = update_sql($query); if (isset($spec['initial'])) { // All this because update_sql does not support %-placeholders. - $sql = 'UPDATE {'. $table .'} SET '. $field .' = '. db_type_placeholder($spec['type']); + $sql = 'UPDATE {' . $table . '} SET ' . $field . ' = ' . db_type_placeholder($spec['type']); $result = db_query($sql, $spec['initial']); - $ret[] = array('success' => $result !== FALSE, 'query' => check_plain($sql .' ('. $spec['initial'] .')')); + $ret[] = array('success' => $result !== FALSE, 'query' => check_plain($sql . ' (' . $spec['initial'] . ')')); } if ($fixnull) { - $ret[] = update_sql("ALTER TABLE {". $table ."} ALTER $field SET NOT NULL"); + $ret[] = update_sql("ALTER TABLE {" . $table . "} ALTER $field SET NOT NULL"); } if (isset($new_keys)) { _db_create_keys($ret, $table, $new_keys); @@ -707,7 +707,7 @@ function db_add_field(&$ret, $table, $field, $spec, $new_keys = array()) { * The field to be dropped. */ function db_drop_field(&$ret, $table, $field) { - $ret[] = update_sql('ALTER TABLE {'. $table .'} DROP COLUMN '. $field); + $ret[] = update_sql('ALTER TABLE {' . $table . '} DROP COLUMN ' . $field); } /** @@ -730,7 +730,7 @@ function db_field_set_default(&$ret, $table, $field, $default) { $default = is_string($default) ? "'$default'" : $default; } - $ret[] = update_sql('ALTER TABLE {'. $table .'} ALTER COLUMN '. $field .' SET DEFAULT '. $default); + $ret[] = update_sql('ALTER TABLE {' . $table . '} ALTER COLUMN ' . $field . ' SET DEFAULT ' . $default); } /** @@ -744,7 +744,7 @@ function db_field_set_default(&$ret, $table, $field, $default) { * The field to be altered. */ function db_field_set_no_default(&$ret, $table, $field) { - $ret[] = update_sql('ALTER TABLE {'. $table .'} ALTER COLUMN '. $field .' DROP DEFAULT'); + $ret[] = update_sql('ALTER TABLE {' . $table . '} ALTER COLUMN ' . $field . ' DROP DEFAULT'); } /** @@ -758,8 +758,8 @@ function db_field_set_no_default(&$ret, $table, $field) { * Fields for the primary key. */ function db_add_primary_key(&$ret, $table, $fields) { - $ret[] = update_sql('ALTER TABLE {'. $table .'} ADD PRIMARY KEY ('. - implode(',', $fields) .')'); + $ret[] = update_sql('ALTER TABLE {' . $table . '} ADD PRIMARY KEY (' . + implode(',', $fields) . ')'); } /** @@ -771,7 +771,7 @@ function db_add_primary_key(&$ret, $table, $fields) { * The table to be altered. */ function db_drop_primary_key(&$ret, $table) { - $ret[] = update_sql('ALTER TABLE {'. $table .'} DROP CONSTRAINT {'. $table .'}_pkey'); + $ret[] = update_sql('ALTER TABLE {' . $table . '} DROP CONSTRAINT {' . $table . '}_pkey'); } /** @@ -787,9 +787,9 @@ function db_drop_primary_key(&$ret, $table) { * An array of field names. */ function db_add_unique_key(&$ret, $table, $name, $fields) { - $name = '{'. $table .'}_'. $name .'_key'; - $ret[] = update_sql('ALTER TABLE {'. $table .'} ADD CONSTRAINT '. - $name .' UNIQUE ('. implode(',', $fields) .')'); + $name = '{' . $table . '}_' . $name . '_key'; + $ret[] = update_sql('ALTER TABLE {' . $table . '} ADD CONSTRAINT ' . + $name . ' UNIQUE (' . implode(',', $fields) . ')'); } /** @@ -803,8 +803,8 @@ function db_add_unique_key(&$ret, $table, $name, $fields) { * The name of the key. */ function db_drop_unique_key(&$ret, $table, $name) { - $name = '{'. $table .'}_'. $name .'_key'; - $ret[] = update_sql('ALTER TABLE {'. $table .'} DROP CONSTRAINT '. $name); + $name = '{' . $table . '}_' . $name . '_key'; + $ret[] = update_sql('ALTER TABLE {' . $table . '} DROP CONSTRAINT ' . $name); } /** @@ -834,8 +834,8 @@ function db_add_index(&$ret, $table, $name, $fields) { * The name of the index. */ function db_drop_index(&$ret, $table, $name) { - $name = '{'. $table .'}_'. $name .'_idx'; - $ret[] = update_sql('DROP INDEX '. $name); + $name = '{' . $table . '}_' . $name . '_idx'; + $ret[] = update_sql('DROP INDEX ' . $name); } /** @@ -901,19 +901,19 @@ function db_drop_index(&$ret, $table, $name) { * table specification but without the 'fields' element. */ function db_change_field(&$ret, $table, $field, $field_new, $spec, $new_keys = array()) { - $ret[] = update_sql("ALTER TABLE {". $table ."} RENAME $field TO ". $field ."_old"); + $ret[] = update_sql("ALTER TABLE {" . $table . "} RENAME $field TO " . $field . "_old"); $not_null = isset($spec['not null']) ? $spec['not null'] : FALSE; unset($spec['not null']); db_add_field($ret, $table, "$field_new", $spec); - $ret[] = update_sql("UPDATE {". $table ."} SET $field_new = ". $field ."_old"); + $ret[] = update_sql("UPDATE {" . $table . "} SET $field_new = " . $field . "_old"); if ($not_null) { - $ret[] = update_sql("ALTER TABLE {". $table ."} ALTER $field_new SET NOT NULL"); + $ret[] = update_sql("ALTER TABLE {" . $table . "} ALTER $field_new SET NOT NULL"); } - db_drop_field($ret, $table, $field .'_old'); + db_drop_field($ret, $table, $field . '_old'); if (isset($new_keys)) { _db_create_keys($ret, $table, $new_keys); diff --git a/includes/file.inc b/includes/file.inc index 5f1b6ae1a..16f5c5629 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -40,14 +40,14 @@ define('FILE_STATUS_PERMANENT', 1); */ function file_create_url($path) { // Strip file_directory_path from $path. We only include relative paths in urls. - if (strpos($path, file_directory_path() .'/') === 0) { + if (strpos($path, file_directory_path() . '/') === 0) { $path = trim(substr($path, strlen(file_directory_path())), '\\/'); } switch (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) { case FILE_DOWNLOADS_PUBLIC: - return $GLOBALS['base_url'] .'/'. file_directory_path() .'/'. str_replace('\\', '/', $path); + return $GLOBALS['base_url'] . '/' . file_directory_path() . '/' . str_replace('\\', '/', $path); case FILE_DOWNLOADS_PRIVATE: - return url('system/files/'. $path, array('absolute' => TRUE)); + return url('system/files/' . $path, array('absolute' => TRUE)); } } @@ -75,8 +75,8 @@ function file_create_path($dest = 0) { return $dest; } // Not found, try again with prefixed directory path. - else if (file_check_location($file_path .'/'. $dest, $file_path)) { - return $file_path .'/'. $dest; + else if (file_check_location($file_path . '/' . $dest, $file_path)) { + return $file_path . '/' . $dest; } // File not found. return FALSE; @@ -128,10 +128,10 @@ function file_check_directory(&$directory, $mode = 0, $form_item = NULL) { $htaccess_lines = "SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006\nOptions None\nOptions +FollowSymLinks"; if (($fp = fopen("$directory/.htaccess", 'w')) && fputs($fp, $htaccess_lines)) { fclose($fp); - chmod($directory .'/.htaccess', 0664); + chmod($directory . '/.htaccess', 0664); } else { - $variables = array('%directory' => $directory, '!htaccess' => '
'. nl2br(check_plain($htaccess_lines))); + $variables = array('%directory' => $directory, '!htaccess' => '
' . nl2br(check_plain($htaccess_lines))); form_set_error($form_item, t("Security warning: Couldn't write .htaccess file. Please create a .htaccess file in your %directory directory which contains the following lines: !htaccess", $variables)); watchdog('security', "Security warning: Couldn't write .htaccess file. Please create a .htaccess file in your %directory directory which contains the following lines: !htaccess", $variables, WATCHDOG_ERROR); } @@ -185,7 +185,7 @@ function file_check_location($source, $directory = '') { } else { // This file does not yet exist - $source = realpath(dirname($source)) .'/'. basename($source); + $source = realpath(dirname($source)) . '/' . basename($source); } $directory = realpath($directory); if ($directory && strpos($source, $directory) !== 0) { @@ -244,7 +244,7 @@ function file_copy(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) { // If the destination file is not specified then use the filename of the source file. $basename = $basename ? $basename : basename($source); - $dest = $directory .'/'. $basename; + $dest = $directory . '/' . $basename; // Make sure source and destination filenames are not the same, makes no sense // to copy it if they are. In fact copying the file will most likely result in @@ -369,12 +369,12 @@ function file_munge_filename($filename, $extensions, $alerts = TRUE) { // end of each section that could be a file extension but isn't in the list // of allowed extensions. foreach ($filename_parts as $filename_part) { - $new_filename .= '.'. $filename_part; + $new_filename .= '.' . $filename_part; if (!in_array($filename_part, $whitelist) && preg_match("/^[a-zA-Z]{2,5}\d?$/", $filename_part)) { $new_filename .= '_'; } } - $filename = $new_filename .'.'. $final_extension; + $filename = $new_filename . '.' . $final_extension; if ($alerts && $original != $filename) { drupal_set_message(t('For security reasons, your upload has been renamed to %filename.', array('%filename' => $filename))); @@ -403,7 +403,7 @@ function file_unmunge_filename($filename) { * @return */ function file_create_filename($basename, $directory) { - $dest = $directory .'/'. $basename; + $dest = $directory . '/' . $basename; if (file_exists($dest)) { // Destination file already exists, generate an alternative. @@ -417,7 +417,7 @@ function file_create_filename($basename, $directory) { $counter = 0; do { - $dest = $directory .'/'. $name .'_'. $counter++ . $ext; + $dest = $directory . '/' . $name . '_' . $counter++ . $ext; } while (file_exists($dest)); } @@ -519,7 +519,7 @@ function file_save_upload($source, $validators = array(), $dest = FALSE, $replac // @todo: this should not be here. we need to figure out the right place. $extensions = ''; foreach ($user->roles as $rid => $name) { - $extensions .= ' '. variable_get("upload_extensions_$rid", + $extensions .= ' ' . variable_get("upload_extensions_$rid", variable_get('upload_extensions_default', 'jpg jpeg gif png txt html doc xls pdf ppt pps odt ods odp')); } @@ -543,7 +543,7 @@ function file_save_upload($source, $validators = array(), $dest = FALSE, $replac } $file->source = $source; - $file->destination = file_destination(file_create_path($dest .'/'. $file->filename), $replace); + $file->destination = file_destination(file_create_path($dest . '/' . $file->filename), $replace); $file->filesize = $_FILES['files']['size'][$source]; // Call the validation functions. @@ -557,10 +557,10 @@ function file_save_upload($source, $validators = array(), $dest = FALSE, $replac if (!empty($errors)) { $message = t('The selected file %name could not be uploaded.', array('%name' => $file->filename)); if (count($errors) > 1) { - $message .= '
  • '. implode('
  • ', $errors) .'
'; + $message .= '
  • ' . implode('
  • ', $errors) . '
'; } else { - $message .= ' '. array_pop($errors); + $message .= ' ' . array_pop($errors); } form_set_error($source, $message); return 0; @@ -623,7 +623,7 @@ function file_validate_extensions($file, $extensions) { // Bypass validation for uid = 1. if ($user->uid != 1) { - $regex = '/\.('. ereg_replace(' +', '|', preg_quote($extensions)) .')$/i'; + $regex = '/\.(' . ereg_replace(' +', '|', preg_quote($extensions)) . ')$/i'; if (!preg_match($regex, $file->filename)) { $errors[] = t('Only files with the following extensions are allowed: %files-allowed.', array('%files-allowed' => $extensions)); } @@ -946,7 +946,7 @@ function file_directory_temp() { } // if a directory has been found, use it, otherwise default to 'files/tmp' or 'files\\tmp'; - $temporary_directory = $temporary_directory ? $temporary_directory : file_directory_path() . $path_delimiter .'tmp'; + $temporary_directory = $temporary_directory ? $temporary_directory : file_directory_path() . $path_delimiter . 'tmp'; variable_set('file_directory_temp', $temporary_directory); } @@ -959,7 +959,7 @@ function file_directory_temp() { * @return A string containing the path to Drupal's 'files' directory. */ function file_directory_path() { - return variable_get('file_directory_path', conf_path() .'/files'); + return variable_get('file_directory_path', conf_path() . '/files'); } /** diff --git a/includes/form.inc b/includes/form.inc index c7738d029..ac9ea2bb9 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -100,7 +100,7 @@ function drupal_get_form($form_id) { array_unshift($args_temp, $form_id); $form = call_user_func_array('drupal_retrieve_form', $args_temp); - $form_build_id = 'form-'. md5(mt_rand()); + $form_build_id = 'form-' . md5(mt_rand()); $form['#build_id'] = $form_build_id; drupal_prepare_form($form_id, $form, $form_state); // Store a copy of the unprocessed form for caching and indicate that it @@ -196,7 +196,7 @@ function drupal_rebuild_form($form_id, &$form_state, $args, $form_build_id = NUL if (!isset($form_build_id)) { // We need a new build_id for the new version of the form. - $form_build_id = 'form-'. md5(mt_rand()); + $form_build_id = 'form-' . md5(mt_rand()); } $form['#build_id'] = $form_build_id; drupal_prepare_form($form_id, $form, $form_state); @@ -219,9 +219,9 @@ function drupal_rebuild_form($form_id, &$form_state, $args, $form_build_id = NUL * Fetch a form from cache. */ function form_get_cache($form_build_id, &$form_state) { - if ($cached = cache_get('form_'. $form_build_id, 'cache_form')) { + if ($cached = cache_get('form_' . $form_build_id, 'cache_form')) { $form = $cached->data; - if ($cached = cache_get('storage_'. $form_build_id, 'cache_form')) { + if ($cached = cache_get('storage_' . $form_build_id, 'cache_form')) { $form_state['storage'] = $cached->data; } return $form; @@ -234,9 +234,9 @@ function form_get_cache($form_build_id, &$form_state) { function form_set_cache($form_build_id, $form, $form_state) { $expire = max(ini_get('session.cookie_lifetime'), 86400); - cache_set('form_'. $form_build_id, $form, 'cache_form', $expire); + cache_set('form_' . $form_build_id, $form, 'cache_form', $expire); if (!empty($form_state['storage'])) { - cache_set('storage_'. $form_build_id, $form_state['storage'], 'cache_form', $expire); + cache_set('storage_' . $form_build_id, $form_state['storage'], 'cache_form', $expire); } } @@ -404,8 +404,8 @@ function drupal_process_form($form_id, &$form, &$form_state) { // here, as we've finished with them. The in-memory copies are still // here, though. if (variable_get('cache', CACHE_DISABLED) == CACHE_DISABLED && !empty($form_state['values']['form_build_id'])) { - cache_clear_all('form_'. $form_state['values']['form_build_id'], 'cache_form'); - cache_clear_all('storage_'. $form_state['values']['form_build_id'], 'cache_form'); + cache_clear_all('form_' . $form_state['values']['form_build_id'], 'cache_form'); + cache_clear_all('storage_' . $form_state['values']['form_build_id'], 'cache_form'); } // If batches were set in the submit handlers, we process them now, @@ -483,7 +483,7 @@ function drupal_prepare_form($form_id, &$form, &$form_state) { else if (isset($user->uid) && $user->uid && !$form['#programmed']) { $form['#token'] = $form_id; $form['form_token'] = array( - '#id' => form_clean_id('edit-'. $form_id .'-form-token'), + '#id' => form_clean_id('edit-' . $form_id . '-form-token'), '#type' => 'token', '#default_value' => drupal_get_token($form['#token']), ); @@ -503,15 +503,15 @@ function drupal_prepare_form($form_id, &$form, &$form_state) { $form += _element_info('form'); if (!isset($form['#validate'])) { - if (function_exists($form_id .'_validate')) { - $form['#validate'] = array($form_id .'_validate'); + if (function_exists($form_id . '_validate')) { + $form['#validate'] = array($form_id . '_validate'); } } if (!isset($form['#submit'])) { - if (function_exists($form_id .'_submit')) { + if (function_exists($form_id . '_submit')) { // We set submit here so that it can be altered. - $form['#submit'] = array($form_id .'_submit'); + $form['#submit'] = array($form_id . '_submit'); } } @@ -523,7 +523,7 @@ function drupal_prepare_form($form_id, &$form, &$form_state) { // @todo: Remove this in Drupal 7. $data = &$form; $data['__drupal_alter_by_ref'] = array(&$form_state); - drupal_alter('form_'. $form_id, $data); + drupal_alter('form_' . $form_id, $data); // __drupal_alter_by_ref is unset in the drupal_alter() function, we need // to repopulate it to ensure both calls get the data. @@ -737,11 +737,11 @@ function _form_validate($elements, &$form_state, $form_id = NULL) { */ function form_execute_handlers($type, &$form, &$form_state) { $return = FALSE; - if (isset($form_state[$type .'_handlers'])) { - $handlers = $form_state[$type .'_handlers']; + if (isset($form_state[$type . '_handlers'])) { + $handlers = $form_state[$type . '_handlers']; } - elseif (isset($form['#'. $type])) { - $handlers = $form['#'. $type]; + elseif (isset($form['#' . $type])) { + $handlers = $form['#' . $type]; } else { $handlers = array(); @@ -948,15 +948,15 @@ function _form_builder_handle_input_element($form_id, &$form, &$form_state, $com // To make it easier to handle $_FILES in file.inc, we place all // file fields in the 'files' array. Also, we do not support // nested file names. - $form['#name'] = 'files['. $form['#name'] .']'; + $form['#name'] = 'files[' . $form['#name'] . ']'; } elseif (count($form['#parents'])) { - $form['#name'] .= '['. implode('][', $form['#parents']) .']'; + $form['#name'] .= '[' . implode('][', $form['#parents']) . ']'; } array_unshift($form['#parents'], $name); } if (!isset($form['#id'])) { - $form['#id'] = form_clean_id('edit-'. implode('-', $form['#parents'])); + $form['#id'] = form_clean_id('edit-' . implode('-', $form['#parents'])); } unset($edit); @@ -965,7 +965,7 @@ function _form_builder_handle_input_element($form_id, &$form, &$form_state, $com } if (!isset($form['#value']) && !array_key_exists('#value', $form)) { - $function = !empty($form['#value_callback']) ? $form['#value_callback'] : 'form_type_'. $form['#type'] .'_value'; + $function = !empty($form['#value_callback']) ? $form['#value_callback'] : 'form_type_' . $form['#type'] . '_value'; if (($form['#programmed']) || ((!isset($form['#access']) || $form['#access']) && isset($form['#post']) && (isset($form['#post']['form_id']) && $form['#post']['form_id'] == $form_id))) { $edit = $form['#post']; foreach ($form['#parents'] as $parent) { @@ -1131,7 +1131,7 @@ function form_type_image_button_value($form, $edit = FALSE) { } if (!isset($post[$element_name])) { - if (isset($post[$element_name .'_x'])) { + if (isset($post[$element_name . '_x'])) { return $form['#return_value']; } return NULL; @@ -1375,10 +1375,10 @@ function form_options_flatten($array, $reset = TRUE) { */ function theme_select($element) { $select = ''; - $size = $element['#size'] ? ' size="'. $element['#size'] .'"' : ''; + $size = $element['#size'] ? ' size="' . $element['#size'] . '"' : ''; _form_set_class($element, array('form-select')); $multiple = $element['#multiple']; - return theme('form_element', $element, ''); + return theme('form_element', $element, ''); } function form_select_options($element, $choices = NULL) { @@ -1392,7 +1392,7 @@ function form_select_options($element, $choices = NULL) { $options = ''; foreach ($choices as $key => $choice) { if (is_array($choice)) { - $options .= ''; + $options .= ''; $options .= form_select_options($element, $choice); $options .= ''; } @@ -1407,7 +1407,7 @@ function form_select_options($element, $choices = NULL) { else { $selected = ''; } - $options .= ''; + $options .= ''; } } return $options; @@ -1488,7 +1488,7 @@ function theme_fieldset($element) { } } - return ''. ($element['#title'] ? ''. $element['#title'] .'' : '') . (isset($element['#description']) && $element['#description'] ? '
'. $element['#description'] .'
' : '') . (!empty($element['#children']) ? $element['#children'] : '') . $element['#value'] ."\n"; + return '' . ($element['#title'] ? '' . $element['#title'] . '' : '') . (isset($element['#description']) && $element['#description'] ? '
' . $element['#description'] . '
' : '') . (!empty($element['#children']) ? $element['#children'] : '') . $element['#value'] . "\n"; } /** @@ -1505,12 +1505,12 @@ function theme_fieldset($element) { function theme_radio($element) { _form_set_class($element, array('form-radio')); $output = ''; + $output .= drupal_attributes($element['#attributes']) . ' />'; if (!is_null($element['#title'])) { - $output = ''; + $output = ''; } unset($element['#title']); @@ -1531,9 +1531,9 @@ function theme_radio($element) { function theme_radios($element) { $class = 'form-radios'; if (isset($element['#attributes']['class'])) { - $class .= ' '. $element['#attributes']['class']; + $class .= ' ' . $element['#attributes']['class']; } - $element['#children'] = '
'. (!empty($element['#children']) ? $element['#children'] : '') .'
'; + $element['#children'] = '
' . (!empty($element['#children']) ? $element['#children'] : '') . '
'; if ($element['#title'] || $element['#description']) { unset($element['#id']); return theme('form_element', $element, $element['#children']); @@ -1623,7 +1623,7 @@ function password_confirm_validate($form, &$form_state) { * @ingroup themeable */ function theme_date($element) { - return theme('form_element', $element, '
'. $element['#children'] .'
'); + return theme('form_element', $element, '
' . $element['#children'] . '
'); } /** @@ -1720,7 +1720,7 @@ function expand_radios($element) { '#default_value' => isset($element['#default_value']) ? $element['#default_value'] : NULL, '#attributes' => $element['#attributes'], '#parents' => $element['#parents'], - '#id' => form_clean_id('edit-'. implode('-', $parents_for_id)), + '#id' => form_clean_id('edit-' . implode('-', $parents_for_id)), ); } } @@ -1782,7 +1782,7 @@ function form_expand_ahah($element) { 'event' => $element['#ahah']['event'], 'keypress' => empty($element['#ahah']['keypress']) ? NULL : $element['#ahah']['keypress'], 'wrapper' => empty($element['#ahah']['wrapper']) ? NULL : $element['#ahah']['wrapper'], - 'selector' => empty($element['#ahah']['selector']) ? '#'. $element['#id'] : $element['#ahah']['selector'], + 'selector' => empty($element['#ahah']['selector']) ? '#' . $element['#id'] : $element['#ahah']['selector'], 'effect' => empty($element['#ahah']['effect']) ? 'none' : $element['#ahah']['effect'], 'method' => empty($element['#ahah']['method']) ? 'replace' : $element['#ahah']['method'], 'progress' => empty($element['#ahah']['progress']) ? array('type' => 'throbber') : $element['#ahah']['progress'], @@ -1841,14 +1841,14 @@ function theme_checkbox($element) { _form_set_class($element, array('form-checkbox')); $checkbox = ''; + $checkbox .= drupal_attributes($element['#attributes']) . ' />'; if (!is_null($element['#title'])) { - $checkbox = ''; + $checkbox = ''; } unset($element['#title']); @@ -1868,9 +1868,9 @@ function theme_checkbox($element) { function theme_checkboxes($element) { $class = 'form-checkboxes'; if (isset($element['#attributes']['class'])) { - $class .= ' '. $element['#attributes']['class']; + $class .= ' ' . $element['#attributes']['class']; } - $element['#children'] = '
'. (!empty($element['#children']) ? $element['#children'] : '') .'
'; + $element['#children'] = '
' . (!empty($element['#children']) ? $element['#children'] : '') . '
'; if ($element['#title'] || $element['#description']) { unset($element['#id']); return theme('form_element', $element, $element['#children']); @@ -1913,13 +1913,13 @@ function theme_submit($element) { function theme_button($element) { // Make sure not to overwrite classes. if (isset($element['#attributes']['class'])) { - $element['#attributes']['class'] = 'form-'. $element['#button_type'] .' '. $element['#attributes']['class']; + $element['#attributes']['class'] = 'form-' . $element['#button_type'] . ' ' . $element['#attributes']['class']; } else { - $element['#attributes']['class'] = 'form-'. $element['#button_type']; + $element['#attributes']['class'] = 'form-' . $element['#button_type']; } - return '\n"; + return '\n"; } /** @@ -1930,18 +1930,18 @@ function theme_button($element) { function theme_image_button($element) { // Make sure not to overwrite classes. if (isset($element['#attributes']['class'])) { - $element['#attributes']['class'] = 'form-'. $element['#button_type'] .' '. $element['#attributes']['class']; + $element['#attributes']['class'] = 'form-' . $element['#button_type'] . ' ' . $element['#attributes']['class']; } else { - $element['#attributes']['class'] = 'form-'. $element['#button_type']; + $element['#attributes']['class'] = 'form-' . $element['#button_type']; } - return '\n"; } @@ -1957,7 +1957,7 @@ function theme_image_button($element) { * @ingroup themeable */ function theme_hidden($element) { - return '\n"; + return '\n"; } /** @@ -1981,8 +1981,8 @@ function theme_token($element) { * @ingroup themeable */ function theme_textfield($element) { - $size = empty($element['#size']) ? '' : ' size="'. $element['#size'] .'"'; - $maxlength = empty($element['#maxlength']) ? '' : ' maxlength="'. $element['#maxlength'] .'"'; + $size = empty($element['#size']) ? '' : ' size="' . $element['#size'] . '"'; + $maxlength = empty($element['#maxlength']) ? '' : ' maxlength="' . $element['#maxlength'] . '"'; $class = array('form-text'); $extra = ''; $output = ''; @@ -1990,18 +1990,18 @@ function theme_textfield($element) { if ($element['#autocomplete_path']) { drupal_add_js('misc/autocomplete.js'); $class[] = 'form-autocomplete'; - $extra = ''; + $extra = ''; } _form_set_class($element, $class); if (isset($element['#field_prefix'])) { - $output .= ''. $element['#field_prefix'] .' '; + $output .= '' . $element['#field_prefix'] . ' '; } - $output .= ''; + $output .= ''; if (isset($element['#field_suffix'])) { - $output .= ' '. $element['#field_suffix'] .''; + $output .= ' ' . $element['#field_suffix'] . ''; } return theme('form_element', $element, $output) . $extra; @@ -2020,8 +2020,8 @@ function theme_textfield($element) { */ function theme_form($element) { // Anonymous div to satisfy XHTML compliance. - $action = $element['#action'] ? 'action="'. check_url($element['#action']) .'" ' : ''; - return '
\n
". $element['#children'] ."\n
\n"; + $action = $element['#action'] ? 'action="' . check_url($element['#action']) . '" ' : ''; + return '
\n
" . $element['#children'] . "\n
\n"; } /** @@ -2054,7 +2054,7 @@ function theme_textarea($element) { } _form_set_class($element, $class); - return theme('form_element', $element, ''); + return theme('form_element', $element, ''); } /** @@ -2087,11 +2087,11 @@ function theme_markup($element) { * @ingroup themeable */ function theme_password($element) { - $size = $element['#size'] ? ' size="'. $element['#size'] .'" ' : ''; - $maxlength = $element['#maxlength'] ? ' maxlength="'. $element['#maxlength'] .'" ' : ''; + $size = $element['#size'] ? ' size="' . $element['#size'] . '" ' : ''; + $maxlength = $element['#maxlength'] ? ' maxlength="' . $element['#maxlength'] . '" ' : ''; _form_set_class($element, array('form-text')); - $output = ''; + $output = ''; return theme('form_element', $element, $output); } @@ -2132,7 +2132,7 @@ function process_weight($element) { */ function theme_file($element) { _form_set_class($element, array('form-file')); - return theme('form_element', $element, '\n"); + return theme('form_element', $element, '\n"); } /** @@ -2154,25 +2154,25 @@ function theme_form_element($element, $value) { $output = '
*' : ''; + $required = !empty($element['#required']) ? '*' : ''; if (!empty($element['#title'])) { $title = $element['#title']; if (!empty($element['#id'])) { - $output .= ' \n"; + $output .= ' \n"; } else { - $output .= ' \n"; + $output .= ' \n"; } } $output .= " $value\n"; if (!empty($element['#description'])) { - $output .= '
'. $element['#description'] ."
\n"; + $output .= '
' . $element['#description'] . "
\n"; } $output .= "
\n"; @@ -2235,7 +2235,7 @@ function form_clean_id($id = NULL, $flush = FALSE) { // outputting duplicate IDs, which would break JS code and XHTML // validity anyways. For now, it's an acceptable stopgap solution. if (isset($seen_ids[$id])) { - $id = $id .'-'. $seen_ids[$id]++; + $id = $id . '-' . $seen_ids[$id]++; } else { $seen_ids[$id] = 1; @@ -2296,7 +2296,7 @@ function form_clean_id($id = NULL, $flush = FALSE) { * // and the batch processing can continue to the next operation. * * $node = node_load(array('uid' => $uid, 'type' => $type)); - * $context['results'][] = $node->nid .' : '. $node->title; + * $context['results'][] = $node->nid . ' : ' . $node->title; * $context['message'] = $node->title; * } * @@ -2311,7 +2311,7 @@ function form_clean_id($id = NULL, $flush = FALSE) { * $result = db_query_range("SELECT nid FROM {node} WHERE nid > %d ORDER BY nid ASC", $context['sandbox']['current_node'], 0, $limit); * while ($row = db_fetch_array($result)) { * $node = node_load($row['nid'], NULL, TRUE); - * $context['results'][] = $node->nid .' : '. $node->title; + * $context['results'][] = $node->nid . ' : ' . $node->title; * $context['sandbox']['progress']++; * $context['sandbox']['current_node'] = $node->nid; * $context['message'] = $node->title; @@ -2483,7 +2483,7 @@ function batch_process($redirect = NULL, $url = NULL) { // Actually store the batch data and the token generated form the batch id. db_query("UPDATE {batch} SET token = '%s', batch = '%s' WHERE bid = %d", drupal_get_token($batch['id']), serialize($batch), $batch['id']); - drupal_goto($batch['url'], 'op=start&id='. $batch['id']); + drupal_goto($batch['url'], 'op=start&id=' . $batch['id']); } else { // Non-progressive execution: bypass the whole progressbar workflow diff --git a/includes/image.gd.inc b/includes/image.gd.inc index c9378ca7f..ab26371f6 100644 --- a/includes/image.gd.inc +++ b/includes/image.gd.inc @@ -183,7 +183,7 @@ function image_gd_crop($source, $destination, $x, $y, $width, $height) { */ function image_gd_open($file, $extension) { $extension = str_replace('jpg', 'jpeg', $extension); - $open_func = 'imageCreateFrom'. $extension; + $open_func = 'imageCreateFrom' . $extension; if (!function_exists($open_func)) { return FALSE; } @@ -204,7 +204,7 @@ function image_gd_open($file, $extension) { */ function image_gd_close($res, $destination, $extension) { $extension = str_replace('jpg', 'jpeg', $extension); - $close_func = 'image'. $extension; + $close_func = 'image' . $extension; if (!function_exists($close_func)) { return FALSE; } diff --git a/includes/image.inc b/includes/image.inc index 03f527887..d86b62b01 100644 --- a/includes/image.inc +++ b/includes/image.inc @@ -42,7 +42,7 @@ function image_get_available_toolkits() { $output = array(); foreach ($toolkits as $file => $toolkit) { include_once "./$file"; - $function = str_replace('.', '_', $toolkit->name) .'_info'; + $function = str_replace('.', '_', $toolkit->name) . '_info'; if (function_exists($function)) { $info = $function(); $output[$info['name']] = $info['title']; @@ -63,7 +63,7 @@ function image_get_toolkit() { if (!$toolkit) { $toolkit = variable_get('image_toolkit', 'gd'); - $toolkit_file = './includes/image.'. $toolkit .'.inc'; + $toolkit_file = './includes/image.' . $toolkit . '.inc'; if (isset($toolkit) && file_exists($toolkit_file)) { include_once $toolkit_file; } @@ -87,7 +87,7 @@ function image_get_toolkit() { */ function image_toolkit_invoke($method, $params = array()) { if ($toolkit = image_get_toolkit()) { - $function = 'image_'. $toolkit .'_'. $method; + $function = 'image_' . $toolkit . '_' . $method; if (function_exists($function)) { return call_user_func_array($function, $params); } diff --git a/includes/install.inc b/includes/install.inc index 6d6d4349e..2d74a9230 100644 --- a/includes/install.inc +++ b/includes/install.inc @@ -42,8 +42,8 @@ function drupal_get_schema_versions($module) { $updates = array(); $functions = get_defined_functions(); foreach ($functions['user'] as $function) { - if (strpos($function, $module .'_update_') === 0) { - $version = substr($function, strlen($module .'_update_')); + if (strpos($function, $module . '_update_') === 0) { + $version = substr($function, strlen($module . '_update_')); if (is_numeric($version)) { $updates[] = $version; } @@ -110,7 +110,7 @@ function drupal_install_profile_name() { if (!isset($name)) { // Load profile details. - $function = $profile .'_profile_details'; + $function = $profile . '_profile_details'; if (function_exists($function)) { $details = $function(); } @@ -134,7 +134,7 @@ function drupal_detect_baseurl($file = 'install.php') { global $profile; $proto = $_SERVER['HTTPS'] ? 'https://' : 'http://'; $host = $_SERVER['SERVER_NAME']; - $port = ($_SERVER['SERVER_PORT'] == 80 ? '' : ':'. $_SERVER['SERVER_PORT']); + $port = ($_SERVER['SERVER_PORT'] == 80 ? '' : ':' . $_SERVER['SERVER_PORT']); $uri = preg_replace("/\?.*/", '', $_SERVER['REQUEST_URI']); $dir = str_replace("/$file", '', $uri); @@ -152,9 +152,9 @@ function drupal_detect_database_types() { $databases = array(); foreach (array('mysql', 'mysqli', 'pgsql') as $type) { - if (file_exists('./includes/install.'. $type .'.inc')) { - include_once './includes/install.'. $type .'.inc'; - $function = $type .'_is_available'; + if (file_exists('./includes/install.' . $type . '.inc')) { + include_once './includes/install.' . $type . '.inc'; + $function = $type . '_is_available'; if ($function()) { $databases[$type] = $type; } @@ -173,7 +173,7 @@ function drupal_detect_database_types() { */ function drupal_rewrite_settings($settings = array(), $prefix = '') { $default_settings = './sites/default/default.settings.php'; - $settings_file = './'. conf_path(FALSE, TRUE) .'/'. $prefix .'settings.php'; + $settings_file = './' . conf_path(FALSE, TRUE) . '/' . $prefix . 'settings.php'; // Build list of setting names and insert the values into the global namespace. $keys = array(); @@ -197,7 +197,7 @@ function drupal_rewrite_settings($settings = array(), $prefix = '') { preg_match('/define\(\s*[\'"]([A-Z_-]+)[\'"]\s*,(.*?)\);/', $line, $variable); if (in_array($variable[1], $keys)) { $setting = $settings[$variable[1]]; - $buffer .= str_replace($variable[2], " '". $setting['value'] ."'", $line); + $buffer .= str_replace($variable[2], " '" . $setting['value'] . "'", $line); unset($settings[$variable[1]]); unset($settings[$variable[2]]); } @@ -212,7 +212,7 @@ function drupal_rewrite_settings($settings = array(), $prefix = '') { // Write new value to settings.php in the following format: // $'setting' = 'value'; // 'comment' $setting = $settings[$variable[1]]; - $buffer .= '$'. $variable[1] ." = '". $setting['value'] ."';". (!empty($setting['comment']) ? ' // '. $setting['comment'] ."\n" : "\n"); + $buffer .= '$' . $variable[1] . " = '" . $setting['value'] . "';" . (!empty($setting['comment']) ? ' // ' . $setting['comment'] . "\n" : "\n"); unset($settings[$variable[1]]); } else { @@ -228,7 +228,7 @@ function drupal_rewrite_settings($settings = array(), $prefix = '') { // Add required settings that were missing from settings.php. foreach ($settings as $setting => $data) { if ($data['required']) { - $buffer .= "\$$setting = '". $data['value'] ."';\n"; + $buffer .= "\$$setting = '" . $data['value'] . "';\n"; } } @@ -251,7 +251,7 @@ function drupal_rewrite_settings($settings = array(), $prefix = '') { function drupal_get_install_files($module_list = array()) { $installs = array(); foreach ($module_list as $module) { - $installs = array_merge($installs, drupal_system_listing($module .'.install$', 'modules')); + $installs = array_merge($installs, drupal_system_listing($module . '.install$', 'modules')); } return $installs; } @@ -279,7 +279,7 @@ function drupal_verify_profile($profile, $locale) { require_once($profile_file); // Get a list of modules required by this profile. - $function = $profile .'_profile_modules'; + $function = $profile . '_profile_modules'; $module_list = array_merge(drupal_required_modules(), $function(), ($locale != 'en' ? array('locale') : array())); // Get a list of modules that exist in Drupal's assorted subdirectories. @@ -355,11 +355,11 @@ function _drupal_install_module($module) { */ function drupal_install_system() { $system_path = dirname(drupal_get_filename('module', 'system', NULL)); - require_once './'. $system_path .'/system.install'; + require_once './' . $system_path . '/system.install'; module_invoke('system', 'install'); $system_versions = drupal_get_schema_versions('system'); $system_version = $system_versions ? max($system_versions) : SCHEMA_INSTALLED; - db_query("INSERT INTO {system} (filename, name, type, owner, status, throttle, bootstrap, schema_version) VALUES('%s', '%s', '%s', '%s', %d, %d, %d, %d)", $system_path .'/system.module', 'system', 'module', '', 1, 0, 0, $system_version); + db_query("INSERT INTO {system} (filename, name, type, owner, status, throttle, bootstrap, schema_version) VALUES('%s', '%s', '%s', '%s', %d, %d, %d, %d)", $system_path . '/system.module', 'system', 'module', '', 1, 0, 0, $system_version); // Now that we've installed things properly, bootstrap the full Drupal environment drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); module_rebuild_cache(); @@ -396,7 +396,7 @@ function drupal_uninstall_module($module) { } $placeholders = implode(', ', array_fill(0, count($paths), "'%s'")); - $result = db_query('SELECT * FROM {menu_links} WHERE router_path IN ('. $placeholders .') AND external = 0 ORDER BY depth DESC', $paths); + $result = db_query('SELECT * FROM {menu_links} WHERE router_path IN (' . $placeholders . ') AND external = 0 ORDER BY depth DESC', $paths); // Remove all such items. Starting from those with the greatest depth will // minimize the amount of re-parenting done by menu_link_delete(). while ($item = db_fetch_array($result)) { @@ -427,7 +427,7 @@ function drupal_verify_install_file($file, $mask = NULL, $type = 'file') { } // Verify that the file is the type of file it is supposed to be. if (isset($type) && file_exists($file)) { - $check = 'is_'. $type; + $check = 'is_' . $type; if (!function_exists($check) || !$check($file)) { $return = FALSE; } @@ -614,7 +614,7 @@ function drupal_install_fix_file($file, $mask, $message = TRUE) { */ function install_goto($path) { global $base_url; - header('Location: '. $base_url .'/'. $path); + header('Location: ' . $base_url . '/' . $path); header('Cache-Control: no-cache'); // Not a permanent redirect. exit(); } @@ -630,7 +630,7 @@ function st($string, $args = array()) { if (!isset($locale_strings)) { $locale_strings = array(); - $filename = './profiles/'. $profile .'/translations/'. $install_locale .'.po'; + $filename = './profiles/' . $profile . '/translations/' . $install_locale . '.po'; if (file_exists($filename)) { require_once './includes/locale.inc'; $file = (object) array('filepath' => $filename); @@ -650,7 +650,7 @@ function st($string, $args = array()) { // Escaped and placeholder case '%': default: - $args[$key] = ''. check_plain($value) .''; + $args[$key] = '' . check_plain($value) . ''; break; // Pass-through case '!': @@ -677,7 +677,7 @@ function drupal_check_profile($profile) { require_once($profile_file); // Get a list of modules required by this profile. - $function = $profile .'_profile_modules'; + $function = $profile . '_profile_modules'; $module_list = array_unique(array_merge(drupal_required_modules(), $function())); // Get a list of all .install files. @@ -724,7 +724,7 @@ function drupal_check_module($module) { if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) { $message = $requirement['description']; if (isset($requirement['value']) && $requirement['value']) { - $message .= ' ('. t('Currently using !item !version', array('!item' => $requirement['title'], '!version' => $requirement['value'])) .')'; + $message .= ' (' . t('Currently using !item !version', array('!item' => $requirement['title'], '!version' => $requirement['value'])) . ')'; } drupal_set_message($message, 'error'); } diff --git a/includes/install.mysql.inc b/includes/install.mysql.inc index dc268525c..2945fab7b 100644 --- a/includes/install.mysql.inc +++ b/includes/install.mysql.inc @@ -35,7 +35,7 @@ function drupal_test_mysql($url, &$success) { // Allow for non-standard MySQL port. if (isset($url['port'])) { - $url['host'] = $url['host'] .':'. $url['port']; + $url['host'] = $url['host'] . ':' . $url['port']; } // Test connecting to the database. diff --git a/includes/install.pgsql.inc b/includes/install.pgsql.inc index f03159ebb..c5ad5f2f3 100644 --- a/includes/install.pgsql.inc +++ b/includes/install.pgsql.inc @@ -30,19 +30,19 @@ function drupal_test_pgsql($url, &$success) { // Decode url-encoded information in the db connection string if (isset($url['user'])) { - $conn_string .= ' user='. urldecode($url['user']); + $conn_string .= ' user=' . urldecode($url['user']); } if (isset($url['pass'])) { - $conn_string .= ' password='. urldecode($url['pass']); + $conn_string .= ' password=' . urldecode($url['pass']); } if (isset($url['host'])) { - $conn_string .= ' host='. urldecode($url['host']); + $conn_string .= ' host=' . urldecode($url['host']); } if (isset($url['path'])) { - $conn_string .= ' dbname='. substr(urldecode($url['path']), 1); + $conn_string .= ' dbname=' . substr(urldecode($url['path']), 1); } if (isset($url['port'])) { - $conn_string .= ' port='. urldecode($url['port']); + $conn_string .= ' port=' . urldecode($url['port']); } // Test connecting to the database. diff --git a/includes/language.inc b/includes/language.inc index e92f36d6d..866947ea3 100644 --- a/includes/language.inc +++ b/includes/language.inc @@ -136,7 +136,7 @@ function language_url_rewrite(&$path, &$options) { case LANGUAGE_NEGOTIATION_PATH: if (!empty($options['language']->prefix)) { - $options['prefix'] = $options['language']->prefix .'/'; + $options['prefix'] = $options['language']->prefix . '/'; } break; } diff --git a/includes/locale.inc b/includes/locale.inc index 14176bd7d..9f51306f9 100644 --- a/includes/locale.inc +++ b/includes/locale.inc @@ -78,12 +78,12 @@ function theme_locale_languages_overview_form($form) { $rows[] = array( array('data' => drupal_render($form['enabled'][$key]), 'align' => 'center'), check_plain($key), - ''. drupal_render($form['name'][$key]) .'', + '' . drupal_render($form['name'][$key]) . '', drupal_render($form['native'][$key]), drupal_render($form['direction'][$key]), drupal_render($form['site_default'][$key]), drupal_render($form['weight'][$key]), - l(t('edit'), 'admin/settings/language/edit/'. $key) . (($key != 'en' && $key != $default->language) ? ' '. l(t('delete'), 'admin/settings/language/delete/'. $key) : '') + l(t('edit'), 'admin/settings/language/edit/' . $key) . (($key != 'en' && $key != $default->language) ? ' ' . l(t('delete'), 'admin/settings/language/delete/' . $key) : '') ); } } @@ -412,7 +412,7 @@ function locale_languages_delete_form_submit($form, &$form_state) { if (isset($languages[$form_state['values']['langcode']])) { // Remove translations first. db_query("DELETE FROM {locales_target} WHERE language = '%s'", $form_state['values']['langcode']); - cache_clear_all('locale:'. $form_state['values']['langcode'], 'cache'); + cache_clear_all('locale:' . $form_state['values']['langcode'], 'cache'); // With no translations, this removes existing JavaScript translations file. _locale_rebuild_js($form_state['values']['langcode']); // Remove the language. @@ -500,7 +500,7 @@ function locale_translate_overview_screen() { foreach ($languages as $langcode => $language) { $rows[$langcode] = array('name' => ($langcode == 'en' ? t('English (built-in)') : t($language->name))); foreach ($groups as $group => $name) { - $rows[$langcode][$group] = ($langcode == 'en' ? t('n/a') : '0/'. (isset($groupsums[$group]) ? $groupsums[$group] : 0) .' (0%)'); + $rows[$langcode][$group] = ($langcode == 'en' ? t('n/a') : '0/' . (isset($groupsums[$group]) ? $groupsums[$group] : 0) . ' (0%)'); } } @@ -508,7 +508,7 @@ function locale_translate_overview_screen() { $translations = db_query("SELECT COUNT(*) AS translation, t.language, s.textgroup FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid GROUP BY textgroup, language"); while ($data = db_fetch_object($translations)) { $ratio = (!empty($groupsums[$data->textgroup]) && $data->translation > 0) ? round(($data->translation/$groupsums[$data->textgroup])*100., 2) : 0; - $rows[$data->language][$data->textgroup] = $data->translation .'/'. $groupsums[$data->textgroup] ." ($ratio%)"; + $rows[$data->language][$data->textgroup] = $data->translation . '/' . $groupsums[$data->textgroup] . " ($ratio%)"; } return theme('table', $headers, $rows); @@ -1062,7 +1062,7 @@ function _locale_import_read_po($op, $file, $mode = NULL, $lang = NULL, $group = _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno); return FALSE; } - $current["msgid"] = $current["msgid"] ."\0". $quoted; + $current["msgid"] = $current["msgid"] . "\0" . $quoted; $context = "MSGID_PLURAL"; } elseif (!strncmp("msgid", $line, 5)) { @@ -1453,13 +1453,13 @@ function _locale_import_parse_arithmetic($string) { if (!empty($prec[$op])) { $f = ""; if ($op == ":") { - $f = $elstk[$i - 2] ."):". $elstk[$i - 1] .")"; + $f = $elstk[$i - 2] . "):" . $elstk[$i - 1] . ")"; } elseif ($op == "?") { - $f = "(". $elstk[$i - 2] ."?(". $elstk[$i - 1]; + $f = "(" . $elstk[$i - 2] . "?(" . $elstk[$i - 1]; } else { - $f = "(". $elstk[$i - 2] . $op . $elstk[$i - 1] .")"; + $f = "(" . $elstk[$i - 2] . $op . $elstk[$i - 1] . ")"; } array_splice($elstk, $i - 2, 3, $f); break; @@ -1506,7 +1506,7 @@ function _locale_import_tokenize_formula($formula) { case 3: case 4: if ($next == '=') { - $tokens[] = $formula[$i] .'='; + $tokens[] = $formula[$i] . '='; $i++; } else { @@ -1572,7 +1572,7 @@ function _locale_import_append_plural($entry, $key) { function _locale_import_shorten_comments($comment) { $comm = ''; while (count($comment)) { - $test = $comm . substr(array_shift($comment), 1) .', '; + $test = $comm . substr(array_shift($comment), 1) . ', '; if (strlen($comm) < 130) { $comm = $test; } @@ -1623,10 +1623,10 @@ function _locale_parse_js_file($filepath) { // Match all calls to Drupal.t() in an array. // Note: \s also matches newlines with the 's' modifier. - preg_match_all('~[^\w]Drupal\s*\.\s*t\s*\(\s*('. LOCALE_JS_STRING .')\s*[,\)]~s', $file, $t_matches); + preg_match_all('~[^\w]Drupal\s*\.\s*t\s*\(\s*(' . LOCALE_JS_STRING . ')\s*[,\)]~s', $file, $t_matches); // Match all Drupal.formatPlural() calls in another array. - preg_match_all('~[^\w]Drupal\s*\.\s*formatPlural\s*\(\s*.+?\s*,\s*('. LOCALE_JS_STRING .')\s*,\s*((?:(?:\'(?:\\\\\'|[^\'])*@count(?:\\\\\'|[^\'])*\'|"(?:\\\\"|[^"])*@count(?:\\\\"|[^"])*")(?:\s*\+\s*)?)+)\s*[,\)]~s', $file, $plural_matches); + preg_match_all('~[^\w]Drupal\s*\.\s*formatPlural\s*\(\s*.+?\s*,\s*(' . LOCALE_JS_STRING . ')\s*,\s*((?:(?:\'(?:\\\\\'|[^\'])*@count(?:\\\\\'|[^\'])*\'|"(?:\\\\"|[^"])*@count(?:\\\\"|[^"])*")(?:\s*\+\s*)?)+)\s*[,\)]~s', $file, $plural_matches); // Loop through all matches and process them. $all_matches = array_merge($plural_matches[1], $t_matches[1]); @@ -1725,21 +1725,21 @@ function _locale_export_po_generate($language = NULL, $strings = array(), $heade if (!isset($header)) { if (isset($language)) { - $header = '# '. $language->name .' translation of '. variable_get('site_name', 'Drupal') ."\n"; - $header .= '# Generated by '. $user->name .' <'. $user->mail .">\n"; + $header = '# ' . $language->name . ' translation of ' . variable_get('site_name', 'Drupal') . "\n"; + $header .= '# Generated by ' . $user->name . ' <' . $user->mail . ">\n"; $header .= "#\n"; $header .= "msgid \"\"\n"; $header .= "msgstr \"\"\n"; $header .= "\"Project-Id-Version: PROJECT VERSION\\n\"\n"; - $header .= "\"POT-Creation-Date: ". date("Y-m-d H:iO") ."\\n\"\n"; - $header .= "\"PO-Revision-Date: ". date("Y-m-d H:iO") ."\\n\"\n"; + $header .= "\"POT-Creation-Date: " . date("Y-m-d H:iO") . "\\n\"\n"; + $header .= "\"PO-Revision-Date: " . date("Y-m-d H:iO") . "\\n\"\n"; $header .= "\"Last-Translator: NAME \\n\"\n"; $header .= "\"Language-Team: LANGUAGE \\n\"\n"; $header .= "\"MIME-Version: 1.0\\n\"\n"; $header .= "\"Content-Type: text/plain; charset=utf-8\\n\"\n"; $header .= "\"Content-Transfer-Encoding: 8bit\\n\"\n"; if ($language->formula && $language->plurals) { - $header .= "\"Plural-Forms: nplurals=". $language->plurals ."; plural=". strtr($language->formula, array('$' => '')) .";\\n\"\n"; + $header .= "\"Plural-Forms: nplurals=" . $language->plurals . "; plural=" . strtr($language->formula, array('$' => '')) . ";\\n\"\n"; } } else { @@ -1749,7 +1749,7 @@ function _locale_export_po_generate($language = NULL, $strings = array(), $heade $header .= "msgid \"\"\n"; $header .= "msgstr \"\"\n"; $header .= "\"Project-Id-Version: PROJECT VERSION\\n\"\n"; - $header .= "\"POT-Creation-Date: ". date("Y-m-d H:iO") ."\\n\"\n"; + $header .= "\"POT-Creation-Date: " . date("Y-m-d H:iO") . "\\n\"\n"; $header .= "\"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\\n\"\n"; $header .= "\"Last-Translator: NAME \\n\"\n"; $header .= "\"Language-Team: LANGUAGE \\n\"\n"; @@ -1760,22 +1760,22 @@ function _locale_export_po_generate($language = NULL, $strings = array(), $heade } } - $output = $header ."\n"; + $output = $header . "\n"; foreach ($strings as $lid => $string) { // Only process non-children, children are output below their parent. if (!isset($string['child'])) { if ($string['comment']) { - $output .= '#: '. $string['comment'] ."\n"; + $output .= '#: ' . $string['comment'] . "\n"; } - $output .= 'msgid '. _locale_export_string($string['source']); + $output .= 'msgid ' . _locale_export_string($string['source']); if (!empty($string['plural'])) { $plural = $string['plural']; - $output .= 'msgid_plural '. _locale_export_string($strings[$plural]['source']); + $output .= 'msgid_plural ' . _locale_export_string($strings[$plural]['source']); if (isset($language)) { $translation = $string['translation']; for ($i = 0; $i < $language->plurals; $i++) { - $output .= 'msgstr['. $i .'] '. _locale_export_string($translation); + $output .= 'msgstr[' . $i . '] ' . _locale_export_string($translation); if ($plural) { $translation = _locale_export_remove_plural($strings[$plural]['translation']); $plural = isset($strings[$plural]['plural']) ? $strings[$plural]['plural'] : 0; @@ -1786,12 +1786,12 @@ function _locale_export_po_generate($language = NULL, $strings = array(), $heade } } else { - $output .= 'msgstr[0] ""'."\n"; - $output .= 'msgstr[1] ""'."\n"; + $output .= 'msgstr[0] ""' . "\n"; + $output .= 'msgstr[1] ""' . "\n"; } } else { - $output .= 'msgstr '. _locale_export_string($string['translation']); + $output .= 'msgstr ' . _locale_export_string($string['translation']); } $output .= "\n"; } @@ -1812,7 +1812,7 @@ function _locale_export_po_generate($language = NULL, $strings = array(), $heade function _locale_export_po($language = NULL, $output = NULL) { // Log the export event. if (isset($language)) { - $filename = $language->language .'.po'; + $filename = $language->language . '.po'; watchdog('locale', 'Exported %locale translation file: %filename.', array('%locale' => $language->name, '%filename' => $filename)); } else { @@ -1850,7 +1850,7 @@ function _locale_export_string($str) { // Multiline string if (count($parts) > 1) { - return "\"\"\n\"". implode("\"\n\"", $parts) ."\"\n"; + return "\"\"\n\"" . implode("\"\n\"", $parts) . "\"\n"; } // Single line string elseif (count($parts) == 1) { @@ -1878,7 +1878,7 @@ function _locale_export_wrap($str, $len) { $nstr = 0; } elseif (strlen("$cur $word") > $len) { - $ret[] = $cur ." "; + $ret[] = $cur . " "; $cur = $word; } else { @@ -1946,7 +1946,7 @@ function _locale_translate_seek() { switch ($query['language']) { // Force search in source strings case "en": - $sql = $join ." WHERE s.source LIKE '%%%s%%' $grouplimit ORDER BY s.source"; + $sql = $join . " WHERE s.source LIKE '%%%s%%' $grouplimit ORDER BY s.source"; $arguments = array($query['string']); // $where is not used, discard its arguments if (!empty($grouplimit)) { $arguments[] = $query['group']; @@ -1979,7 +1979,7 @@ function _locale_translate_seek() { foreach ($arr as $lid => $value) { $rows[] = array( $value['group'], - array('data' => check_plain(truncate_utf8($value['source'], 150, FALSE, TRUE)) .'
'. $value['location'] .''), + array('data' => check_plain(truncate_utf8($value['source'], 150, FALSE, TRUE)) . '
' . $value['location'] . ''), array('data' => _locale_translate_language_list($value['languages'], $limit_language), 'align' => 'center'), array('data' => l(t('edit'), "admin/build/translate/edit/$lid"), 'class' => 'nowrap'), array('data' => l(t('delete'), "admin/build/translate/delete/$lid"), 'class' => 'nowrap'), @@ -2038,12 +2038,12 @@ function _locale_invalidate_js($langcode = NULL) { $languages = language_list(); unset($languages['en']); foreach ($languages as $lcode => $data) { - $parsed['refresh:'. $lcode] = 'waiting'; + $parsed['refresh:' . $lcode] = 'waiting'; } } else { // Invalidate single language. - $parsed['refresh:'. $langcode] = 'waiting'; + $parsed['refresh:' . $langcode] = 'waiting'; } variable_set('javascript_parsed', $parsed); @@ -2108,7 +2108,7 @@ function _locale_rebuild_js($langcode = NULL) { $data .= "'pluralFormula': function(\$n) { return Number({$language->formula}); }, "; } - $data .= "'strings': ". drupal_to_js($translations) ." };"; + $data .= "'strings': " . drupal_to_js($translations) . " };"; $data_hash = md5($data); } @@ -2118,7 +2118,7 @@ function _locale_rebuild_js($langcode = NULL) { // Delete old file, if we have no translations anymore, or a different file to be saved. if (!empty($language->javascript) && (!$data || $language->javascript != $data_hash)) { - file_delete(file_create_path($dir .'/'. $language->language .'_'. $language->javascript .'.js')); + file_delete(file_create_path($dir . '/' . $language->language . '_' . $language->javascript . '.js')); $language->javascript = ''; $status = 'deleted'; } @@ -2129,7 +2129,7 @@ function _locale_rebuild_js($langcode = NULL) { file_check_directory($dir, TRUE); // Save the file. - $dest = $dir .'/'. $language->language .'_'. $data_hash .'.js'; + $dest = $dir . '/' . $language->language . '_' . $data_hash . '.js'; if (file_save_data($data, $dest)) { $language->javascript = $data_hash; $status = ($status == 'deleted') ? 'updated' : 'created'; @@ -2180,14 +2180,14 @@ function _locale_rebuild_js($langcode = NULL) { */ function _locale_translate_language_list($translation, $limit_language) { // Add CSS - drupal_add_css(drupal_get_path('module', 'locale') .'/locale.css', 'module', 'all', FALSE); + drupal_add_css(drupal_get_path('module', 'locale') . '/locale.css', 'module', 'all', FALSE); $languages = language_list(); unset($languages['en']); $output = ''; foreach ($languages as $langcode => $language) { if (!$limit_language || $limit_language == $langcode) { - $output .= (!empty($translation[$langcode])) ? $langcode .' ' : "$langcode "; + $output .= (!empty($translation[$langcode])) ? $langcode . ' ' : "$langcode "; } } @@ -2442,7 +2442,7 @@ function locale_batch_by_language($langcode, $finished = NULL, $skip = array()) $components = array(); $query = "SELECT name, filename FROM {system} WHERE status = 1"; if (count($skip)) { - $query .= " AND name NOT IN (". db_placeholders($skip, 'varchar') .")"; + $query .= " AND name NOT IN (" . db_placeholders($skip, 'varchar') . ")"; } $result = db_query($query, $skip); while ($component = db_fetch_object($result)) { @@ -2450,7 +2450,7 @@ function locale_batch_by_language($langcode, $finished = NULL, $skip = array()) // with names ending with $langcode.po. This allows for filenames // like node-module.de.po to let translators use small files and // be able to import in smaller chunks. - $files = array_merge($files, file_scan_directory(dirname($component->filename) .'/translations', '(^|\.)'. $langcode .'\.po$', array('.', '..', 'CVS'), 0, FALSE)); + $files = array_merge($files, file_scan_directory(dirname($component->filename) . '/translations', '(^|\.)' . $langcode . '\.po$', array('.', '..', 'CVS'), 0, FALSE)); $components[] = $component->name; } @@ -2482,7 +2482,7 @@ function locale_batch_by_component($components, $finished = '_locale_batch_syste // as $langcode.po or with names ending with $langcode.po. This allows // for filenames like node-module.de.po to let translators use small // files and be able to import in smaller chunks. - $files = array_merge($files, file_scan_directory(dirname($component->filename) .'/translations', '(^|\.)('. $language_list .')\.po$', array('.', '..', 'CVS'), 0, FALSE)); + $files = array_merge($files, file_scan_directory(dirname($component->filename) . '/translations', '(^|\.)(' . $language_list . ')\.po$', array('.', '..', 'CVS'), 0, FALSE)); } } return _locale_batch_build($files, $finished); diff --git a/includes/mail.inc b/includes/mail.inc index 3f943652b..56c765e7c 100644 --- a/includes/mail.inc +++ b/includes/mail.inc @@ -85,7 +85,7 @@ function drupal_mail($module, $key, $to, $language, $params = array(), $from = N // Bundle up the variables into a structured array for altering. $message = array( - 'id' => $module .'_'. $key, + 'id' => $module . '_' . $key, 'to' => $to, 'from' => isset($from) ? $from : $default_from, 'language' => $language, @@ -115,7 +115,7 @@ function drupal_mail($module, $key, $to, $language, $params = array(), $from = N // Build the e-mail (get subject and body, allow additional headers) by // invoking hook_mail() on this module. We cannot use module_invoke() as // we need to have $message by reference in hook_mail(). - if (function_exists($function = $module .'_mail')) { + if (function_exists($function = $module . '_mail')) { $function($key, $message, $params); } @@ -173,13 +173,13 @@ function drupal_mail($module, $key, $to, $language, $params = array(), $from = N function drupal_mail_send($message) { // Allow for a custom mail backend. if (variable_get('smtp_library', '') && file_exists(variable_get('smtp_library', ''))) { - include_once './'. variable_get('smtp_library', ''); + include_once './' . variable_get('smtp_library', ''); return drupal_mail_wrapper($message); } else { $mimeheaders = array(); foreach ($message['headers'] as $name => $value) { - $mimeheaders[] = $name .': '. mime_header_encode($value); + $mimeheaders[] = $name . ': ' . mime_header_encode($value); } return mail( $message['to'], @@ -286,7 +286,7 @@ function drupal_html_to_text($string, $allowed_tags = NULL) { if (count($urls)) { $footnotes .= "\n"; for ($i = 0, $max = count($urls); $i < $max; $i++) { - $footnotes .= '['. ($i + 1) .'] '. $urls[$i] ."\n"; + $footnotes .= '[' . ($i + 1) . '] ' . $urls[$i] . "\n"; } } @@ -326,7 +326,7 @@ function drupal_html_to_text($string, $allowed_tags = NULL) { $indent[] = count($lists) ? ' "' : '>'; break; case 'li': - $indent[] = is_numeric($lists[0]) ? ' '. $lists[0]++ .') ' : ' * '; + $indent[] = is_numeric($lists[0]) ? ' ' . $lists[0]++ . ') ' : ' * '; break; case 'dd': $indent[] = ' '; @@ -340,7 +340,7 @@ function drupal_html_to_text($string, $allowed_tags = NULL) { case '/blockquote': if (count($lists)) { // Append closing quote for inline quotes (immediately). - $output = rtrim($output, "> \n") ."\"\n"; + $output = rtrim($output, "> \n") . "\"\n"; $chunk = ''; // Ensure blank new-line. } // Fall-through @@ -377,7 +377,7 @@ function drupal_html_to_text($string, $allowed_tags = NULL) { // Horizontal rulers case 'hr': // Insert immediately. - $output .= drupal_wrap_mail('', implode('', $indent)) ."\n"; + $output .= drupal_wrap_mail('', implode('', $indent)) . "\n"; $output = _drupal_html_to_text_pad($output, '-'); break; @@ -404,7 +404,7 @@ function drupal_html_to_text($string, $allowed_tags = NULL) { $chunk = $casing($chunk); } // Format it and apply the current indentation. - $output .= drupal_wrap_mail($chunk, implode('', $indent)) ."\n"; + $output .= drupal_wrap_mail($chunk, implode('', $indent)) . "\n"; // Remove non-quotation markers from indentation. $indent = array_map('_drupal_html_to_text_clean', $indent); } @@ -442,13 +442,13 @@ function _drupal_html_to_mail_urls($match = NULL, $reset = FALSE) { } else { if (empty($regexp)) { - $regexp = '@^'. preg_quote($base_path, '@') .'@'; + $regexp = '@^' . preg_quote($base_path, '@') . '@'; } if ($match) { list(, , $url, $label) = $match; // Ensure all URLs are absolute. - $urls[] = strpos($url, '://') ? $url : preg_replace($regexp, $base_url .'/', $url); - return $label .' ['. count($urls) .']'; + $urls[] = strpos($url, '://') ? $url : preg_replace($regexp, $base_url . '/', $url); + return $label . ' [' . count($urls) . ']'; } } return $urls; @@ -477,5 +477,5 @@ function _drupal_html_to_text_pad($text, $pad, $prefix = '') { } $n = max(0, 79 - (strlen($text) - $p)); // Add prefix and padding, and restore linebreak. - return $text . $prefix . str_repeat($pad, $n - strlen($prefix)) ."\n"; + return $text . $prefix . str_repeat($pad, $n - strlen($prefix)) . "\n"; } diff --git a/includes/menu.inc b/includes/menu.inc index 235fd9f8c..914f5c8f1 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -312,7 +312,7 @@ function menu_get_item($path = NULL, $router_item = NULL) { $parts = array_slice($original_map, 0, MENU_MAX_PARTS); list($ancestors, $placeholders) = menu_get_ancestors($parts); - if ($router_item = db_fetch_array(db_query_range('SELECT * FROM {menu_router} WHERE path IN ('. implode (',', $placeholders) .') ORDER BY fit DESC', $ancestors, 0, 1))) { + if ($router_item = db_fetch_array(db_query_range('SELECT * FROM {menu_router} WHERE path IN (' . implode (',', $placeholders) . ') ORDER BY fit DESC', $ancestors, 0, 1))) { $map = _menu_translate($router_item, $original_map); if ($map === FALSE) { $router_items[$path] = FALSE; @@ -685,7 +685,7 @@ function _menu_link_translate(&$item) { */ function menu_get_object($type = 'node', $position = 1, $path = NULL) { $router_item = menu_get_item($path); - if (isset($router_item['load_functions'][$position]) && !empty($router_item['map'][$position]) && $router_item['load_functions'][$position] == $type .'_load') { + if (isset($router_item['load_functions'][$position]) && !empty($router_item['map'][$position]) && $router_item['load_functions'][$position] == $type . '_load') { return $router_item['map'][$position]; } } @@ -773,7 +773,7 @@ function menu_tree_all_data($menu_name = 'navigation', $item = NULL) { // Use $mlid as a flag for whether the data being loaded is for the whole tree. $mlid = isset($item['mlid']) ? $item['mlid'] : 0; // Generate a cache ID (cid) specific for this $menu_name and $item. - $cid = 'links:'. $menu_name .':all-cid:'. $mlid; + $cid = 'links:' . $menu_name . ':all-cid:' . $mlid; if (!isset($tree[$cid])) { // If the static variable doesn't have the data, check {cache_menu}. @@ -798,7 +798,7 @@ function menu_tree_all_data($menu_name = 'navigation', $item = NULL) { } $args = array_unique($args); $placeholders = implode(', ', array_fill(0, count($args), '%d')); - $where = ' AND ml.plid IN ('. $placeholders .')'; + $where = ' AND ml.plid IN (' . $placeholders . ')'; $parents = $args; $parents[] = $item['mlid']; } @@ -815,7 +815,7 @@ function menu_tree_all_data($menu_name = 'navigation', $item = NULL) { $data['tree'] = menu_tree_data(db_query(" SELECT m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, m.title_callback, m.title_arguments, m.type, m.description, ml.* FROM {menu_links} ml LEFT JOIN {menu_router} m ON m.path = ml.router_path - WHERE ml.menu_name = '%s'". $where ." + WHERE ml.menu_name = '%s'" . $where . " ORDER BY p1 ASC, p2 ASC, p3 ASC, p4 ASC, p5 ASC, p6 ASC, p7 ASC, p8 ASC, p9 ASC", $args), $parents); $data['node_links'] = array(); menu_tree_collect_node_links($data['tree'], $data['node_links']); @@ -856,7 +856,7 @@ function menu_tree_page_data($menu_name = 'navigation') { // Load the menu item corresponding to the current page. if ($item = menu_get_item()) { // Generate a cache ID (cid) specific for this page. - $cid = 'links:'. $menu_name .':page-cid:'. $item['href'] .':'. (int)$item['access']; + $cid = 'links:' . $menu_name . ':page-cid:' . $item['href'] . ':' . (int)$item['access']; if (!isset($tree[$cid])) { // If the static variable doesn't have the data, check {cache_menu}. @@ -880,7 +880,7 @@ function menu_tree_page_data($menu_name = 'navigation') { $args[] = ''; $placeholders .= ", '%s'"; } - $parents = db_fetch_array(db_query("SELECT p1, p2, p3, p4, p5, p6, p7, p8 FROM {menu_links} WHERE menu_name = '%s' AND link_path IN (". $placeholders .")", $args)); + $parents = db_fetch_array(db_query("SELECT p1, p2, p3, p4, p5, p6, p7, p8 FROM {menu_links} WHERE menu_name = '%s' AND link_path IN (" . $placeholders . ")", $args)); if (empty($parents)) { // If no link exists, we may be on a local task that's not in the links. @@ -899,7 +899,7 @@ function menu_tree_page_data($menu_name = 'navigation') { // Collect all the links set to be expanded, and then add all of // their children to the list as well. do { - $result = db_query("SELECT mlid FROM {menu_links} WHERE menu_name = '%s' AND expanded = 1 AND has_children = 1 AND plid IN (". $placeholders .') AND mlid NOT IN ('. $placeholders .')', array_merge(array($menu_name), $args, $args)); + $result = db_query("SELECT mlid FROM {menu_links} WHERE menu_name = '%s' AND expanded = 1 AND has_children = 1 AND plid IN (" . $placeholders . ') AND mlid NOT IN (' . $placeholders . ')', array_merge(array($menu_name), $args, $args)); $num_rows = FALSE; while ($item = db_fetch_array($result)) { $args[] = $item['mlid']; @@ -922,7 +922,7 @@ function menu_tree_page_data($menu_name = 'navigation') { $data['tree'] = menu_tree_data(db_query(" SELECT m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, m.title_callback, m.title_arguments, m.type, m.description, ml.* FROM {menu_links} ml LEFT JOIN {menu_router} m ON m.path = ml.router_path - WHERE ml.menu_name = '%s' AND ml.plid IN (". $placeholders .") + WHERE ml.menu_name = '%s' AND ml.plid IN (" . $placeholders . ") ORDER BY p1 ASC, p2 ASC, p3 ASC, p4 ASC, p5 ASC, p6 ASC, p7 ASC, p8 ASC, p9 ASC", $args), $parents); $data['node_links'] = array(); menu_tree_collect_node_links($data['tree'], $data['node_links']); @@ -948,7 +948,7 @@ function menu_tree_page_data($menu_name = 'navigation') { * Helper function - compute the real cache ID for menu tree data. */ function _menu_tree_cid($menu_name, $data) { - return 'links:'. $menu_name .':tree-data:'. md5(serialize($data)); + return 'links:' . $menu_name . ':tree-data:' . md5(serialize($data)); } /** @@ -977,8 +977,8 @@ function menu_tree_check_access(&$tree, $node_links = array()) { if ($node_links) { // Use db_rewrite_sql to evaluate view access without loading each full node. $nids = array_keys($node_links); - $placeholders = '%d'. str_repeat(', %d', count($nids) - 1); - $result = db_query(db_rewrite_sql("SELECT n.nid FROM {node} n WHERE n.status = 1 AND n.nid IN (". $placeholders .")"), $nids); + $placeholders = '%d' . str_repeat(', %d', count($nids) - 1); + $result = db_query(db_rewrite_sql("SELECT n.nid FROM {node} n WHERE n.status = 1 AND n.nid IN (" . $placeholders . ")"), $nids); while ($node = db_fetch_array($result)) { $nid = $node['nid']; foreach ($node_links[$nid] as $mlid => $link) { @@ -1005,7 +1005,7 @@ function _menu_tree_check_access(&$tree) { // The weights are made a uniform 5 digits by adding 50000 as an offset. // After _menu_link_translate(), $item['title'] has the localized link title. // Adding the mlid to the end of the index insures that it is unique. - $new_tree[(50000 + $item['weight']) .' '. $item['title'] .' '. $item['mlid']] = $tree[$key]; + $new_tree[(50000 + $item['weight']) . ' ' . $item['title'] . ' ' . $item['mlid']] = $tree[$key]; } } // Sort siblings in the tree based on the weights and localized titles. @@ -1112,7 +1112,7 @@ function theme_menu_item_link($link) { * @ingroup themeable */ function theme_menu_tree($tree) { - return ''; + return ''; } /** @@ -1123,12 +1123,12 @@ function theme_menu_tree($tree) { function theme_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL) { $class = ($menu ? 'expanded' : ($has_children ? 'collapsed' : 'leaf')); if (!empty($extra_class)) { - $class .= ' '. $extra_class; + $class .= ' ' . $extra_class; } if ($in_active_trail) { $class .= ' active-trail'; } - return '
  • '. $link . $menu ."
  • \n"; + return '
  • ' . $link . $menu . "
  • \n"; } /** @@ -1137,7 +1137,7 @@ function theme_menu_item($link, $has_children, $menu = '', $in_active_trail = FA * @ingroup themeable */ function theme_menu_local_task($link, $active = FALSE) { - return '
  • '. $link ."
  • \n"; + return '
  • ' . $link . "
  • \n"; } /** @@ -1162,12 +1162,12 @@ function menu_get_active_help() { if (module_hook($name, 'help')) { // Lookup help for this path. if ($help = module_invoke($name, 'help', $router_path, $arg)) { - $output .= $help ."\n"; + $output .= $help . "\n"; } // Add "more help" link on admin pages if the module provides a // standalone help page. - if ($arg[0] == "admin" && module_exists('help') && module_invoke($name, 'help', 'admin/help#'. $arg[2], $empty_arg) && $help) { - $output .= theme("more_help_link", url('admin/help/'. $arg[2])); + if ($arg[0] == "admin" && module_exists('help') && module_invoke($name, 'help', 'admin/help#' . $arg[2], $empty_arg) && $help) { + $output .= theme("more_help_link", url('admin/help/' . $arg[2])); } } } @@ -1258,7 +1258,7 @@ function menu_navigation_links($menu_name, $level = 0) { $l['href'] = $item['link']['href']; $l['title'] = $item['link']['title']; // Keyed with unique menu id to generate classes from theme_links(). - $links['menu-'. $item['link']['mlid']] = $l; + $links['menu-' . $item['link']['mlid']] = $l; } } return $links; @@ -1424,10 +1424,10 @@ function theme_menu_local_tasks() { $output = ''; if ($primary = menu_primary_local_tasks()) { - $output .= "
      \n". $primary ."
    \n"; + $output .= "
      \n" . $primary . "
    \n"; } if ($secondary = menu_secondary_local_tasks()) { - $output .= "
      \n". $secondary ."
    \n"; + $output .= "
      \n" . $secondary . "
    \n"; } return $output; @@ -1608,11 +1608,11 @@ function menu_cache_clear($menu_name = 'navigation') { static $cache_cleared = array(); if (empty($cache_cleared[$menu_name])) { - cache_clear_all('links:'. $menu_name .':', 'cache_menu', TRUE); + cache_clear_all('links:' . $menu_name . ':', 'cache_menu', TRUE); $cache_cleared[$menu_name] = 1; } elseif ($cache_cleared[$menu_name] == 1) { - register_shutdown_function('cache_clear_all', 'links:'. $menu_name .':', 'cache_menu', TRUE); + register_shutdown_function('cache_clear_all', 'links:' . $menu_name . ':', 'cache_menu', TRUE); $cache_cleared[$menu_name] = 2; } } @@ -1663,7 +1663,7 @@ function menu_router_build($reset = FALSE) { // a given item came from. $callbacks = array(); foreach (module_implements('menu') as $module) { - $router_items = call_user_func($module .'_menu'); + $router_items = call_user_func($module . '_menu'); if (isset($router_items) && is_array($router_items)) { foreach (array_keys($router_items) as $path) { $router_items[$path]['module'] = $module; @@ -1865,10 +1865,10 @@ function menu_link_save(&$item) { do { $parent = FALSE; $parent_path = substr($parent_path, 0, strrpos($parent_path, '/')); - $result = db_query("SELECT COUNT(*) FROM {menu_links} ". $where, $parent_path, $arg2); + $result = db_query("SELECT COUNT(*) FROM {menu_links} " . $where, $parent_path, $arg2); // Only valid if we get a unique result. if (db_result($result) == 1) { - $parent = db_fetch_array(db_query("SELECT * FROM {menu_links} ". $where, $parent_path, $arg2)); + $parent = db_fetch_array(db_query("SELECT * FROM {menu_links} " . $where, $parent_path, $arg2)); } } while ($parent === FALSE && $parent_path); } @@ -2077,10 +2077,10 @@ function menu_link_children_relative_depth($item) { while ($i <= MENU_MAX_DEPTH && $item[$p]) { $match .= " AND $p = %d"; $args[] = $item[$p]; - $p = 'p'. ++$i; + $p = 'p' . ++$i; } - $max_depth = db_result(db_query_range("SELECT depth FROM {menu_links} WHERE menu_name = '%s'". $match ." ORDER BY depth DESC", $args, 0, 1)); + $max_depth = db_result(db_query_range("SELECT depth FROM {menu_links} WHERE menu_name = '%s'" . $match . " ORDER BY depth DESC", $args, 0, 1)); return ($max_depth > $item['depth']) ? $max_depth - $item['depth'] : 0; } @@ -2098,16 +2098,16 @@ function _menu_link_move_children($item, $existing_item) { $i = 1; while ($i <= $item['depth']) { - $p = 'p'. $i++; + $p = 'p' . $i++; $set[] = "$p = %d"; $args[] = $item[$p]; } $j = $existing_item['depth'] + 1; while ($i <= MENU_MAX_DEPTH && $j <= MENU_MAX_DEPTH) { - $set[] = 'p'. $i++ .' = p'. $j++; + $set[] = 'p' . $i++ . ' = p' . $j++; } while ($i <= MENU_MAX_DEPTH) { - $set[] = 'p'. $i++ .' = 0'; + $set[] = 'p' . $i++ . ' = 0'; } $shift = $item['depth'] - $existing_item['depth']; @@ -2129,12 +2129,12 @@ function _menu_link_move_children($item, $existing_item) { $where[] = "menu_name = '%s'"; $args[] = $existing_item['menu_name']; $p = 'p1'; - for ($i = 1; $i <= MENU_MAX_DEPTH && $existing_item[$p]; $p = 'p'. ++$i) { + for ($i = 1; $i <= MENU_MAX_DEPTH && $existing_item[$p]; $p = 'p' . ++$i) { $where[] = "$p = %d"; $args[] = $existing_item[$p]; } - db_query("UPDATE {menu_links} SET ". implode(', ', $set) ." WHERE ". implode(' AND ', $where), $args); + db_query("UPDATE {menu_links} SET " . implode(', ', $set) . " WHERE " . implode(' AND ', $where), $args); // Check the has_children status of the parent, while excluding this item. _menu_update_parental_status($existing_item, TRUE); } @@ -2148,7 +2148,7 @@ function _menu_update_parental_status($item, $exclude = FALSE) { // We may want to exclude the passed link as a possible child. $where = $exclude ? " AND mlid != %d" : ''; // Check if at least one visible child exists in the table. - $parent_has_children = (bool)db_result(db_query_range("SELECT mlid FROM {menu_links} WHERE menu_name = '%s' AND plid = %d AND hidden = 0". $where, $item['menu_name'], $item['plid'], $item['mlid'], 0, 1)); + $parent_has_children = (bool)db_result(db_query_range("SELECT mlid FROM {menu_links} WHERE menu_name = '%s' AND plid = %d AND hidden = 0" . $where, $item['menu_name'], $item['plid'], $item['mlid'], 0, 1)); db_query("UPDATE {menu_links} SET has_children = %d WHERE mlid = %d", $parent_has_children, $item['plid']); } } @@ -2159,14 +2159,14 @@ function _menu_update_parental_status($item, $exclude = FALSE) { function _menu_link_parents_set(&$item, $parent) { $i = 1; while ($i < $item['depth']) { - $p = 'p'. $i++; + $p = 'p' . $i++; $item[$p] = $parent[$p]; } - $p = 'p'. $i++; + $p = 'p' . $i++; // The parent (p1 - p9) corresponding to the depth always equals the mlid. $item[$p] = $item['mlid']; while ($i <= MENU_MAX_DEPTH) { - $p = 'p'. $i++; + $p = 'p' . $i++; $item[$p] = 0; } } @@ -2198,13 +2198,13 @@ function _menu_router_build($callbacks) { $load_functions[$k] = NULL; } else { - if (function_exists($matches[1] .'_to_arg')) { - $to_arg_functions[$k] = $matches[1] .'_to_arg'; + if (function_exists($matches[1] . '_to_arg')) { + $to_arg_functions[$k] = $matches[1] . '_to_arg'; $load_functions[$k] = NULL; $match = TRUE; } - if (function_exists($matches[1] .'_load')) { - $function = $matches[1] .'_load'; + if (function_exists($matches[1] . '_load')) { + $function = $matches[1] . '_load'; // Create an array of arguments that will be passed to the _load // function when this menu path is checked, if 'load arguments' // exists. @@ -2330,7 +2330,7 @@ function _menu_router_build($callbacks) { // Calculate out the file to be included for each callback, if any. if ($item['file']) { $file_path = $item['file path'] ? $item['file path'] : drupal_get_path('module', $item['module']); - $item['include file'] = $file_path .'/'. $item['file']; + $item['include file'] = $file_path . '/' . $item['file']; } $title_arguments = $item['title arguments'] ? serialize($item['title arguments']) : ''; @@ -2395,7 +2395,7 @@ function _menu_site_is_offline() { return $_GET['q'] != 'user' && $_GET['q'] != 'user/login'; } // Logged in users are unprivileged here, so they are logged out. - require_once drupal_get_path('module', 'user') .'/user.pages.inc'; + require_once drupal_get_path('module', 'user') . '/user.pages.inc'; user_logout(); } } diff --git a/includes/module.inc b/includes/module.inc index 034f54ed7..c87393c7b 100644 --- a/includes/module.inc +++ b/includes/module.inc @@ -113,7 +113,7 @@ function module_rebuild_cache() { foreach ($files as $filename => $file) { // Look for the info file. - $file->info = drupal_parse_info_file(dirname($file->filename) .'/'. $file->name .'.info'); + $file->info = drupal_parse_info_file(dirname($file->filename) . '/' . $file->name . '.info'); // Skip modules that don't provide info. if (empty($file->info)) { @@ -256,7 +256,7 @@ function module_load_include($type, $module, $name = NULL) { $name = $module; } - $file = './'. drupal_get_path('module', $module) ."/$name.$type"; + $file = './' . drupal_get_path('module', $module) . "/$name.$type"; if (is_file($file)) { require_once $file; @@ -383,7 +383,7 @@ function module_disable($module_list) { * implemented in that module. */ function module_hook($module, $hook) { - return function_exists($module .'_'. $hook); + return function_exists($module . '_' . $hook); } /** @@ -445,7 +445,7 @@ function module_invoke() { $module = $args[0]; $hook = $args[1]; unset($args[0], $args[1]); - $function = $module .'_'. $hook; + $function = $module . '_' . $hook; if (module_hook($module, $hook)) { return call_user_func_array($function, $args); } @@ -467,7 +467,7 @@ function module_invoke_all() { unset($args[0]); $return = array(); foreach (module_implements($hook) as $module) { - $function = $module .'_'. $hook; + $function = $module . '_' . $hook; $result = call_user_func_array($function, $args); if (isset($result) && is_array($result)) { $return = array_merge_recursive($return, $result); diff --git a/includes/path.inc b/includes/path.inc index df20c0eb1..8f2939c33 100644 --- a/includes/path.inc +++ b/includes/path.inc @@ -231,7 +231,7 @@ function drupal_match_path($path, $patterns) { static $regexps; if (!isset($regexps[$patterns])) { - $regexps[$patterns] = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($patterns, '/')) .')$/'; + $regexps[$patterns] = '/^(' . preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\($|\|)/'), array('|', '.*', '\1' . preg_quote(variable_get('site_frontpage', 'node'), '/') . '\2'), preg_quote($patterns, '/')) . ')$/'; } return preg_match($regexps[$patterns], $path); } diff --git a/includes/session.inc b/includes/session.inc index 74ddb2c3f..25d2479d4 100644 --- a/includes/session.inc +++ b/includes/session.inc @@ -110,7 +110,7 @@ function sess_regenerate() { */ function sess_count($timestamp = 0, $anonymous = true) { $query = $anonymous ? ' AND uid = 0' : ' AND uid > 0'; - return db_result(db_query('SELECT COUNT(sid) AS count FROM {sessions} WHERE timestamp >= %d'. $query, $timestamp)); + return db_result(db_query('SELECT COUNT(sid) AS count FROM {sessions} WHERE timestamp >= %d' . $query, $timestamp)); } /** diff --git a/includes/tablesort.inc b/includes/tablesort.inc index 9c39c5ce8..3c2068e1b 100644 --- a/includes/tablesort.inc +++ b/includes/tablesort.inc @@ -86,9 +86,9 @@ function tablesort_header($cell, $header, $ts) { } if (!empty($ts['query_string'])) { - $ts['query_string'] = '&'. $ts['query_string']; + $ts['query_string'] = '&' . $ts['query_string']; } - $cell['data'] = l($cell['data'] . $image, $_GET['q'], array('attributes' => array('title' => $title), 'query' => 'sort='. $ts['sort'] .'&order='. urlencode($cell['data']) . $ts['query_string'], 'html' => TRUE)); + $cell['data'] = l($cell['data'] . $image, $_GET['q'], array('attributes' => array('title' => $title), 'query' => 'sort=' . $ts['sort'] . '&order=' . urlencode($cell['data']) . $ts['query_string'], 'html' => TRUE)); unset($cell['field'], $cell['sort']); } diff --git a/includes/theme.inc b/includes/theme.inc index 7693a482a..8f389a0cc 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -153,14 +153,14 @@ function _init_theme($theme, $base_theme = array(), $registry_callback = '_theme // Initialize the theme. if (isset($theme->engine)) { // Include the engine. - include_once './'. $theme->owner; + include_once './' . $theme->owner; $theme_engine = $theme->engine; - if (function_exists($theme_engine .'_init')) { + if (function_exists($theme_engine . '_init')) { foreach ($base_theme as $base) { - call_user_func($theme_engine .'_init', $base); + call_user_func($theme_engine . '_init', $base); } - call_user_func($theme_engine .'_init', $theme); + call_user_func($theme_engine . '_init', $theme); } } else { @@ -168,12 +168,12 @@ function _init_theme($theme, $base_theme = array(), $registry_callback = '_theme foreach ($base_theme as $base) { // Include the theme file or the engine. if (!empty($base->owner)) { - include_once './'. $base->owner; + include_once './' . $base->owner; } } // and our theme gets one too. if (!empty($theme->owner)) { - include_once './'. $theme->owner; + include_once './' . $theme->owner; } } @@ -261,7 +261,7 @@ function drupal_rebuild_theme_registry() { * over how and when the preprocess functions are run. */ function _theme_process_registry(&$cache, $name, $type, $theme, $path) { - $function = $name .'_theme'; + $function = $name . '_theme'; if (function_exists($function)) { $result = $function($cache, $type, $theme, $path); @@ -271,7 +271,7 @@ function _theme_process_registry(&$cache, $name, $type, $theme, $path) { // if function and file are left out, default to standard naming // conventions. if (!isset($info['template']) && !isset($info['function'])) { - $result[$hook]['function'] = ($type == 'module' ? 'theme_' : $name .'_') . $hook; + $result[$hook]['function'] = ($type == 'module' ? 'theme_' : $name . '_') . $hook; } // If a path is set in the info, use what was set. Otherwise use the // default path. This is mostly so system.module can declare theme @@ -279,15 +279,15 @@ function _theme_process_registry(&$cache, $name, $type, $theme, $path) { // All files are included to be safe. Conditionally included // files can prevent them from getting registered. if (isset($info['file']) && !isset($info['path'])) { - $result[$hook]['file'] = $path .'/'. $info['file']; + $result[$hook]['file'] = $path . '/' . $info['file']; include_once($result[$hook]['file']); } elseif (isset($info['file']) && isset($info['path'])) { - include_once($info['path'] .'/'. $info['file']); + include_once($info['path'] . '/' . $info['file']); } if (isset($info['template']) && !isset($info['path'])) { - $result[$hook]['template'] = $path .'/'. $info['template']; + $result[$hook]['template'] = $path . '/' . $info['template']; } // If 'arguments' have been defined previously, carry them forward. // This should happen if a theme overrides a Drupal defined theme @@ -316,7 +316,7 @@ function _theme_process_registry(&$cache, $name, $type, $theme, $path) { } elseif ($type == 'theme_engine') { // Theme engines get an extra set that come before the normally named preprocessors. - $prefixes[] = $name .'_engine'; + $prefixes[] = $name . '_engine'; // The theme engine also registers on behalf of the theme. The theme or engine name can be used. $prefixes[] = $name; $prefixes[] = $theme; @@ -327,11 +327,11 @@ function _theme_process_registry(&$cache, $name, $type, $theme, $path) { } foreach ($prefixes as $prefix) { - if (function_exists($prefix .'_preprocess')) { - $info['preprocess functions'][] = $prefix .'_preprocess'; + if (function_exists($prefix . '_preprocess')) { + $info['preprocess functions'][] = $prefix . '_preprocess'; } - if (function_exists($prefix .'_preprocess_'. $hook)) { - $info['preprocess functions'][] = $prefix .'_preprocess_'. $hook; + if (function_exists($prefix . '_preprocess_' . $hook)) { + $info['preprocess functions'][] = $prefix . '_preprocess_' . $hook; } } } @@ -582,7 +582,7 @@ function theme() { if (!empty($info['file'])) { $include_file = $info['file']; if (isset($info['path'])) { - $include_file = $info['path'] .'/'. $include_file; + $include_file = $info['path'] . '/' . $include_file; } include_once($include_file); } @@ -613,10 +613,10 @@ function theme() { // If theme or theme engine is implementing this, it may have // a different extension and a different renderer. if ($info['type'] != 'module') { - if (function_exists($theme_engine .'_render_template')) { - $render_function = $theme_engine .'_render_template'; + if (function_exists($theme_engine . '_render_template')) { + $render_function = $theme_engine . '_render_template'; } - $extension_function = $theme_engine .'_extension'; + $extension_function = $theme_engine . '_extension'; if (function_exists($extension_function)) { $extension = $extension_function(); } @@ -654,7 +654,7 @@ function theme() { if (empty($template_file)) { $template_file = $info['template'] . $extension; if (isset($info['path'])) { - $template_file = $info['path'] .'/'. $template_file; + $template_file = $info['path'] . '/' . $template_file; } } $output = $render_function($template_file, $variables); @@ -678,7 +678,7 @@ function drupal_discover_template($paths, $suggestions, $extension = '.tpl.php') foreach ($suggestions as $suggestion) { if (!empty($suggestion)) { foreach ($paths as $path) { - if (file_exists($file = $path .'/'. $suggestion . $extension)) { + if (file_exists($file = $path . '/' . $suggestion . $extension)) { return $file; } } @@ -718,10 +718,10 @@ function drupal_find_theme_functions($cache, $prefixes) { foreach ($cache as $hook => $info) { foreach ($prefixes as $prefix) { if (!empty($info['pattern'])) { - $matches = preg_grep('/^'. $prefix .'_'. $info['pattern'] .'/', $functions['user']); + $matches = preg_grep('/^' . $prefix . '_' . $info['pattern'] . '/', $functions['user']); if ($matches) { foreach ($matches as $match) { - $new_hook = str_replace($prefix .'_', '', $match); + $new_hook = str_replace($prefix . '_', '', $match); $templates[$new_hook] = array( 'function' => $match, 'arguments' => $info['arguments'], @@ -729,9 +729,9 @@ function drupal_find_theme_functions($cache, $prefixes) { } } } - if (function_exists($prefix .'_'. $hook)) { + if (function_exists($prefix . '_' . $hook)) { $templates[$hook] = array( - 'function' => $prefix .'_'. $hook, + 'function' => $prefix . '_' . $hook, ); } } @@ -774,7 +774,7 @@ function drupal_find_theme_templates($cache, $extension, $path) { $subtheme_paths = isset($theme_paths[$theme]) ? $theme_paths[$theme] : array(); // Escape the periods in the extension. - $regex = str_replace('.', '\.', $extension) .'$'; + $regex = str_replace('.', '\.', $extension) . '$'; // Because drupal_system_listing works the way it does, we check for real // templates separately from checking for patterns. $files = drupal_system_listing($regex, $path, 'name', 0); @@ -808,7 +808,7 @@ function drupal_find_theme_templates($cache, $extension, $path) { // for the purposes of searching. $pattern = strtr($info['pattern'], '_', '-'); - $matches = preg_grep('/^'. $pattern .'/', $patterns); + $matches = preg_grep('/^' . $pattern . '/', $patterns); if ($matches) { foreach ($matches as $match) { $file = substr($match, 0, strpos($match, '.')); @@ -865,13 +865,13 @@ function theme_get_settings($key = NULL) { if (module_exists('node')) { foreach (node_get_types() as $type => $name) { - $defaults['toggle_node_info_'. $type] = 1; + $defaults['toggle_node_info_' . $type] = 1; } } $settings = array_merge($defaults, variable_get('theme_settings', array())); if ($key) { - $settings = array_merge($settings, variable_get(str_replace('/', '_', 'theme_'. $key .'_settings'), array())); + $settings = array_merge($settings, variable_get(str_replace('/', '_', 'theme_' . $key . '_settings'), array())); } // Only offer search box if search.module is enabled. @@ -918,7 +918,7 @@ function theme_get_setting($setting_name, $refresh = FALSE) { if ($settings['toggle_logo']) { if ($settings['default_logo']) { - $settings['logo'] = base_path() . dirname($theme_object->filename) .'/logo.png'; + $settings['logo'] = base_path() . dirname($theme_object->filename) . '/logo.png'; } elseif ($settings['logo_path']) { $settings['logo'] = base_path() . $settings['logo_path']; @@ -927,11 +927,11 @@ function theme_get_setting($setting_name, $refresh = FALSE) { if ($settings['toggle_favicon']) { if ($settings['default_favicon']) { - if (file_exists($favicon = dirname($theme_object->filename) .'/favicon.ico')) { + if (file_exists($favicon = dirname($theme_object->filename) . '/favicon.ico')) { $settings['favicon'] = base_path() . $favicon; } else { - $settings['favicon'] = base_path() .'misc/favicon.ico'; + $settings['favicon'] = base_path() . 'misc/favicon.ico'; } } elseif ($settings['favicon_path']) { @@ -1042,7 +1042,7 @@ function theme_render_template($file, $variables) { * The formatted text (html). */ function theme_placeholder($text) { - return ''. check_plain($text) .''; + return '' . check_plain($text) . ''; } /** @@ -1062,7 +1062,7 @@ function theme_status_messages($display = NULL) { if (count($messages) > 1) { $output .= "
      \n"; foreach ($messages as $message) { - $output .= '
    • '. $message ."
    • \n"; + $output .= '
    • ' . $message . "
    • \n"; } $output .= "
    \n"; } @@ -1088,7 +1088,7 @@ function theme_links($links, $attributes = array('class' => 'links')) { $output = ''; if (count($links) > 0) { - $output = ''; + $output = ''; $num_links = count($links); $i = 1; @@ -1106,7 +1106,7 @@ function theme_links($links, $attributes = array('class' => 'links')) { if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '' && drupal_is_front_page()))) { $class .= ' active'; } - $output .= '
  • '; + $output .= '
  • '; if (isset($link['href'])) { // Pass in $link as $options, they share the same keys. @@ -1121,7 +1121,7 @@ function theme_links($links, $attributes = array('class' => 'links')) { if (isset($link['attributes'])) { $span_attributes = drupal_attributes($link['attributes']); } - $output .= ''. $link['title'] .''; + $output .= '' . $link['title'] . ''; } $i++; @@ -1154,7 +1154,7 @@ function theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize if (!$getsize || (is_file($path) && (list($width, $height, $type, $image_attributes) = @getimagesize($path)))) { $attributes = drupal_attributes($attributes); $url = (url($path) == $path) ? $path : (base_path() . $path); - return ''. check_plain($alt) .''; + return '' . check_plain($alt) . ''; } } @@ -1167,7 +1167,7 @@ function theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize */ function theme_breadcrumb($breadcrumb) { if (!empty($breadcrumb)) { - return ''; + return ''; } } @@ -1178,7 +1178,7 @@ function theme_breadcrumb($breadcrumb) { */ function theme_help() { if ($help = menu_get_active_help()) { - return '
    '. $help .'
    '; + return '
    ' . $help . '
    '; } } @@ -1189,7 +1189,7 @@ function theme_help() { * An array of links. */ function theme_submenu($links) { - return ''; + return ''; } /** @@ -1242,13 +1242,13 @@ function theme_table($header, $rows, $attributes = array(), $caption = NULL) { drupal_add_js('misc/tableheader.js'); // Add 'sticky-enabled' class to the table to identify it for JS. // This is needed to target tables constructed by this function. - $attributes['class'] = empty($attributes['class']) ? 'sticky-enabled' : ($attributes['class'] .' sticky-enabled'); + $attributes['class'] = empty($attributes['class']) ? 'sticky-enabled' : ($attributes['class'] . ' sticky-enabled'); } - $output = '\n"; + $output = '\n"; if (isset($caption)) { - $output .= ''. $caption ."\n"; + $output .= '' . $caption . "\n"; } // Format the table header: @@ -1294,14 +1294,14 @@ function theme_table($header, $rows, $attributes = array(), $caption = NULL) { // Add odd/even class $class = $flip[$class]; if (isset($attributes['class'])) { - $attributes['class'] .= ' '. $class; + $attributes['class'] .= ' ' . $class; } else { $attributes['class'] = $class; } // Build row - $output .= ' '; + $output .= ' '; $i = 0; foreach ($cells as $cell) { $cell = tablesort_cell($cell, $header, $ts, $i++); @@ -1356,7 +1356,7 @@ function theme_tablesort_indicator($style) { * A string containing the box output. */ function theme_box($title, $content, $region = 'main') { - $output = '

    '. $title .'

    '. $content .'
    '; + $output = '

    ' . $title . '

    ' . $content . '
    '; return $output; } @@ -1374,10 +1374,10 @@ function theme_mark($type = MARK_NEW) { global $user; if ($user->uid) { if ($type == MARK_NEW) { - return ' '. t('new') .''; + return ' ' . t('new') . ''; } else if ($type == MARK_UPDATED) { - return ' '. t('updated') .''; + return ' ' . t('updated') . ''; } } } @@ -1403,11 +1403,11 @@ function theme_mark($type = MARK_NEW) { function theme_item_list($items = array(), $title = NULL, $type = 'ul', $attributes = NULL) { $output = '
    '; if (isset($title)) { - $output .= '

    '. $title .'

    '; + $output .= '

    ' . $title . '

    '; } if (!empty($items)) { - $output .= "<$type". drupal_attributes($attributes) .'>'; + $output .= "<$type" . drupal_attributes($attributes) . '>'; $num_items = count($items); foreach ($items as $i => $item) { $attributes = array(); @@ -1432,12 +1432,12 @@ function theme_item_list($items = array(), $title = NULL, $type = 'ul', $attribu $data .= theme_item_list($children, NULL, $type, $attributes); // Render nested list } if ($i == 0) { - $attributes['class'] = empty($attributes['class']) ? 'first' : ($attributes['class'] .' first'); + $attributes['class'] = empty($attributes['class']) ? 'first' : ($attributes['class'] . ' first'); } if ($i == $num_items - 1) { - $attributes['class'] = empty($attributes['class']) ? 'last' : ($attributes['class'] .' last'); + $attributes['class'] = empty($attributes['class']) ? 'last' : ($attributes['class'] . ' last'); } - $output .= ''. $data ."
  • \n"; + $output .= '' . $data . "\n"; } $output .= ""; } @@ -1449,7 +1449,7 @@ function theme_item_list($items = array(), $title = NULL, $type = 'ul', $attribu * Returns code that emits the 'more help'-link. */ function theme_more_help_link($url) { - return ''; + return ''; } /** @@ -1463,7 +1463,7 @@ function theme_more_help_link($url) { */ function theme_xml_icon($url) { if ($image = theme('image', 'misc/xml.png', t('XML feed'), t('XML feed'))) { - return ''. $image .''; + return '' . $image . ''; } } @@ -1477,7 +1477,7 @@ function theme_xml_icon($url) { */ function theme_feed_icon($url, $title) { if ($image = theme('image', 'misc/feed.png', t('Syndicate content'), $title)) { - return ''. $image .''; + return '' . $image . ''; } } @@ -1490,7 +1490,7 @@ function theme_feed_icon($url, $title) { * A descriptive verb for the link, like 'Read more' */ function theme_more_link($url, $title) { - return ''; + return ''; } /** @@ -1545,14 +1545,14 @@ function theme_username($object) { if ($object->uid && $object->name) { // Shorten the name when it is too long or it will break many tables. if (drupal_strlen($object->name) > 20) { - $name = drupal_substr($object->name, 0, 15) .'...'; + $name = drupal_substr($object->name, 0, 15) . '...'; } else { $name = $object->name; } if (user_access('access user profiles')) { - $output = l($name, 'user/'. $object->uid, array('title' => t('View user profile.'))); + $output = l($name, 'user/' . $object->uid, array('title' => t('View user profile.'))); } else { $output = check_plain($name); @@ -1570,7 +1570,7 @@ function theme_username($object) { $output = check_plain($object->name); } - $output .= ' ('. t('not verified') .')'; + $output .= ' (' . t('not verified') . ')'; } else { $output = variable_get('anonymous', t('Anonymous')); @@ -1591,9 +1591,9 @@ function theme_username($object) { */ function theme_progress_bar($percent, $message) { $output = '
    '; - $output .= '
    '; - $output .= '
    '. $percent .'%
    '; - $output .= '
    '. $message .'
    '; + $output .= '
    '; + $output .= '
    ' . $percent . '%
    '; + $output .= '
    ' . $message . '
    '; $output .= '
    '; return $output; @@ -1702,7 +1702,7 @@ function template_preprocess(&$variables, $hook) { function template_preprocess_page(&$variables) { // Add favicon if (theme_get_setting('toggle_favicon')) { - drupal_set_html_head(''); + drupal_set_html_head(''); } global $theme; @@ -1786,10 +1786,10 @@ function template_preprocess_page(&$variables) { // type (e.g. node, admin, user, etc.). To avoid illegal characters in the class, // we're removing everything disallowed. We are not using 'a-z' as that might leave // in certain international characters (e.g. German umlauts). - $body_classes[] = preg_replace('![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s', '', 'page-'. form_clean_id(drupal_strtolower(arg(0)))); + $body_classes[] = preg_replace('![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s', '', 'page-' . form_clean_id(drupal_strtolower(arg(0)))); // If on an individual node page, add the node type. if (isset($variables['node']) && $variables['node']->type) { - $body_classes[] = 'node-type-'. form_clean_id($variables['node']->type); + $body_classes[] = 'node-type-' . form_clean_id($variables['node']->type); } // Add information about the number of sidebars. if ($variables['layout'] == 'both') { @@ -1799,7 +1799,7 @@ function template_preprocess_page(&$variables) { $body_classes[] = 'no-sidebars'; } else { - $body_classes[] = 'one-sidebar sidebar-'. $variables['layout']; + $body_classes[] = 'one-sidebar sidebar-' . $variables['layout']; } // Implode with spaces. $variables['body_classes'] = implode(' ', $body_classes); @@ -1818,9 +1818,9 @@ function template_preprocess_page(&$variables) { $suggestion = 'page'; $suggestions = array(); while ($arg = arg($i++)) { - $suggestions[] = $suggestion .'-'. $arg; + $suggestions[] = $suggestion . '-' . $arg; if (!is_numeric($arg)) { - $suggestion .= '-'. $arg; + $suggestion .= '-' . $arg; } } if (drupal_is_front_page()) { @@ -1868,7 +1868,7 @@ function template_preprocess_node(&$variables) { $variables['date'] = format_date($node->created); $variables['links'] = !empty($node->links) ? theme('links', $node->links, array('class' => 'links inline')) : ''; $variables['name'] = theme('username', $node); - $variables['node_url'] = url('node/'. $node->nid); + $variables['node_url'] = url('node/' . $node->nid); $variables['terms'] = theme('links', $variables['taxonomy'], array('class' => 'links inline')); $variables['title'] = check_plain($node->title); @@ -1876,7 +1876,7 @@ function template_preprocess_node(&$variables) { $variables = array_merge((array)$node, $variables); // Display info only on certain node types. - if (theme_get_setting('toggle_node_info_'. $node->type)) { + if (theme_get_setting('toggle_node_info_' . $node->type)) { $variables['submitted'] = theme('node_submitted', $node); $variables['picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', $node) : ''; } @@ -1885,7 +1885,7 @@ function template_preprocess_node(&$variables) { $variables['picture'] = ''; } // Clean up name so there are no underscores. - $variables['template_files'][] = 'node-'. $node->type; + $variables['template_files'][] = 'node-' . $node->type; } /** @@ -1915,8 +1915,8 @@ function template_preprocess_block(&$variables) { $variables['block_zebra'] = ($block_counter[$variables['block']->region] % 2) ? 'odd' : 'even'; $variables['block_id'] = $block_counter[$variables['block']->region]++; - $variables['template_files'][] = 'block-'. $variables['block']->region; - $variables['template_files'][] = 'block-'. $variables['block']->module; - $variables['template_files'][] = 'block-'. $variables['block']->module .'-'. $variables['block']->delta; + $variables['template_files'][] = 'block-' . $variables['block']->region; + $variables['template_files'][] = 'block-' . $variables['block']->module; + $variables['template_files'][] = 'block-' . $variables['block']->module . '-' . $variables['block']->delta; } diff --git a/includes/theme.maintenance.inc b/includes/theme.maintenance.inc index 9a99e833e..965eed450 100644 --- a/includes/theme.maintenance.inc +++ b/includes/theme.maintenance.inc @@ -62,10 +62,10 @@ function _drupal_maintenance_theme() { // These are usually added from system_init() -except maintenance.css. // When the database is inactive it's not called so we add it here. - drupal_add_css(drupal_get_path('module', 'system') .'/defaults.css', 'module'); - drupal_add_css(drupal_get_path('module', 'system') .'/system.css', 'module'); - drupal_add_css(drupal_get_path('module', 'system') .'/system-menus.css', 'module'); - drupal_add_css(drupal_get_path('module', 'system') .'/maintenance.css', 'module'); + drupal_add_css(drupal_get_path('module', 'system') . '/defaults.css', 'module'); + drupal_add_css(drupal_get_path('module', 'system') . '/system.css', 'module'); + drupal_add_css(drupal_get_path('module', 'system') . '/system-menus.css', 'module'); + drupal_add_css(drupal_get_path('module', 'system') . '/maintenance.css', 'module'); } /** @@ -92,7 +92,7 @@ function theme_task_list($items, $active = NULL) { else { $class = $done ? 'done' : ''; } - $output .= '
  • '. $item .'
  • '; + $output .= '
  • ' . $item . '
  • '; } $output .= ''; return $output; @@ -120,22 +120,22 @@ function theme_install_page($content) { $messages = drupal_set_message(); if (isset($messages['error'])) { $title = count($messages['error']) > 1 ? st('The following errors must be resolved before you can continue the installation process') : st('The following error must be resolved before you can continue the installation process'); - $variables['messages'] .= '

    '. $title .':

    '; + $variables['messages'] .= '

    ' . $title . ':

    '; $variables['messages'] .= theme('status_messages', 'error'); - $variables['content'] .= '

    '. st('Please check the error messages and try again.', array('!url' => request_uri())) .'

    '; + $variables['content'] .= '

    ' . st('Please check the error messages and try again.', array('!url' => request_uri())) . '

    '; } // Special handling of warning messages if (isset($messages['warning'])) { $title = count($messages['warning']) > 1 ? st('The following installation warnings should be carefully reviewed') : st('The following installation warning should be carefully reviewed'); - $variables['messages'] .= '

    '. $title .':

    '; + $variables['messages'] .= '

    ' . $title . ':

    '; $variables['messages'] .= theme('status_messages', 'warning'); } // Special handling of status messages if (isset($messages['status'])) { $title = count($messages['status']) > 1 ? st('The following installation warnings should be carefully reviewed, but in most cases may be safely ignored') : st('The following installation warning should be carefully reviewed, but in most cases may be safely ignored'); - $variables['messages'] .= '

    '. $title .':

    '; + $variables['messages'] .= '

    ' . $title . ':

    '; $variables['messages'] .= theme('status_messages', 'status'); } @@ -173,7 +173,7 @@ function theme_update_page($content, $show_messages = TRUE) { $messages = drupal_set_message(); if (isset($messages['warning'])) { $title = count($messages['warning']) > 1 ? 'The following update warnings should be carefully reviewed before continuing' : 'The following update warning should be carefully reviewed before continuing'; - $variables['messages'] .= '

    '. $title .':

    '; + $variables['messages'] .= '

    ' . $title . ':

    '; $variables['messages'] .= theme('status_messages', 'warning'); } @@ -205,7 +205,7 @@ function theme_update_page($content, $show_messages = TRUE) { function template_preprocess_maintenance_page(&$variables) { // Add favicon if (theme_get_setting('toggle_favicon')) { - drupal_set_html_head(''); + drupal_set_html_head(''); } global $theme; @@ -276,7 +276,7 @@ function template_preprocess_maintenance_page(&$variables) { $body_classes[] = 'no-sidebars'; } else { - $body_classes[] = 'one-sidebar sidebar-'. $variables['layout']; + $body_classes[] = 'one-sidebar sidebar-' . $variables['layout']; } $variables['body_classes'] = implode(' ', $body_classes); diff --git a/includes/unicode.inc b/includes/unicode.inc index 19c74422b..cb3b0a8fc 100644 --- a/includes/unicode.inc +++ b/includes/unicode.inc @@ -178,7 +178,7 @@ function drupal_convert_to_utf8($data, $encoding) { $out = @mb_convert_encoding($data, 'utf-8', $encoding); } else if (function_exists('recode_string')) { - $out = @recode_string($encoding .'..utf-8', $data); + $out = @recode_string($encoding . '..utf-8', $data); } else { watchdog('php', 'Unsupported encoding %s. Please install iconv, GNU recode or mbstring for PHP.', array('%s' => $encoding), WATCHDOG_ERROR); @@ -283,7 +283,7 @@ function mime_header_encode($string) { $output = ''; while ($len > 0) { $chunk = drupal_truncate_bytes($string, $chunk_size); - $output .= ' =?UTF-8?B?'. base64_encode($chunk) ."?=\n"; + $output .= ' =?UTF-8?B?' . base64_encode($chunk) . "?=\n"; $c = strlen($chunk); $string = substr($string, $c); $len -= $c; diff --git a/includes/xmlrpc.inc b/includes/xmlrpc.inc index c7751e1c1..569871b8f 100644 --- a/includes/xmlrpc.inc +++ b/includes/xmlrpc.inc @@ -90,32 +90,32 @@ function xmlrpc_value_calculate_type(&$xmlrpc_value) { function xmlrpc_value_get_xml($xmlrpc_value) { switch ($xmlrpc_value->type) { case 'boolean': - return ''. (($xmlrpc_value->data) ? '1' : '0') .''; + return '' . (($xmlrpc_value->data) ? '1' : '0') . ''; break; case 'int': - return ''. $xmlrpc_value->data .''; + return '' . $xmlrpc_value->data . ''; break; case 'double': - return ''. $xmlrpc_value->data .''; + return '' . $xmlrpc_value->data . ''; break; case 'string': // Note: we don't escape apostrophes because of the many blogging clients // that don't support numerical entities (and XML in general) properly. - return ''. htmlspecialchars($xmlrpc_value->data) .''; + return '' . htmlspecialchars($xmlrpc_value->data) . ''; break; case 'array': - $return = ''."\n"; + $return = '' . "\n"; foreach ($xmlrpc_value->data as $item) { - $return .= ' '. xmlrpc_value_get_xml($item) ."\n"; + $return .= ' ' . xmlrpc_value_get_xml($item) . "\n"; } $return .= ''; return $return; break; case 'struct': - $return = ''."\n"; + $return = '' . "\n"; foreach ($xmlrpc_value->data as $name => $value) { - $return .= " ". check_plain($name) .""; - $return .= xmlrpc_value_get_xml($value) ."\n"; + $return .= " " . check_plain($name) . ""; + $return .= xmlrpc_value_get_xml($value) . "\n"; } $return .= ''; return $return; @@ -158,7 +158,7 @@ function xmlrpc_message($message) { */ function xmlrpc_message_parse(&$xmlrpc_message) { // First remove the XML declaration - $xmlrpc_message->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $xmlrpc_message->message); + $xmlrpc_message->message = preg_replace('/<\?xml(.*)?\?' . '>/', '', $xmlrpc_message->message); if (trim($xmlrpc_message->message) == '') { return FALSE; } @@ -403,7 +403,7 @@ function xmlrpc_date($time) { } function xmlrpc_date_get_xml($xmlrpc_date) { - return ''. $xmlrpc_date->year . $xmlrpc_date->month . $xmlrpc_date->day .'T'. $xmlrpc_date->hour .':'. $xmlrpc_date->minute .':'. $xmlrpc_date->second .''; + return '' . $xmlrpc_date->year . $xmlrpc_date->month . $xmlrpc_date->day . 'T' . $xmlrpc_date->hour . ':' . $xmlrpc_date->minute . ':' . $xmlrpc_date->second . ''; } function xmlrpc_base64($data) { @@ -414,7 +414,7 @@ function xmlrpc_base64($data) { } function xmlrpc_base64_get_xml($xmlrpc_base64) { - return ''. base64_encode($xmlrpc_base64->data) .''; + return '' . base64_encode($xmlrpc_base64->data) . ''; } /** diff --git a/includes/xmlrpcs.inc b/includes/xmlrpcs.inc index 11744a98e..33e5bb209 100644 --- a/includes/xmlrpcs.inc +++ b/includes/xmlrpcs.inc @@ -77,9 +77,9 @@ function xmlrpc_server($callbacks) { - '. + ' . xmlrpc_value_get_xml($r) - .' + . ' @@ -105,11 +105,11 @@ function xmlrpc_server_error($error, $message = FALSE) { } function xmlrpc_server_output($xml) { - $xml = ''."\n". $xml; + $xml = '' . "\n" . $xml; header('Connection: close'); - header('Content-Length: '. strlen($xml)); + header('Content-Length: ' . strlen($xml)); header('Content-Type: text/xml'); - header('Date: '. date('r')); + header('Date: ' . date('r')); echo $xml; exit; } -- cgit v1.2.3