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


PHP GeSHi::merge_arrays方法代碼示例

本文整理匯總了PHP中GeSHi::merge_arrays方法的典型用法代碼示例。如果您正苦於以下問題:PHP GeSHi::merge_arrays方法的具體用法?PHP GeSHi::merge_arrays怎麽用?PHP GeSHi::merge_arrays使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在GeSHi的用法示例。


在下文中一共展示了GeSHi::merge_arrays方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: load_language

 /**
  * Gets language information and stores it for later use
  *
  * @param string The filename of the language file you want to load
  * @since 1.0.0
  * @access private
  * @todo Needs to load keys for lexic permissions for keywords, regexps etc
  */
 function load_language($file_name)
 {
     if ($file_name == $this->loaded_language) {
         // this file is already loaded!
         return;
     }
     //Prepare some stuff before actually loading the language file
     $this->loaded_language = $file_name;
     $this->parse_cache_built = false;
     $this->enable_highlighting();
     $language_data = array();
     //Load the language file
     require $file_name;
     // Perhaps some checking might be added here later to check that
     // $language data is a valid thing but maybe not
     $this->language_data = $language_data;
     // Set strict mode if should be set
     if ($this->language_data['STRICT_MODE_APPLIES'] == GESHI_ALWAYS) {
         $this->strict_mode = true;
     }
     // Set permissions for all lexics to true
     // so they'll be highlighted by default
     foreach (array_keys($this->language_data['KEYWORDS']) as $key) {
         if (!empty($this->language_data['KEYWORDS'][$key])) {
             $this->lexic_permissions['KEYWORDS'][$key] = true;
         } else {
             $this->lexic_permissions['KEYWORDS'][$key] = false;
         }
     }
     foreach (array_keys($this->language_data['COMMENT_SINGLE']) as $key) {
         $this->lexic_permissions['COMMENTS'][$key] = true;
     }
     foreach (array_keys($this->language_data['REGEXPS']) as $key) {
         $this->lexic_permissions['REGEXPS'][$key] = true;
     }
     // for BenBE and future code reviews:
     // we can use empty here since we only check for existance and emptiness of an array
     // if it is not an array at all but rather false or null this will work as intended as well
     // even if $this->language_data['PARSER_CONTROL'] is undefined this won't trigger a notice
     if (!empty($this->language_data['PARSER_CONTROL']['ENABLE_FLAGS'])) {
         foreach ($this->language_data['PARSER_CONTROL']['ENABLE_FLAGS'] as $flag => $value) {
             // it's either true or false and maybe is true as well
             $perm = $value !== GESHI_NEVER;
             if ($flag == 'ALL') {
                 $this->enable_highlighting($perm);
                 continue;
             }
             if (!isset($this->lexic_permissions[$flag])) {
                 // unknown lexic permission
                 continue;
             }
             if (is_array($this->lexic_permissions[$flag])) {
                 foreach ($this->lexic_permissions[$flag] as $key => $val) {
                     $this->lexic_permissions[$flag][$key] = $perm;
                 }
             } else {
                 $this->lexic_permissions[$flag] = $perm;
             }
         }
         unset($this->language_data['PARSER_CONTROL']['ENABLE_FLAGS']);
     }
     //NEW in 1.0.8: Allow styles to be loaded from a separate file to override defaults
     $style_filename = substr($file_name, 0, -4) . '.style.php';
     if (is_readable($style_filename)) {
         //Clear any style_data that could have been set before ...
         if (isset($style_data)) {
             unset($style_data);
         }
         //Read the Style Information from the style file
         include $style_filename;
         //Apply the new styles to our current language styles
         if (isset($style_data) && is_array($style_data)) {
             $this->language_data['STYLES'] = GeSHi::merge_arrays($this->language_data['STYLES'], $style_data);
         }
     }
     // Set default class for CSS
     $this->overall_class = $this->language;
 }
開發者ID:akoehn,項目名稱:wikireader,代碼行數:86,代碼來源:geshi.php


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