本文整理匯總了PHP中TranslationProxy::get_translation_projects方法的典型用法代碼示例。如果您正苦於以下問題:PHP TranslationProxy::get_translation_projects方法的具體用法?PHP TranslationProxy::get_translation_projects怎麽用?PHP TranslationProxy::get_translation_projects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TranslationProxy
的用法示例。
在下文中一共展示了TranslationProxy::get_translation_projects方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* @param TranslationProxy_Service $service
* @param string $delivery
*/
public function __construct($service, $delivery = 'xmlrpc')
{
$this->service = $service;
$this->errors = array();
$icl_translation_projects = TranslationProxy::get_translation_projects();
$project_index = self::generate_service_index($service);
if ($project_index && $icl_translation_projects && isset($icl_translation_projects[$project_index])) {
$project = $icl_translation_projects[$project_index];
$this->id = $project['id'];
$this->access_key = $project['access_key'];
$this->ts_id = $project['ts_id'];
$this->ts_access_key = $project['ts_access_key'];
$this->service->delivery_method = $delivery;
}
}
示例2: enqueue_migration_in_tp
public function enqueue_migration_in_tp()
{
global $sitepress;
remove_filter('otgs_translation_get_services', 'filter_tp_services');
$site_id = $sitepress->get_setting('site_id');
$access_key = $sitepress->get_setting('access_key');
$delivery = wpml_get_setting_filter(false, 'translation_pickup_method');
$delivery = $delivery === 'polling' ? 'polling' : 'xmlrpc';
$service = TranslationProxy_Service::get_service($this->get_icl_service_id());
$params = array('project' => array('ts_accesskey' => $access_key, 'external_id' => $site_id, 'delivery_method' => $delivery, 'url' => get_option('siteurl'), 'name' => get_option('blogname'), 'description' => get_option('blogdescription'), 'suid' => isset($service->suid) ? $service->suid : ""));
$project = false;
$error_data = false;
try {
$response = TranslationProxy_Api::proxy_request('/projects/migrate.json', $params, 'POST');
if (isset($response->project)) {
$project = (array) $response->project;
$project_index = $this->icl_project_hash_key();
$projects = TranslationProxy::get_translation_projects();
$projects[$project_index] = $project;
icl_set_setting('icl_translation_projects', $projects, true);
icl_set_setting('translation_service', TranslationProxy_Service::get_service($this->get_icl_service_id()), true);
}
} catch (Exception $e) {
$error_data = $params;
}
if (!$error_data) {
$this->move_finished_jobs_to_batch();
if (defined('ICL_DEBUG_MODE') && ICL_DEBUG_MODE) {
$this->regenerate_wrong_service_data();
}
}
return array($project, $error_data);
}