Edit File by line
/home/barbar84/www/wp-inclu...
File: default-constants.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Defines constants and global variables that can be overridden, generally in wp-config.php.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Defines initial WordPress constants.
[8] Fix | Delete
*
[9] Fix | Delete
* @see wp_debug_mode()
[10] Fix | Delete
*
[11] Fix | Delete
* @since 3.0.0
[12] Fix | Delete
*
[13] Fix | Delete
* @global int $blog_id The current site ID.
[14] Fix | Delete
* @global string $wp_version The WordPress version string.
[15] Fix | Delete
*/
[16] Fix | Delete
function wp_initial_constants() {
[17] Fix | Delete
global $blog_id, $wp_version;
[18] Fix | Delete
[19] Fix | Delete
/**#@+
[20] Fix | Delete
* Constants for expressing human-readable data sizes in their respective number of bytes.
[21] Fix | Delete
*
[22] Fix | Delete
* @since 4.4.0
[23] Fix | Delete
*/
[24] Fix | Delete
define( 'KB_IN_BYTES', 1024 );
[25] Fix | Delete
define( 'MB_IN_BYTES', 1024 * KB_IN_BYTES );
[26] Fix | Delete
define( 'GB_IN_BYTES', 1024 * MB_IN_BYTES );
[27] Fix | Delete
define( 'TB_IN_BYTES', 1024 * GB_IN_BYTES );
[28] Fix | Delete
/**#@-*/
[29] Fix | Delete
[30] Fix | Delete
// Start of run timestamp.
[31] Fix | Delete
if ( ! defined( 'WP_START_TIMESTAMP' ) ) {
[32] Fix | Delete
define( 'WP_START_TIMESTAMP', microtime( true ) );
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
$current_limit = ini_get( 'memory_limit' );
[36] Fix | Delete
$current_limit_int = wp_convert_hr_to_bytes( $current_limit );
[37] Fix | Delete
[38] Fix | Delete
// Define memory limits.
[39] Fix | Delete
if ( ! defined( 'WP_MEMORY_LIMIT' ) ) {
[40] Fix | Delete
if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
[41] Fix | Delete
define( 'WP_MEMORY_LIMIT', $current_limit );
[42] Fix | Delete
} elseif ( is_multisite() ) {
[43] Fix | Delete
define( 'WP_MEMORY_LIMIT', '64M' );
[44] Fix | Delete
} else {
[45] Fix | Delete
define( 'WP_MEMORY_LIMIT', '40M' );
[46] Fix | Delete
}
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
if ( ! defined( 'WP_MAX_MEMORY_LIMIT' ) ) {
[50] Fix | Delete
if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
[51] Fix | Delete
define( 'WP_MAX_MEMORY_LIMIT', $current_limit );
[52] Fix | Delete
} elseif ( -1 === $current_limit_int || $current_limit_int > 268435456 /* = 256M */ ) {
[53] Fix | Delete
define( 'WP_MAX_MEMORY_LIMIT', $current_limit );
[54] Fix | Delete
} else {
[55] Fix | Delete
define( 'WP_MAX_MEMORY_LIMIT', '256M' );
[56] Fix | Delete
}
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
// Set memory limits.
[60] Fix | Delete
$wp_limit_int = wp_convert_hr_to_bytes( WP_MEMORY_LIMIT );
[61] Fix | Delete
if ( -1 !== $current_limit_int && ( -1 === $wp_limit_int || $wp_limit_int > $current_limit_int ) ) {
[62] Fix | Delete
ini_set( 'memory_limit', WP_MEMORY_LIMIT );
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
if ( ! isset( $blog_id ) ) {
[66] Fix | Delete
$blog_id = 1;
[67] Fix | Delete
}
[68] Fix | Delete
[69] Fix | Delete
if ( ! defined( 'WP_CONTENT_DIR' ) ) {
[70] Fix | Delete
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // No trailing slash, full paths only - WP_CONTENT_URL is defined further down.
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
// Add define( 'WP_DEBUG', true ); to wp-config.php to enable display of notices during development.
[74] Fix | Delete
if ( ! defined( 'WP_DEBUG' ) ) {
[75] Fix | Delete
if ( 'development' === wp_get_environment_type() ) {
[76] Fix | Delete
define( 'WP_DEBUG', true );
[77] Fix | Delete
} else {
[78] Fix | Delete
define( 'WP_DEBUG', false );
[79] Fix | Delete
}
[80] Fix | Delete
}
[81] Fix | Delete
[82] Fix | Delete
// Add define( 'WP_DEBUG_DISPLAY', null ); to wp-config.php to use the globally configured setting
[83] Fix | Delete
// for 'display_errors' and not force errors to be displayed. Use false to force 'display_errors' off.
[84] Fix | Delete
if ( ! defined( 'WP_DEBUG_DISPLAY' ) ) {
[85] Fix | Delete
define( 'WP_DEBUG_DISPLAY', true );
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
// Add define( 'WP_DEBUG_LOG', true ); to enable error logging to wp-content/debug.log.
[89] Fix | Delete
if ( ! defined( 'WP_DEBUG_LOG' ) ) {
[90] Fix | Delete
define( 'WP_DEBUG_LOG', false );
[91] Fix | Delete
}
[92] Fix | Delete
[93] Fix | Delete
if ( ! defined( 'WP_CACHE' ) ) {
[94] Fix | Delete
define( 'WP_CACHE', false );
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
// Add define( 'SCRIPT_DEBUG', true ); to wp-config.php to enable loading of non-minified,
[98] Fix | Delete
// non-concatenated scripts and stylesheets.
[99] Fix | Delete
if ( ! defined( 'SCRIPT_DEBUG' ) ) {
[100] Fix | Delete
if ( ! empty( $wp_version ) ) {
[101] Fix | Delete
$develop_src = false !== strpos( $wp_version, '-src' );
[102] Fix | Delete
} else {
[103] Fix | Delete
$develop_src = false;
[104] Fix | Delete
}
[105] Fix | Delete
[106] Fix | Delete
define( 'SCRIPT_DEBUG', $develop_src );
[107] Fix | Delete
}
[108] Fix | Delete
[109] Fix | Delete
/**
[110] Fix | Delete
* Private
[111] Fix | Delete
*/
[112] Fix | Delete
if ( ! defined( 'MEDIA_TRASH' ) ) {
[113] Fix | Delete
define( 'MEDIA_TRASH', false );
[114] Fix | Delete
}
[115] Fix | Delete
[116] Fix | Delete
if ( ! defined( 'SHORTINIT' ) ) {
[117] Fix | Delete
define( 'SHORTINIT', false );
[118] Fix | Delete
}
[119] Fix | Delete
[120] Fix | Delete
// Constants for features added to WP that should short-circuit their plugin implementations.
[121] Fix | Delete
define( 'WP_FEATURE_BETTER_PASSWORDS', true );
[122] Fix | Delete
[123] Fix | Delete
/**#@+
[124] Fix | Delete
* Constants for expressing human-readable intervals
[125] Fix | Delete
* in their respective number of seconds.
[126] Fix | Delete
*
[127] Fix | Delete
* Please note that these values are approximate and are provided for convenience.
[128] Fix | Delete
* For example, MONTH_IN_SECONDS wrongly assumes every month has 30 days and
[129] Fix | Delete
* YEAR_IN_SECONDS does not take leap years into account.
[130] Fix | Delete
*
[131] Fix | Delete
* If you need more accuracy please consider using the DateTime class (https://www.php.net/manual/en/class.datetime.php).
[132] Fix | Delete
*
[133] Fix | Delete
* @since 3.5.0
[134] Fix | Delete
* @since 4.4.0 Introduced `MONTH_IN_SECONDS`.
[135] Fix | Delete
*/
[136] Fix | Delete
define( 'MINUTE_IN_SECONDS', 60 );
[137] Fix | Delete
define( 'HOUR_IN_SECONDS', 60 * MINUTE_IN_SECONDS );
[138] Fix | Delete
define( 'DAY_IN_SECONDS', 24 * HOUR_IN_SECONDS );
[139] Fix | Delete
define( 'WEEK_IN_SECONDS', 7 * DAY_IN_SECONDS );
[140] Fix | Delete
define( 'MONTH_IN_SECONDS', 30 * DAY_IN_SECONDS );
[141] Fix | Delete
define( 'YEAR_IN_SECONDS', 365 * DAY_IN_SECONDS );
[142] Fix | Delete
/**#@-*/
[143] Fix | Delete
}
[144] Fix | Delete
[145] Fix | Delete
/**
[146] Fix | Delete
* Defines plugin directory WordPress constants.
[147] Fix | Delete
*
[148] Fix | Delete
* Defines must-use plugin directory constants, which may be overridden in the sunrise.php drop-in.
[149] Fix | Delete
*
[150] Fix | Delete
* @since 3.0.0
[151] Fix | Delete
*/
[152] Fix | Delete
function wp_plugin_directory_constants() {
[153] Fix | Delete
if ( ! defined( 'WP_CONTENT_URL' ) ) {
[154] Fix | Delete
define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' ); // Full URL - WP_CONTENT_DIR is defined further up.
[155] Fix | Delete
}
[156] Fix | Delete
[157] Fix | Delete
/**
[158] Fix | Delete
* Allows for the plugins directory to be moved from the default location.
[159] Fix | Delete
*
[160] Fix | Delete
* @since 2.6.0
[161] Fix | Delete
*/
[162] Fix | Delete
if ( ! defined( 'WP_PLUGIN_DIR' ) ) {
[163] Fix | Delete
define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // Full path, no trailing slash.
[164] Fix | Delete
}
[165] Fix | Delete
[166] Fix | Delete
/**
[167] Fix | Delete
* Allows for the plugins directory to be moved from the default location.
[168] Fix | Delete
*
[169] Fix | Delete
* @since 2.6.0
[170] Fix | Delete
*/
[171] Fix | Delete
if ( ! defined( 'WP_PLUGIN_URL' ) ) {
[172] Fix | Delete
define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // Full URL, no trailing slash.
[173] Fix | Delete
}
[174] Fix | Delete
[175] Fix | Delete
/**
[176] Fix | Delete
* Allows for the plugins directory to be moved from the default location.
[177] Fix | Delete
*
[178] Fix | Delete
* @since 2.1.0
[179] Fix | Delete
* @deprecated
[180] Fix | Delete
*/
[181] Fix | Delete
if ( ! defined( 'PLUGINDIR' ) ) {
[182] Fix | Delete
define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat.
[183] Fix | Delete
}
[184] Fix | Delete
[185] Fix | Delete
/**
[186] Fix | Delete
* Allows for the mu-plugins directory to be moved from the default location.
[187] Fix | Delete
*
[188] Fix | Delete
* @since 2.8.0
[189] Fix | Delete
*/
[190] Fix | Delete
if ( ! defined( 'WPMU_PLUGIN_DIR' ) ) {
[191] Fix | Delete
define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // Full path, no trailing slash.
[192] Fix | Delete
}
[193] Fix | Delete
[194] Fix | Delete
/**
[195] Fix | Delete
* Allows for the mu-plugins directory to be moved from the default location.
[196] Fix | Delete
*
[197] Fix | Delete
* @since 2.8.0
[198] Fix | Delete
*/
[199] Fix | Delete
if ( ! defined( 'WPMU_PLUGIN_URL' ) ) {
[200] Fix | Delete
define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // Full URL, no trailing slash.
[201] Fix | Delete
}
[202] Fix | Delete
[203] Fix | Delete
/**
[204] Fix | Delete
* Allows for the mu-plugins directory to be moved from the default location.
[205] Fix | Delete
*
[206] Fix | Delete
* @since 2.8.0
[207] Fix | Delete
* @deprecated
[208] Fix | Delete
*/
[209] Fix | Delete
if ( ! defined( 'MUPLUGINDIR' ) ) {
[210] Fix | Delete
define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat.
[211] Fix | Delete
}
[212] Fix | Delete
}
[213] Fix | Delete
[214] Fix | Delete
/**
[215] Fix | Delete
* Defines cookie-related WordPress constants.
[216] Fix | Delete
*
[217] Fix | Delete
* Defines constants after multisite is loaded.
[218] Fix | Delete
*
[219] Fix | Delete
* @since 3.0.0
[220] Fix | Delete
*/
[221] Fix | Delete
function wp_cookie_constants() {
[222] Fix | Delete
/**
[223] Fix | Delete
* Used to guarantee unique hash cookies.
[224] Fix | Delete
*
[225] Fix | Delete
* @since 1.5.0
[226] Fix | Delete
*/
[227] Fix | Delete
if ( ! defined( 'COOKIEHASH' ) ) {
[228] Fix | Delete
$siteurl = get_site_option( 'siteurl' );
[229] Fix | Delete
if ( $siteurl ) {
[230] Fix | Delete
define( 'COOKIEHASH', md5( $siteurl ) );
[231] Fix | Delete
} else {
[232] Fix | Delete
define( 'COOKIEHASH', '' );
[233] Fix | Delete
}
[234] Fix | Delete
}
[235] Fix | Delete
[236] Fix | Delete
/**
[237] Fix | Delete
* @since 2.0.0
[238] Fix | Delete
*/
[239] Fix | Delete
if ( ! defined( 'USER_COOKIE' ) ) {
[240] Fix | Delete
define( 'USER_COOKIE', 'wordpressuser_' . COOKIEHASH );
[241] Fix | Delete
}
[242] Fix | Delete
[243] Fix | Delete
/**
[244] Fix | Delete
* @since 2.0.0
[245] Fix | Delete
*/
[246] Fix | Delete
if ( ! defined( 'PASS_COOKIE' ) ) {
[247] Fix | Delete
define( 'PASS_COOKIE', 'wordpresspass_' . COOKIEHASH );
[248] Fix | Delete
}
[249] Fix | Delete
[250] Fix | Delete
/**
[251] Fix | Delete
* @since 2.5.0
[252] Fix | Delete
*/
[253] Fix | Delete
if ( ! defined( 'AUTH_COOKIE' ) ) {
[254] Fix | Delete
define( 'AUTH_COOKIE', 'wordpress_' . COOKIEHASH );
[255] Fix | Delete
}
[256] Fix | Delete
[257] Fix | Delete
/**
[258] Fix | Delete
* @since 2.6.0
[259] Fix | Delete
*/
[260] Fix | Delete
if ( ! defined( 'SECURE_AUTH_COOKIE' ) ) {
[261] Fix | Delete
define( 'SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH );
[262] Fix | Delete
}
[263] Fix | Delete
[264] Fix | Delete
/**
[265] Fix | Delete
* @since 2.6.0
[266] Fix | Delete
*/
[267] Fix | Delete
if ( ! defined( 'LOGGED_IN_COOKIE' ) ) {
[268] Fix | Delete
define( 'LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH );
[269] Fix | Delete
}
[270] Fix | Delete
[271] Fix | Delete
/**
[272] Fix | Delete
* @since 2.3.0
[273] Fix | Delete
*/
[274] Fix | Delete
if ( ! defined( 'TEST_COOKIE' ) ) {
[275] Fix | Delete
define( 'TEST_COOKIE', 'wordpress_test_cookie' );
[276] Fix | Delete
}
[277] Fix | Delete
[278] Fix | Delete
/**
[279] Fix | Delete
* @since 1.2.0
[280] Fix | Delete
*/
[281] Fix | Delete
if ( ! defined( 'COOKIEPATH' ) ) {
[282] Fix | Delete
define( 'COOKIEPATH', preg_replace( '|https?://[^/]+|i', '', get_option( 'home' ) . '/' ) );
[283] Fix | Delete
}
[284] Fix | Delete
[285] Fix | Delete
/**
[286] Fix | Delete
* @since 1.5.0
[287] Fix | Delete
*/
[288] Fix | Delete
if ( ! defined( 'SITECOOKIEPATH' ) ) {
[289] Fix | Delete
define( 'SITECOOKIEPATH', preg_replace( '|https?://[^/]+|i', '', get_option( 'siteurl' ) . '/' ) );
[290] Fix | Delete
}
[291] Fix | Delete
[292] Fix | Delete
/**
[293] Fix | Delete
* @since 2.6.0
[294] Fix | Delete
*/
[295] Fix | Delete
if ( ! defined( 'ADMIN_COOKIE_PATH' ) ) {
[296] Fix | Delete
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
[297] Fix | Delete
}
[298] Fix | Delete
[299] Fix | Delete
/**
[300] Fix | Delete
* @since 2.6.0
[301] Fix | Delete
*/
[302] Fix | Delete
if ( ! defined( 'PLUGINS_COOKIE_PATH' ) ) {
[303] Fix | Delete
define( 'PLUGINS_COOKIE_PATH', preg_replace( '|https?://[^/]+|i', '', WP_PLUGIN_URL ) );
[304] Fix | Delete
}
[305] Fix | Delete
[306] Fix | Delete
/**
[307] Fix | Delete
* @since 2.0.0
[308] Fix | Delete
*/
[309] Fix | Delete
if ( ! defined( 'COOKIE_DOMAIN' ) ) {
[310] Fix | Delete
define( 'COOKIE_DOMAIN', false );
[311] Fix | Delete
}
[312] Fix | Delete
[313] Fix | Delete
if ( ! defined( 'RECOVERY_MODE_COOKIE' ) ) {
[314] Fix | Delete
/**
[315] Fix | Delete
* @since 5.2.0
[316] Fix | Delete
*/
[317] Fix | Delete
define( 'RECOVERY_MODE_COOKIE', 'wordpress_rec_' . COOKIEHASH );
[318] Fix | Delete
}
[319] Fix | Delete
}
[320] Fix | Delete
[321] Fix | Delete
/**
[322] Fix | Delete
* Defines SSL-related WordPress constants.
[323] Fix | Delete
*
[324] Fix | Delete
* @since 3.0.0
[325] Fix | Delete
*/
[326] Fix | Delete
function wp_ssl_constants() {
[327] Fix | Delete
/**
[328] Fix | Delete
* @since 2.6.0
[329] Fix | Delete
*/
[330] Fix | Delete
if ( ! defined( 'FORCE_SSL_ADMIN' ) ) {
[331] Fix | Delete
if ( 'https' === parse_url( get_option( 'siteurl' ), PHP_URL_SCHEME ) ) {
[332] Fix | Delete
define( 'FORCE_SSL_ADMIN', true );
[333] Fix | Delete
} else {
[334] Fix | Delete
define( 'FORCE_SSL_ADMIN', false );
[335] Fix | Delete
}
[336] Fix | Delete
}
[337] Fix | Delete
force_ssl_admin( FORCE_SSL_ADMIN );
[338] Fix | Delete
[339] Fix | Delete
/**
[340] Fix | Delete
* @since 2.6.0
[341] Fix | Delete
* @deprecated 4.0.0
[342] Fix | Delete
*/
[343] Fix | Delete
if ( defined( 'FORCE_SSL_LOGIN' ) && FORCE_SSL_LOGIN ) {
[344] Fix | Delete
force_ssl_admin( true );
[345] Fix | Delete
}
[346] Fix | Delete
}
[347] Fix | Delete
[348] Fix | Delete
/**
[349] Fix | Delete
* Defines functionality-related WordPress constants.
[350] Fix | Delete
*
[351] Fix | Delete
* @since 3.0.0
[352] Fix | Delete
*/
[353] Fix | Delete
function wp_functionality_constants() {
[354] Fix | Delete
/**
[355] Fix | Delete
* @since 2.5.0
[356] Fix | Delete
*/
[357] Fix | Delete
if ( ! defined( 'AUTOSAVE_INTERVAL' ) ) {
[358] Fix | Delete
define( 'AUTOSAVE_INTERVAL', MINUTE_IN_SECONDS );
[359] Fix | Delete
}
[360] Fix | Delete
[361] Fix | Delete
/**
[362] Fix | Delete
* @since 2.9.0
[363] Fix | Delete
*/
[364] Fix | Delete
if ( ! defined( 'EMPTY_TRASH_DAYS' ) ) {
[365] Fix | Delete
define( 'EMPTY_TRASH_DAYS', 30 );
[366] Fix | Delete
}
[367] Fix | Delete
[368] Fix | Delete
if ( ! defined( 'WP_POST_REVISIONS' ) ) {
[369] Fix | Delete
define( 'WP_POST_REVISIONS', true );
[370] Fix | Delete
}
[371] Fix | Delete
[372] Fix | Delete
/**
[373] Fix | Delete
* @since 3.3.0
[374] Fix | Delete
*/
[375] Fix | Delete
if ( ! defined( 'WP_CRON_LOCK_TIMEOUT' ) ) {
[376] Fix | Delete
define( 'WP_CRON_LOCK_TIMEOUT', MINUTE_IN_SECONDS );
[377] Fix | Delete
}
[378] Fix | Delete
}
[379] Fix | Delete
[380] Fix | Delete
/**
[381] Fix | Delete
* Defines templating-related WordPress constants.
[382] Fix | Delete
*
[383] Fix | Delete
* @since 3.0.0
[384] Fix | Delete
*/
[385] Fix | Delete
function wp_templating_constants() {
[386] Fix | Delete
/**
[387] Fix | Delete
* Filesystem path to the current active template directory.
[388] Fix | Delete
*
[389] Fix | Delete
* @since 1.5.0
[390] Fix | Delete
*/
[391] Fix | Delete
define( 'TEMPLATEPATH', get_template_directory() );
[392] Fix | Delete
[393] Fix | Delete
/**
[394] Fix | Delete
* Filesystem path to the current active template stylesheet directory.
[395] Fix | Delete
*
[396] Fix | Delete
* @since 2.1.0
[397] Fix | Delete
*/
[398] Fix | Delete
define( 'STYLESHEETPATH', get_stylesheet_directory() );
[399] Fix | Delete
[400] Fix | Delete
/**
[401] Fix | Delete
* Slug of the default theme for this installation.
[402] Fix | Delete
* Used as the default theme when installing new sites.
[403] Fix | Delete
* It will be used as the fallback if the current theme doesn't exist.
[404] Fix | Delete
*
[405] Fix | Delete
* @since 3.0.0
[406] Fix | Delete
*
[407] Fix | Delete
* @see WP_Theme::get_core_default_theme()
[408] Fix | Delete
*/
[409] Fix | Delete
if ( ! defined( 'WP_DEFAULT_THEME' ) ) {
[410] Fix | Delete
define( 'WP_DEFAULT_THEME', 'twentytwentyone' );
[411] Fix | Delete
}
[412] Fix | Delete
[413] Fix | Delete
}
[414] Fix | Delete
[415] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function