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

merge-requests/26/head
Dries Buytaert 2009-05-24 17:39:35 +00:00
parent a5f42fd007
commit a24a6c2bba
93 changed files with 381 additions and 381 deletions

View File

@ -1091,7 +1091,7 @@ class SelectQuery extends Query implements SelectQueryInterface {
// If the table is a subquery, compile it and integrate it into this query. // If the table is a subquery, compile it and integrate it into this query.
if ($table['table'] instanceof SelectQueryInterface) { if ($table['table'] instanceof SelectQueryInterface) {
$table_string = '(' . (string)$table['table'] .')'; $table_string = '(' . (string)$table['table'] . ')';
} }
else { else {
$table_string = '{' . $this->connection->escapeTable($table['table']) . '}'; $table_string = '{' . $this->connection->escapeTable($table['table']) . '}';

View File

@ -1878,7 +1878,7 @@ function file_get_mimetype($filename, $mapping = NULL) {
)); ));
} }
foreach ($mapping as $ext_preg => $mime_match) { foreach ($mapping as $ext_preg => $mime_match) {
if (preg_match('!\.('. $ext_preg .')$!i', $filename)) { if (preg_match('!\.(' . $ext_preg . ')$!i', $filename)) {
return $mime_match; return $mime_match;
} }
} }

View File

@ -414,7 +414,7 @@ function drupal_rewrite_settings($settings = array(), $prefix = '') {
function drupal_get_install_files($module_list = array()) { function drupal_get_install_files($module_list = array()) {
$installs = array(); $installs = array();
foreach ($module_list as $module) { 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; return $installs;
} }
@ -938,7 +938,7 @@ function drupal_check_profile($profile) {
$requirements = array(); $requirements = array();
foreach ($installs as $install) { foreach ($installs as $install) {
require_once DRUPAL_ROOT . '/' . $install->filepath; require_once DRUPAL_ROOT . '/' . $install->filepath;
$function = $install->name. '_requirements'; $function = $install->name . '_requirements';
if (function_exists($function)) { if (function_exists($function)) {
$requirements = array_merge($requirements, $function('install')); $requirements = array_merge($requirements, $function('install'));
} }

View File

@ -542,7 +542,7 @@ function locale_translate_overview_screen() {
// Languages with at least one record in the locale table. // 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"); $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) { 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%)"; $rows[$data->language][$data->textgroup] = $data->translation . '/' . $groupsums[$data->textgroup] . " ($ratio%)";
} }

View File

@ -1839,7 +1839,7 @@ function menu_router_build() {
// a given item came from. // a given item came from.
$callbacks = array(); $callbacks = array();
foreach (module_implements('menu') as $module) { 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)) { if (isset($router_items) && is_array($router_items)) {
foreach (array_keys($router_items) as $path) { foreach (array_keys($router_items) as $path) {
$router_items[$path]['module'] = $module; $router_items[$path]['module'] = $module;

View File

@ -157,7 +157,7 @@ function module_rebuild_cache() {
* without this module. * without this module.
*/ */
function _module_build_dependencies($files) { function _module_build_dependencies($files) {
require_once DRUPAL_ROOT .'/includes/graph.inc'; require_once DRUPAL_ROOT . '/includes/graph.inc';
$roots = $files; $roots = $files;
foreach ($files as $filename => $file) { foreach ($files as $filename => $file) {
$graph[$file->name]['edges'] = array(); $graph[$file->name]['edges'] = array();

View File

@ -895,7 +895,7 @@ function drupal_find_theme_templates($cache, $extension, $path) {
$subtheme_paths = isset($theme_paths[$theme]) ? $theme_paths[$theme] : array(); $subtheme_paths = isset($theme_paths[$theme]) ? $theme_paths[$theme] : array();
// Escape the periods in the extension. // 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 // Because drupal_system_listing works the way it does, we check for real
// templates separately from checking for patterns. // templates separately from checking for patterns.
$files = drupal_system_listing($regex, $path, 'name', 0); $files = drupal_system_listing($regex, $path, 'name', 0);

View File

@ -665,7 +665,7 @@ function install_tasks($profile, $task) {
// to the same address, until the batch finished callback is invoked // to the same address, until the batch finished callback is invoked
// and the task advances to 'locale-initial-import'. // and the task advances to 'locale-initial-import'.
if ($task == 'profile-install-batch') { if ($task == 'profile-install-batch') {
include_once DRUPAL_ROOT .'/includes/batch.inc'; include_once DRUPAL_ROOT . '/includes/batch.inc';
$output = _batch_page(); $output = _batch_page();
} }
@ -917,7 +917,7 @@ function install_check_requirements($profile, $verify) {
'title' => st('Settings file'), 'title' => st('Settings file'),
'value' => st('The settings file does not exist.'), 'value' => st('The settings file does not exist.'),
'severity' => REQUIREMENT_ERROR, '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 { else {

View File

@ -242,7 +242,7 @@ EOF;
function createSampleNodes() { function createSampleNodes() {
// Post 5 articles. // Post 5 articles.
for($i = 0; $i < 5; $i++) { for ($i = 0; $i < 5; $i++) {
$edit = array(); $edit = array();
$edit['title'] = $this->randomName(); $edit['title'] = $this->randomName();
$edit['body'] = $this->randomName(); $edit['body'] = $this->randomName();

View File

@ -36,9 +36,9 @@ class BlogTestCase extends DrupalWebTestCase {
$this->drupalLogin($this->big_user); $this->drupalLogin($this->big_user);
$this->drupalGet('blog/'. $this->big_user->uid); $this->drupalGet('blog/' . $this->big_user->uid);
$this->assertResponse(200); $this->assertResponse(200);
$this->assertTitle(t("@name's blog", array('@name' => $this->big_user->name)) .' | Drupal', t('Blog title was displayed')); $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')); $this->assertText(t('You are not allowed to post a new blog entry.'), t('No new entries can be posted without the right permission'));
} }
@ -48,9 +48,9 @@ class BlogTestCase extends DrupalWebTestCase {
function testBlogPageNoEntries() { function testBlogPageNoEntries() {
$this->drupalLogin($this->big_user); $this->drupalLogin($this->big_user);
$this->drupalGet('blog/'. $this->own_user->uid); $this->drupalGet('blog/' . $this->own_user->uid);
$this->assertResponse(200); $this->assertResponse(200);
$this->assertTitle(t("@name's blog", array('@name' => $this->own_user->name)) .' | Drupal', t('Blog title was displayed')); $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')); $this->assertText(t('!author has not created any blog entries.', array('!author' => $this->own_user->name)), t('Users blog displayed with no entries'));
} }
@ -139,14 +139,14 @@ class BlogTestCase extends DrupalWebTestCase {
// View blog node. // View blog node.
$this->drupalGet('node/' . $node->nid); $this->drupalGet('node/' . $node->nid);
$this->assertResponse(200); $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')); $this->assertText(t('Home ' . $crumb . ' Blogs ' . $crumb . ' @name' . $quote . 's blog', array('@name' => $node_user->name)), t('Breadcrumbs were displayed'));
// View blog edit node. // View blog edit node.
$this->drupalGet('node/' . $node->nid . '/edit'); $this->drupalGet('node/' . $node->nid . '/edit');
$this->assertResponse($response); $this->assertResponse($response);
if ($response == 200) { 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')); $this->assertText(t('Home ' . $crumb . ' @title', array('@title' => $node->title)), t('Breadcrumbs were displayed'));
} }

View File

@ -331,7 +331,7 @@ function blogapi_status_error_check($node, $original_status) {
$node = (object) $node; $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 // 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, // 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); $term_list = array_unique($node->taxonomy);
$params = $term_list; $params = $term_list;
$params[] = $node->type; $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_terms = array();
$found_count = 0; $found_count = 0;
while ($term = db_fetch_object($result)) { while ($term = db_fetch_object($result)) {
@ -768,7 +768,7 @@ function blogapi_admin_settings() {
'#field_suffix' => t('MB') '#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'); $roles = user_roles(FALSE, 'administer content with blog api');
$form['roles'] = array('#type' => 'value', '#value' => $roles); $form['roles'] = array('#type' => 'value', '#value' => $roles);

View File

@ -873,7 +873,7 @@ function comment_save($edit) {
$parent->thread = (string) rtrim((string) $parent->thread, '/'); $parent->thread = (string) rtrim((string) $parent->thread, '/');
// Get the max value in *this* thread. // Get the max value in *this* thread.
$max = db_query("SELECT MAX(thread) FROM {comment} WHERE thread LIKE :thread AND nid = :nid", array( $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'], ':nid' => $edit['nid'],
))->fetchField(); ))->fetchField();

View File

@ -15,7 +15,7 @@
*/ */
function comment_edit($cid) { function comment_edit($cid) {
global $user; 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 = drupal_unpack($comment);
$comment->name = $comment->uid ? $comment->registered_name : $comment->name; $comment->name = $comment->uid ? $comment->registered_name : $comment->name;

View File

@ -143,7 +143,7 @@ class CommentHelperCase extends DrupalWebTestCase {
* Comments per page value. * Comments per page value.
*/ */
function setCommentsPerPage($number) { 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); $reply_loaded = comment_load($reply->id);
$this->assertTrue($this->commentExists($reply, TRUE), t('Reply found.')); $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($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 // Second reply to comment
$this->drupalGet('comment/reply/' . $this->node->nid . '/' . $comment->id); $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 = $this->postComment(NULL, $this->randomName(), $this->randomName());
$reply_loaded = comment_load($reply->id); $reply_loaded = comment_load($reply->id);
$this->assertTrue($this->commentExists($reply, TRUE), t('Second reply found.')); $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. // Edit reply.
$this->drupalGet('comment/edit/' . $reply->id); $this->drupalGet('comment/edit/' . $reply->id);
@ -524,11 +524,11 @@ class CommentApprovalTest extends CommentHelperCase {
// Approve comment. // Approve comment.
$this->drupalLogin($this->admin_user); $this->drupalLogin($this->admin_user);
$this->drupalGet('node/'. $this->node->nid); $this->drupalGet('node/' . $this->node->nid);
$this->clickLink(t('approve')); $this->clickLink(t('approve'));
$this->drupalLogout(); $this->drupalLogout();
$this->drupalGet('node/'. $this->node->nid); $this->drupalGet('node/' . $this->node->nid);
$this->assertTrue($this->commentExists($anonymous_comment4), t('Anonymous comment visible.')); $this->assertTrue($this->commentExists($anonymous_comment4), t('Anonymous comment visible.'));
} }
} }

View File

@ -185,7 +185,7 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
$edit['reply'] = $reply; $edit['reply'] = $reply;
$edit['selected'] = ($selected ? '1' : '0'); $edit['selected'] = ($selected ? '1' : '0');
$this->drupalPost('admin/build/contact/edit/' . $category_id, $edit, t('Save')); $this->drupalPost('admin/build/contact/edit/' . $category_id, $edit, t('Save'));
return($category_id); return ($category_id);
} }
/** /**

View File

@ -197,7 +197,7 @@ class DBLogTestCase extends DrupalWebTestCase {
$this->drupalLogout(); $this->drupalLogout();
// Fetch row ids in watchdog that relate to the user. // Fetch row ids in watchdog that relate to the user.
$result = db_query('SELECT wid FROM {watchdog} WHERE uid = :uid', array(':uid' => $user->uid)); $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; $ids[] = $row->wid;
} }
$count_before = (isset($ids)) ? count($ids) : 0; $count_before = (isset($ids)) ? count($ids) : 0;
@ -225,7 +225,7 @@ class DBLogTestCase extends DrupalWebTestCase {
unset($ids); unset($ids);
// Fetch row ids in watchdog that relate to the user. // Fetch row ids in watchdog that relate to the user.
$result = db_query('SELECT wid FROM {watchdog} WHERE uid = :uid', array(':uid' => $user->uid)); $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; $ids[] = $row->wid;
} }
$this->assertTrue(!isset($ids), t('DBLog contains no records for @name', array('@name' => $user->name))); $this->assertTrue(!isset($ids), t('DBLog contains no records for @name', array('@name' => $user->name)));

View File

@ -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 // This could be called with no object, as when a UI module creates a
// dummy form to set default values. // dummy form to set default values.
if ($object) { if ($object) {
list($id, ,) = field_attach_extract_ids($obj_type, $object); list($id, , ) = field_attach_extract_ids($obj_type, $object);
} }
$addition = array(); $addition = array();

View File

@ -101,7 +101,7 @@ function field_help($path, $arg) {
switch ($path) { switch ($path) {
case 'admin/help#field': 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>'; $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>';
$output .= '<p>' .t('The Field API provides no user interface on its own. Use the Content Construction Kit (CCK) contrib module to manage custom fields via a web browser.') . '</p>'; $output .= '<p>' . t('The Field API provides no user interface on its own. Use the Content Construction Kit (CCK) contrib module to manage custom fields via a web browser.') . '</p>';
return $output; return $output;
} }
} }

View File

@ -1039,7 +1039,7 @@ class FieldFormTestCase extends DrupalWebTestCase {
$this->assertPattern("|$pattern|s", 'Widgets are displayed in the correct order'); $this->assertPattern("|$pattern|s", 'Widgets are displayed in the correct order');
$this->assertFieldByName("$this->field_name[$delta][value]", '', "New widget is displayed"); $this->assertFieldByName("$this->field_name[$delta][value]", '', "New widget is displayed");
$this->assertFieldByName("$this->field_name[$delta][_weight]", $delta, "New widget has the right weight"); $this->assertFieldByName("$this->field_name[$delta][_weight]", $delta, "New widget has the right weight");
$this->assertNoField("$this->field_name[". ($delta + 1) . '][value]', 'No extraneous widget is displayed'); $this->assertNoField("$this->field_name[" . ($delta + 1) . '][value]', 'No extraneous widget is displayed');
} }
/** /**

View File

@ -310,7 +310,7 @@ function filter_formats($index = NULL) {
if (!$all) { if (!$all) {
$or = db_or()->condition('format', variable_get('filter_default_format', 1)); $or = db_or()->condition('format', variable_get('filter_default_format', 1));
foreach ($user->roles as $rid => $role) { foreach ($user->roles as $rid => $role) {
$or->condition('roles', '%'. (int)$rid .'%', 'LIKE'); $or->condition('roles', '%' . (int)$rid . '%', 'LIKE');
} }
$query->condition($or); $query->condition($or);
} }

View File

@ -101,7 +101,7 @@ class FilterAdminTestCase extends DrupalWebTestCase {
$this->drupalLogin($web_user); $this->drupalLogin($web_user);
$this->drupalGet('node/add/page'); $this->drupalGet('node/add/page');
$this->assertRaw('<option value="' . $full .'">Full HTML</option>', t('Full HTML filter accessible.')); $this->assertRaw('<option value="' . $full . '">Full HTML</option>', t('Full HTML filter accessible.'));
// Use filtered HTML and see if it removes tags that arn't allowed. // Use filtered HTML and see if it removes tags that arn't allowed.
$body = $this->randomName(); $body = $this->randomName();

View File

@ -193,11 +193,11 @@ class ForumTestCase extends DrupalWebTestCase {
*/ */
function deleteForum($tid) { function deleteForum($tid) {
// Delete the forum id. // Delete the forum id.
$this->drupalPost('admin/build/forum/edit/forum/'. $tid, array(), t('Delete')); $this->drupalPost('admin/build/forum/edit/forum/' . $tid, array(), t('Delete'));
$this->drupalPost(NULL, NULL, t('Delete')); $this->drupalPost(NULL, NULL, t('Delete'));
// Assert that the forum no longer exists. // Assert that the forum no longer exists.
$this->drupalGet('forum/'. $tid); $this->drupalGet('forum/' . $tid);
$this->assertRaw(t('No forums defined'), 'The forum was not found'); $this->assertRaw(t('No forums defined'), 'The forum was not found');
} }

View File

@ -341,7 +341,7 @@ function menu_node_update($node) {
*/ */
function menu_node_delete($node) { function menu_node_delete($node) {
// Delete all menu module links that point to this node. // Delete all menu module links that point to this node.
$result = db_query("SELECT mlid FROM {menu_links} WHERE link_path = :path AND module = 'menu'", array(':path' => 'node/'. $node->nid), array('fetch' => PDO::FETCH_ASSOC)); $result = db_query("SELECT mlid FROM {menu_links} WHERE link_path = :path AND module = 'menu'", array(':path' => 'node/' . $node->nid), array('fetch' => PDO::FETCH_ASSOC));
foreach ($result as $m) { foreach ($result as $m) {
menu_link_delete($m['mlid']); menu_link_delete($m['mlid']);
} }
@ -358,14 +358,14 @@ function menu_node_prepare($node) {
if (isset($node->nid)) { if (isset($node->nid)) {
// Give priority to the default menu // Give priority to the default menu
$mlid = db_query_range("SELECT mlid FROM {menu_links} WHERE link_path = :path AND menu_name = :menu_name AND module = 'menu' ORDER BY mlid ASC", array( $mlid = db_query_range("SELECT mlid FROM {menu_links} WHERE link_path = :path AND menu_name = :menu_name AND module = 'menu' ORDER BY mlid ASC", array(
':path' => 'node/'. $node->nid, ':path' => 'node/' . $node->nid,
':menu_name' => $menu_name, ':menu_name' => $menu_name,
), 0, 1) ), 0, 1)
->fetchField(); ->fetchField();
// Check all menus if a link does not exist in the default menu. // Check all menus if a link does not exist in the default menu.
if (!$mlid) { if (!$mlid) {
$mlid = db_query_range("SELECT mlid FROM {menu_links} WHERE link_path = :path AND module = 'menu' ORDER BY mlid ASC", array( $mlid = db_query_range("SELECT mlid FROM {menu_links} WHERE link_path = :path AND module = 'menu' ORDER BY mlid ASC", array(
':path' => 'node/'. $node->nid, ':path' => 'node/' . $node->nid,
), 0, 1) ), 0, 1)
->fetchField(); ->fetchField();
} }

View File

@ -100,7 +100,7 @@ class MenuTestCase extends DrupalWebTestCase {
$this->drupalGet('admin/build/menu/add'); $this->drupalGet('admin/build/menu/add');
$menu_name = substr(md5($this->randomName(16)), 0, MENU_MAX_MENU_NAME_LENGTH_UI + 1); $menu_name = substr(md5($this->randomName(16)), 0, MENU_MAX_MENU_NAME_LENGTH_UI + 1);
$title = $this->randomName(16); $title = $this->randomName(16);
$edit = array ( $edit = array(
'menu_name' => $menu_name, 'menu_name' => $menu_name,
'description' => '', 'description' => '',
'title' => $title, 'title' => $title,
@ -181,7 +181,7 @@ class MenuTestCase extends DrupalWebTestCase {
// Note in the UI the 'mlid:x[hidden]' form element maps to enabled, or // Note in the UI the 'mlid:x[hidden]' form element maps to enabled, or
// NOT hidden. // NOT hidden.
$edit['mlid:' . $item1['mlid'] . '[hidden]'] = TRUE; $edit['mlid:' . $item1['mlid'] . '[hidden]'] = TRUE;
$this->drupalPost('admin/build/menu-customize/'. $item1['menu_name'], $edit, t('Save configuration')); $this->drupalPost('admin/build/menu-customize/' . $item1['menu_name'], $edit, t('Save configuration'));
// Verify in the database. // Verify in the database.
$hidden = db_query("SELECT hidden FROM {menu_links} WHERE mlid = :mlid", array(':mlid' => $item1['mlid']))->fetchField(); $hidden = db_query("SELECT hidden FROM {menu_links} WHERE mlid = :mlid", array(':mlid' => $item1['mlid']))->fetchField();
@ -206,7 +206,7 @@ class MenuTestCase extends DrupalWebTestCase {
$this->assertResponse(200); $this->assertResponse(200);
$title = '!link_' . $this->randomName(16); $title = '!link_' . $this->randomName(16);
$edit = array ( $edit = array(
'menu[link_path]' => $link, 'menu[link_path]' => $link,
'menu[link_title]' => $title, 'menu[link_title]' => $title,
'menu[description]' => '', 'menu[description]' => '',
@ -250,7 +250,7 @@ class MenuTestCase extends DrupalWebTestCase {
*/ */
function addInvalidMenuLink($menu_name = 'navigation') { function addInvalidMenuLink($menu_name = 'navigation') {
foreach (array('-&-', 'admin/user/permissions') as $link_path) { foreach (array('-&-', 'admin/user/permissions') as $link_path) {
$edit = array ( $edit = array(
'menu[link_path]' => $link_path, 'menu[link_path]' => $link_path,
'menu[link_title]' => 'title', 'menu[link_title]' => 'title',
); );

View File

@ -52,7 +52,7 @@ function theme_node_admin_overview($name, $type) {
* Generates the node type editing form. * Generates the node type editing form.
*/ */
function node_type_form(&$form_state, $type = NULL) { function node_type_form(&$form_state, $type = NULL) {
drupal_add_js(drupal_get_path('module', 'node') .'/content_types.js'); drupal_add_js(drupal_get_path('module', 'node') . '/content_types.js');
if (!isset($type->type)) { if (!isset($type->type)) {
// This is a new type. Node module managed types are custom and unlocked. // This is a new type. Node module managed types are custom and unlocked.
$type = node_type_set_defaults(array('custom' => 1, 'locked' => 0)); $type = node_type_set_defaults(array('custom' => 1, 'locked' => 0));
@ -167,7 +167,7 @@ function node_type_form(&$form_state, $type = NULL) {
$form['display']['node_submitted'] = array( $form['display']['node_submitted'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('Display post information'), '#title' => t('Display post information'),
'#default_value' => variable_get('node_submitted_'. $type->type, TRUE), '#default_value' => variable_get('node_submitted_' . $type->type, TRUE),
'#description' => t('Enable the <em>submitted by Username on date</em> text.'), '#description' => t('Enable the <em>submitted by Username on date</em> text.'),
); );
$form['old_type'] = array( $form['old_type'] = array(

View File

@ -481,7 +481,7 @@ function node_admin_nodes() {
$filter = node_build_filter_query(); $filter = node_build_filter_query();
$sort = tablesort_sql($header, '', 'n.changed DESC'); $sort = tablesort_sql($header, '', 'n.changed DESC');
$result = pager_query(db_rewrite_sql('SELECT n.*, u.name FROM {node} n '. $filter['join'] .' INNER JOIN {users} u ON n.uid = u.uid '. $filter['where'] . $sort), 50, 0, NULL, $filter['args']); $result = pager_query(db_rewrite_sql('SELECT n.*, u.name FROM {node} n ' . $filter['join'] . ' INNER JOIN {users} u ON n.uid = u.uid ' . $filter['where'] . $sort), 50, 0, NULL, $filter['args']);
// Build the 'Update options' form. // Build the 'Update options' form.
$form['options'] = array( $form['options'] = array(

View File

@ -1458,14 +1458,14 @@ function _node_rankings() {
); );
if ($ranking = module_invoke_all('ranking')) { if ($ranking = module_invoke_all('ranking')) {
foreach ($ranking as $rank => $values) { foreach ($ranking as $rank => $values) {
if ($node_rank = variable_get('node_rank_'. $rank, 0)) { if ($node_rank = variable_get('node_rank_' . $rank, 0)) {
// If the table defined in the ranking isn't already joined, then add it. // If the table defined in the ranking isn't already joined, then add it.
if (isset($values['join']) && !isset($rankings['join'][$values['join']])) { if (isset($values['join']) && !isset($rankings['join'][$values['join']])) {
$rankings['join'][$values['join']] = $values['join']; $rankings['join'][$values['join']] = $values['join'];
} }
// Add the rankings weighted score multiplier value, handling NULL gracefully. // Add the rankings weighted score multiplier value, handling NULL gracefully.
$rankings['score'][] = 'CAST(%f AS DECIMAL) * COALESCE(('. $values['score'] .'), 0)'; $rankings['score'][] = 'CAST(%f AS DECIMAL) * COALESCE((' . $values['score'] . '), 0)';
// Add the the administrator's weighted score multiplier value for this ranking. // Add the the administrator's weighted score multiplier value for this ranking.
$rankings['total'] += $node_rank; $rankings['total'] += $node_rank;
@ -1517,11 +1517,11 @@ function node_search($op = 'search', $keys = NULL) {
// Note: reversed to reflect that higher number = higher ranking. // Note: reversed to reflect that higher number = higher ranking.
$options = drupal_map_assoc(range(0, 10)); $options = drupal_map_assoc(range(0, 10));
foreach (module_invoke_all('ranking') as $var => $values) { foreach (module_invoke_all('ranking') as $var => $values) {
$form['content_ranking']['factors']['node_rank_'. $var] = array( $form['content_ranking']['factors']['node_rank_' . $var] = array(
'#title' => $values['title'], '#title' => $values['title'],
'#type' => 'select', '#type' => 'select',
'#options' => $options, '#options' => $options,
'#default_value' => variable_get('node_rank_'. $var, 0), '#default_value' => variable_get('node_rank_' . $var, 0),
); );
} }
return $form; return $form;
@ -1578,7 +1578,7 @@ function node_search($op = 'search', $keys = NULL) {
$total = $rankings['total']; $total = $rankings['total'];
$arguments2 = $rankings['arguments']; $arguments2 = $rankings['arguments'];
$join2 = implode(' ', $rankings['join']); $join2 = implode(' ', $rankings['join']);
$select2 = 'SUM('. implode(' + ', $rankings['score']) .') AS calculated_score'; $select2 = 'SUM(' . implode(' + ', $rankings['score']) . ') AS calculated_score';
} }
// Do search. // Do search.
@ -2175,7 +2175,7 @@ function node_update_index() {
$result = db_query_range("SELECT n.nid FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid WHERE d.sid IS NULL OR d.reindex <> 0 ORDER BY d.reindex ASC, n.nid ASC", 0, $limit); $result = db_query_range("SELECT n.nid FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid WHERE d.sid IS NULL OR d.reindex <> 0 ORDER BY d.reindex ASC, n.nid ASC", 0, $limit);
foreach($result as $node) { foreach ($result as $node) {
_node_index_node($node); _node_index_node($node);
} }
} }

View File

@ -94,7 +94,7 @@ function openid_user_delete_form($form_state, $account, $aid = 0) {
':aid' => $aid, ':aid' => $aid,
)) ))
->fetchField(); ->fetchField();
return confirm_form(array(), t('Are you sure you want to delete the OpenID %authname for %user?', array('%authname' => $authname, '%user' => $account->name)), 'user/'. $account->uid .'/openid'); return confirm_form(array(), t('Are you sure you want to delete the OpenID %authname for %user?', array('%authname' => $authname, '%user' => $account->name)), 'user/' . $account->uid . '/openid');
} }
function openid_user_delete_form_submit(&$form_state, $form_values) { function openid_user_delete_form_submit(&$form_state, $form_values) {
@ -106,5 +106,5 @@ function openid_user_delete_form_submit(&$form_state, $form_values) {
if ($query) { if ($query) {
drupal_set_message(t('OpenID deleted.')); drupal_set_message(t('OpenID deleted.'));
} }
$form_state['#redirect'] = 'user/'. $form_state['#args'][0]->uid .'/openid'; $form_state['#redirect'] = 'user/' . $form_state['#args'][0]->uid . '/openid';
} }

View File

@ -55,7 +55,7 @@ class PHPFilterTestCase extends PHPTestCase {
$node = $this->createNodeWithCode(); $node = $this->createNodeWithCode();
// Make sure that the PHP code shows up as text. // Make sure that the PHP code shows up as text.
$this->drupalGet('node/'. $node->nid); $this->drupalGet('node/' . $node->nid);
$this->assertText('print', t('PHP code is displayed.')); $this->assertText('print', t('PHP code is displayed.'));
// Change filter to PHP filter and see that PHP code is evaluated. // Change filter to PHP filter and see that PHP code is evaluated.
@ -92,7 +92,7 @@ class PHPAccessTestCase extends PHPTestCase {
$node = $this->createNodeWithCode(); $node = $this->createNodeWithCode();
// Make sure that the PHP code shows up as text. // Make sure that the PHP code shows up as text.
$this->drupalGet('node/'. $node->nid); $this->drupalGet('node/' . $node->nid);
$this->assertText('print', t('PHP code is displayed.')); $this->assertText('print', t('PHP code is displayed.'));
// Make sure that user doesn't have access to filter. // Make sure that user doesn't have access to filter.

View File

@ -397,7 +397,7 @@ function profile_field_delete_submit($form, &$form_state) {
*/ */
function profile_admin_settings_autocomplete($string) { function profile_admin_settings_autocomplete($string) {
$matches = array(); $matches = array();
$result = db_query_range("SELECT category FROM {profile_field} WHERE LOWER(category) LIKE LOWER(:category)", array(':category' => $string .'%'), 0, 10); $result = db_query_range("SELECT category FROM {profile_field} WHERE LOWER(category) LIKE LOWER(:category)", array(':category' => $string . '%'), 0, 10);
while ($data = db_fetch_object($result)) { while ($data = db_fetch_object($result)) {
$matches[$data->category] = check_plain($data->category); $matches[$data->category] = check_plain($data->category);
} }

View File

@ -114,7 +114,7 @@ function profile_autocomplete($field, $string) {
if ($autocomplete_field) { if ($autocomplete_field) {
$result = db_query_range("SELECT value FROM {profile_value} WHERE fid = :fid AND LOWER(value) LIKE LOWER(:value) GROUP BY value ORDER BY value ASC", array( $result = db_query_range("SELECT value FROM {profile_value} WHERE fid = :fid AND LOWER(value) LIKE LOWER(:value) GROUP BY value ORDER BY value ASC", array(
':fid' => $field, ':fid' => $field,
':value' => $string .'%', ':value' => $string . '%',
), 0, 10); ), 0, 10);
while ($data = db_fetch_object($result)) { while ($data = db_fetch_object($result)) {
$matches[$data->value] = check_plain($data->value); $matches[$data->value] = check_plain($data->value);

View File

@ -136,7 +136,7 @@ class ProfileTestFields extends ProfileTestCase {
'checkbox' => 1, 'checkbox' => 1,
// An underscore is an invalid character in a domain name. The method randomName can // An underscore is an invalid character in a domain name. The method randomName can
// return an underscore. // return an underscore.
'url' => 'http://www.' . str_replace('_', '', $this->randomName(10)). '.org', 'url' => 'http://www.' . str_replace('_', '', $this->randomName(10)) . '.org',
); );
// For each field type, create a field, give it a value and delete the field. // For each field type, create a field, give it a value and delete the field.
@ -263,7 +263,7 @@ class ProfileTestAutocomplete extends ProfileTestCase {
// Set some html for what we want to see in the page output later. // Set some html for what we want to see in the page output later.
$autocomplete_html = '<input class="autocomplete" type="hidden" id="' . form_clean_id('edit-' . $field['form_name'] . '-autocomplete') . '" value="' . url('profile/autocomplete/' . $field['fid'], array('absolute' => TRUE)) . '" disabled="disabled" />'; $autocomplete_html = '<input class="autocomplete" type="hidden" id="' . form_clean_id('edit-' . $field['form_name'] . '-autocomplete') . '" value="' . url('profile/autocomplete/' . $field['fid'], array('absolute' => TRUE)) . '" disabled="disabled" />';
$field_html = '<input type="text" maxlength="255" name="' . $field['form_name'] . '" id="'. form_clean_id('edit-' . $field['form_name']) . '" size="60" value="' . $field['value'] . '" class="form-text form-autocomplete required" />'; $field_html = '<input type="text" maxlength="255" name="' . $field['form_name'] . '" id="' . form_clean_id('edit-' . $field['form_name']) . '" size="60" value="' . $field['value'] . '" class="form-text form-autocomplete required" />';
// Check that autocompletion html is found on the user's profile edit page. // Check that autocompletion html is found on the user's profile edit page.
$this->drupalGet('user/' . $this->admin_user->uid . '/edit/' . $category); $this->drupalGet('user/' . $this->admin_user->uid . '/edit/' . $category);

View File

@ -52,34 +52,34 @@ define('PREG_CLASS_SEARCH_EXCLUDE',
* Matches all 'N' Unicode character classes (numbers) * Matches all 'N' Unicode character classes (numbers)
*/ */
define('PREG_CLASS_NUMBERS', define('PREG_CLASS_NUMBERS',
'\x{30}-\x{39}\x{b2}\x{b3}\x{b9}\x{bc}-\x{be}\x{660}-\x{669}\x{6f0}-\x{6f9}'. '\x{30}-\x{39}\x{b2}\x{b3}\x{b9}\x{bc}-\x{be}\x{660}-\x{669}\x{6f0}-\x{6f9}' .
'\x{966}-\x{96f}\x{9e6}-\x{9ef}\x{9f4}-\x{9f9}\x{a66}-\x{a6f}\x{ae6}-\x{aef}'. '\x{966}-\x{96f}\x{9e6}-\x{9ef}\x{9f4}-\x{9f9}\x{a66}-\x{a6f}\x{ae6}-\x{aef}' .
'\x{b66}-\x{b6f}\x{be7}-\x{bf2}\x{c66}-\x{c6f}\x{ce6}-\x{cef}\x{d66}-\x{d6f}'. '\x{b66}-\x{b6f}\x{be7}-\x{bf2}\x{c66}-\x{c6f}\x{ce6}-\x{cef}\x{d66}-\x{d6f}' .
'\x{e50}-\x{e59}\x{ed0}-\x{ed9}\x{f20}-\x{f33}\x{1040}-\x{1049}\x{1369}-'. '\x{e50}-\x{e59}\x{ed0}-\x{ed9}\x{f20}-\x{f33}\x{1040}-\x{1049}\x{1369}-' .
'\x{137c}\x{16ee}-\x{16f0}\x{17e0}-\x{17e9}\x{17f0}-\x{17f9}\x{1810}-\x{1819}'. '\x{137c}\x{16ee}-\x{16f0}\x{17e0}-\x{17e9}\x{17f0}-\x{17f9}\x{1810}-\x{1819}' .
'\x{1946}-\x{194f}\x{2070}\x{2074}-\x{2079}\x{2080}-\x{2089}\x{2153}-\x{2183}'. '\x{1946}-\x{194f}\x{2070}\x{2074}-\x{2079}\x{2080}-\x{2089}\x{2153}-\x{2183}' .
'\x{2460}-\x{249b}\x{24ea}-\x{24ff}\x{2776}-\x{2793}\x{3007}\x{3021}-\x{3029}'. '\x{2460}-\x{249b}\x{24ea}-\x{24ff}\x{2776}-\x{2793}\x{3007}\x{3021}-\x{3029}' .
'\x{3038}-\x{303a}\x{3192}-\x{3195}\x{3220}-\x{3229}\x{3251}-\x{325f}\x{3280}-'. '\x{3038}-\x{303a}\x{3192}-\x{3195}\x{3220}-\x{3229}\x{3251}-\x{325f}\x{3280}-' .
'\x{3289}\x{32b1}-\x{32bf}\x{ff10}-\x{ff19}'); '\x{3289}\x{32b1}-\x{32bf}\x{ff10}-\x{ff19}');
/** /**
* Matches all 'P' Unicode character classes (punctuation) * Matches all 'P' Unicode character classes (punctuation)
*/ */
define('PREG_CLASS_PUNCTUATION', define('PREG_CLASS_PUNCTUATION',
'\x{21}-\x{23}\x{25}-\x{2a}\x{2c}-\x{2f}\x{3a}\x{3b}\x{3f}\x{40}\x{5b}-\x{5d}'. '\x{21}-\x{23}\x{25}-\x{2a}\x{2c}-\x{2f}\x{3a}\x{3b}\x{3f}\x{40}\x{5b}-\x{5d}' .
'\x{5f}\x{7b}\x{7d}\x{a1}\x{ab}\x{b7}\x{bb}\x{bf}\x{37e}\x{387}\x{55a}-\x{55f}'. '\x{5f}\x{7b}\x{7d}\x{a1}\x{ab}\x{b7}\x{bb}\x{bf}\x{37e}\x{387}\x{55a}-\x{55f}' .
'\x{589}\x{58a}\x{5be}\x{5c0}\x{5c3}\x{5f3}\x{5f4}\x{60c}\x{60d}\x{61b}\x{61f}'. '\x{589}\x{58a}\x{5be}\x{5c0}\x{5c3}\x{5f3}\x{5f4}\x{60c}\x{60d}\x{61b}\x{61f}' .
'\x{66a}-\x{66d}\x{6d4}\x{700}-\x{70d}\x{964}\x{965}\x{970}\x{df4}\x{e4f}'. '\x{66a}-\x{66d}\x{6d4}\x{700}-\x{70d}\x{964}\x{965}\x{970}\x{df4}\x{e4f}' .
'\x{e5a}\x{e5b}\x{f04}-\x{f12}\x{f3a}-\x{f3d}\x{f85}\x{104a}-\x{104f}\x{10fb}'. '\x{e5a}\x{e5b}\x{f04}-\x{f12}\x{f3a}-\x{f3d}\x{f85}\x{104a}-\x{104f}\x{10fb}' .
'\x{1361}-\x{1368}\x{166d}\x{166e}\x{169b}\x{169c}\x{16eb}-\x{16ed}\x{1735}'. '\x{1361}-\x{1368}\x{166d}\x{166e}\x{169b}\x{169c}\x{16eb}-\x{16ed}\x{1735}' .
'\x{1736}\x{17d4}-\x{17d6}\x{17d8}-\x{17da}\x{1800}-\x{180a}\x{1944}\x{1945}'. '\x{1736}\x{17d4}-\x{17d6}\x{17d8}-\x{17da}\x{1800}-\x{180a}\x{1944}\x{1945}' .
'\x{2010}-\x{2027}\x{2030}-\x{2043}\x{2045}-\x{2051}\x{2053}\x{2054}\x{2057}'. '\x{2010}-\x{2027}\x{2030}-\x{2043}\x{2045}-\x{2051}\x{2053}\x{2054}\x{2057}' .
'\x{207d}\x{207e}\x{208d}\x{208e}\x{2329}\x{232a}\x{23b4}-\x{23b6}\x{2768}-'. '\x{207d}\x{207e}\x{208d}\x{208e}\x{2329}\x{232a}\x{23b4}-\x{23b6}\x{2768}-' .
'\x{2775}\x{27e6}-\x{27eb}\x{2983}-\x{2998}\x{29d8}-\x{29db}\x{29fc}\x{29fd}'. '\x{2775}\x{27e6}-\x{27eb}\x{2983}-\x{2998}\x{29d8}-\x{29db}\x{29fc}\x{29fd}' .
'\x{3001}-\x{3003}\x{3008}-\x{3011}\x{3014}-\x{301f}\x{3030}\x{303d}\x{30a0}'. '\x{3001}-\x{3003}\x{3008}-\x{3011}\x{3014}-\x{301f}\x{3030}\x{303d}\x{30a0}' .
'\x{30fb}\x{fd3e}\x{fd3f}\x{fe30}-\x{fe52}\x{fe54}-\x{fe61}\x{fe63}\x{fe68}'. '\x{30fb}\x{fd3e}\x{fd3f}\x{fe30}-\x{fe52}\x{fe54}-\x{fe61}\x{fe63}\x{fe68}' .
'\x{fe6a}\x{fe6b}\x{ff01}-\x{ff03}\x{ff05}-\x{ff0a}\x{ff0c}-\x{ff0f}\x{ff1a}'. '\x{fe6a}\x{fe6b}\x{ff01}-\x{ff03}\x{ff05}-\x{ff0a}\x{ff0c}-\x{ff0f}\x{ff1a}' .
'\x{ff1b}\x{ff1f}\x{ff20}\x{ff3b}-\x{ff3d}\x{ff3f}\x{ff5b}\x{ff5d}\x{ff5f}-'. '\x{ff1b}\x{ff1f}\x{ff20}\x{ff3b}-\x{ff3d}\x{ff3f}\x{ff5b}\x{ff5d}\x{ff5f}-' .
'\x{ff65}'); '\x{ff65}');
/** /**

View File

@ -1843,7 +1843,7 @@ class DrupalWebTestCase {
$this->plainTextContent = filter_xss($this->content, array()); $this->plainTextContent = filter_xss($this->content, array());
} }
if (!$message) { if (!$message) {
$message = '"' . $text . '"'. ($be_unique ? ' found only once' : ' found more than once'); $message = '"' . $text . '"' . ($be_unique ? ' found only once' : ' found more than once');
} }
$first_occurance = strpos($this->plainTextContent, $text); $first_occurance = strpos($this->plainTextContent, $text);
if ($first_occurance === FALSE) { if ($first_occurance === FALSE) {

View File

@ -76,7 +76,7 @@ function simpletest_generate_file($filename, $width, $lines, $type = 'binary-tex
break; break;
} }
} }
$text = wordwrap($text, $width - 1, "\n", TRUE) ."\n"; // Add \n for symetrical file. $text = wordwrap($text, $width - 1, "\n", TRUE) . "\n"; // Add \n for symetrical file.
// Create filename. // Create filename.
$path = file_directory_path() . '/simpletest/'; $path = file_directory_path() . '/simpletest/';

View File

@ -12,11 +12,11 @@
function simpletest_help($path, $arg) { function simpletest_help($path, $arg) {
switch ($path) { switch ($path) {
case 'admin/help#simpletest': case 'admin/help#simpletest':
$output = '<p>' . t('The SimpleTest module is a framework for running automated unit tests in Drupal. It can be used to verify a working state of Drupal before and after any code changes, or as a means for developers to write and execute tests for their modules.') .'</p>'; $output = '<p>' . t('The SimpleTest module is a framework for running automated unit tests in Drupal. It can be used to verify a working state of Drupal before and after any code changes, or as a means for developers to write and execute tests for their modules.') . '</p>';
$output .= '<p>' . t('Visit <a href="@admin-simpletest">Administer >> Site building >> SimpleTest</a> to display a list of available tests. For comprehensive testing, select <em>all</em> tests, or individually select tests for more targeted testing. Note that it might take several minutes for all tests to complete.)', array('@admin-simpletest' => url('admin/development/testing'))) .'</p>'; $output .= '<p>' . t('Visit <a href="@admin-simpletest">Administer >> Site building >> SimpleTest</a> to display a list of available tests. For comprehensive testing, select <em>all</em> tests, or individually select tests for more targeted testing. Note that it might take several minutes for all tests to complete.)', array('@admin-simpletest' => url('admin/development/testing'))) . '</p>';
$output .= '<p>' . t('After the tests have run, a message will be displayed next to each test group indicating whether tests within it passed, failed, or had exceptions. A pass means that a test returned the expected results, while fail means that it did not. An exception normally indicates an error outside of the test, such as a PHP warning or notice. If there were fails or exceptions, the results are expanded, and the tests that had issues will be indicated in red or pink rows. Use these results to refine your code and tests until all tests return a pass.') .'</p>'; $output .= '<p>' . t('After the tests have run, a message will be displayed next to each test group indicating whether tests within it passed, failed, or had exceptions. A pass means that a test returned the expected results, while fail means that it did not. An exception normally indicates an error outside of the test, such as a PHP warning or notice. If there were fails or exceptions, the results are expanded, and the tests that had issues will be indicated in red or pink rows. Use these results to refine your code and tests until all tests return a pass.') . '</p>';
$output .= '<p>' . t('For more information on creating and modifying your own tests, see the <a href="@simpletest-api">SimpleTest API Documentation</a> in the Drupal handbook.', array('@simpletest-api' => 'http://drupal.org/simpletest')) .'</p>'; $output .= '<p>' . t('For more information on creating and modifying your own tests, see the <a href="@simpletest-api">SimpleTest API Documentation</a> in the Drupal handbook.', array('@simpletest-api' => 'http://drupal.org/simpletest')) . '</p>';
$output .= '<p>' . t('For more information, see the online handbook entry for <a href="@simpletest">SimpleTest module</a>.', array('@simpletest' => 'http://drupal.org/handbook/modules/simpletest')) .'</p>'; $output .= '<p>' . t('For more information, see the online handbook entry for <a href="@simpletest">SimpleTest module</a>.', array('@simpletest' => 'http://drupal.org/handbook/modules/simpletest')) . '</p>';
return $output; return $output;
} }
} }

View File

@ -346,7 +346,7 @@ function simpletest_result_form_submit($form, &$form_state) {
* @return HTML output. * @return HTML output.
*/ */
function theme_simpletest_result_summary($form) { function theme_simpletest_result_summary($form) {
return '<div class="simpletest-' . ($form['#ok'] ? 'pass' : 'fail') .'">' . _simpletest_format_summary_line($form) . '</div>'; return '<div class="simpletest-' . ($form['#ok'] ? 'pass' : 'fail') . '">' . _simpletest_format_summary_line($form) . '</div>';
} }
/** /**

View File

@ -159,7 +159,7 @@ class SimpleTestFunctionalTest extends DrupalWebTestCase {
* Fetch the test id from the test results. * Fetch the test id from the test results.
*/ */
function getTestIdFromResults() { function getTestIdFromResults() {
foreach($this->childTestResults['assertions'] as $assertion) { foreach ($this->childTestResults['assertions'] as $assertion) {
if (preg_match('@^Test ID is ([0-9]*)\.$@', $assertion['message'], $matches)) { if (preg_match('@^Test ID is ([0-9]*)\.$@', $assertion['message'], $matches)) {
return $matches[1]; return $matches[1];
} }

View File

@ -316,7 +316,7 @@ class DrupalHTTPRequestTestCase extends DrupalWebTestCase {
$password = $this->randomName(); $password = $this->randomName();
$url = url('system-test/auth', array('absolute' => TRUE)); $url = url('system-test/auth', array('absolute' => TRUE));
$auth = str_replace('http://', 'http://' . $username . ':' . $password .'@', $url); $auth = str_replace('http://', 'http://' . $username . ':' . $password . '@', $url);
$result = drupal_http_request($auth); $result = drupal_http_request($auth);
$this->drupalSetContent($result->data); $this->drupalSetContent($result->data);
@ -711,7 +711,7 @@ class ValidUrlTestCase extends DrupalWebTestCase {
foreach ($valid_relative_urls as $url) { foreach ($valid_relative_urls as $url) {
$test_url = $front . $url; $test_url = $front . $url;
$valid_url = valid_url($test_url); $valid_url = valid_url($test_url);
$this->assertTrue($valid_url,t('@url is a valid url.', array('@url' => $test_url))); $this->assertTrue($valid_url, t('@url is a valid url.', array('@url' => $test_url)));
} }
} }
} }
@ -730,7 +730,7 @@ class ValidUrlTestCase extends DrupalWebTestCase {
foreach ($invalid_relative_urls as $url) { foreach ($invalid_relative_urls as $url) {
$test_url = $front . $url; $test_url = $front . $url;
$valid_url = valid_url($test_url); $valid_url = valid_url($test_url);
$this->assertFALSE($valid_url,t('@url is NOT a valid url.', array('@url' => $test_url))); $this->assertFALSE($valid_url, t('@url is NOT a valid url.', array('@url' => $test_url)));
} }
} }
} }

View File

@ -769,7 +769,7 @@ class DatabaseUpdateComplexTestCase extends DatabaseTestCase {
$num_updated = db_update('test') $num_updated = db_update('test')
->condition('name', 'Ringo') ->condition('name', 'Ringo')
->fields(array('job' => 'Musician')) ->fields(array('job' => 'Musician'))
->expression('age', 'age + :age',array(':age' => 4)) ->expression('age', 'age + :age', array(':age' => 4))
->execute(); ->execute();
$this->assertIdentical($num_updated, 1, t('Updated 1 record.')); $this->assertIdentical($num_updated, 1, t('Updated 1 record.'));
@ -790,7 +790,7 @@ class DatabaseUpdateComplexTestCase extends DatabaseTestCase {
$before_age = db_query("SELECT age FROM {test} WHERE name = 'Ringo'")->fetchField(); $before_age = db_query("SELECT age FROM {test} WHERE name = 'Ringo'")->fetchField();
$num_updated = db_update('test') $num_updated = db_update('test')
->condition('name', 'Ringo') ->condition('name', 'Ringo')
->expression('age', 'age + :age',array(':age' => 4)) ->expression('age', 'age + :age', array(':age' => 4))
->execute(); ->execute();
$this->assertIdentical($num_updated, 1, t('Updated 1 record.')); $this->assertIdentical($num_updated, 1, t('Updated 1 record.'));
@ -2391,7 +2391,7 @@ class DatabaseInvalidDataTestCase extends DatabaseTestCase {
// Ensure the other values were not inserted. // Ensure the other values were not inserted.
$record = db_select('test') $record = db_select('test')
->fields('test', array('name', 'age')) ->fields('test', array('name', 'age'))
->condition('age', array(17, 75),'IN') ->condition('age', array(17, 75), 'IN')
->execute()->fetchObject(); ->execute()->fetchObject();
$this->assertFalse($record, t('The rest of the insert aborted as expected.')); $this->assertFalse($record, t('The rest of the insert aborted as expected.'));
@ -2596,7 +2596,7 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
$saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'DanielB'))->fetchField(); $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'DanielB'))->fetchField();
$this->assertNotIdentical($saved_age, '19', t('Cannot retrieve DanielB row after commit.')); $this->assertNotIdentical($saved_age, '19', t('Cannot retrieve DanielB row after commit.'));
} }
catch(Exception $e) { catch (Exception $e) {
$this->fail($e->getMessage()); $this->fail($e->getMessage());
} }
} }
@ -2622,7 +2622,7 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
$saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'DanielB'))->fetchField(); $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'DanielB'))->fetchField();
$this->assertIdentical($saved_age, '19', t('DanielB not rolled back, since transactions are not supported.')); $this->assertIdentical($saved_age, '19', t('DanielB not rolled back, since transactions are not supported.'));
} }
catch(Exception $e) { catch (Exception $e) {
$this->fail($e->getMessage()); $this->fail($e->getMessage());
} }
} }
@ -2644,7 +2644,7 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
$saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'DanielA'))->fetchField(); $saved_age = db_query("SELECT age FROM {test} WHERE name = :name", array(':name' => 'DanielA'))->fetchField();
$this->assertIdentical($saved_age, '19', t('Can retrieve DanielA row after commit.')); $this->assertIdentical($saved_age, '19', t('Can retrieve DanielA row after commit.'));
} }
catch(Exception $e) { catch (Exception $e) {
$this->fail($e->getMessage()); $this->fail($e->getMessage());
} }
} }

View File

@ -705,13 +705,13 @@ class FileDirectoryTest extends FileTestCase {
$this->assertDirectoryPermissions($directory, variable_get('file_chmod_directory', 0775)); $this->assertDirectoryPermissions($directory, variable_get('file_chmod_directory', 0775));
// Remove .htaccess file to then test that it gets re-created. // Remove .htaccess file to then test that it gets re-created.
@unlink(file_directory_path() .'/.htaccess'); @unlink(file_directory_path() . '/.htaccess');
$directory = file_directory_path(); $directory = file_directory_path();
file_check_directory($directory); file_check_directory($directory);
$this->assertTrue(is_file(file_directory_path() . '/.htaccess'), t('Successfully created the .htaccess file in the files directory.'), 'File'); $this->assertTrue(is_file(file_directory_path() . '/.htaccess'), t('Successfully created the .htaccess file in the files directory.'), 'File');
// Verify contents of .htaccess file. // Verify contents of .htaccess file.
$file = file_get_contents(file_directory_path() .'/.htaccess'); $file = file_get_contents(file_directory_path() . '/.htaccess');
$this->assertEqual($file, "SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006\nOptions None\nOptions +FollowSymLinks", t('The .htaccess file contains the proper content.'), 'File'); $this->assertEqual($file, "SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006\nOptions None\nOptions +FollowSymLinks", t('The .htaccess file contains the proper content.'), 'File');
} }
@ -773,14 +773,14 @@ class FileDirectoryTest extends FileTestCase {
// directory. // directory.
$basename = 'xyz.txt'; $basename = 'xyz.txt';
$directory = 'misc'; $directory = 'misc';
$original = $directory .'/'. $basename; $original = $directory . '/' . $basename;
$path = file_create_filename($basename, $directory); $path = file_create_filename($basename, $directory);
$this->assertEqual($path, $original, t('New filepath %new equals %original.', array('%new' => $path, '%original' => $original)), 'File'); $this->assertEqual($path, $original, t('New filepath %new equals %original.', array('%new' => $path, '%original' => $original)), 'File');
// Then we test against a file that already exists within that directory. // Then we test against a file that already exists within that directory.
$basename = 'druplicon.png'; $basename = 'druplicon.png';
$original = $directory .'/'. $basename; $original = $directory . '/' . $basename;
$expected = $directory .'/druplicon_0.png'; $expected = $directory . '/druplicon_0.png';
$path = file_create_filename($basename, $directory); $path = file_create_filename($basename, $directory);
$this->assertEqual($path, $expected, t('Creating a new filepath from %original equals %new.', array('%new' => $path, '%original' => $original)), 'File'); $this->assertEqual($path, $expected, t('Creating a new filepath from %original equals %new.', array('%new' => $path, '%original' => $original)), 'File');

View File

@ -42,7 +42,7 @@ class FormsTestCase extends DrupalWebTestCase {
$elements['radios']['element'] = array('#title' => $this->randomName(), '#type' => 'radios', '#required' => TRUE, '#options' => array($this->randomName(), $this->randomName(), $this->randomName())); $elements['radios']['element'] = array('#title' => $this->randomName(), '#type' => 'radios', '#required' => TRUE, '#options' => array($this->randomName(), $this->randomName(), $this->randomName()));
$elements['radios']['empty_values'] = $empty_arrays; $elements['radios']['empty_values'] = $empty_arrays;
$elements['checkboxes']['element'] = array('#title' => $this->randomName(), '#type' => 'checkboxes', '#required' => TRUE,'#options' => array($this->randomName(), $this->randomName(), $this->randomName())); $elements['checkboxes']['element'] = array('#title' => $this->randomName(), '#type' => 'checkboxes', '#required' => TRUE, '#options' => array($this->randomName(), $this->randomName(), $this->randomName()));
$elements['checkboxes']['empty_values'] = $empty_arrays; $elements['checkboxes']['empty_values'] = $empty_arrays;
$elements['select']['element'] = array('#title' => $this->randomName(), '#type' => 'select', '#required' => TRUE, '#options' => array($this->randomName(), $this->randomName(), $this->randomName())); $elements['select']['element'] = array('#title' => $this->randomName(), '#type' => 'select', '#required' => TRUE, '#options' => array($this->randomName(), $this->randomName(), $this->randomName()));
@ -142,7 +142,7 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
$this->assertFieldByXPath('//th[@class="select-all"]', NULL, t('Presence of the "Select all" checkbox.')); $this->assertFieldByXPath('//th[@class="select-all"]', NULL, t('Presence of the "Select all" checkbox.'));
$rows = array('row1', 'row2', 'row3'); $rows = array('row1', 'row2', 'row3');
foreach($rows as $row) { foreach ($rows as $row) {
$this->assertFieldByXPath('//input[@type="checkbox"]', $row, t('Checkbox for value @row.', array('@row' => $row))); $this->assertFieldByXPath('//input[@type="checkbox"]', $row, t('Checkbox for value @row.', array('@row' => $row)));
} }
} }
@ -159,7 +159,7 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
$this->assertNoFieldByXPath('//th[@class="select-all"]', '', t('Absence of the "Select all" checkbox.')); $this->assertNoFieldByXPath('//th[@class="select-all"]', '', t('Absence of the "Select all" checkbox.'));
$rows = array('row1', 'row2', 'row3'); $rows = array('row1', 'row2', 'row3');
foreach($rows as $row) { foreach ($rows as $row) {
$this->assertFieldByXPath('//input[@type="radio"]', $row, t('Radio button for value @row.', array('@row' => $row))); $this->assertFieldByXPath('//input[@type="radio"]', $row, t('Radio button for value @row.', array('@row' => $row)));
} }
} }

View File

@ -392,7 +392,7 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
} }
// Perform our operation. // Perform our operation.
$function = 'image_'. $values['function']; $function = 'image_' . $values['function'];
$arguments = array(); $arguments = array();
$arguments[] = &$image; $arguments[] = &$image;
$arguments = array_merge($arguments, $values['arguments']); $arguments = array_merge($arguments, $values['arguments']);

View File

@ -144,7 +144,7 @@ class RegistrySkipBodyTestCase extends DrupalWebTestCase {
); );
} }
function testRegistrySkipBody () { function testRegistrySkipBody() {
// This string contains all three kinds of opening braces. // This string contains all three kinds of opening braces.
$function = '<?php function foo () { $x = "{$y}"; $x = "${y}"; }'; $function = '<?php function foo () { $x = "{$y}"; $x = "${y}"; }';
$tokens = token_get_all($function); $tokens = token_get_all($function);

View File

@ -103,7 +103,7 @@ class SchemaTestCase extends DrupalWebTestCase {
function tryInsert($table = 'test_table') { function tryInsert($table = 'test_table') {
try { try {
db_query("INSERT INTO {" . $table . "} (id) VALUES (:id)", array(':id' => mt_rand(10,20))); db_query("INSERT INTO {" . $table . "} (id) VALUES (:id)", array(':id' => mt_rand(10, 20)));
return TRUE; return TRUE;
} }
catch (Exception $e) { catch (Exception $e) {

View File

@ -26,13 +26,13 @@ class XMLRPCValidator1IncTestCase extends DrupalWebTestCase {
mt_srand(); mt_srand();
$array_1 = array(array('curly' => mt_rand(-100,100)), $array_1 = array(array('curly' => mt_rand(-100, 100)),
array('curly' => mt_rand(-100,100)), array('curly' => mt_rand(-100, 100)),
array('larry' => mt_rand(-100,100)), array('larry' => mt_rand(-100, 100)),
array('larry' => mt_rand(-100,100)), array('larry' => mt_rand(-100, 100)),
array('moe' => mt_rand(-100,100)), array('moe' => mt_rand(-100, 100)),
array('moe' => mt_rand(-100,100)), array('moe' => mt_rand(-100, 100)),
array('larry' => mt_rand(-100,100))); array('larry' => mt_rand(-100, 100)));
shuffle($array_1); shuffle($array_1);
$l_res_1 = xmlrpc_test_arrayOfStructsTest($array_1); $l_res_1 = xmlrpc_test_arrayOfStructsTest($array_1);
$r_res_1 = xmlrpc($xml_url, 'validator1.arrayOfStructsTest', $array_1); $r_res_1 = xmlrpc($xml_url, 'validator1.arrayOfStructsTest', $array_1);
@ -45,7 +45,7 @@ class XMLRPCValidator1IncTestCase extends DrupalWebTestCase {
$this->assertIdentical($l_res_2, $r_res_2, 'count the entities test: %s'); $this->assertIdentical($l_res_2, $r_res_2, 'count the entities test: %s');
$struct_3 = array('moe' => mt_rand(-100,100), 'larry' => mt_rand(-100,100), 'curly' => mt_rand(-100,100), 'homer' => mt_rand(-100,100)); $struct_3 = array('moe' => mt_rand(-100, 100), 'larry' => mt_rand(-100, 100), 'curly' => mt_rand(-100, 100), 'homer' => mt_rand(-100, 100));
$l_res_3 = xmlrpc_test_easyStructTest($struct_3); $l_res_3 = xmlrpc_test_easyStructTest($struct_3);
$r_res_3 = xmlrpc($xml_url, 'validator1.easyStructTest', $struct_3); $r_res_3 = xmlrpc($xml_url, 'validator1.easyStructTest', $struct_3);
$this->assertIdentical($l_res_3, $r_res_3, 'easy struct test: %s'); $this->assertIdentical($l_res_3, $r_res_3, 'easy struct test: %s');
@ -59,10 +59,10 @@ class XMLRPCValidator1IncTestCase extends DrupalWebTestCase {
$r_res_4 = xmlrpc($xml_url, 'validator1.echoStructTest', $struct_4); $r_res_4 = xmlrpc($xml_url, 'validator1.echoStructTest', $struct_4);
$this->assertIdentical($l_res_4, $r_res_4, 'echo struct test: %s'); $this->assertIdentical($l_res_4, $r_res_4, 'echo struct test: %s');
$int_5 = mt_rand(-100,100); $int_5 = mt_rand(-100, 100);
$bool_5 = (($int_5 % 2) == 0); $bool_5 = (($int_5 % 2) == 0);
$string_5 = $this->randomName(); $string_5 = $this->randomName();
$double_5 = (double)(mt_rand(-1000,1000) / 100); $double_5 = (double)(mt_rand(-1000, 1000) / 100);
$time_5 = REQUEST_TIME; $time_5 = REQUEST_TIME;
$base64_5 = $this->randomName(100); $base64_5 = $this->randomName(100);
$l_res_5 = xmlrpc_test_manyTypesTest($int_5, $bool_5, $string_5, $double_5, xmlrpc_date($time_5), $base64_5); $l_res_5 = xmlrpc_test_manyTypesTest($int_5, $bool_5, $string_5, $double_5, xmlrpc_date($time_5), $base64_5);
@ -73,10 +73,10 @@ class XMLRPCValidator1IncTestCase extends DrupalWebTestCase {
$this->assertEqual($l_res_5, $r_res_5, 'many types test: %s'); $this->assertEqual($l_res_5, $r_res_5, 'many types test: %s');
$size = mt_rand(100,200); $size = mt_rand(100, 200);
$array_6 = array(); $array_6 = array();
for ($i = 0; $i < $size; $i++) { for ($i = 0; $i < $size; $i++) {
$array_6[] = $this->randomName(mt_rand(8,12)); $array_6[] = $this->randomName(mt_rand(8, 12));
} }
$l_res_6 = xmlrpc_test_moderateSizeArrayCheck($array_6); $l_res_6 = xmlrpc_test_moderateSizeArrayCheck($array_6);
@ -91,9 +91,9 @@ class XMLRPCValidator1IncTestCase extends DrupalWebTestCase {
$ys = (string)$y; $ys = (string)$y;
$ms = sprintf('%02d', $m); $ms = sprintf('%02d', $m);
$ds = sprintf('%02d', $d); $ds = sprintf('%02d', $d);
$struct_7[$ys][$ms][$ds]['moe'] = mt_rand(-100,100); $struct_7[$ys][$ms][$ds]['moe'] = mt_rand(-100, 100);
$struct_7[$ys][$ms][$ds]['larry'] = mt_rand(-100,100); $struct_7[$ys][$ms][$ds]['larry'] = mt_rand(-100, 100);
$struct_7[$ys][$ms][$ds]['curly'] = mt_rand(-100,100); $struct_7[$ys][$ms][$ds]['curly'] = mt_rand(-100, 100);
} }
} }
} }
@ -102,7 +102,7 @@ class XMLRPCValidator1IncTestCase extends DrupalWebTestCase {
$this->assertIdentical($l_res_7, $r_res_7, 'nested struct test: %s'); $this->assertIdentical($l_res_7, $r_res_7, 'nested struct test: %s');
$int_8 = mt_rand(-100,100); $int_8 = mt_rand(-100, 100);
$l_res_8 = xmlrpc_test_simpleStructReturnTest($int_8); $l_res_8 = xmlrpc_test_simpleStructReturnTest($int_8);
$r_res_8 = xmlrpc($xml_url, 'validator1.simpleStructReturnTest', $int_8); $r_res_8 = xmlrpc($xml_url, 'validator1.simpleStructReturnTest', $int_8);
$this->assertIdentical($l_res_8, $r_res_8, 'nested struct test: %s'); $this->assertIdentical($l_res_8, $r_res_8, 'nested struct test: %s');

View File

@ -155,7 +155,7 @@ function statistics_top_referrers() {
$query->addExpression('MAX(timestamp)', 'last'); $query->addExpression('MAX(timestamp)', 'last');
$query $query
->fields('a', array('url')) ->fields('a', array('url'))
->where('LOWER(url) NOT LIKE :host', array(':host' => '%'. $_SERVER['HTTP_HOST'] .'%')) ->where('LOWER(url) NOT LIKE :host', array(':host' => '%' . $_SERVER['HTTP_HOST'] . '%'))
->condition('url', '', '<>') ->condition('url', '', '<>')
->groupBy('url') ->groupBy('url')
->limit(30) ->limit(30)
@ -164,7 +164,7 @@ function statistics_top_referrers() {
$count_query = db_select('accesslog'); $count_query = db_select('accesslog');
$count_query->addExpression('COUNT(DISTINCT url)'); $count_query->addExpression('COUNT(DISTINCT url)');
$count_query $count_query
->where('LOWER(url) NOT LIKE :host', array(':host' => '%'. $_SERVER['HTTP_HOST'] .'%')) ->where('LOWER(url) NOT LIKE :host', array(':host' => '%' . $_SERVER['HTTP_HOST'] . '%'))
->condition('url', '', '<>'); ->condition('url', '', '<>');
$query->setCountQuery($count_query); $query->setCountQuery($count_query);

View File

@ -235,7 +235,7 @@ function image_gd_desaturate(stdClass $image) {
*/ */
function image_gd_load(stdClass $image) { function image_gd_load(stdClass $image) {
$extension = str_replace('jpg', 'jpeg', $image->info['extension']); $extension = str_replace('jpg', 'jpeg', $image->info['extension']);
$function = 'imagecreatefrom'. $extension; $function = 'imagecreatefrom' . $extension;
return (function_exists($function) && $image->resource = $function($image->source)); return (function_exists($function) && $image->resource = $function($image->source));
} }
@ -255,7 +255,7 @@ function image_gd_load(stdClass $image) {
*/ */
function image_gd_save(stdClass $image, $destination) { function image_gd_save(stdClass $image, $destination) {
$extension = str_replace('jpg', 'jpeg', $image->info['extension']); $extension = str_replace('jpg', 'jpeg', $image->info['extension']);
$function = 'image'. $extension; $function = 'image' . $extension;
if (!function_exists($function)) { if (!function_exists($function)) {
return FALSE; return FALSE;
} }

View File

@ -2040,7 +2040,7 @@ function theme_system_modules_fieldset($form) {
// If we have help, it becomes the first part // If we have help, it becomes the first part
// of the description - with CSS, it is float: right'd. // of the description - with CSS, it is float: right'd.
if (isset($module['help'])) { if (isset($module['help'])) {
$description = '<div class="module-help">'. drupal_render($module['help']) .'</div>'; $description = '<div class="module-help">' . drupal_render($module['help']) . '</div>';
} }
// Add the description, along with any modules it requires. // Add the description, along with any modules it requires.
$description .= drupal_render($module['description']); $description .= drupal_render($module['description']);
@ -2067,7 +2067,7 @@ function theme_system_modules_fieldset($form) {
* An HTML string for the message. * An HTML string for the message.
*/ */
function theme_system_modules_incompatible($message) { function theme_system_modules_incompatible($message) {
return '<div class="incompatible">'. $message .'</div>'; return '<div class="incompatible">' . $message . '</div>';
} }
/** /**

View File

@ -2582,9 +2582,9 @@ function system_update_6043() {
db_add_index($ret, 'history', 'nid', array('nid')); db_add_index($ret, 'history', 'nid', array('nid'));
// Change length of theme field in {blocks} to be consistent with module, and // Change length of theme field in {blocks} to be consistent with module, and
// to avoid a MySQL error regarding a too-long index. Also add new indices. // to avoid a MySQL error regarding a too-long index. Also add new indices.
db_change_field($ret, 'blocks', 'theme', 'theme', array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => ''),array( db_change_field($ret, 'blocks', 'theme', 'theme', array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => ''), array(
'unique keys' => array('tmd' => array('theme', 'module', 'delta'),), 'unique keys' => array('tmd' => array('theme', 'module', 'delta')),
'indexes' => array('list' => array('theme', 'status', 'region', 'weight', 'module'),),)); 'indexes' => array('list' => array('theme', 'status', 'region', 'weight', 'module'))));
db_add_index($ret, 'blocks_roles', 'rid', array('rid')); db_add_index($ret, 'blocks_roles', 'rid', array('rid'));
// Improve filter module indices. // Improve filter module indices.
db_drop_index($ret, 'filters', 'weight'); db_drop_index($ret, 'filters', 'weight');
@ -2626,8 +2626,8 @@ function system_update_6043() {
if (db_table_exists('profile_values')) { if (db_table_exists('profile_values')) {
db_drop_index($ret, 'profile_values', 'uid'); db_drop_index($ret, 'profile_values', 'uid');
db_drop_index($ret, 'profile_values', 'fid'); db_drop_index($ret, 'profile_values', 'fid');
db_change_field($ret,'profile_values' ,'fid', 'fid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0,), array('indexes' => array('fid' => array('fid'),))); db_change_field($ret,'profile_values' ,'fid', 'fid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), array('indexes' => array('fid' => array('fid'))));
db_change_field($ret,'profile_values' ,'uid', 'uid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0,)); db_change_field($ret,'profile_values' ,'uid', 'uid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
db_add_primary_key($ret, 'profile_values', array('uid', 'fid')); db_add_primary_key($ret, 'profile_values', array('uid', 'fid'));
} }
// Alter a statistics module table to add an index. // Alter a statistics module table to add an index.
@ -2941,7 +2941,7 @@ function system_update_7004(&$sandbox) {
foreach ($renamed_deltas as $module => $deltas) { foreach ($renamed_deltas as $module => $deltas) {
foreach ($deltas as $old_delta => $new_delta) { foreach ($deltas as $old_delta => $new_delta) {
// Only do the update if the old block actually exists. // Only do the update if the old block actually exists.
$block_exists = db_query("SELECT COUNT(*) FROM {" . $table . "} WHERE module = :module AND delta = :delta",array( $block_exists = db_query("SELECT COUNT(*) FROM {" . $table . "} WHERE module = :module AND delta = :delta", array(
':module' => $module, ':module' => $module,
':delta' => $old_delta, ':delta' => $old_delta,
)) ))

View File

@ -62,7 +62,7 @@ class DrupalQueue {
public static function get($name) { public static function get($name) {
static $queues; static $queues;
if (!isset($queues[$name])) { if (!isset($queues[$name])) {
$class = variable_get('queue_module_'. $name, 'System') . 'Queue'; $class = variable_get('queue_module_' . $name, 'System') . 'Queue';
$queues[$name] = new $class($name); $queues[$name] = new $class($name);
} }
return $queues[$name]; return $queues[$name];

View File

@ -166,7 +166,7 @@ class ModuleDependencyTestCase extends ModuleTestCase {
/** /**
* Attempt to enable translation module without locale enabled. * Attempt to enable translation module without locale enabled.
*/ */
function testEnableWithoutDependency () { function testEnableWithoutDependency() {
// Attempt to enable content translation without locale enabled. // Attempt to enable content translation without locale enabled.
$edit = array(); $edit = array();
$edit['modules[Core][translation][enable]'] = 'translation'; $edit['modules[Core][translation][enable]'] = 'translation';
@ -208,7 +208,7 @@ class ModuleRequiredTestCase extends ModuleTestCase {
function testDisableRequired() { function testDisableRequired() {
$required_modules = drupal_required_modules(); $required_modules = drupal_required_modules();
$this->drupalGet('admin/build/modules'); $this->drupalGet('admin/build/modules');
foreach($required_modules as $module) { foreach ($required_modules as $module) {
// Check to make sure the checkbox for required module is not found. // Check to make sure the checkbox for required module is not found.
$this->assertNoFieldByName('modules[Core][' . $module . '][enable]'); $this->assertNoFieldByName('modules[Core][' . $module . '][enable]');
} }
@ -453,8 +453,8 @@ class AdminMetaTagTestCase extends DrupalWebTestCase {
* Verify that the meta tag HTML is generated correctly. * Verify that the meta tag HTML is generated correctly.
*/ */
public function testMetaTag() { public function testMetaTag() {
list($version,) = explode('.', VERSION); list($version, ) = explode('.', VERSION);
$string = '<meta name="Generator" content="Drupal ' . $version. ' (http://drupal.org)" />'; $string = '<meta name="Generator" content="Drupal ' . $version . ' (http://drupal.org)" />';
$this->drupalGet('node'); $this->drupalGet('node');
$this->assertRaw($string, t('Fingerprinting meta tag generated correctly.'), t('System')); $this->assertRaw($string, t('Fingerprinting meta tag generated correctly.'), t('System'));
} }

View File

@ -134,7 +134,7 @@ function taxonomy_autocomplete($vid, $string = '') {
$tags = $query $tags = $query
->fields('t', array('tid', 'name')) ->fields('t', array('tid', 'name'))
->condition('t.vid', $vid) ->condition('t.vid', $vid)
->where("LOWER(t.name) LIKE LOWER(:last_string)", array(':last_string' => '%'. $last_string .'%')) ->where("LOWER(t.name) LIKE LOWER(:last_string)", array(':last_string' => '%' . $last_string . '%'))
->range(0, 10) ->range(0, 10)
->execute() ->execute()
->fetchAllKeyed(); ->fetchAllKeyed();

View File

@ -104,7 +104,7 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase {
foreach ($vocabularies as $key => $vocabulary) { foreach ($vocabularies as $key => $vocabulary) {
$vocabulary->weight = -$vocabulary->weight; $vocabulary->weight = -$vocabulary->weight;
$vocabularies[$key]->weight = $vocabulary->weight; $vocabularies[$key]->weight = $vocabulary->weight;
$edit[$key .'[weight]'] = $vocabulary->weight; $edit[$key . '[weight]'] = $vocabulary->weight;
} }
// Saving the new weights via the interface. // Saving the new weights via the interface.
$this->drupalPost('admin/content/taxonomy/', $edit, t('Save')); $this->drupalPost('admin/content/taxonomy/', $edit, t('Save'));
@ -157,7 +157,7 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase {
// Delete the vocabulary. // Delete the vocabulary.
$edit = array(); $edit = array();
$this->drupalPost('admin/content/taxonomy/' .$vid, $edit, t('Delete')); $this->drupalPost('admin/content/taxonomy/' . $vid, $edit, t('Delete'));
$this->assertRaw(t('Are you sure you want to delete the vocabulary %name?', array('%name' => $vocabulary->name)), t('[confirm deletion] Asks for confirmation.')); $this->assertRaw(t('Are you sure you want to delete the vocabulary %name?', array('%name' => $vocabulary->name)), t('[confirm deletion] Asks for confirmation.'));
$this->assertText(t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'), t('[confirm deletion] Inform that all terms will be deleted.')); $this->assertText(t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'), t('[confirm deletion] Inform that all terms will be deleted.'));
@ -175,7 +175,7 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase {
*/ */
class TaxonomyVocabularyUnitTest extends TaxonomyWebTestCase { class TaxonomyVocabularyUnitTest extends TaxonomyWebTestCase {
public static function getInfo() { public static function getInfo() {
return array( return array(
'name' => t('Taxonomy vocabularies'), 'name' => t('Taxonomy vocabularies'),
'description' => t('Test loading, saving and deleting vocabularies.'), 'description' => t('Test loading, saving and deleting vocabularies.'),
@ -501,7 +501,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
$edit['title'] = $this->randomName(); $edit['title'] = $this->randomName();
// Insert the terms in a comma separated list. Vocabulary 1 is a // Insert the terms in a comma separated list. Vocabulary 1 is a
// free-tagging field created by the default profile. // free-tagging field created by the default profile.
$edit['taxonomy[tags][' . $this->vocabulary->vid .']'] = implode(', ', $terms); $edit['taxonomy[tags][' . $this->vocabulary->vid . ']'] = implode(', ', $terms);
$edit['body'] = $this->randomName(); $edit['body'] = $this->randomName();
$this->drupalPost('node/add/article', $edit, t('Save')); $this->drupalPost('node/add/article', $edit, t('Save'));
$this->assertRaw(t('@type %title has been created.', array('@type' => t('Article'), '%title' => $edit['title'])), t('The node was created successfully')); $this->assertRaw(t('@type %title has been created.', array('@type' => t('Article'), '%title' => $edit['title'])), t('The node was created successfully'));

View File

@ -42,7 +42,7 @@ class TriggerContentTestCase extends DrupalWebTestCase {
$edit[$info['property']] = !$info['expected']; $edit[$info['property']] = !$info['expected'];
$this->drupalPost('node/add/page', $edit, t('Save')); $this->drupalPost('node/add/page', $edit, t('Save'));
// Make sure the text we want appears. // Make sure the text we want appears.
$this->assertRaw(t('!post %title has been created.', array ('!post' => 'Page', '%title' => $edit['title'])), t('Make sure the page has actually been created')); $this->assertRaw(t('!post %title has been created.', array('!post' => 'Page', '%title' => $edit['title'])), t('Make sure the page has actually been created'));
// Action should have been fired. // Action should have been fired.
$loaded_node = $this->drupalGetNodeByTitle($edit['title']);; $loaded_node = $this->drupalGetNodeByTitle($edit['title']);;
$this->assertTrue($loaded_node->$info['property'] == $info['expected'], t('Make sure the @action action fired.', array('@action' => $info['name']))); $this->assertTrue($loaded_node->$info['property'] == $info['expected'], t('Make sure the @action action fired.', array('@action' => $info['name'])));

View File

@ -1059,7 +1059,7 @@ function user_block_list() {
function user_block_configure($delta = '') { function user_block_configure($delta = '') {
global $user; global $user;
switch($delta) { switch ($delta) {
case 'new': case 'new':
$form['user_block_whois_new_count'] = array( $form['user_block_whois_new_count'] = array(
'#type' => 'select', '#type' => 'select',

View File

@ -12,7 +12,7 @@
function user_autocomplete($string = '') { function user_autocomplete($string = '') {
$matches = array(); $matches = array();
if ($string) { if ($string) {
$result = db_query_range("SELECT name FROM {users} WHERE LOWER(name) LIKE LOWER(:name)", array(':name' => $string .'%'), 0, 10); $result = db_query_range("SELECT name FROM {users} WHERE LOWER(name) LIKE LOWER(:name)", array(':name' => $string . '%'), 0, 10);
foreach ($result as $user) { foreach ($result as $user) {
$matches[$user->name] = check_plain($user->name); $matches[$user->name] = check_plain($user->name);
} }

View File

@ -522,7 +522,7 @@ class UserPictureTestCase extends DrupalWebTestCase {
$file_check = file_check_directory($file_dir, FILE_CREATE_DIRECTORY, 'file_directory_path'); $file_check = file_check_directory($file_dir, FILE_CREATE_DIRECTORY, 'file_directory_path');
$picture_dir = variable_get('user_picture_path', 'pictures'); $picture_dir = variable_get('user_picture_path', 'pictures');
$picture_path = $file_dir . '/' .$picture_dir; $picture_path = $file_dir . '/' . $picture_dir;
$pic_check = file_check_directory($picture_path, FILE_CREATE_DIRECTORY, 'user_picture_path'); $pic_check = file_check_directory($picture_path, FILE_CREATE_DIRECTORY, 'user_picture_path');
$this->_directory_test = is_writable($picture_path); $this->_directory_test = is_writable($picture_path);

View File

@ -45,7 +45,7 @@ function garland_preprocess_page(&$vars) {
} }
$vars['site_title'] = implode(' ', $site_fields); $vars['site_title'] = implode(' ', $site_fields);
if (!empty($site_fields)) { if (!empty($site_fields)) {
$site_fields[0] = '<span>'. $site_fields[0] .'</span>'; $site_fields[0] = '<span>' . $site_fields[0] . '</span>';
} }
$vars['site_html'] = implode(' ', $site_fields); $vars['site_html'] = implode(' ', $site_fields);
@ -91,9 +91,9 @@ function garland_node_submitted($node) {
function garland_get_ie_styles() { function garland_get_ie_styles() {
global $language; global $language;
$ie_styles = '<link type="text/css" rel="stylesheet" media="all" href="' . base_path() . path_to_theme() . '/fix-ie.css" />'. "\n"; $ie_styles = '<link type="text/css" rel="stylesheet" media="all" href="' . base_path() . path_to_theme() . '/fix-ie.css" />' . "\n";
if ($language->direction == LANGUAGE_RTL) { if ($language->direction == LANGUAGE_RTL) {
$ie_styles .= ' <style type="text/css" media="all">@import "' . base_path() . path_to_theme() . '/fix-ie-rtl.css";</style>'. "\n"; $ie_styles .= ' <style type="text/css" media="all">@import "' . base_path() . path_to_theme() . '/fix-ie-rtl.css";</style>' . "\n";
} }
return $ie_styles; return $ie_styles;

View File

@ -237,7 +237,7 @@ function update_script_selection_form() {
foreach (array_keys($updates) as $update) { foreach (array_keys($updates) as $update) {
if ($update > $schema_version) { if ($update > $schema_version) {
// The description for an update comes from its Doxygen. // The description for an update comes from its Doxygen.
$func = new ReflectionFunction($module. '_update_'. $update); $func = new ReflectionFunction($module . '_update_' . $update);
$description = str_replace(array("\n", '*', '/'), '', $func->getDocComment()); $description = str_replace(array("\n", '*', '/'), '', $func->getDocComment());
$pending[] = "$update - $description"; $pending[] = "$update - $description";
if (!isset($default)) { if (!isset($default)) {
@ -253,7 +253,7 @@ function update_script_selection_form() {
'#type' => 'hidden', '#type' => 'hidden',
'#value' => $default, '#value' => $default,
); );
$form['start'][$module. '_updates'] = array( $form['start'][$module . '_updates'] = array(
'#markup' => theme('item_list', $pending, $module . ' module'), '#markup' => theme('item_list', $pending, $module . ' module'),
); );
} }