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


PHP SitePress::get_setting方法代码示例

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


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

示例1: 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

示例2:

 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

示例3: 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

示例4: get_status_array

 /**
  * @return array containing strings displayed in the translation service polling status box
  */
 public function get_status_array()
 {
     $data = $this->filter_obsolete($this->project->jobs());
     $button_text = __('Get completed translations', 'sitepress');
     if (($job_in_progress = $this->in_progress_count($data)) == 1) {
         $jobs_in_progress_text = __('1 job has been sent to the translation service.', 'sitepress');
     } else {
         $jobs_in_progress_text = sprintf(__('%d jobs have been sent to the translation service.', 'sitepress'), $job_in_progress);
     }
     $last_picked_up = $this->sitepress->get_setting('last_picked_up');
     $last_time_picked_up = !empty($last_picked_up) ? date_i18n('Y, F jS @g:i a', $last_picked_up) : __('never', 'sitepress');
     $last_pickup_text = sprintf(__('Last time translations were picked up: %s', 'sitepress'), $last_time_picked_up);
     return array('jobs_in_progress_text' => $jobs_in_progress_text, 'button_text' => $button_text, 'last_pickup_text' => $last_pickup_text, 'polling_data' => $this->filter_known_pending($data));
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:17,代码来源:class-wpml-tp-polling-status.php

示例5: pre_option_sticky_posts_filter

 /**
  * Filters the sticky posts option. If synchronization of sticky posts is activated it will translated
  * wrong language values, if deactivated filter out wrong language values.
  *
  * @param int[]     $posts
  * @param SitePress $sitepress
  *
  * @used-by \SitePress::option_sticky_posts which uses this function to filter the sticky posts array after
  *                                          having removed WPML per-language filtering on the sticky posts option.
  *
  * @return int[]
  */
 public function pre_option_sticky_posts_filter($posts, &$sitepress)
 {
     $posts = $posts ? $posts : get_option('sticky_posts');
     $this->filtered_sticky_posts = array();
     if ($posts) {
         $current_lang = $sitepress->get_current_language();
         $this->prefetch_ids($posts);
         if ($sitepress->get_setting('sync_sticky_flag')) {
             $unfiltered = $posts;
             foreach ($posts as $index => $sticky_post_id) {
                 $posts[$index] = $this->element_id_in($sticky_post_id, $current_lang);
             }
             if ($unfiltered != $posts) {
                 update_option('sticky_posts', array_values(array_unique(array_filter(array_merge($posts, $unfiltered)))));
             }
         } else {
             foreach ($posts as $index => $sticky_post_id) {
                 if ($this->get_element_lang_code($sticky_post_id) !== $current_lang) {
                     $this->filtered_sticky_posts[] = $sticky_post_id;
                     unset($posts[$index]);
                 }
             }
         }
         $posts = array_values(array_unique(array_filter($posts)));
     }
     return $posts;
 }
开发者ID:agiper,项目名称:wordpress,代码行数:39,代码来源:wpml-post-translation.class.php

示例6: get_status_array

 /**
  * @return array containing strings displayed in the translation service polling status box
  *
  * @throws Exception in case communication with Translation Proxy fails
  */
 public function get_status_array()
 {
     try {
         $data = $this->filter_obsolete($this->project->jobs());
     } catch (Exception $e) {
         throw new Exception('Got the following error when trying to load status data from Translation Proxy via polling: ' . $e->getMessage(), 0, $e);
     }
     $button_text = __('Get completed translations', 'wpml-translation-management');
     if (($job_in_progress = $this->in_progress_count($data)) == 1) {
         $jobs_in_progress_text = __('1 job has been sent to the translation service.', 'wpml-translation-management');
     } else {
         $jobs_in_progress_text = sprintf(__('%d jobs have been sent to the translation service.', 'wpml-translation-management'), $job_in_progress);
     }
     $last_picked_up = $this->sitepress->get_setting('last_picked_up');
     $last_time_picked_up = !empty($last_picked_up) ? date_i18n('Y, F jS @g:i a', $last_picked_up) : __('never', 'wpml-translation-management');
     $last_pickup_text = sprintf(__('Last time translations were picked up: %s', 'wpml-translation-management'), $last_time_picked_up);
     return array('jobs_in_progress_text' => $jobs_in_progress_text, 'button_text' => $button_text, 'last_pickup_text' => $last_pickup_text, 'polling_data' => $this->filter_known_pending($data));
 }
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:23,代码来源:class-wpml-tp-polling-status.php

示例7: strpos

 function post_type_link_filter($post_link, $post, $leavename, $sample)
 {
     if (!$this->sitepress->is_translated_post_type($post->post_type) || !($ld = $this->sitepress->get_element_language_details($post->ID, 'post_' . $post->post_type))) {
         return $post_link;
     }
     if (isset($this->post_link_cache[$post->ID][$leavename . '#' . $sample])) {
         $post_link = $this->post_link_cache[$post->ID][$leavename . '#' . $sample];
     } else {
         $st_settings = $this->sitepress->get_setting('st');
         $strings_language = !empty($st_settings['strings_language']) ? $st_settings['strings_language'] : 'en';
         // fix permalink when object is not in the current language
         if ($ld->language_code != $strings_language) {
             $slug_settings = $this->sitepress->get_setting('posts_slug_translation');
             $slug_settings = !empty($slug_settings['types'][$post->post_type]) ? $slug_settings['types'][$post->post_type] : null;
             if ((bool) $slug_settings === true) {
                 $slug_this = $this->get_slug_by_type($post->post_type);
                 $slug_real = $this->get_translated_slug($slug_this, $ld->language_code);
                 if (empty($slug_real)) {
                     return $post_link;
                 }
                 global $wp_rewrite;
                 if (isset($wp_rewrite->extra_permastructs[$post->post_type])) {
                     $struct_original = $wp_rewrite->extra_permastructs[$post->post_type]['struct'];
                     $lslash = false !== strpos($struct_original, '/' . $slug_this) ? '/' : '';
                     $wp_rewrite->extra_permastructs[$post->post_type]['struct'] = preg_replace('@' . $lslash . $slug_this . '/@', $lslash . $slug_real . '/', $struct_original);
                     remove_filter('post_type_link', array($this, 'post_type_link_filter'), 1);
                     // high priority
                     $post_link = get_post_permalink($post->ID, $leavename, $sample);
                     add_filter('post_type_link', array($this, 'post_type_link_filter'), 1, 4);
                     // high priority
                     $wp_rewrite->extra_permastructs[$post->post_type]['struct'] = $struct_original;
                 } else {
                     $post_link = str_replace($slug_this . '=', $slug_real . '=', $post_link);
                 }
             }
             $this->post_link_cache[$post->ID][$leavename . '#' . $sample] = $post_link;
         }
     }
     return $post_link;
 }
开发者ID:fdelarosa191,项目名称:iftheme-docs,代码行数:40,代码来源:slug-translation.php

示例8: maybe_migrate_string_name

 public function maybe_migrate_string_name()
 {
     global $wpdb;
     $slug_settings = $this->sitepress->get_setting('posts_slug_translation');
     if (!isset($slug_settings['string_name_migrated'])) {
         $queryable_post_types = get_post_types(array('publicly_queryable' => true));
         foreach ($queryable_post_types as $type) {
             $post_type_obj = get_post_type_object($type);
             $slug = trim($post_type_obj->rewrite['slug'], '/');
             if ($slug) {
                 // First check if we should migrate from the old format URL slug: slug
                 $string_id = $wpdb->get_var($wpdb->prepare("SELECT id\r\r\n\t\t\t\t\t\t\t\t\t\t\tFROM {$wpdb->prefix}icl_strings\r\r\n\t\t\t\t\t\t\t\t\t\t\tWHERE name = %s AND value = %s", 'URL slug: ' . $slug, $slug));
                 if ($string_id) {
                     // migrate it to URL slug: post_type
                     $st_update['name'] = 'URL slug: ' . $type;
                     $wpdb->update($wpdb->prefix . 'icl_strings', $st_update, array('id' => $string_id));
                 }
             }
         }
         $slug_settings['string_name_migrated'] = true;
         $this->sitepress->set_setting('posts_slug_translation', $slug_settings, true);
     }
 }
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:23,代码来源:slug-translation.php

示例9: get_user_xliff_version

 /**
  * @return bool|string
  */
 private function get_user_xliff_version()
 {
     return $this->sitepress->get_setting("tm_xliff_version", false);
 }
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:7,代码来源:class-wpml-tm-xliff-frontend.php

示例10: get_strings_per_page

 private function get_strings_per_page()
 {
     $st_settings = $this->sitepress->get_setting('st');
     return isset($st_settings['strings_per_page']) ? $st_settings['strings_per_page'] : WPML_ST_DEFAULT_STRINGS_PER_PAGE;
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:5,代码来源:class-wpml-st-strings.php

示例11: __construct

 public function __construct(&$sitepress, WPML_ST_Upgrade_Command_Factory $command_factory)
 {
     $this->sitepress = $sitepress;
     $this->string_settings = $this->sitepress->get_setting('st', array());
     $this->command_factory = $command_factory;
 }
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:6,代码来源:class-wpml-st-upgrade.php


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