includes/plugins.php
changeset 519 94214ec0871c
parent 507 586fd7d3202d
child 527 21e11f564463
equal deleted inserted replaced
518:2b826f2640e9 519:94214ec0871c
   222     foreach ( $blocks[0] as $i => $_ )
   222     foreach ( $blocks[0] as $i => $_ )
   223     {
   223     {
   224       if ( is_string($type) && $blocks[1][$i] !== $type )
   224       if ( is_string($type) && $blocks[1][$i] !== $type )
   225         continue;
   225         continue;
   226       
   226       
       
   227       $value =& $blocks[4][$i];
       
   228       // parse includes
       
   229       preg_match_all('/^!include [\'"]?(.+?)[\'"]?$/m', $value, $includes);
       
   230       foreach ( $includes[0] as $i => $replace )
       
   231       {
       
   232         $filename = ENANO_ROOT . '/' . $includes[1][$i];
       
   233         if ( @file_exists( $filename ) && @is_readable( $filename ) )
       
   234         {
       
   235           $contents = @file_get_contents($filename);
       
   236           $value = str_replace_once($replace, $contents, $value);
       
   237         }
       
   238       }
       
   239       
   227       $el = self::parse_vars($blocks[2][$i]);
   240       $el = self::parse_vars($blocks[2][$i]);
   228       $el['block'] = $blocks[1][$i];
   241       $el['block'] = $blocks[1][$i];
   229       $el['value'] = $blocks[4][$i];
   242       $el['value'] = $value;
   230       $return[] = $el;
   243       $return[] = $el;
   231     }
   244     }
   232     
   245     
   233     return $return;
   246     return $return;
   234   }
   247   }