Skip to content
Permalink
Browse files

Improved parser - IF / ELSEIF / ELSE / ENDIF

<@if:[*id:is(1)*]>
Top-Page
<@else>
Other-Page
<@endif>

<!--@if:[*id:is(1)*]>
Top-Page
<@else>
Other-Page
<@ENDIF-->

These are both valid .
  • Loading branch information...
yama committed Aug 4, 2016
1 parent 7564d01 commit efa787b2b8192db23a2bd5fa3587ba04ec261510
Showing with 4 additions and 6 deletions.
  1. +4 −6 manager/includes/document.parser.class.inc.php
@@ -1085,13 +1085,11 @@ function mergeConditionalTagsContent($content)
{
if ($this->debug) $fstart = $this->getMicroTime();
if(strpos($content,'<!--@IF ')!==false) $content = str_replace('<!--@IF ','<!--@IF:',$content);
if(strpos($content,'<!--@IF:')===false) return $content;
if(strpos($content,'<!--@ELSEIF')!==false) $content = str_replace('<!--@ELSEIF', '<@ELSEIF', $content);
if(strpos($content,'<!--@ELSE-->')!==false) $content = str_replace('<!--@ELSE-->', '<@ELSE>', $content);
if(strpos($content,'<!--@ENDIF-->')!==false) $content = str_replace('<!--@ENDIF-->','<@ENDIF-->',$content);
if(strpos($content,'<!--@IF:')!==false) $content = str_replace('<!--@IF:', '<@IF:',$content);
if(strpos($content,'<@IF:')===false) return $content;
if(strpos($content,'<@ENDIF-->')!==false) $content = str_replace('<@ENDIF-->', '<@ENDIF>',$content);
$s = array('<!--@IF:', '<@ELSE', '<@ENDIF-->');
$s = array('<@IF:', '<@ELSE', '<@ENDIF>');
$r = array('<!--@CONDTAG@IF:','<!--@CONDTAG@ELSE', '<!--@CONDTAG@ENDIF-->');
$content = str_replace($s, $r, $content);
$splits = explode('<!--@CONDTAG@', $content);

1 comment on commit efa787b

@AgelxNash

This comment has been minimized.

Copy link
Contributor

AgelxNash commented on efa787b Oct 9, 2016

You are crazy....

Please sign in to comment.
You can’t perform that action at this time.