@@ -11,77 +11,77 @@ |
||
| 11 | 11 | class EE_Load_Textdomain extends EE_Base |
| 12 | 12 | { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * holds the current lang in WP |
|
| 16 | - * |
|
| 17 | - * @var string |
|
| 18 | - */ |
|
| 19 | - private static $_lang; |
|
| 14 | + /** |
|
| 15 | + * holds the current lang in WP |
|
| 16 | + * |
|
| 17 | + * @var string |
|
| 18 | + */ |
|
| 19 | + private static $_lang; |
|
| 20 | 20 | |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * this takes care of retrieving a matching textdomain for event espresso for the current WPLANG from EE GitHub |
|
| 24 | - * repo (if necessary) and then loading it for translations. should only be called in wp plugins_loaded callback |
|
| 25 | - * |
|
| 26 | - * @return void |
|
| 27 | - */ |
|
| 28 | - public static function load_textdomain() |
|
| 29 | - { |
|
| 30 | - self::_maybe_get_langfiles(); |
|
| 31 | - // now load the textdomain |
|
| 32 | - if (! empty(self::$_lang) && is_readable(EE_LANGUAGES_SAFE_DIR . 'event_espresso-' . self::$_lang . '.mo')) { |
|
| 33 | - load_plugin_textdomain('event_espresso', false, EE_LANGUAGES_SAFE_LOC); |
|
| 34 | - } elseif (! empty(self::$_lang) |
|
| 35 | - && is_readable(EE_LANGUAGES_SAFE_DIR . 'event-espresso-4-' . self::$_lang . '.mo') |
|
| 36 | - ) { |
|
| 37 | - load_textdomain('event_espresso', EE_LANGUAGES_SAFE_DIR . 'event-espresso-4-' . self::$_lang . '.mo'); |
|
| 38 | - } else { |
|
| 39 | - load_plugin_textdomain('event_espresso', false, dirname(EE_PLUGIN_BASENAME) . '/languages/'); |
|
| 40 | - } |
|
| 41 | - } |
|
| 22 | + /** |
|
| 23 | + * this takes care of retrieving a matching textdomain for event espresso for the current WPLANG from EE GitHub |
|
| 24 | + * repo (if necessary) and then loading it for translations. should only be called in wp plugins_loaded callback |
|
| 25 | + * |
|
| 26 | + * @return void |
|
| 27 | + */ |
|
| 28 | + public static function load_textdomain() |
|
| 29 | + { |
|
| 30 | + self::_maybe_get_langfiles(); |
|
| 31 | + // now load the textdomain |
|
| 32 | + if (! empty(self::$_lang) && is_readable(EE_LANGUAGES_SAFE_DIR . 'event_espresso-' . self::$_lang . '.mo')) { |
|
| 33 | + load_plugin_textdomain('event_espresso', false, EE_LANGUAGES_SAFE_LOC); |
|
| 34 | + } elseif (! empty(self::$_lang) |
|
| 35 | + && is_readable(EE_LANGUAGES_SAFE_DIR . 'event-espresso-4-' . self::$_lang . '.mo') |
|
| 36 | + ) { |
|
| 37 | + load_textdomain('event_espresso', EE_LANGUAGES_SAFE_DIR . 'event-espresso-4-' . self::$_lang . '.mo'); |
|
| 38 | + } else { |
|
| 39 | + load_plugin_textdomain('event_espresso', false, dirname(EE_PLUGIN_BASENAME) . '/languages/'); |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * The purpose of this method is to sideload all of the lang files for EE, this includes the POT file and also the PO/MO files for the given WPLANG locale (if necessary). |
|
| 46 | - * |
|
| 47 | - * @access private |
|
| 48 | - * @static |
|
| 49 | - * @return void |
|
| 50 | - */ |
|
| 51 | - private static function _maybe_get_langfiles() |
|
| 52 | - { |
|
| 53 | - self::$_lang = get_locale(); |
|
| 54 | - if ($has_check = get_option('ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION) |
|
| 55 | - || empty(self::$_lang) |
|
| 56 | - ) { |
|
| 57 | - return; |
|
| 58 | - } |
|
| 44 | + /** |
|
| 45 | + * The purpose of this method is to sideload all of the lang files for EE, this includes the POT file and also the PO/MO files for the given WPLANG locale (if necessary). |
|
| 46 | + * |
|
| 47 | + * @access private |
|
| 48 | + * @static |
|
| 49 | + * @return void |
|
| 50 | + */ |
|
| 51 | + private static function _maybe_get_langfiles() |
|
| 52 | + { |
|
| 53 | + self::$_lang = get_locale(); |
|
| 54 | + if ($has_check = get_option('ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION) |
|
| 55 | + || empty(self::$_lang) |
|
| 56 | + ) { |
|
| 57 | + return; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - // load sideloader and sideload the .POT file as this is should always be included. |
|
| 61 | - $sideloader_args = array( |
|
| 62 | - '_upload_to' => EE_PLUGIN_DIR_PATH . 'languages/', |
|
| 63 | - '_upload_from' => 'https://github.com/eventespresso/languages-ee4/blob/master/event_espresso.pot?raw=true', |
|
| 64 | - '_new_file_name' => 'event_espresso.pot', |
|
| 65 | - ); |
|
| 66 | - $sideloader = EE_Registry::instance()->load_helper('Sideloader', $sideloader_args, false); |
|
| 67 | - $sideloader->sideload(); |
|
| 60 | + // load sideloader and sideload the .POT file as this is should always be included. |
|
| 61 | + $sideloader_args = array( |
|
| 62 | + '_upload_to' => EE_PLUGIN_DIR_PATH . 'languages/', |
|
| 63 | + '_upload_from' => 'https://github.com/eventespresso/languages-ee4/blob/master/event_espresso.pot?raw=true', |
|
| 64 | + '_new_file_name' => 'event_espresso.pot', |
|
| 65 | + ); |
|
| 66 | + $sideloader = EE_Registry::instance()->load_helper('Sideloader', $sideloader_args, false); |
|
| 67 | + $sideloader->sideload(); |
|
| 68 | 68 | |
| 69 | - // if lang is en_US or empty then lets just get out. (Event Espresso core is en_US) |
|
| 70 | - if (empty(self::$_lang) || self::$_lang == 'en_US') { |
|
| 71 | - return; |
|
| 72 | - } |
|
| 69 | + // if lang is en_US or empty then lets just get out. (Event Espresso core is en_US) |
|
| 70 | + if (empty(self::$_lang) || self::$_lang == 'en_US') { |
|
| 71 | + return; |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - // made it here so let's get the language files from the github repo, first the .mo file |
|
| 75 | - $sideloader->set_upload_from('https://github.com/eventespresso/languages-ee4/blob/master/event_espresso-' . self::$_lang . '.mo?raw=true'); |
|
| 76 | - $sideloader->set_new_file_name('event_espresso-' . self::$_lang . '.mo'); |
|
| 77 | - $sideloader->sideload(); |
|
| 74 | + // made it here so let's get the language files from the github repo, first the .mo file |
|
| 75 | + $sideloader->set_upload_from('https://github.com/eventespresso/languages-ee4/blob/master/event_espresso-' . self::$_lang . '.mo?raw=true'); |
|
| 76 | + $sideloader->set_new_file_name('event_espresso-' . self::$_lang . '.mo'); |
|
| 77 | + $sideloader->sideload(); |
|
| 78 | 78 | |
| 79 | - // now the .po file: |
|
| 80 | - $sideloader->set_upload_from('https://github.com/eventespresso/languages-ee4/blob/master/event_espresso-' . self::$_lang . '.po?raw=true'); |
|
| 81 | - $sideloader->set_new_file_name('event_espresso-' . self::$_lang . '.po'); |
|
| 82 | - $sideloader->sideload(); |
|
| 79 | + // now the .po file: |
|
| 80 | + $sideloader->set_upload_from('https://github.com/eventespresso/languages-ee4/blob/master/event_espresso-' . self::$_lang . '.po?raw=true'); |
|
| 81 | + $sideloader->set_new_file_name('event_espresso-' . self::$_lang . '.po'); |
|
| 82 | + $sideloader->sideload(); |
|
| 83 | 83 | |
| 84 | - // set option so the above only runs when EE updates. |
|
| 85 | - update_option('ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION, 1); |
|
| 86 | - } |
|
| 84 | + // set option so the above only runs when EE updates. |
|
| 85 | + update_option('ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION, 1); |
|
| 86 | + } |
|
| 87 | 87 | } |
@@ -29,14 +29,14 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | self::_maybe_get_langfiles(); |
| 31 | 31 | // now load the textdomain |
| 32 | - if (! empty(self::$_lang) && is_readable(EE_LANGUAGES_SAFE_DIR . 'event_espresso-' . self::$_lang . '.mo')) { |
|
| 32 | + if ( ! empty(self::$_lang) && is_readable(EE_LANGUAGES_SAFE_DIR.'event_espresso-'.self::$_lang.'.mo')) { |
|
| 33 | 33 | load_plugin_textdomain('event_espresso', false, EE_LANGUAGES_SAFE_LOC); |
| 34 | - } elseif (! empty(self::$_lang) |
|
| 35 | - && is_readable(EE_LANGUAGES_SAFE_DIR . 'event-espresso-4-' . self::$_lang . '.mo') |
|
| 34 | + } elseif ( ! empty(self::$_lang) |
|
| 35 | + && is_readable(EE_LANGUAGES_SAFE_DIR.'event-espresso-4-'.self::$_lang.'.mo') |
|
| 36 | 36 | ) { |
| 37 | - load_textdomain('event_espresso', EE_LANGUAGES_SAFE_DIR . 'event-espresso-4-' . self::$_lang . '.mo'); |
|
| 37 | + load_textdomain('event_espresso', EE_LANGUAGES_SAFE_DIR.'event-espresso-4-'.self::$_lang.'.mo'); |
|
| 38 | 38 | } else { |
| 39 | - load_plugin_textdomain('event_espresso', false, dirname(EE_PLUGIN_BASENAME) . '/languages/'); |
|
| 39 | + load_plugin_textdomain('event_espresso', false, dirname(EE_PLUGIN_BASENAME).'/languages/'); |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | private static function _maybe_get_langfiles() |
| 52 | 52 | { |
| 53 | 53 | self::$_lang = get_locale(); |
| 54 | - if ($has_check = get_option('ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION) |
|
| 54 | + if ($has_check = get_option('ee_lang_check_'.self::$_lang.'_'.EVENT_ESPRESSO_VERSION) |
|
| 55 | 55 | || empty(self::$_lang) |
| 56 | 56 | ) { |
| 57 | 57 | return; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | // load sideloader and sideload the .POT file as this is should always be included. |
| 61 | 61 | $sideloader_args = array( |
| 62 | - '_upload_to' => EE_PLUGIN_DIR_PATH . 'languages/', |
|
| 62 | + '_upload_to' => EE_PLUGIN_DIR_PATH.'languages/', |
|
| 63 | 63 | '_upload_from' => 'https://github.com/eventespresso/languages-ee4/blob/master/event_espresso.pot?raw=true', |
| 64 | 64 | '_new_file_name' => 'event_espresso.pot', |
| 65 | 65 | ); |
@@ -72,16 +72,16 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // made it here so let's get the language files from the github repo, first the .mo file |
| 75 | - $sideloader->set_upload_from('https://github.com/eventespresso/languages-ee4/blob/master/event_espresso-' . self::$_lang . '.mo?raw=true'); |
|
| 76 | - $sideloader->set_new_file_name('event_espresso-' . self::$_lang . '.mo'); |
|
| 75 | + $sideloader->set_upload_from('https://github.com/eventespresso/languages-ee4/blob/master/event_espresso-'.self::$_lang.'.mo?raw=true'); |
|
| 76 | + $sideloader->set_new_file_name('event_espresso-'.self::$_lang.'.mo'); |
|
| 77 | 77 | $sideloader->sideload(); |
| 78 | 78 | |
| 79 | 79 | // now the .po file: |
| 80 | - $sideloader->set_upload_from('https://github.com/eventespresso/languages-ee4/blob/master/event_espresso-' . self::$_lang . '.po?raw=true'); |
|
| 81 | - $sideloader->set_new_file_name('event_espresso-' . self::$_lang . '.po'); |
|
| 80 | + $sideloader->set_upload_from('https://github.com/eventespresso/languages-ee4/blob/master/event_espresso-'.self::$_lang.'.po?raw=true'); |
|
| 81 | + $sideloader->set_new_file_name('event_espresso-'.self::$_lang.'.po'); |
|
| 82 | 82 | $sideloader->sideload(); |
| 83 | 83 | |
| 84 | 84 | // set option so the above only runs when EE updates. |
| 85 | - update_option('ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION, 1); |
|
| 85 | + update_option('ee_lang_check_'.self::$_lang.'_'.EVENT_ESPRESSO_VERSION, 1); |
|
| 86 | 86 | } |
| 87 | 87 | } |