From a88c178b91ff1342377b89b68965dcf7aaac725a Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 28 Dec 2007 12:02:52 +0000 Subject: - 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 b4f3cfcf3..66b416ec2 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 b28c7c433..52bb2e977 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 c58e81bb5..19c74422b 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 3dc172b2c..0b7e5a420 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 a35b250f9..0f2987781 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 = ''. $blog->body .' ['. l($blog->name, "node/$nid") .']'; } diff --git a/modules/color/color.module b/modules/color/color.module index a65271ba5..bdbdad550 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 download method 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 download method 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 2d97e0ed2..0f820489c 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 251fc0876..fd7c24953 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 = '

'. 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 My account 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.") .'

'; $output .= '

'. t('For each language available on the site, use the edit 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 Language selection when creating a post of a content type with multilingual support.') .'

'; - $output .= '

' .t('Use the add language page to enable additional languages (and automatically import files from a translation package, if available), the translate interface page to locate strings for manual translation, or the import page to add translations from individual .po files. A number of contributed translation packages containing .po files are available on the Drupal.org translations page.', 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')) .'

'; + $output .= '

'. t('Use the add language page to enable additional languages (and automatically import files from a translation package, if available), the translate interface page to locate strings for manual translation, or the import page to add translations from individual .po files. A number of contributed translation packages containing .po files are available on the Drupal.org translations page.', 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')) .'

'; return $output; case 'admin/settings/language/add': return '

'. t('Add all languages to be supported by your site. If your desired language is not available in the Language name drop-down, click Custom language 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.') .'

'; case 'admin/settings/language/configure': $output = '

'. t("Language negotiation settings determine the site's presentation language. Available options include:") .'

'; - $output .= '