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


PHP icl_get_string_translations函数代码示例

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


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

示例1: icl_st_init


//.........这里部分代码省略.........
                }
                if (!trim($lines[$k])) {
                    $fuzzy = 0;
                }
            }
            if (empty($icl_st_po_strings)) {
                $icl_st_err_str = __('No string found', 'wpml-string-translation');
            }
        }
    } elseif (isset($_POST['action']) && 'icl_st_save_strings' == $_POST['action']) {
        $arr = array_intersect_key($_POST['icl_strings'], array_flip($_POST['icl_strings_selected']));
        //$arr = array_map('html_entity_decode', $arr);
        if (isset($_POST['icl_st_po_language'])) {
            $arr_t = array_intersect_key($_POST['icl_translations'], array_flip($_POST['icl_strings_selected']));
            $arr_f = array_intersect_key($_POST['icl_fuzzy'], array_flip($_POST['icl_strings_selected']));
            //$arr_t = array_map('html_entity_decode', $arr_t);
        }
        foreach ($arr as $k => $string) {
            $name = isset($_POST['icl_name'][$k]) && $_POST['icl_name'][$k] ? $_POST['icl_name'][$k] : md5($string);
            $string_id = icl_register_string($_POST['icl_st_domain_name'], $name, $string);
            if ($string_id && isset($_POST['icl_st_po_language'])) {
                if ($arr_t[$k] != "") {
                    if ($arr_f[$k]) {
                        $_status = ICL_TM_NOT_TRANSLATED;
                    } else {
                        $_status = ICL_TM_COMPLETE;
                    }
                    icl_add_string_translation($string_id, $_POST['icl_st_po_language'], $arr_t[$k], $_status);
                    icl_update_string_status($string_id);
                }
            }
        }
    }
    //handle po export
    if (isset($_POST['icl_st_pie_e']) && wp_verify_nonce($_POST['_wpnonce'], 'icl_po_export')) {
        //force some filters
        if (isset($_GET['status'])) {
            unset($_GET['status']);
        }
        $_GET['show_results'] = 'all';
        if ($_POST['icl_st_e_context']) {
            $_GET['context'] = $_POST['icl_st_e_context'];
        }
        $_GET['translation_language'] = $_POST['icl_st_e_language'];
        $strings = icl_get_string_translations();
        if (!empty($strings)) {
            $po = icl_st_generate_po_file($strings, !isset($_POST['icl_st_pe_translations']));
        } else {
            $po = "";
        }
        if (!isset($_POST['icl_st_pe_translations'])) {
            $popot = 'pot';
            $poname = $_POST['icl_st_e_context'] ? urlencode($_POST['icl_st_e_context']) : 'all_context';
        } else {
            $popot = 'po';
            $poname = $_GET['context'] . '-' . $_GET['translation_language'];
        }
        header("Content-Type: application/force-download");
        header("Content-Type: application/octet-stream");
        header("Content-Type: application/download");
        header("Content-Disposition: attachment; filename=" . $poname . '.' . $popot . ";");
        header("Content-Length: " . strlen($po));
        echo $po;
        exit(0);
    } elseif (isset($_POST['icl_st_action']) && $_POST['icl_st_action'] == 'send_strings') {
        add_action('init', 'icl_send_strings_action');
    }
    // hook into blog title and tag line
    add_filter('option_blogname', 'icl_sw_filters_blogname');
    add_filter('option_blogdescription', 'icl_sw_filters_blogdescription');
    add_filter('widget_title', 'icl_sw_filters_widget_title', 0);
    //highest priority
    add_filter('widget_text', 'icl_sw_filters_widget_text', 0);
    //highest priority
    $setup_complete = apply_filters('WPML_get_setting', false, 'setup_complete');
    $theme_localization_type = apply_filters('WPML_get_setting', false, 'theme_localization_type');
    if ($setup_complete && $theme_localization_type == 1) {
        add_filter('gettext', 'icl_sw_filters_gettext', 9, 3);
        add_filter('gettext_with_context', 'icl_sw_filters_gettext_with_context', 1, 4);
        add_filter('ngettext', 'icl_sw_filters_ngettext', 9, 5);
        add_filter('ngettext_with_context', 'icl_sw_filters_nxgettext', 9, 6);
    }
    $widget_groups = $wpdb->get_results("SELECT option_name, option_value FROM {$wpdb->options} WHERE option_name LIKE 'widget\\_%'");
    foreach ($widget_groups as $w) {
        add_action('update_option_' . $w->option_name, 'icl_st_update_widget_title_actions', 5, 2);
    }
    add_action('update_option_widget_text', 'icl_st_update_text_widgets_actions', 5, 2);
    add_action('update_option_sidebars_widgets', '__icl_st_init_register_widget_titles');
    if ($icl_st_err_str) {
        add_action('admin_notices', 'icl_st_admin_notices');
    }
    if (isset($_REQUEST['string-translated']) && $_REQUEST['string-translated'] == true) {
        add_action('admin_notices', 'icl_st_admin_notices_string_updated');
    }
    add_filter('get_the_author_first_name', 'icl_st_author_first_name_filter', 10, 2);
    add_filter('get_the_author_last_name', 'icl_st_author_last_name_filter', 10, 2);
    add_filter('get_the_author_nickname', 'icl_st_author_nickname_filter', 10, 2);
    add_filter('get_the_author_description', 'icl_st_author_description_filter', 10, 2);
    add_filter('the_author', 'icl_st_author_displayname_filter', 10);
}
开发者ID:edgarter,项目名称:wecare,代码行数:101,代码来源:functions.php

示例2: icl_st_init


//.........这里部分代码省略.........
        // case of adding translation
        $res = $wpdb->get_results("                                                                                              \n            SELECT value, name \n            FROM {$wpdb->prefix}icl_strings \n            WHERE context = '" . $wpdb->escape($_POST['icl_st_domain_name']) . "' AND value IN ('" . join("','", array_map('mysql_real_escape_string', $arr)) . "')  \n        ");
        if (!empty($res)) {
            foreach ($res as $r) {
                $map[$r->value] = $r->name;
            }
        }
        foreach ($arr as $k => $string) {
            if (isset($map[$string])) {
                $name = $map[$string];
            } else {
                $name = md5($string);
            }
            $string_id = icl_register_string($_POST['icl_st_domain_name'], $name, $string);
            if ($string_id && isset($_POST['icl_st_po_language'])) {
                if ($arr_t[$k] != "") {
                    if ($arr_f[$k]) {
                        $_status = ICL_STRING_TRANSLATION_NOT_TRANSLATED;
                    } else {
                        $_status = ICL_STRING_TRANSLATION_COMPLETE;
                    }
                    icl_add_string_translation($string_id, $_POST['icl_st_po_language'], $arr_t[$k], $_status);
                    icl_update_string_status($string_id);
                }
            }
        }
    }
    //handle po export
    if (isset($_POST['icl_st_pie_e']) && wp_verify_nonce($_POST['_wpnonce'], 'icl_po_export')) {
        //force some filters
        if (isset($_GET['status'])) {
            unset($_GET['status']);
        }
        $_GET['show_results'] = 'all';
        if ($_POST['icl_st_e_context']) {
            $_GET['context'] = $_POST['icl_st_e_context'];
        }
        $_GET['translation_language'] = $_POST['icl_st_e_language'];
        $strings = icl_get_string_translations();
        if (!empty($strings)) {
            $po = icl_st_generate_po_file($strings, !isset($_POST['icl_st_pe_translations']));
        } else {
            $po = "";
        }
        if (!isset($_POST['icl_st_pe_translations'])) {
            $popot = 'pot';
            $poname = $_POST['icl_st_e_context'] ? urlencode($_POST['icl_st_e_context']) : 'all_context';
        } else {
            $popot = 'po';
            $poname = $_GET['translation_language'];
        }
        header("Content-Type: application/force-download");
        header("Content-Type: application/octet-stream");
        header("Content-Type: application/download");
        header("Content-Disposition: attachment; filename=" . $poname . '.' . $popot . ";");
        header("Content-Length: " . strlen($po));
        echo $po;
        exit(0);
    } elseif (isset($_POST['icl_st_action']) && $_POST['icl_st_action'] == 'send_strings') {
        if ($_POST['iclnonce'] == wp_create_nonce('icl-string-translation')) {
            $_POST = stripslashes_deep($_POST);
            $services = $_POST['service'];
            $string_ids = explode(',', $_POST['strings']);
            $translate_to = array();
            foreach ($_POST['translate_to'] as $lang_to => $one) {
                if (isset($services[$lang_to])) {
                    $translate_to[$lang_to] = $services[$lang_to];
                }
            }
            if (!empty($translate_to)) {
                icl_translation_send_strings($string_ids, $translate_to);
            }
        }
    }
    // hook into blog title and tag line
    add_filter('option_blogname', 'icl_sw_filters_blogname');
    add_filter('option_blogdescription', 'icl_sw_filters_blogdescription');
    add_filter('widget_title', 'icl_sw_filters_widget_title');
    add_filter('widget_text', 'icl_sw_filters_widget_text');
    if (isset($sitepress_settings['theme_localization_type']) && $sitepress_settings['theme_localization_type'] == 1) {
        add_filter('gettext', 'icl_sw_filters_gettext', 9, 3);
        add_filter('gettext_with_context', 'icl_sw_filters_gettext_with_context', 9, 4);
        add_filter('ngettext', 'icl_sw_filters_ngettext', 9, 5);
        add_filter('ngettext_with_context', 'icl_sw_filters_nxgettext', 9, 6);
    }
    $widget_groups = $wpdb->get_results("SELECT option_name, option_value FROM {$wpdb->options} WHERE option_name LIKE 'widget\\_%'");
    foreach ($widget_groups as $w) {
        add_action('update_option_' . $w->option_name, 'icl_st_update_widget_title_actions', 5, 2);
    }
    add_action('update_option_widget_text', 'icl_st_update_text_widgets_actions', 5, 2);
    add_action('update_option_sidebars_widgets', '__icl_st_init_register_widget_titles');
    if ($icl_st_err_str) {
        add_action('admin_notices', 'icl_st_admin_notices');
    }
    add_filter('get_the_author_first_name', 'icl_st_author_first_name_filter', 10, 2);
    add_filter('get_the_author_last_name', 'icl_st_author_last_name_filter', 10, 2);
    add_filter('get_the_author_nickname', 'icl_st_author_nickname_filter', 10, 2);
    add_filter('get_the_author_description', 'icl_st_author_description_filter', 10, 2);
    add_filter('the_author', 'icl_st_author_displayname_filter', 10);
}
开发者ID:envickery,项目名称:staging.xylemwatermark.org,代码行数:101,代码来源:functions.php

示例3: elseif

} elseif (filter_input(INPUT_GET, 'download_mo')) {
    include dirname(__FILE__) . '/auto-download-mo.php';
    return;
}
$status_filter_text = filter_input(INPUT_GET, 'status');
if (preg_match("#" . ICL_STRING_TRANSLATION_WAITING_FOR_TRANSLATOR . "-(.+)#", $status_filter_text, $matches)) {
    $status_filter = ICL_STRING_TRANSLATION_WAITING_FOR_TRANSLATOR;
    $status_filter_lang = $matches[1];
} else {
    $status_filter = filter_input(INPUT_GET, 'status', FILTER_SANITIZE_NUMBER_INT);
}
$status_filter = $status_filter !== null ? (int) $status_filter : null;
$context_filter = filter_input(INPUT_GET, 'context');
$search_filter = filter_input(INPUT_GET, 'search', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$exact_match = filter_input(INPUT_GET, 'em', FILTER_VALIDATE_BOOLEAN);
$icl_string_translations = icl_get_string_translations();
if (!empty($icl_string_translations)) {
    $icl_strings_in_page = icl_get_strings_tracked_in_pages($icl_string_translations);
}
$active_languages = $sitepress->get_active_languages();
$icl_contexts = icl_st_get_contexts($status_filter);
$icl_st_translation_enabled = $sitepress->icl_account_configured() && $sitepress->get_icl_translation_enabled();
$available_contexts = array();
if (!empty($icl_contexts)) {
    foreach ($icl_contexts as $c) {
        if ($c) {
            $available_contexts[] = $c->context;
        }
    }
}
if (!empty($sitepress_settings['st']['theme_localization_domains']) && is_array($sitepress_settings['st']['theme_localization_domains'])) {
开发者ID:ngocthangict,项目名称:edo,代码行数:31,代码来源:string-translation.php

示例4: icl_st_init


//.........这里部分代码省略.........
        } else {
            global $po_importer;
            require_once WPML_ST_PATH . '/inc/gettext/wpml-po-import.class.php';
            $po_importer = new WPML_PO_Import($_FILES['icl_po_file']['tmp_name']);
            $icl_st_err_str = $po_importer->get_errors();
        }
    } elseif (isset($_POST['action']) && 'icl_st_save_strings' == $_POST['action']) {
        $arr = array_intersect_key($_POST['icl_strings'], array_flip($_POST['icl_strings_selected']));
        //$arr = array_map('html_entity_decode', $arr);
        if (isset($_POST['icl_st_po_language'])) {
            $arr_t = array_intersect_key($_POST['icl_translations'], array_flip($_POST['icl_strings_selected']));
            $arr_f = array_intersect_key($_POST['icl_fuzzy'], array_flip($_POST['icl_strings_selected']));
            //$arr_t = array_map('html_entity_decode', $arr_t);
        }
        $arr_c = array_intersect_key($_POST['icl_context'], array_flip($_POST['icl_strings_selected']));
        foreach ($arr as $k => $string) {
            $string = str_replace('\\n', "\n", $string);
            $name = isset($_POST['icl_name'][$k]) && $_POST['icl_name'][$k] ? $_POST['icl_name'][$k] : md5($string);
            $string_id = icl_register_string(array('domain' => $_POST['icl_st_domain_name'], 'context' => $arr_c[$k]), $name, $string);
            if ($string_id && isset($_POST['icl_st_po_language'])) {
                if ($arr_t[$k] != "") {
                    if ($arr_f[$k]) {
                        $_status = ICL_TM_NOT_TRANSLATED;
                    } else {
                        $_status = ICL_TM_COMPLETE;
                    }
                    $translation = str_replace('\\n', "\n", $arr_t[$k]);
                    icl_add_string_translation($string_id, $_POST['icl_st_po_language'], $translation, $_status);
                    icl_update_string_status($string_id);
                }
            }
        }
    }
    //handle po export
    if (isset($_POST['icl_st_pie_e']) && wp_verify_nonce($_POST['_wpnonce'], 'icl_po_export')) {
        //force some filters
        if (isset($_GET['status'])) {
            unset($_GET['status']);
        }
        $_GET['show_results'] = 'all';
        if ($_POST['icl_st_e_context']) {
            $_GET['context'] = $_POST['icl_st_e_context'];
        }
        $_GET['translation_language'] = $_POST['icl_st_e_language'];
        $strings = icl_get_string_translations();
        if (!empty($strings)) {
            $po = icl_st_generate_po_file($strings, !isset($_POST['icl_st_pe_translations']));
        } else {
            $po = "";
        }
        if (!isset($_POST['icl_st_pe_translations'])) {
            $popot = 'pot';
            $poname = $_POST['icl_st_e_context'] ? urlencode($_POST['icl_st_e_context']) : 'all_context';
        } else {
            $popot = 'po';
            $poname = $_GET['context'] . '-' . $_GET['translation_language'];
        }
        header("Content-Type: application/force-download");
        header("Content-Type: application/octet-stream");
        header("Content-Type: application/download");
        header("Content-Disposition: attachment; filename=" . $poname . '.' . $popot . ";");
        header("Content-Length: " . strlen($po));
        echo $po;
        exit(0);
    } elseif (isset($_POST['icl_st_action']) && $_POST['icl_st_action'] == 'send_strings') {
        add_action('init', 'icl_send_strings_action');
    }
    // hook into blog title and tag line
    add_filter('option_blogname', 'icl_sw_filters_blogname');
    add_filter('option_blogdescription', 'icl_sw_filters_blogdescription');
    add_filter('widget_title', 'icl_sw_filters_widget_title', 0);
    //highest priority
    add_filter('widget_text', 'icl_sw_filters_widget_text', 0);
    //highest priority
    $setup_complete = apply_filters('WPML_get_setting', false, 'setup_complete');
    $theme_localization_type = apply_filters('WPML_get_setting', false, 'theme_localization_type');
    if ($setup_complete && $theme_localization_type == 1) {
        add_filter('gettext', 'icl_sw_filters_gettext', 9, 3);
        add_filter('gettext_with_context', 'icl_sw_filters_gettext_with_context', 1, 4);
        add_filter('ngettext', 'icl_sw_filters_ngettext', 9, 5);
        add_filter('ngettext_with_context', 'icl_sw_filters_nxgettext', 9, 6);
    }
    $widget_groups = $wpdb->get_results("SELECT option_name, option_value FROM {$wpdb->options} WHERE option_name LIKE 'widget\\_%'");
    foreach ($widget_groups as $w) {
        add_action('update_option_' . $w->option_name, 'icl_st_update_widget_title_actions', 5, 2);
    }
    add_action('update_option_widget_text', 'icl_st_update_text_widgets_actions', 5, 2);
    add_action('update_option_sidebars_widgets', '__icl_st_init_register_widget_titles');
    if ($icl_st_err_str) {
        add_action('admin_notices', 'icl_st_admin_notices');
    }
    if (isset($_REQUEST['string-translated']) && $_REQUEST['string-translated'] == true) {
        add_action('admin_notices', 'icl_st_admin_notices_string_updated');
    }
    add_filter('get_the_author_first_name', 'icl_st_author_first_name_filter', 10, 2);
    add_filter('get_the_author_last_name', 'icl_st_author_last_name_filter', 10, 2);
    add_filter('get_the_author_nickname', 'icl_st_author_nickname_filter', 10, 2);
    add_filter('get_the_author_description', 'icl_st_author_description_filter', 10, 2);
    add_filter('the_author', 'icl_st_author_displayname_filter', 10);
}
开发者ID:crazyyy,项目名称:octagram,代码行数:101,代码来源:functions.php


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