wp/wp-load.php
author ymh <ymh.work@gmail.com>
Wed, 06 Nov 2013 03:21:17 +0000
changeset 0 d970ebf37754
child 5 5e2f62d02dcd
permissions -rw-r--r--
first import
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 * Bootstrap file for setting the ABSPATH constant
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 * and loading the wp-config.php file. The wp-config.php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * file will then load the wp-settings.php file, which
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 * will then set up the WordPress environment.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
 * If the wp-config.php file is not found then an error
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
 * will be displayed asking the visitor to set up the
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
 * wp-config.php file.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
 * Will also search for wp-config.php in WordPress' parent
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
 * directory to allow the WordPress directory to remain
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
 * untouched.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
 * @internal This file must be parsable by PHP4.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
 * @package WordPress
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
/** Define ABSPATH as this file's directory */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
define( 'ABSPATH', dirname(__FILE__) . '/' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
if ( file_exists( ABSPATH . 'wp-config.php') ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
	/** The config file resides in ABSPATH */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
	require_once( ABSPATH . 'wp-config.php' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
} elseif ( file_exists( dirname(ABSPATH) . '/wp-config.php' ) && ! file_exists( dirname(ABSPATH) . '/wp-settings.php' ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
	/** The config file resides one level above ABSPATH but is not part of another install */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
	require_once( dirname(ABSPATH) . '/wp-config.php' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
} else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
	// A config file doesn't exist
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
	define( 'WPINC', 'wp-includes' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
	define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
	require_once( ABSPATH . WPINC . '/load.php' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
	require_once( ABSPATH . WPINC . '/version.php' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
	wp_check_php_mysql_versions();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
	wp_load_translations_early();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
	// Standardize $_SERVER variables across setups.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
	wp_fix_server_vars();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
	require_once( ABSPATH . WPINC . '/functions.php' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
	$path = wp_guess_url() . '/wp-admin/setup-config.php';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
	// Die with an error message
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
	$die  = __( "There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started." ) . '</p>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
	$die .= '<p>' . __( "Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>." ) . '</p>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
	$die .= '<p>' . __( "You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file." ) . '</p>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
	$die .= '<p><a href="' . $path . '" class="button button-large">' . __( "Create a Configuration File" ) . '</a>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
	wp_die( $die, __( 'WordPress &rsaquo; Error' ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
}