Changeset 13062
- Timestamp:
- 02/12/2010 07:52:58 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/default-constants.php
r13025 r13062 7 7 8 8 /** 9 * Defines WordPress default constants. 10 * 11 * @since 3.0.0 12 * @param $context 13 */ 14 function wp_default_constants( $context ) { 15 16 switch( $context ) { 17 18 case 'init' : 19 20 // set memory limits 21 if ( !defined('WP_MEMORY_LIMIT') ) { 22 if( is_multisite() ) { 23 define('WP_MEMORY_LIMIT', '64M'); 24 } else { 25 define('WP_MEMORY_LIMIT', '32M'); 26 } 27 } 28 29 /** 30 * The $blog_id global, which you can change in the config allows you to create a simple 31 * multiple blog installation using just one WordPress and changing $blog_id around. 32 * 33 * @global int $blog_id 34 * @since 2.0.0 35 */ 36 if ( ! isset($blog_id) ) 37 $blog_id = 1; 38 39 // set memory limits. 40 if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) ) 41 @ini_set('memory_limit', WP_MEMORY_LIMIT); 42 43 if ( !defined('WP_CONTENT_DIR') ) 44 define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down 45 46 // Add define('WP_DEBUG', true); to wp-config.php to enable display of notices during development. 47 if ( !defined('WP_DEBUG') ) 48 define( 'WP_DEBUG', false ); 49 50 // Add define('WP_DEBUG_DISPLAY', false); to wp-config.php to use the globally configured setting for display_errors and not force it to On 51 if ( !defined('WP_DEBUG_DISPLAY') ) 52 define( 'WP_DEBUG_DISPLAY', true ); 53 54 // Add define('WP_DEBUG_LOG', true); to enable php debug logging to WP_CONTENT_DIR/debug.log 55 if ( !defined('WP_DEBUG_LOG') ) 56 define('WP_DEBUG_LOG', false); 57 58 if ( !defined('WP_CACHE') ) 59 define('WP_CACHE', false); 60 61 /** 62 * Private 63 */ 64 if ( !defined('MEDIA_TRASH') ) 65 define('MEDIA_TRASH', false); 66 67 if ( !defined('SHORTINIT') ) 68 define('SHORTINIT', false); 69 break; 70 71 case 'wp_included': 72 73 if ( !defined('WP_CONTENT_URL') ) 74 define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up 75 76 /** 77 * Allows for the plugins directory to be moved from the default location. 78 * 79 * @since 2.6.0 80 */ 81 if ( !defined('WP_PLUGIN_DIR') ) 82 define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash 83 84 /** 85 * Allows for the plugins directory to be moved from the default location. 86 * 87 * @since 2.6.0 88 */ 89 if ( !defined('WP_PLUGIN_URL') ) 90 define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // full url, no trailing slash 91 92 /** 93 * Allows for the plugins directory to be moved from the default location. 94 * 95 * @since 2.1.0 96 * @deprecated 97 */ 98 if ( !defined('PLUGINDIR') ) 99 define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat. 100 101 /** 102 * Allows for the mu-plugins directory to be moved from the default location. 103 * 104 * @since 2.8.0 105 */ 106 if ( !defined('WPMU_PLUGIN_DIR') ) 107 define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // full path, no trailing slash 108 109 /** 110 * Allows for the mu-plugins directory to be moved from the default location. 111 * 112 * @since 2.8.0 113 */ 114 if ( !defined('WPMU_PLUGIN_URL') ) 115 define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // full url, no trailing slash 116 117 /** 118 * Allows for the mu-plugins directory to be moved from the default location. 119 * 120 * @since 2.8.0 121 * @deprecated 122 */ 123 if ( !defined( 'MUPLUGINDIR' ) ) 124 define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat. 125 break; 126 127 case 'ms_loaded'; 128 129 global $wp_default_secret_key; 130 131 /** 132 * Used to guarantee unique hash cookies 133 * @since 1.5 134 */ 135 if ( !defined( 'COOKIEHASH' ) ) { 136 $siteurl = get_site_option( 'siteurl' ); 137 if ( $siteurl ) 138 define( 'COOKIEHASH', md5( $siteurl ) ); 139 else 140 define( 'COOKIEHASH', '' ); 141 } 142 143 /** 144 * Should be exactly the same as the default value of SECRET_KEY in wp-config-sample.php 145 * @since 2.5.0 146 */ 147 $wp_default_secret_key = 'put your unique phrase here'; 148 149 /** 150 * @since 2.0.0 151 */ 152 if ( !defined('USER_COOKIE') ) 153 define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH); 154 155 /** 156 * @since 2.0.0 157 */ 158 if ( !defined('PASS_COOKIE') ) 159 define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH); 160 161 /** 162 * @since 2.5.0 163 */ 164 if ( !defined('AUTH_COOKIE') ) 165 define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH); 166 167 /** 168 * @since 2.6.0 169 */ 170 if ( !defined('SECURE_AUTH_COOKIE') ) 171 define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH); 172 173 /** 174 * @since 2.6.0 175 */ 176 if ( !defined('LOGGED_IN_COOKIE') ) 177 define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH); 178 179 /** 180 * @since 2.3.0 181 */ 182 if ( !defined('TEST_COOKIE') ) 183 define('TEST_COOKIE', 'wordpress_test_cookie'); 184 185 /** 186 * @since 1.2.0 187 */ 188 if ( !defined('COOKIEPATH') ) 189 define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) ); 190 191 /** 192 * @since 1.5.0 193 */ 194 if ( !defined('SITECOOKIEPATH') ) 195 define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) ); 196 197 /** 198 * @since 2.6.0 199 */ 200 if ( !defined('ADMIN_COOKIE_PATH') ) 201 define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' ); 202 203 /** 204 * @since 2.6.0 205 */ 206 if ( !defined('PLUGINS_COOKIE_PATH') ) 207 define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL) ); 208 209 /** 210 * @since 2.0.0 211 */ 212 if ( !defined('COOKIE_DOMAIN') ) 213 define('COOKIE_DOMAIN', false); 214 215 /** 216 * @since 2.6.0 217 */ 218 if ( !defined('FORCE_SSL_ADMIN') ) 219 define('FORCE_SSL_ADMIN', false); 220 force_ssl_admin(FORCE_SSL_ADMIN); 221 222 /** 223 * @since 2.6.0 224 */ 225 if ( !defined('FORCE_SSL_LOGIN') ) 226 define('FORCE_SSL_LOGIN', false); 227 force_ssl_login(FORCE_SSL_LOGIN); 228 229 /** 230 * @since 2.5.0 231 */ 232 if ( !defined( 'AUTOSAVE_INTERVAL' ) ) 233 define( 'AUTOSAVE_INTERVAL', 60 ); 234 235 /** 236 * @since 2.9.0 237 */ 238 if ( !defined( 'EMPTY_TRASH_DAYS' ) ) 239 define( 'EMPTY_TRASH_DAYS', 30 ); 240 break; 241 242 case 'plugins_loaded': 243 244 if ( !defined('WP_POST_REVISIONS') ) 245 define('WP_POST_REVISIONS', true); 246 break; 247 248 case 'setup_theme': 249 250 /** 251 * Web Path to the current active template directory 252 * @since 1.5.0 253 */ 254 define('TEMPLATEPATH', get_template_directory()); 255 256 /** 257 * Web Path to the current active template stylesheet directory 258 * @since 2.1.0 259 */ 260 define('STYLESHEETPATH', get_stylesheet_directory()); 261 262 /** 263 * Slug of the fallback theme for this install. 264 * Will be used as the fallback if the current theme doesn't exist. 265 * @since 3.0.0 266 */ 267 define( 'WP_FALLBACK_THEME', 'twentyten' ); 268 break; 269 9 * Defines initial WordPress constants 10 * 11 * @since 3.0.0 12 */ 13 function wp_initial_constants( ) { 14 global $blog_id; 15 16 // set memory limits 17 if ( !defined('WP_MEMORY_LIMIT') ) { 18 if( is_multisite() ) { 19 define('WP_MEMORY_LIMIT', '64M'); 20 } else { 21 define('WP_MEMORY_LIMIT', '32M'); 22 } 270 23 } 271 24 25 /** 26 * The $blog_id global, which you can change in the config allows you to create a simple 27 * multiple blog installation using just one WordPress and changing $blog_id around. 28 * 29 * @global int $blog_id 30 * @since 2.0.0 31 */ 32 if ( ! isset($blog_id) ) 33 $blog_id = 1; 34 35 // set memory limits. 36 if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) ) 37 @ini_set('memory_limit', WP_MEMORY_LIMIT); 38 39 if ( !defined('WP_CONTENT_DIR') ) 40 define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down 41 42 // Add define('WP_DEBUG', true); to wp-config.php to enable display of notices during development. 43 if ( !defined('WP_DEBUG') ) 44 define( 'WP_DEBUG', false ); 45 46 // Add define('WP_DEBUG_DISPLAY', false); to wp-config.php to use the globally configured setting for display_errors and not force it to On 47 if ( !defined('WP_DEBUG_DISPLAY') ) 48 define( 'WP_DEBUG_DISPLAY', true ); 49 50 // Add define('WP_DEBUG_LOG', true); to enable php debug logging to WP_CONTENT_DIR/debug.log 51 if ( !defined('WP_DEBUG_LOG') ) 52 define('WP_DEBUG_LOG', false); 53 54 if ( !defined('WP_CACHE') ) 55 define('WP_CACHE', false); 56 57 /** 58 * Private 59 */ 60 if ( !defined('MEDIA_TRASH') ) 61 define('MEDIA_TRASH', false); 62 63 if ( !defined('SHORTINIT') ) 64 define('SHORTINIT', false); 65 } 66 67 /** 68 * Defines plugin directory WordPress constants 69 * 70 * Defines must-use plugin directory constants, which may be overridden in the sunrise.php drop-in 71 * 72 * @since 3.0.0 73 */ 74 function wp_plugin_directory_constants( ) { 75 if ( !defined('WP_CONTENT_URL') ) 76 define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up 77 78 /** 79 * Allows for the plugins directory to be moved from the default location. 80 * 81 * @since 2.6.0 82 */ 83 if ( !defined('WP_PLUGIN_DIR') ) 84 define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash 85 86 /** 87 * Allows for the plugins directory to be moved from the default location. 88 * 89 * @since 2.6.0 90 */ 91 if ( !defined('WP_PLUGIN_URL') ) 92 define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // full url, no trailing slash 93 94 /** 95 * Allows for the plugins directory to be moved from the default location. 96 * 97 * @since 2.1.0 98 * @deprecated 99 */ 100 if ( !defined('PLUGINDIR') ) 101 define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat. 102 103 /** 104 * Allows for the mu-plugins directory to be moved from the default location. 105 * 106 * @since 2.8.0 107 */ 108 if ( !defined('WPMU_PLUGIN_DIR') ) 109 define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // full path, no trailing slash 110 111 /** 112 * Allows for the mu-plugins directory to be moved from the default location. 113 * 114 * @since 2.8.0 115 */ 116 if ( !defined('WPMU_PLUGIN_URL') ) 117 define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // full url, no trailing slash 118 119 /** 120 * Allows for the mu-plugins directory to be moved from the default location. 121 * 122 * @since 2.8.0 123 * @deprecated 124 */ 125 if ( !defined( 'MUPLUGINDIR' ) ) 126 define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat. 127 } 128 129 /** 130 * Defines cookie related WordPress constants 131 * 132 * Defines constants after multisite is loaded. Cookie-related constants may be overridden in ms_network_cookies(). 133 * @since 3.0.0 134 */ 135 function wp_cookie_constants( ) { 136 global $wp_default_secret_key; 137 138 /** 139 * Used to guarantee unique hash cookies 140 * @since 1.5 141 */ 142 if ( !defined( 'COOKIEHASH' ) ) { 143 $siteurl = get_site_option( 'siteurl' ); 144 if ( $siteurl ) 145 define( 'COOKIEHASH', md5( $siteurl ) ); 146 else 147 define( 'COOKIEHASH', '' ); 148 } 149 150 /** 151 * Should be exactly the same as the default value of SECRET_KEY in wp-config-sample.php 152 * @since 2.5.0 153 */ 154 $wp_default_secret_key = 'put your unique phrase here'; 155 156 /** 157 * @since 2.0.0 158 */ 159 if ( !defined('USER_COOKIE') ) 160 define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH); 161 162 /** 163 * @since 2.0.0 164 */ 165 if ( !defined('PASS_COOKIE') ) 166 define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH); 167 168 /** 169 * @since 2.5.0 170 */ 171 if ( !defined('AUTH_COOKIE') ) 172 define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH); 173 174 /** 175 * @since 2.6.0 176 */ 177 if ( !defined('SECURE_AUTH_COOKIE') ) 178 define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH); 179 180 /** 181 * @since 2.6.0 182 */ 183 if ( !defined('LOGGED_IN_COOKIE') ) 184 define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH); 185 186 /** 187 * @since 2.3.0 188 */ 189 if ( !defined('TEST_COOKIE') ) 190 define('TEST_COOKIE', 'wordpress_test_cookie'); 191 192 /** 193 * @since 1.2.0 194 */ 195 if ( !defined('COOKIEPATH') ) 196 define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) ); 197 198 /** 199 * @since 1.5.0 200 */ 201 if ( !defined('SITECOOKIEPATH') ) 202 define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) ); 203 204 /** 205 * @since 2.6.0 206 */ 207 if ( !defined('ADMIN_COOKIE_PATH') ) 208 define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' ); 209 210 /** 211 * @since 2.6.0 212 */ 213 if ( !defined('PLUGINS_COOKIE_PATH') ) 214 define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL) ); 215 216 /** 217 * @since 2.0.0 218 */ 219 if ( !defined('COOKIE_DOMAIN') ) 220 define('COOKIE_DOMAIN', false); 221 } 222 223 /** 224 * Defines cookie related WordPress constants 225 * 226 * @since 3.0.0 227 */ 228 function wp_ssl_constants( ) { 229 /** 230 * @since 2.6.0 231 */ 232 if ( !defined('FORCE_SSL_ADMIN') ) 233 define('FORCE_SSL_ADMIN', false); 234 force_ssl_admin(FORCE_SSL_ADMIN); 235 236 /** 237 * @since 2.6.0 238 */ 239 if ( !defined('FORCE_SSL_LOGIN') ) 240 define('FORCE_SSL_LOGIN', false); 241 force_ssl_login(FORCE_SSL_LOGIN); 242 } 243 244 /** 245 * Defines functionality related WordPress constants 246 * 247 * @since 3.0.0 248 */ 249 function wp_functionality_constants( ) { 250 /** 251 * @since 2.5.0 252 */ 253 if ( !defined( 'AUTOSAVE_INTERVAL' ) ) 254 define( 'AUTOSAVE_INTERVAL', 60 ); 255 256 /** 257 * @since 2.9.0 258 */ 259 if ( !defined( 'EMPTY_TRASH_DAYS' ) ) 260 define( 'EMPTY_TRASH_DAYS', 30 ); 261 262 if ( !defined('WP_POST_REVISIONS') ) 263 define('WP_POST_REVISIONS', true); 264 } 265 266 /** 267 * Defines templating related WordPress constants 268 * 269 * @since 3.0.0 270 */ 271 function wp_templating_constants( ) { 272 /** 273 * Web Path to the current active template directory 274 * @since 1.5.0 275 */ 276 define('TEMPLATEPATH', get_template_directory()); 277 278 /** 279 * Web Path to the current active template stylesheet directory 280 * @since 2.1.0 281 */ 282 define('STYLESHEETPATH', get_stylesheet_directory()); 283 284 /** 285 * Slug of the fallback theme for this install. 286 * Will be used as the fallback if the current theme doesn't exist. 287 * @since 3.0.0 288 */ 289 define( 'WP_FALLBACK_THEME', 'twentyten' ); 272 290 } 273 291
Note: See TracChangeset
for help on using the changeset viewer.