本文整理汇总了PHP中GeSHi::getHumanThemeName方法的典型用法代码示例。如果您正苦于以下问题:PHP GeSHi::getHumanThemeName方法的具体用法?PHP GeSHi::getHumanThemeName怎么用?PHP GeSHi::getHumanThemeName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeSHi
的用法示例。
在下文中一共展示了GeSHi::getHumanThemeName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: themesSupportedBy
/**
* Returns the themes supported by the given language
*
* The names returned are in the form that GeSHi reads them, i.e. they
* are not nice human strings. If you want the human form, use
* {@link GeSHi::getHumanThemeName()} on each name returned.
*
* @param string $language The language to get supported themes for
* @param boolean $return_human If <kbd>true</kbd>, returns an array of
* theme name => human-readable name. Otherwise,
* just return an array of theme names.
* @return array A list of themes supported by the language. Note that
* they are _not_ in preferred order
* @since 1.1.1
* @todo Make them in preferred order?
* @todo Expensive, maybe cache?
*/
public static function themesSupportedBy($language, $return_human = false)
{
$themes = array();
//geshi_dbg('GeSHi::themesSupportedBy(' . $language . ')', GESHI_DBG_API);
$language = GeSHi::_cleanLanguageName($language);
//geshi_dbg(' language now ' . $language, GESHI_DBG_API);
$dh = opendir(GESHI_THEMES_ROOT);
while (false !== ($theme_folder = readdir($dh))) {
if ('.' == $theme_folder || '..' == $theme_folder) {
continue;
}
if (is_readable(GESHI_THEMES_ROOT . $theme_folder . '/' . $language . '.php')) {
if ($return_human) {
$themes[$theme_folder] = GeSHi::getHumanThemeName($theme_folder);
} else {
$themes[] = $theme_folder;
}
// Check for subthemes
$dh2 = opendir(GESHI_THEMES_ROOT . $theme_folder);
while (false !== ($subtheme_folder = readdir($dh2))) {
if ('.' == $subtheme_folder || '..' == $subtheme_folder || !is_dir(GESHI_THEMES_ROOT . $theme_folder . '/' . $subtheme_folder)) {
continue;
}
if (is_readable(GESHI_THEMES_ROOT . $theme_folder . '/' . $subtheme_folder . '/' . $language . '.php')) {
$subtheme_name = "{$theme_folder}/{$subtheme_folder}";
if ($return_human) {
$themes[$subtheme_name] = GeSHi::getHumanThemeName($subtheme_name);
} else {
$themes[] = $subtheme_name;
}
}
}
}
}
return $themes;
}