web/wp-settings.php
branchwordpress
changeset 132 4d4862461b8d
parent 109 03b0d1493584
equal deleted inserted replaced
131:a4642baaf829 132:4d4862461b8d
    15 if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) )
    15 if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) )
    16 	@ini_set('memory_limit', WP_MEMORY_LIMIT);
    16 	@ini_set('memory_limit', WP_MEMORY_LIMIT);
    17 
    17 
    18 set_magic_quotes_runtime(0);
    18 set_magic_quotes_runtime(0);
    19 @ini_set('magic_quotes_sybase', 0);
    19 @ini_set('magic_quotes_sybase', 0);
       
    20 
       
    21 if ( function_exists('date_default_timezone_set') )
       
    22 	date_default_timezone_set('UTC');
    20 
    23 
    21 /**
    24 /**
    22  * Turn register globals off.
    25  * Turn register globals off.
    23  *
    26  *
    24  * @access private
    27  * @access private
    44 }
    47 }
    45 
    48 
    46 wp_unregister_GLOBALS();
    49 wp_unregister_GLOBALS();
    47 
    50 
    48 unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate );
    51 unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate );
    49 
       
    50 // Force REQUEST to be GET + POST.  If SERVER, COOKIE, or ENV are needed, use those superglobals directly.
       
    51 $_REQUEST = array_merge($_GET, $_POST);
       
    52 
    52 
    53 /**
    53 /**
    54  * The $blog_id global, which you can change in the config allows you to create a simple
    54  * The $blog_id global, which you can change in the config allows you to create a simple
    55  * multiple blog installation using just one WordPress and changing $blog_id around.
    55  * multiple blog installation using just one WordPress and changing $blog_id around.
    56  *
    56  *
   124 		$protocol = $_SERVER["SERVER_PROTOCOL"];
   124 		$protocol = $_SERVER["SERVER_PROTOCOL"];
   125 		if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
   125 		if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
   126 			$protocol = 'HTTP/1.0';
   126 			$protocol = 'HTTP/1.0';
   127 		header( "$protocol 503 Service Unavailable", true, 503 );
   127 		header( "$protocol 503 Service Unavailable", true, 503 );
   128 		header( 'Content-Type: text/html; charset=utf-8' );
   128 		header( 'Content-Type: text/html; charset=utf-8' );
       
   129 		header( 'Retry-After: 600' );
   129 ?>
   130 ?>
   130 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   131 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   131 <html xmlns="http://www.w3.org/1999/xhtml">
   132 <html xmlns="http://www.w3.org/1999/xhtml">
   132 <head>
   133 <head>
   133 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   134 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   198 		echo $r;
   199 		echo $r;
   199 	return $r;
   200 	return $r;
   200 }
   201 }
   201 timer_start();
   202 timer_start();
   202 
   203 
   203 // Add define('WP_DEBUG',true); to wp-config.php to enable display of notices during development.
   204 // Add define('WP_DEBUG', true); to wp-config.php to enable display of notices during development.
   204 if (defined('WP_DEBUG') and WP_DEBUG == true) {
   205 if ( defined('WP_DEBUG') && WP_DEBUG ) {
   205 	error_reporting(E_ALL);
   206 	if ( defined('E_DEPRECATED') )
       
   207 		error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT);
       
   208 	else
       
   209 		error_reporting(E_ALL);
       
   210 	// 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
       
   211 	if ( ! defined('WP_DEBUG_DISPLAY') || WP_DEBUG_DISPLAY )
       
   212 		ini_set('display_errors', 1);
       
   213 	// Add define('WP_DEBUG_LOG', true); to enable php debug logging to WP_CONTENT_DIR/debug.log
       
   214 	if ( defined('WP_DEBUG_LOG') && WP_DEBUG_LOG ) {
       
   215 		ini_set('log_errors', 1);
       
   216 		ini_set('error_log', WP_CONTENT_DIR . '/debug.log');
       
   217 	}
   206 } else {
   218 } else {
       
   219 	define('WP_DEBUG', false);
   207 	if ( defined('E_RECOVERABLE_ERROR') )
   220 	if ( defined('E_RECOVERABLE_ERROR') )
   208 		error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
   221 		error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
   209 	else
   222 	else
   210 		error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING);
   223 		error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING);
   211 }
   224 }
   212 
   225 
   213 // For an advanced caching plugin to use, static because you would only want one
   226 // For an advanced caching plugin to use, static because you would only want one
   214 if ( defined('WP_CACHE') )
   227 if ( defined('WP_CACHE') && WP_CACHE )
   215 	@include WP_CONTENT_DIR . '/advanced-cache.php';
   228 	@include WP_CONTENT_DIR . '/advanced-cache.php';
       
   229 
       
   230 /**
       
   231  * Private
       
   232  */ 
       
   233 if ( !defined('MEDIA_TRASH') )
       
   234 	define('MEDIA_TRASH', false);
   216 
   235 
   217 /**
   236 /**
   218  * Stores the location of the WordPress directory of functions, classes, and core content.
   237  * Stores the location of the WordPress directory of functions, classes, and core content.
   219  *
   238  *
   220  * @since 1.0.0
   239  * @since 1.0.0
   286 		$can_clone = version_compare( phpversion(), '5.0', '>=' );
   305 		$can_clone = version_compare( phpversion(), '5.0', '>=' );
   287 	}
   306 	}
   288 	return $can_clone ? clone( $object ) : $object;
   307 	return $can_clone ? clone( $object ) : $object;
   289 }
   308 }
   290 
   309 
       
   310 /**
       
   311  * Whether the current request is in WordPress admin Panel
       
   312  *
       
   313  * Does not inform on whether the user is an admin! Use capability checks to
       
   314  * tell if the user should be accessing a section or not.
       
   315  *
       
   316  * @since 1.5.1
       
   317  *
       
   318  * @return bool True if inside WordPress administration pages.
       
   319  */
       
   320 function is_admin() {
       
   321 	if ( defined('WP_ADMIN') )
       
   322 		return WP_ADMIN;
       
   323 	return false;
       
   324 }
       
   325 
   291 if ( file_exists(WP_CONTENT_DIR . '/object-cache.php') ) {
   326 if ( file_exists(WP_CONTENT_DIR . '/object-cache.php') ) {
   292 	require_once (WP_CONTENT_DIR . '/object-cache.php');
   327 	require_once (WP_CONTENT_DIR . '/object-cache.php');
   293 	$_wp_using_ext_object_cache = true;
   328 	$_wp_using_ext_object_cache = true;
   294 } else {
   329 } else {
   295 	require_once (ABSPATH . WPINC . '/cache.php');
   330 	require_once (ABSPATH . WPINC . '/cache.php');
   296 	$_wp_using_ext_object_cache = false;
   331 	$_wp_using_ext_object_cache = false;
   297 }
   332 }
   298 
   333 
   299 wp_cache_init();
   334 wp_cache_init();
   300 if ( function_exists('wp_cache_add_global_groups') ) {
   335 if ( function_exists('wp_cache_add_global_groups') ) {
   301 	wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta'));
   336 	wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-transient'));
   302 	wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
   337 	wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
   303 }
   338 }
   304 
   339 
   305 require (ABSPATH . WPINC . '/plugin.php');
   340 require (ABSPATH . WPINC . '/plugin.php');
   306 require (ABSPATH . WPINC . '/default-filters.php');
   341 require (ABSPATH . WPINC . '/default-filters.php');
   324 require (ABSPATH . WPINC . '/formatting.php');
   359 require (ABSPATH . WPINC . '/formatting.php');
   325 require (ABSPATH . WPINC . '/capabilities.php');
   360 require (ABSPATH . WPINC . '/capabilities.php');
   326 require (ABSPATH . WPINC . '/query.php');
   361 require (ABSPATH . WPINC . '/query.php');
   327 require (ABSPATH . WPINC . '/theme.php');
   362 require (ABSPATH . WPINC . '/theme.php');
   328 require (ABSPATH . WPINC . '/user.php');
   363 require (ABSPATH . WPINC . '/user.php');
       
   364 require (ABSPATH . WPINC . '/meta.php');
   329 require (ABSPATH . WPINC . '/general-template.php');
   365 require (ABSPATH . WPINC . '/general-template.php');
   330 require (ABSPATH . WPINC . '/link-template.php');
   366 require (ABSPATH . WPINC . '/link-template.php');
   331 require (ABSPATH . WPINC . '/author-template.php');
   367 require (ABSPATH . WPINC . '/author-template.php');
   332 require (ABSPATH . WPINC . '/post.php');
   368 require (ABSPATH . WPINC . '/post.php');
   333 require (ABSPATH . WPINC . '/post-template.php');
   369 require (ABSPATH . WPINC . '/post-template.php');
   524  * @since 2.5.0
   560  * @since 2.5.0
   525  */
   561  */
   526 if ( !defined( 'AUTOSAVE_INTERVAL' ) )
   562 if ( !defined( 'AUTOSAVE_INTERVAL' ) )
   527 	define( 'AUTOSAVE_INTERVAL', 60 );
   563 	define( 'AUTOSAVE_INTERVAL', 60 );
   528 
   564 
       
   565 /**
       
   566  * It is possible to define this in wp-config.php
       
   567  * @since 2.9.0
       
   568  */
       
   569 if ( !defined( 'EMPTY_TRASH_DAYS' ) )
       
   570 	define( 'EMPTY_TRASH_DAYS', 30 );
   529 
   571 
   530 require (ABSPATH . WPINC . '/vars.php');
   572 require (ABSPATH . WPINC . '/vars.php');
   531 
   573 
   532 // make taxonomies available to plugins and themes
   574 // make taxonomies available to plugins and themes
   533 // @plugin authors: warning: this gets registered again on the init hook
   575 // @plugin authors: warning: this gets registered again on the init hook
   537 if ( get_option('hack_file') ) {
   579 if ( get_option('hack_file') ) {
   538 	if ( file_exists(ABSPATH . 'my-hacks.php') )
   580 	if ( file_exists(ABSPATH . 'my-hacks.php') )
   539 		require(ABSPATH . 'my-hacks.php');
   581 		require(ABSPATH . 'my-hacks.php');
   540 }
   582 }
   541 
   583 
   542 $current_plugins = get_option('active_plugins');
   584 $current_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
   543 if ( is_array($current_plugins) && !defined('WP_INSTALLING') ) {
   585 if ( is_array($current_plugins) && !defined('WP_INSTALLING') ) {
   544 	foreach ( $current_plugins as $plugin ) {
   586 	foreach ( $current_plugins as $plugin ) {
   545 		// check the $plugin filename
   587 		// check the $plugin filename
   546 		// Validate plugin filename
   588 		// Validate plugin filename
   547 		if ( validate_file($plugin) // $plugin must validate as file
   589 		if ( validate_file($plugin) // $plugin must validate as file
   589 $_GET    = add_magic_quotes($_GET   );
   631 $_GET    = add_magic_quotes($_GET   );
   590 $_POST   = add_magic_quotes($_POST  );
   632 $_POST   = add_magic_quotes($_POST  );
   591 $_COOKIE = add_magic_quotes($_COOKIE);
   633 $_COOKIE = add_magic_quotes($_COOKIE);
   592 $_SERVER = add_magic_quotes($_SERVER);
   634 $_SERVER = add_magic_quotes($_SERVER);
   593 
   635 
       
   636 // Force REQUEST to be GET + POST.  If SERVER, COOKIE, or ENV are needed, use those superglobals directly.
       
   637 $_REQUEST = array_merge($_GET, $_POST);
       
   638 
   594 do_action('sanitize_comment_cookies');
   639 do_action('sanitize_comment_cookies');
   595 
   640 
   596 /**
   641 /**
   597  * WordPress Query object
   642  * WordPress Query object
   598  * @global object $wp_the_query
   643  * @global object $wp_the_query
   669 if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists(STYLESHEETPATH . '/functions.php') )
   714 if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists(STYLESHEETPATH . '/functions.php') )
   670 	include(STYLESHEETPATH . '/functions.php');
   715 	include(STYLESHEETPATH . '/functions.php');
   671 if ( file_exists(TEMPLATEPATH . '/functions.php') )
   716 if ( file_exists(TEMPLATEPATH . '/functions.php') )
   672 	include(TEMPLATEPATH . '/functions.php');
   717 	include(TEMPLATEPATH . '/functions.php');
   673 
   718 
       
   719 // Load in support for template functions which the theme supports
       
   720 require_if_theme_supports( 'post-thumbnails', ABSPATH . WPINC . '/post-thumbnail-template.php' );
       
   721 
   674 /**
   722 /**
   675  * Runs just before PHP shuts down execution.
   723  * Runs just before PHP shuts down execution.
   676  *
   724  *
   677  * @access private
   725  * @access private
   678  * @since 1.2.0
   726  * @since 1.2.0