/** * Get language .mo path * @author Howard <*****@*****.**> * @static * @param string $locale * @return string */ public static function get_language_mo_path($locale = NULL) { if (!$locale) { $locale = wpl_global::get_current_language(); } $path = WP_LANG_DIR . DS . WPL_BASENAME . DS . WPL_TEXTDOMAIN . '-' . $locale . '.mo'; if (!wpl_file::exists($path)) { $path = wpl_global::get_wpl_root_path() . 'languages' . DS . WPL_TEXTDOMAIN . '-' . $locale . '.mo'; } return $path; }
/** * Imports a language file * @author Howard <*****@*****.**> * @return void */ public function import_language() { $locale = apply_filters('plugin_locale', get_locale(), WPL_TEXTDOMAIN); $overriden_language_filepath = WP_LANG_DIR . DS . WPL_BASENAME . DS . WPL_TEXTDOMAIN . '-' . $locale . '.mo'; /** check if the language file is overridden **/ if (wpl_file::exists($overriden_language_filepath)) { load_textdomain(WPL_TEXTDOMAIN, WP_LANG_DIR . DS . WPL_BASENAME . DS . WPL_TEXTDOMAIN . '-' . $locale . '.mo'); } else { load_plugin_textdomain(WPL_TEXTDOMAIN, false, wpl_global::get_wpl_root_path() . 'languages' . DS); } }
/** * Returns image URL * @author Howard R <*****@*****.**> * @static * @param string $image * @return string|boolean */ public static function get_images_url($image = '') { /** first validation **/ if (trim($image) == '') { return false; } $path = wpl_global::get_wpl_root_path() . 'libraries' . DS . 'notifications' . DS . 'templates' . DS . 'cache' . DS . $image . '.png'; $url = wpl_global::get_wpl_url() . 'libraries/notifications/templates/cache/' . $image . '.png'; if (!wpl_file::exists($path)) { wpl_images::text_to_image($image, '000000', $path); } return $url; }