From 1026fc619dc44a6b218d112885b2700277db97ce Mon Sep 17 00:00:00 2001 From: CodeLingoBot Date: Fri, 5 Apr 2019 20:02:09 +1300 Subject: [PATCH] Change PHP keywords to comply with PSR2 Signed-off-by: CodeLingoBot --- install.php | 90 +++---- .../block/block-admin-display-form.tpl.php | 2 +- modules/simpletest/drupal_web_test_case.php | 230 +++++++++--------- sites/default/default.settings.php | 2 +- update.php | 76 +++--- 5 files changed, 200 insertions(+), 200 deletions(-) diff --git a/install.php b/install.php index 2d0837af77f..2bea19e0404 100644 --- a/install.php +++ b/install.php @@ -22,7 +22,7 @@ function install_main() { // The user agent header is used to pass a database prefix in the request when // running tests. However, for security reasons, it is imperative that no // installation be permitted using such a prefix. - if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], "simpletest") !== FALSE) { + if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], "simpletest") !== false) { header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); exit; } @@ -43,7 +43,7 @@ function install_main() { include_once './includes/module.inc'; $module_list['system']['filename'] = 'modules/system/system.module'; $module_list['filter']['filename'] = 'modules/filter/filter.module'; - module_list(TRUE, FALSE, FALSE, $module_list); + module_list(true, false, false, $module_list); drupal_load('module', 'system'); drupal_load('module', 'filter'); @@ -85,7 +85,7 @@ function install_main() { require_once './includes/cache-install.inc'; $conf['cache_inc'] = './includes/cache-install.inc'; - $task = NULL; + $task = null; } // No profile was passed in GET, ask the user. @@ -105,7 +105,7 @@ function install_main() { if (!empty($_GET['locale'])) { $install_locale = preg_replace('/[^a-zA-Z_0-9\-]/', '', $_GET['locale']); } - elseif (($install_locale = install_select_locale($profile)) !== FALSE) { + elseif (($install_locale = install_select_locale($profile)) !== false) { install_goto("install.php?profile=$profile&locale=$install_locale"); } @@ -191,19 +191,19 @@ function install_verify_settings() { $url = parse_url(is_array($db_url) ? $db_url['default'] : $db_url); $db_user = urldecode($url['user']); - $db_pass = isset($url['pass']) ? urldecode($url['pass']) : NULL; + $db_pass = isset($url['pass']) ? urldecode($url['pass']) : null; $db_host = urldecode($url['host']); $db_port = isset($url['port']) ? urldecode($url['port']) : ''; $db_path = ltrim(urldecode($url['path']), '/'); - $settings_file = './'. conf_path(FALSE, TRUE) .'/settings.php'; + $settings_file = './'. conf_path(false, true) .'/settings.php'; $form_state = array(); _install_settings_form_validate($db_prefix, $db_type, $db_user, $db_pass, $db_host, $db_port, $db_path, $settings_file, $form_state); if (!form_get_errors()) { - return TRUE; + return true; } } - return FALSE; + return false; } /** @@ -218,7 +218,7 @@ function install_change_settings($profile = 'default', $install_locale = '') { $db_host = isset($url['host']) ? urldecode($url['host']) : ''; $db_port = isset($url['port']) ? urldecode($url['port']) : ''; $db_path = ltrim(urldecode($url['path']), '/'); - $conf_path = './'. conf_path(FALSE, TRUE); + $conf_path = './'. conf_path(false, true); $settings_file = $conf_path .'/settings.php'; // We always need this because we want to run form_get_errors. @@ -262,7 +262,7 @@ function install_settings_form(&$form_state, $profile, $install_locale, $setting $form['basic_options']['db_type'] = array( '#type' => 'radios', '#title' => st('Database type'), - '#required' => TRUE, + '#required' => true, '#options' => $db_types, '#default_value' => ($db_type ? $db_type : current($db_types)), '#description' => st('The type of database your @drupal data will be stored in.', array('@drupal' => drupal_install_profile_name())), @@ -286,7 +286,7 @@ function install_settings_form(&$form_state, $profile, $install_locale, $setting '#title' => st('Database name'), '#default_value' => $db_path, '#size' => 45, - '#required' => TRUE, + '#required' => true, '#description' => $db_path_description ); @@ -296,7 +296,7 @@ function install_settings_form(&$form_state, $profile, $install_locale, $setting '#title' => st('Database username'), '#default_value' => $db_user, '#size' => 45, - '#required' => TRUE, + '#required' => true, ); // Database username @@ -310,8 +310,8 @@ function install_settings_form(&$form_state, $profile, $install_locale, $setting $form['advanced_options'] = array( '#type' => 'fieldset', '#title' => st('Advanced options'), - '#collapsible' => TRUE, - '#collapsed' => TRUE, + '#collapsible' => true, + '#collapsed' => true, '#description' => st("These options are only necessary for some sites. If you're not sure what you should enter here, leave the default settings or check with your hosting provider.") ); @@ -323,7 +323,7 @@ function install_settings_form(&$form_state, $profile, $install_locale, $setting '#size' => 45, // Hostnames can be 255 characters long. '#maxlength' => 255, - '#required' => TRUE, + '#required' => true, '#description' => st('If your database is located on a different server, change this.'), ); @@ -357,7 +357,7 @@ function install_settings_form(&$form_state, $profile, $install_locale, $setting $form['settings_file'] = array('#type' => 'value', '#value' => $settings_file); $form['_db_url'] = array('#type' => 'value'); $form['#action'] = "install.php?profile=$profile". ($install_locale ? "&locale=$install_locale" : ''); - $form['#redirect'] = FALSE; + $form['#redirect'] = false; } return $form; } @@ -373,7 +373,7 @@ function install_settings_form_validate($form, &$form_state) { /** * Helper function for install_settings_validate. */ -function _install_settings_form_validate($db_prefix, $db_type, $db_user, $db_pass, $db_host, $db_port, $db_path, $settings_file, &$form_state, $form = NULL) { +function _install_settings_form_validate($db_prefix, $db_type, $db_user, $db_pass, $db_host, $db_port, $db_path, $settings_file, &$form_state, $form = null) { global $db_url; // Verify the table prefix @@ -423,11 +423,11 @@ function install_settings_form_submit($form, &$form_state) { // Update global settings array and save $settings['db_url'] = array( 'value' => $form_state['values']['_db_url'], - 'required' => TRUE, + 'required' => true, ); $settings['db_prefix'] = array( 'value' => $form_state['values']['db_prefix'], - 'required' => TRUE, + 'required' => true, ); drupal_rewrite_settings($settings); @@ -439,7 +439,7 @@ function install_settings_form_submit($form, &$form_state) { * Find all .profile files. */ function install_find_profiles() { - return file_scan_directory('./profiles', '\.profile$', array('.', '..', 'CVS'), 0, TRUE, 'name', 0); + return file_scan_directory('./profiles', '\.profile$', array('.', '..', 'CVS'), 0, true, 'name', 0); } /** @@ -524,7 +524,7 @@ function install_select_profile_form(&$form_state, $profile_files) { * Find all .po files for the current profile. */ function install_find_locales($profilename) { - $locales = file_scan_directory('./profiles/'. $profilename .'/translations', '\.po$', array('.', '..', 'CVS'), 0, FALSE); + $locales = file_scan_directory('./profiles/'. $profilename .'/translations', '\.po$', array('.', '..', 'CVS'), 0, false); array_unshift($locales, (object) array('name' => 'en')); return $locales; } @@ -567,7 +567,7 @@ function install_select_locale($profilename) { } // One language, but not the default profile, assume // the user knows what he is doing. - return FALSE; + return false; } else { // Allow profile to pre-select the language, skipping the selection. @@ -614,7 +614,7 @@ function install_select_locale_form(&$form_state, $locales) { $form['locale'][$locale->name] = array( '#type' => 'radio', '#return_value' => $locale->name, - '#default_value' => ($locale->name == 'en' ? TRUE : FALSE), + '#default_value' => ($locale->name == 'en' ? true : false), '#title' => $name . ($locale->name == 'en' ? ' '. st('(built-in)') : ''), '#parents' => array('locale') ); @@ -706,7 +706,7 @@ function install_tasks($profile, $task) { if (!empty($install_locale) && ($install_locale != 'en')) { include_once 'includes/locale.inc'; // Enable installation language as default site language. - locale_add_language($install_locale, NULL, NULL, NULL, NULL, NULL, 1, TRUE); + locale_add_language($install_locale, null, null, null, null, null, 1, true); // Collect files to import for this language. $batch = locale_batch_by_language($install_locale, '_install_locale_initial_batch_finished'); if (!empty($batch)) { @@ -729,7 +729,7 @@ function install_tasks($profile, $task) { } if ($task == 'configure') { - if (variable_get('site_name', FALSE) || variable_get('site_mail', FALSE)) { + if (variable_get('site_name', false) || variable_get('site_mail', false)) { // Site already configured: This should never happen, means re-running // the installer, possibly by an attacker after the 'install_task' variable // got accidentally blown somewhere. Stop it now. @@ -737,7 +737,7 @@ function install_tasks($profile, $task) { } $form = drupal_get_form('install_configure_form', $url); - if (!variable_get('site_name', FALSE) && !variable_get('site_mail', FALSE)) { + if (!variable_get('site_name', false) && !variable_get('site_mail', false)) { // Not submitted yet: Prepare to display the form. $output = $form; drupal_set_title(st('Configure site')); @@ -911,17 +911,17 @@ function install_check_requirements($profile, $verify) { // If Drupal is not set up already, we need to create a settings file. if (!$verify) { - $writable = FALSE; - $conf_path = './'. conf_path(FALSE, TRUE); + $writable = false; + $conf_path = './'. conf_path(false, true); $settings_file = $conf_path .'/settings.php'; $file = $conf_path; - $exists = FALSE; + $exists = false; // Verify that the directory exists. if (drupal_verify_install_file($conf_path, FILE_EXIST, 'dir')) { // Check to make sure a settings.php already exists. $file = $settings_file; if (drupal_verify_install_file($settings_file, FILE_EXIST)) { - $exists = TRUE; + $exists = true; // If it does, make sure it is writable. $writable = drupal_verify_install_file($settings_file, FILE_READABLE|FILE_WRITABLE); } @@ -973,7 +973,7 @@ function install_check_requirements($profile, $verify) { /** * Add the installation task list to the current page. */ -function install_task_list($active = NULL) { +function install_task_list($active = null) { // Default list of tasks. $tasks = array( 'profile-select' => st('Choose profile'), @@ -1024,7 +1024,7 @@ function install_task_list($active = NULL) { // Let the theming function know that 'finished' and 'done' // include everything, so every step is completed. if (in_array($active, array('finished', 'done'))) { - $active = NULL; + $active = null; } drupal_set_content('left', theme_task_list($tasks, $active)); } @@ -1041,12 +1041,12 @@ function install_configure_form(&$form_state, $url) { $form['site_information'] = array( '#type' => 'fieldset', '#title' => st('Site information'), - '#collapsible' => FALSE, + '#collapsible' => false, ); $form['site_information']['site_name'] = array( '#type' => 'textfield', '#title' => st('Site name'), - '#required' => TRUE, + '#required' => true, '#weight' => -20, ); $form['site_information']['site_mail'] = array( @@ -1054,15 +1054,15 @@ function install_configure_form(&$form_state, $url) { '#title' => st('Site e-mail address'), '#default_value' => ini_get('sendmail_from'), '#description' => st("The From address in automated e-mails sent during registration and new password requests, and other notifications. (Use an address ending in your site's domain to help prevent this e-mail being flagged as spam.)"), - '#required' => TRUE, + '#required' => true, '#weight' => -15, ); $form['admin_account'] = array( '#type' => 'fieldset', '#title' => st('Administrator account'), - '#collapsible' => FALSE, + '#collapsible' => false, ); - $form['admin_account']['account']['#tree'] = TRUE; + $form['admin_account']['account']['#tree'] = true; $form['admin_account']['markup'] = array( '#value' => '

'. st('The administrator account has complete access to the site; it will automatically be granted all permissions and can perform any administrative activity. This will be the only account that can perform certain activities, so keep its credentials safe.') .'

', '#weight' => -10, @@ -1072,7 +1072,7 @@ function install_configure_form(&$form_state, $url) { '#title' => st('Username'), '#maxlength' => USERNAME_MAX_LENGTH, '#description' => st('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.'), - '#required' => TRUE, + '#required' => true, '#weight' => -10, ); @@ -1080,12 +1080,12 @@ function install_configure_form(&$form_state, $url) { '#title' => st('E-mail address'), '#maxlength' => EMAIL_MAX_LENGTH, '#description' => st('All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'), - '#required' => TRUE, + '#required' => true, '#weight' => -5, ); $form['admin_account']['account']['pass'] = array( '#type' => 'password_confirm', - '#required' => TRUE, + '#required' => true, '#size' => 25, '#weight' => 0, ); @@ -1093,7 +1093,7 @@ function install_configure_form(&$form_state, $url) { $form['server_settings'] = array( '#type' => 'fieldset', '#title' => st('Server settings'), - '#collapsible' => FALSE, + '#collapsible' => false, ); $form['server_settings']['date_default_timezone'] = array( '#type' => 'select', @@ -1110,7 +1110,7 @@ function install_configure_form(&$form_state, $url) { '#default_value' => 0, '#options' => array(0 => st('Disabled'), 1 => st('Enabled')), '#description' => st('This option makes Drupal emit "clean" URLs (i.e. without ?q= in the URL).'), - '#disabled' => TRUE, + '#disabled' => true, '#prefix' => '
', '#suffix' => '
', '#weight' => 10, @@ -1131,7 +1131,7 @@ function install_configure_form(&$form_state, $url) { '#weight' => 15, ); $form['#action'] = $url; - $form['#redirect'] = FALSE; + $form['#redirect'] = false; // Allow the profile to alter this form. $form_state isn't available // here, but to conform to the hook_form_alter() signature, we pass @@ -1174,7 +1174,7 @@ function install_configure_form_submit($form, &$form_state) { } // Turn this off temporarily so that we can pass a password through. - variable_set('user_email_verification', FALSE); + variable_set('user_email_verification', false); $form_state['old_values'] = $form_state['values']; $form_state['values'] = $form_state['values']['account']; @@ -1186,7 +1186,7 @@ function install_configure_form_submit($form, &$form_state) { user_authenticate($form_state['values']); $form_state['values'] = $form_state['old_values']; unset($form_state['old_values']); - variable_set('user_email_verification', TRUE); + variable_set('user_email_verification', true); if (isset($form_state['values']['clean_url'])) { variable_set('clean_url', $form_state['values']['clean_url']); diff --git a/modules/block/block-admin-display-form.tpl.php b/modules/block/block-admin-display-form.tpl.php index 3862f4dec47..a869c183720 100644 --- a/modules/block/block-admin-display-form.tpl.php +++ b/modules/block/block-admin-display-form.tpl.php @@ -30,7 +30,7 @@ drupal_add_js('misc/tableheader.js'); drupal_add_js(drupal_get_path('module', 'block') .'/block.js'); foreach ($block_regions as $region => $title) { - drupal_add_tabledrag('blocks', 'match', 'sibling', 'block-region-select', 'block-region-'. $region, NULL, FALSE); + drupal_add_tabledrag('blocks', 'match', 'sibling', 'block-region-select', 'block-region-'. $region, null, false); drupal_add_tabledrag('blocks', 'order', 'sibling', 'block-weight', 'block-weight-'. $region); } ?> diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index 6789a8d3e7d..7ff9abf212e 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -30,14 +30,14 @@ abstract class DrupalTestCase { * * @var string */ - protected $originalPrefix = NULL; + protected $originalPrefix = null; /** * The original file directory, before it was changed for testing purposes. * * @var string */ - protected $originalFileDirectory = NULL; + protected $originalFileDirectory = null; /** * Time limit for the test. @@ -71,7 +71,7 @@ abstract class DrupalTestCase { * that called it. So we need to skip the classes defining these helper * methods. */ - protected $skipClasses = array(__CLASS__ => TRUE); + protected $skipClasses = array(__CLASS__ => true); /** * Constructor for DrupalWebTestCase. @@ -79,7 +79,7 @@ abstract class DrupalTestCase { * @param $test_id * Tests with the same id are reported together. */ - public function __construct($test_id = NULL) { + public function __construct($test_id = null) { $this->testId = $test_id; } @@ -100,7 +100,7 @@ public function __construct($test_id = NULL) { * the name of the source file, 'line' is the line number and 'function' * is the caller function itself. */ - protected function assert($status, $message = '', $group = 'Other', array $caller = NULL) { + protected function assert($status, $message = '', $group = 'Other', array $caller = null) { global $db_prefix; // Convert boolean status to string status. @@ -145,10 +145,10 @@ protected function assert($status, $message = '', $group = 'Other', array $calle // We do not use a ternary operator here to allow a breakpoint on // test failure. if ($status == 'pass') { - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -363,8 +363,8 @@ protected function assertNotIdentical($first, $second, $message = '', $group = ' * @return * TRUE. */ - protected function pass($message = NULL, $group = 'Other') { - return $this->assert(TRUE, $message, $group); + protected function pass($message = null, $group = 'Other') { + return $this->assert(true, $message, $group); } /** @@ -377,8 +377,8 @@ protected function pass($message = NULL, $group = 'Other') { * @return * FALSE. */ - protected function fail($message = NULL, $group = 'Other') { - return $this->assert(FALSE, $message, $group); + protected function fail($message = null, $group = 'Other') { + return $this->assert(false, $message, $group); } /** @@ -393,7 +393,7 @@ protected function fail($message = NULL, $group = 'Other') { * @return * FALSE. */ - protected function error($message = '', $group = 'Other', array $caller = NULL) { + protected function error($message = '', $group = 'Other', array $caller = null) { if ($group == 'User notice') { // Since 'User notice' is set by trigger_error() which is used for debug // set the message to a status of 'debug'. @@ -408,12 +408,12 @@ protected function error($message = '', $group = 'Other', array $caller = NULL) */ public function run() { // Initialize verbose debugging. - simpletest_verbose(NULL, file_directory_path(), get_class($this)); + simpletest_verbose(null, file_directory_path(), get_class($this)); // HTTP auth settings (:) for the simpletest browser // when sending requests to the test site. - $username = variable_get('simpletest_username', NULL); - $password = variable_get('simpletest_password', NULL); + $username = variable_get('simpletest_username', null); + $password = variable_get('simpletest_password', null); if ($username && $password) { $this->httpauth_credentials = $username . ':' . $password; } @@ -447,7 +447,7 @@ public function run() { * @see set_error_handler * */ - public function errorHandler($severity, $message, $file = NULL, $line = NULL) { + public function errorHandler($severity, $message, $file = null, $line = null) { if ($severity & error_reporting()) { $error_map = array( E_STRICT => 'Run-time notice', @@ -464,7 +464,7 @@ public function errorHandler($severity, $message, $file = NULL, $line = NULL) { $backtrace = debug_backtrace(); $this->error($message, $error_map[$severity], _drupal_get_last_caller($backtrace)); } - return TRUE; + return true; } /** @@ -544,9 +544,9 @@ class DrupalUnitTestCase extends DrupalTestCase { /** * Constructor for DrupalUnitTestCase. */ - function __construct($test_id = NULL) { + function __construct($test_id = null) { parent::__construct($test_id); - $this->skipClasses[__CLASS__] = TRUE; + $this->skipClasses[__CLASS__] = true; } function setUp() { @@ -568,7 +568,7 @@ function setUp() { if (isset($module_list['locale'])) { $this->originalModuleList = $module_list; unset($module_list['locale']); - module_list(TRUE, FALSE, FALSE, $module_list); + module_list(true, false, false, $module_list); } } @@ -581,7 +581,7 @@ function tearDown() { $db_prefix = $this->originalPrefix; // Restore modules if necessary. if (isset($this->originalModuleList)) { - module_list(TRUE, FALSE, FALSE, $this->originalModuleList); + module_list(true, false, false, $this->originalModuleList); } } } @@ -631,14 +631,14 @@ class DrupalWebTestCase extends DrupalTestCase { * * @var SimpleXMLElement */ - protected $elements = NULL; + protected $elements = null; /** * The current user logged in using the internal browser. * * @var bool */ - protected $loggedInUser = FALSE; + protected $loggedInUser = false; /** * The current cookie file used by cURL. @@ -646,7 +646,7 @@ class DrupalWebTestCase extends DrupalTestCase { * We do not reuse the cookies in further runs, so we do not need a file * but we still need cookie handling, so we set the jar to NULL. */ - protected $cookieFile = NULL; + protected $cookieFile = null; /** * Additional cURL options. @@ -660,29 +660,29 @@ class DrupalWebTestCase extends DrupalTestCase { * * @var object */ - protected $originalUser = NULL; + protected $originalUser = null; /** * HTTP authentication credentials (:). */ - protected $httpauth_credentials = NULL; + protected $httpauth_credentials = null; /** * The current session name, if available. */ - protected $session_name = NULL; + protected $session_name = null; /** * The current session ID, if available. */ - protected $session_id = NULL; + protected $session_id = null; /** * Constructor for DrupalWebTestCase. */ - function __construct($test_id = NULL) { + function __construct($test_id = null) { parent::__construct($test_id); - $this->skipClasses[__CLASS__] = TRUE; + $this->skipClasses[__CLASS__] = true; } /** @@ -728,8 +728,8 @@ protected function drupalCreateNode($settings = array()) { 'status' => 1, 'sticky' => 0, 'type' => 'page', - 'revisions' => NULL, - 'taxonomy' => NULL, + 'revisions' => null, + 'taxonomy' => null, ); // Use the original node's created time for existing nodes. @@ -816,7 +816,7 @@ protected function drupalCreateContentType($settings = array()) { $this->assertEqual($saved_type, SAVED_NEW, t('Created content type %type.', array('%type' => $type->type))); // Reset permissions so that permissions for this content type are available. - $this->checkPermissions(array(), TRUE); + $this->checkPermissions(array(), true); return $type; } @@ -831,7 +831,7 @@ protected function drupalCreateContentType($settings = array()) { * @return * List of files that match filter. */ - protected function drupalGetTestFiles($type, $size = NULL) { + protected function drupalGetTestFiles($type, $size = null) { $files = array(); // Make sure type is valid. @@ -842,7 +842,7 @@ protected function drupalGetTestFiles($type, $size = NULL) { $files = file_scan_directory($path, '' . $type . '\-.*'); // If size is set then remove any files that are not of that size. - if ($size !== NULL) { + if ($size !== null) { foreach ($files as $file) { // $stats = stat($file->uri); $stats = stat($file->filename); @@ -886,7 +886,7 @@ protected function drupalCompareFiles($file1, $file2) { protected function drupalCreateUser($permissions = array('access comments', 'access content', 'post comments', 'post comments without approval')) { // Create a role with the given permission set. if (!($rid = $this->drupalCreateRole($permissions))) { - return FALSE; + return false; } // Create a user assigned to that role. @@ -901,7 +901,7 @@ protected function drupalCreateUser($permissions = array('access comments', 'acc $this->assertTrue(!empty($account->uid), t('User created with name %name and pass %pass', array('%name' => $edit['name'], '%pass' => $edit['pass'])), t('User login')); if (empty($account->uid)) { - return FALSE; + return false; } // Add the raw password so that we can log in as this user. @@ -919,7 +919,7 @@ protected function drupalCreateUser($permissions = array('access comments', 'acc * @return * Role ID of newly created role, or FALSE if role creation failed. */ - protected function drupalCreateRole(array $permissions, $name = NULL) { + protected function drupalCreateRole(array $permissions, $name = null) { // Generate random name if it was not passed. if (!$name) { $name = $this->randomName(); @@ -927,7 +927,7 @@ protected function drupalCreateRole(array $permissions, $name = NULL) { // Check the all the permissions strings are valid. if (!$this->checkPermissions($permissions)) { - return FALSE; + return false; } // Create new role. @@ -950,7 +950,7 @@ protected function drupalCreateRole(array $permissions, $name = NULL) { return $role->rid; } else { - return FALSE; + return false; } } @@ -964,7 +964,7 @@ protected function drupalCreateRole(array $permissions, $name = NULL) { * @return * TRUE or FALSE depending on whether the permissions are valid. */ - protected function checkPermissions(array $permissions, $reset = FALSE) { + protected function checkPermissions(array $permissions, $reset = false) { // $available = &drupal_static(__FUNCTION__); static $available; @@ -973,11 +973,11 @@ protected function checkPermissions(array $permissions, $reset = FALSE) { $available = module_invoke_all('perm'); } - $valid = TRUE; + $valid = true; foreach ($permissions as $permission) { if (!in_array($permission, $available)) { $this->fail(t('Invalid permission %permission.', array('%permission' => $permission)), t('Role')); - $valid = FALSE; + $valid = false; } } return $valid; @@ -1051,7 +1051,7 @@ protected function drupalLogout() { $pass = $pass && $this->assertField('pass', t('Password field found.'), t('Logout')); if ($pass) { - $this->loggedInUser = FALSE; + $this->loggedInUser = false; } } @@ -1079,7 +1079,7 @@ protected function setUp() { // Must reset locale here, since schema calls t(). (Drupal 6) if (module_exists('locale')) { $language = (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => ''); - locale(NULL, NULL, TRUE); + locale(null, null, true); } // Generate temporary prefixed database to ensure that tests have a clean starting point. @@ -1138,7 +1138,7 @@ protected function setUp() { // it between each run. If we don't, then it will contain // stale data for the previous run's database prefix and all // calls to it will fail. - drupal_get_schema(NULL, TRUE); + drupal_get_schema(null, true); // Run default profile tasks. // $install_state = array(); @@ -1151,14 +1151,14 @@ protected function setUp() { actions_synchronize(); _drupal_flush_css_js(); $this->refreshVariables(); - $this->checkPermissions(array(), TRUE); - user_access(NULL, NULL, TRUE); // Drupal 6. + $this->checkPermissions(array(), true); + user_access(null, null, true); // Drupal 6. // Log in with a clean $user. $this->originalUser = $user; // drupal_save_session(FALSE); // $user = user_load(1); - session_save_session(FALSE); + session_save_session(false); $user = user_load(array('uid' => 1)); // Restore necessary variables. @@ -1235,7 +1235,7 @@ protected function tearDown() { // log to pick up any fatal errors. $db_prefix_temp = $db_prefix; $db_prefix = $this->originalPrefix; - simpletest_log_read($this->testId, $db_prefix, get_class($this), TRUE); + simpletest_log_read($this->testId, $db_prefix, get_class($this), true); $db_prefix = $db_prefix_temp; $emailCount = count(variable_get('drupal_test_email_collector', array())); @@ -1250,7 +1250,7 @@ protected function tearDown() { simpletest_clean_temporary_directory(file_directory_path()); // Remove all prefixed tables (all the tables in the schema). - $schema = drupal_get_schema(NULL, TRUE); + $schema = drupal_get_schema(null, true); $ret = array(); foreach ($schema as $name => $table) { db_drop_table($ret, $name); @@ -1262,23 +1262,23 @@ protected function tearDown() { // Return the user to the original one. $user = $this->originalUser; // drupal_save_session(TRUE); - session_save_session(TRUE); + session_save_session(true); // Bring back default language. (Drupal 6) if (module_exists('locale')) { drupal_init_language(); - locale(NULL, NULL, TRUE); + locale(null, null, true); } // Ensure that internal logged in variable and cURL options are reset. - $this->loggedInUser = FALSE; + $this->loggedInUser = false; $this->additionalCurlOptions = array(); // Reload module list and implementations to ensure that test module hooks // aren't called after tests. - module_list(TRUE); + module_list(true); // module_implements('', FALSE, TRUE); - module_implements('', '', TRUE); + module_implements('', '', true); // Reset the Field API. // field_cache_clear(); @@ -1313,11 +1313,11 @@ protected function curlInitialize() { $curl_options = $this->additionalCurlOptions + array( CURLOPT_COOKIEJAR => $this->cookieFile, CURLOPT_URL => $base_url, - CURLOPT_FOLLOWLOCATION => TRUE, + CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 5, - CURLOPT_RETURNTRANSFER => TRUE, - CURLOPT_SSL_VERIFYPEER => FALSE, // Required to make the tests run on https. - CURLOPT_SSL_VERIFYHOST => FALSE, // Required to make the tests run on https. + CURLOPT_RETURNTRANSFER => true, + CURLOPT_SSL_VERIFYPEER => false, // Required to make the tests run on https. + CURLOPT_SSL_VERIFYHOST => false, // Required to make the tests run on https. CURLOPT_HEADERFUNCTION => array(&$this, 'curlHeaderCallback'), ); if (isset($this->httpauth_credentials)) { @@ -1357,7 +1357,7 @@ protected function curlExec($curl_options) { curl_setopt_array($this->curlHandle, $this->additionalCurlOptions + $curl_options); // Reset headers and the session ID. - $this->session_id = NULL; + $this->session_id = null; $this->headers = array(); $this->drupalSetContent(curl_exec($this->curlHandle), curl_getinfo($this->curlHandle, CURLINFO_EFFECTIVE_URL)); @@ -1368,7 +1368,7 @@ protected function curlExec($curl_options) { '!length' => format_size(strlen($this->content)) ); $message = t('!method @url returned @status (!length).', $message_vars); - $this->assertTrue($this->content !== FALSE, $message, t('Browser')); + $this->assertTrue($this->content !== false, $message, t('Browser')); return $this->drupalGetContent(); } @@ -1399,7 +1399,7 @@ protected function curlHeaderCallback($curlHandler, $header) { $this->session_id = $matches[1]; } else { - $this->session_id = NULL; + $this->session_id = null; } } @@ -1456,12 +1456,12 @@ protected function parse() { * The retrieved HTML string, also available as $this->drupalGetContent() */ protected function drupalGet($path, array $options = array(), array $headers = array()) { - $options['absolute'] = TRUE; + $options['absolute'] = true; // We re-using a CURL connection here. If that connection still has certain // options set, it might change the GET into a POST. Make sure we clear out // previous options. - $out = $this->curlExec(array(CURLOPT_HTTPGET => TRUE, CURLOPT_URL => url($path, $options), CURLOPT_NOBODY => FALSE, CURLOPT_HTTPHEADER => $headers)); + $out = $this->curlExec(array(CURLOPT_HTTPGET => true, CURLOPT_URL => url($path, $options), CURLOPT_NOBODY => false, CURLOPT_HTTPHEADER => $headers)); $this->refreshVariables(); // Ensure that any changes to variables in the other thread are picked up. // Replace original page output with new output from redirected page(s). @@ -1510,7 +1510,7 @@ protected function drupalGet($path, array $options = array(), array $headers = a * "name: value". */ protected function drupalPost($path, $edit, $submit, array $options = array(), array $headers = array()) { - $submit_matches = FALSE; + $submit_matches = false; if (isset($path)) { $html = $this->drupalGet($path, $options); } @@ -1551,7 +1551,7 @@ protected function drupalPost($path, $edit, $submit, array $options = array(), a } $post = implode('&', $post); } - $out = $this->curlExec(array(CURLOPT_URL => $action, CURLOPT_POST => TRUE, CURLOPT_POSTFIELDS => $post, CURLOPT_HTTPHEADER => $headers)); + $out = $this->curlExec(array(CURLOPT_URL => $action, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $post, CURLOPT_HTTPHEADER => $headers)); // Ensure that any changes to variables in the other thread are picked up. $this->refreshVariables(); @@ -1561,7 +1561,7 @@ protected function drupalPost($path, $edit, $submit, array $options = array(), a } $this->verbose('POST request to: ' . $path . '
Ending URL: ' . $this->getUrl() . - '
Fields: ' . highlight_string('Fields: ' . highlight_string('' . $out); return $out; } @@ -1594,7 +1594,7 @@ protected function checkForMetaRefresh() { } } } - return FALSE; + return false; } /** @@ -1611,8 +1611,8 @@ protected function checkForMetaRefresh() { * The retrieved headers, also available as $this->drupalGetContent() */ protected function drupalHead($path, array $options = array(), array $headers = array()) { - $options['absolute'] = TRUE; - $out = $this->curlExec(array(CURLOPT_NOBODY => TRUE, CURLOPT_URL => url($path, $options), CURLOPT_HTTPHEADER => $headers)); + $options['absolute'] = true; + $out = $this->curlExec(array(CURLOPT_NOBODY => true, CURLOPT_URL => url($path, $options), CURLOPT_HTTPHEADER => $headers)); $this->refreshVariables(); // Ensure that any changes to variables in the other thread are picked up. return $out; } @@ -1636,7 +1636,7 @@ protected function drupalHead($path, array $options = array(), array $headers = protected function handleForm(&$post, &$edit, &$upload, $submit, $form) { // Retrieve the form elements. $elements = $form->xpath('.//input|.//textarea|.//select'); - $submit_matches = FALSE; + $submit_matches = false; foreach ($elements as $element) { // SimpleXML objects need string casting all the time. $name = (string) $element['name']; @@ -1644,7 +1644,7 @@ protected function handleForm(&$post, &$edit, &$upload, $submit, $form) { // for