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


PHP icl_st_is_translator函数代码示例

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


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

示例1: get_currentuserinfo

                            <?php 
                if (isset($icl_string['translations'][$lang['code']]) && $icl_string['translations'][$lang['code']]['status'] == ICL_STRING_TRANSLATION_COMPLETE) {
                    $tr_complete_checked = 'checked="checked"';
                } else {
                    if (icl_st_is_translator()) {
                        global $current_user;
                        get_currentuserinfo();
                        $user_lang_pairs = get_user_meta(get_current_user_id(), $wpdb->prefix . 'language_pairs', true);
                        if (empty($user_lang_pairs[$sitepress_settings['st']['strings_language']][$lang['code']])) {
                            continue;
                        }
                    }
                    $tr_complete_checked = '';
                }
                if (icl_st_is_translator()) {
                    $icl_pro_status = $wpdb->get_var($wpdb->prepare("\n                                            SELECT c.status FROM {$wpdb->prefix}icl_core_status c\n                                                JOIN {$wpdb->prefix}icl_string_status s ON s.rid = c.rid\n                                                WHERE s.string_translation_id = %d AND target=%s AND status = %d\n                                                ORDER BY s.id DESC LIMIT 1\n                                        ", $icl_string['string_id'], $lang['code'], CMS_TARGET_LANGUAGE_ASSIGNED));
                    if (isset($icl_string['translations'][$lang['code']]) && ($icl_string['translations'][$lang['code']]['translator_id'] == get_current_user_id() || is_null($icl_string['translations'][$lang['code']]['translator_id']) && $icl_string['translations'][$lang['code']]['status'] == ICL_STRING_TRANSLATION_WAITING_FOR_TRANSLATOR && !$icl_pro_status)) {
                        $form_disabled = '';
                    } else {
                        $form_disabled = ' disabled="disabled" ';
                    }
                } else {
                    $form_disabled = '';
                }
                ?>

                            <form class="icl_st_form" name="icl_st_form_<?php 
                echo $lang['code'] . '_' . $string_id;
                ?>
" action="">
开发者ID:ngocthangict,项目名称:edo,代码行数:30,代码来源:string-translation.php

示例2: icl_st_get_contexts

function icl_st_get_contexts($status)
{
    global $wpdb, $sitepress, $sitepress_settings;
    $extra_cond = '';
    $joins = '';
    $results = false;
    $current_user = $sitepress->get_current_user();
    if ($status !== false) {
        if ($status == ICL_TM_COMPLETE) {
            $extra_cond .= " AND s.status = " . ICL_TM_COMPLETE;
        } else {
            $extra_cond .= " AND s.status IN (" . ICL_STRING_TRANSLATION_PARTIAL . "," . ICL_TM_NEEDS_UPDATE . "," . ICL_TM_NOT_TRANSLATED . ")";
        }
    }
    if (icl_st_is_translator()) {
        $user_langs = get_user_meta($current_user->ID, $wpdb->prefix . 'language_pairs', true);
        $active_langs = $sitepress->get_active_languages();
        if (!empty($user_langs[$sitepress_settings['st']['strings_language']])) {
            foreach ($user_langs[$sitepress_settings['st']['strings_language']] as $lang => $one) {
                if (isset($active_langs[$lang])) {
                    $lcode_alias = esc_sql(str_replace('-', '', $lang));
                    $joins[] = $wpdb->prepare(" JOIN {$wpdb->prefix}icl_string_translations {$lcode_alias}_str\r\n                                                    ON {$lcode_alias}_str.string_id = s.id AND {$lcode_alias}_str.language= %s\r\n                                                        AND\r\n                    ( \r\n                        {$lcode_alias}_str.status = " . ICL_TM_WAITING_FOR_TRANSLATOR . " OR {$lcode_alias}_str.translator_id = %d ) ", $lcode_alias, $current_user->ID);
                }
            }
            $sql = "\r\n                SELECT s.context, COUNT(s.context) AS c FROM {$wpdb->prefix}icl_strings s\r\n                " . join("\n", $joins) . "\r\n                WHERE 1 {$extra_cond} \r\n                GROUP BY context\r\n                ORDER BY context ASC\r\n            ";
            $results = $wpdb->get_results($sql);
        }
    } else {
        $results = $wpdb->get_results($wpdb->prepare("\r\n            SELECT context, COUNT(context) AS c\r\n            FROM {$wpdb->prefix}icl_strings s\r\n            WHERE language=%s {$extra_cond}\r\n            GROUP BY context \r\n            ORDER BY context ASC", $sitepress_settings['st']['strings_language']));
    }
    return $results;
}
开发者ID:edgarter,项目名称:wecare,代码行数:32,代码来源:functions.php

示例3: ajax_calls

 function ajax_calls($call, $data)
 {
     global $sitepress;
     switch ($call) {
         case 'icl_st_save_translation':
             $icl_st_complete = isset($data['icl_st_translation_complete']) ? $data['icl_st_translation_complete'] : ICL_STRING_TRANSLATION_NOT_TRANSLATED;
             if (get_magic_quotes_gpc()) {
                 $data = stripslashes_deep($data);
             }
             if (icl_st_is_translator()) {
                 $translator_id = get_current_user_id() > 0 ? get_current_user_id() : null;
             } else {
                 $translator_id = null;
             }
             echo icl_add_string_translation($data['icl_st_string_id'], $data['icl_st_language'], stripslashes($data['icl_st_translation']), $icl_st_complete, $translator_id);
             echo '|';
             global $icl_st_string_translation_statuses;
             $ts = icl_update_string_status($data['icl_st_string_id']);
             if (icl_st_is_translator()) {
                 $ts = icl_get_relative_translation_status($data['icl_st_string_id'], $translator_id);
             }
             echo $icl_st_string_translation_statuses[$ts];
             break;
         case 'icl_st_delete_strings':
             $arr = explode(',', $data['value']);
             __icl_unregister_string_multi($arr);
             break;
             /*
             case 'icl_st_send_strings':
             	$arr = explode(',',$data['strings']);
             	icl_translation_send_strings($arr, explode('#',$data['languages']));
             	echo '1';
             	break;
             case 'icl_st_send_strings_all':
             	icl_translation_send_untranslated_strings(explode(',',$data['languages']));
             	echo '1';
             	break;
             */
             // OBSOLETE?
         /*
         case 'icl_st_send_strings':
         	$arr = explode(',',$data['strings']);
         	icl_translation_send_strings($arr, explode('#',$data['languages']));
         	echo '1';
         	break;
         case 'icl_st_send_strings_all':
         	icl_translation_send_untranslated_strings(explode(',',$data['languages']));
         	echo '1';
         	break;
         */
         // OBSOLETE?
         case 'icl_st_option_writes_form':
             if (!empty($data['icl_admin_options'])) {
                 icl_register_admin_options($data['icl_admin_options']);
                 echo '1|';
             } else {
                 echo '0' . __('No strings selected', 'wpml-string-translation');
             }
             break;
             // OBSOLETE?
         // OBSOLETE?
         case 'icl_st_ow_export':
             // filter empty options out
             do {
                 list($data['icl_admin_options'], $empty_found) = _icl_st_filter_empty_options_out($data['icl_admin_options']);
             } while ($empty_found);
             if (!empty($data['icl_admin_options'])) {
                 foreach ($data['icl_admin_options'] as $k => $opt) {
                     if (!$opt) {
                         unset($data['icl_admin_options'][$k]);
                     }
                 }
                 $message = __('Include the following PHP in your code. <em>functions.php</em> would be a good place.', 'wpml-string-translation') . "<textarea wrap=\"soft\">&lt;?php\r\n        if (function_exists('wpml_register_admin_strings')) {\r\n            wpml_register_admin_strings('" . serialize($data['icl_admin_options']) . "');\r\n        }\r\n        ?&gt;</textarea>";
             } else {
                 $error = 1;
                 $message = __('Error: no strings selected', 'wpml-string-translation');
             }
             echo json_encode(array('error' => 0, 'message' => $message));
             break;
     }
 }
开发者ID:Calraiser,项目名称:flux,代码行数:81,代码来源:wpml-string-translation.class.php

示例4: ajax_calls

 function ajax_calls($call, $data)
 {
     require_once WPML_ST_PATH . '/inc/admin-texts/wpml-admin-text-configuration.php';
     switch ($call) {
         case 'icl_st_save_translation':
             $icl_st_complete = isset($data['icl_st_translation_complete']) && $data['icl_st_translation_complete'] ? ICL_TM_COMPLETE : ICL_TM_NOT_TRANSLATED;
             if (get_magic_quotes_gpc()) {
                 $data = stripslashes_deep($data);
             }
             if (icl_st_is_translator()) {
                 $translator_id = get_current_user_id() > 0 ? get_current_user_id() : null;
             } else {
                 $translator_id = null;
             }
             echo icl_add_string_translation($data['icl_st_string_id'], $data['icl_st_language'], stripslashes($data['icl_st_translation']), $icl_st_complete, $translator_id);
             echo '|';
             $ts = icl_update_string_status($data['icl_st_string_id']);
             if (icl_st_is_translator()) {
                 $ts = icl_get_relative_translation_status($data['icl_st_string_id']);
             }
             echo WPML_ST_String_Statuses::get_status($ts);
             break;
         case 'icl_st_delete_strings':
             $arr = explode(',', $data['value']);
             __icl_unregister_string_multi($arr);
             break;
         case 'icl_st_option_writes_form':
             if (!empty($data['icl_admin_options'])) {
                 $wpml_admin_text = wpml_st_load_admin_texts();
                 $wpml_admin_text->icl_register_admin_options($data['icl_admin_options']);
                 echo '1|';
             } else {
                 echo '0' . __('No strings selected', 'wpml-string-translation');
             }
             break;
         case 'icl_st_ow_export':
             // filter empty options out
             do {
                 list($data['icl_admin_options'], $empty_found) = _icl_st_filter_empty_options_out($data['icl_admin_options']);
             } while ($empty_found);
             if (!empty($data['icl_admin_options'])) {
                 foreach ($data['icl_admin_options'] as $k => $opt) {
                     if (!$opt) {
                         unset($data['icl_admin_options'][$k]);
                     }
                 }
                 $wpml_admin_text_config = new WPML_Admin_Text_Configuration();
                 $message = __('Save the following to a wpml-config.xml in the root of your theme or plugin.', 'wpml-string-translation') . "<textarea wrap=\"soft\" spellcheck=\"false\">" . htmlentities($wpml_admin_text_config->get_wpml_config_file($data['icl_admin_options'])) . "</textarea>";
             } else {
                 $message = __('Error: no strings selected', 'wpml-string-translation');
             }
             echo json_encode(array('error' => 0, 'message' => $message));
             break;
     }
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:55,代码来源:wpml-string-translation.class.php

示例5: icl_st_get_contexts

function icl_st_get_contexts($status)
{
    global $wpdb, $sitepress, $sitepress_settings;
    $extra_cond = '';
    if ($status !== false) {
        if ($status == ICL_STRING_TRANSLATION_COMPLETE) {
            $extra_cond .= " AND s.status = " . ICL_STRING_TRANSLATION_COMPLETE;
        } else {
            $extra_cond .= " AND s.status IN (" . ICL_STRING_TRANSLATION_PARTIAL . "," . ICL_STRING_TRANSLATION_NEEDS_UPDATE . "," . ICL_STRING_TRANSLATION_NOT_TRANSLATED . ")";
        }
    }
    if (icl_st_is_translator()) {
        $user_langs = get_user_meta(get_current_user_id(), $wpdb->prefix . 'language_pairs', true);
        $active_langs = $sitepress->get_active_languages();
        if (!empty($user_langs[$sitepress_settings['st']['strings_language']])) {
            foreach ($user_langs[$sitepress_settings['st']['strings_language']] as $lang => $one) {
                if (isset($active_langs[$lang])) {
                    $lcode_alias = str_replace('-', '', $lang);
                    $joins[] = " JOIN {$wpdb->prefix}icl_string_translations {$lcode_alias}_str ON {$lcode_alias}_str.string_id = s.id AND {$lcode_alias}_str.language='{$lcode_alias}'\n";
                }
            }
            $sql = "\n                SELECT s.context, COUNT(s.context) AS c FROM {$wpdb->prefix}icl_strings s\n                " . join("\n", $joins) . "\n                WHERE 1 {$extra_cond} \n                GROUP BY context\n                ORDER BY context ASC\n            ";
            $results = $wpdb->get_results($sql);
        }
    } else {
        $results = $wpdb->get_results("\n            SELECT context, COUNT(context) AS c \n            FROM {$wpdb->prefix}icl_strings s\n            WHERE language='{$sitepress->get_current_language()}' {$extra_cond}\n            GROUP BY context \n            ORDER BY context ASC");
    }
    return $results;
}
开发者ID:envickery,项目名称:staging.xylemwatermark.org,代码行数:29,代码来源:functions.php

示例6: get_translation_form_status

 private function get_translation_form_status($icl_string, $lang)
 {
     global $wpdb;
     $form_disabled = '';
     $form_disabled_reason = '';
     if (icl_st_is_translator()) {
         // Determine if string is being translated via Translation Proxy
         $translation_proxy_status = $wpdb->get_var($wpdb->prepare("\n\t\t\t\t\tSELECT c.status FROM {$wpdb->prefix}icl_core_status c \n\t\t\t\t\t\tJOIN {$wpdb->prefix}icl_string_status s ON s.rid = c.rid\n\t\t\t\t\t\tWHERE s.string_translation_id = (SELECT id FROM {$wpdb->prefix}icl_string_translations WHERE string_id=%d AND language=%s) AND c.target=%s AND c.status = %d\n\t\t\t\t\t\tORDER BY s.id DESC LIMIT 1\n\t\t\t\t", $icl_string['string_id'], $lang['code'], $lang['code'], ICL_TM_WAITING_FOR_TRANSLATOR));
         $can_translate = isset($icl_string['translations'][$lang['code']]);
         if (!$can_translate) {
             $form_disabled_reason = __("You can't translate this string because it hasn't been sent for translation in this language", 'wpml-string-translation');
         }
         $translator_id = $can_translate ? $icl_string['translations'][$lang['code']]['translator_id'] : null;
         if ($can_translate && $translator_id != 0 && $translator_id != get_current_user_id()) {
             $can_translate = false;
             $form_disabled_reason = __("You can't translate this string because it's assigned to another translator", 'wpml-string-translation');
         }
         if ($can_translate && ($translator_id == 0 && $icl_string['translations'][$lang['code']]['status'] == ICL_TM_WAITING_FOR_TRANSLATOR && $translation_proxy_status)) {
             $can_translate = false;
             $form_disabled_reason = __("You can't translate this string because it's assigned to another translator", 'wpml-string-translation');
         }
         if (!$can_translate) {
             $form_disabled = ' disabled="disabled" ';
         }
     }
     return array($form_disabled, $form_disabled_reason);
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:27,代码来源:class-wpml-string-translation-table.php

示例7: get_per_domain_counts

 public function get_per_domain_counts($status)
 {
     $extra_cond = '';
     $joins = '';
     $current_user = $this->sitepress->get_current_user();
     if ($status !== false) {
         if ($status == ICL_TM_COMPLETE) {
             $extra_cond .= " AND s.status = " . ICL_TM_COMPLETE;
         } else {
             $extra_cond .= " AND s.status IN (" . ICL_STRING_TRANSLATION_PARTIAL . "," . ICL_TM_NEEDS_UPDATE . "," . ICL_TM_NOT_TRANSLATED . ")";
         }
     }
     if (icl_st_is_translator()) {
         $user_langs = get_user_meta($current_user->ID, $this->wpdb->prefix . 'language_pairs', true);
         foreach ($user_langs as $source_lang => $lang_pair) {
             $source_lang = esc_sql($source_lang);
             foreach ($lang_pair as $lang => $one) {
                 $lcode_alias = esc_sql(str_replace('-', '', $source_lang . $lang));
                 $joins[] = $this->wpdb->prepare(" JOIN {$this->wpdb->prefix}icl_string_translations {$lcode_alias}_str\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tON {$lcode_alias}_str.string_id = s.id AND {$lcode_alias}_str.language= %s AND s.language = %s\n\t\t\t                                                  AND ( {$lcode_alias}_str.status = " . ICL_TM_WAITING_FOR_TRANSLATOR . " OR {$lcode_alias}_str.translator_id = %d ) ", $lcode_alias, $source_lang, $current_user->ID);
             }
         }
         $sql = "\n                SELECT s.context, COUNT(s.context) AS c FROM {$this->wpdb->prefix}icl_strings s\n                " . join("\n", $joins) . "\n                WHERE 1 {$extra_cond}  AND TRIM(s.value) != ''\n                GROUP BY context\n                ORDER BY context ASC\n            ";
         $results = $this->wpdb->get_results($sql);
     } else {
         $results = $this->wpdb->get_results("\n            SELECT context, COUNT(context) AS c\n            FROM {$this->wpdb->prefix}icl_strings s\n            WHERE 1 {$extra_cond} AND TRIM(s.value) != ''\n            GROUP BY context\n            ORDER BY context ASC");
     }
     return $results;
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:28,代码来源:class-wpml-st-strings.php


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