当前位置: 首页>>代码示例>>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;未经允许,请勿转载。