From 7a032342b389ce832ebe21e34764238c97f0f616 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 21 Sep 2006 20:46:39 +0000 Subject: [PATCH] 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 --- wp-admin/admin-functions.php | 3 +-- wp-admin/admin.php | 4 ++-- wp-admin/menu-header.php | 6 +++--- wp-admin/plugin-editor.php | 4 ++-- wp-admin/plugins.php | 8 ++++---- wp-includes/l10n.php | 14 +++++--------- wp-settings.php | 8 ++++++++ 7 files changed, 25 insertions(+), 22 deletions(-) diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 2b5e6a609..9c065765e 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -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); diff --git a/wp-admin/admin.php b/wp-admin/admin.php index 8e3a45fea..3c2afcff6 100644 --- a/wp-admin/admin.php +++ b/wp-admin/admin.php @@ -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'); diff --git a/wp-admin/menu-header.php b/wp-admin/menu-header.php index 417a84fbd..99c02a596 100644 --- a/wp-admin/menu-header.php +++ b/wp-admin/menu-header.php @@ -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
  • {$item[0]}
  • "; else echo "\n\t
  • {$item[0]}
  • "; @@ -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
  • {$item[0]}
  • "; else @@ -58,4 +58,4 @@ endif; do_action('admin_notices'); -?> \ No newline at end of file +?> diff --git a/wp-admin/plugin-editor.php b/wp-admin/plugin-editor.php index f27e31218..9d311d924 100644 --- a/wp-admin/plugin-editor.php +++ b/wp-admin/plugin-editor.php @@ -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; diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index 6fbc81495..3fa7c02c7 100644 --- a/wp-admin/plugins.php +++ b/wp-admin/plugins.php @@ -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)) { } ?> -

    wp-content/plugins directory and it will be automatically deactivated.'); ?>

    +

    %s directory and it will be automatically deactivated.', PLUGINDIR)); ?>

    -

    WordPress plugin directory. To install a plugin you generally just need to upload the plugin file into your wp-content/plugins directory. Once a plugin is uploaded, you may activate it here.'); ?>

    +

    WordPress plugin directory. To install a plugin you generally just need to upload the plugin file into your %s directory. Once a plugin is uploaded, you may activate it here.', PLUGINDIR)); ?>

    diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php index ba77c2359..b2b099c42 100644 --- a/wp-includes/l10n.php +++ b/wp-includes/l10n.php @@ -1,10 +1,4 @@ \ No newline at end of file +?> diff --git a/wp-settings.php b/wp-settings.php index 4bbccf6cf..f92439206 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -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')) ) {