[ Index ]

PHP Cross Reference of Wordpress MU 2.7

title

Body

[close]

/ -> wp-settings.php (source)

   1  <?php
   2  /**
   3   * Used to setup and fix common variables and include
   4   * the WordPress procedural and class library.
   5   *
   6   * You should not have to change this file and allows
   7   * for some configuration in wp-config.php.
   8   *
   9   * @package WordPress
  10   */
  11  
  12  if ( !defined('WP_MEMORY_LIMIT') )
  13      define('WP_MEMORY_LIMIT', '32M');
  14  
  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);
  17  
  18  
  19  /**
  20   * Turn register globals off.
  21   *
  22   * @access private
  23   * @since 2.1.0
  24   * @return null Will return null if register_globals PHP directive was disabled
  25   */
  26  function wp_unregister_GLOBALS() {
  27      if ( !ini_get('register_globals') )
  28          return;
  29  
  30      if ( isset($_REQUEST['GLOBALS']) )
  31          die('GLOBALS overwrite attempt detected');
  32  
  33      // Variables that shouldn't be unset
  34      $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix');
  35  
  36      $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
  37      foreach ( $input as $k => $v )
  38          if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) {
  39              $GLOBALS[$k] = NULL;
  40              unset($GLOBALS[$k]);
  41          }
  42  }
  43  
  44  wp_unregister_GLOBALS();
  45  
  46  unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate );
  47  
  48  /**
  49   * The $blog_id global, which you can change in the config allows you to create a simple
  50   * multiple blog installation using just one WordPress and changing $blog_id around.
  51   *
  52   * @global int $blog_id
  53   * @since 2.0.0
  54   */
  55  if ( ! isset($blog_id) )
  56      $blog_id = 0;
  57  
  58  // Fix for IIS, which doesn't set REQUEST_URI
  59  if ( empty( $_SERVER['REQUEST_URI'] ) ) {
  60  
  61      // IIS Mod-Rewrite
  62      if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {
  63          $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
  64      }
  65      // IIS Isapi_Rewrite
  66      else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
  67          $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
  68      }
  69      else
  70      {
  71          // Use ORIG_PATH_INFO if there is no PATH_INFO
  72          if ( !isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO']) )
  73              $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
  74  
  75          // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
  76          if ( isset($_SERVER['PATH_INFO']) ) {
  77              if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
  78                  $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
  79              else
  80                  $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
  81          }
  82  
  83          // Append the query string if it exists and isn't null
  84          if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
  85              $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
  86          }
  87      }
  88  }
  89  
  90  // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests
  91  if ( isset($_SERVER['SCRIPT_FILENAME']) && ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 ) )
  92      $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
  93  
  94  // Fix for Dreamhost and other PHP as CGI hosts
  95  if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false)
  96      unset($_SERVER['PATH_INFO']);
  97  
  98  
  99  if ( version_compare( '4.3', phpversion(), '>' ) ) {
 100      die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %s but WordPress requires at least 4.3.'/*/WP_I18N_OLD_PHP*/, phpversion() ) );
 101  }
 102  
 103  if ( !defined('WP_CONTENT_DIR') )
 104      define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down
 105  
 106  if ( file_exists(ABSPATH . '.maintenance') && !defined('WP_INSTALLING') ) {
 107      include(ABSPATH . '.maintenance');
 108      // If the $upgrading timestamp is older than 10 minutes, don't die.
 109      if ( ( time() - $upgrading ) < 600 ) {
 110          if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) {
 111              require_once( WP_CONTENT_DIR . '/maintenance.php' );
 112              die();
 113          }
 114  
 115          $protocol = $_SERVER["SERVER_PROTOCOL"];
 116          if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
 117              $protocol = 'HTTP/1.0';
 118          header( "$protocol 503 Service Unavailable", true, 503 );
 119          header( 'Content-Type: text/html; charset=utf-8' );
 120  ?>
 121  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 122  <html xmlns="http://www.w3.org/1999/xhtml">
 123  <head>
 124  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 125      <title>Maintenance</title>
 126  
 127  </head>
 128  <body>
 129      <h1>Briefly unavailable for scheduled maintenance. Check back in a minute.</h1>
 130  </body>
 131  </html>
 132  <?php
 133          die();
 134      }
 135  }
 136  
 137  if ( !extension_loaded('mysql') && !file_exists(WP_CONTENT_DIR . '/db.php') )
 138      die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ );
 139  
 140  /**
 141   * PHP 4 standard microtime start capture.
 142   *
 143   * @access private
 144   * @since 0.71
 145   * @global int $timestart Seconds and Microseconds added together from when function is called.
 146   * @return bool Always returns true.
 147   */
 148  function timer_start() {
 149      global $timestart;
 150      $mtime = explode(' ', microtime() );
 151      $mtime = $mtime[1] + $mtime[0];
 152      $timestart = $mtime;
 153      return true;
 154  }
 155  
 156  /**
 157   * Return and/or display the time from the page start to when function is called.
 158   *
 159   * You can get the results and print them by doing:
 160   * <code>
 161   * $nTimePageTookToExecute = timer_stop();
 162   * echo $nTimePageTookToExecute;
 163   * </code>
 164   *
 165   * Or instead, you can do:
 166   * <code>
 167   * timer_stop(1);
 168   * </code>
 169   * which will do what the above does. If you need the result, you can assign it to a variable, but
 170   * most cases, you only need to echo it.
 171   *
 172   * @since 0.71
 173   * @global int $timestart Seconds and Microseconds added together from when timer_start() is called
 174   * @global int $timeend  Seconds and Microseconds added together from when function is called
 175   *
 176   * @param int $display Use '0' or null to not echo anything and 1 to echo the total time
 177   * @param int $precision The amount of digits from the right of the decimal to display. Default is 3.
 178   * @return float The "second.microsecond" finished time calculation
 179   */
 180  function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal
 181      global $timestart, $timeend;
 182      $mtime = microtime();
 183      $mtime = explode(' ',$mtime);
 184      $mtime = $mtime[1] + $mtime[0];
 185      $timeend = $mtime;
 186      $timetotal = $timeend-$timestart;
 187      $r = ( function_exists('number_format_i18n') ) ? number_format_i18n($timetotal, $precision) : number_format($timetotal, $precision);
 188      if ( $display )
 189          echo $r;
 190      return $r;
 191  }
 192  timer_start();
 193  
 194  // Add define('WP_DEBUG',true); to wp-config.php to enable display of notices during development.
 195  if (defined('WP_DEBUG') and WP_DEBUG == true) {
 196      error_reporting(E_ALL);
 197  } else {
 198      error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE);
 199  }
 200  
 201  // For an advanced caching plugin to use, static because you would only want one
 202  if ( defined('WP_CACHE') )
 203      @include WP_CONTENT_DIR . '/advanced-cache.php';
 204  
 205  /**
 206   * Stores the location of the WordPress directory of functions, classes, and core content.
 207   *
 208   * @since 1.0.0
 209   */
 210  define('WPINC', 'wp-includes');
 211  
 212  if ( !defined('WP_LANG_DIR') ) {
 213      /**
 214       * Stores the location of the language directory. First looks for language folder in WP_CONTENT_DIR
 215       * and uses that folder if it exists. Or it uses the "languages" folder in WPINC.
 216       *
 217       * @since 2.1.0
 218       */
 219      if ( file_exists(WP_CONTENT_DIR . '/languages') && @is_dir(WP_CONTENT_DIR . '/languages') ) {
 220          define('WP_LANG_DIR', WP_CONTENT_DIR . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH
 221          if (!defined('LANGDIR')) {
 222              // Old static relative path maintained for limited backwards compatibility - won't work in some cases
 223              define('LANGDIR', 'wp-content/languages');
 224          }
 225      } else {
 226          define('WP_LANG_DIR', ABSPATH . WPINC . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH
 227          if (!defined('LANGDIR')) {
 228              // Old relative path maintained for backwards compatibility
 229              define('LANGDIR', WPINC . '/languages');
 230          }
 231      }
 232  }
 233  
 234  require (ABSPATH . WPINC . '/compat.php');
 235  require (ABSPATH . WPINC . '/functions.php');
 236  require (ABSPATH . WPINC . '/classes.php');
 237  
 238  require_wp_db();
 239  
 240  if ( !empty($wpdb->error) )
 241      dead_db();
 242  
 243  $prefix = $wpdb->set_prefix($table_prefix); // set up global tables
 244  
 245  if ( is_wp_error($prefix) )
 246      wp_die(/*WP_I18N_BAD_PREFIX*/'<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/);
 247  
 248  if ( file_exists(WP_CONTENT_DIR . '/object-cache.php') )
 249      require_once (WP_CONTENT_DIR . '/object-cache.php');
 250  else
 251      require_once (ABSPATH . WPINC . '/cache.php');
 252  
 253  wp_cache_init();
 254  if ( function_exists('wp_cache_add_global_groups') ) {
 255      wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss'));
 256      wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
 257  }
 258  
 259  if( defined( 'SUNRISE' ) )
 260      include_once( ABSPATH . 'wp-content/sunrise.php' );
 261  
 262  require_once  ( ABSPATH . 'wpmu-settings.php' );
 263  $wpdb->blogid           = $current_blog->blog_id;
 264  $wpdb->siteid           = $current_blog->site_id;
 265  $wpdb->set_prefix($table_prefix); // set up blog tables
 266  $table_prefix = $table_prefix . $blog_id . '_';
 267  
 268  // Fix empty PHP_SELF
 269  $PHP_SELF = $_SERVER['PHP_SELF'];
 270  if ( empty($PHP_SELF) || ( constant( 'VHOST' ) == 'no' && $current_blog->path != '/' ) )
 271      $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
 272  
 273  wp_cache_init(); // need to init cache again after blog_id is set
 274  if ( function_exists('wp_cache_add_global_groups') ) { // need to add these again. Yes, it's an ugly hack
 275      wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss'));
 276      wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
 277  }
 278  
 279  if( !defined( "UPLOADBLOGSDIR" ) )
 280      define( "UPLOADBLOGSDIR", 'wp-content/blogs.dir' );
 281  
 282  if( !defined( "UPLOADS" ) )
 283      define( "UPLOADS", UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" );
 284  
 285  if( !defined( "BLOGUPLOADDIR" ) )
 286      define( "BLOGUPLOADDIR", WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" );
 287  
 288  require (ABSPATH . WPINC . '/plugin.php');
 289  require (ABSPATH . WPINC . '/default-filters.php');
 290  
 291  /**
 292   * Runs just before PHP shuts down execution.
 293   *
 294   * @access private
 295   * @since 1.2.0
 296   */
 297  function shutdown_action_hook() {
 298      do_action('shutdown');
 299      wp_cache_close();
 300  }
 301  register_shutdown_function('shutdown_action_hook');
 302  
 303  if( defined( "SHORTINIT" ) && constant( "SHORTINIT" ) == true ) // stop most of WP being loaded, we just want the basics
 304      return false;
 305  
 306  include_once(ABSPATH . WPINC . '/streams.php');
 307  include_once(ABSPATH . WPINC . '/gettext.php');
 308  require_once (ABSPATH . WPINC . '/l10n.php');
 309  
 310  if ( !is_blog_installed() && !defined('WP_INSTALLING') ) {
 311      die( __( 'The blog you have requested is not installed properly. Please contact the system administrator.' ) ); // have to die here ~ Mark
 312  }
 313  
 314  require (ABSPATH . WPINC . '/formatting.php');
 315  require (ABSPATH . WPINC . '/capabilities.php');
 316  require (ABSPATH . WPINC . '/query.php');
 317  require (ABSPATH . WPINC . '/theme.php');
 318  require (ABSPATH . WPINC . '/user.php');
 319  require (ABSPATH . WPINC . '/general-template.php');
 320  require (ABSPATH . WPINC . '/link-template.php');
 321  require (ABSPATH . WPINC . '/author-template.php');
 322  require (ABSPATH . WPINC . '/post.php');
 323  require (ABSPATH . WPINC . '/post-template.php');
 324  require (ABSPATH . WPINC . '/category.php');
 325  require (ABSPATH . WPINC . '/category-template.php');
 326  require (ABSPATH . WPINC . '/comment.php');
 327  require (ABSPATH . WPINC . '/comment-template.php');
 328  require (ABSPATH . WPINC . '/rewrite.php');
 329  require (ABSPATH . WPINC . '/feed.php');
 330  require (ABSPATH . WPINC . '/bookmark.php');
 331  require (ABSPATH . WPINC . '/bookmark-template.php');
 332  require (ABSPATH . WPINC . '/kses.php');
 333  require (ABSPATH . WPINC . '/cron.php');
 334  require (ABSPATH . WPINC . '/version.php');
 335  require (ABSPATH . WPINC . '/deprecated.php');
 336  require (ABSPATH . WPINC . '/script-loader.php');
 337  require (ABSPATH . WPINC . '/taxonomy.php');
 338  require (ABSPATH . WPINC . '/update.php');
 339  require (ABSPATH . WPINC . '/canonical.php');
 340  require (ABSPATH . WPINC . '/shortcodes.php');
 341  require (ABSPATH . WPINC . '/media.php');
 342  require (ABSPATH . WPINC . '/http.php');
 343  
 344  if ( !defined('WP_CONTENT_URL') )
 345      define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up
 346  
 347  require_once( ABSPATH . WPINC . '/wpmu-functions.php' );
 348  require (ABSPATH . WPINC . '/wpmu-default-filters.php'); // WPmu Filters 
 349  
 350  /**
 351   * Allows for the plugins directory to be moved from the default location.
 352   *
 353   * @since 2.6.0
 354   */
 355  if ( !defined('WP_PLUGIN_DIR') )
 356      define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash
 357  
 358  /**
 359   * Allows for the plugins directory to be moved from the default location.
 360   *
 361   * @since 2.6.0
 362   */
 363  if ( !defined('WP_PLUGIN_URL') )
 364      define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // full url, no trailing slash
 365  
 366  /**
 367   * Allows for the plugins directory to be moved from the default location.
 368   *
 369   * @since 2.1.0
 370   */
 371  if ( !defined('PLUGINDIR') )
 372      define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH.  For back compat.
 373  
 374  if( !isset($current_site->site_name) )
 375      $current_site->site_name = get_site_option('site_name');
 376  if( $current_site->site_name == false )
 377      $current_site->site_name = ucfirst( $current_site->domain );
 378      
 379  if ( ! defined('WP_INSTALLING') ) {
 380      // Used to guarantee unique hash cookies
 381      if ( !isset($cookiehash) )
 382          $cookiehash = '';
 383  
 384      /**
 385       * Used to guarantee unique hash cookies
 386       * @since 1.5
 387       */
 388      if ( !defined('COOKIEHASH') )
 389          define( 'COOKIEHASH', $cookiehash );
 390  }
 391  
 392  $wpdb->hide_errors();
 393  if ( !defined('WPMU_PLUGIN_DIR') )
 394      define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // full path, no trailing slash
 395  if ( !defined('WPMU_PLUGIN_URL') )
 396      define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // full url, no trailing slash
 397  if( defined( 'MUPLUGINDIR' ) == false ) 
 398      define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH.  For back compat.
 399  
 400  if( is_dir( WPMU_PLUGIN_DIR ) ) {
 401      if( $dh = opendir( WPMU_PLUGIN_DIR ) ) {
 402          while( ( $plugin = readdir( $dh ) ) !== false ) {
 403              if( substr( $plugin, -4 ) == '.php' ) {
 404                  include_once( WPMU_PLUGIN_DIR . '/' . $plugin );
 405              }
 406          }
 407      }
 408  }
 409  do_action('muplugins_loaded');
 410  $wpdb->show_errors();
 411  
 412  if ( '1' == $current_blog->deleted ) {
 413      header('HTTP/1.1 410 Gone');
 414      graceful_fail(__('This user has elected to delete their account and the content is no longer available.'));
 415  }
 416  
 417  if ( '2' == $current_blog->deleted )
 418      graceful_fail( sprintf( __( 'This blog has not been activated yet. If you are having problems activating your blog, please contact <a href="mailto:%1$s">%1$s</a>.' ), str_replace( '@', ' AT ', get_site_option( 'admin_email', "support@{$current_site->domain}" ) ) ) );
 419  
 420  if( $current_blog->archived == '1' || $current_blog->spam == '1' ) {
 421      header('HTTP/1.1 410 Gone');
 422      graceful_fail(__('This blog has been archived or suspended.'));
 423  }
 424  
 425  /**
 426   * Should be exactly the same as the default value of SECRET_KEY in wp-config-sample.php
 427   * @since 2.5.0
 428   */
 429  $wp_default_secret_key = 'put your unique phrase here';
 430  
 431  /**
 432   * It is possible to define this in wp-config.php
 433   * @since 2.0.0
 434   */
 435  if ( !defined('USER_COOKIE') )
 436      define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH);
 437  
 438  /**
 439   * It is possible to define this in wp-config.php
 440   * @since 2.0.0
 441   */
 442  if ( !defined('PASS_COOKIE') )
 443      define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH);
 444  
 445  /**
 446   * It is possible to define this in wp-config.php
 447   * @since 2.5.0
 448   */
 449  if ( !defined('AUTH_COOKIE') )
 450      define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH);
 451  
 452  /**
 453   * It is possible to define this in wp-config.php
 454   * @since 2.6.0
 455   */
 456  if ( !defined('SECURE_AUTH_COOKIE') )
 457      define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH);
 458  
 459  /**
 460   * It is possible to define this in wp-config.php
 461   * @since 2.6.0
 462   */
 463  if ( !defined('LOGGED_IN_COOKIE') )
 464      define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH);
 465  
 466  /**
 467   * It is possible to define this in wp-config.php
 468   * @since 2.3.0
 469   */
 470  if ( !defined('TEST_COOKIE') )
 471      define('TEST_COOKIE', 'wordpress_test_cookie');
 472  
 473  /**
 474   * It is possible to define this in wp-config.php
 475   * @since 1.2.0
 476   */
 477  if ( !defined('COOKIEPATH') )
 478      define('COOKIEPATH', $current_site->path );
 479  
 480  /**
 481   * It is possible to define this in wp-config.php
 482   * @since 1.5.0
 483   */
 484  if ( !defined('SITECOOKIEPATH') )
 485      define('SITECOOKIEPATH', $current_site->path );
 486  
 487  /**
 488   * It is possible to define this in wp-config.php
 489   * @since 2.6.0
 490   */
 491  if ( !defined('ADMIN_COOKIE_PATH') ) {
 492      if( constant( 'VHOST' ) == 'no' ) {
 493          define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH );
 494      } else {
 495          define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
 496      }
 497  }
 498  
 499  /**
 500   * It is possible to define this in wp-config.php
 501   * @since 2.6.0
 502   */
 503  if ( !defined('PLUGINS_COOKIE_PATH') )
 504      define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL)  );
 505  
 506  /**
 507   * It is possible to define this in wp-config.php
 508   * @since 2.0.0
 509   */
 510  if ( !defined('COOKIE_DOMAIN') )
 511      define('COOKIE_DOMAIN', '.' . $current_site->domain);
 512  
 513  /**
 514   * It is possible to define this in wp-config.php
 515   * @since 2.6.0
 516   */
 517  if ( !defined('FORCE_SSL_ADMIN') )
 518      define('FORCE_SSL_ADMIN', false);
 519  force_ssl_admin(FORCE_SSL_ADMIN);
 520  
 521  /**
 522   * It is possible to define this in wp-config.php
 523   * @since 2.6.0
 524   */
 525  if ( !defined('FORCE_SSL_LOGIN') )
 526      define('FORCE_SSL_LOGIN', false);
 527  force_ssl_login(FORCE_SSL_LOGIN);
 528  
 529  /**
 530   * It is possible to define this in wp-config.php
 531   * @since 2.5.0
 532   */
 533  if ( !defined( 'AUTOSAVE_INTERVAL' ) )
 534      define( 'AUTOSAVE_INTERVAL', 60 );
 535  
 536  
 537  require (ABSPATH . WPINC . '/vars.php');
 538  
 539  
 540  if ( get_option('active_plugins') && !defined('WP_INSTALLING') ) {
 541      $current_plugins = get_option('active_plugins');
 542      if ( is_array($current_plugins) ) {
 543          foreach ($current_plugins as $plugin) {
 544              if ( '' != $plugin && 0 == validate_file($plugin) && file_exists(WP_PLUGIN_DIR . '/' . $plugin) )
 545                  include_once(WP_PLUGIN_DIR . '/' . $plugin);
 546          }
 547      }
 548  }
 549  
 550  require (ABSPATH . WPINC . '/pluggable.php');
 551  
 552  /*
 553   * In most cases the default internal encoding is latin1, which is of no use,
 554   * since we want to use the mb_ functions for utf-8 strings
 555   */
 556  if (function_exists('mb_internal_encoding')) {
 557      if (!@mb_internal_encoding(get_option('blog_charset')))
 558          mb_internal_encoding('UTF-8');
 559  }
 560  
 561  
 562  if ( defined('WP_CACHE') && function_exists('wp_cache_postload') )
 563      wp_cache_postload();
 564  
 565  do_action('plugins_loaded');
 566  
 567  $default_constants = array( 'WP_POST_REVISIONS' => true );
 568  foreach ( $default_constants as $c => $v )
 569      @define( $c, $v ); // will fail if the constant is already defined
 570  unset($default_constants, $c, $v);
 571  
 572  // If already slashed, strip.
 573  if ( get_magic_quotes_gpc() ) {
 574      $_GET    = stripslashes_deep($_GET   );
 575      $_POST   = stripslashes_deep($_POST  );
 576      $_COOKIE = stripslashes_deep($_COOKIE);
 577  }
 578  
 579  // Escape with wpdb.
 580  $_GET    = add_magic_quotes($_GET   );
 581  $_POST   = add_magic_quotes($_POST  );
 582  $_COOKIE = add_magic_quotes($_COOKIE);
 583  $_SERVER = add_magic_quotes($_SERVER);
 584  
 585  do_action('sanitize_comment_cookies');
 586  
 587  /**
 588   * WordPress Query object
 589   * @global object $wp_the_query
 590   * @since 2.0.0
 591   */
 592  $wp_the_query =& new WP_Query();
 593  
 594  /**
 595   * Holds the reference to @see $wp_the_query
 596   * Use this global for WordPress queries
 597   * @global object $wp_query
 598   * @since 1.5.0
 599   */
 600  $wp_query     =& $wp_the_query;
 601  
 602  /**
 603   * Holds the WordPress Rewrite object for creating pretty URLs
 604   * @global object $wp_rewrite
 605   * @since 1.5.0
 606   */
 607  $wp_rewrite   =& new WP_Rewrite();
 608  
 609  /**
 610   * WordPress Object
 611   * @global object $wp
 612   * @since 2.0.0
 613   */
 614  $wp           =& new WP();
 615  
 616  do_action('setup_theme');
 617  
 618  /**
 619   * Web Path to the current active template directory
 620   * @since 1.5.0
 621   */
 622  define('TEMPLATEPATH', get_template_directory());
 623  
 624  /**
 625   * Web Path to the current active template stylesheet directory
 626   * @since 2.1.0
 627   */
 628  define('STYLESHEETPATH', get_stylesheet_directory());
 629  
 630  // Load the default text localization domain.
 631  load_default_textdomain();
 632  
 633  /**
 634   * The locale of the blog
 635   * @since 1.5.0
 636   */
 637  $locale = get_locale();
 638  $locale_file = WP_LANG_DIR . "/$locale.php";
 639  if ( is_readable($locale_file) )
 640      require_once($locale_file);
 641  
 642  // Pull in locale data after loading text domain.
 643  require_once(ABSPATH . WPINC . '/locale.php');
 644  
 645  /**
 646   * WordPress Locale object for loading locale domain date and various strings.
 647   * @global object $wp_locale
 648   * @since 2.1.0
 649   */
 650  $wp_locale =& new WP_Locale();
 651  
 652  // Load functions for active theme.
 653  if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists(STYLESHEETPATH . '/functions.php') )
 654      include(STYLESHEETPATH . '/functions.php');
 655  if ( file_exists(TEMPLATEPATH . '/functions.php') )
 656      include(TEMPLATEPATH . '/functions.php');
 657  
 658  $wp->init();  // Sets up current user.
 659  
 660  // Everything is loaded and initialized.
 661  do_action('init');
 662  
 663  ?>


Generated: Thu Mar 5 12:05:07 2009 Cross-referenced by PHPXref 0.7