コード例 #1
0
 /**
  * Disable cache busted file extensions for some classes (usually @LeftAndMain)
  */
 function onBeforeInit()
 {
     foreach (Requirements::$disable_cache_busted_file_extensions_for as $class) {
         if (is_a($this->owner, $class)) {
             Requirements::$use_cache_busted_file_extensions = false;
         }
     }
 }
コード例 #2
0
 public function blockDefault()
 {
     $blocked = (array) self::config()->block;
     if (empty($blocked)) {
         return;
     }
     foreach ($blocked as $block) {
         preg_match_all('/{{([^}]*)}}/', $block, $matches);
         if (!empty($matches[1])) {
             foreach ($matches[1] as $match) {
                 if (strpos($match, '|') !== false) {
                     list($const, $default) = explode('|', $match);
                 } else {
                     $const = $default = $match;
                 }
                 if (defined(trim($const))) {
                     $block = str_replace('{{' . $match . '}}', constant(trim($const)), $block);
                 } elseif (trim($default)) {
                     $block = str_replace('{{' . $match . '}}', trim($default), $block);
                 }
             }
         }
         preg_match_all('/\\[\\[([^}]*)\\]\\]/', $block, $matches);
         if (!empty($matches[1])) {
             foreach ($matches[1] as $match) {
                 if (strpos($match, '|') !== false) {
                     list($const, $default) = explode('|', $match);
                 } else {
                     $const = $match;
                     $default = null;
                 }
                 $block = str_replace('[[' . $match . ']]', trim(singleton('env')->get($const, $default)), $block);
             }
         }
         Requirements::block($block);
     }
 }