當前位置: 首頁>>代碼示例>>PHP>>正文


PHP GeSHi::getHumanThemeName方法代碼示例

本文整理匯總了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;
 }
開發者ID:rockylo,項目名稱:geshi-1.1,代碼行數:53,代碼來源:class.geshi.php


注:本文中的GeSHi::getHumanThemeName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。