當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ICanLocalizeQuery::error方法代碼示例

本文整理匯總了PHP中ICanLocalizeQuery::error方法的典型用法代碼示例。如果您正苦於以下問題:PHP ICanLocalizeQuery::error方法的具體用法?PHP ICanLocalizeQuery::error怎麽用?PHP ICanLocalizeQuery::error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ICanLocalizeQuery的用法示例。


在下文中一共展示了ICanLocalizeQuery::error方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: ICanLocalizeQuery

     $iclq = new ICanLocalizeQuery($sitepress_settings['site_id'], $sitepress_settings['access_key']);
     $p = $wpdb->get_row("SELECT t.* FROM {$wpdb->prefix}icl_translations t JOIN {$wpdb->prefix}icl_translation_status s ON t.translation_id=s.translation_id\n                WHERE t.element_type LIKE 'post\\_%' AND t.source_language_code IS NOT NULL AND s.translation_service='icanlocalize' LIMIT {$_REQUEST['offset']}, 1");
     if (!empty($p)) {
         $original_id = $wpdb->get_var($wpdb->prepare("SELECT element_id FROM {$wpdb->prefix}icl_translations WHERE trid=%d AND source_language_code IS NULL", $p->trid));
         if ($p->element_type == 'post_page') {
             $permalink = get_option('home') . '?page_id=' . $original_id;
         } else {
             $permalink = get_option('home') . '?p=' . $original_id;
         }
         $_lang_details = $sitepress->get_language_details($p->source_language_code);
         $from_language = ICL_Pro_Translation::server_languages_map($_lang_details['english_name']);
         $_lang_details = $sitepress->get_language_details($p->language_code);
         $to_language = ICL_Pro_Translation::server_languages_map($_lang_details['english_name']);
         $cms_id = sprintf('%s_%d_%s_%s', preg_replace('#^post_#', '', $p->element_type), $original_id, $p->source_language_code, $p->language_code);
         $ret = $iclq->update_cms_id(compact('permalink', 'from_language', 'to_language', 'cms_id'));
         if ($ret != $cms_id && $iclq->error()) {
             echo json_encode(array('errors' => 1, 'message' => $iclq->error(), 'cont' => 0));
         } else {
             echo json_encode(array('errors' => 0, 'message' => 'OK', 'cont' => 1));
         }
     } else {
         echo json_encode(array('errors' => 0, 'message' => __('Done', 'sitepress'), 'cont' => 0));
     }
     exit;
     //break;
 //break;
 case 'icl_cleanup':
     global $sitepress, $wpdb, $wp_post_types;
     $post_types = array_keys($wp_post_types);
     foreach ($post_types as $pt) {
         $types[] = 'post_' . $pt;
開發者ID:GaryJones,項目名稱:TPWP,代碼行數:31,代碼來源:troubleshooting.php

示例2: ICanLocalizeQuery

 /**
  * Sends the translation snapshot to ICanLocalize.
  * 
  * @param $array $params The parameters to be added when sending the snapshot
  */
 function send_translation_snapshot_to_icl($params)
 {
     global $sitepress, $sitepress_settings;
     $params['accesskey'] = $sitepress_settings['access_key'];
     $params['website_id'] = $sitepress_settings['site_id'];
     require_once ICL_PLUGIN_PATH . '/lib/Snoopy.class.php';
     require_once ICL_PLUGIN_PATH . '/lib/xml2array.php';
     require_once ICL_PLUGIN_PATH . '/lib/icl_api.php';
     $icl_query = new ICanLocalizeQuery();
     $request = ICL_API_ENDPOINT . "/translation_snapshots/create_by_cms.xml";
     $response = $icl_query->_request($request, 'POST', $params);
     if (!$response) {
         error_log('Translation Analytics: Could not send translation snapshot:\\n' . $icl_query->error());
     }
 }
開發者ID:ascarius,項目名稱:wordpress-bootstrap,代碼行數:20,代碼來源:translation-analytics.class.php


注:本文中的ICanLocalizeQuery::error方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。