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


PHP icl_get_setting函数代码示例

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


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

示例1: init

 public function init()
 {
     global $sitepress;
     $tax_get = filter_input(INPUT_GET, 'taxonomy');
     require ICL_PLUGIN_PATH . '/menu/term-taxonomy-menus/wpml-term-language-filter.class.php';
     if (($trid = filter_input(INPUT_GET, 'trid')) && ($source_lang = filter_input(INPUT_GET, 'source_lang')) && get_taxonomy($tax_get) !== false) {
         $translations = $sitepress->get_element_translations($trid, 'tax_' . $this->taxonomy);
         if (isset($translations[$_GET['lang']]) && !empty($translations[$_GET['lang']]->term_id)) {
             wp_redirect(get_edit_term_link($translations[$_GET['lang']]->term_id, $tax_get));
             exit;
         } else {
             add_action('admin_notices', array($this, '_tax_adding'));
         }
     }
     $term_lang_filter = new WPML_Term_Language_Filter(icl_get_setting('default_language'));
     if ($this->taxonomy === 'category') {
         add_action('edit_category_form', array($this, 'wpml_edit_term_form'));
     } else {
         add_action('add_tag_form', array($this, 'wpml_edit_term_form'));
         add_action('edit_tag_form', array($this, 'wpml_edit_term_form'));
     }
     add_action('admin_print_scripts-edit-tags.php', array($this, 'js_scripts_tags'));
     add_filter('wp_dropdown_cats', array($this, 'wp_dropdown_cats_select_parent'), 10, 2);
     add_action('admin_footer', array($term_lang_filter, 'terms_language_filter'));
 }
开发者ID:pcuervo,项目名称:odc,代码行数:25,代码来源:wpml-tax-menu-loader.class.php

示例2: _wpml_get_redirect_helper

/**
 * @param string $request_uri
 * @param string $http_host
 *
 * @return array (WPML_Redirection|string)[] containing the actual redirect helper object at the 0 index and the language code of the currently
 *               queried url at the 1 index
 */
function _wpml_get_redirect_helper($request_uri, $http_host)
{
    global $wpml_url_converter;
    $lang_neg_type = icl_get_setting('language_negotiation_type');
    $language_code = $wpml_url_converter->get_language_from_url($http_host . $request_uri);
    switch ($lang_neg_type) {
        case 1:
            global $wpml_url_filters;
            if ($wpml_url_filters->frontend_uses_root() !== false) {
                require ICL_PLUGIN_PATH . '/inc/request-handling/redirection/wpml-rootpage-redirect-by-subdir.class.php';
                $redirect_helper = new WPML_RootPage_Redirect_By_Subdir(icl_get_setting('urls'), $request_uri, $http_host);
            } else {
                require ICL_PLUGIN_PATH . '/inc/request-handling/redirection/wpml-redirect-by-subdir.class.php';
                $redirect_helper = new WPML_Redirect_By_Subdir(icl_get_setting('urls'), $request_uri, $http_host);
            }
            break;
        case 2:
            require ICL_PLUGIN_PATH . '/inc/request-handling/redirection/wpml-redirect-by-domain.class.php';
            $redirect_helper = new WPML_Redirect_By_Domain(icl_get_setting('language_domains'), $request_uri, $http_host);
            break;
        case 3:
        default:
            $redirect_helper = new WPML_Redirect_By_Param(icl_get_setting('taxonomies_sync_option', array()), $language_code, $request_uri);
    }
    return array($redirect_helper, $language_code);
}
开发者ID:pcuervo,项目名称:odc,代码行数:33,代码来源:wpml-frontend-redirection.php

示例3: _wpml_get_redirect_helper

/**
 *
 * @return  WPML_Redirection
 *
 */
function _wpml_get_redirect_helper()
{
    global $wpml_url_converter, $wpml_request_handler, $wpml_language_resolution, $sitepress;
    $lang_neg_type = wpml_get_setting_filter(false, 'language_negotiation_type');
    switch ($lang_neg_type) {
        case 1:
            global $wpml_url_filters;
            if ($wpml_url_filters->frontend_uses_root() !== false) {
                require_once ICL_PLUGIN_PATH . '/inc/request-handling/redirection/wpml-rootpage-redirect-by-subdir.class.php';
                $redirect_helper = new WPML_RootPage_Redirect_By_Subdir(wpml_get_setting_filter(array(), 'urls'), $wpml_request_handler, $wpml_url_converter, $wpml_language_resolution);
            } else {
                require_once ICL_PLUGIN_PATH . '/inc/request-handling/redirection/wpml-redirect-by-subdir.class.php';
                $redirect_helper = new WPML_Redirect_By_Subdir($wpml_url_converter, $wpml_request_handler, $wpml_language_resolution);
            }
            break;
        case 2:
            require_once ICL_PLUGIN_PATH . '/inc/request-handling/redirection/wpml-redirect-by-domain.class.php';
            $wp_api = new WPML_WP_API();
            $redirect_helper = new WPML_Redirect_By_Domain(icl_get_setting('language_domains'), $wp_api, $wpml_request_handler, $wpml_url_converter, $wpml_language_resolution);
            break;
        case 3:
        default:
            $redirect_helper = new WPML_Redirect_By_Param(icl_get_setting('taxonomies_sync_option', array()), $wpml_url_converter, $wpml_request_handler, $wpml_language_resolution, $sitepress);
            $redirect_helper->init_hooks();
    }
    return $redirect_helper;
}
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:32,代码来源:wpml-frontend-redirection.php

示例4: register_string

 public function register_string($context, $name, $value, $allow_empty_value = false)
 {
     global $wpdb;
     /* cpt slugs - do not register them when scanning themes and plugins
      * if name starting from 'URL slug: '
      * and context is different from 'WordPress'
      */
     if (substr($name, 0, 10) === 'URL slug: ' && 'WordPress' !== $context) {
         return false;
     }
     // if the default language is not set up return without doing anything
     if (!icl_get_setting('existing_content_language_verified')) {
         return false;
     }
     $translation = $this->string_from_registered($name, $context);
     if ($translation === $value) {
         return false;
     }
     list($name, $context) = $this->truncate_name_and_context($name, $context);
     $language = $this->language;
     $query = $wpdb->prepare("SELECT id, value, status FROM {$wpdb->prefix}icl_strings WHERE context=%s AND name=%s", $context, $name);
     $res = $wpdb->get_row($query);
     if ($res) {
         $string_id = $res->id;
         /*
          * If Sticky Links plugin is active and set to change links in Strings,
          * we need to process $value and change links into sticky before comparing
          * with saved in DB $res->value.
          * Otherwise after every String Translation screen refresh status of this string
          * will be changed into 'needs update'
          */
         $alp_settings = get_option('alp_settings');
         if (!empty($alp_settings['sticky_links_strings']) && $alp_settings['sticky_links_strings'] && defined('WPML_STICKY_LINKS_VERSION')) {
             // sticky links plugin is active?
             require_once ICL_PLUGIN_PATH . '/inc/absolute-links/absolute-links.class.php';
             $absolute_links_object = new AbsoluteLinks();
             $alp_broken_links = array();
             $value = $absolute_links_object->_process_generic_text($value, $alp_broken_links);
         }
         $update_string = array();
         if ($value != $res->value) {
             $update_string['value'] = $value;
         }
         if (!empty($update_string)) {
             $wpdb->update($wpdb->prefix . 'icl_strings', $update_string, array('id' => $string_id));
             $wpdb->update($wpdb->prefix . 'icl_string_translations', array('status' => ICL_TM_NEEDS_UPDATE), array('string_id' => $string_id));
             icl_update_string_status($string_id);
         }
     } else {
         $string_id = $this->save_string($value, $allow_empty_value, $language, $context, $name);
     }
     global $WPML_Sticky_Links;
     if (defined('WPML_TM_PATH') && !empty($WPML_Sticky_Links) && $WPML_Sticky_Links->settings['sticky_links_strings']) {
         require_once WPML_TM_PATH . '/inc/translation-proxy/wpml-pro-translation.class.php';
         WPML_Pro_Translation::_content_make_links_sticky($string_id, 'string', false);
     }
     $this->name_cache[$name . $context] = $value;
     return $string_id;
 }
开发者ID:edgarter,项目名称:wecare,代码行数:59,代码来源:wpml-admin-string-filter.class.php

示例5: __construct

 public function __construct($user_id, $user_is_admin, $language_pairs, $current_lang, $active_languages)
 {
     $this->language_pairs = $language_pairs;
     $this->current_lang = $current_lang;
     $this->active_langs = $active_languages;
     $this->editor_is_default = icl_get_setting('doc_translation_method');
     add_action('wpml_cache_clear', array($this, 'init'), 11, 0);
 }
开发者ID:aarongillett,项目名称:B22-151217,代码行数:8,代码来源:class-wpml-tm-translation-status-display.php

示例6: get_language_pairs

 /**
  *
  * Get information about language pairs (including translators). Works only for ICL as a Translation Service
  *
  * @return array
  */
 public static function get_language_pairs()
 {
     $icl_lang_status = icl_get_setting('icl_lang_status', array());
     if (!empty($icl_lang_status)) {
         return $icl_lang_status;
     }
     $translator_status = self::get_icl_translator_status();
     $language_pairs = $translator_status['icl_lang_status'];
     return $language_pairs;
 }
开发者ID:sonvq,项目名称:passioninvestment,代码行数:16,代码来源:translationproxy-translator.class.php

示例7: apply_include_filters

function apply_include_filters()
{
    if (icl_get_setting('language_domains')) {
        add_filter('plugins_url', 'filter_include_url');
        //so plugin includes get the correct path
        add_filter('template_directory_uri', 'filter_include_url');
        //js includes get correct path
        add_filter('stylesheet_directory_uri', 'filter_include_url');
        //style.css gets included right
    }
}
开发者ID:Calraiser,项目名称:flux,代码行数:11,代码来源:sitepress.php

示例8: get_language_pairs

 /**
  *
  * Get information about language pairs (including translators). Works only for ICL as a Translation Service
  *
  * @return array
  */
 public static function get_language_pairs()
 {
     $icl_lang_status = icl_get_setting('icl_lang_status', array());
     if (!empty($icl_lang_status)) {
         $missing_translators = false;
         foreach ($icl_lang_status as $lang) {
             if (empty($lang['translators'])) {
                 $missing_translators = true;
                 break;
             }
         }
         if (!$missing_translators) {
             return $icl_lang_status;
         }
     }
     $translator_status = self::get_icl_translator_status();
     return $translator_status['icl_lang_status'];
 }
开发者ID:Junaid-Farid,项目名称:gocnex,代码行数:24,代码来源:translationproxy-translator.class.php

示例9: loaded

 function loaded()
 {
     parent::loaded();
     if ($this->passed_dependencies()) {
         if (icl_get_setting('setup_complete')) {
             $this->add_admin_hooks();
             $this->add_global_hooks();
             if (is_admin()) {
                 $this->run_db_update();
                 if (get_option('wpml-package-translation-refresh-required', true)) {
                     add_action('init', array($this, 'refresh_packages'), 999, 0);
                     update_option('wpml-package-translation-refresh-required', false);
                 }
             }
             $this->package_translation_active = true;
         }
     }
 }
开发者ID:Junaid-Farid,项目名称:gocnex,代码行数:18,代码来源:wpml-package-translation.class.php

示例10: _e

            ?>
			                <label>
				                <input type="radio" name="icl_untranslated_blog_posts" <?php 
            echo $icl_only_translated_posts_checked;
            ?>
 value="0"/>
				                <?php 
            _e('Only translated posts.', 'sitepress');
            ?>
			                </label>
		                </p>

		                <p>
			                <label>
				                <?php 
            $icl_all_posts_checked = checked(1, icl_get_setting('show_untranslated_blog_posts', 0), false);
            ?>
				                <input type="radio" name="icl_untranslated_blog_posts" <?php 
            echo $icl_all_posts_checked;
            ?>
 value="1"/>
				                <?php 
            _e('All posts (display translation if it exists or posts in default language otherwise).', 'sitepress');
            ?>
			                </label>

		                </p>

		                <div id="icl_untranslated_blog_posts_help" style="display: none">
			                <?php 
            _e("Please note that this setting affects only blog posts queried by the main loop in a theme's index.php template.", "sitepress");
开发者ID:Junaid-Farid,项目名称:gocnex,代码行数:31,代码来源:languages.php

示例11: prepopulate_translations

 private function prepopulate_translations($lang)
 {
     global $wpdb;
     $existing_lang_verified = icl_get_setting('existing_content_language_verified');
     if (!empty($existing_lang_verified)) {
         return;
     }
     icl_cache_clear();
     // case of icl_sitepress_settings accidentally lost
     // if there's at least one translation do not initialize the languages for elements
     $one_translation = $wpdb->get_var($wpdb->prepare("SELECT translation_id FROM {$wpdb->prefix}icl_translations WHERE language_code<>%s", $lang));
     if ($one_translation) {
         return;
     }
     $wpdb->query("TRUNCATE TABLE {$wpdb->prefix}icl_translations");
     $wpdb->query($wpdb->prepare("\n\t\t\tINSERT INTO {$wpdb->prefix}icl_translations(element_type, element_id, trid, language_code, source_language_code)\n\t\t\tSELECT CONCAT('post_',post_type), ID, ID, %s, NULL FROM {$wpdb->posts} WHERE post_status IN ('draft', 'publish','schedule','future','private', 'pending')\n\t\t\t", $lang));
     $maxtrid = 1 + $wpdb->get_var("SELECT MAX(trid) FROM {$wpdb->prefix}icl_translations");
     global $wp_taxonomies;
     $taxonomies = array_keys((array) $wp_taxonomies);
     foreach ($taxonomies as $tax) {
         $element_type = 'tax_' . $tax;
         $insert_query = "\n\t\t\t\tINSERT INTO {$wpdb->prefix}icl_translations(element_type, element_id, trid, language_code, source_language_code)\n\t\t\t\tSELECT %s, term_taxonomy_id, %d+term_taxonomy_id, %s, NULL FROM {$wpdb->term_taxonomy} WHERE taxonomy = %s\n\t\t\t\t";
         $insert_prepare = $wpdb->prepare($insert_query, array($element_type, $maxtrid, $lang, $tax));
         $wpdb->query($insert_prepare);
         $maxtrid = 1 + $wpdb->get_var("SELECT MAX(trid) FROM {$wpdb->prefix}icl_translations");
     }
     $wpdb->query($wpdb->prepare("\n\t\t\tINSERT INTO {$wpdb->prefix}icl_translations(element_type, element_id, trid, language_code, source_language_code)\n\t\t\tSELECT 'comment', comment_ID, {$maxtrid}+comment_ID, %s, NULL FROM {$wpdb->comments}\n\t\t\t", $lang));
     $wpdb->update($wpdb->prefix . 'icl_languages', array('active' => '1'), array('code' => $lang));
 }
开发者ID:pcuervo,项目名称:odc,代码行数:29,代码来源:wpml-installation.class.php

示例12: build_content_mcs


//.........这里部分代码省略.........
        if (!$doc_translation_method) {
            ?>
checked="checked"<?php 
        }
        ?>
 />
		                        <?php 
        _e('Create translations manually', 'wpml-translation-management');
        ?>
	                        </label>
                        </li>
	                    <li>
		                    <label>
			                    <input type="radio" name="t_method" value="<?php 
        echo ICL_TM_TMETHOD_EDITOR;
        ?>
"
			                           <?php 
        if ($doc_translation_method) {
            ?>
checked="checked"<?php 
        }
        ?>
 />
			                    <?php 
        _e('Use the translation editor', 'wpml-translation-management');
        ?>
		                    </label>
	                    </li>
                    </ul>
                    <p id="tm_block_retranslating_terms"><label>
                            <input name="tm_block_retranslating_terms"
                                   value="1" <?php 
        checked(icl_get_setting('tm_block_retranslating_terms'), "1");
        ?>
                                   type="checkbox"/>
                            <?php 
        _e('Block translating taxonomy terms (from the Translation Editor) that have already been translated.', 'wpml-translation-management');
        ?>
                        </label>
                    </p>

                    <p>
                        <label>
                            <input name="how_to_translate"
                                   value="1" <?php 
        checked(icl_get_setting('hide_how_to_translate'), false);
        ?>
                                   type="checkbox"/>
                            <?php 
        _e('Show translation instructions in the list of pages', 'wpml-translation-management');
        ?>
                        </label>
                    </p>

                    <p>
                        <a href="https://wpml.org/?page_id=3416"
                           target="_blank"><?php 
        _e('Learn more about the different translation options', 'wpml-translation-management');
        ?>
</a>
                    </p>

                    <p class="buttons-wrap">
                        <span class="icl_ajx_response" id="icl_ajx_response_dtm"></span>
                        <input type="submit" class="button-primary"
开发者ID:tlandn,项目名称:akvo-sites-zz-template,代码行数:67,代码来源:wpml-tm-menus.class.php

示例13: wpml_maybe_setup_post_edit

function wpml_maybe_setup_post_edit()
{
    global $pagenow, $sitepress, $post_edit_screen;
    if ($pagenow === 'post.php' || $pagenow === 'post-new.php' || $pagenow === 'edit.php' || defined('DOING_AJAX')) {
        require ICL_PLUGIN_PATH . '/menu/wpml-post-edit-screen.class.php';
        $post_edit_screen = new WPML_Post_Edit_Screen(icl_get_setting('language_negotiation_type'));
        add_action('admin_head', array($sitepress, 'post_edit_language_options'));
    }
}
开发者ID:edgarter,项目名称:wecare,代码行数:9,代码来源:functions-load.php

示例14: icl_get_sub_setting

/**
 * @param string      $key
 * @param string      $sub_key
 * @param mixed|false $default
 *
 * @return bool|mixed
 * @since      3.1
 * @deprecated 3.2 use 'wpml_sub_setting' filter instead
 */
function icl_get_sub_setting($key, $sub_key, $default = false)
{
    $parent = icl_get_setting($key, array());
    return isset($parent[$sub_key]) ? $parent[$sub_key] : $default;
}
开发者ID:nhainam,项目名称:wordpress4,代码行数:14,代码来源:functions.php

示例15: filter_for_legal_langs

 /**
  *
  * Sets the language of frontend requests to false, if they are not for
  * a hidden or active language code. The handling of permissions in case of
  * hidden languages is done in \SitePress::init.
  *
  * @param string $lang
  *
  * @return bool|string
  */
 private function filter_for_legal_langs($lang)
 {
     $this->maybe_reload();
     if ($lang === 'all' && is_admin()) {
         return 'all';
     }
     if (!isset($this->hidden_lang_codes[$lang]) && !isset($this->active_language_codes[$lang])) {
         $lang = $this->default_lang ? $this->default_lang : icl_get_setting('default_language');
     }
     return $lang;
 }
开发者ID:aarongillett,项目名称:B22-151217,代码行数:21,代码来源:wpml-language-resolution.class.php


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