示例#1
0
 /**
  * Check if a translation plugin is activated (WPML or qTranslate)
  *
  * @since 2.0
  * @deprecated 2.2
  * @deprecated Use rocket_has_i18n()
  *
  */
 function rocket_has_translation_plugin_active()
 {
     _deprecated_function(__FUNCTION__, '2.2', 'rocket_has_i18n()');
     return rocket_has_i18n();
 }
示例#2
0
/**
 * Get home URL of a specific lang
 *
 * @since 2.2
 *
 * @param string $lang (default: '') The language code
 * @return string $url
 */
function get_rocket_i18n_home_url($lang = '')
{
    $url = home_url();
    if (!rocket_has_i18n()) {
        return $url;
    }
    if (rocket_is_plugin_active('sitepress-multilingual-cms/sitepress.php')) {
        $url = $GLOBALS['sitepress']->language_url($lang);
    } elseif (rocket_is_plugin_active('qtranslate/qtranslate.php')) {
        $url = qtrans_convertURL(home_url(), $lang, true);
    } elseif (rocket_is_plugin_active('polylang/polylang.php') && !empty($GLOBALS['polylang']->options['force_lang'])) {
        $url = pll_home_url($lang);
    }
    return $url;
}
示例#3
0
 /**
  * Run WP Rocket Bot for preload cache files
  *
  * ## EXAMPLES
  *
  *     wp rocket preload
  *
  * @subcommand preload
  */
 public function preload($args = array(), $assoc_args = array())
 {
     if (rocket_has_i18n()) {
         run_rocket_bot_for_all_langs();
     } else {
         run_rocket_bot('cache-preload');
     }
     WP_CLI::success('Finished WP Rocket preload cache files.');
 }