Commit 5622bce2 authored by Gábor Hojtsy's avatar Gábor Hojtsy

#198579 by webernet and hswong3i: a huge set of coding style fixes, including:

 - whitespaces at end of lines
 - indentation
 - control structure usage
 - whitespace in empty lines
 - phpdoc comment formatting
parent aaaf8f57
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
// $Id$ // $Id$
/** /**
* @file * @file
* This is the actions engine for executing stored actions. * This is the actions engine for executing stored actions.
*/ */
/** /**
* Perform a given list of actions by executing their callback functions. * Perform a given list of actions by executing their callback functions.
......
...@@ -291,7 +291,7 @@ function _batch_finished() { ...@@ -291,7 +291,7 @@ function _batch_finished() {
$batch =& batch_get(); $batch =& batch_get();
// Execute the 'finished' callbacks for each batch set. // Execute the 'finished' callbacks for each batch set.
foreach($batch['sets'] as $key => $batch_set) { foreach ($batch['sets'] as $key => $batch_set) {
if (isset($batch_set['finished'])) { if (isset($batch_set['finished'])) {
// Check if the set requires an additional file for functions definitions. // Check if the set requires an additional file for functions definitions.
if (isset($batch_set['file']) && is_file($batch_set['file'])) { if (isset($batch_set['file']) && is_file($batch_set['file'])) {
......
...@@ -521,7 +521,7 @@ function bootstrap_invoke_all($hook) { ...@@ -521,7 +521,7 @@ function bootstrap_invoke_all($hook) {
foreach (module_list(TRUE, TRUE) as $module) { foreach (module_list(TRUE, TRUE) as $module) {
drupal_load('module', $module); drupal_load('module', $module);
module_invoke($module, $hook); module_invoke($module, $hook);
} }
} }
/** /**
...@@ -786,7 +786,7 @@ function drupal_get_messages($type = NULL, $clear_queue = TRUE) { ...@@ -786,7 +786,7 @@ function drupal_get_messages($type = NULL, $clear_queue = TRUE) {
if ($messages = drupal_set_message()) { if ($messages = drupal_set_message()) {
if ($type) { if ($type) {
if ($clear_queue) { if ($clear_queue) {
unset($_SESSION['messages'][$type]); unset($_SESSION['messages'][$type]);
} }
if (isset($messages[$type])) { if (isset($messages[$type])) {
return array($type => $messages[$type]); return array($type => $messages[$type]);
...@@ -794,7 +794,7 @@ function drupal_get_messages($type = NULL, $clear_queue = TRUE) { ...@@ -794,7 +794,7 @@ function drupal_get_messages($type = NULL, $clear_queue = TRUE) {
} }
else { else {
if ($clear_queue) { if ($clear_queue) {
unset($_SESSION['messages']); unset($_SESSION['messages']);
} }
return $messages; return $messages;
} }
......
...@@ -1319,7 +1319,7 @@ function url($path = NULL, $options = array()) { ...@@ -1319,7 +1319,7 @@ function url($path = NULL, $options = array()) {
// Will be empty if there is no language prefix. // Will be empty if there is no language prefix.
$path = trim($options['prefix'], '/'); $path = trim($options['prefix'], '/');
} }
if ($clean_url) { if ($clean_url) {
// With Clean URLs. // With Clean URLs.
if ($options['query']) { if ($options['query']) {
...@@ -1337,7 +1337,7 @@ function url($path = NULL, $options = array()) { ...@@ -1337,7 +1337,7 @@ function url($path = NULL, $options = array()) {
} }
if (!empty($options['query'])) { if (!empty($options['query'])) {
$variables[] = $options['query']; $variables[] = $options['query'];
} }
if ($query = join('&', $variables)) { if ($query = join('&', $variables)) {
return $base . $script .'?'. $query . $options['fragment']; return $base . $script .'?'. $query . $options['fragment'];
} }
...@@ -1757,7 +1757,7 @@ function drupal_build_css_cache($types, $filename) { ...@@ -1757,7 +1757,7 @@ function drupal_build_css_cache($types, $filename) {
/** /**
* Helper function for drupal_build_css_cache(). * Helper function for drupal_build_css_cache().
* *
* This function will prefix all paths within a CSS file. * This function will prefix all paths within a CSS file.
*/ */
function _drupal_build_css_path($matches, $base = NULL) { function _drupal_build_css_path($matches, $base = NULL) {
...@@ -1835,7 +1835,7 @@ function drupal_load_stylesheet($file, $optimize = NULL) { ...@@ -1835,7 +1835,7 @@ function drupal_load_stylesheet($file, $optimize = NULL) {
/** /**
* Loads stylesheets recursively and returns contents with corrected paths. * Loads stylesheets recursively and returns contents with corrected paths.
* *
* This function is used for recursive loading of stylesheets and * This function is used for recursive loading of stylesheets and
* returns the stylesheet content with all url() paths corrected. * returns the stylesheet content with all url() paths corrected.
*/ */
...@@ -1914,7 +1914,7 @@ function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer ...@@ -1914,7 +1914,7 @@ function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer
static $javascript = array(); static $javascript = array();
if (isset($data)) { if (isset($data)) {
// Add jquery.js and drupal.js the first time a Javascript file is added. // Add jquery.js and drupal.js the first time a Javascript file is added.
if (empty($javascript)) { if (empty($javascript)) {
$javascript['header'] = array( $javascript['header'] = array(
...@@ -1925,7 +1925,7 @@ function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer ...@@ -1925,7 +1925,7 @@ function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer
'module' => array(), 'theme' => array(), 'setting' => array(), 'inline' => array(), 'module' => array(), 'theme' => array(), 'setting' => array(), 'inline' => array(),
); );
} }
if (isset($scope) && !isset($javascript[$scope])) { if (isset($scope) && !isset($javascript[$scope])) {
$javascript[$scope] = array('core' => array(), 'module' => array(), 'theme' => array(), 'setting' => array(), 'inline' => array()); $javascript[$scope] = array('core' => array(), 'module' => array(), 'theme' => array(), 'setting' => array(), 'inline' => array());
} }
...@@ -1933,7 +1933,7 @@ function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer ...@@ -1933,7 +1933,7 @@ function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer
if (isset($type) && isset($scope) && !isset($javascript[$scope][$type])) { if (isset($type) && isset($scope) && !isset($javascript[$scope][$type])) {
$javascript[$scope][$type] = array(); $javascript[$scope][$type] = array();
} }
switch ($type) { switch ($type) {
case 'setting': case 'setting':
$javascript[$scope][$type][] = $data; $javascript[$scope][$type][] = $data;
...@@ -1948,7 +1948,7 @@ function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer ...@@ -1948,7 +1948,7 @@ function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer
} }
if (isset($scope)) { if (isset($scope)) {
if (isset($javascript[$scope])) { if (isset($javascript[$scope])) {
return $javascript[$scope]; return $javascript[$scope];
} }
......
...@@ -514,7 +514,7 @@ function db_change_field(&$ret, $table, $field, $field_new, $spec, $keys_new = a ...@@ -514,7 +514,7 @@ function db_change_field(&$ret, $table, $field, $field_new, $spec, $keys_new = a
$sql = 'ALTER TABLE {'. $table .'} CHANGE '. $field .' '. $sql = 'ALTER TABLE {'. $table .'} CHANGE '. $field .' '.
_db_create_field_sql($field_new, _db_process_field($spec)); _db_create_field_sql($field_new, _db_process_field($spec));
if (count($keys_new)) { 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); $ret[] = update_sql($sql);
} }
......
...@@ -74,7 +74,7 @@ function db_connect($url) { ...@@ -74,7 +74,7 @@ function db_connect($url) {
// Allow for non-standard MySQL port. // Allow for non-standard MySQL port.
if (isset($url['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 // - TRUE makes mysql_connect() always open a new link, even if
......
...@@ -203,16 +203,16 @@ function db_fetch_array($result) { ...@@ -203,16 +203,16 @@ function db_fetch_array($result) {
} }
/** /**
* Return an individual result field from the previous query. * Return an individual result field from the previous query.
* *
* Only use this function if exactly one field is being selected; otherwise, * Only use this function if exactly one field is being selected; otherwise,
* use db_fetch_object() or db_fetch_array(). * use db_fetch_object() or db_fetch_array().
* *
* @param $result * @param $result
* A database query result resource, as returned from db_query(). * A database query result resource, as returned from db_query().
* @return * @return
* The resulting field or FALSE. * The resulting field or FALSE.
*/ */
function db_result($result) { function db_result($result) {
if ($result && mysqli_num_rows($result) > 0) { if ($result && mysqli_num_rows($result) > 0) {
// The mysqli_fetch_row function has an optional second parameter $row // The mysqli_fetch_row function has an optional second parameter $row
......
...@@ -415,7 +415,7 @@ function drupal_process_form($form_id, &$form, &$form_state) { ...@@ -415,7 +415,7 @@ function drupal_process_form($form_id, &$form, &$form_state) {
// however, we'll skip this and let the calling function examine // however, we'll skip this and let the calling function examine
// the resulting $form_state bundle itself. // the resulting $form_state bundle itself.
if (!$form['#programmed'] && empty($form_state['rebuild']) && empty($form_state['storage'])) { if (!$form['#programmed'] && empty($form_state['rebuild']) && empty($form_state['storage'])) {
drupal_redirect_form($form, $form_state['redirect']); drupal_redirect_form($form, $form_state['redirect']);
} }
} }
} }
...@@ -1432,7 +1432,7 @@ function theme_fieldset($element) { ...@@ -1432,7 +1432,7 @@ function theme_fieldset($element) {
$element['#attributes']['class'] .= ' collapsible'; $element['#attributes']['class'] .= ' collapsible';
if ($element['#collapsed']) { if ($element['#collapsed']) {
$element['#attributes']['class'] .= ' collapsed'; $element['#attributes']['class'] .= ' collapsed';
} }
} }
......
...@@ -35,7 +35,7 @@ function drupal_test_mysql($url, &$success) { ...@@ -35,7 +35,7 @@ function drupal_test_mysql($url, &$success) {
// Allow for non-standard MySQL port. // Allow for non-standard MySQL port.
if (isset($url['port'])) { if (isset($url['port'])) {
$url['host'] = $url['host'] .':'. $url['port']; $url['host'] = $url['host'] .':'. $url['port'];
} }
// Test connecting to the database. // Test connecting to the database.
......
...@@ -106,7 +106,7 @@ function language_url_rewrite(&$path, &$options) { ...@@ -106,7 +106,7 @@ function language_url_rewrite(&$path, &$options) {
if (!isset($options['language'])) { if (!isset($options['language'])) {
$options['language'] = $language; $options['language'] = $language;
} }
switch (variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE)) { switch (variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE)) {
case LANGUAGE_NEGOTIATION_NONE: case LANGUAGE_NEGOTIATION_NONE:
// No language dependent path allowed in this mode. // No language dependent path allowed in this mode.
......
...@@ -1792,8 +1792,8 @@ function menu_link_save(&$item) { ...@@ -1792,8 +1792,8 @@ function menu_link_save(&$item) {
} }
/** /**
* Helper function to clear the page and block caches at most twice per page load. * Helper function to clear the page and block caches at most twice per page load.
*/ */
function _menu_clear_page_cache() { function _menu_clear_page_cache() {
static $cache_cleared = 0; static $cache_cleared = 0;
...@@ -1814,8 +1814,8 @@ function _menu_clear_page_cache() { ...@@ -1814,8 +1814,8 @@ function _menu_clear_page_cache() {
} }
/** /**
* Helper function to update a list of menus with expanded items * Helper function to update a list of menus with expanded items
*/ */
function _menu_set_expanded_menus() { function _menu_set_expanded_menus() {
$names = array(); $names = array();
$result = db_query("SELECT menu_name FROM {menu_links} WHERE expanded != 0 GROUP BY menu_name"); $result = db_query("SELECT menu_name FROM {menu_links} WHERE expanded != 0 GROUP BY menu_name");
......
...@@ -1627,7 +1627,7 @@ function template_preprocess(&$variables, $hook) { ...@@ -1627,7 +1627,7 @@ function template_preprocess(&$variables, $hook) {
// Tell all templates where they are located. // Tell all templates where they are located.
$variables['directory'] = path_to_theme(); $variables['directory'] = path_to_theme();
// Set default variables that depend on the database. // Set default variables that depend on the database.
$variables['is_admin'] = FALSE; $variables['is_admin'] = FALSE;
$variables['is_front'] = FALSE; $variables['is_front'] = FALSE;
......
...@@ -78,7 +78,7 @@ function _theme_load_offline_registry($theme, $base_theme = NULL, $theme_engine ...@@ -78,7 +78,7 @@ function _theme_load_offline_registry($theme, $base_theme = NULL, $theme_engine
/** /**
* Return a themed list of maintenance tasks to perform. * Return a themed list of maintenance tasks to perform.
* *
* @ingroup themeable * @ingroup themeable
*/ */
function theme_task_list($items, $active = NULL) { function theme_task_list($items, $active = NULL) {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
Site: http://scripts.incutio.com/xmlrpc/ Site: http://scripts.incutio.com/xmlrpc/
Manual: http://scripts.incutio.com/xmlrpc/manual.php Manual: http://scripts.incutio.com/xmlrpc/manual.php
This version is made available under the GNU GPL License This version is made available under the GNU GPL License
*/ */
/** /**
* Recursively turn a data structure into objects with 'data' and 'type' attributes. * Recursively turn a data structure into objects with 'data' and 'type' attributes.
......
...@@ -55,7 +55,7 @@ function xmlrpc_server($callbacks) { ...@@ -55,7 +55,7 @@ function xmlrpc_server($callbacks) {
$data = file_get_contents('php://input'); $data = file_get_contents('php://input');
if (!$data) { if (!$data) {
die('XML-RPC server accepts POST requests only.'); die('XML-RPC server accepts POST requests only.');
} }
$xmlrpc_server->message = xmlrpc_message($data); $xmlrpc_server->message = xmlrpc_message($data);
if (!xmlrpc_message_parse($xmlrpc_server->message)) { if (!xmlrpc_message_parse($xmlrpc_server->message)) {
......
...@@ -73,7 +73,7 @@ function aggregator_schema() { ...@@ -73,7 +73,7 @@ function aggregator_schema() {
'not null' => TRUE, 'not null' => TRUE,
'default' => 0, 'default' => 0,
'description' => t('The {aggregator_category}.cid to which the feed is being assigned.'), 'description' => t('The {aggregator_category}.cid to which the feed is being assigned.'),
) )
), ),
'primary key' => array('fid', 'cid'), 'primary key' => array('fid', 'cid'),
); );
......
...@@ -577,7 +577,7 @@ function aggregator_refresh($feed) { ...@@ -577,7 +577,7 @@ function aggregator_refresh($feed) {
case 302: case 302:
case 307: case 307:
// Filter the input data: // Filter the input data:
if (aggregator_parse_feed($result->data, $feed)) { if (aggregator_parse_feed($result->data, $feed)) {
$modified = empty($result->headers['Last-Modified']) ? 0 : strtotime($result->headers['Last-Modified']); $modified = empty($result->headers['Last-Modified']) ? 0 : strtotime($result->headers['Last-Modified']);
......
...@@ -39,21 +39,21 @@ ...@@ -39,21 +39,21 @@
define('BLOCK_NO_CACHE', -1); define('BLOCK_NO_CACHE', -1);
/** /**
* The block can change depending on the roles the user viewing the page belongs to. * The block can change depending on the roles the user viewing the page belongs to.
* This is the default setting, used when the block does not specify anything. * This is the default setting, used when the block does not specify anything.
*/ */
define('BLOCK_CACHE_PER_ROLE', 0x0001); define('BLOCK_CACHE_PER_ROLE', 0x0001);
/** /**
* The block can change depending on the user viewing the page. * The block can change depending on the user viewing the page.
* This setting can be resource-consuming for sites with large number of users, * This setting can be resource-consuming for sites with large number of users,
* and thus should only be used when BLOCK_CACHE_PER_ROLE is not sufficient. * and thus should only be used when BLOCK_CACHE_PER_ROLE is not sufficient.
*/ */
define('BLOCK_CACHE_PER_USER', 0x0002); define('BLOCK_CACHE_PER_USER', 0x0002);
/** /**
* The block can change depending on the page being viewed. * The block can change depending on the page being viewed.
*/ */
define('BLOCK_CACHE_PER_PAGE', 0x0004); define('BLOCK_CACHE_PER_PAGE', 0x0004);
/** /**
......
...@@ -231,7 +231,7 @@ function theme_book_admin_table($form) { ...@@ -231,7 +231,7 @@ function theme_book_admin_table($form) {
*/ */
function _book_admin_sort_tree(&$tree) { function _book_admin_sort_tree(&$tree) {
uasort($tree, '_book_admin_compare'); uasort($tree, '_book_admin_compare');
foreach($tree as $key => $subtree) { foreach ($tree as $key => $subtree) {
if (!empty($tree[$key]['below'])) { if (!empty($tree[$key]['below'])) {
_book_admin_sort_tree($tree[$key]['below']); _book_admin_sort_tree($tree[$key]['below']);
} }
......
...@@ -159,44 +159,44 @@ function comment_schema() { ...@@ -159,44 +159,44 @@ function comment_schema() {
'primary key' => array('cid'), 'primary key' => array('cid'),
); );
$schema['node_comment_statistics'] = array( $schema['node_comment_statistics'] = array(
'description' => t('Maintains statistics of node and comments posts to show "new" and "updated" flags.'), 'description' => t('Maintains statistics of node and comments posts to show "new" and "updated" flags.'),
'fields' => array( 'fields' => array(
'nid' => array( 'nid' => array(
'type' => 'int', 'type' => 'int',
'unsigned' => TRUE, 'unsigned' => TRUE,
'not null' => TRUE, 'not null' => TRUE,
'default' => 0, 'default' => 0,
'description' => t('The {node}.nid for which the statistics are compiled.'), 'description' => t('The {node}.nid for which the statistics are compiled.'),
), ),
'last_comment_timestamp' => array( 'last_comment_timestamp' => array(
'type' => 'int', 'type' => 'int',
'not null' => TRUE, 'not null' => TRUE,
'default' => 0, 'default' => 0,
'description' => t('The Unix timestamp of the last comment that was posted within this node, from {comments}.timestamp.'), 'description' => t('The Unix timestamp of the last comment that was posted within this node, from {comments}.timestamp.'),
), ),
'last_comment_name' => array( 'last_comment_name' => array(
'type' => 'varchar', 'type' => 'varchar',
'length' => 60, 'length' => 60,
'not null' => FALSE, 'not null' => FALSE,
'description' => t('The name of the latest author to post a comment on this node, from {comments}.name.'), 'description' => t('The name of the latest author to post a comment on this node, from {comments}.name.'),
), ),
'last_comment_uid' => array( 'last_comment_uid' => array(
'type' => 'int', 'type' => 'int',
'not null' => TRUE, 'not null' => TRUE,
'default' => 0, 'default' => 0,
'description' => t('The user ID of the latest author to post a comment on this node, from {comments}.uid.'), 'description' => t('The user ID of the latest author to post a comment on this node, from {comments}.uid.'),
), ),
'comment_count' => array( 'comment_count' => array(
'type' => 'int', 'type' => 'int',
'unsigned' => TRUE, 'unsigned' => TRUE,
'not null' => TRUE, 'not null' => TRUE,
'default' => 0, 'default' => 0,
'description' => t('The total number of comments on this node.'), 'description' => t('The total number of comments on this node.'),
), ),
), ),
'indexes' => array('node_comment_timestamp' => array('last_comment_timestamp')), 'indexes' => array('node_comment_timestamp' => array('last_comment_timestamp')),
'primary key' => array('nid'), 'primary key' => array('nid'),
); );
return $schema; return $schema;
......
...@@ -1050,8 +1050,8 @@ function comment_operations($action = NULL) { ...@@ -1050,8 +1050,8 @@ function comment_operations($action = NULL) {
} }
/** /**
*** misc functions: helpers, privates, history * Misc functions: helpers, privates, history
**/ */
/** /**
* Load the entire comment by cid. * Load the entire comment by cid.
...@@ -1318,7 +1318,7 @@ function comment_form(&$form_state, $edit, $title = NULL) { ...@@ -1318,7 +1318,7 @@ function comment_form(&$form_state, $edit, $title = NULL) {
if (!form_get_errors() && ((variable_get('comment_preview_'. $node->type, COMMENT_PREVIEW_REQUIRED) == COMMENT_PREVIEW_OPTIONAL) || ($op == t('Preview')) || ($op == t('Save')))) { if (!form_get_errors() && ((variable_get('comment_preview_'. $node->type, COMMENT_PREVIEW_REQUIRED) == COMMENT_PREVIEW_OPTIONAL) || ($op == t('Preview')) || ($op == t('Save')))) {
$form['submit'] = array('#type' => 'submit', '#value' => t('Save'), '#weight' => 19); $form['submit'] = array('#type' => 'submit', '#value' => t('Save'), '#weight' => 19);
} }
$form['preview'] = array('#type' => 'button', '#value' => t('Preview'), '#weight' => 20); $form['preview'] = array('#type' => 'button', '#value' => t('Preview'), '#weight' => 20);
$form['#token'] = 'comment'. $edit['nid'] . (isset($edit['pid']) ? $edit['pid'] : ''); $form['#token'] = 'comment'. $edit['nid'] . (isset($edit['pid']) ? $edit['pid'] : '');
......
...@@ -274,7 +274,7 @@ function filter_filter_tips($delta, $format, $long = FALSE) { ...@@ -274,7 +274,7 @@ function filter_filter_tips($delta, $format, $long = FALSE) {
} }
break; break;
case 2: case 2:
return t('Web page addresses and e-mail addresses turn into links automatically.'); return t('Web page addresses and e-mail addresses turn into links automatically.');
} }
} }
......
...@@ -190,7 +190,7 @@ function forum_nodeapi(&$node, $op, $teaser, $page) { ...@@ -190,7 +190,7 @@ function forum_nodeapi(&$node, $op, $teaser, $page) {
if ($parents = taxonomy_get_parents_all($node->tid)) { if ($parents = taxonomy_get_parents_all($node->tid)) {
$parents = array_reverse($parents); $parents = array_reverse($parents);
foreach ($parents as $p) { foreach ($parents as $p) {
$breadcrumb[] = l($p->name, 'forum/'.$p->tid); $breadcrumb[] = l($p->name, 'forum/'. $p->tid);
} }
} }
drupal_set_breadcrumb($breadcrumb); drupal_set_breadcrumb($breadcrumb);
......
...@@ -384,7 +384,7 @@ function node_admin_nodes() { ...@@ -384,7 +384,7 @@ function node_admin_nodes() {
'#submit' => array('node_admin_nodes_submit'), '#submit' => array('node_admin_nodes_submit'),
); );
$languages = language_list(); $languages = language_list();
$destination = drupal_get_destination(); $destination = drupal_get_destination();
$nodes =