Commit 2db2c039 authored by Dries's avatar Dries

- Patch #172950 by webernet: code style fixes.

parent 95799751
......@@ -226,7 +226,7 @@ function _batch_process() {
'@percentage' => $percentage,
);
$message = strtr($progress_message, $values) .'<br/>';
$message.= $task_message ? $task_message : '&nbsp';
$message .= $task_message ? $task_message : '&nbsp';
return array($percentage, $message);
}
......@@ -272,7 +272,7 @@ function _batch_finished() {
$batch =& batch_get();
// Execute the 'finished' callbacks.
foreach($batch['sets'] as $key => $batch_set) {
foreach ($batch['sets'] as $key => $batch_set) {
if (isset($batch_set['finished']) && function_exists($batch_set['finished'])) {
$batch_set['finished']($batch_set['success'], $batch_set['results'], $batch_set['operations']);
}
......
......@@ -490,7 +490,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';
}
/**
......
......@@ -406,7 +406,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);
}
......@@ -482,4 +482,4 @@ function db_last_insert_id($table, $field) {
/**
* @} End of "ingroup schemaapi".
*/
\ No newline at end of file
*/
......@@ -245,7 +245,7 @@ function db_error() {
* The name of the autoincrement field.
*/
function db_last_insert_id($table, $field) {
return db_result(db_query("SELECT currval('%s_seq')", db_prefix_tables('{'. $table .'}') . '_'. $field));
return db_result(db_query("SELECT currval('%s_seq')", db_prefix_tables('{'. $table .'}') .'_'. $field));
}
/**
......
......@@ -846,7 +846,7 @@ function _form_builder_handle_input_element($form_id, &$form, &$form_state) {
$form['#value'] = $function($form);
}
// Final catch. If we haven't set a value yet, use the explicit default value.
if(!isset($form['#value'])) {
if (!isset($form['#value'])) {
$form['#value'] = isset($form['#default_value']) ? $form['#default_value'] : '';
}
}
......@@ -1711,12 +1711,12 @@ function theme_image_button($element) {
$element['#attributes']['class'] = 'form-'. $element['#button_type'];
}
return '<input type="image" name="'. $element['#name'] .'" ' .
return '<input type="image" name="'. $element['#name'] .'" '.
(!empty($element['#value']) ? ('value="'. check_plain($element['#value']) .'" ') : '') .
'id="' . $element['#id'] . '" ' .
'id="'. $element['#id'] .'" '.
drupal_attributes($element['#attributes']) .
' src="' . base_path() . $element['#src'] . '" ' .
(!empty($element['#title']) ? 'alt="' . check_plain($element['#title']) . '" title="' . check_plain($element['#title']) . '" ' : '' ).
' src="'. base_path() . $element['#src'] .'" '.
(!empty($element['#title']) ? 'alt="'. check_plain($element['#title']) .'" title="'. check_plain($element['#title']) .'" ' : '' ) .
"/>\n";
}
......
......@@ -360,7 +360,7 @@ function drupal_uninstall_module($module) {
if (!empty($paths)) {
$paths = array_keys($paths);
// Clean out the names of load functions.
foreach($paths as $index => $path) {
foreach ($paths as $index => $path) {
$parts = explode('/', $path, MENU_MAX_PARTS);
foreach ($parts as $k => $part) {
if (preg_match('/^%[a-z_]*$/', $part)) {
......
......@@ -81,7 +81,7 @@ function theme_locale_languages_overview_form($form) {
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) : '')
);
}
}
......@@ -493,7 +493,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%)');
}
}
......@@ -2449,7 +2449,7 @@ function _locale_batch_build($files, $finished = NULL) {
$t = get_t();
if (count($files)) {
$operations = array();
foreach($files as $file) {
foreach ($files as $file) {
// We call _locale_batch_import for every batch operation.
$operations[] = array('_locale_batch_import', array($file->filename)); }
$batch = array(
......
......@@ -173,7 +173,7 @@ 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 {
......@@ -436,7 +436,7 @@ function _drupal_html_to_mail_urls($match = NULL) {
$regexp = '@^'. preg_quote($base_path, '@') .'@';
}
if ($match) {
list(,, $url, $label) = $match;
list(, , $url, $label) = $match;
// Ensure all URLs are absolute.
$urls[] = strpos($url, '://') ? $url : preg_replace($regexp, $base_url .'/', $url);
return $label .' ['. count($urls) .']';
......
......@@ -1023,7 +1023,7 @@ function menu_secondary_links() {
*/
function menu_navigation_links($menu_name, $level = 0) {
// Don't even bother querying the menu table if no menu is specified.
if (empty($menu_name)){
if (empty($menu_name)) {
return array();
}
......
......@@ -296,7 +296,7 @@ function module_disable($module_list) {
module_implements('', FALSE, TRUE);
}
// If there remains no more node_access module, rebuilding will be
// If there remains no more node_access module, rebuilding will be
// straightforward, we can do it right now.
if (node_access_needs_rebuild() && count(module_implements('node_grants')) == 0) {
node_access_rebuild();
......
......@@ -658,7 +658,7 @@ function drupal_find_theme_functions($cache, $prefixes) {
$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'],
......@@ -692,7 +692,7 @@ function drupal_find_theme_templates($cache, $extension, $path) {
$templates = array();
// Escape the dots 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.
......@@ -1731,7 +1731,7 @@ 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);
......@@ -1766,9 +1766,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()) {
......@@ -1824,7 +1824,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) : '';
}
......@@ -1863,8 +1863,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;
}
......@@ -430,7 +430,7 @@ function _xmlrpc() {
$method = 'system.multicall';
$multicall_args = array();
foreach ($args[0] as $call) {
$multicall_args[] = array('methodName' => array_shift($call),'params' => $call);
$multicall_args[] = array('methodName' => array_shift($call), 'params' => $call);
}
$args = array($multicall_args);
}
......
......@@ -109,7 +109,7 @@ function xmlrpc_server_output($xml) {
header('Connection: close');
header('Content-Length: '. strlen($xml));
header('Content-Type: text/xml');
header('Date: '.date('r'));
header('Date: '. date('r'));
echo $xml;
exit;
}
......@@ -315,4 +315,4 @@ function xmlrpc_server_method_signature($methodname) {
function xmlrpc_server_method_help($method) {
$xmlrpc_server = xmlrpc_server_get();
return $xmlrpc_server->help[$method];
}
\ No newline at end of file
}
......@@ -514,16 +514,16 @@ function install_select_locale($profilename) {
install_task_list('locale-select');
drupal_set_title(st('Choose language'));
if (!empty($_GET['localize'])) {
$output = '<p>'. st('With the addition of an appropriate language pack, this installer is capable of proceeding in another language of your choice. To install and use Drupal in a language other than English:') . '</p>';
$output = '<p>'. st('With the addition of an appropriate language pack, this installer is capable of proceeding in another language of your choice. To install and use Drupal in a language other than English:') .'</p>';
$output .= '<ul><li>'. st('Determine if <a href="@translations" target="_blank">a translation of this Drupal version</a> is available in your language of choice. A translation is provided via a translation pack; each translation pack enables the display of a specific version of Drupal in a specific language. Not all languages are available for every version of Drupal.', array('@translations' => 'http://drupal.org/project/Translations')) .'</li>';
$output .= '<li>'. st('If an alternative language pack of your choice is available, download and extract its contents to your Drupal root directory.') .'</li>';
$output .= '<li>'. st('Return to choose language using the second link below and select your desired language from the displayed list. Reloading the page allows the list to automatically adjust to the presence of new language packs.') .'</li>';
$output .= '</ul><p>' . st('Alternatively, to install and use Drupal in English, or to defer the selection of an alternative language until after installation, select the first link below.') .'</p>';
$output .= '<p>' . st('How should the installation continue?') .'</p>';
$output .= '<ul><li><a href="install.php?profile='. $profilename . '&amp;locale=en">'. st('Continue installation in English') .'</a></li><li><a href="install.php?profile='. $profilename . '">'. st('Return to choose a language') .'</a></li></ul>';
$output .= '</ul><p>'. st('Alternatively, to install and use Drupal in English, or to defer the selection of an alternative language until after installation, select the first link below.') .'</p>';
$output .= '<p>'. st('How should the installation continue?') .'</p>';
$output .= '<ul><li><a href="install.php?profile='. $profilename .'&amp;locale=en">'. st('Continue installation in English') .'</a></li><li><a href="install.php?profile='. $profilename .'">'. st('Return to choose a language') .'</a></li></ul>';
}
else {
$output = '<ul><li><a href="install.php?profile='. $profilename . '&amp;locale=en">'. st('Install Drupal in English') .'</a></li><li><a href="install.php?profile='. $profilename . '&localize=true">'. st('Learn how to install Drupal in other languages') .'</a></li></ul>';
$output = '<ul><li><a href="install.php?profile='. $profilename .'&amp;locale=en">'. st('Install Drupal in English') .'</a></li><li><a href="install.php?profile='. $profilename .'&localize=true">'. st('Learn how to install Drupal in other languages') .'</a></li></ul>';
}
print theme('install_page', $output);
exit;
......
......@@ -324,28 +324,28 @@ function comment_new_page_count($num_comments, $new_replies, $nid) {
$mode = _comment_get_display_setting('mode');
$order = _comment_get_display_setting('sort');
$pagenum = NULL;
$flat = in_array($mode, array(COMMENT_MODE_FLAT_COLLAPSED, COMMENT_MODE_FLAT_EXPANDED));
$flat = in_array($mode, array(COMMENT_MODE_FLAT_COLLAPSED, COMMENT_MODE_FLAT_EXPANDED));
if ($num_comments <= $comments_per_page || ($flat && $order == COMMENT_ORDER_NEWEST_FIRST)) {
// Only one page of comments or flat forum and newest first.
// First new comment will always be on first page.
$pageno = 0;
}
}
else {
if ($flat) {
if ($flat) {
// Flat comments and oldest first.
$count = $num_comments - $new_replies;
}
}
else {
// Threaded comments. See the documentation for comment_render().
if ($order == COMMENT_ORDER_NEWEST_FIRST) {
if ($order == COMMENT_ORDER_NEWEST_FIRST) {
// Newest first: find the last thread with new comment
$result = db_query('(SELECT thread FROM {comments} WHERE nid = %d AND status = 0 ORDER BY timestamp DESC LIMIT %d) ORDER BY thread DESC LIMIT 1', $nid, $new_replies);
$thread = db_result($result);
$result_count = db_query("SELECT COUNT(*) FROM {comments} WHERE nid = %d AND status = 0 AND thread > '" . $thread . "'", $nid);
}
else {
}
else {
// Oldest first: find the first thread with new comment
$result = db_query('(SELECT thread FROM {comments} WHERE nid = %d AND status = 0 ORDER BY timestamp DESC LIMIT %d) ORDER BY SUBSTRING(thread, 1, (LENGTH(thread) - 1)) LIMIT 1', $nid, $new_replies);
$result = db_query('(SELECT thread FROM {comments} WHERE nid = %d AND status = 0 ORDER BY timestamp DESC LIMIT %d) ORDER BY SUBSTRING(thread, 1, (LENGTH(thread) - 1)) LIMIT 1', $nid, $new_replies);
$thread = substr(db_result($result), 0, -1);
$result_count = db_query("SELECT COUNT(*) FROM {comments} WHERE nid = %d AND status = 0 AND SUBSTRING(thread, 1, (LENGTH(thread) - 1)) < '" . $thread . "'", $nid);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment