本文整理匯總了PHP中TranslationManagement::messages_by_type方法的典型用法代碼示例。如果您正苦於以下問題:PHP TranslationManagement::messages_by_type方法的具體用法?PHP TranslationManagement::messages_by_type怎麽用?PHP TranslationManagement::messages_by_type使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TranslationManagement
的用法示例。
在下文中一共展示了TranslationManagement::messages_by_type方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: send_all_jobs
/**
* Sends all jobs from basket in batch mode to translation proxy
*
* @param string $basket_name
* @param array $batch
* @param array $translators
*
* @return bool false in case of errors (read from TranslationManagement::get_messages('error') to get errors details)
*/
private function send_all_jobs(array $batch, array $translators, $basket_name)
{
$basket_name_saved = $this->basket->get_name();
$basket_name = $basket_name_saved ? $basket_name_saved : $basket_name;
if ($basket_name) {
$this->basket->set_name($basket_name);
}
$valid_jobs = $this->get_valid_jobs_from_basket($batch);
$this->basket->set_remote_target_languages($this->generate_remote_target_langs($translators, $valid_jobs));
$basket_items_types = $this->basket->get_item_types();
foreach ($basket_items_types as $item_type_name => $item_type) {
$type_basket_items = isset($valid_jobs[$item_type_name]) ? $valid_jobs[$item_type_name] : array();
do_action('wpml_tm_send_' . $item_type_name . '_jobs', $item_type_name, $item_type, $type_basket_items, $translators, $basket_name);
}
// check if there were no errors
return !$this->tm_instance->messages_by_type('error');
}