Tweak load_plugin_textdomain to be relative - this falls back to WP_LANG_DIR automatically. Can prevent "open_basedir restriction in effect".

@claudiosmweb agree? Load_plugin_textdomain needs a relative path. If
the locale isn’t found, it reverts to WP_LANG_DIR/plugins/ as you coded
it.
This commit is contained in:
Mike Jolley 2014-09-19 10:29:19 +01:00
parent 2e6ca2a710
commit 40d73e48d2
2 changed files with 16 additions and 3 deletions

View File

@ -130,6 +130,8 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
== Changelog ==
* Tweak load_plugin_textdomain to be relative - this falls back to WP_LANG_DIR automatically. Can prevent "open_basedir restriction in effect".
= 2.2.4 - 18/09/2014 =
* Fix - Prevent errors when adding 'zero-rated' tax on checkout.
* Fix - Fixed a varation product width inheritance bug.

View File

@ -408,15 +408,26 @@ final class WooCommerce {
$locale = apply_filters( 'plugin_locale', get_locale(), 'woocommerce' );
$dir = trailingslashit( WP_LANG_DIR );
// Admin Locale
/**
* Admin Locale. Looks in:
*
* - WP_LANG_DIR/woocommerce/woocommerce-admin-LOCALE.mo
* - WP_LANG_DIR/plugins/woocommerce-admin-LOCALE.mo
*/
if ( is_admin() ) {
load_textdomain( 'woocommerce', $dir . 'woocommerce/woocommerce-admin-' . $locale . '.mo' );
load_textdomain( 'woocommerce', $dir . 'plugins/woocommerce-admin-' . $locale . '.mo' );
}
// Global + Frontend Locale
/**
* Frontend/global Locale. Looks in:
*
* - WP_LANG_DIR/woocommerce/woocommerce-LOCALE.mo
* - woocommerce/i18n/languages/woocommerce-LOCALE.mo (which if not found falls back to:)
* - WP_LANG_DIR/plugins/woocommerce-LOCALE.mo
*/
load_textdomain( 'woocommerce', $dir . 'woocommerce/woocommerce-' . $locale . '.mo' );
load_plugin_textdomain( 'woocommerce', false, $dir . 'plugins' );
load_plugin_textdomain( 'woocommerce', false, plugin_basename( dirname( __FILE__ ) ) . "/i18n/languages" );
}
/**