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 }
mp-wp_genesis 202
mp-wp_genesis 203 // For an advanced caching plugin to use, static because you would only want one
mp-wp_genesis 204 if ( defined('WP_CACHE') )
mp-wp_genesis 205 @include WP_CONTENT_DIR . '/advanced-cache.php';
mp-wp_genesis 206
mp-wp_genesis 207 /**
mp-wp_genesis 208 * Stores the location of the WordPress directory of functions, classes, and core content.
mp-wp_genesis 209 *
mp-wp_genesis 210 * @since 1.0.0
mp-wp_genesis 211 */
mp-wp_genesis 212 define('WPINC', 'wp-includes');
mp-wp_genesis 213
mp-wp_genesis 214 if ( !defined('WP_LANG_DIR') ) {
mp-wp_genesis 215 /**
mp-wp_genesis 216 * Stores the location of the language directory. First looks for language folder in WP_CONTENT_DIR
mp-wp_genesis 217 * and uses that folder if it exists. Or it uses the "languages" folder in WPINC.
mp-wp_genesis 218 *
mp-wp_genesis 219 * @since 2.1.0
mp-wp_genesis 220 */
mp-wp_genesis 221 if ( file_exists(WP_CONTENT_DIR . '/languages') && @is_dir(WP_CONTENT_DIR . '/languages') ) {
mp-wp_genesis 222 define('WP_LANG_DIR', WP_CONTENT_DIR . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH
mp-wp_genesis 223 if (!defined('LANGDIR')) {
mp-wp_genesis 224 // Old static relative path maintained for limited backwards compatibility - won't work in some cases
mp-wp_genesis 225 define('LANGDIR', 'wp-content/languages');
mp-wp_genesis 226 }
mp-wp_genesis 227 } else {
mp-wp_genesis 228 define('WP_LANG_DIR', ABSPATH . WPINC . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH
mp-wp_genesis 229 if (!defined('LANGDIR')) {
mp-wp_genesis 230 // Old relative path maintained for backwards compatibility
mp-wp_genesis 231 define('LANGDIR', WPINC . '/languages');
mp-wp_genesis 232 }
mp-wp_genesis 233 }
mp-wp_genesis 234 }
mp-wp_genesis 235
mp-wp_genesis 236 require (ABSPATH . WPINC . '/compat.php');
mp-wp_genesis 237 require (ABSPATH . WPINC . '/functions.php');
mp-wp_genesis 238 require (ABSPATH . WPINC . '/classes.php');
mp-wp_genesis 239
mp-wp_genesis 240 require_wp_db();
mp-wp_genesis 241
mp-wp_genesis 242 if ( !empty($wpdb->error) )
mp-wp_genesis 243 dead_db();
mp-wp_genesis 244
mp-wp_genesis 245 $prefix = $wpdb->set_prefix($table_prefix);
mp-wp_genesis 246
mp-wp_genesis 247 if ( is_wp_error($prefix) )
mp-wp_genesis 248 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 249
mp-wp_genesis 250 if ( file_exists(WP_CONTENT_DIR . '/object-cache.php') )
mp-wp_genesis 251 require_once (WP_CONTENT_DIR . '/object-cache.php');
mp-wp_genesis 252 else
mp-wp_genesis 253 require_once (ABSPATH . WPINC . '/cache.php');
mp-wp_genesis 254
mp-wp_genesis 255 wp_cache_init();
mp-wp_genesis 256 if ( function_exists('wp_cache_add_global_groups') ) {
mp-wp_genesis 257 wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta'));
mp-wp_genesis 258 wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
mp-wp_genesis 259 }
mp-wp_genesis 260
mp-wp_genesis 261 require (ABSPATH . WPINC . '/plugin.php');
mp-wp_genesis 262 require (ABSPATH . WPINC . '/default-filters.php');
mp-wp_genesis 263 include_once(ABSPATH . WPINC . '/streams.php');
mp-wp_genesis 264 include_once(ABSPATH . WPINC . '/gettext.php');
mp-wp_genesis 265 require_once (ABSPATH . WPINC . '/l10n.php');
mp-wp_genesis 266
mp-wp_genesis 267 if ( !is_blog_installed() && (strpos($_SERVER['PHP_SELF'], 'install.php') === false && !defined('WP_INSTALLING')) ) {
mp-wp_genesis 268 if ( defined('WP_SITEURL') )
mp-wp_genesis 269 $link = WP_SITEURL . '/wp-admin/install.php';
mp-wp_genesis 270 elseif (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false)
mp-wp_genesis 271 $link = preg_replace('|/wp-admin/?.*?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php';
mp-wp_genesis 272 else
mp-wp_genesis 273 $link = preg_replace('|/[^/]+?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php';
mp-wp_genesis 274 require_once(ABSPATH . WPINC . '/kses.php');
mp-wp_genesis 275 require_once(ABSPATH . WPINC . '/pluggable.php');
mp-wp_genesis 276 wp_redirect($link);
mp-wp_genesis 277 die(); // have to die here ~ Mark
mp-wp_genesis 278 }
mp-wp_genesis 279
mp-wp_genesis 280 require (ABSPATH . WPINC . '/formatting.php');
mp-wp_genesis 281 require (ABSPATH . WPINC . '/capabilities.php');
mp-wp_genesis 282 require (ABSPATH . WPINC . '/query.php');
mp-wp_genesis 283 require (ABSPATH . WPINC . '/theme.php');
mp-wp_genesis 284 require (ABSPATH . WPINC . '/user.php');
mp-wp_genesis 285 require (ABSPATH . WPINC . '/general-template.php');
mp-wp_genesis 286 require (ABSPATH . WPINC . '/link-template.php');
mp-wp_genesis 287 require (ABSPATH . WPINC . '/author-template.php');
mp-wp_genesis 288 require (ABSPATH . WPINC . '/post.php');
mp-wp_genesis 289 require (ABSPATH . WPINC . '/post-template.php');
mp-wp_genesis 290 require (ABSPATH . WPINC . '/category.php');
mp-wp_genesis 291 require (ABSPATH . WPINC . '/category-template.php');
mp-wp_genesis 292 require (ABSPATH . WPINC . '/comment.php');
mp-wp_genesis 293 require (ABSPATH . WPINC . '/comment-template.php');
mp-wp_genesis 294 require (ABSPATH . WPINC . '/rewrite.php');
mp-wp_genesis 295 require (ABSPATH . WPINC . '/feed.php');
mp-wp_genesis 296 require (ABSPATH . WPINC . '/bookmark.php');
mp-wp_genesis 297 require (ABSPATH . WPINC . '/bookmark-template.php');
mp-wp_genesis 298 require (ABSPATH . WPINC . '/kses.php');
mp-wp_genesis 299 require (ABSPATH . WPINC . '/cron.php');
mp-wp_genesis 300 require (ABSPATH . WPINC . '/version.php');
mp-wp_genesis 301 require (ABSPATH . WPINC . '/deprecated.php');
mp-wp_genesis 302 require (ABSPATH . WPINC . '/script-loader.php');
mp-wp_genesis 303 require (ABSPATH . WPINC . '/taxonomy.php');
mp-wp_genesis 304 require (ABSPATH . WPINC . '/canonical.php');
mp-wp_genesis 305 require (ABSPATH . WPINC . '/shortcodes.php');
mp-wp_genesis 306 require (ABSPATH . WPINC . '/media.php');
mp-wp_genesis 307 require (ABSPATH . WPINC . '/http.php');
mp-wp_genesis 308
mp-wp_genesis 309 if ( !defined('WP_CONTENT_URL') )
mp-wp_genesis 310 define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up
mp-wp_genesis 311
mp-wp_genesis 312 /**
mp-wp_genesis 313 * Allows for the plugins directory to be moved from the default location.
mp-wp_genesis 314 *
mp-wp_genesis 315 * @since 2.6.0
mp-wp_genesis 316 */
mp-wp_genesis 317 if ( !defined('WP_PLUGIN_DIR') )
mp-wp_genesis 318 define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash
mp-wp_genesis 319
mp-wp_genesis 320 /**
mp-wp_genesis 321 * Allows for the plugins directory to be moved from the default location.
mp-wp_genesis 322 *
mp-wp_genesis 323 * @since 2.6.0
mp-wp_genesis 324 */
mp-wp_genesis 325 if ( !defined('WP_PLUGIN_URL') )
mp-wp_genesis 326 define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // full url, no trailing slash
mp-wp_genesis 327
mp-wp_genesis 328 /**
mp-wp_genesis 329 * Allows for the plugins directory to be moved from the default location.
mp-wp_genesis 330 *
mp-wp_genesis 331 * @since 2.1.0
mp-wp_genesis 332 */
mp-wp_genesis 333 if ( !defined('PLUGINDIR') )
mp-wp_genesis 334 define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat.
mp-wp_genesis 335
mp-wp_genesis 336 /**
mp-wp_genesis 337 * Used to guarantee unique hash cookies
mp-wp_genesis 338 * @since 1.5
mp-wp_genesis 339 */
mp-wp_genesis 340 define('COOKIEHASH', md5(get_option('siteurl')));
mp-wp_genesis 341
mp-wp_genesis 342 /**
mp-wp_genesis 343 * Should be exactly the same as the default value of SECRET_KEY in wp-config-sample.php
mp-wp_genesis 344 * @since 2.5.0
mp-wp_genesis 345 */
mp-wp_genesis 346 $wp_default_secret_key = 'put your unique phrase here';
mp-wp_genesis 347
mp-wp_genesis 348 /**
mp-wp_genesis 349 * It is possible to define this in wp-config.php
mp-wp_genesis 350 * @since 2.0.0
mp-wp_genesis 351 */
mp-wp_genesis 352 if ( !defined('USER_COOKIE') )
mp-wp_genesis 353 define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH);
mp-wp_genesis 354
mp-wp_genesis 355 /**
mp-wp_genesis 356 * It is possible to define this in wp-config.php
mp-wp_genesis 357 * @since 2.0.0
mp-wp_genesis 358 */
mp-wp_genesis 359 if ( !defined('PASS_COOKIE') )
mp-wp_genesis 360 define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH);
mp-wp_genesis 361
mp-wp_genesis 362 /**
mp-wp_genesis 363 * It is possible to define this in wp-config.php
mp-wp_genesis 364 * @since 2.5.0
mp-wp_genesis 365 */
mp-wp_genesis 366 if ( !defined('AUTH_COOKIE') )
mp-wp_genesis 367 define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH);
mp-wp_genesis 368
mp-wp_genesis 369 /**
mp-wp_genesis 370 * It is possible to define this in wp-config.php
mp-wp_genesis 371 * @since 2.6.0
mp-wp_genesis 372 */
mp-wp_genesis 373 if ( !defined('SECURE_AUTH_COOKIE') )
mp-wp_genesis 374 define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH);
mp-wp_genesis 375
mp-wp_genesis 376 /**
mp-wp_genesis 377 * It is possible to define this in wp-config.php
mp-wp_genesis 378 * @since 2.6.0
mp-wp_genesis 379 */
mp-wp_genesis 380 if ( !defined('LOGGED_IN_COOKIE') )
mp-wp_genesis 381 define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH);
mp-wp_genesis 382
mp-wp_genesis 383 /**
mp-wp_genesis 384 * It is possible to define this in wp-config.php
mp-wp_genesis 385 * @since 2.3.0
mp-wp_genesis 386 */
mp-wp_genesis 387 if ( !defined('TEST_COOKIE') )
mp-wp_genesis 388 define('TEST_COOKIE', 'wordpress_test_cookie');
mp-wp_genesis 389
mp-wp_genesis 390 /**
mp-wp_genesis 391 * It is possible to define this in wp-config.php
mp-wp_genesis 392 * @since 1.2.0
mp-wp_genesis 393 */
mp-wp_genesis 394 if ( !defined('COOKIEPATH') )
mp-wp_genesis 395 define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) );
mp-wp_genesis 396
mp-wp_genesis 397 /**
mp-wp_genesis 398 * It is possible to define this in wp-config.php
mp-wp_genesis 399 * @since 1.5.0
mp-wp_genesis 400 */
mp-wp_genesis 401 if ( !defined('SITECOOKIEPATH') )
mp-wp_genesis 402 define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) );
mp-wp_genesis 403
mp-wp_genesis 404 /**
mp-wp_genesis 405 * It is possible to define this in wp-config.php
mp-wp_genesis 406 * @since 2.6.0
mp-wp_genesis 407 */
mp-wp_genesis 408 if ( !defined('ADMIN_COOKIE_PATH') )
mp-wp_genesis 409 define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
mp-wp_genesis 410
mp-wp_genesis 411 /**
mp-wp_genesis 412 * It is possible to define this in wp-config.php
mp-wp_genesis 413 * @since 2.6.0
mp-wp_genesis 414 */
mp-wp_genesis 415 if ( !defined('PLUGINS_COOKIE_PATH') )
mp-wp_genesis 416 define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL) );
mp-wp_genesis 417
mp-wp_genesis 418 /**
mp-wp_genesis 419 * It is possible to define this in wp-config.php
mp-wp_genesis 420 * @since 2.0.0
mp-wp_genesis 421 */
mp-wp_genesis 422 if ( !defined('COOKIE_DOMAIN') )
mp-wp_genesis 423 define('COOKIE_DOMAIN', false);
mp-wp_genesis 424
mp-wp_genesis 425 /**
mp-wp_genesis 426 * It is possible to define this in wp-config.php
mp-wp_genesis 427 * @since 2.6.0
mp-wp_genesis 428 */
mp-wp_genesis 429 if ( !defined('FORCE_SSL_ADMIN') )
mp-wp_genesis 430 define('FORCE_SSL_ADMIN', false);
mp-wp_genesis 431 force_ssl_admin(FORCE_SSL_ADMIN);
mp-wp_genesis 432
mp-wp_genesis 433 /**
mp-wp_genesis 434 * It is possible to define this in wp-config.php
mp-wp_genesis 435 * @since 2.6.0
mp-wp_genesis 436 */
mp-wp_genesis 437 if ( !defined('FORCE_SSL_LOGIN') )
mp-wp_genesis 438 define('FORCE_SSL_LOGIN', false);
mp-wp_genesis 439 force_ssl_login(FORCE_SSL_LOGIN);
mp-wp_genesis 440
mp-wp_genesis 441 /**
mp-wp_genesis 442 * It is possible to define this in wp-config.php
mp-wp_genesis 443 * @since 2.5.0
mp-wp_genesis 444 */
mp-wp_genesis 445 if ( !defined( 'AUTOSAVE_INTERVAL' ) )
mp-wp_genesis 446 define( 'AUTOSAVE_INTERVAL', 60 );
mp-wp_genesis 447
mp-wp_genesis 448
mp-wp_genesis 449 require (ABSPATH . WPINC . '/vars.php');
mp-wp_genesis 450
mp-wp_genesis 451 // Check for hacks file if the option is enabled
mp-wp_genesis 452 if (get_option('hack_file')) {
mp-wp_genesis 453 if (file_exists(ABSPATH . 'my-hacks.php'))
mp-wp_genesis 454 require(ABSPATH . 'my-hacks.php');
mp-wp_genesis 455 }
mp-wp_genesis 456
mp-wp_genesis 457 if ( get_option('active_plugins') && !defined('WP_INSTALLING') ) {
mp-wp_genesis 458 $current_plugins = get_option('active_plugins');
mp-wp_genesis 459 if ( is_array($current_plugins) ) {
mp-wp_genesis 460 foreach ($current_plugins as $plugin) {
mp-wp_genesis 461 if ( '' != $plugin && 0 == validate_file($plugin) && file_exists(WP_PLUGIN_DIR . '/' . $plugin) )
mp-wp_genesis 462 include_once(WP_PLUGIN_DIR . '/' . $plugin);
mp-wp_genesis 463 }
mp-wp_genesis 464 }
mp-wp_genesis 465 }
mp-wp_genesis 466
mp-wp_genesis 467 require (ABSPATH . WPINC . '/pluggable.php');
mp-wp_genesis 468
mp-wp_genesis 469 /*
mp-wp_genesis 470 * In most cases the default internal encoding is latin1, which is of no use,
mp-wp_genesis 471 * since we want to use the mb_ functions for utf-8 strings
mp-wp_genesis 472 */
mp-wp_genesis 473 if (function_exists('mb_internal_encoding')) {
mp-wp_genesis 474 if (!@mb_internal_encoding(get_option('blog_charset')))
mp-wp_genesis 475 mb_internal_encoding('UTF-8');
mp-wp_genesis 476 }
mp-wp_genesis 477
mp-wp_genesis 478
mp-wp_genesis 479 if ( defined('WP_CACHE') && function_exists('wp_cache_postload') )
mp-wp_genesis 480 wp_cache_postload();
mp-wp_genesis 481
mp-wp_genesis 482 do_action('plugins_loaded');
mp-wp_genesis 483
mp-wp_genesis 484 $default_constants = array( 'WP_POST_REVISIONS' => true );
mp-wp_genesis 485 foreach ( $default_constants as $c => $v )
mp-wp_genesis 486 @define( $c, $v ); // will fail if the constant is already defined
mp-wp_genesis 487 unset($default_constants, $c, $v);
mp-wp_genesis 488
mp-wp_genesis 489 // If already slashed, strip.
mp-wp_genesis 490 if ( get_magic_quotes_gpc() ) {
mp-wp_genesis 491 $_GET = stripslashes_deep($_GET );
mp-wp_genesis 492 $_POST = stripslashes_deep($_POST );
mp-wp_genesis 493 $_COOKIE = stripslashes_deep($_COOKIE);
mp-wp_genesis 494 }
mp-wp_genesis 495
mp-wp_genesis 496 // Escape with wpdb.
mp-wp_genesis 497 $_GET = add_magic_quotes($_GET );
mp-wp_genesis 498 $_POST = add_magic_quotes($_POST );
mp-wp_genesis 499 $_COOKIE = add_magic_quotes($_COOKIE);
mp-wp_genesis 500 $_SERVER = add_magic_quotes($_SERVER);
mp-wp_genesis 501
mp-wp_genesis 502 do_action('sanitize_comment_cookies');
mp-wp_genesis 503
mp-wp_genesis 504 /**
mp-wp_genesis 505 * WordPress Query object
mp-wp_genesis 506 * @global object $wp_the_query
mp-wp_genesis 507 * @since 2.0.0
mp-wp_genesis 508 */
mp-wp_genesis 509 $wp_the_query = new WP_Query();
mp-wp_genesis 510
mp-wp_genesis 511 /**
mp-wp_genesis 512 * Holds the reference to @see $wp_the_query
mp-wp_genesis 513 * Use this global for WordPress queries
mp-wp_genesis 514 * @global object $wp_query
mp-wp_genesis 515 * @since 1.5.0
mp-wp_genesis 516 */
mp-wp_genesis 517 $wp_query =& $wp_the_query;
mp-wp_genesis 518
mp-wp_genesis 519 /**
mp-wp_genesis 520 * Holds the WordPress Rewrite object for creating pretty URLs
mp-wp_genesis 521 * @global object $wp_rewrite
mp-wp_genesis 522 * @since 1.5.0
mp-wp_genesis 523 */
mp-wp_genesis 524 $wp_rewrite = new WP_Rewrite();
mp-wp_genesis 525
mp-wp_genesis 526 /**
mp-wp_genesis 527 * WordPress Object
mp-wp_genesis 528 * @global object $wp
mp-wp_genesis 529 * @since 2.0.0
mp-wp_genesis 530 */
mp-wp_genesis 531 $wp = new WP();
mp-wp_genesis 532
mp-wp_genesis 533 do_action('setup_theme');
mp-wp_genesis 534
mp-wp_genesis 535 /**
mp-wp_genesis 536 * Web Path to the current active template directory
mp-wp_genesis 537 * @since 1.5.0
mp-wp_genesis 538 */
mp-wp_genesis 539 define('TEMPLATEPATH', get_template_directory());
mp-wp_genesis 540
mp-wp_genesis 541 /**
mp-wp_genesis 542 * Web Path to the current active template stylesheet directory
mp-wp_genesis 543 * @since 2.1.0
mp-wp_genesis 544 */
mp-wp_genesis 545 define('STYLESHEETPATH', get_stylesheet_directory());
mp-wp_genesis 546
mp-wp_genesis 547 // Load the default text localization domain.
mp-wp_genesis 548 load_default_textdomain();
mp-wp_genesis 549
mp-wp_genesis 550 /**
mp-wp_genesis 551 * The locale of the blog
mp-wp_genesis 552 * @since 1.5.0
mp-wp_genesis 553 */
mp-wp_genesis 554 $locale = get_locale();
mp-wp_genesis 555 $locale_file = WP_LANG_DIR . "/$locale.php";
mp-wp_genesis 556 if ( is_readable($locale_file) )
mp-wp_genesis 557 require_once($locale_file);
mp-wp_genesis 558
mp-wp_genesis 559 // Pull in locale data after loading text domain.
mp-wp_genesis 560 require_once(ABSPATH . WPINC . '/locale.php');
mp-wp_genesis 561
mp-wp_genesis 562 /**
mp-wp_genesis 563 * WordPress Locale object for loading locale domain date and various strings.
mp-wp_genesis 564 * @global object $wp_locale
mp-wp_genesis 565 * @since 2.1.0
mp-wp_genesis 566 */
mp-wp_genesis 567 $wp_locale = new WP_Locale();
mp-wp_genesis 568
mp-wp_genesis 569 // Load functions for active theme.
mp-wp_genesis 570 if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists(STYLESHEETPATH . '/functions.php') )
mp-wp_genesis 571 include(STYLESHEETPATH . '/functions.php');
mp-wp_genesis 572 if ( file_exists(TEMPLATEPATH . '/functions.php') )
mp-wp_genesis 573 include(TEMPLATEPATH . '/functions.php');
mp-wp_genesis 574
mp-wp_genesis 575 /**
mp-wp_genesis 576 * Runs just before PHP shuts down execution.
mp-wp_genesis 577 *
mp-wp_genesis 578 * @access private
mp-wp_genesis 579 * @since 1.2.0
mp-wp_genesis 580 */
mp-wp_genesis 581 function shutdown_action_hook() {
mp-wp_genesis 582 do_action('shutdown');
mp-wp_genesis 583 wp_cache_close();
mp-wp_genesis 584 }
mp-wp_genesis 585 register_shutdown_function('shutdown_action_hook');
mp-wp_genesis 586
mp-wp_genesis 587 $wp->init(); // Sets up current user.
mp-wp_genesis 588
mp-wp_genesis 589 // Everything is loaded and initialized.
mp-wp_genesis 590 do_action('init');
mp-wp_genesis 591
mp-wp_genesis 592 ?>