web/wp-load.php
author ymh
Fri, 12 Mar 2010 13:29:04 +0000
changeset 1 0d28b7c10758
permissions -rw-r--r--
First commit
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
0d28b7c10758 First commit
ymh
parents:
diff changeset
     1
<?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
     2
/**
0d28b7c10758 First commit
ymh
parents:
diff changeset
     3
 * Bootstrap file for setting the ABSPATH constant
0d28b7c10758 First commit
ymh
parents:
diff changeset
     4
 * and loading the wp-config.php file. The wp-config.php
0d28b7c10758 First commit
ymh
parents:
diff changeset
     5
 * file will then load the wp-settings.php file, which
0d28b7c10758 First commit
ymh
parents:
diff changeset
     6
 * will then set up the WordPress environment.
0d28b7c10758 First commit
ymh
parents:
diff changeset
     7
 *
0d28b7c10758 First commit
ymh
parents:
diff changeset
     8
 * If the wp-config.php file is not found then an error
0d28b7c10758 First commit
ymh
parents:
diff changeset
     9
 * will be displayed asking the visitor to set up the
0d28b7c10758 First commit
ymh
parents:
diff changeset
    10
 * wp-config.php file.
0d28b7c10758 First commit
ymh
parents:
diff changeset
    11
 *
0d28b7c10758 First commit
ymh
parents:
diff changeset
    12
 * Will also search for wp-config.php in WordPress' parent
0d28b7c10758 First commit
ymh
parents:
diff changeset
    13
 * directory to allow the WordPress directory to remain
0d28b7c10758 First commit
ymh
parents:
diff changeset
    14
 * untouched.
0d28b7c10758 First commit
ymh
parents:
diff changeset
    15
 *
0d28b7c10758 First commit
ymh
parents:
diff changeset
    16
 * @package WordPress
0d28b7c10758 First commit
ymh
parents:
diff changeset
    17
 */
0d28b7c10758 First commit
ymh
parents:
diff changeset
    18
0d28b7c10758 First commit
ymh
parents:
diff changeset
    19
/** Define ABSPATH as this files directory */
0d28b7c10758 First commit
ymh
parents:
diff changeset
    20
define( 'ABSPATH', dirname(__FILE__) . '/' );
0d28b7c10758 First commit
ymh
parents:
diff changeset
    21
0d28b7c10758 First commit
ymh
parents:
diff changeset
    22
if ( defined('E_RECOVERABLE_ERROR') )
0d28b7c10758 First commit
ymh
parents:
diff changeset
    23
	error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
0d28b7c10758 First commit
ymh
parents:
diff changeset
    24
else
0d28b7c10758 First commit
ymh
parents:
diff changeset
    25
	error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING);
0d28b7c10758 First commit
ymh
parents:
diff changeset
    26
0d28b7c10758 First commit
ymh
parents:
diff changeset
    27
if ( file_exists( ABSPATH . 'wp-config.php') ) {
0d28b7c10758 First commit
ymh
parents:
diff changeset
    28
0d28b7c10758 First commit
ymh
parents:
diff changeset
    29
	/** The config file resides in ABSPATH */
0d28b7c10758 First commit
ymh
parents:
diff changeset
    30
	require_once( ABSPATH . 'wp-config.php' );
0d28b7c10758 First commit
ymh
parents:
diff changeset
    31
0d28b7c10758 First commit
ymh
parents:
diff changeset
    32
} elseif ( file_exists( dirname(ABSPATH) . '/wp-config.php' ) && ! file_exists( dirname(ABSPATH) . '/wp-settings.php' ) ) {
0d28b7c10758 First commit
ymh
parents:
diff changeset
    33
0d28b7c10758 First commit
ymh
parents:
diff changeset
    34
	/** The config file resides one level above ABSPATH but is not part of another install*/
0d28b7c10758 First commit
ymh
parents:
diff changeset
    35
	require_once( dirname(ABSPATH) . '/wp-config.php' );
0d28b7c10758 First commit
ymh
parents:
diff changeset
    36
0d28b7c10758 First commit
ymh
parents:
diff changeset
    37
} else {
0d28b7c10758 First commit
ymh
parents:
diff changeset
    38
0d28b7c10758 First commit
ymh
parents:
diff changeset
    39
	// A config file doesn't exist
0d28b7c10758 First commit
ymh
parents:
diff changeset
    40
0d28b7c10758 First commit
ymh
parents:
diff changeset
    41
	// Set a path for the link to the installer
0d28b7c10758 First commit
ymh
parents:
diff changeset
    42
	if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = '';
0d28b7c10758 First commit
ymh
parents:
diff changeset
    43
	else $path = 'wp-admin/';
0d28b7c10758 First commit
ymh
parents:
diff changeset
    44
0d28b7c10758 First commit
ymh
parents:
diff changeset
    45
	// Die with an error message
0d28b7c10758 First commit
ymh
parents:
diff changeset
    46
	require_once( ABSPATH . '/wp-includes/classes.php' );
0d28b7c10758 First commit
ymh
parents:
diff changeset
    47
	require_once( ABSPATH . '/wp-includes/functions.php' );
0d28b7c10758 First commit
ymh
parents:
diff changeset
    48
	require_once( ABSPATH . '/wp-includes/plugin.php' );
0d28b7c10758 First commit
ymh
parents:
diff changeset
    49
	$text_direction = /*WP_I18N_TEXT_DIRECTION*/"ltr"/*/WP_I18N_TEXT_DIRECTION*/;
0d28b7c10758 First commit
ymh
parents:
diff changeset
    50
	wp_die(sprintf(/*WP_I18N_NO_CONFIG*/"There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. 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><p><a href='%ssetup-config.php' class='button'>Create a Configuration File</a>"/*/WP_I18N_NO_CONFIG*/, $path), /*WP_I18N_ERROR_TITLE*/"WordPress &rsaquo; Error"/*/WP_I18N_ERROR_TITLE*/, array('text_direction' => $text_direction));
0d28b7c10758 First commit
ymh
parents:
diff changeset
    51
0d28b7c10758 First commit
ymh
parents:
diff changeset
    52
}
0d28b7c10758 First commit
ymh
parents:
diff changeset
    53
0d28b7c10758 First commit
ymh
parents:
diff changeset
    54
?>