Skip to content

Commit

Permalink
Restore use of $path_replace_list
Browse files Browse the repository at this point in the history
  • Loading branch information
eliemichel committed Aug 25, 2014
1 parent 2b7e996 commit d4a540e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions inc/rain.tpl.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -719,9 +719,15 @@ protected function path_replace( $html, $tpl_basedir ){
$this->path = $this->reduce_path( $tpl_dir );

$exp = array();
$exp[] = '/<(link|a)(.*?)(href)="(.*?)"/i';
$exp[] = '/<(img|script|input)(.*?)(src)="(.*?)"/i';
$exp[] = '/<(form)(.*?)(action)="(.*?)"/i';

$tags = array_intersect( array( "link", "a" ), self::$path_replace_list );
$exp[] = '/<(' . join( '|', $tags ) . ')(.*?)(href)="(.*?)"/i';

$tags = array_intersect( array( "img", "script", "input" ), self::$path_replace_list );
$exp[] = '/<(' . join( '|', $tags ) . ')(.*?)(src)="(.*?)"/i';

$tags = array_intersect( array( "form" ), self::$path_replace_list );
$exp[] = '/<(' . join( '|', $tags ) . ')(.*?)(action)="(.*?)"/i';

return preg_replace_callback( $exp, 'self::single_path_replace', $html );

Expand Down

0 comments on commit d4a540e

Please sign in to comment.