From a88c178b91ff1342377b89b68965dcf7aaac725a Mon Sep 17 00:00:00 2001 From: Dries Buytaert <dries@buytaert.net> Date: Fri, 28 Dec 2007 12:02:52 +0000 Subject: [PATCH] - Patch #204221 by webernet: code style fixes. --- INSTALL.txt | 2 +- includes/menu.inc | 2 +- includes/unicode.inc | 2 +- modules/aggregator/aggregator.module | 49 ++++++++-------------------- modules/blog/blog.module | 7 ++-- modules/color/color.module | 32 +++++++++--------- modules/comment/comment.module | 10 ++---- modules/locale/locale.module | 6 ++-- modules/node/node.admin.inc | 4 +-- modules/node/node.module | 2 +- modules/openid/openid.inc | 4 +-- modules/path/path.admin.inc | 4 +-- modules/trigger/trigger.admin.inc | 2 +- modules/trigger/trigger.install | 42 ++++++++++++------------ modules/user/user.module | 2 +- 15 files changed, 71 insertions(+), 99 deletions(-) diff --git a/INSTALL.txt b/INSTALL.txt index b4f3cfcf3316..66b416ec2b82 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -108,7 +108,7 @@ INSTALLATION The install script will attempt to create a files storage directory in the default location at sites/default/files (the location of the - files directory may be changed after Drupal is installed). In some + files directory may be changed after Drupal is installed). In some cases, you may need to create the directory and modify its permissions manually. Use the following commands (from the installation directory) to create the files directory and grant the web server write privileges to it: diff --git a/includes/menu.inc b/includes/menu.inc index b28c7c433c0e..52bb2e977584 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -607,7 +607,7 @@ function _menu_link_translate(&$item) { } // If the link title matches that of its router item, localize it. - if (!empty($item['title']) && ($item['title'] == $item['link_title'])){ + if (!empty($item['title']) && ($item['title'] == $item['link_title'])) { if (!empty($item['title_arguments']) && $item['title_callback'] == 't') { $item['title'] = t($item['title'], menu_unserialize($item['title_arguments'], $map)); } diff --git a/includes/unicode.inc b/includes/unicode.inc index c58e81bb5d97..19c74422bfcf 100644 --- a/includes/unicode.inc +++ b/includes/unicode.inc @@ -208,7 +208,7 @@ function drupal_convert_to_utf8($data, $encoding) { */ function drupal_truncate_bytes($string, $len) { if (strlen($string) <= $len) { - return $string; + return $string; } if ((ord($string[$len]) < 0x80) || (ord($string[$len]) >= 0xC0)) { return substr($string, 0, $len); diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index 3dc172b2c070..0b7e5a420841 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -716,15 +716,11 @@ function aggregator_parse_feed(&$data, $feed) { } xml_parser_free($xml_parser); - /* - ** We reverse the array such that we store the first item last, - ** and the last item first. In the database, the newest item - ** should be at the top. - */ - + // We reverse the array such that we store the first item last, and the last + // item first. In the database, the newest item should be at the top. $items = array_reverse($items); - // Initialize variables + // Initialize variables. $title = $link = $author = $description = $guid = NULL; foreach ($items as $item) { unset($title, $link, $author, $description, $guid); @@ -734,12 +730,9 @@ function aggregator_parse_feed(&$data, $feed) { $item[$key] = trim($value); } - /* - ** Resolve the item's title. If no title is found, we use - ** up to 40 characters of the description ending at a word - ** boundary but not splitting potential entities. - */ - + // Resolve the item's title. If no title is found, we use up to 40 + // characters of the description ending at a word boundary but not + // splitting potential entities. if (!empty($item['TITLE'])) { $title = $item['TITLE']; } @@ -750,10 +743,7 @@ function aggregator_parse_feed(&$data, $feed) { $title = ''; } - /* - ** Resolve the items link. - */ - + // Resolve the items link. if (!empty($item['LINK'])) { $link = $item['LINK']; } @@ -762,9 +752,7 @@ function aggregator_parse_feed(&$data, $feed) { } $guid = isset($item['GUID']) ? $item['GUID'] : ''; - /** - * Atom feeds have a CONTENT and/or SUMMARY tag instead of a DESCRIPTION tag - */ + // Atom feeds have a CONTENT and/or SUMMARY tag instead of a DESCRIPTION tag. if (!empty($item['CONTENT:ENCODED'])) { $item['DESCRIPTION'] = $item['CONTENT:ENCODED']; } @@ -775,11 +763,8 @@ function aggregator_parse_feed(&$data, $feed) { $item['DESCRIPTION'] = $item['CONTENT']; } - /* - ** Try to resolve and parse the item's publication date. If no - ** date is found, we use the current date instead. - */ - + // Try to resolve and parse the item's publication date. If no date is + // found, we use the current date instead. $date = 'now'; foreach (array('PUBDATE', 'DC:DATE', 'DCTERMS:ISSUED', 'DCTERMS:CREATED', 'DCTERMS:MODIFIED', 'ISSUED', 'CREATED', 'MODIFIED', 'PUBLISHED', 'UPDATED') as $key) { if (!empty($item[$key])) { @@ -796,12 +781,9 @@ function aggregator_parse_feed(&$data, $feed) { } } - /* - ** Save this item. Try to avoid duplicate entries as much as - ** possible. If we find a duplicate entry, we resolve it and - ** pass along its ID is such that we can update it if needed. - */ - + // Save this item. Try to avoid duplicate entries as much as possible. If + // we find a duplicate entry, we resolve it and pass along its ID is such + // that we can update it if needed. if (!empty($guid)) { $entry = db_fetch_object(db_query("SELECT iid FROM {aggregator_item} WHERE fid = %d AND guid = '%s'", $feed['fid'], $guid)); } @@ -815,10 +797,7 @@ function aggregator_parse_feed(&$data, $feed) { aggregator_save_item(array('iid' => (isset($entry->iid) ? $entry->iid: ''), 'fid' => $feed['fid'], 'timestamp' => $timestamp, 'title' => $title, 'link' => $link, 'author' => $item['AUTHOR'], 'description' => $item['DESCRIPTION'], 'guid' => $guid)); } - /* - ** Remove all items that are older than flush item timer: - */ - + // Remove all items that are older than flush item timer. $age = time() - variable_get('aggregator_clear', 9676800); $result = db_query('SELECT iid FROM {aggregator_item} WHERE fid = %d AND timestamp < %d', $feed['fid'], $age); diff --git a/modules/blog/blog.module b/modules/blog/blog.module index a35b250f9544..0f2987781d5a 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -80,11 +80,8 @@ function blog_form(&$node) { if (empty($node->body)) { - /* - ** If the user clicked a "blog it" link, we load the data from the - ** database and quote it in the blog: - */ - + // If the user clicked a "blog it" link, we load the data from the + // database and quote it in the blog. if ($nid && $blog = node_load($nid)) { $node->body = '<em>'. $blog->body .'</em> ['. l($blog->name, "node/$nid") .']'; } diff --git a/modules/color/color.module b/modules/color/color.module index a65271ba50f6..bdbdad550b28 100644 --- a/modules/color/color.module +++ b/modules/color/color.module @@ -32,22 +32,22 @@ function color_theme() { function color_form_alter(&$form, $form_state, $form_id) { // Insert the color changer into the theme settings page. if ($form_id == 'system_theme_settings' && color_get_info(arg(4)) && function_exists('gd_info')) { - if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) != FILE_DOWNLOADS_PUBLIC) { - // Disables the color changer when the private download method is used. - // TODO: This should be solved in a different way. See issue #181003. - drupal_set_message(t('The color picker only works if the <a href="@url">download method</a> is set to public.', array('@url' => url('admin/settings/file-system'))), 'warning'); - } - else { - $form['color'] = array( - '#type' => 'fieldset', - '#title' => t('Color scheme'), - '#weight' => -1, - '#attributes' => array('id' => 'color_scheme_form'), - '#theme' => 'color_scheme_form', - ); - $form['color'] += color_scheme_form($form_state, arg(4)); - $form['#submit'][] = 'color_scheme_form_submit'; - } + if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) != FILE_DOWNLOADS_PUBLIC) { + // Disables the color changer when the private download method is used. + // TODO: This should be solved in a different way. See issue #181003. + drupal_set_message(t('The color picker only works if the <a href="@url">download method</a> is set to public.', array('@url' => url('admin/settings/file-system'))), 'warning'); + } + else { + $form['color'] = array( + '#type' => 'fieldset', + '#title' => t('Color scheme'), + '#weight' => -1, + '#attributes' => array('id' => 'color_scheme_form'), + '#theme' => 'color_scheme_form', + ); + $form['color'] += color_scheme_form($form_state, arg(4)); + $form['#submit'][] = 'color_scheme_form_submit'; + } } // Use the generated screenshot in the theme list. diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 2d97e0ed2a12..0f820489c067 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -976,13 +976,9 @@ function comment_render($node, $cid = 0) { $query .= ' ORDER BY c.cid'; } else { - - /* - ** See comment above. Analysis learns that this doesn't cost - ** too much. It scales much much better than having the whole - ** comment structure. - */ - + // See comment above. Analysis reveals that this doesn't cost too + // much. It scales much much better than having the whole comment + // structure. $query .= ' ORDER BY SUBSTRING(c.thread, 1, (LENGTH(c.thread) - 1))'; } } diff --git a/modules/locale/locale.module b/modules/locale/locale.module index 251fc08760f7..fd7c24953d50 100644 --- a/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -43,14 +43,14 @@ function locale_help($path, $arg) { case 'admin/settings/language': $output = '<p>'. t("This page provides an overview of your site's enabled languages. If multiple languages are available and enabled, the text on your site interface may be translated, registered users may select their preferred language on the <em>My account</em> page, and site authors may indicate a specific language when creating posts. The site's default language is used for anonymous visitors and for users who have not selected a preferred language.") .'</p>'; $output .= '<p>'. t('For each language available on the site, use the <em>edit</em> link to configure language details, including name, an optional language-specific path or domain, and whether the language is natively presented either left-to-right or right-to-left. These languages also appear in the <em>Language</em> selection when creating a post of a content type with multilingual support.') .'</p>'; - $output .= '<p>' .t('Use the <a href="@add-language">add language page</a> to enable additional languages (and automatically import files from a translation package, if available), the <a href="@search">translate interface page</a> to locate strings for manual translation, or the <a href="@import">import page</a> to add translations from individual <em>.po</em> files. A number of contributed translation packages containing <em>.po</em> files are available on the <a href="@translations">Drupal.org translations page</a>.', array('@add-language' => url('admin/settings/language/add'), '@search' => url('admin/build/translate/search'), '@import' => url('admin/build/translate/import'), '@translations' => 'http://drupal.org/project/translations')) .'</p>'; + $output .= '<p>'. t('Use the <a href="@add-language">add language page</a> to enable additional languages (and automatically import files from a translation package, if available), the <a href="@search">translate interface page</a> to locate strings for manual translation, or the <a href="@import">import page</a> to add translations from individual <em>.po</em> files. A number of contributed translation packages containing <em>.po</em> files are available on the <a href="@translations">Drupal.org translations page</a>.', array('@add-language' => url('admin/settings/language/add'), '@search' => url('admin/build/translate/search'), '@import' => url('admin/build/translate/import'), '@translations' => 'http://drupal.org/project/translations')) .'</p>'; return $output; case 'admin/settings/language/add': return '<p>'. t('Add all languages to be supported by your site. If your desired language is not available in the <em>Language name</em> drop-down, click <em>Custom language</em> and provide a language code and other details manually. When providing a language code manually, be sure to enter a standardized language code, since this code may be used by browsers to determine an appropriate display language.') .'</p>'; case 'admin/settings/language/configure': $output = '<p>'. t("Language negotiation settings determine the site's presentation language. Available options include:") .'</p>'; - $output .= '<ul><li>' .t('<strong>None.</strong> The default language is used for site presentation, though users may (optionally) select a preferred language on the <em>My Account</em> page. (User language preferences will be used for site e-mails, if available.)'). '</li>'; - $output .= '<li>' .t('<strong>Path prefix only.</strong> The presentation language is determined by examining the path for a language code or other custom string that matches the path prefix (if any) specified for each language. If a suitable prefix is not identified, the default language is used. <em>Example: "example.com/de/contact" sets presentation language to German based on the use of "de" within the path.</em>') .'</li>'; + $output .= '<ul><li>'. t('<strong>None.</strong> The default language is used for site presentation, though users may (optionally) select a preferred language on the <em>My Account</em> page. (User language preferences will be used for site e-mails, if available.)') .'</li>'; + $output .= '<li>'. t('<strong>Path prefix only.</strong> The presentation language is determined by examining the path for a language code or other custom string that matches the path prefix (if any) specified for each language. If a suitable prefix is not identified, the default language is used. <em>Example: "example.com/de/contact" sets presentation language to German based on the use of "de" within the path.</em>') .'</li>'; $output .= '<li>'. t("<strong>Path prefix with language fallback.</strong> The presentation language is determined by examining the path for a language code or other custom string that matches the path prefix (if any) specified for each language. If a suitable prefix is not identified, the display language is determined by the user's language preferences from the <em>My Account</em> page, or by the browser's language settings. If a presentation language cannot be determined, the default language is used.") .'</t>'; $output .= '<li>'. t('<strong>Domain name only.</strong> The presentation language is determined by examining the domain used to access the site, and comparing it to the language domain (if any) specified for each language. If a match is not identified, the default language is used. <em>Example: "http://de.example.com/contact" sets presentation language to German based on the use of "http://de.example.com" in the domain.</em>') .'</li></ul>'; $output .= '<p>'. t('The path prefix or domain name for a language may be set by editing the <a href="@languages">available languages</a>. In the absence of an appropriate match, the site is displayed in the <a href="@languages">default language</a>.', array('@languages' => url('admin/settings/language'))) .'</p>'; diff --git a/modules/node/node.admin.inc b/modules/node/node.admin.inc index 3697b17c3024..0c34f1b41cf7 100644 --- a/modules/node/node.admin.inc +++ b/modules/node/node.admin.inc @@ -375,12 +375,12 @@ function node_mass_update($nodes, $updates) { 'error_message' => t('The update has encountered an error.'), // The operations do not live in the .module file, so we need to // tell the batch engine which file to load before calling them. - 'file' => drupal_get_path('module', 'node'). '/node.admin.inc', + 'file' => drupal_get_path('module', 'node') .'/node.admin.inc', ); batch_set($batch); } else { - foreach($nodes as $nid) { + foreach ($nodes as $nid) { _node_mass_update_helper($nid, $updates); } drupal_set_message(t('The update has been performed.')); diff --git a/modules/node/node.module b/modules/node/node.module index f936399e9edd..85a49cfedbb4 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -35,7 +35,7 @@ function node_help($path, $arg) { case 'admin/help#node': $output = '<p>'. t('The node module manages content on your site, and stores all posts (regardless of type) as a "node". In addition to basic publishing settings, including whether the post has been published, promoted to the site front page, or should remain present (or sticky) at the top of lists, the node module also records basic information about the author of a post. Optional revision control over edits is available. For additional functionality, the node module is often extended by other modules.') .'</p>'; $output .= '<p>'. t('Though each post on your site is a node, each post is also of a particular <a href="@content-type">content type</a>. <a href="@content-type">Content types</a> are used to define the characteristics of a post, including the title and description of the fields displayed on its add and edit pages. Each content type may have different default settings for <em>Publishing options</em> and other workflow controls. By default, the two content types in a standard Drupal installation are <em>Page</em> and <em>Story</em>. Use the <a href="@content-type">content types page</a> to add new or edit existing content types. Additional content types also become available as you enable additional core, contributed and custom modules.', array('@content-type' => url('admin/content/types'))) .'</p>'; - $output .= '<p>'. t('The administrative <a href="@content">content page</a> allows you to review and manage your site content. The <a href="@post-settings">post settings page</a> sets certain options for the display of posts. The node module makes a number of permissions available for each content type, which may be set by role on the <a href="@permissions">permissions page</a>.', array('@content' => url('admin/content/node'),'@post-settings' => url('admin/content/node-settings'), '@permissions' => url('admin/user/permissions'))) .'</p>'; + $output .= '<p>'. t('The administrative <a href="@content">content page</a> allows you to review and manage your site content. The <a href="@post-settings">post settings page</a> sets certain options for the display of posts. The node module makes a number of permissions available for each content type, which may be set by role on the <a href="@permissions">permissions page</a>.', array('@content' => url('admin/content/node'), '@post-settings' => url('admin/content/node-settings'), '@permissions' => url('admin/user/permissions'))) .'</p>'; $output .= '<p>'. t('For more information, see the online handbook entry for <a href="@node">Node module</a>.', array('@node' => 'http://drupal.org/handbook/modules/node/')) .'</p>'; return $output; case 'admin/content/node': diff --git a/modules/openid/openid.inc b/modules/openid/openid.inc index e7544593adc7..9ff4af5a2950 100644 --- a/modules/openid/openid.inc +++ b/modules/openid/openid.inc @@ -393,7 +393,7 @@ function _openid_fix_post(&$post) { $fixed_key = str_replace('openid.ns_', 'openid.ns.', $fixed_key); $fixed_key = str_replace('openid.sreg_', 'openid.sreg.', $fixed_key); foreach ($extensions as $ext) { - $fixed_key = str_replace('openid.'.$ext.'_', 'openid.'.$ext.'.', $fixed_key); + $fixed_key = str_replace('openid.'. $ext .'_', 'openid.'. $ext .'.', $fixed_key); } unset($post[$key]); $post[$fixed_key] = $value; @@ -417,4 +417,4 @@ function bcpowmod($base, $exp, $mod) { } return $result; } -} \ No newline at end of file +} diff --git a/modules/path/path.admin.inc b/modules/path/path.admin.inc index d63d26c620ef..71488639d874 100644 --- a/modules/path/path.admin.inc +++ b/modules/path/path.admin.inc @@ -158,7 +158,7 @@ function path_admin_form_submit($form, &$form_state) { /** * Menu callback; confirms deleting an URL alias - **/ + */ function path_admin_delete_confirm($form_state, $pid) { $path = path_load($pid); if (user_access('administer url aliases')) { @@ -172,7 +172,7 @@ function path_admin_delete_confirm($form_state, $pid) { /** * Execute URL alias deletion - **/ + */ function path_admin_delete_confirm_submit($form, &$form_state) { if ($form_state['values']['confirm']) { path_admin_delete($form_state['values']['pid']); diff --git a/modules/trigger/trigger.admin.inc b/modules/trigger/trigger.admin.inc index 0573ac8afcb7..624982208eb0 100644 --- a/modules/trigger/trigger.admin.inc +++ b/modules/trigger/trigger.admin.inc @@ -140,7 +140,7 @@ function trigger_assign_form($form_state, $hook, $op, $description) { $form[$op] = array( '#type' => 'fieldset', - '#title' => t('Trigger: '). $description, + '#title' => t('Trigger: ') . $description, '#theme' => 'trigger_display' ); // Retrieve actions that are already assigned to this hook-op combination. diff --git a/modules/trigger/trigger.install b/modules/trigger/trigger.install index bca11130ce5e..981ad5dbf065 100644 --- a/modules/trigger/trigger.install +++ b/modules/trigger/trigger.install @@ -27,27 +27,27 @@ function trigger_schema() { $schema['trigger_assignments'] = array( 'description' => t('Maps trigger to hook and operation assignments from trigger.module.'), 'fields' => array( - 'hook' => array( - 'type' => 'varchar', - 'length' => 32, - 'not null' => TRUE, - 'default' => '', - 'description' => t('Primary Key: The name of the internal Drupal hook upon which an action is firing; for example, nodeapi.'), - ), - 'op' => array( - 'type' => 'varchar', - 'length' => 32, - 'not null' => TRUE, - 'default' => '', - 'description' => t('Primary Key: The specific operation of the hook upon which an action is firing: for example, presave.'), - ), - 'aid' => array( - 'type' => 'varchar', - 'length' => 255, - 'not null' => TRUE, - 'default' => '', - 'description' => t("Primary Key: Action's {actions}.aid."), - ), + 'hook' => array( + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '', + 'description' => t('Primary Key: The name of the internal Drupal hook upon which an action is firing; for example, nodeapi.'), + ), + 'op' => array( + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '', + 'description' => t('Primary Key: The specific operation of the hook upon which an action is firing: for example, presave.'), + ), + 'aid' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => t("Primary Key: Action's {actions}.aid."), + ), 'weight' => array( 'type' => 'int', 'not null' => TRUE, diff --git a/modules/user/user.module b/modules/user/user.module index 0a0c51332110..05556aecddb5 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -118,7 +118,7 @@ function user_external_login($account, $edit = array()) { // Invalid login. return FALSE; } - + // Valid login. global $user; $user = $account; -- GitLab