當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。