Commit a88c178b authored by Dries's avatar Dries

- Patch #204221 by webernet: code style fixes.

parent faf7ebaf
......@@ -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:
......
......@@ -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));
}
......
......@@ -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);
......
......@@ -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);
......
......@@ -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") .']';
}
......
......@@ -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.
......
......@@ -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))';
}
}
......
......@@ -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>';
......
......@@ -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.'));
......
......@@ -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':
......
......@@ -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
}
......@@ -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']);
......
......@@ -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.
......
......@@ -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,
......
......@@ -118,7 +118,7 @@ function user_external_login($account, $edit = array()) {
// Invalid login.
return FALSE;
}
// Valid login.
global $user;
$user = $account;
......
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