Commit efe0a73b authored by catch's avatar catch

Issue #334024 by klausi, catch, beejeebus, sun: Use const keyword to define...

Issue #334024 by klausi, catch, beejeebus, sun: Use const keyword to define constants instead of define().
parent c42985ff
......@@ -35,7 +35,7 @@
* solve some theming issues. This flag is checked on several places
* in Drupal code (not just authorize.php).
*/
define('MAINTENANCE_MODE', 'update');
const MAINTENANCE_MODE = 'update';
/**
* Renders a 403 access denied page for authorize.php.
......
......@@ -8,34 +8,34 @@
/**
* The current system version.
*/
define('VERSION', '8.0-dev');
const VERSION = '8.0-dev';
/**
* Core API compatibility.
*/
define('DRUPAL_CORE_COMPATIBILITY', '8.x');
const DRUPAL_CORE_COMPATIBILITY = '8.x';
/**
* Minimum supported version of PHP.
*/
define('DRUPAL_MINIMUM_PHP', '5.3.2');
const DRUPAL_MINIMUM_PHP = '5.3.2';
/**
* Minimum recommended value of PHP memory_limit.
*/
define('DRUPAL_MINIMUM_PHP_MEMORY_LIMIT', '32M');
const DRUPAL_MINIMUM_PHP_MEMORY_LIMIT = '32M';
/**
* Indicates that the item should never be removed unless explicitly selected.
*
* The item may be removed using cache()->delete() with a cache ID.
*/
define('CACHE_PERMANENT', 0);
const CACHE_PERMANENT = 0;
/**
* Indicates that the item should be removed at the next general cache wipe.
*/
define('CACHE_TEMPORARY', -1);
const CACHE_TEMPORARY = -1;
/**
* @defgroup logging_severity_levels Logging severity levels
......@@ -60,42 +60,42 @@
/**
* Log message severity -- Emergency: system is unusable.
*/
define('WATCHDOG_EMERGENCY', 0);
const WATCHDOG_EMERGENCY = 0;
/**
* Log message severity -- Alert: action must be taken immediately.
*/
define('WATCHDOG_ALERT', 1);
const WATCHDOG_ALERT = 1;
/**
* Log message severity -- Critical: critical conditions.
*/
define('WATCHDOG_CRITICAL', 2);
const WATCHDOG_CRITICAL = 2;
/**
* Log message severity -- Error: error conditions.
*/
define('WATCHDOG_ERROR', 3);
const WATCHDOG_ERROR = 3;
/**
* Log message severity -- Warning: warning conditions.
*/
define('WATCHDOG_WARNING', 4);
const WATCHDOG_WARNING = 4;
/**
* Log message severity -- Notice: normal but significant condition.
*/
define('WATCHDOG_NOTICE', 5);
const WATCHDOG_NOTICE = 5;
/**
* Log message severity -- Informational: informational messages.
*/
define('WATCHDOG_INFO', 6);
const WATCHDOG_INFO = 6;
/**
* Log message severity -- Debug: debug-level messages.
*/
define('WATCHDOG_DEBUG', 7);
const WATCHDOG_DEBUG = 7;
/**
* @} End of "defgroup logging_severity_levels".
......@@ -104,98 +104,98 @@
/**
* First bootstrap phase: initialize configuration.
*/
define('DRUPAL_BOOTSTRAP_CONFIGURATION', 0);
const DRUPAL_BOOTSTRAP_CONFIGURATION = 0;
/**
* Second bootstrap phase: try to serve a cached page.
*/
define('DRUPAL_BOOTSTRAP_PAGE_CACHE', 1);
const DRUPAL_BOOTSTRAP_PAGE_CACHE = 1;
/**
* Third bootstrap phase: initialize database layer.
*/
define('DRUPAL_BOOTSTRAP_DATABASE', 2);
const DRUPAL_BOOTSTRAP_DATABASE = 2;
/**
* Fourth bootstrap phase: initialize the variable system.
*/
define('DRUPAL_BOOTSTRAP_VARIABLES', 3);
const DRUPAL_BOOTSTRAP_VARIABLES = 3;
/**
* Fifth bootstrap phase: initialize session handling.
*/
define('DRUPAL_BOOTSTRAP_SESSION', 4);
const DRUPAL_BOOTSTRAP_SESSION = 4;
/**
* Sixth bootstrap phase: set up the page header.
*/
define('DRUPAL_BOOTSTRAP_PAGE_HEADER', 5);
const DRUPAL_BOOTSTRAP_PAGE_HEADER = 5;
/**
* Seventh bootstrap phase: find out language of the page.
*/
define('DRUPAL_BOOTSTRAP_LANGUAGE', 6);
const DRUPAL_BOOTSTRAP_LANGUAGE = 6;
/**
* Final bootstrap phase: Drupal is fully loaded; validate and fix
* input data.
*/
define('DRUPAL_BOOTSTRAP_FULL', 7);
const DRUPAL_BOOTSTRAP_FULL = 7;
/**
* Role ID for anonymous users; should match what's in the "role" table.
*/
define('DRUPAL_ANONYMOUS_RID', 1);
const DRUPAL_ANONYMOUS_RID = 1;
/**
* Role ID for authenticated users; should match what's in the "role" table.
*/
define('DRUPAL_AUTHENTICATED_RID', 2);
const DRUPAL_AUTHENTICATED_RID = 2;
/**
* The number of bytes in a kilobyte. For more information, visit
* http://en.wikipedia.org/wiki/Kilobyte.
*/
define('DRUPAL_KILOBYTE', 1024);
const DRUPAL_KILOBYTE = 1024;
/**
* System language (only applicable to UI).
*
* Refers to the language used in Drupal and module/theme source code.
*/
define('LANGUAGE_SYSTEM', 'system');
const LANGUAGE_SYSTEM = 'system';
/**
* The language code used when no language is explicitly assigned.
*
* Defined by ISO639-2 for "Undetermined".
*/
define('LANGUAGE_NONE', 'und');
const LANGUAGE_NONE = 'und';
/**
* The type of language used to define the content language.
*/
define('LANGUAGE_TYPE_CONTENT', 'language_content');
const LANGUAGE_TYPE_CONTENT = 'language_content';
/**
* The type of language used to select the user interface.
*/
define('LANGUAGE_TYPE_INTERFACE', 'language');
const LANGUAGE_TYPE_INTERFACE = 'language';
/**
* The type of language used for URLs.
*/
define('LANGUAGE_TYPE_URL', 'language_url');
const LANGUAGE_TYPE_URL = 'language_url';
/**
* Language written left to right. Possible value of $language->direction.
*/
define('LANGUAGE_LTR', 0);
const LANGUAGE_LTR = 0;
/**
* Language written right to left. Possible value of $language->direction.
*/
define('LANGUAGE_RTL', 1);
const LANGUAGE_RTL = 1;
/**
* Time of the current request in seconds elapsed since the Unix Epoch.
......@@ -212,29 +212,29 @@
/**
* Flag for drupal_set_title(); text is not sanitized, so run check_plain().
*/
define('CHECK_PLAIN', 0);
const CHECK_PLAIN = 0;
/**
* Flag for drupal_set_title(); text has already been sanitized.
*/
define('PASS_THROUGH', -1);
const PASS_THROUGH = -1;
/**
* Signals that the registry lookup cache should be reset.
*/
define('REGISTRY_RESET_LOOKUP_CACHE', 1);
const REGISTRY_RESET_LOOKUP_CACHE = 1;
/**
* Signals that the registry lookup cache should be written to storage.
*/
define('REGISTRY_WRITE_LOOKUP_CACHE', 2);
const REGISTRY_WRITE_LOOKUP_CACHE = 2;
/**
* Regular expression to match PHP function names.
*
* @see http://php.net/manual/en/language.functions.php
*/
define('DRUPAL_PHP_FUNCTION_PATTERN', '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*');
const DRUPAL_PHP_FUNCTION_PATTERN = '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*';
/**
* Provides a caching wrapper to be used in place of large array structures.
......
......@@ -42,59 +42,59 @@
/**
* Return status for saving which involved creating a new item.
*/
define('SAVED_NEW', 1);
const SAVED_NEW = 1;
/**
* Return status for saving which involved an update to an existing item.
*/
define('SAVED_UPDATED', 2);
const SAVED_UPDATED = 2;
/**
* Return status for saving which deleted an existing item.
*/
define('SAVED_DELETED', 3);
const SAVED_DELETED = 3;
/**
* The default group for system CSS files added to the page.
*/
define('CSS_SYSTEM', -100);
const CSS_SYSTEM = -100;
/**
* The default group for module CSS files added to the page.
*/
define('CSS_DEFAULT', 0);
const CSS_DEFAULT = 0;
/**
* The default group for theme CSS files added to the page.
*/
define('CSS_THEME', 100);
const CSS_THEME = 100;
/**
* The default group for JavaScript libraries or jQuery plugins added
* to the page.
*/
define('JS_LIBRARY', -100);
const JS_LIBRARY = -100;
/**
* The default group for module JavaScript code added to the page.
*/
define('JS_DEFAULT', 0);
const JS_DEFAULT = 0;
/**
* The default group for theme JavaScript code added to the page.
*/
define('JS_THEME', 100);
const JS_THEME = 100;
/**
* The default group for JavaScript settings added to the page.
*/
define('JS_SETTING', 200);
const JS_SETTING = 200;
/**
* Error code indicating that the request made by drupal_http_request() exceeded
* the specified timeout.
*/
define('HTTP_REQUEST_TIMEOUT', -1);
const HTTP_REQUEST_TIMEOUT = -1;
/**
* Constants defining cache granularity for blocks and renderable arrays.
......@@ -121,7 +121,7 @@
* the content.
* - for blocks that change too frequently.
*/
define('DRUPAL_NO_CACHE', -1);
const DRUPAL_NO_CACHE = -1;
/**
* The block is handling its own caching in its hook_block_view(). From the
......@@ -129,31 +129,31 @@
* Useful when time based expiration is needed or a site uses a node access
* which invalidates standard block cache.
*/
define('DRUPAL_CACHE_CUSTOM', -2);
const DRUPAL_CACHE_CUSTOM = -2;
/**
* The block or element can change depending on the roles the user viewing the
* page belongs to. This is the default setting for blocks, used when the block
* does not specify anything.
*/
define('DRUPAL_CACHE_PER_ROLE', 0x0001);
const DRUPAL_CACHE_PER_ROLE = 0x0001;
/**
* The block or element can change depending on the user viewing the page.
* This setting can be resource-consuming for sites with large number of users,
* and thus should only be used when DRUPAL_CACHE_PER_ROLE is not sufficient.
*/
define('DRUPAL_CACHE_PER_USER', 0x0002);
const DRUPAL_CACHE_PER_USER = 0x0002;
/**
* The block or element can change depending on the page being viewed.
*/
define('DRUPAL_CACHE_PER_PAGE', 0x0004);
const DRUPAL_CACHE_PER_PAGE = 0x0004;
/**
* The block or element is the same for every user on every page where it is visible.
*/
define('DRUPAL_CACHE_GLOBAL', 0x0008);
const DRUPAL_CACHE_GLOBAL = 0x0008;
/**
* Add content to a specified region.
......
......@@ -13,7 +13,7 @@
/**
* The name by which to obtain a lock for retrive the next insert id.
*/
define('POSTGRESQL_NEXTID_LOCK', 1000);
const POSTGRESQL_NEXTID_LOCK = 1000;
class DatabaseConnection_pgsql extends DatabaseConnection {
......
......@@ -8,17 +8,17 @@
/**
* Error reporting level: display no errors.
*/
define('ERROR_REPORTING_HIDE', 0);
const ERROR_REPORTING_HIDE = 0;
/**
* Error reporting level: display errors and warnings.
*/
define('ERROR_REPORTING_DISPLAY_SOME', 1);
const ERROR_REPORTING_DISPLAY_SOME = 1;
/**
* Error reporting level: display all messages.
*/
define('ERROR_REPORTING_DISPLAY_ALL', 2);
const ERROR_REPORTING_DISPLAY_ALL = 2;
/**
* Map PHP error constants to watchdog severity levels.
......
......@@ -38,27 +38,27 @@
/**
* Flag used by file_prepare_directory() -- create directory if not present.
*/
define('FILE_CREATE_DIRECTORY', 1);
const FILE_CREATE_DIRECTORY = 1;
/**
* Flag used by file_prepare_directory() -- file permissions may be changed.
*/
define('FILE_MODIFY_PERMISSIONS', 2);
const FILE_MODIFY_PERMISSIONS = 2;
/**
* Flag for dealing with existing files: Appends number until name is unique.
*/
define('FILE_EXISTS_RENAME', 0);
const FILE_EXISTS_RENAME = 0;
/**
* Flag for dealing with existing files: Replace the existing file.
*/
define('FILE_EXISTS_REPLACE', 1);
const FILE_EXISTS_REPLACE = 1;
/**
* Flag for dealing with existing files: Do nothing and return FALSE.
*/
define('FILE_EXISTS_ERROR', 2);
const FILE_EXISTS_ERROR = 2;
/**
* Indicates that the file is permanent and should not be deleted.
......@@ -67,7 +67,7 @@
* during cron runs, but permanent files will not be removed during the file
* garbage collection process.
*/
define('FILE_STATUS_PERMANENT', 1);
const FILE_STATUS_PERMANENT = 1;
/**
* Methods to manage a registry of stream wrappers.
......
......@@ -17,7 +17,7 @@
* also uses this flag to skip language import tasks when the installation is
* being performed in English.
*/
define('INSTALL_TASK_SKIP', 1);
const INSTALL_TASK_SKIP = 1;
/**
* Global flag to indicate that a task should be run on each installation
......@@ -25,7 +25,7 @@
*
* This is primarily used by the Drupal installer for bootstrap-related tasks.
*/
define('INSTALL_TASK_RUN_IF_REACHED', 2);
const INSTALL_TASK_RUN_IF_REACHED = 2;
/**
* Global flag to indicate that a task should be run on each installation
......@@ -39,7 +39,7 @@
* modules on the new site, and also for the configuration form that collects
* basic site information and sets up the site maintenance account.
*/
define('INSTALL_TASK_RUN_IF_NOT_COMPLETED', 3);
const INSTALL_TASK_RUN_IF_NOT_COMPLETED = 3;
/**
* Installs Drupal either interactively or via an array of passed-in settings.
......
......@@ -3,72 +3,72 @@
/**
* Indicates that a module has not been installed yet.
*/
define('SCHEMA_UNINSTALLED', -1);
const SCHEMA_UNINSTALLED = -1;
/**
* Indicates that a module has been installed.
*/
define('SCHEMA_INSTALLED', 0);
const SCHEMA_INSTALLED = 0;
/**
* Requirement severity -- Informational message only.
*/
define('REQUIREMENT_INFO', -1);
const REQUIREMENT_INFO = -1;
/**
* Requirement severity -- Requirement successfully met.
*/
define('REQUIREMENT_OK', 0);
const REQUIREMENT_OK = 0;
/**
* Requirement severity -- Warning condition; proceed but flag warning.
*/
define('REQUIREMENT_WARNING', 1);
const REQUIREMENT_WARNING = 1;
/**
* Requirement severity -- Error condition; abort installation.
*/
define('REQUIREMENT_ERROR', 2);
const REQUIREMENT_ERROR = 2;
/**
* File permission check -- File exists.
*/
define('FILE_EXIST', 1);
const FILE_EXIST = 1;
/**
* File permission check -- File is readable.
*/
define('FILE_READABLE', 2);
const FILE_READABLE = 2;
/**
* File permission check -- File is writable.
*/
define('FILE_WRITABLE', 4);
const FILE_WRITABLE = 4;
/**
* File permission check -- File is executable.
*/
define('FILE_EXECUTABLE', 8);
const FILE_EXECUTABLE = 8;
/**
* File permission check -- File does not exist.
*/
define('FILE_NOT_EXIST', 16);
const FILE_NOT_EXIST = 16;
/**
* File permission check -- File is not readable.
*/
define('FILE_NOT_READABLE', 32);
const FILE_NOT_READABLE = 32;
/**
* File permission check -- File is not writable.
*/
define('FILE_NOT_WRITABLE', 64);
const FILE_NOT_WRITABLE = 64;
/**
* File permission check -- File is not executable.
*/
define('FILE_NOT_EXECUTABLE', 128);
const FILE_NOT_EXECUTABLE = 128;
/**
* Initialize the update system by loading all installed module's .install files.
......
......@@ -8,7 +8,7 @@
/**
* No language negotiation. The default language is used.
*/
define('LANGUAGE_NEGOTIATION_DEFAULT', 'language-default');
const LANGUAGE_NEGOTIATION_DEFAULT = 'language-default';
/**
* Return all the defined language types.
......
......@@ -9,38 +9,38 @@
* The language is determined using a URL language indicator:
* path prefix or domain according to the configuration.
*/
define('LOCALE_LANGUAGE_NEGOTIATION_URL', 'locale-url');
const LOCALE_LANGUAGE_NEGOTIATION_URL = 'locale-url';
/**
* The language is set based on the browser language settings.
*/
define('LOCALE_LANGUAGE_NEGOTIATION_BROWSER', 'locale-browser');
const LOCALE_LANGUAGE_NEGOTIATION_BROWSER = 'locale-browser';
/**
* The language is determined using the current interface language.
*/
define('LOCALE_LANGUAGE_NEGOTIATION_INTERFACE', 'locale-interface');
const LOCALE_LANGUAGE_NEGOTIATION_INTERFACE = 'locale-interface';
/**
* If no URL language is available language is determined using an already
* detected one.
*/
define('LOCALE_LANGUAGE_NEGOTIATION_URL_FALLBACK', 'locale-url-fallback');
const LOCALE_LANGUAGE_NEGOTIATION_URL_FALLBACK = 'locale-url-fallback';
/**
* The language is set based on the user language settings.
*/
define('LOCALE_LANGUAGE_NEGOTIATION_USER', 'locale-user');
const LOCALE_LANGUAGE_NEGOTIATION_USER = 'locale-user';
/**
* The language is set based on the request/session parameters.
*/
define('LOCALE_LANGUAGE_NEGOTIATION_SESSION', 'locale-session');
const LOCALE_LANGUAGE_NEGOTIATION_SESSION = 'locale-session';
/**
* Regular expression pattern used to localize JavaScript strings.
*/
define('LOCALE_JS_STRING', '(?:(?:\'(?:\\\\\'|[^\'])*\'|"(?:\\\\"|[^"])*")(?:\s*\+\s*)?)+');
const LOCALE_JS_STRING = '(?:(?:\'(?:\\\\\'|[^\'])*\'|"(?:\\\\"|[^"])*")(?:\s*\+\s*)?)+';
/**
* Regular expression pattern used to match simple JS object literal.
......@@ -48,7 +48,7 @@
* This pattern matches a basic JS object, but will fail on an object with
* nested objects. Used in JS file parsing for string arg processing.
*/
define('LOCALE_JS_OBJECT', '\{.*?\}');
const LOCALE_JS_OBJECT = '\{.*?\}';
/**
* Regular expression to match an object containing a key 'context'.
......@@ -76,25 +76,25 @@
* Translation import mode overwriting all existing translations
* if new translated version available.
*/
define('LOCALE_IMPORT_OVERWRITE', 0);
const LOCALE_IMPORT_OVERWRITE = 0;
/**
* Translation import mode keeping existing translations and only
* inserting new strings.
*/
define('LOCALE_IMPORT_KEEP', 1);
const LOCALE_IMPORT_KEEP = 1;
/**
* URL language negotiation: use the path prefix as URL language
* indicator.
*/
define('LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX', 0);
const LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX = 0;
/**
* URL language negotiation: use the domain as URL language
* indicator.
*/
define('LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN', 1);
const LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN = 1;
/**
* @defgroup locale-languages-negotiation Language negotiation options
......
......@@ -83,42 +83,42 @@
/**
* Internal menu flag -- menu item is the root of the menu tree.
*/
define('MENU_IS_ROOT', 0x0001);
const MENU_IS_ROOT = 0x0001;
/**
* Internal menu flag -- menu item is visible in the menu tree.
*/
define('MENU_VISIBLE_IN_TREE', 0x0002);
const MENU_VISIBLE_IN_TREE = 0x0002;
/**
* Internal menu flag -- menu item is visible in the breadcrumb.
*/
define('MENU_VISIBLE_IN_BREADCRUMB', 0x0004);
const MENU_VISIBLE_IN_BREADCRUMB = 0x0004;
/**
* Internal menu flag -- menu item links back to its parent.
*/
define('MENU_LINKS_TO_PARENT', 0x0008);
const MENU_LINKS_TO_PARENT = 0x0008;
/**
* Internal menu flag -- menu item can be modified by administrator.
*/
define('MENU_MODIFIED_BY_ADMIN', 0x0020);
const MENU_MODIFIED_BY_ADMIN = 0x0020;
/**
* Internal menu flag -- menu item was created by administrator.
*/
define('MENU_CREATED_BY_ADMIN', 0x0040);
const MENU_CREATED_BY_ADMIN = 0x0040;
/**
* Internal menu flag -- menu item is a local task.
*/
define('MENU_IS_LOCAL_TASK', 0x0080);
const MENU_IS_LOCAL_TASK = 0x0080;
/**
* Internal menu flag -- menu item is a local action.
*/
define('MENU_IS_LOCAL_ACTION', 0x0100);
const MENU_IS_LOCAL_ACTION = 0x0100;
/**
* @} End of "Menu flags".
......@@ -148,7 +148,7 @@
* Callbacks simply register a path so that the correct function is fired
* when the URL is accessed. They do not appear in menus or breadcrumbs.
*/
define('MENU_CALLBACK', 0x0000);
const MENU_CALLBACK = 0x0000;
/**
* Menu type -- A normal menu item, hidden until enabled by an administrator.
......@@ -201,17 +201,17 @@
* This flag may be used for local tasks like "Delete", so custom modules and
* themes can alter the default context and expose the task by altering menu.
*/
define('MENU_CONTEXT_NONE', 0x0000);
const MENU_CONTEXT_NONE = 0x0000;
/**
* Internal menu flag: Local task should be displayed in page context.
*/
define('MENU_CONTEXT_PAGE', 0x0001);
const MENU_CONTEXT_PAGE = 0x0001;
/**
* Internal menu flag: Local task should be displayed inline.
*/
define('MENU_CONTEXT_INLINE', 0x0002);
const MENU_CONTEXT_INLINE = 0x0002;
/**