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