当前位置: 首页>>代码示例>>PHP>>正文


PHP SitePress类代码示例

本文整理汇总了PHP中SitePress的典型用法代码示例。如果您正苦于以下问题:PHP SitePress类的具体用法?PHP SitePress怎么用?PHP SitePress使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SitePress类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 function __construct()
 {
     global $cms_nav_ie_ver, $sitepress;
     if (!isset($sitepress)) {
         $sitepress = new SitePress();
         $sitepress->initialize_cache();
     }
     $sitepress_settings = $sitepress->get_settings();
     $this->settings = $sitepress_settings['modules']['cms-navigation'];
     $cms_nav_user_agent = $_SERVER['HTTP_USER_AGENT'];
     if (preg_match('#MSIE ([0-9]+)\\.[0-9]#', $cms_nav_user_agent, $matches)) {
         $cms_nav_ie_ver = $matches[1];
     }
     add_action('icl_navigation_breadcrumb', array($this, 'cms_navigation_breadcrumb'));
     add_action('icl_navigation_menu', array($this, 'cms_navigation_menu_nav'));
     add_action('icl_navigation_sidebar', array($this, 'cms_navigation_page_navigation'));
     add_action('save_post', array($this, 'cms_navigation_update_post_settings'));
     add_action('admin_head', array($this, 'cms_navigation_page_edit_options'));
     add_action('admin_head', array($this, 'cms_navigation_js'));
     add_action('init', array($this, 'cms_navigation_css'));
     add_action('plugins_loaded', array($this, 'sidebar_navigation_widget_init'));
     add_filter('page_link', array($this, 'rewrite_page_link'), 15, 2);
     add_action('parse_query', array($this, 'redirect_offsite_urls'));
     add_filter('permalink_structure_changed', array($this, 'clear_cache'));
     add_filter('update_option_show_on_front', array($this, 'clear_cache'));
     add_filter('update_option_page_on_front', array($this, 'clear_cache'));
     add_filter('update_option_page_for_posts', array($this, 'clear_cache'));
     add_action('delete_post', array($this, 'clear_cache'));
     add_action('delete_category', array($this, 'clear_cache'));
     add_action('create_category', array($this, 'clear_cache'));
     add_action('edited_category', array($this, 'clear_cache'));
     // not needed - save_post handles this
     //add_action('trashed_post', array($this,'clear_cache'));
     //add_action('untrashed_post', array($this,'clear_cache'));
 }
开发者ID:winyatasenjaya,项目名称:sitepress-multilingual-cms,代码行数:35,代码来源:cms-navigation.php

示例2: __construct

 /**
  * @param SitePress         $sitepress
  * @param WPML_Query_Filter $query_filter
  */
 public function __construct(&$sitepress, &$query_filter)
 {
     $wpdb = $sitepress->wpdb();
     $post_translation = $sitepress->post_translations();
     $term_translation = $sitepress->term_translations();
     parent::__construct($sitepress, $wpdb, $post_translation, $term_translation);
     $this->query_filter =& $query_filter;
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:12,代码来源:class-wpml-query-parser.php

示例3: __construct

 /**
  * WPML_TM_Translation_Status_Display constructor.
  *
  * @param wpdb                         $wpdb
  * @param SitePress                    $sitepress
  * @param WPML_Post_Status             $status_helper
  * @param WPML_Translation_Job_Factory $job_factory
  * @param WPML_TM_API                  $tm_api
  */
 public function __construct(&$wpdb, &$sitepress, &$status_helper, &$job_factory, &$tm_api)
 {
     $post_translation = $sitepress->post_translations();
     parent::__construct($wpdb, $sitepress, $post_translation);
     $this->status_helper =& $status_helper;
     $this->job_factory =& $job_factory;
     $this->tm_api =& $tm_api;
 }
开发者ID:agiper,项目名称:wordpress,代码行数:17,代码来源:class-wpml-tm-translation-status-display.php

示例4: __construct

 /**
  * @param SitePress               $sitepress
  * @param WPML_Terms_Translations $term_utils
  * @param string                  $taxonomy
  */
 public function __construct(&$sitepress, &$term_utils, $taxonomy)
 {
     $wpdb = $sitepress->wpdb();
     parent::__construct($wpdb, $sitepress);
     $this->term_utils = $term_utils;
     $this->taxonomy = $taxonomy;
     $this->data = $this->set_affected_ids();
     $this->prepare_missing_terms_data();
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:14,代码来源:class-wpml-term-language-synchronization.php

示例5: __construct

 /**
  * WPML_Translations_Queue_Jobs_Model constructor.
  *
  * @param SitePress                 $sitepress
  * @param TranslationManagement     $tm_instance
  * @param WPML_TM_API               $tm_api
  * @param WPML_TM_Post_Link_Factory $post_link_factory
  * @param array                     $translation_jobs
  */
 public function __construct($sitepress, &$tm_instance, &$tm_api, &$post_link_factory, array $translation_jobs)
 {
     parent::__construct($tm_instance);
     $this->translation_jobs = $translation_jobs;
     $this->tm_api =& $tm_api;
     $this->post_link_factory =& $post_link_factory;
     $this->post_types = $sitepress->get_translatable_documents(true);
     $this->post_types = apply_filters('wpml_get_translatable_types', $this->post_types);
 }
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:18,代码来源:class-wpml-translations-queue-jobs-model.php

示例6: get_current_lang

 /**
  * get current language
  */
 public static function get_current_lang()
 {
     self::validate_wpml_exists();
     $wpml = new SitePress();
     if (is_admin()) {
         $lang = $wpml->get_default_language();
     } else {
         $lang = self::get_current_lang_code();
     }
     return $lang;
 }
开发者ID:daanbakker1995,项目名称:vanteun,代码行数:14,代码来源:wpml.class.php

示例7: getFlagUrl

 /**
  * get flag url
  */
 public static function getFlagUrl($code)
 {
     self::validateWpmlExists();
     $wpml = new SitePress();
     if (empty($code) || $code == "all") {
         $url = ICL_PLUGIN_URL . '/res/img/icon16.png';
     } else {
         $url = $wpml->get_flag_url($code);
     }
     //default: show all
     if (empty($url)) {
         $url = ICL_PLUGIN_URL . '/res/img/icon16.png';
     }
     return $url;
 }
开发者ID:jgabrielfreitas,项目名称:MultipagosTestesAPP,代码行数:18,代码来源:wpml.class.php

示例8: get_job_id_from_request

 public static function get_job_id_from_request()
 {
     /**
      * @var TranslationManagement $iclTranslationManagement
      * @var WPML_Post_Translation $wpml_post_translations
      */
     global $iclTranslationManagement, $wpml_post_translations, $wpml_translation_job_factory, $sitepress, $wpdb;
     $job_id = filter_input(INPUT_GET, 'job_id', FILTER_SANITIZE_NUMBER_INT);
     $trid = filter_input(INPUT_GET, 'trid', FILTER_SANITIZE_NUMBER_INT);
     $language_code = filter_input(INPUT_GET, 'language_code', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
     $source_language_code = filter_input(INPUT_GET, 'source_language_code', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
     if (!$job_id && $trid && $language_code) {
         $job_id = $iclTranslationManagement->get_translation_job_id($trid, $language_code);
         if (!$job_id) {
             if (!$source_language_code) {
                 $post_id = SitePress::get_original_element_id_by_trid($trid);
             } else {
                 $posts_in_trid = $wpml_post_translations->get_element_translations(false, $trid);
                 $post_id = isset($posts_in_trid[$source_language_code]) ? $posts_in_trid[$source_language_code] : false;
             }
             $blog_translators = wpml_tm_load_blog_translators();
             $args = array('lang_from' => $source_language_code, 'lang_to' => $language_code, 'job_id' => $job_id);
             if ($post_id && $blog_translators->is_translator($sitepress->get_current_user()->ID, $args)) {
                 $job_id = $wpml_translation_job_factory->create_local_post_job($post_id, $language_code);
             }
         }
     }
     return $job_id;
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:29,代码来源:wpml-translation-editor.class.php

示例9: get_job_id_from_request

 public static function get_job_id_from_request()
 {
     /**
      * @var TranslationManagement $iclTranslationManagement
      * @var WPML_Post_Translation $wpml_post_translations
      */
     global $iclTranslationManagement, $wpml_post_translations, $wpml_translation_job_factory;
     $job_id = filter_input(INPUT_GET, 'job_id', FILTER_SANITIZE_NUMBER_INT);
     $trid = filter_input(INPUT_GET, 'trid', FILTER_SANITIZE_NUMBER_INT);
     $language_code = filter_input(INPUT_GET, 'language_code', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
     $source_language_code = filter_input(INPUT_GET, 'source_language_code', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
     if (!$job_id && $trid && $language_code) {
         $job_id = $iclTranslationManagement->get_translation_job_id($trid, $language_code);
         if (!$job_id) {
             if (!$source_language_code) {
                 $post_id = SitePress::get_original_element_id_by_trid($trid);
             } else {
                 $posts_in_trid = $wpml_post_translations->get_element_translations(false, $trid);
                 $post_id = isset($posts_in_trid[$source_language_code]) ? $posts_in_trid[$source_language_code] : false;
             }
             if ($post_id && current_user_can('manage_options', $post_id)) {
                 $job_id = $wpml_translation_job_factory->create_local_post_job($post_id, $language_code);
             }
         }
     }
     return $job_id;
 }
开发者ID:ryuqing,项目名称:cake,代码行数:27,代码来源:wpml-translation-editor.class.php

示例10: _st_warnings

 static function _st_warnings()
 {
     if (!class_exists('ICL_AdminNotifier')) {
         return;
     }
     global $sitepress, $sitepress_settings;
     if (!isset($sitepress)) {
         return;
     }
     if (method_exists($sitepress, 'check_settings_integrity') && !SitePress::check_settings_integrity()) {
         return;
     }
     if (!isset($sitepress_settings['st']['strings_language'])) {
         $sitepress_settings = $sitepress->get_settings();
     }
     if (isset($sitepress_settings['st']['strings_language'])) {
         if ($sitepress->get_default_language() != $sitepress_settings['st']['strings_language']) {
             self::_st_default_language_warning();
         } elseif ($sitepress_settings['st']['strings_language'] != 'en') {
             self::_st_default_and_st_language_warning();
         } else {
             ICL_AdminNotifier::removeMessage('_st_default_and_st_language_warning');
             ICL_AdminNotifier::removeMessage('_st_default_language_warning');
         }
     }
 }
开发者ID:Calraiser,项目名称:flux,代码行数:26,代码来源:wpml-string-translation.class.php

示例11: set_language

 public function set_language($domain, $lang)
 {
     $this->language_of_domain[$domain] = $lang;
     $string_settings = $this->sitepress->get_setting('st');
     $string_settings['lang_of_domain'] = $this->language_of_domain;
     $this->sitepress->set_setting('st', $string_settings, true);
 }
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:7,代码来源:class-wpml-language-of-domain.php

示例12: estimate_custom_field_word_count

 private function estimate_custom_field_word_count()
 {
     $sitepress_settings = $this->sitepress->get_settings();
     if (!isset($this->language_code) || !isset($this->id) || !$this->is_registered_type()) {
         return 0;
     }
     $words = 0;
     $post_id = $this->id;
     if (!empty($sitepress_settings['translation-management']['custom_fields_translation']) && is_array($sitepress_settings['translation-management']['custom_fields_translation'])) {
         $custom_fields = array();
         foreach ($sitepress_settings['translation-management']['custom_fields_translation'] as $cf => $op) {
             if (WPML_TRANSLATE_CUSTOM_FIELD === (int) $op) {
                 $custom_fields[] = $cf;
             }
         }
         foreach ($custom_fields as $cf) {
             $custom_fields_value = get_post_meta($post_id, $cf);
             if ($custom_fields_value && is_scalar($custom_fields_value)) {
                 // only support scalar values fo rnow
                 $words += $this->get_string_words_count($this->language_code, $custom_fields_value);
             } else {
                 foreach ($custom_fields_value as $custom_fields_value_item) {
                     if ($custom_fields_value_item && is_scalar($custom_fields_value_item)) {
                         // only support scalar values fo rnow
                         $words += $this->get_string_words_count($this->language_code, $custom_fields_value_item);
                     }
                 }
             }
         }
     }
     return (int) $words;
 }
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:32,代码来源:class-wpml-tm-post.php

示例13: load_icl_migration

 public function load_icl_migration()
 {
     if (!$this->sitepress || (bool) $this->sitepress->get_setting('wpml_icl_migration_completed') === false) {
         require_once WPML_ICLM_PATH . '/menu/wpml-icl-migration-menu.class.php';
         $migration_menu = new WPML_ICL_Migration_Display();
         $migration_menu->init();
     }
 }
开发者ID:Alexg10,项目名称:Egzobeatbox,代码行数:8,代码来源:wpml-iclm-loader.class.php

示例14:

 function language_selector_widget_init()
 {
     if ($this->sitepress->get_setting('setup_complete')) {
         register_widget('ICL_Language_Switcher');
     }
     add_action('template_redirect', 'icl_lang_sel_nav_ob_start', 0);
     add_action('wp_head', 'icl_lang_sel_nav_ob_end');
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:8,代码来源:language-switcher.php

示例15: get_source_lang

 /**
  * @param $name
  * @param $domain
  *
  * @return string
  */
 public function get_source_lang($name, $domain)
 {
     $domain_lang = $this->lang_of_domain->get_language($domain);
     if (!$domain_lang) {
         $flag = 0 === strpos($domain, 'admin_texts_') || 'Tagline' === $name || 'Blog Title' === $name;
         $domain_lang = $flag ? $this->sitepress->get_user_admin_language(get_current_user_id()) : 'en';
     }
     return $domain_lang;
 }
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:15,代码来源:class-wpml-autoregister-save-strings.php


注:本文中的SitePress类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。