Commit a24a6c2b authored by Dries's avatar Dries

- Patch #471070 by stella: millions of code style fixes.

parent a5f42fd0
......@@ -800,7 +800,7 @@ function drupal_set_header($name = NULL, $value = NULL, $append = FALSE) {
* or NULL if the header has not been set.
*/
function drupal_get_header($name = NULL) {
$headers = drupal_set_header();
$headers = drupal_set_header();
if (isset($name)) {
$name = strtolower($name);
return isset($headers[$name]) ? $headers[$name] : NULL;
......@@ -1824,7 +1824,7 @@ function registry_rebuild() {
* @param $name
* Globally unique name for the variable. For a function with only one static,
* variable, the function name (e.g. via the PHP magic __FUNCTION__ constant)
* is recommended. For a function with multiple static variables add a
* is recommended. For a function with multiple static variables add a
* distinguishing suffix to the function name for each one.
* @param $default_value
* Optional default value.
......
......@@ -385,7 +385,7 @@ function drupal_not_found() {
*/
function drupal_access_denied() {
drupal_set_header('403 Forbidden');
watchdog('access denied', check_plain($_GET['q']), NULL, WATCHDOG_WARNING);
$path = drupal_get_normal_path(variable_get('site_403', ''));
......@@ -741,8 +741,8 @@ function _drupal_decode_exception($exception) {
// or in one of its global functions.
$db_functions = array('db_query', 'pager_query', 'db_query_range', 'db_query_temporary', 'update_sql');
while (!empty($backtrace[1]) && ($caller = $backtrace[1]) &&
((isset($caller['class']) && (strpos($caller['class'], 'Query') !== FALSE || strpos($caller['class'], 'Database') !== FALSE)) ||
in_array($caller['function'], $db_functions))) {
((isset($caller['class']) && (strpos($caller['class'], 'Query') !== FALSE || strpos($caller['class'], 'Database') !== FALSE)) ||
in_array($caller['function'], $db_functions))) {
// We remove that call.
array_shift($backtrace);
}
......@@ -2219,7 +2219,7 @@ function drupal_get_path($type, $name) {
/**
* Return the base URL path (i.e., directory) of the Drupal installation.
*
* base_path() prefixes and suffixes a "/" onto the returned path if the path is
* base_path() prefixes and suffixes a "/" onto the returned path if the path is
* not empty. At the very least, this will return "/".
*
* Examples:
......@@ -2571,7 +2571,7 @@ function drupal_load_stylesheet($file, $optimize = NULL) {
* @return
* Contents of the stylesheet including the imported stylesheets.
*/
function drupal_load_stylesheet_content($contents, $optimize = FALSE) {
function drupal_load_stylesheet_content($contents, $optimize = FALSE) {
// Replaces @import commands with the actual stylesheet content.
// This happens recursively but omits external files.
$contents = preg_replace_callback('/@import\s*(?:url\()?[\'"]?(?![a-z]+:)([^\'"\()]+)[\'"]?\)?;/', '_drupal_load_stylesheet', $contents);
......@@ -3134,8 +3134,8 @@ function drupal_json($var = NULL) {
function drupal_urlencode($text) {
if (variable_get('clean_url', '0')) {
return str_replace(array('%2F', '%26', '%23', '//'),
array('/', '%2526', '%2523', '/%252F'),
rawurlencode($text));
array('/', '%2526', '%2523', '/%252F'),
rawurlencode($text));
}
else {
return str_replace('%2F', '/', rawurlencode($text));
......@@ -4274,7 +4274,7 @@ function drupal_write_record($table, &$object, $primary_keys = array()) {
if (empty($primary_keys)) {
$options = array('return' => Database::RETURN_INSERT_ID);
if (isset($serial) && isset($fields[$serial])) {
// If the serial column has been explicitly set with an ID, then we don't
// If the serial column has been explicitly set with an ID, then we don't
// require the database to return the last insert id.
if ($fields[$serial]) {
$options['return'] = Database::RETURN_AFFECTED;
......
......@@ -25,7 +25,7 @@ public function execute() {
if (count($this->insertFields) + count($this->defaultFields) == 0) {
return NULL;
}
// Don't execute query without values.
if (!isset($this->insertValues[0]) && count($this->insertFields) > 0) {
return NULL;
......
......@@ -611,7 +611,7 @@ public function key(array $fields, array $values = array()) {
* The called object.
*/
public function update(array $fields, array $values = array()) {
if ($values) {
if ($values) {
$fields = array_combine($fields, $values);
}
$this->updateFields = $fields;
......
......@@ -496,7 +496,7 @@ public function fieldNames($fields) {
/**
* Prepare a table or column comment for database query.
*
*
* @param $comment
* The comment string to prepare.
* @param $length
......
......@@ -1091,7 +1091,7 @@ public function __toString() {
// If the table is a subquery, compile it and integrate it into this query.
if ($table['table'] instanceof SelectQueryInterface) {
$table_string = '(' . (string)$table['table'] .')';
$table_string = '(' . (string)$table['table'] . ')';
}
else {
$table_string = '{' . $this->connection->escapeTable($table['table']) . '}';
......
......@@ -916,7 +916,7 @@ function file_save_upload($source, $validators = array(), $destination = FALSE,
// Final check that this is a valid upload, if it isn't, use the
// default error handler.
if (is_uploaded_file($_FILES['files']['tmp_name'][$source])) {
break;
break;
}
// Unknown error
......@@ -1401,7 +1401,7 @@ function file_download() {
* @return
* An associative array (keyed on the provided key) of objects with
* 'filepath', 'filename', and 'name' members corresponding to the
* matching files.
* matching files.
*/
function file_scan_directory($dir, $mask, $options = array(), $depth = 0) {
// Merge in defaults.
......@@ -1878,7 +1878,7 @@ function file_get_mimetype($filename, $mapping = NULL) {
));
}
foreach ($mapping as $ext_preg => $mime_match) {
if (preg_match('!\.('. $ext_preg .')$!i', $filename)) {
if (preg_match('!\.(' . $ext_preg . ')$!i', $filename)) {
return $mime_match;
}
}
......
......@@ -29,7 +29,7 @@
* presentation, while simplifying code and reducing the amount of HTML that
* must be explicitly generated by modules.
*
* The drupal_get_form() function handles retrieving and processing an HTML
* The drupal_get_form() function handles retrieving and processing an HTML
* form for modules automatically. For example:
*
* @code
......@@ -198,7 +198,7 @@ function drupal_build_form($form_id, &$form_state) {
if ((!empty($form_state['storage']) || !empty($form_state['rebuild'])) && !empty($form_state['submitted']) && !form_get_errors()) {
$form = drupal_rebuild_form($form_id, $form_state);
}
// Don't override #theme if someone already set it.
if (!isset($form['#theme'])) {
init_theme();
......@@ -823,8 +823,8 @@ function form_execute_handlers($type, &$form, &$form_state) {
foreach ($handlers as $function) {
if (drupal_function_exists($function)) {
// Check to see if a previous _submit handler has set a batch, but
// make sure we do not react to a batch that is already being processed
// Check to see if a previous _submit handler has set a batch, but
// make sure we do not react to a batch that is already being processed
// (for instance if a batch operation performs a drupal_form_submit()).
if ($type == 'submit' && ($batch =& batch_get()) && !isset($batch['current_set'])) {
// Some previous _submit handler has set a batch. We store the call
......
......@@ -414,7 +414,7 @@ function drupal_rewrite_settings($settings = array(), $prefix = '') {
function drupal_get_install_files($module_list = array()) {
$installs = array();
foreach ($module_list as $module) {
$installs = array_merge($installs, drupal_system_listing('/'. $module . '.install$/', 'modules'));
$installs = array_merge($installs, drupal_system_listing('/' . $module . '.install$/', 'modules'));
}
return $installs;
}
......@@ -628,11 +628,11 @@ function drupal_uninstall_modules($module_list = array()) {
$placeholders = implode(', ', array_fill(0, count($paths), "'%s'"));
$result = db_select('menu_links')
->fields('menu_links')
->condition('router_path', $paths, 'IN')
->condition('external', 0)
->orderBy('depth')
->execute();
->fields('menu_links')
->condition('router_path', $paths, 'IN')
->condition('external', 0)
->orderBy('depth')
->execute();
// Remove all such items. Starting from those with the greatest depth will
// minimize the amount of re-parenting done by menu_link_delete().
foreach ($result as $item) {
......@@ -938,7 +938,7 @@ function drupal_check_profile($profile) {
$requirements = array();
foreach ($installs as $install) {
require_once DRUPAL_ROOT . '/' . $install->filepath;
$function = $install->name. '_requirements';
$function = $install->name . '_requirements';
if (function_exists($function)) {
$requirements = array_merge($requirements, $function('install'));
}
......
......@@ -542,7 +542,7 @@ function locale_translate_overview_screen() {
// Languages with at least one record in the locale table.
$translations = db_query("SELECT COUNT(*) AS translation, t.language, s.textgroup FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid GROUP BY textgroup, language");
foreach ($translations as $data) {
$ratio = (!empty($groupsums[$data->textgroup]) && $data->translation > 0) ? round(($data->translation/$groupsums[$data->textgroup])*100., 2) : 0;
$ratio = (!empty($groupsums[$data->textgroup]) && $data->translation > 0) ? round(($data->translation/$groupsums[$data->textgroup]) * 100.0, 2) : 0;
$rows[$data->language][$data->textgroup] = $data->translation . '/' . $groupsums[$data->textgroup] . " ($ratio%)";
}
......@@ -688,7 +688,7 @@ function locale_translation_filter_form_submit($form, &$form_state) {
$_SESSION['locale_translation_filter'] = array();
break;
}
$form_state['redirect'] = 'admin/international/translate/translate';
}
......
......@@ -1839,7 +1839,7 @@ function menu_router_build() {
// a given item came from.
$callbacks = array();
foreach (module_implements('menu') as $module) {
$router_items = call_user_func($module .'_menu');
$router_items = call_user_func($module . '_menu');
if (isset($router_items) && is_array($router_items)) {
foreach (array_keys($router_items) as $path) {
$router_items[$path]['module'] = $module;
......@@ -1860,7 +1860,7 @@ function menu_router_build() {
*/
function _menu_router_cache($new_menu = NULL) {
$menu = &drupal_static(__FUNCTION__);
if (isset($new_menu)) {
$menu = $new_menu;
}
......
......@@ -157,7 +157,7 @@ function module_rebuild_cache() {
* without this module.
*/
function _module_build_dependencies($files) {
require_once DRUPAL_ROOT .'/includes/graph.inc';
require_once DRUPAL_ROOT . '/includes/graph.inc';
$roots = $files;
foreach ($files as $filename => $file) {
$graph[$file->name]['edges'] = array();
......
......@@ -895,7 +895,7 @@ function drupal_find_theme_templates($cache, $extension, $path) {
$subtheme_paths = isset($theme_paths[$theme]) ? $theme_paths[$theme] : array();
// Escape the periods 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.
$files = drupal_system_listing($regex, $path, 'name', 0);
......@@ -1373,7 +1373,7 @@ function theme_submenu($links) {
* within a table. For example, one may easily group three columns and
* apply same background style to all.
* @param $sticky
* Use a "sticky" table header.
* Use a "sticky" table header.
* @return
* An HTML string representing the table.
*/
......
......@@ -333,9 +333,9 @@ function decode_entities($text, $exclude = array()) {
// Flip the exclude list so that we can do quick lookups later.
$exclude = array_flip($exclude);
// Use a regexp to select all entities in one pass, to avoid decoding
// Use a regexp to select all entities in one pass, to avoid decoding
// double-escaped entities twice. The PREG_REPLACE_EVAL modifier 'e' is
// being used to allow for a callback (see
// being used to allow for a callback (see
// http://php.net/manual/en/reference.pcre.pattern.modifiers).
return preg_replace('/&(#x?)?([A-Za-z0-9]+);/e', '_decode_entities("$1", "$2", "$0", $html_entities, $exclude)', $text);
}
......
......@@ -559,7 +559,7 @@ function install_select_locale($profilename) {
install_task_list('locale-select');
drupal_set_title(st('Choose language'));
print theme('install_page', drupal_render(drupal_get_form('install_select_locale_form', $locales)));
exit;
}
......@@ -665,7 +665,7 @@ function install_tasks($profile, $task) {
// to the same address, until the batch finished callback is invoked
// and the task advances to 'locale-initial-import'.
if ($task == 'profile-install-batch') {
include_once DRUPAL_ROOT .'/includes/batch.inc';
include_once DRUPAL_ROOT . '/includes/batch.inc';
$output = _batch_page();
}
......@@ -917,7 +917,7 @@ function install_check_requirements($profile, $verify) {
'title' => st('Settings file'),
'value' => st('The settings file does not exist.'),
'severity' => REQUIREMENT_ERROR,
'description' => st('The @drupal installer requires that you create a settings file as part of the installation process. Copy the %default_file file to %file. More details about installing Drupal are available in <a href="@install_txt">INSTALL.txt</a>.', array('@drupal' => drupal_install_profile_name(), '%file' => $file, '%default_file' => $conf_path .'/default.settings.php', '@install_txt' => base_path() .'INSTALL.txt')),
'description' => st('The @drupal installer requires that you create a settings file as part of the installation process. Copy the %default_file file to %file. More details about installing Drupal are available in <a href="@install_txt">INSTALL.txt</a>.', array('@drupal' => drupal_install_profile_name(), '%file' => $file, '%default_file' => $conf_path . '/default.settings.php', '@install_txt' => base_path() . 'INSTALL.txt')),
);
}
else {
......
......@@ -55,7 +55,7 @@ function aggregator_view() {
function aggregator_form_feed(&$form_state, stdClass $feed = NULL) {
$period = drupal_map_assoc(array(900, 1800, 3600, 7200, 10800, 21600, 32400, 43200, 64800, 86400, 172800, 259200, 604800, 1209600, 2419200), 'format_interval');
$period[0] = t('Never');
$form['title'] = array('#type' => 'textfield',
'#title' => t('Title'),
'#default_value' => isset($feed->title) ? $feed->title : '',
......@@ -458,7 +458,7 @@ function aggregator_admin_form($form_state) {
'#default_value' => variable_get('aggregator_processors', array('aggregator')),
);
}
if (count($basic_conf)) {
if (count($basic_conf)) {
$form['basic_conf'] = array(
'#type' => 'fieldset',
'#title' => t('Basic configuration'),
......
......@@ -109,8 +109,8 @@ function hook_aggregator_parse($feed) {
* parser.
*
* The title and the description provided are shown on admin/settings/aggregator
* among other places. Use as title the human readable name of the parser and
* as description a brief (40 to 80 characters) explanation of the parser's
* among other places. Use as title the human readable name of the parser and
* as description a brief (40 to 80 characters) explanation of the parser's
* functionality.
*
* This hook is only called if your module implements hook_aggregator_parse().
......@@ -167,8 +167,8 @@ function hook_aggregator_process($feed) {
* processor.
*
* The title and the description provided are shown most importantly on
* admin/settings/aggregator. Use as title the natural name of the processor
* and as description a brief (40 to 80 characters) explanation of the
* admin/settings/aggregator. Use as title the natural name of the processor
* and as description a brief (40 to 80 characters) explanation of the
* functionality.
*
* This hook is only called if your module implements
......
......@@ -175,7 +175,7 @@ function aggregator_expire($feed) {
// Remove all items that are older than flush item timer.
$age = REQUEST_TIME - $aggregator_clear;
$iids = db_query('SELECT iid FROM {aggregator_item} WHERE fid = :fid AND timestamp < :timestamp', array(
':fid' => $feed->fid,
':fid' => $feed->fid,
':timestamp' => $age,
))
->fetchCol();
......
......@@ -20,7 +20,7 @@ class AggregatorTestCase extends DrupalWebTestCase {
* If given, feed will be created with this URL, otherwise /rss.xml will be used.
* @return $feed
* Full feed object if possible.
*
*
* @see getFeedEditArray()
*/
function createFeed($feed_url = NULL) {
......@@ -67,8 +67,8 @@ class AggregatorTestCase extends DrupalWebTestCase {
/**
* Return the count of the randomly created feed array.
*
* @return
*
* @return
* Number of feed items on default feed created by createFeed().
*/
function getDefaultFeedItemCount() {
......@@ -117,10 +117,10 @@ class AggregatorTestCase extends DrupalWebTestCase {
/**
* Add and remove feed items and ensure that the count is zero.
*
* @param $feed
*
* @param $feed
* Feed object representing the feed.
* @param $expected_count
* @param $expected_count
* Expected number of feed items.
*/
function updateAndRemove($feed, $expected_count) {
......@@ -242,7 +242,7 @@ EOF;
function createSampleNodes() {
// Post 5 articles.
for($i = 0; $i < 5; $i++) {
for ($i = 0; $i < 5; $i++) {
$edit = array();
$edit['title'] = $this->randomName();
$edit['body'] = $this->randomName();
......@@ -438,7 +438,7 @@ class RemoveFeedItemTestCase extends AggregatorTestCase {
foreach ($feed_urls as $feed_url) {
$feed = $this->createFeed($feed_url);
// Update and remove items two times in a row to make sure that removal
// resets all 'modified' information (modified, etag, hash) and allows for
// resets all 'modified' information (modified, etag, hash) and allows for
// immediate update.
$this->updateAndRemove($feed, 2);
$this->updateAndRemove($feed, 2);
......
......@@ -178,8 +178,8 @@ function block_schema() {
*/
function block_install() {
drupal_install_schema('block');
// Block should go first so that other modules can alter its output
// Block should go first so that other modules can alter its output
// during hook_page_alter(). Almost everything on the page is a block,
// so before block module runs, there will not be much to alter.
db_update('system')
......@@ -199,8 +199,8 @@ function block_uninstall() {
/**
* Set system.weight to a low value for block module.
*
* Block should go first so that other modules can alter its output
*
* Block should go first so that other modules can alter its output
* during hook_page_alter(). Almost everything on the page is a block,
* so before block module runs, there will not be much to alter.
*/
......
......@@ -95,7 +95,7 @@ function block_theme() {
'block' => array(
'arguments' => array('block' => NULL),
'template' => 'block',
),
),
'block_admin_display_form' => array(
'template' => 'block-admin-display-form',
'file' => 'block.admin.inc',
......
......@@ -24,35 +24,35 @@ class BlogTestCase extends DrupalWebTestCase {
$this->own_user = $this->drupalCreateUser(array('create blog content', 'edit own blog content', 'delete own blog content'));
$this->any_user = $this->drupalCreateUser(array('create blog content', 'edit any blog content', 'delete any blog content', 'access administration pages'));
}
/**
* Confirm that the "You are not allowed to post a new blog entry." message
* shows up if a user submitted blog entries, has been denied that
* Confirm that the "You are not allowed to post a new blog entry." message
* shows up if a user submitted blog entries, has been denied that
* permission, and goes to the blog page.
*/
function testUnprivilegedUser() {
// Create a blog node for a user with no blog permissions.
$this->drupalCreateNode(array('type' => 'blog', 'uid' => $this->big_user->uid));
$this->drupalLogin($this->big_user);
$this->drupalGet('blog/'. $this->big_user->uid);
$this->assertResponse(200);
$this->assertTitle(t("@name's blog", array('@name' => $this->big_user->name)) .' | Drupal', t('Blog title was displayed'));
$this->assertText(t('You are not allowed to post a new blog entry.'), t('No new entries can be posted without the right permission'));
}
/**
* View the blog of a user with no blog entries as another user.
*/
function testBlogPageNoEntries() {
$this->drupalLogin($this->big_user);
$this->drupalGet('blog/'. $this->own_user->uid);
$this->assertResponse(200);
$this->assertTitle(t("@name's blog", array('@name' => $this->own_user->name)) .' | Drupal', t('Blog title was displayed'));
$this->assertText(t('!author has not created any blog entries.', array('!author' => $this->own_user->name)), t('Users blog displayed with no entries'));
}
function testUnprivilegedUser() {
// Create a blog node for a user with no blog permissions.
$this->drupalCreateNode(array('type' => 'blog', 'uid' => $this->big_user->uid));
$this->drupalLogin($this->big_user);
$this->drupalGet('blog/' . $this->big_user->uid);
$this->assertResponse(200);
$this->assertTitle(t("@name's blog", array('@name' => $this->big_user->name)) . ' | Drupal', t('Blog title was displayed'));
$this->assertText(t('You are not allowed to post a new blog entry.'), t('No new entries can be posted without the right permission'));
}
/**
* View the blog of a user with no blog entries as another user.
*/
function testBlogPageNoEntries() {
$this->drupalLogin($this->big_user);
$this->drupalGet('blog/' . $this->own_user->uid);
$this->assertResponse(200);
$this->assertTitle(t("@name's blog", array('@name' => $this->own_user->name)) . ' | Drupal', t('Blog title was displayed'));
$this->assertText(t('!author has not created any blog entries.', array('!author' => $this->own_user->name)), t('Users blog displayed with no entries'));
}
/**
* Login users, create blog nodes, and test blog functionality through the admin and user interfaces.
......@@ -139,14 +139,14 @@ class BlogTestCase extends DrupalWebTestCase {
// View blog node.
$this->drupalGet('node/' . $node->nid);
$this->assertResponse(200);
$this->assertTitle($node->title. ' | Drupal', t('Blog node was displayed'));
$this->assertTitle($node->title . ' | Drupal', t('Blog node was displayed'));
$this->assertText(t('Home ' . $crumb . ' Blogs ' . $crumb . ' @name' . $quote . 's blog', array('@name' => $node_user->name)), t('Breadcrumbs were displayed'));
// View blog edit node.
$this->drupalGet('node/' . $node->nid . '/edit');
$this->assertResponse($response);
if ($response == 200) {
$this->assertTitle('Edit Blog entry ' . $node->title. ' | Drupal', t('Blog edit node was displayed'));
$this->assertTitle('Edit Blog entry ' . $node->title . ' | Drupal', t('Blog edit node was displayed'));
$this->assertText(t('Home ' . $crumb . ' @title', array('@title' => $node->title)), t('Breadcrumbs were displayed'));
}
......
......@@ -331,7 +331,7 @@ function blogapi_status_error_check($node, $original_status) {
$node = (object) $node;
$node_type_default = variable_get('node_options_'. $node->type, array('status', 'promote'));
$node_type_default = variable_get('node_options_' . $node->type, array('status', 'promote'));
// If we don't have the 'administer nodes' permission and the status is
// changing or for a new node the status is not the content type's default,
......@@ -584,7 +584,7 @@ function blogapi_mt_validate_terms($node) {
$term_list = array_unique($node->taxonomy);
$params = $term_list;
$params[] = $node->type;
$result = db_query(db_rewrite_sql("SELECT t.tid, t.vid FROM {taxonomy_term_data} t INNER JOIN {taxonomy_vocabulary_node_type} n ON t.vid = n.vid WHERE t.tid IN (". db_placeholders($term_list) .") AND n.type = '%s'", 't', 'tid'), $params);
$result = db_query(db_rewrite_sql("SELECT t.tid, t.vid FROM {taxonomy_term_data} t INNER JOIN {taxonomy_vocabulary_node_type} n ON t.vid = n.vid WHERE t.tid IN (" . db_placeholders($term_list) . ") AND n.type = '%s'", 't', 'tid'), $params);
$found_terms = array();
$found_count = 0;
while ($term = db_fetch_object($result)) {
......@@ -768,7 +768,7 @@ function blogapi_admin_settings() {
'#field_suffix' => t('MB')
);
$form['settings_general']['upload_max_size'] = array('#value' => '<p>'. t('Your PHP settings limit the maximum file size per upload to %size.', array('%size' => format_size(file_upload_max_size()))).'</p>');
$form['settings_general']['upload_max_size'] = array('#value' => '<p>' . t('Your PHP settings limit the maximum file size per upload to %size.', array('%size' => format_size(file_upload_max_size()))) . '</p>');
$roles = user_roles(FALSE, 'administer content with blog api');
$form['roles'] = array('#type' => 'value', '#value' => $roles);
......
......@@ -873,7 +873,7 @@ function comment_save($edit) {
$parent->thread = (string) rtrim((string) $parent->thread, '/');
// Get the max value in *this* thread.
$max = db_query("SELECT MAX(thread) FROM {comment} WHERE thread LIKE :thread AND nid = :nid", array(
':thread' => $parent->thread .'.%',
':thread' => $parent->thread . '.%',
':nid' => $edit['nid'],
))->fetchField();
......
......@@ -15,7 +15,7 @@
*/
function comment_edit($cid) {
global $user;
$comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.data FROM {comment} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid', array(':cid'=>$cid))->fetchObject();
$comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.data FROM {comment} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid', array(':cid' => $cid))->fetchObject();
$comment = drupal_unpack($comment);
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
......
......@@ -143,7 +143,7 @@ class CommentHelperCase extends DrupalWebTestCase {
* Comments per page value.
*/
function setCommentsPerPage($number) {
$this->setCommentSettings('comment_default_per_page_article', $number, 'Number of comments per page set to ' . $number .'.');
$this->setCommentSettings('comment_default_per_page_article', $number, 'Number of comments per page set to ' . $number . '.');
}
/**
......@@ -280,7 +280,7 @@ class CommentInterfaceTest extends CommentHelperCase {
$reply_loaded = comment_load($reply->id);
$this->assertTrue($this->commentExists($reply, TRUE), t('Reply found.'));
$this->assertEqual($comment->id, $reply_loaded->pid, t('Pid of a reply to a comment is set correctly.'));
$this->assertEqual(rtrim($comment_loaded->thread,'/').'.00/', $reply_loaded->thread, t('Thread of reply grows correctly.'));
$this->assertEqual(rtrim($comment_loaded->thread, '/') . '.00/', $reply_loaded->thread, t('Thread of reply grows correctly.'));
// Second reply to comment
$this->drupalGet('comment/reply/' . $this->node->nid . '/' . $comment->id);
......@@ -289,7 +289,7 @@ class CommentInterfaceTest extends CommentHelperCase {
$reply = $this->postComment(NULL, $this->randomName(), $this->randomName());
$reply_loaded = comment_load($reply->id);
$this->assertTrue($this->commentExists($reply, TRUE), t('Second reply found.'));
$this->assertEqual(rtrim($comment_loaded->thread,'/').'.01/', $reply_loaded->thread, t('Thread of second reply grows correctly.'));
$this->assertEqual(rtrim($comment_loaded->thread, '/') . '.01/', $reply_loaded->thread, t('Thread of second reply grows correctly.'));
// Edit reply.
$this->drupalGet('comment/edit/' . $reply->id);
......@@ -524,11 +524,11 @@ class CommentApprovalTest extends CommentHelperCase {
// Approve comment.
$this->drupalLogin($this->admin_user);
$this->drupalGet('node/'. $this->node->nid);
$this->drupalGet('node/' . $this->node->nid);
$this->clickLink(t('approve'));
$this->drupalLogout();
$this->drupalGet('node/'. $this->node->nid);
$this->drupalGet('node/' . $this->node->nid);
$this->assertTrue($this->commentExists($anonymous_comment4), t('Anonymous comment visible.'));
}
}
......
......@@ -185,7 +185,7 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
$edit['reply'] = $reply;
$edit['selected'] = ($selected ? '1' : '0');
$this->drupalPost('admin/build/contact/edit/' . $category_id, $edit, t('Save'));
return($category_id);
return ($category_id);
}
/**
......
......@@ -197,7 +197,7 @@ class DBLogTestCase extends DrupalWebTestCase {
$this->drupalLogout();
// Fetch row ids in watchdog that relate to the user.
$result = db_query('SELECT wid FROM {watchdog} WHERE uid = :uid', array(':uid' => $user->uid));
foreach($result as $row) {
foreach ($result as $row) {
$ids[] = $row->wid;
}
$count_before = (isset($ids)) ? count($ids) : 0;
......@@ -225,7 +225,7 @@ class DBLogTestCase extends DrupalWebTestCase {
unset($ids);
// Fetch row ids in watchdog that relate to the user.
$result = db_query('SELECT wid FROM {watchdog} WHERE uid = :uid', array(':uid' => $user->uid));
foreach($result as $row) {
foreach ($result as $row) {
$ids[] = $row->wid;
}
$this->assertTrue(!isset($ids), t('DBLog contains no records for @name', array('@name' => $user->name)));
......
......@@ -70,7 +70,7 @@
* as Schema API index specifications. Only columns that appear in the
* 'columns' setting are allowed. Note that field types can specify
* default indexes, which can be modified or added to when
* creating a field.
* creating a field.
* - settings (array)
* A sub-array of key/value pairs of field-type-specific settings. Each
* field type module defines and documents its own field settings.
......@@ -155,7 +155,7 @@
* the display formatter used in this context.
* - module (string, read-only)
* The name of the module which implements the display formatter.
* - example_context_2
* - example_context_2
* - ...
*
* TODO D7 : document max length for field types, widget types,
......@@ -194,7 +194,7 @@
* definition of a field-type index by providing an index with the
* same name, or to remove it by redefining it as an empty array
* of columns. Overriding field-type indexes should be done
* carefully, for it might seriously affect the site's performance.
* carefully, for it might seriously affect the site's performance.
* - settings: each omitted setting is given the default value defined in
* hook_field_info().
* @throw
......
......@@ -15,7 +15,7 @@ function field_default_form($obj_type, $object, $field, $instance, $items, &$for
// This could be called with no object, as when a UI module creates a
// dummy form to set default values.
if ($object) {
list($id, ,) = field_attach_extract_ids($obj_type, $object);
list($id, , ) = field_attach_extract_ids($obj_type, $object);
}
$addition = array();
......
......@@ -130,7 +130,7 @@ function field_schema() {
'primary key' => array('id'),
'unique keys' => array(
'field_name_bundle' => array('field_name', 'bundle'),
),
),
'indexes' => array(
// used by field_read_instances
'widget_active_deleted' => array('widget_active', 'deleted'),
......
......@@ -101,7 +101,7 @@ function field_help($path, $arg) {
switch ($path) {
case 'admin/help#field':
$output = '<p>' . t('The Field API allows custom data fields to be attached to Drupal objects and takes care of storing, loading, editing, and rendering field data. Any object type (node, user, etc.) can use the Field API to make itself "fieldable" and thus allow fields to be attached to it.') . '</p>';