2077 case BLOCK_PLUGIN: |
2077 case BLOCK_PLUGIN: |
2078 $parser = $this->makeParserText('{CONTENT}'); |
2078 $parser = $this->makeParserText('{CONTENT}'); |
2079 $c = (gettype($this->fetch_block($row['block_content'])) == 'string') ? $this->fetch_block($row['block_content']) : /* This used to say "can't find plugin block" but I think it's more friendly to just silently hide it. */ ''; |
2079 $c = (gettype($this->fetch_block($row['block_content'])) == 'string') ? $this->fetch_block($row['block_content']) : /* This used to say "can't find plugin block" but I think it's more friendly to just silently hide it. */ ''; |
2080 break; |
2080 break; |
2081 } |
2081 } |
|
2082 // is there a {restrict} or {hideif} block? |
|
2083 if ( preg_match('/\{(restrict|hideif) ([a-z0-9_\(\)\|&! ]+)\}/', $c, $match) ) |
|
2084 { |
|
2085 // we have one, check the condition |
|
2086 $type =& $match[1]; |
|
2087 $cond =& $match[2]; |
|
2088 $result = $this->process_condition($cond); |
|
2089 if ( ( $type == 'restrict' && $result == 1 ) || ( $type == 'hideif' && $result == 2 ) ) |
|
2090 { |
|
2091 // throw out this block, it's hidden for whatever reason by the sidebar script |
|
2092 continue; |
|
2093 } |
|
2094 // didn't get a match, so hide the conditional logic |
|
2095 $c = str_replace_once($match[0], '', $c); |
|
2096 } |
|
2097 |
2082 $parser->assign_vars(Array( 'TITLE'=>$this->tplWikiFormat($row['block_name']), 'CONTENT'=>$c )); |
2098 $parser->assign_vars(Array( 'TITLE'=>$this->tplWikiFormat($row['block_name']), 'CONTENT'=>$c )); |
2083 $run = $parser->run(); |
2099 $run = $parser->run(); |
2084 if ( $row['block_type'] == BLOCK_PLUGIN ) |
2100 if ( $row['block_type'] == BLOCK_PLUGIN ) |
2085 { |
2101 { |
2086 $run = str_replace('{TITLE}', $this->tplWikiFormat($row['block_name']), $run); |
2102 $run = str_replace('{TITLE}', $this->tplWikiFormat($row['block_name']), $run); |