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


PHP icl_get_string_translations_by_id函数代码示例

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


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

示例1: test_add_default_slug_translations

 function test_add_default_slug_translations()
 {
     $category_base = !empty($this->wc_permalinks['category_base']) ? $this->wc_permalinks['category_base'] : $this->url_translation->default_product_category_base;
     $name = $this->url_translation->url_string_name('product_cat');
     $this->url_translation->add_default_slug_translations($category_base, $name);
     $string_id = icl_get_string_id($category_base, $this->url_translation->url_strings_context(), $name);
     $translations = icl_get_string_translations_by_id($string_id);
     $this->assertEquals('categorie-produit', $translations['fr']['value']);
 }
开发者ID:helgatheviking,项目名称:woocommerce-multilingual,代码行数:9,代码来源:test-slugs.php

示例2: add_endpoints

 function add_endpoints()
 {
     if (!isset($this->endpoints_strings)) {
         return;
     }
     global $wpdb;
     //add endpoints and flush rules
     foreach ($this->endpoints_strings as $string_id) {
         $string_translations = icl_get_string_translations_by_id($string_id);
         foreach ($string_translations as $string) {
             add_rewrite_endpoint($string['value'], EP_ROOT | EP_PAGES);
         }
     }
 }
开发者ID:Alexg10,项目名称:Egzobeatbox,代码行数:14,代码来源:endpoints.class.php

示例3: get_filtered_comments

 function get_filtered_comments($comments)
 {
     $user_id = get_current_user_id();
     if ($user_id) {
         global $wpdb, $woocommerce_wpml;
         $user_language = get_user_meta($user_id, 'icl_admin_language', true);
         foreach ($comments as $key => $comment) {
             $comment_string_id = icl_get_string_id($comment->comment_content, 'woocommerce');
             if ($comment_string_id) {
                 $comment_strings = icl_get_string_translations_by_id($comment_string_id);
                 if ($comment_strings) {
                     $comments[$key]->comment_content = $comment_strings[$user_language]['value'];
                 }
             }
         }
     }
     return $comments;
 }
开发者ID:heaptrace,项目名称:onlineshop,代码行数:18,代码来源:orders.class.php

示例4: icl_get_string_by_id

/**
 * Returns indexed array with language code and value of string
 *
 * @param int         $string_id     ID of string in icl_strings DB table
 * @param bool|string $language_code false, or language code
 *
 * @return string
 */
function icl_get_string_by_id($string_id, $language_code = false)
{
    global $wpdb, $sitepress_settings;
    if (!$language_code) {
        $language_code = $sitepress_settings['st']['strings_language'];
    }
    if ($language_code == $sitepress_settings['st']['strings_language']) {
        $result_prepared = $wpdb->prepare("SELECT language, value FROM {$wpdb->prefix}icl_strings WHERE id=%d", $string_id);
        $result = $wpdb->get_row($result_prepared);
        if ($result) {
            return $result->value;
        }
    } else {
        $translations = icl_get_string_translations_by_id($string_id);
        if (isset($translations[$language_code])) {
            return $translations[$language_code]['value'];
        }
    }
    return false;
}
开发者ID:edgarter,项目名称:wecare,代码行数:28,代码来源:functions.php

示例5: get_translated_strings

 function get_translated_strings($strings)
 {
     $package_id = $this->get_package_id();
     if ($package_id) {
         $results = $this->get_package_strings();
         foreach ($results as $result) {
             $translations = icl_get_string_translations_by_id($result->id);
             if (!empty($translations)) {
                 $string_name = $this->get_package_string_name_from_st_name($result);
                 $strings[$string_name] = $translations;
             }
         }
     }
     return $strings;
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:15,代码来源:wpml-package.class.php

示例6: get_translations

 static function get_translations($slug)
 {
     global $sitepress, $sitepress_settings, $wpdb;
     $default_language = $sitepress->get_default_language();
     if ($default_language != $sitepress_settings['st']['strings_language']) {
         $string_id_prepared = $wpdb->prepare("SELECT s.id FROM {$wpdb->prefix}icl_strings s\r\n\t\t\t\t\t\t\t\t\t\t\t\t   JOIN {$wpdb->prefix}icl_string_translations st\r\n\t\t\t\t\t\t\t\t\t\t\t\t   ON st.string_id = s.id\r\n\t\t\t\t\t\t\t\t\t\t\t\t   WHERE st.language=%s AND name = %s ", $default_language, 'URL slug: ' . $slug);
     } else {
         $string_id_prepared = self::get_sql_to_get_string_id($slug);
     }
     $string_id = $wpdb->get_var($string_id_prepared);
     $slug_translations = icl_get_string_translations_by_id($string_id);
     return array($string_id, $slug_translations);
 }
开发者ID:fdelarosa191,项目名称:iftheme-docs,代码行数:13,代码来源:slug-translation.php

示例7: admin_email

 function admin_email($order_id)
 {
     global $woocommerce, $sitepress;
     if (class_exists('WC_Email_New_Order')) {
         $recipients = explode(',', $woocommerce->mailer()->emails['WC_Email_New_Order']->get_recipient());
         foreach ($recipients as $recipient) {
             $user = get_user_by('email', $recipient);
             if ($user) {
                 $user_lang = $sitepress->get_user_admin_language($user->ID);
             } else {
                 $user_lang = get_post_meta($order_id, 'wpml_language', TRUE);
             }
             icl_get_string_translations_by_id(1);
             $this->change_email_language($user_lang);
             $woocommerce->mailer()->emails['WC_Email_New_Order']->heading = $this->wcml_get_translated_email_string('admin_texts_woocommerce_new_order_settings', '[woocommerce_new_order_settings]heading');
             $woocommerce->mailer()->emails['WC_Email_New_Order']->subject = $this->wcml_get_translated_email_string('admin_texts_woocommerce_new_order_settings', '[woocommerce_new_order_settings]subject');
             $woocommerce->mailer()->emails['WC_Email_New_Order']->recipient = $recipient;
             $woocommerce->mailer()->emails['WC_Email_New_Order']->trigger($order_id);
         }
         $woocommerce->mailer()->emails['WC_Email_New_Order']->enabled = false;
         $this->refresh_email_lang($order_id);
     }
 }
开发者ID:helgatheviking,项目名称:woocommerce-multilingual,代码行数:23,代码来源:emails.class.php

示例8: translate_attribute_taxonomies_labels

 function translate_attribute_taxonomies_labels($attribute_taxonomies)
 {
     global $sitepress;
     if (is_admin() && !wpml_is_ajax()) {
         foreach ($attribute_taxonomies as $key => $attribute_taxonomy) {
             $string_language = $this->get_string_language($attribute_taxonomy->attribute_name, 'WordPress', 'taxonomy singular name: ' . $attribute_taxonomy->attribute_name);
             if ($sitepress->get_current_language() == $string_language) {
                 continue;
             }
             $string_id = icl_get_string_id($attribute_taxonomy->attribute_name, 'WordPress', 'taxonomy singular name: ' . $attribute_taxonomy->attribute_name);
             $strings = icl_get_string_translations_by_id($string_id);
             if ($strings && isset($strings[$sitepress->get_current_language()])) {
                 $attribute_taxonomies[$key]->attribute_label = $strings[$sitepress->get_current_language()]['value'];
             }
         }
     }
     return $attribute_taxonomies;
 }
开发者ID:Alexg10,项目名称:Egzobeatbox,代码行数:18,代码来源:wc-strings.class.php

示例9: isset

            $_has_slug = isset($custom_post->rewrite['slug']) && $custom_post->rewrite['slug'];
            $_on = $sitepress_settings['posts_slug_translation']['on'] && $_has_slug && isset($sitepress_settings['custom_posts_sync_option'][$k]) && $sitepress_settings['custom_posts_sync_option'][$k] == 1;
            $is_hidden = $_on ? '' : 'hidden';
            $_translate = !empty($sitepress_settings['posts_slug_translation']['types'][$k]);
            if ($_has_slug) {
                if ($default_language != $sitepress_settings['st']['strings_language']) {
                    $string_id_prepared = $wpdb->prepare("\r\n                                                        SELECT s.id FROM {$wpdb->prefix}icl_strings s\r\n                                                            JOIN {$wpdb->prefix}icl_string_translations st\r\n                                                            ON st.string_id = s.id\r\n                                                            WHERE st.language=%s AND s.value=%s AND s.name LIKE %s\r\n                                                    ", array($default_language, $custom_post->rewrite['slug'], 'URL slug: %'));
                } else {
                    $string_id_prepared = $wpdb->prepare("SELECT id FROM {$wpdb->prefix}icl_strings WHERE name = %s AND value = %s ", array('Url slug: ' . $custom_post->rewrite['slug'], $custom_post->rewrite['slug']));
                }
                $string_id = $wpdb->get_var($string_id_prepared);
                if ($_translate && !$string_id) {
                    $message = sprintf(__("%s slugs are set to be translated, but they are missing their translation", 'sitepress'), $custom_post->labels->name);
                    ICL_AdminNotifier::displayInstantMessage($message, 'error', 'below-h2', false);
                }
                $_slug_translations = icl_get_string_translations_by_id($string_id);
            } else {
                $_slug_translations = false;
            }
            ?>
                                        <?php 
            if ($_has_slug && isset($sitepress_settings['posts_slug_translation']['on']) && $sitepress_settings['posts_slug_translation']['on']) {
                ?>
                                            <div class="icl_slug_translation_choice <?php 
                echo $is_hidden;
                ?>
">
                                                <p>
                                                    <label>
                                                        <input name="translate_slugs[<?php 
                echo $k;
开发者ID:santikrass,项目名称:apache,代码行数:31,代码来源:_custom_types_translation.php

示例10: get_translations

 static function get_translations($slug)
 {
     global $wpdb;
     $string_id_prepared = self::get_sql_to_get_string_id($slug);
     $string_id = $wpdb->get_var($string_id_prepared);
     $slug_translations = icl_get_string_translations_by_id($string_id);
     return array($string_id, $slug_translations);
 }
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:8,代码来源:slug-translation.php

示例11: get_translated_strings

 function get_translated_strings($strings, $context)
 {
     $package_id = $this->_get_package_id($context);
     if ($package_id) {
         global $wpdb;
         // Get strings already in the database
         $results_query = "SELECT id, name, value FROM {$wpdb->prefix}icl_strings WHERE string_package_id=%d";
         $results_prepare = $wpdb->prepare($results_query, $package_id);
         $results = $wpdb->get_results($results_prepare);
         foreach ($results as $result) {
             $translations = icl_get_string_translations_by_id($result->id);
             if (!empty($translations)) {
                 $string_name = substr($result->name, strlen($package_id) + 1);
                 $strings[$string_name] = $translations;
             }
         }
     }
     return $strings;
 }
开发者ID:StudioCreate,项目名称:Uncle-Hummer-WordPress-Theme,代码行数:19,代码来源:wpml_package_translation.class.php


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