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 . '/canonical.php');
mp-wp_genesis 307 require (ABSPATH . WPINC . '/shortcodes.php');
mp-wp_genesis 308 require (ABSPATH . WPINC . '/media.php');
mp-wp_genesis 309 require (ABSPATH . WPINC . '/http.php');
mp-wp_genesis 310
mp-wp_genesis 311 if ( !defined('WP_CONTENT_URL') )
mp-wp_genesis 312 define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up
mp-wp_genesis 313
mp-wp_genesis 314 /**
mp-wp_genesis 315 * Allows for the plugins directory to be moved from the default location.
mp-wp_genesis 316 *
mp-wp_genesis 317 * @since 2.6.0
mp-wp_genesis 318 */
mp-wp_genesis 319 if ( !defined('WP_PLUGIN_DIR') )
mp-wp_genesis 320 define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash
mp-wp_genesis 321
mp-wp_genesis 322 /**
mp-wp_genesis 323 * Allows for the plugins directory to be moved from the default location.
mp-wp_genesis 324 *
mp-wp_genesis 325 * @since 2.6.0
mp-wp_genesis 326 */
mp-wp_genesis 327 if ( !defined('WP_PLUGIN_URL') )
mp-wp_genesis 328 define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // full url, no trailing slash
mp-wp_genesis 329
mp-wp_genesis 330 /**
mp-wp_genesis 331 * Allows for the plugins directory to be moved from the default location.
mp-wp_genesis 332 *
mp-wp_genesis 333 * @since 2.1.0
mp-wp_genesis 334 */
mp-wp_genesis 335 if ( !defined('PLUGINDIR') )
mp-wp_genesis 336 define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat.
mp-wp_genesis 337
mp-wp_genesis 338 /**
mp-wp_genesis 339 * Used to guarantee unique hash cookies
mp-wp_genesis 340 * @since 1.5
mp-wp_genesis 341 */
mp-wp_genesis 342 define('COOKIEHASH', md5(get_option('siteurl')));
mp-wp_genesis 343
mp-wp_genesis 344 /**
mp-wp_genesis 345 * Should be exactly the same as the default value of SECRET_KEY in wp-config-sample.php
mp-wp_genesis 346 * @since 2.5.0
mp-wp_genesis 347 */
mp-wp_genesis 348 $wp_default_secret_key = 'put your unique phrase here';
mp-wp_genesis 349
mp-wp_genesis 350 /**
mp-wp_genesis 351 * It is possible to define this in wp-config.php
mp-wp_genesis 352 * @since 2.0.0
mp-wp_genesis 353 */
mp-wp_genesis 354 if ( !defined('USER_COOKIE') )
mp-wp_genesis 355 define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH);
mp-wp_genesis 356
mp-wp_genesis 357 /**
mp-wp_genesis 358 * It is possible to define this in wp-config.php
mp-wp_genesis 359 * @since 2.0.0
mp-wp_genesis 360 */
mp-wp_genesis 361 if ( !defined('PASS_COOKIE') )
mp-wp_genesis 362 define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH);
mp-wp_genesis 363
mp-wp_genesis 364 /**
mp-wp_genesis 365 * It is possible to define this in wp-config.php
mp-wp_genesis 366 * @since 2.5.0
mp-wp_genesis 367 */
mp-wp_genesis 368 if ( !defined('AUTH_COOKIE') )
mp-wp_genesis 369 define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH);
mp-wp_genesis 370
mp-wp_genesis 371 /**
mp-wp_genesis 372 * It is possible to define this in wp-config.php
mp-wp_genesis 373 * @since 2.6.0
mp-wp_genesis 374 */
mp-wp_genesis 375 if ( !defined('SECURE_AUTH_COOKIE') )
mp-wp_genesis 376 define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH);
mp-wp_genesis 377
mp-wp_genesis 378 /**
mp-wp_genesis 379 * It is possible to define this in wp-config.php
mp-wp_genesis 380 * @since 2.6.0
mp-wp_genesis 381 */
mp-wp_genesis 382 if ( !defined('LOGGED_IN_COOKIE') )
mp-wp_genesis 383 define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH);
mp-wp_genesis 384
mp-wp_genesis 385 /**
mp-wp_genesis 386 * It is possible to define this in wp-config.php
mp-wp_genesis 387 * @since 2.3.0
mp-wp_genesis 388 */
mp-wp_genesis 389 if ( !defined('TEST_COOKIE') )
mp-wp_genesis 390 define('TEST_COOKIE', 'wordpress_test_cookie');
mp-wp_genesis 391
mp-wp_genesis 392 /**
mp-wp_genesis 393 * It is possible to define this in wp-config.php
mp-wp_genesis 394 * @since 1.2.0
mp-wp_genesis 395 */
mp-wp_genesis 396 if ( !defined('COOKIEPATH') )
mp-wp_genesis 397 define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) );
mp-wp_genesis 398
mp-wp_genesis 399 /**
mp-wp_genesis 400 * It is possible to define this in wp-config.php
mp-wp_genesis 401 * @since 1.5.0
mp-wp_genesis 402 */
mp-wp_genesis 403 if ( !defined('SITECOOKIEPATH') )
mp-wp_genesis 404 define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) );
mp-wp_genesis 405
mp-wp_genesis 406 /**
mp-wp_genesis 407 * It is possible to define this in wp-config.php
mp-wp_genesis 408 * @since 2.6.0
mp-wp_genesis 409 */
mp-wp_genesis 410 if ( !defined('ADMIN_COOKIE_PATH') )
mp-wp_genesis 411 define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
mp-wp_genesis 412
mp-wp_genesis 413 /**
mp-wp_genesis 414 * It is possible to define this in wp-config.php
mp-wp_genesis 415 * @since 2.6.0
mp-wp_genesis 416 */
mp-wp_genesis 417 if ( !defined('PLUGINS_COOKIE_PATH') )
mp-wp_genesis 418 define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL) );
mp-wp_genesis 419
mp-wp_genesis 420 /**
mp-wp_genesis 421 * It is possible to define this in wp-config.php
mp-wp_genesis 422 * @since 2.0.0
mp-wp_genesis 423 */
mp-wp_genesis 424 if ( !defined('COOKIE_DOMAIN') )
mp-wp_genesis 425 define('COOKIE_DOMAIN', false);
mp-wp_genesis 426
mp-wp_genesis 427 /**
mp-wp_genesis 428 * It is possible to define this in wp-config.php
mp-wp_genesis 429 * @since 2.6.0
mp-wp_genesis 430 */
mp-wp_genesis 431 if ( !defined('FORCE_SSL_ADMIN') )
mp-wp_genesis 432 define('FORCE_SSL_ADMIN', false);
mp-wp_genesis 433 force_ssl_admin(FORCE_SSL_ADMIN);
mp-wp_genesis 434
mp-wp_genesis 435 /**
mp-wp_genesis 436 * It is possible to define this in wp-config.php
mp-wp_genesis 437 * @since 2.6.0
mp-wp_genesis 438 */
mp-wp_genesis 439 if ( !defined('FORCE_SSL_LOGIN') )
mp-wp_genesis 440 define('FORCE_SSL_LOGIN', false);
mp-wp_genesis 441 force_ssl_login(FORCE_SSL_LOGIN);
mp-wp_genesis 442
mp-wp_genesis 443 /**
mp-wp_genesis 444 * It is possible to define this in wp-config.php
mp-wp_genesis 445 * @since 2.5.0
mp-wp_genesis 446 */
mp-wp_genesis 447 if ( !defined( 'AUTOSAVE_INTERVAL' ) )
mp-wp_genesis 448 define( 'AUTOSAVE_INTERVAL', 60 );
mp-wp_genesis 449
mp-wp_genesis 450
mp-wp_genesis 451 require (ABSPATH . WPINC . '/vars.php');
mp-wp_genesis 452
mp-wp_genesis 453 // Check for hacks file if the option is enabled
mp-wp_genesis 454 if (get_option('hack_file')) {
mp-wp_genesis 455 if (file_exists(ABSPATH . 'my-hacks.php'))
mp-wp_genesis 456 require(ABSPATH . 'my-hacks.php');
mp-wp_genesis 457 }
mp-wp_genesis 458
mp-wp_genesis 459 if ( get_option('active_plugins') && !defined('WP_INSTALLING') ) {
mp-wp_genesis 460 $current_plugins = get_option('active_plugins');
mp-wp_genesis 461 if ( is_array($current_plugins) ) {
mp-wp_genesis 462 foreach ($current_plugins as $plugin) {
mp-wp_genesis 463 if ( '' != $plugin && 0 == validate_file($plugin) && file_exists(WP_PLUGIN_DIR . '/' . $plugin) )
mp-wp_genesis 464 include_once(WP_PLUGIN_DIR . '/' . $plugin);
mp-wp_genesis 465 }
mp-wp_genesis 466 }
mp-wp_genesis 467 }
mp-wp_genesis 468
mp-wp_genesis 469 require (ABSPATH . WPINC . '/pluggable.php');
mp-wp_genesis 470
mp-wp_genesis 471 /*
mp-wp_genesis 472 * In most cases the default internal encoding is latin1, which is of no use,
mp-wp_genesis 473 * since we want to use the mb_ functions for utf-8 strings
mp-wp_genesis 474 */
mp-wp_genesis 475 if (function_exists('mb_internal_encoding')) {
mp-wp_genesis 476 if (!@mb_internal_encoding(get_option('blog_charset')))
mp-wp_genesis 477 mb_internal_encoding('UTF-8');
mp-wp_genesis 478 }
mp-wp_genesis 479
mp-wp_genesis 480
mp-wp_genesis 481 if ( defined('WP_CACHE') && function_exists('wp_cache_postload') )
mp-wp_genesis 482 wp_cache_postload();
mp-wp_genesis 483
mp-wp_genesis 484 do_action('plugins_loaded');
mp-wp_genesis 485
mp-wp_genesis 486 $default_constants = array( 'WP_POST_REVISIONS' => true );
mp-wp_genesis 487 foreach ( $default_constants as $c => $v )
mp-wp_genesis 488 @define( $c, $v ); // will fail if the constant is already defined
mp-wp_genesis 489 unset($default_constants, $c, $v);
mp-wp_genesis 490
mp-wp_genesis 491 // If already slashed, strip.
mp-wp_genesis 492 if ( get_magic_quotes_gpc() ) {
mp-wp_genesis 493 $_GET = stripslashes_deep($_GET );
mp-wp_genesis 494 $_POST = stripslashes_deep($_POST );
mp-wp_genesis 495 $_COOKIE = stripslashes_deep($_COOKIE);
mp-wp_genesis 496 }
mp-wp_genesis 497
mp-wp_genesis 498 // Escape with wpdb.
mp-wp_genesis 499 $_GET = add_magic_quotes($_GET );
mp-wp_genesis 500 $_POST = add_magic_quotes($_POST );
mp-wp_genesis 501 $_COOKIE = add_magic_quotes($_COOKIE);
mp-wp_genesis 502 $_SERVER = add_magic_quotes($_SERVER);
mp-wp_genesis 503
mp-wp_genesis 504 do_action('sanitize_comment_cookies');
mp-wp_genesis 505
mp-wp_genesis 506 /**
mp-wp_genesis 507 * WordPress Query object
mp-wp_genesis 508 * @global object $wp_the_query
mp-wp_genesis 509 * @since 2.0.0
mp-wp_genesis 510 */
mp-wp_genesis 511 $wp_the_query = new WP_Query();
mp-wp_genesis 512
mp-wp_genesis 513 /**
mp-wp_genesis 514 * Holds the reference to @see $wp_the_query
mp-wp_genesis 515 * Use this global for WordPress queries
mp-wp_genesis 516 * @global object $wp_query
mp-wp_genesis 517 * @since 1.5.0
mp-wp_genesis 518 */
mp-wp_genesis 519 $wp_query =& $wp_the_query;
mp-wp_genesis 520
mp-wp_genesis 521 /**
mp-wp_genesis 522 * Holds the WordPress Rewrite object for creating pretty URLs
mp-wp_genesis 523 * @global object $wp_rewrite
mp-wp_genesis 524 * @since 1.5.0
mp-wp_genesis 525 */
mp-wp_genesis 526 $wp_rewrite = new WP_Rewrite();
mp-wp_genesis 527
mp-wp_genesis 528 /**
mp-wp_genesis 529 * WordPress Object
mp-wp_genesis 530 * @global object $wp
mp-wp_genesis 531 * @since 2.0.0
mp-wp_genesis 532 */
mp-wp_genesis 533 $wp = new WP();
mp-wp_genesis 534
mp-wp_genesis 535 do_action('setup_theme');
mp-wp_genesis 536
mp-wp_genesis 537 /**
mp-wp_genesis 538 * Web Path to the current active template directory
mp-wp_genesis 539 * @since 1.5.0
mp-wp_genesis 540 */
mp-wp_genesis 541 define('TEMPLATEPATH', get_template_directory());
mp-wp_genesis 542
mp-wp_genesis 543 /**
mp-wp_genesis 544 * Web Path to the current active template stylesheet directory
mp-wp_genesis 545 * @since 2.1.0
mp-wp_genesis 546 */
mp-wp_genesis 547 define('STYLESHEETPATH', get_stylesheet_directory());
mp-wp_genesis 548
mp-wp_genesis 549 // Load the default text localization domain.
mp-wp_genesis 550 load_default_textdomain();
mp-wp_genesis 551
mp-wp_genesis 552 /**
mp-wp_genesis 553 * The locale of the blog
mp-wp_genesis 554 * @since 1.5.0
mp-wp_genesis 555 */
mp-wp_genesis 556 $locale = get_locale();
mp-wp_genesis 557 $locale_file = WP_LANG_DIR . "/$locale.php";
mp-wp_genesis 558 if ( is_readable($locale_file) )
mp-wp_genesis 559 require_once($locale_file);
mp-wp_genesis 560
mp-wp_genesis 561 // Pull in locale data after loading text domain.
mp-wp_genesis 562 require_once(ABSPATH . WPINC . '/locale.php');
mp-wp_genesis 563
mp-wp_genesis 564 /**
mp-wp_genesis 565 * WordPress Locale object for loading locale domain date and various strings.
mp-wp_genesis 566 * @global object $wp_locale
mp-wp_genesis 567 * @since 2.1.0
mp-wp_genesis 568 */
mp-wp_genesis 569 $wp_locale = new WP_Locale();
mp-wp_genesis 570
mp-wp_genesis 571 // Load functions for active theme.
mp-wp_genesis 572 if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists(STYLESHEETPATH . '/functions.php') )
mp-wp_genesis 573 include(STYLESHEETPATH . '/functions.php');
mp-wp_genesis 574 if ( file_exists(TEMPLATEPATH . '/functions.php') )
mp-wp_genesis 575 include(TEMPLATEPATH . '/functions.php');
mp-wp_genesis 576
mp-wp_genesis 577 /**
mp-wp_genesis 578 * Runs just before PHP shuts down execution.
mp-wp_genesis 579 *
mp-wp_genesis 580 * @access private
mp-wp_genesis 581 * @since 1.2.0
mp-wp_genesis 582 */
mp-wp_genesis 583 function shutdown_action_hook() {
mp-wp_genesis 584 do_action('shutdown');
mp-wp_genesis 585 wp_cache_close();
mp-wp_genesis 586 }
mp-wp_genesis 587 register_shutdown_function('shutdown_action_hook');
mp-wp_genesis 588
mp-wp_genesis 589 $wp->init(); // Sets up current user.
mp-wp_genesis 590
mp-wp_genesis 591 // Everything is loaded and initialized.
mp-wp_genesis 592 do_action('init');
mp-wp_genesis 593
mp-wp_genesis 594 ?>