- Patch #471070 by stella: millions of code style fixes.
parent
a5f42fd007
commit
a24a6c2bba
modules
blog
blogapi
contact
dblog
forum
locale
php
search
statistics
trigger
themes/garland
|
@ -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 @@ class InsertQuery_pgsql extends InsertQuery {
|
|||
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 @@ class MergeQuery extends Query {
|
|||
* 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 @@ abstract class DatabaseSchema {
|
|||
|
||||
/**
|
||||
* Prepare a table or column comment for database query.
|
||||
*
|
||||
*
|
||||
* @param $comment
|
||||
* The comment string to prepare.
|
||||
* @param $length
|
||||
|
|
|
@ -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 ($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));
|
||||
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->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->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'));
|
||||
}
|
||||
|
||||
$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'));
|
||||
}
|
||||
/**
|
||||
* 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>';
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1039,7 +1039,7 @@ class FieldFormTestCase extends DrupalWebTestCase {
|
|||
$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][_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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -114,7 +114,7 @@ function hook_filter($op, $delta = 0, $format = -1, $text = '', $langcode = '',
|
|||
return t('Allows users to post code verbatim using <code> and <?php ?> tags.');
|
||||
|
||||
case 'prepare':
|
||||
// Note: we use [ and ] to replace < > during the filtering process.
|
||||
// Note: we use [ and ] to replace < > during the filtering process.
|
||||
// For more information, see "Temporary placeholders and
|
||||
// delimiters" at http://drupal.org/node/209715.
|
||||
$text = preg_replace('@<code>(.+?)</code>@se', "'[codefilter-code]' . codefilter_escape('\\1') . '[/codefilter-code]'", $text);
|
||||
|
|
|
@ -310,7 +310,7 @@ function filter_formats($index = NULL) {
|
|||
if (!$all) {
|
||||
$or = db_or()->condition('format', variable_get('filter_default_format', 1));
|
||||
foreach ($user->roles as $rid => $role) {
|
||||
$or->condition('roles', '%'. (int)$rid .'%', 'LIKE');
|
||||
$or->condition('roles', '%' . (int)$rid . '%', 'LIKE');
|
||||
}
|
||||
$query->condition($or);
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class FilterAdminTestCase extends DrupalWebTestCase {
|
|||
$this->drupalLogin($web_user);
|
||||
|
||||
$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.
|
||||
$body = $this->randomName();
|
||||
|
|
|
@ -193,11 +193,11 @@ class ForumTestCase extends DrupalWebTestCase {
|
|||
*/
|
||||
function deleteForum($tid) {
|
||||
// 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'));
|
||||
|
||||
|
||||
// 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');
|
||||
}
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ function locale_uninstall() {
|
|||
}
|
||||
// Delete the JavaScript translations directory if empty.
|
||||
@rmdir($locale_js_directory);
|
||||
|
||||
|
||||
// Clear variables.
|
||||
variable_del('language_default');
|
||||
variable_del('language_count');
|
||||
|
@ -234,16 +234,16 @@ function locale_uninstall() {
|
|||
variable_del('language_content_type_negotiation');
|
||||
variable_del('locale_cache_strings');
|
||||
variable_del('locale_js_directory');
|
||||
|
||||
|
||||
foreach (node_get_types() as $type => $content_type) {
|
||||
$setting = variable_del('language_content_type_' . $type);
|
||||
}
|
||||
|
||||
|
||||
// Switch back to English: with a $language->language value different from 'en'
|
||||
// successive calls of t() might result in calling locale(), which in turn might
|
||||
// successive calls of t() might result in calling locale(), which in turn might
|
||||
// try to query the unexisting {locales_source} and {locales_target} tables.
|
||||
drupal_init_language();
|
||||
|
||||
|
||||
// Remove tables.
|
||||
drupal_uninstall_schema('locale');
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ function menu_overview_page() {
|
|||
function theme_menu_admin_overview($title, $name, $description) {
|
||||
$output = check_plain($title);
|
||||
$output .= '<div class="description">' . filter_xss_admin($description) . '</div>';
|
||||
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
|
@ -341,7 +341,7 @@ function menu_node_update($node) {
|
|||
*/
|
||||
function menu_node_delete($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) {
|
||||
menu_link_delete($m['mlid']);
|
||||
}
|
||||
|
@ -358,14 +358,14 @@ function menu_node_prepare($node) {
|
|||
if (isset($node->nid)) {
|
||||
// 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(
|
||||
':path' => 'node/'. $node->nid,
|
||||
':path' => 'node/' . $node->nid,
|
||||
':menu_name' => $menu_name,
|
||||
), 0, 1)
|
||||
->fetchField();
|
||||
// Check all menus if a link does not exist in the default menu.
|
||||
if (!$mlid) {
|
||||
$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)
|
||||
->fetchField();
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ class MenuTestCase extends DrupalWebTestCase {
|
|||
$this->drupalGet('admin/build/menu/add');
|
||||
$menu_name = substr(md5($this->randomName(16)), 0, MENU_MAX_MENU_NAME_LENGTH_UI + 1);
|
||||
$title = $this->randomName(16);
|
||||
$edit = array (
|
||||
$edit = array(
|
||||
'menu_name' => $menu_name,
|
||||
'description' => '',
|
||||
'title' => $title,
|
||||
|
@ -173,7 +173,7 @@ class MenuTestCase extends DrupalWebTestCase {
|
|||
// Toggle menu links.
|
||||
$this->toggleMenuLink($item1);
|
||||
$this->toggleMenuLink($item2);
|
||||
|
||||
|
||||
// Enable a link via the overview form.
|
||||
$this->disableMenuLink($item1);
|
||||
$edit = array();
|
||||
|
@ -181,7 +181,7 @@ class MenuTestCase extends DrupalWebTestCase {
|
|||
// Note in the UI the 'mlid:x[hidden]' form element maps to enabled, or
|
||||
// NOT hidden.
|
||||
$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.
|
||||
$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);
|
||||
|
||||
$title = '!link_' . $this->randomName(16);
|
||||
$edit = array (
|
||||
$edit = array(
|
||||
'menu[link_path]' => $link,
|
||||
'menu[link_title]' => $title,
|
||||
'menu[description]' => '',
|
||||
|
@ -250,7 +250,7 @@ class MenuTestCase extends DrupalWebTestCase {
|
|||
*/
|
||||
function addInvalidMenuLink($menu_name = 'navigation') {
|
||||
foreach (array('-&-', 'admin/user/permissions') as $link_path) {
|
||||
$edit = array (
|
||||
$edit = array(
|
||||
'menu[link_path]' => $link_path,
|
||||
'menu[link_title]' => 'title',
|
||||
);
|
||||
|
|
|
@ -52,7 +52,7 @@ function theme_node_admin_overview($name, $type) {
|
|||
* Generates the node type editing form.
|
||||
*/
|
||||
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)) {
|
||||
// This is a new type. Node module managed types are custom and unlocked.
|
||||
$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(
|
||||
'#type' => 'checkbox',
|
||||
'#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.'),
|
||||
);
|
||||
$form['old_type'] = array(
|
||||
|
|
|
@ -481,7 +481,7 @@ function node_admin_nodes() {
|
|||
$filter = node_build_filter_query();
|
||||
|
||||
$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.
|
||||
$form['options'] = array(
|
||||
|
@ -633,10 +633,10 @@ function node_multiple_delete_confirm(&$form_state, $nodes) {
|
|||
}
|
||||
$form['operation'] = array('#type' => 'hidden', '#value' => 'delete');
|
||||
$form['#submit'][] = 'node_multiple_delete_confirm_submit';
|
||||
$confirm_question = format_plural(count($nodes),
|
||||
'Are you sure you want to delete this item?',
|
||||
$confirm_question = format_plural(count($nodes),
|
||||
'Are you sure you want to delete this item?',
|
||||
'Are you sure you want to delete these items?');
|
||||
return confirm_form($form,
|
||||
return confirm_form($form,
|
||||
$confirm_question,
|
||||
'admin/content/node', t('This action cannot be undone.'),
|
||||
t('Delete'), t('Cancel'));
|
||||
|
|
|
@ -1046,7 +1046,7 @@ function node_save($node) {
|
|||
global $user;
|
||||
|
||||
if (!isset($node->is_new)) {
|
||||
$node->is_new = empty($node->nid);
|
||||
$node->is_new = empty($node->nid);
|
||||
}
|
||||
|
||||
// Apply filters to some default node fields:
|
||||
|
@ -1131,7 +1131,7 @@ function node_save($node) {
|
|||
|
||||
// Update the node access table for this node.
|
||||
node_access_acquire_grants($node);
|
||||
|
||||
|
||||
// Clear internal properties.
|
||||
unset($node->is_new);
|
||||
|
||||
|
@ -1458,14 +1458,14 @@ function _node_rankings() {
|
|||
);
|
||||
if ($ranking = module_invoke_all('ranking')) {
|
||||
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 (isset($values['join']) && !isset($rankings['join'][$values['join']])) {
|
||||
$rankings['join'][$values['join']] = $values['join'];
|
||||
}
|
||||
|
||||
// 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.
|
||||
$rankings['total'] += $node_rank;
|
||||
|
@ -1517,11 +1517,11 @@ function node_search($op = 'search', $keys = NULL) {
|
|||
// Note: reversed to reflect that higher number = higher ranking.
|
||||
$options = drupal_map_assoc(range(0, 10));
|
||||
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'],
|
||||
'#type' => 'select',
|
||||
'#options' => $options,
|
||||
'#default_value' => variable_get('node_rank_'. $var, 0),
|
||||
'#default_value' => variable_get('node_rank_' . $var, 0),
|
||||
);
|
||||
}
|
||||
return $form;
|
||||
|
@ -1578,7 +1578,7 @@ function node_search($op = 'search', $keys = NULL) {
|
|||
$total = $rankings['total'];
|
||||
$arguments2 = $rankings['arguments'];
|
||||
$join2 = implode(' ', $rankings['join']);
|
||||
$select2 = 'SUM('. implode(' + ', $rankings['score']) .') AS calculated_score';
|
||||
$select2 = 'SUM(' . implode(' + ', $rankings['score']) . ') AS calculated_score';
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
foreach($result as $node) {
|
||||
foreach ($result as $node) {
|
||||
_node_index_node($node);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -505,7 +505,7 @@ class PageViewTestCase extends DrupalWebTestCase {
|
|||
|
||||
class NodeTitleXSSTestCase extends DrupalWebTestCase {
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
return array(
|
||||
'name' => t('Node title XSS filtering'),
|
||||
'description' => t('Create a node with dangerous tags in its title and test that they are escaped.'),
|
||||
'group' => t('Node'),
|
||||
|
@ -631,7 +631,7 @@ class NodePostSettingsTestCase extends DrupalWebTestCase {
|
|||
|
||||
/**
|
||||
* Ensure that data added to nodes by other modules appears in RSS feeds.
|
||||
*
|
||||
*
|
||||
* Create a node, enable the node_test module to ensure that extra data is
|
||||
* added to the node->content array, then verify that the data appears on the
|
||||
* sitewide RSS feed at rss.xml.
|
||||
|
@ -688,7 +688,7 @@ class NodeRSSContentTestCase extends DrupalWebTestCase {
|
|||
* Test case to check node save related functionality, including import-save
|
||||
*/
|
||||
class NodeSaveTestCase extends DrupalWebTestCase {
|
||||
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => t('Node save'),
|
||||
|
@ -707,7 +707,7 @@ class NodeSaveTestCase extends DrupalWebTestCase {
|
|||
|
||||
/**
|
||||
* Import test, to check if custom node ids are saved properly.
|
||||
* Workflow:
|
||||
* Workflow:
|
||||
* - first create a piece of content
|
||||
* - save the content
|
||||
* - check if node exists
|
||||
|
@ -716,7 +716,7 @@ class NodeSaveTestCase extends DrupalWebTestCase {
|
|||
// Node ID must be a number that is not in the database.
|
||||
$max_nid = db_result(db_query('SELECT MAX(nid) FROM {node}'));
|
||||
$test_nid = $max_nid + mt_rand(1000, 1000000);
|
||||
$title = $this->randomName(8);
|
||||
$title = $this->randomName(8);
|
||||
$node = array(
|
||||
'title' => $title,
|
||||
'body' => $this->randomName(32),
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* Possible values:
|
||||
* - request: Modify parameters before they are sent to the OpenID provider.
|
||||
* @param $request
|
||||
* An associative array of parameter defaults to which to modify or append.
|
||||
* An associative array of parameter defaults to which to modify or append.
|
||||
* @return
|
||||
* An associative array of parameters to be merged with the default list.
|
||||
*
|
||||
|
|
|
@ -384,14 +384,14 @@ function openid_association($op_endpoint) {
|
|||
$assoc_response['mac_key'] = base64_encode(_openid_dh_xorsecret($shared, $enc_mac_key));
|
||||
}
|
||||
db_insert('openid_association')
|
||||
->fields(array(
|
||||
'idp_endpoint_uri' => $op_endpoint,
|
||||
'session_type' => $assoc_response['session_type'],
|
||||
'assoc_handle' => $assoc_response['assoc_handle'],
|
||||
'assoc_type' => $assoc_response['assoc_type'],
|
||||
'expires_in' => $assoc_response['expires_in'],
|
||||
'mac_key' => $assoc_response['mac_key'],
|
||||
'created' => REQUEST_TIME,
|
||||
->fields(array(
|
||||
'idp_endpoint_uri' => $op_endpoint,
|
||||
'session_type' => $assoc_response['session_type'],
|
||||
'assoc_handle' => $assoc_response['assoc_handle'],
|
||||
'assoc_type' => $assoc_response['assoc_type'],
|
||||
'expires_in' => $assoc_response['expires_in'],
|
||||
'mac_key' => $assoc_response['mac_key'],
|
||||
'created' => REQUEST_TIME,
|
||||
))
|
||||
->execute();
|
||||
$assoc_handle = $assoc_response['assoc_handle'];
|
||||
|
|
|
@ -94,7 +94,7 @@ function openid_user_delete_form($form_state, $account, $aid = 0) {
|
|||
':aid' => $aid,
|
||||
))
|
||||
->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) {
|
||||
|
@ -106,5 +106,5 @@ function openid_user_delete_form_submit(&$form_state, $form_values) {
|
|||
if ($query) {
|
||||
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';
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ class PHPFilterTestCase extends PHPTestCase {
|
|||
$node = $this->createNodeWithCode();
|
||||
|
||||
// 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.'));
|
||||
|
||||
// Change filter to PHP filter and see that PHP code is evaluated.
|
||||
|
@ -92,7 +92,7 @@ class PHPAccessTestCase extends PHPTestCase {
|
|||
$node = $this->createNodeWithCode();
|
||||
|
||||
// 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.'));
|
||||
|
||||
// Make sure that user doesn't have access to filter.
|
||||
|
|
|
@ -397,7 +397,7 @@ function profile_field_delete_submit($form, &$form_state) {
|
|||
*/
|
||||
function profile_admin_settings_autocomplete($string) {
|
||||
$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)) {
|
||||
$matches[$data->category] = check_plain($data->category);
|
||||
}
|
||||
|
|
|
@ -293,8 +293,8 @@ function profile_view_field($user, $field) {
|
|||
// and if a user has permission to view profiles. Note that this check is
|
||||
// necessary because a user may always see their own profile.
|
||||
$browse = user_access('access user profiles')
|
||||
&& (user_access('administer users') || $field->visibility != PROFILE_PRIVATE)
|
||||
&& !empty($field->page);
|
||||
&& (user_access('administer users') || $field->visibility != PROFILE_PRIVATE)
|
||||
&& !empty($field->page);
|
||||
|
||||
if (isset($user->{$field->name}) && $value = $user->{$field->name}) {
|
||||
switch ($field->type) {
|
||||
|
|
|
@ -114,7 +114,7 @@ function profile_autocomplete($field, $string) {
|
|||
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(
|
||||
':fid' => $field,
|
||||
':value' => $string .'%',
|
||||
':value' => $string . '%',
|
||||
), 0, 10);
|
||||
while ($data = db_fetch_object($result)) {
|
||||
$matches[$data->value] = check_plain($data->value);
|
||||
|
|
|
@ -136,7 +136,7 @@ class ProfileTestFields extends ProfileTestCase {
|
|||
'checkbox' => 1,
|
||||
// An underscore is an invalid character in a domain name. The method randomName can
|
||||
// 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.
|
||||
|
@ -263,7 +263,7 @@ class ProfileTestAutocomplete extends ProfileTestCase {
|
|||
|
||||
// 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" />';
|
||||
$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.
|
||||
$this->drupalGet('user/' . $this->admin_user->uid . '/edit/' . $category);
|
||||
|
|
|
@ -52,34 +52,34 @@ define('PREG_CLASS_SEARCH_EXCLUDE',
|
|||
* Matches all 'N' Unicode character classes (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{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{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{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{3038}-\x{303a}\x{3192}-\x{3195}\x{3220}-\x{3229}\x{3251}-\x{325f}\x{3280}-'.
|
||||
'\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{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{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{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{3289}\x{32b1}-\x{32bf}\x{ff10}-\x{ff19}');
|
||||
|
||||
/**
|
||||
* Matches all 'P' Unicode character classes (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{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{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{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{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{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{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{ff1b}\x{ff1f}\x{ff20}\x{ff3b}-\x{ff3d}\x{ff3f}\x{ff5b}\x{ff5d}\x{ff5f}-'.
|
||||
'\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{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{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{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{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{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{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{ff65}');
|
||||
|
||||
/**
|
||||
|
@ -649,7 +649,7 @@ function search_node_update_index($node) {
|
|||
while ($link = db_fetch_object($result)) {
|
||||
$output[] = $link->caption;
|
||||
}
|
||||
if (count($output)) {
|
||||
if (count($output)) {
|
||||
return '<a>(' . implode(', ', $output) . ')</a>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -385,7 +385,7 @@ class SearchBlockTestCase extends DrupalWebTestCase {
|
|||
// Create and login user
|
||||
$admin_user = $this->drupalCreateUser(array('administer blocks', 'search content'));
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
|
||||
// Disable the theme form to avoid confusion.
|
||||
$settings = theme_get_settings();
|
||||
$settings['toggle_search'] = FALSE;
|
||||
|
@ -403,7 +403,7 @@ class SearchBlockTestCase extends DrupalWebTestCase {
|
|||
$this->drupalPost('admin/build/block', $edit, t('Save blocks'));
|
||||
$this->assertText(t('The block settings have been updated.'), t('Block successfully move to footer region.'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test that the search block form works correctly.
|
||||
*/
|
||||
|
|
|
@ -1843,7 +1843,7 @@ class DrupalWebTestCase {
|
|||
$this->plainTextContent = filter_xss($this->content, array());
|
||||
}
|
||||
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);
|
||||
if ($first_occurance === FALSE) {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
/**
|
||||
* A test group has started.
|
||||
*
|
||||
*
|
||||
* This hook is called just once at the beginning of a test group.
|
||||
*
|
||||
* @return
|
||||
|
@ -27,7 +27,7 @@ function hook_test_group_started() {
|
|||
* A test group has finished.
|
||||
*
|
||||
* This hook is called just once at the end of a test group.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* None.
|
||||
*
|
||||
|
@ -37,11 +37,11 @@ function hook_test_group_finished() {
|
|||
|
||||
/**
|
||||
* An individual test has finished.
|
||||
*
|
||||
*
|
||||
* This hook is called when an individual test has finished.
|
||||
*
|
||||
* @param
|
||||
* $results The results of the test as gathered by DrupalWebTestCase.
|
||||
* $results The results of the test as gathered by DrupalWebTestCase.
|
||||
*
|
||||
* @return
|
||||
* None.
|
||||
|
|
|
@ -76,7 +76,7 @@ function simpletest_generate_file($filename, $width, $lines, $type = 'binary-tex
|
|||
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.
|
||||
$path = file_directory_path() . '/simpletest/';
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
function simpletest_help($path, $arg) {
|
||||
switch ($path) {
|
||||
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('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('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('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('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, see the online handbook entry for <a href="@simpletest">SimpleTest module</a>.', array('@simpletest' => 'http://drupal.org/handbook/modules/simpletest')) . '</p>';
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
@ -129,9 +129,9 @@ function simpletest_run_tests($test_list, $reporter = 'drupal') {
|
|||
'init_message' => t('Processing test @num of @max - %test.', array('%test' => $info['name'], '@num' => '1', '@max' => count($test_list))),
|
||||
);
|
||||
batch_set($batch);
|
||||
|
||||
|
||||
module_invoke_all('test_group_started');
|
||||
|
||||
|
||||
// Normally, the forms portion of the batch API takes care of calling
|
||||
// batch_process(), but in the process it saves the whole $form into the
|
||||
// database (which is huge for the test selection form).
|
||||
|
|
|
@ -346,7 +346,7 @@ function simpletest_result_form_submit($form, &$form_state) {
|
|||
* @return HTML output.
|
||||
*/
|
||||
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>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -159,7 +159,7 @@ class SimpleTestFunctionalTest extends DrupalWebTestCase {
|
|||
* Fetch the test id from the test results.
|
||||
*/
|
||||
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)) {
|
||||
return $matches[1];
|
||||
}
|
||||
|
|
|
@ -316,7 +316,7 @@ class DrupalHTTPRequestTestCase extends DrupalWebTestCase {
|
|||
$password = $this->randomName();
|
||||
$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);
|
||||
|
||||
$this->drupalSetContent($result->data);
|
||||
|
@ -711,7 +711,7 @@ class ValidUrlTestCase extends DrupalWebTestCase {
|
|||
foreach ($valid_relative_urls as $url) {
|
||||
$test_url = $front . $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) {
|
||||
$test_url = $front . $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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ function database_test_schema() {
|
|||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
),
|
||||
),
|
||||
'age' => array(
|
||||
'description' => "The person's age",
|
||||
'type' => 'int',
|
||||
|
@ -109,7 +109,7 @@ function database_test_schema() {
|
|||
'description' => 'Simple unique ID.',
|
||||
'type' => 'serial',
|
||||
'not null' => TRUE,
|
||||
),
|
||||
),
|
||||
'blob1' => array(
|
||||
'description' => 'A dummy BLOB field.',
|
||||
'type' => 'blob',
|
||||
|
|
|
@ -769,7 +769,7 @@ class DatabaseUpdateComplexTestCase extends DatabaseTestCase {
|
|||
$num_updated = db_update('test')
|
||||
->condition('name', 'Ringo')
|
||||
->fields(array('job' => 'Musician'))
|
||||
->expression('age', 'age + :age',array(':age' => 4))
|
||||
->expression('age', 'age + :age', array(':age' => 4))
|
||||
->execute();
|
||||
$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();
|
||||
$num_updated = db_update('test')
|
||||
->condition('name', 'Ringo')
|
||||
->expression('age', 'age + :age',array(':age' => 4))
|
||||
->expression('age', 'age + :age', array(':age' => 4))
|
||||
->execute();
|
||||
$this->assertIdentical($num_updated, 1, t('Updated 1 record.'));
|
||||
|
||||
|
@ -1643,7 +1643,7 @@ class DatabaseSelectPagerDefaultTestCase extends DatabaseTestCase {
|
|||
if (!($num_pages * $limit < $count)) {
|
||||
$num_pages--;
|
||||
}
|
||||
|
||||
|
||||
for ($page = 0; $page <= $num_pages; ++$page) {
|
||||
$this->drupalGet('database_test/pager_query_even/' . $limit, array('query' => array('page' => $page)));
|
||||
$data = json_decode($this->drupalGetContent());
|
||||
|
@ -1769,7 +1769,7 @@ class DatabaseSelectTableSortDefaultTestCase extends DatabaseTestCase {
|
|||
$this->assertEqual($last->task, $sort['last'], t('Items appear in the correct order.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Confirm that if a tablesort's orderByHeader is called before another orderBy, that the header happens first.
|
||||
*
|
||||
|
@ -2391,7 +2391,7 @@ class DatabaseInvalidDataTestCase extends DatabaseTestCase {
|
|||
// Ensure the other values were not inserted.
|
||||
$record = db_select('test')
|
||||
->fields('test', array('name', 'age'))
|
||||
->condition('age', array(17, 75),'IN')
|
||||
->condition('age', array(17, 75), 'IN')
|
||||
->execute()->fetchObject();
|
||||
|
||||
$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();
|
||||
$this->assertNotIdentical($saved_age, '19', t('Cannot retrieve DanielB row after commit.'));
|
||||
}
|
||||
catch(Exception $e) {
|
||||
catch (Exception $e) {
|
||||
$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();
|
||||
$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());
|
||||
}
|
||||
}
|
||||
|
@ -2644,7 +2644,7 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
|
|||
$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.'));
|
||||
}
|
||||
catch(Exception $e) {
|
||||
catch (Exception $e) {
|
||||
$this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -705,13 +705,13 @@ class FileDirectoryTest extends FileTestCase {
|
|||
$this->assertDirectoryPermissions($directory, variable_get('file_chmod_directory', 0775));
|
||||
|
||||
// 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();
|
||||
file_check_directory($directory);
|
||||
$this->assertTrue(is_file(file_directory_path() . '/.htaccess'), t('Successfully created the .htaccess file in the files directory.'), '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');
|
||||
}
|
||||
|
||||
|
@ -773,14 +773,14 @@ class FileDirectoryTest extends FileTestCase {
|
|||
// directory.
|
||||
$basename = 'xyz.txt';
|
||||
$directory = 'misc';
|
||||
$original = $directory .'/'. $basename;
|
||||
$original = $directory . '/' . $basename;
|
||||
$path = file_create_filename($basename, $directory);
|
||||
$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.
|
||||
$basename = 'druplicon.png';
|
||||
$original = $directory .'/'. $basename;
|
||||
$expected = $directory .'/druplicon_0.png';
|
||||
$original = $directory . '/' . $basename;
|
||||
$expected = $directory . '/druplicon_0.png';
|
||||
$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');
|
||||
|
||||
|
|
|
@ -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']['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['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.'));
|
||||
|
||||
$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)));
|
||||
}
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
|
|||
$this->assertNoFieldByXPath('//th[@class="select-all"]', '', t('Absence of the "Select all" checkbox.'));
|
||||
|
||||
$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)));
|
||||
}
|
||||
}
|
||||
|
@ -411,7 +411,7 @@ class FormsFormStorageTestCase extends DrupalWebTestCase {
|
|||
* Tests using the form in a usual way.
|
||||
*/
|
||||
function testForm() {
|
||||
|
||||
|
||||
$user = $this->drupalCreateUser(array('access content'));
|
||||
$this->drupalLogin($user);
|
||||
|
||||
|
@ -432,7 +432,7 @@ class FormsFormStorageTestCase extends DrupalWebTestCase {
|
|||
|
||||
$this->drupalPost('form_test/form-storage', array('title' => 'new', 'value' => 'value_is_set'), 'Continue', array('query' => 'cache=1'));
|
||||
$this->assertText('Form constructions: 1', t('The form has been constructed one time till now.'));
|
||||
|
||||
|
||||
$this->drupalPost(NULL, array(), 'Save', array('query' => 'cache=1'));
|
||||
$this->assertText('Form constructions: 2', t('The form has been constructed two times till now.'));
|
||||
$this->assertText('Title: new', t('The form storage has stored the values.'));
|
||||
|
|
|
@ -392,7 +392,7 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
|
|||
}
|
||||
|
||||
// Perform our operation.
|
||||
$function = 'image_'. $values['function'];
|
||||
$function = 'image_' . $values['function'];
|
||||
$arguments = array();
|
||||
$arguments[] = &$image;
|
||||
$arguments = array_merge($arguments, $values['arguments']);
|
||||
|
|
|
@ -143,8 +143,8 @@ class RegistrySkipBodyTestCase extends DrupalWebTestCase {
|
|||
'group' => t('System'),
|
||||
);
|
||||
}
|
||||
|
||||
function testRegistrySkipBody () {
|
||||
|
||||
function testRegistrySkipBody() {
|
||||
// This string contains all three kinds of opening braces.
|
||||
$function = '<?php function foo () { $x = "{$y}"; $x = "${y}"; }';
|
||||
$tokens = token_get_all($function);
|
||||
|
|
|
@ -103,7 +103,7 @@ class SchemaTestCase extends DrupalWebTestCase {
|
|||
|
||||
function tryInsert($table = 'test_table') {
|
||||
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;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
|
|
|
@ -26,13 +26,13 @@ class XMLRPCValidator1IncTestCase extends DrupalWebTestCase {
|
|||
mt_srand();
|
||||
|
||||
|
||||
$array_1 = array(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('moe' => mt_rand(-100,100)),
|
||||
array('moe' => mt_rand(-100,100)),
|
||||
array('larry' => mt_rand(-100,100)));
|
||||
$array_1 = array(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('moe' => mt_rand(-100, 100)),
|
||||
array('moe' => mt_rand(-100, 100)),
|
||||
array('larry' => mt_rand(-100, 100)));
|
||||
shuffle($array_1);
|
||||
$l_res_1 = xmlrpc_test_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');
|
||||
|
||||
|
||||
$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);
|
||||
$r_res_3 = xmlrpc($xml_url, 'validator1.easyStructTest', $struct_3);
|
||||
$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);
|
||||
$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);
|
||||
$string_5 = $this->randomName();
|
||||
$double_5 = (double)(mt_rand(-1000,1000) / 100);
|
||||
$double_5 = (double)(mt_rand(-1000, 1000) / 100);
|
||||
$time_5 = REQUEST_TIME;
|
||||
$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);
|
||||
|
@ -73,10 +73,10 @@ class XMLRPCValidator1IncTestCase extends DrupalWebTestCase {
|
|||
$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();
|
||||
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);
|
||||
|
@ -91,9 +91,9 @@ class XMLRPCValidator1IncTestCase extends DrupalWebTestCase {
|
|||
$ys = (string)$y;
|
||||
$ms = sprintf('%02d', $m);
|
||||
$ds = sprintf('%02d', $d);
|
||||
$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]['curly'] = 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]['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');
|
||||
|
||||
|
||||
$int_8 = mt_rand(-100,100);
|
||||
$int_8 = mt_rand(-100, 100);
|
||||
$l_res_8 = xmlrpc_test_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');
|
||||
|
|
|
@ -61,7 +61,7 @@ function statistics_top_pages() {
|
|||
$query->addExpression('MAX(title)', 'title');
|
||||
$query->addExpression('AVG(timer)', 'average_time');
|
||||
$query->addExpression('SUM(timer)', 'total_time');
|
||||
|
||||
|
||||
$query
|
||||
->fields('accesslog', array('path'))
|
||||
->groupBy('path')
|
||||
|
@ -119,7 +119,7 @@ function statistics_top_visitors() {
|
|||
$count_query = db_select('accesslog');
|
||||
$count_query->addExpression('COUNT(DISTINCT CONCAT(CAST(uid AS char), hostname))');
|
||||
$query->setCountQuery($count_query);
|
||||
|
||||
|
||||
$result = $query->execute();
|
||||
$rows = array();
|
||||
foreach ($result as $account) {
|
||||
|
@ -155,7 +155,7 @@ function statistics_top_referrers() {
|
|||
$query->addExpression('MAX(timestamp)', 'last');
|
||||
$query
|
||||
->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', '', '<>')
|
||||
->groupBy('url')
|
||||
->limit(30)
|
||||
|
@ -164,7 +164,7 @@ function statistics_top_referrers() {
|
|||
$count_query = db_select('accesslog');
|
||||
$count_query->addExpression('COUNT(DISTINCT url)');
|
||||
$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', '', '<>');
|
||||
$query->setCountQuery($count_query);
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ function image_gd_desaturate(stdClass $image) {
|
|||
*/
|
||||
function image_gd_load(stdClass $image) {
|
||||
$extension = str_replace('jpg', 'jpeg', $image->info['extension']);
|
||||
$function = 'imagecreatefrom'. $extension;
|
||||
$function = 'imagecreatefrom' . $extension;
|
||||
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) {
|
||||
$extension = str_replace('jpg', 'jpeg', $image->info['extension']);
|
||||
$function = 'image'. $extension;
|
||||
$function = 'image' . $extension;
|
||||
if (!function_exists($function)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ function system_themes_form() {
|
|||
}
|
||||
else {
|
||||
// Ensure this theme is compatible with this version of core.
|
||||
// Require the 'content' region to make sure the main page
|
||||
// Require the 'content' region to make sure the main page
|
||||
// content has a common place in all themes.
|
||||
if (!isset($theme->info['core']) || ($theme->info['core'] != DRUPAL_CORE_COMPATIBILITY) || (!isset($theme->info['regions']['content']))) {
|
||||
$incompatible_core[] = $theme->name;
|
||||
|
@ -2040,15 +2040,15 @@ function theme_system_modules_fieldset($form) {
|
|||
// If we have help, it becomes the first part
|
||||
// of the description - with CSS, it is float: right'd.
|
||||
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.
|
||||
$description .= drupal_render($module['description']);
|
||||
if ($module['#requires']) {
|
||||
$description .= '<div class="admin-requirements">' . t('Requires: !module-list', array('!module-list' => implode(', ', $module['#requires']))) . '</div>';
|
||||
$description .= '<div class="admin-requirements">' . t('Requires: !module-list', array('!module-list' => implode(', ', $module['#requires']))) . '</div>';
|
||||
}
|
||||
if ($module['#required_by']) {
|
||||
$description .= '<div class="admin-requirements">' . t('Required by: !module-list', array('!module-list' => implode(', ', $module['#required_by']))) . '</div>';
|
||||
$description .= '<div class="admin-requirements">' . t('Required by: !module-list', array('!module-list' => implode(', ', $module['#required_by']))) . '</div>';
|
||||
}
|
||||
$row[] = array('data' => $description, 'class' => 'description');
|
||||
$rows[] = $row;
|
||||
|
@ -2067,7 +2067,7 @@ function theme_system_modules_fieldset($form) {
|
|||
* An HTML string for the message.
|
||||
*/
|
||||
function theme_system_modules_incompatible($message) {
|
||||
return '<div class="incompatible">'. $message .'</div>';
|
||||
return '<div class="incompatible">' . $message . '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -457,7 +457,7 @@ function hook_link($type, $object, $teaser = FALSE) {
|
|||
|
||||
/**
|
||||
* Perform alterations before links on a comment are rendered. One popular use of
|
||||
* this hook is to modify/remove links from other modules. If you want to add a link
|
||||
* this hook is to modify/remove links from other modules. If you want to add a link
|
||||
* to the links section of a node, use hook_link instead.
|
||||
*
|
||||
* @param $links
|
||||
|
@ -1588,13 +1588,13 @@ function hook_install() {
|
|||
* the same directory as mymodule.module. Drupal core's updates are implemented
|
||||
* using the system module as a name and stored in database/updates.inc.
|
||||
*
|
||||
* If your update task is potentially time-consuming, you'll need to implement a
|
||||
* multipass update to avoid PHP timeouts. Multipass updates use the $sandbox
|
||||
* parameter provided by the batch API (normally, $context['sandbox']) to store
|
||||
* information between successive calls, and the $ret['#finished'] return value
|
||||
* If your update task is potentially time-consuming, you'll need to implement a
|
||||
* multipass update to avoid PHP timeouts. Multipass updates use the $sandbox
|
||||
* parameter provided by the batch API (normally, $context['sandbox']) to store
|
||||
* information between successive calls, and the $ret['#finished'] return value
|
||||
* to provide feedback regarding completion level.
|
||||
*
|
||||
* See the batch operations page for more information on how to use the batch API:
|
||||
* See the batch operations page for more information on how to use the batch API:
|
||||
* @link http://drupal.org/node/146843 http://drupal.org/node/146843 @endlink
|
||||
*
|
||||
* @return An array with the results of the calls to update_sql(). An upate
|
||||
|
@ -1611,11 +1611,11 @@ function hook_update_N(&$sandbox = NULL) {
|
|||
$ret = array();
|
||||
db_add_field($ret, 'mytable1', 'newcol', array('type' => 'int', 'not null' => TRUE, 'description' => 'My new integer column.'));
|
||||
return $ret;
|
||||
|
||||
// However, for more complex operations that may take a long time,
|
||||
|
||||
// However, for more complex operations that may take a long time,
|
||||
// you may hook into Batch API as in the following example.
|
||||
$ret = array();
|
||||
|
||||
|
||||
// Update 3 users at a time to have an exclamation point after their names.
|
||||
// (They're really happy that we can do batch API in this hook!)
|
||||
if (!isset($sandbox['progress'])) {
|
||||
|
@ -1633,13 +1633,13 @@ function hook_update_N(&$sandbox = NULL) {
|
|||
foreach ($users as $user) {
|
||||
$user->name .= '!';
|
||||
$ret[] = update_sql("UPDATE {users} SET name = '$user->name' WHERE uid = $user->uid");
|
||||
|
||||
|
||||
$sandbox['progress']++;
|
||||
$sandbox['current_uid'] = $user->uid;
|
||||
}
|
||||
|
||||
$ret['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']);
|
||||
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -2582,9 +2582,9 @@ function system_update_6043() {
|
|||
db_add_index($ret, 'history', 'nid', array('nid'));
|
||||
// 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.
|
||||
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'),),
|
||||
'indexes' => array('list' => array('theme', 'status', 'region', 'weight', 'module'),),));
|
||||
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')),
|
||||
'indexes' => array('list' => array('theme', 'status', 'region', 'weight', 'module'))));
|
||||
db_add_index($ret, 'blocks_roles', 'rid', array('rid'));
|
||||
// Improve filter module indices.
|
||||
db_drop_index($ret, 'filters', 'weight');
|
||||
|
@ -2626,8 +2626,8 @@ function system_update_6043() {
|
|||
if (db_table_exists('profile_values')) {
|
||||
db_drop_index($ret, 'profile_values', 'uid');
|
||||
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' ,'uid', 'uid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0,));
|
||||
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_add_primary_key($ret, 'profile_values', array('uid', 'fid'));
|
||||
}
|
||||
// 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 ($deltas as $old_delta => $new_delta) {
|
||||
// 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,
|
||||
':delta' => $old_delta,
|
||||
))
|
||||
|
@ -3345,7 +3345,7 @@ function system_update_7020() {
|
|||
*/
|
||||
function system_update_7021() {
|
||||
$ret = array();
|
||||
|
||||
|
||||
// Collect a list of themes with blocks.
|
||||
$themes_with_blocks = array();
|
||||
$result = db_query("SELECT s.name FROM {system} s INNER JOIN {block} b ON s.name = b.theme WHERE s.type = 'theme' GROUP by s.name");
|
||||
|
@ -3366,7 +3366,7 @@ function system_update_7021() {
|
|||
}
|
||||
drupal_set_message('The contact form information setting was migrated to <a href="' . url('admin/build/block/configure/block/' . $bid) . '">a custom block</a> and set up to only show on the site-wide contact page. The block was set to use the default text format, which might differ from the HTML based format used before. Please check the block and ensure that the output is right.');
|
||||
}
|
||||
|
||||
|
||||
// Migrate user help setting.
|
||||
if ($user_help = variable_get('user_registration_help', '')) {
|
||||
$bid = db_insert('box')->fields(array('body' => $user_help, 'info' => 'User registration guidelines', 'format' => FILTER_FORMAT_DEFAULT))->execute();
|
||||
|
@ -3376,7 +3376,7 @@ function system_update_7021() {
|
|||
}
|
||||
drupal_set_message('The user registration guidelines were migrated to <a href="' . url('admin/build/block/configure/block/' . $bid) . '">a custom block</a> and set up to only show on the user registration page. The block was set to use the default text format, which might differ from the HTML based format used before. Please check the block and ensure that the output is right.');
|
||||
}
|
||||
|
||||
|
||||
// Migrate site mission setting.
|
||||
if ($mission = variable_get('site_mission')) {
|
||||
$bid = db_insert('box')->fields(array('body' => $mission, 'info' => 'Site mission', 'format' => FILTER_FORMAT_DEFAULT))->execute();
|
||||
|
@ -3394,20 +3394,20 @@ function system_update_7021() {
|
|||
$bid = db_insert('box')->fields(array('body' => $footer_message, 'info' => 'Footer message', 'format' => FILTER_FORMAT_DEFAULT))->execute();
|
||||
foreach ($themes_with_blocks as $theme) {
|
||||
// Add site footer block for themes, which had blocks.
|
||||
// Set low weight, so the block comes early (it used to be
|
||||
// Set low weight, so the block comes early (it used to be
|
||||
// before the other blocks).
|
||||
$ret[] = update_sql("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('block', '" . $bid . "', '" . $theme . "', 1, -10, 'footer', '', -1)");
|
||||
}
|
||||
drupal_set_message('The footer message was migrated to <a href="' . url('admin/build/block/configure/block/' . $bid) . '">a custom block</a> and set up to appear in the footer. The block was set to use the default text format, which might differ from the HTML based format used before. Please check the block and ensure that the output is right. If your theme does not have a footer region, you might need to <a href="' . url('admin/build/block') . '">relocate the block</a>.');
|
||||
}
|
||||
|
||||
|
||||
// Remove the variables (even if they were saved empty on the admin interface),
|
||||
// to avoid keeping clutter in the variables table.
|
||||
variable_del('contact_form_information');
|
||||
variable_del('user_registration_help');
|
||||
variable_del('site_mission');
|
||||
variable_del('site_footer');
|
||||
|
||||
|
||||
// Rebuild theme data, so the new 'help' region is identified.
|
||||
system_theme_data();
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ class DrupalQueue {
|
|||
public static function get($name) {
|
||||
static $queues;
|
||||
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);
|
||||
}
|
||||
return $queues[$name];
|
||||
|
|
|
@ -166,7 +166,7 @@ class ModuleDependencyTestCase extends ModuleTestCase {
|
|||
/**
|
||||
* Attempt to enable translation module without locale enabled.
|
||||
*/
|
||||
function testEnableWithoutDependency () {
|
||||
function testEnableWithoutDependency() {
|
||||
// Attempt to enable content translation without locale enabled.
|
||||
$edit = array();
|
||||
$edit['modules[Core][translation][enable]'] = 'translation';
|
||||
|
@ -208,7 +208,7 @@ class ModuleRequiredTestCase extends ModuleTestCase {
|
|||
function testDisableRequired() {
|
||||
$required_modules = drupal_required_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.
|
||||
$this->assertNoFieldByName('modules[Core][' . $module . '][enable]');
|
||||
}
|
||||
|
@ -453,8 +453,8 @@ class AdminMetaTagTestCase extends DrupalWebTestCase {
|
|||
* Verify that the meta tag HTML is generated correctly.
|
||||
*/
|
||||
public function testMetaTag() {
|
||||
list($version,) = explode('.', VERSION);
|
||||
$string = '<meta name="Generator" content="Drupal ' . $version. ' (http://drupal.org)" />';
|
||||
list($version, ) = explode('.', VERSION);
|
||||
$string = '<meta name="Generator" content="Drupal ' . $version . ' (http://drupal.org)" />';
|
||||
$this->drupalGet('node');
|
||||
$this->assertRaw($string, t('Fingerprinting meta tag generated correctly.'), t('System'));
|
||||
}
|
||||
|
@ -927,7 +927,7 @@ class SystemThemeFunctionalTest extends DrupalWebTestCase {
|
|||
'node_admin_theme' => FALSE,
|
||||
);
|
||||
$this->drupalPost('admin/build/themes', $edit, t('Save configuration'));
|
||||
|
||||
|
||||
$this->drupalGet('admin');
|
||||
$this->assertRaw('themes/garland', t('Administration theme used on an administration page.'));
|
||||
|
||||
|
@ -936,7 +936,7 @@ class SystemThemeFunctionalTest extends DrupalWebTestCase {
|
|||
|
||||
// Reset to the default theme settings.
|
||||
$this->drupalPost('admin/build/themes', array(), t('Reset to defaults'));
|
||||
|
||||
|
||||
$this->drupalGet('admin');
|
||||
$this->assertRaw('themes/garland', t('Site default theme used on administration page.'));
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ function taxonomy_overview_vocabularies_submit($form, &$form_state) {
|
|||
*/
|
||||
function theme_taxonomy_overview_vocabularies($form) {
|
||||
$rows = array();
|
||||
|
||||
|
||||
foreach (element_children($form) as $key) {
|
||||
if (isset($form[$key]['name'])) {
|
||||
$vocabulary = &$form[$key];
|
||||
|
|
|
@ -85,7 +85,7 @@ function taxonomy_node_view($node) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$node->content['links']['terms'] = array(
|
||||
'#type' => 'node_links',
|
||||
'#value' => $links,
|
||||
|
@ -361,7 +361,7 @@ function taxonomy_term_save($term) {
|
|||
$status = drupal_write_record('taxonomy_term_data', $term);
|
||||
module_invoke_all('taxonomy_term_update', $term);
|
||||
}
|
||||
|
||||
|
||||
db_delete('taxonomy_term_relation')
|
||||
->condition(db_or()
|
||||
->condition('tid1', $term->tid)
|
||||
|
@ -409,10 +409,10 @@ function taxonomy_term_save($term) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
$query->values(array(
|
||||
'tid' => $term->tid,
|
||||
'parent' => $parent
|
||||
));
|
||||
$query->values(array(
|
||||
'tid' => $term->tid,
|
||||
'parent' => $parent
|
||||
));
|
||||
}
|
||||
$query->execute();
|
||||
|
||||
|
@ -492,7 +492,7 @@ function taxonomy_term_delete($tid) {
|
|||
|
||||
cache_clear_all();
|
||||
taxonomy_terms_static_reset();
|
||||
|
||||
|
||||
return SAVED_DELETED;
|
||||
}
|
||||
|
||||
|
@ -826,7 +826,7 @@ function taxonomy_node_save($node, $terms) {
|
|||
if (is_array($terms) && !empty($terms)) {
|
||||
$query = db_insert('taxonomy_term_node')
|
||||
->fields(array('nid', 'vid', 'tid'));
|
||||
|
||||
|
||||
foreach ($terms as $term) {
|
||||
if (is_array($term)) {
|
||||
foreach ($term as $tid) {
|
||||
|
@ -1406,7 +1406,7 @@ function taxonomy_term_load($tid) {
|
|||
* A term object. Results are statically cached.
|
||||
*/
|
||||
function taxonomy_get_term_data($tid) {
|
||||
$terms = &drupal_static(__FUNCTION__, array());
|
||||
$terms = &drupal_static(__FUNCTION__, array());
|
||||
|
||||
if (!isset($terms[$tid])) {
|
||||
$terms[$tid] = db_query('SELECT * FROM {taxonomy_term_data} WHERE tid = :tid', array(':tid' => $tid))->fetch();
|
||||
|
@ -1494,7 +1494,7 @@ function theme_taxonomy_term_select($element) {
|
|||
* Whether the nodes are to be used with a pager (the case on most Drupal
|
||||
* pages) or not (in an XML feed, for example).
|
||||
* @param $order
|
||||
* The order clause for the query that retrieve the nodes.
|
||||
* The order clause for the query that retrieve the nodes.
|
||||
* It is important to specifc the table alias (n).
|
||||
*
|
||||
* Example:
|
||||
|
@ -1532,7 +1532,7 @@ function taxonomy_select_nodes($tids = array(), $operator = 'or', $depth = 0, $p
|
|||
$query->condition($alias . '.tid', $tids, 'IN');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($pager) {
|
||||
$count_query = clone $query;
|
||||
$count_query->addExpression('COUNT(DISTINCT n.nid)');
|
||||
|
@ -1540,7 +1540,7 @@ function taxonomy_select_nodes($tids = array(), $operator = 'or', $depth = 0, $p
|
|||
$query = $query
|
||||
->extend('PagerDefault')
|
||||
->limit(variable_get('default_nodes_main', 10));
|
||||
$query->setCountQuery($count_query);
|
||||
$query->setCountQuery($count_query);
|
||||
}
|
||||
else {
|
||||
$query->range(0, variable_get('feed_default_items', 10));
|
||||
|
|
|
@ -134,11 +134,11 @@ function taxonomy_autocomplete($vid, $string = '') {
|
|||
$tags = $query
|
||||
->fields('t', array('tid', 'name'))
|
||||
->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)
|
||||
->execute()
|
||||
->fetchAllKeyed();
|
||||
|
||||
|
||||
$prefix = count($array) ? implode(', ', $array) . ', ' : '';
|
||||
|
||||
foreach ($tags as $tid => $name) {
|
||||
|
|
|
@ -104,7 +104,7 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase {
|
|||
foreach ($vocabularies as $key => $vocabulary) {
|
||||
$vocabulary->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.
|
||||
$this->drupalPost('admin/content/taxonomy/', $edit, t('Save'));
|
||||
|
@ -157,7 +157,7 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase {
|
|||
|
||||
// Delete the vocabulary.
|
||||
$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->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,13 +175,13 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase {
|
|||
*/
|
||||
class TaxonomyVocabularyUnitTest extends TaxonomyWebTestCase {
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => t('Taxonomy vocabularies'),
|
||||
'description' => t('Test loading, saving and deleting vocabularies.'),
|
||||
'group' => t('Taxonomy'),
|
||||
);
|
||||
}
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => t('Taxonomy vocabularies'),
|
||||
'description' => t('Test loading, saving and deleting vocabularies.'),
|
||||
'group' => t('Taxonomy'),
|
||||
);
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
parent::setUp('taxonomy');
|
||||
|
@ -501,7 +501,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
|
|||
$edit['title'] = $this->randomName();
|
||||
// Insert the terms in a comma separated list. Vocabulary 1 is a
|
||||
// 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();
|
||||
$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'));
|
||||
|
|
|
@ -42,7 +42,7 @@ class TriggerContentTestCase extends DrupalWebTestCase {
|
|||
$edit[$info['property']] = !$info['expected'];
|
||||
$this->drupalPost('node/add/page', $edit, t('Save'));
|
||||
// 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.
|
||||
$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'])));
|
||||
|
|
|
@ -25,8 +25,8 @@ function hook_update_status_alter(&$projects) {
|
|||
foreach ($projects as $project => $project_info) {
|
||||
if (isset($settings[$project]) && isset($settings[$project]['check']) &&
|
||||
($settings[$project]['check'] == 'never' ||
|
||||
(isset($project_info['recommended']) &&
|
||||
$settings[$project]['check'] === $project_info['recommended']))) {
|
||||
(isset($project_info['recommended']) &&
|
||||
$settings[$project]['check'] === $project_info['recommended']))) {
|
||||
$projects[$project]['status'] = UPDATE_NOT_CHECKED;
|
||||
$projects[$project]['reason'] = t('Ignored from settings');
|
||||
if (!empty($settings[$project]['notes'])) {
|
||||
|
|
|
@ -402,8 +402,8 @@ function update_calculate_project_data($available) {
|
|||
// Otherwise, ignore unpublished, insecure, or unsupported releases.
|
||||
if ($release['status'] == 'unpublished' ||
|
||||
(isset($release['terms']['Release type']) &&
|
||||
(in_array('Insecure', $release['terms']['Release type']) ||
|
||||
in_array('Unsupported', $release['terms']['Release type'])))) {
|
||||
(in_array('Insecure', $release['terms']['Release type']) ||
|
||||
in_array('Unsupported', $release['terms']['Release type'])))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ function _update_refresh() {
|
|||
// available release data, since even if we fail to fetch new data, we need
|
||||
// to clear out the stale data at this point.
|
||||
_update_cache_clear('update_available_releases');
|
||||
|
||||
|
||||
foreach ($projects as $key => $project) {
|
||||
$url = _update_build_fetch_url($project, $site_key);
|
||||
$xml = drupal_http_request($url);
|
||||
|
|
|
@ -562,7 +562,7 @@ function _update_cache_set($cid, $data, $expire) {
|
|||
->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Retrieve data from the private update status cache table.
|
||||
*
|
||||
* @param $cid
|
||||
|
|
|
@ -127,11 +127,11 @@ function theme_update_report($data) {
|
|||
if ($project['recommended'] !== $project['latest_version']
|
||||
|| !empty($project['also'])
|
||||
|| ($project['install_type'] == 'dev'
|
||||
&& isset($project['dev_version'])
|
||||
&& $project['latest_version'] !== $project['dev_version']
|
||||
&& $project['recommended'] !== $project['dev_version'])
|
||||
&& isset($project['dev_version'])
|
||||
&& $project['latest_version'] !== $project['dev_version']
|
||||
&& $project['recommended'] !== $project['dev_version'])
|
||||
|| (isset($project['security updates'][0])
|
||||
&& $project['recommended'] !== $project['security updates'][0])
|
||||
&& $project['recommended'] !== $project['security updates'][0])
|
||||
) {
|
||||
$version_class .= ' version-recommended-strong';
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ function user_admin_account() {
|
|||
$query->leftJoin('users_roles', 'ur', 'u.uid = ur.uid');
|
||||
$query->condition('u.uid', 0, '<>');
|
||||
user_build_filter_query($query);
|
||||
|
||||
|
||||
$count_query = clone $query;
|
||||
$count_query->addExpression('COUNT(DISTINCT u.uid)');
|
||||
|
||||
|
|
|
@ -399,7 +399,7 @@ function user_save($account, $edit = array(), $category = 'account') {
|
|||
$edit = (array) $edit;
|
||||
|
||||
if (!isset($account->is_new)) {
|
||||
$account->is_new = empty($account->uid);
|
||||
$account->is_new = empty($account->uid);
|
||||
}
|
||||
if (is_object($account) && !$account->is_new) {
|
||||
user_module_invoke('update', $edit, $account, $category);
|
||||
|
@ -597,15 +597,15 @@ function user_validate_name($name) {
|
|||
return t('The username contains an illegal character.');
|
||||
}
|
||||
if (preg_match('/[\x{80}-\x{A0}' . // Non-printable ISO-8859-1 + NBSP
|
||||
'\x{AD}' . // Soft-hyphen
|
||||
'\x{2000}-\x{200F}' . // Various space characters
|
||||
'\x{2028}-\x{202F}' . // Bidirectional text overrides
|
||||
'\x{205F}-\x{206F}' . // Various text hinting characters
|
||||
'\x{FEFF}' . // Byte order mark
|
||||
'\x{FF01}-\x{FF60}' . // Full-width latin
|
||||
'\x{FFF9}-\x{FFFD}' . // Replacement characters
|
||||
'\x{0}-\x{1F}]/u', // NULL byte and control characters
|
||||
$name)) {
|
||||
'\x{AD}' . // Soft-hyphen
|
||||
'\x{2000}-\x{200F}' . // Various space characters
|
||||
'\x{2028}-\x{202F}' . // Bidirectional text overrides
|
||||
'\x{205F}-\x{206F}' . // Various text hinting characters
|
||||
'\x{FEFF}' . // Byte order mark
|
||||
'\x{FF01}-\x{FF60}' . // Full-width latin
|
||||
'\x{FFF9}-\x{FFFD}' . // Replacement characters
|
||||
'\x{0}-\x{1F}]/u', // NULL byte and control characters
|
||||
$name)) {
|
||||
return t('The username contains an illegal character.');
|
||||
}
|
||||
if (drupal_strlen($name) > USERNAME_MAX_LENGTH) {
|
||||
|
@ -787,32 +787,32 @@ function user_is_blocked($name) {
|
|||
* Implementation of hook_perm().
|
||||
*/
|
||||
function user_perm() {
|
||||
return array(
|
||||
'administer permissions' => array(
|
||||
'title' => t('Administer permissions'),
|
||||
'description' => t('Manage the permissions assigned to user roles. %warning', array('%warning' => t('Warning: Give to trusted roles only; this permission has security implications.'))),
|
||||
),
|
||||
'administer users' => array(
|
||||
'title' => t('Administer users'),
|
||||
'description' => t('Manage or block users, and manage their role assignments.'),
|
||||
),
|
||||
'access user profiles' => array(
|
||||
'title' => t('Access user profiles'),
|
||||
'description' => t('View profiles of users on the site, which may contain personal information.'),
|
||||
),
|
||||
'change own username' => array(
|
||||
'title' => t('Change own username'),
|
||||
'description' => t('Select a different username.'),
|
||||
),
|
||||
'cancel account' => array(
|
||||
'title' => t('Cancel account'),
|
||||
'description' => t('Remove or disable own user account and unpublish, anonymize, or remove own submissions depending on the configured <a href="@user-settings-url">user settings</a>.', array('@user-settings-url' => url('admin/user/settings'))),
|
||||
),
|
||||
'select account cancellation method' => array(
|
||||
'title' => t('Select method for cancelling own account'),
|
||||
'description' => t('Select the method for cancelling own user account. %warning', array('%warning' => t('Warning: Give to trusted roles only; this permission has security implications.'))),
|
||||
),
|
||||
);
|
||||
return array(
|
||||
'administer permissions' => array(
|
||||
'title' => t('Administer permissions'),
|
||||
'description' => t('Manage the permissions assigned to user roles. %warning', array('%warning' => t('Warning: Give to trusted roles only; this permission has security implications.'))),
|
||||
),
|
||||
'administer users' => array(
|
||||
'title' => t('Administer users'),
|
||||
'description' => t('Manage or block users, and manage their role assignments.'),
|
||||
),
|
||||
'access user profiles' => array(
|
||||
'title' => t('Access user profiles'),
|
||||
'description' => t('View profiles of users on the site, which may contain personal information.'),
|
||||
),
|
||||
'change own username' => array(
|
||||
'title' => t('Change own username'),
|
||||
'description' => t('Select a different username.'),
|
||||
),
|
||||
'cancel account' => array(
|
||||
'title' => t('Cancel account'),
|
||||
'description' => t('Remove or disable own user account and unpublish, anonymize, or remove own submissions depending on the configured <a href="@user-settings-url">user settings</a>.', array('@user-settings-url' => url('admin/user/settings'))),
|
||||
),
|
||||
'select account cancellation method' => array(
|
||||
'title' => t('Select method for cancelling own account'),
|
||||
'description' => t('Select the method for cancelling own user account. %warning', array('%warning' => t('Warning: Give to trusted roles only; this permission has security implications.'))),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1059,7 +1059,7 @@ function user_block_list() {
|
|||
function user_block_configure($delta = '') {
|
||||
global $user;
|
||||
|
||||
switch($delta) {
|
||||
switch ($delta) {
|
||||
case 'new':
|
||||
$form['user_block_whois_new_count'] = array(
|
||||
'#type' => 'select',
|
||||
|
@ -1678,13 +1678,13 @@ function user_authenticate($form_values = array()) {
|
|||
require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc');
|
||||
if (user_check_password($password, $account)) {
|
||||
if (user_needs_new_hash($account)) {
|
||||
$new_hash = user_hash_password($password);
|
||||
if ($new_hash) {
|
||||
db_update('users')
|
||||
->fields(array('pass' => $new_hash))
|
||||
->condition('uid', $account->uid)
|
||||
->execute();
|
||||
}
|
||||
$new_hash = user_hash_password($password);
|
||||
if ($new_hash) {
|
||||
db_update('users')
|
||||
->fields(array('pass' => $new_hash))
|
||||
->condition('uid', $account->uid)
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
$users = user_load_multiple(array($account->uid), array('status' => '1'));
|
||||
$user = reset($users);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
function user_autocomplete($string = '') {
|
||||
$matches = array();
|
||||
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) {
|
||||
$matches[$user->name] = check_plain($user->name);
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ function user_logout() {
|
|||
* Contains the default "History" profile data for a user.
|
||||
* - $page['content']['#account']:
|
||||
* The user account of the profile being viewed.
|
||||
*
|
||||
*
|
||||
* To theme user profiles, copy modules/user/user-profile.tpl.php
|
||||
* to your theme directory, and edit it as instructed in that file's comments.
|
||||
*/
|
||||
|
@ -169,7 +169,7 @@ function user_view($account) {
|
|||
drupal_set_title($account->name);
|
||||
// Retrieve all profile fields and attach to $account->content.
|
||||
user_build_content($account);
|
||||
|
||||
|
||||
$build = $account->content;
|
||||
$build += array(
|
||||
'#theme' => 'user_profile',
|
||||
|
@ -189,7 +189,7 @@ function user_view($account) {
|
|||
*/
|
||||
function template_preprocess_user_profile(&$variables) {
|
||||
$account = $variables['elements']['#account'];
|
||||
|
||||
|
||||
$variables['profile'] = array();
|
||||
// Sort sections by weight
|
||||
uasort($account->content, 'element_sort');
|
||||
|
|
|
@ -69,9 +69,9 @@ class UserRegistrationTestCase extends DrupalWebTestCase {
|
|||
$edit['pass[pass1]'] = '99999.0';
|
||||
$edit['pass[pass2]'] = '99999';
|
||||
$this->drupalPost(NULL, $edit, t('Save'));
|
||||
$this->assertText(t('The specified passwords do not match.'), t('Type mismatched passwords display an error message.'));
|
||||
$this->assertText(t('The specified passwords do not match.'), t('Type mismatched passwords display an error message.'));
|
||||
$this->assertNoText(t('The changes have been saved.'), t('Save user password with mismatched type in password confirm.'));
|
||||
|
||||
|
||||
// Change user password.
|
||||
$new_pass = user_password();
|
||||
$edit = array();
|
||||
|
@ -522,7 +522,7 @@ class UserPictureTestCase extends DrupalWebTestCase {
|
|||
$file_check = file_check_directory($file_dir, FILE_CREATE_DIRECTORY, 'file_directory_path');
|
||||
|
||||
$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');
|
||||
$this->_directory_test = is_writable($picture_path);
|
||||
|
@ -1026,7 +1026,7 @@ class UserSaveTestCase extends DrupalWebTestCase {
|
|||
// User ID must be a number that is not in the database.
|
||||
$max_uid = db_result(db_query('SELECT MAX(uid) FROM {users}'));
|
||||
$test_uid = $max_uid + mt_rand(1000, 1000000);
|
||||
$test_name = $this->randomName();
|
||||
$test_name = $this->randomName();
|
||||
|
||||
// Create the base user, based on drupalCreateUser().
|
||||
$user = array(
|
||||
|
|
|
@ -45,7 +45,7 @@ function garland_preprocess_page(&$vars) {
|
|||
}
|
||||
$vars['site_title'] = implode(' ', $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);
|
||||
|
||||
|
@ -91,9 +91,9 @@ function garland_node_submitted($node) {
|
|||
function garland_get_ie_styles() {
|
||||
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) {
|
||||
$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;
|
||||
|
|
|
@ -237,7 +237,7 @@ function update_script_selection_form() {
|
|||
foreach (array_keys($updates) as $update) {
|
||||
if ($update > $schema_version) {
|
||||
// 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());
|
||||
$pending[] = "$update - $description";
|
||||
if (!isset($default)) {
|
||||
|
@ -253,7 +253,7 @@ function update_script_selection_form() {
|
|||
'#type' => 'hidden',
|
||||
'#value' => $default,
|
||||
);
|
||||
$form['start'][$module. '_updates'] = array(
|
||||
$form['start'][$module . '_updates'] = array(
|
||||
'#markup' => theme('item_list', $pending, $module . ' module'),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue