本文整理汇总了PHP中SitePress::get_languages方法的典型用法代码示例。如果您正苦于以下问题:PHP SitePress::get_languages方法的具体用法?PHP SitePress::get_languages怎么用?PHP SitePress::get_languages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SitePress
的用法示例。
在下文中一共展示了SitePress::get_languages方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_package_language_name
public function get_package_language_name()
{
if ($this->is_package_language_active()) {
return $this->active_languages[$this->package_language]['display_name'];
} else {
$all_languages = $this->sitepress->get_languages();
return $all_languages[$this->package_language]['display_name'];
}
}
示例2: wpml_get_table_taxonomies
public static function wpml_get_table_taxonomies(SitePress $sitepress)
{
$taxonomies = $sitepress->get_wp_api()->get_taxonomies(array(), 'objects');
$result = array("taxonomies" => array(), "activeLanguages" => array(), "allLanguages" => array());
$sitepress->set_admin_language();
$active_langs = $sitepress->get_active_languages();
$default_lang = $sitepress->get_default_language();
$result["activeLanguages"][$default_lang] = array("label" => $active_langs[$default_lang]['display_name'], "flag" => $sitepress->get_flag_url($default_lang));
foreach ($active_langs as $code => $lang) {
if ($code !== $default_lang) {
$result["activeLanguages"][$code] = array("label" => $lang['display_name'], "flag" => $sitepress->get_flag_url($code));
}
}
$all_languages = $sitepress->get_languages();
foreach ($all_languages as $code => $lang) {
$result["allLanguages"][$code] = array("label" => $lang['display_name'], "flag" => $sitepress->get_flag_url($code));
}
foreach ($taxonomies as $key => $tax) {
if ($sitepress->is_translated_taxonomy($key)) {
$result["taxonomies"][$key] = array("label" => $tax->label, "singularLabel" => $tax->labels->singular_name, "hierarchical" => $tax->hierarchical, "name" => $key);
}
}
return $result;
}