當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。