本文整理汇总了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);
}