本文整理汇总了PHP中SitePress::get_source_language_by_trid方法的典型用法代码示例。如果您正苦于以下问题:PHP SitePress::get_source_language_by_trid方法的具体用法?PHP SitePress::get_source_language_by_trid怎么用?PHP SitePress::get_source_language_by_trid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SitePress
的用法示例。
在下文中一共展示了SitePress::get_source_language_by_trid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_save_post_source_lang
/**
* @param int $trid
* @param string $language_code
* @param string $default_language
*
* @uses \WPML_Backend_Request::get_source_language_from_referer to retrieve the source_language when saving via ajax
*
* @return null|string
*/
protected function get_save_post_source_lang($trid, $language_code, $default_language)
{
/** @var WPML_Backend_Request $wpml_request_handler */
global $wpml_request_handler;
$source_language = filter_input(INPUT_GET, 'source_lang', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$source_language = $source_language ? $source_language : $wpml_request_handler->get_source_language_from_referer();
$source_language = $source_language ? $source_language : SitePress::get_source_language_by_trid($trid);
$source_language = $source_language === 'all' ? $default_language : $source_language;
$source_language = $source_language !== $language_code ? $source_language : null;
return $source_language;
}
示例2: is_in_active_job
protected function is_in_active_job($element_id, $target_lang_code, $element_type_prefix, $return_status = false)
{
/**
* @var TranslationManagement $iclTranslationManagement
* @var WPML_TM_Element_Translations $wpml_tm_element_translations
*/
global $wpml_tm_element_translations;
$trid = $this->get_element_trid($element_id, $element_type_prefix);
if ($return_status && SitePress::get_source_language_by_trid($trid) === $target_lang_code) {
$res = ICL_TM_COMPLETE;
} else {
$job_id = $wpml_tm_element_translations->get_job_id($trid, $target_lang_code);
$res = false;
if ($job_id > 0) {
$res = $wpml_tm_element_translations->get_translation_status($trid, $target_lang_code);
$res = $return_status ? $res : in_array($res, array(ICL_TM_IN_PROGRESS, ICL_TM_WAITING_FOR_TRANSLATOR), true);
} elseif ($return_status && (bool) $wpml_tm_element_translations->get_element_id($trid, $target_lang_code) === true) {
$res = ICL_TM_COMPLETE;
}
}
return $res;
}