Turn hard-coded paths to defines. Pull gettext includes int wp-settings. Props mdawaffe. fixes #3157

git-svn-id: http://svn.automattic.com/wordpress/trunk@4202 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-09-21 20:46:39 +00:00
parent 8ca163a2d2
commit 7a032342b3
7 changed files with 25 additions and 22 deletions

View File

@ -1721,8 +1721,7 @@ function get_plugins() {
}
$wp_plugins = array ();
$plugin_loc = 'wp-content/plugins';
$plugin_root = ABSPATH.$plugin_loc;
$plugin_root = ABSPATH . PLUGINDIR;
// Files in wp-content/plugins directory
$plugins_dir = @ dir($plugin_root);

View File

@ -52,7 +52,7 @@ if (isset($plugin_page)) {
wp_die(__('Invalid plugin page'));
}
if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page"))
if (! file_exists(ABSPATH . PLUGINDIR . "/$plugin_page"))
wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
do_action('load-' . $plugin_page);
@ -60,7 +60,7 @@ if (isset($plugin_page)) {
if (! isset($_GET['noheader']))
require_once(ABSPATH . '/wp-admin/admin-header.php');
include(ABSPATH . "wp-content/plugins/$plugin_page");
include(ABSPATH . PLUGINDIR . "/$plugin_page");
}
include(ABSPATH . 'wp-admin/admin-footer.php');

View File

@ -12,7 +12,7 @@ foreach ($menu as $item) {
if (( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
if ( !empty($submenu[$item[2]]) || current_user_can($item[1]) ) {
if ( file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") )
if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") )
echo "\n\t<li><a href='" . get_option('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
else
echo "\n\t<li><a href='" . get_option('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
@ -40,7 +40,7 @@ else $class = '';
$menu_hook = get_plugin_page_hook($item[2], $parent_file);
if (file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") || ! empty($menu_hook)) {
if (file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || ! empty($menu_hook)) {
if ( 'admin.php' == $pagenow )
echo "\n\t<li><a href='" . get_option('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
else

View File

@ -14,7 +14,7 @@ if (empty($file)) {
}
$file = validate_file_to_edit($file, $plugin_files);
$real_file = get_real_file_to_edit("wp-content/plugins/$file");
$real_file = get_real_file_to_edit( PLUGINDIR . "/$file");
switch($action) {
@ -46,7 +46,7 @@ default:
require_once('admin-header.php');
update_recently_edited("wp-content/plugins/$file");
update_recently_edited(PLUGINDIR . "/$file");
if (!is_file($real_file))
$error = 1;

View File

@ -9,7 +9,7 @@ if ( isset($_GET['action']) ) {
$current[] = trim( $_GET['plugin'] );
sort($current);
update_option('active_plugins', $current);
include(ABSPATH . 'wp-content/plugins/' . trim( $_GET['plugin'] ));
include(ABSPATH . PLUGINDIR . '/' . trim( $_GET['plugin'] ));
do_action('activate_' . trim( $_GET['plugin'] ));
}
wp_redirect('plugins.php?activate=true');
@ -42,7 +42,7 @@ if ( !is_array($check_plugins) ) {
// If a plugin file does not exist, remove it from the list of active
// plugins.
foreach ($check_plugins as $check_plugin) {
if (!file_exists(ABSPATH . 'wp-content/plugins/' . $check_plugin)) {
if (!file_exists(ABSPATH . PLUGINDIR . '/' . $check_plugin)) {
$current = get_option('active_plugins');
$key = array_search($check_plugin, $current);
if ( false !== $key && NULL !== $key ) {
@ -123,10 +123,10 @@ if (empty($plugins)) {
}
?>
<p><?php _e('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>wp-content/plugins</code> directory and it will be automatically deactivated.'); ?></p>
<p><?php _e(sprintf('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.', PLUGINDIR)); ?></p>
<h2><?php _e('Get More Plugins'); ?></h2>
<p><?php _e('You can find additional plugins for your site in the <a href="http://wordpress.org/extend/plugins/">WordPress plugin directory</a>. To install a plugin you generally just need to upload the plugin file into your <code>wp-content/plugins</code> directory. Once a plugin is uploaded, you may activate it here.'); ?></p>
<p><?php _e(sprintf('You can find additional plugins for your site in the <a href="http://wordpress.org/extend/plugins/">WordPress plugin directory</a>. To install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory. Once a plugin is uploaded, you may activate it here.', PLUGINDIR)); ?></p>
</div>

View File

@ -1,10 +1,4 @@
<?php
if ( defined('WPLANG') && '' != constant('WPLANG') ) {
include_once(ABSPATH . 'wp-includes/streams.php');
include_once(ABSPATH . 'wp-includes/gettext.php');
}
function get_locale() {
global $locale;
@ -75,13 +69,15 @@ function load_default_textdomain() {
global $l10n;
$locale = get_locale();
$mofile = ABSPATH . "wp-includes/languages/$locale.mo";
$mofile = ABSPATH . LANGDIR . "/$locale.mo";
load_textdomain('default', $mofile);
}
function load_plugin_textdomain($domain, $path = 'wp-content/plugins') {
function load_plugin_textdomain($domain, $path = false) {
$locale = get_locale();
if ( false === $path )
$path = PLUGINDIR;
$mofile = ABSPATH . "$path/$domain-$locale.mo";
load_textdomain($domain, $mofile);

View File

@ -81,6 +81,10 @@ if ( defined('WP_CACHE') )
require (ABSPATH . 'wp-content/advanced-cache.php');
define('WPINC', 'wp-includes');
if ( !defined('LANGDIR') )
define('LANGDIR', WPINC . '/languages'); // no leading slash, no trailing slash
if ( !defined('PLUGINDIR') )
define('PLUGINDIR', 'wp-content/plugins'); // no leading slash, no trailing slash
if ( file_exists(ABSPATH . 'wp-content/db.php') )
require (ABSPATH . 'wp-content/db.php');
else
@ -119,6 +123,10 @@ wp_cache_init();
require (ABSPATH . WPINC . '/functions.php');
require (ABSPATH . WPINC . '/plugin.php');
require (ABSPATH . WPINC . '/default-filters.php');
if ( defined('WPLANG') && '' != constant('WPLANG') ) {
include_once(ABSPATH . WPINC . '/streams.php');
include_once(ABSPATH . WPINC . '/gettext.php');
}
require_once (ABSPATH . WPINC . '/l10n.php');
if ( !is_blog_installed() && (!strstr($_SERVER['PHP_SELF'], 'install.php') && !defined('WP_INSTALLING')) ) {