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


PHP ICanLocalizeQuery::report_back_permalink方法代码示例

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


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

示例1: ICanLocalizeQuery

 function add_translated_document($translation_id, $request_id)
 {
     global $sitepress_settings, $wpdb, $sitepress;
     $iclq = new ICanLocalizeQuery($sitepress_settings['site_id'], $sitepress_settings['access_key']);
     $tinfo = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}icl_translations WHERE translation_id=%d", $translation_id));
     $_lang = $sitepress->get_language_details($tinfo->language_code);
     $translation = $iclq->cms_do_download($request_id, $this->server_languages_map($_lang['english_name']));
     $translation = apply_filters('icl_data_from_pro_translation', $translation);
     //if(icl_is_string_translation($translation)){
     //    $language_code = $wpdb->get_var($wpdb->prepare("
     //        SELECT target FROM {$wpdb->prefix}icl_core_status
     //        WHERE rid=%d", $request_id
     //    ));
     //    $ret = icl_translation_add_string_translation($request_id, $translation, $language_code);
     //}else{
     $language_code = $wpdb->get_var($wpdb->prepare("\n                SELECT language_code FROM {$wpdb->prefix}icl_translations WHERE translation_id=%d", $translation_id));
     $ret = $this->save_post_translation($translation_id, $translation);
     //}
     if ($ret) {
         $lang_details = $sitepress->get_language_details($language_code);
         $language_server = $this->server_languages_map($lang_details['english_name']);
         $iclq->cms_update_request_status($request_id, CMS_TARGET_LANGUAGE_DONE, $language_server);
         $translations = $sitepress->get_element_translations($tinfo->trid, $tinfo->element_type);
         $iclq->report_back_permalink($request_id, $language_server, $translations[$tinfo->language_code]);
     }
     return $ret;
 }
开发者ID:bidhanbaral,项目名称:fotodep_store,代码行数:27,代码来源:pro-translation.class.php

示例2: ICanLocalizeQuery

 function add_translated_document($translation_id, $request_id)
 {
     global $sitepress_settings, $wpdb, $sitepress;
     $iclq = new ICanLocalizeQuery($sitepress_settings['site_id'], $sitepress_settings['access_key']);
     $tinfo = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}icl_translations WHERE translation_id=%d", $translation_id));
     $_lang = $sitepress->get_language_details($tinfo->language_code);
     $translation = $iclq->cms_do_download($request_id, $this->server_languages_map($_lang['english_name']));
     $translation = apply_filters('icl_data_from_pro_translation', $translation);
     $ret = false;
     if (!empty($translation)) {
         $language_code = $wpdb->get_var($wpdb->prepare("\n                SELECT language_code FROM {$wpdb->prefix}icl_translations WHERE translation_id=%d", $translation_id));
         $parts = explode('_', $translation['original_id']);
         if ($parts[0] == 'external') {
             // Translations are saved in the string table for 'external' types
             $id = array_pop($parts);
             unset($parts[0]);
             $type = implode('_', $parts);
             unset($translation['original_id']);
             foreach ($translation as $field => $value) {
                 if (function_exists('icl_st_is_registered_string')) {
                     $value = str_replace('&#0A;', "\n", $value);
                     $string_id = icl_st_is_registered_string($type, $id . '_' . $field);
                     if (!$string_id) {
                         icl_register_string($type, $id . '_' . $field, $value);
                         $string_id = icl_st_is_registered_string($type, $id . '_' . $field);
                     }
                     if ($string_id) {
                         icl_add_string_translation($string_id, $language_code, $value, ICL_STRING_TRANSLATION_COMPLETE);
                     }
                 }
             }
             $ret = true;
         } else {
             $ret = $this->save_post_translation($translation_id, $translation);
         }
         if ($ret) {
             $lang_details = $sitepress->get_language_details($language_code);
             $language_server = $this->server_languages_map($lang_details['english_name']);
             $iclq->cms_update_request_status($request_id, CMS_TARGET_LANGUAGE_DONE, $language_server);
             $translations = $sitepress->get_element_translations($tinfo->trid, $tinfo->element_type);
             if (isset($translations[$tinfo->language_code])) {
                 $iclq->report_back_permalink($request_id, $language_server, $translations[$tinfo->language_code]);
             }
         }
     }
     return $ret;
 }
开发者ID:envickery,项目名称:staging.xylemwatermark.org,代码行数:47,代码来源:pro-translation.class.php


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