コード例 #1
0
 /**
  * @see wcf\system\template\IPrefilterTemplatePlugin::execute()
  */
 public function execute($templateName, $sourceContent, TemplateScriptingCompiler $compiler)
 {
     $ldq = preg_quote($compiler->getLeftDelimiter(), '~');
     $rdq = preg_quote($compiler->getRightDelimiter(), '~');
     $sourceContent = preg_replace_callback("~{$ldq}hascontent{$rdq}(.*){$ldq}content{$rdq}(.*){$ldq}\\/content{$rdq}(.*)({$ldq}hascontentelse{$rdq}(.*))?{$ldq}\\/hascontent{$rdq}~sU", array('self', 'replaceContentCallback'), $sourceContent);
     return $sourceContent;
 }
コード例 #2
0
 /**
  * @see wcf\system\template\ITemplatePluginPrefilter::execute()
  */
 public function execute($templateName, $sourceContent, TemplateScriptingCompiler $compiler)
 {
     $ldq = preg_quote($compiler->getLeftDelimiter(), '~');
     $rdq = preg_quote($compiler->getRightDelimiter(), '~');
     $sourceContent = preg_replace("~{$ldq}icon size='?([SML])'?{$rdq}([\\w\\.]+){$ldq}/icon{$rdq}~", '{literal}<?php echo \\wcf\\system\\style\\StyleHandler::getInstance()->getStyle()->getIconPath(\'$2\', \'$1\'); ?>{/literal}', $sourceContent);
     return $sourceContent;
 }
コード例 #3
0
 /**
  * @see wcf\system\template\IPrefilterTemplatePlugin::execute()
  */
 public function execute($templateName, $sourceContent, TemplateScriptingCompiler $compiler)
 {
     $ldq = preg_quote($compiler->getLeftDelimiter(), '~');
     $rdq = preg_quote($compiler->getRightDelimiter(), '~');
     $sourceContent = preg_replace_callback("~{$ldq}lang{$rdq}([\\w\\.]+){$ldq}/lang{$rdq}~", function ($match) {
         return WCF::getLanguage()->get($match[1]);
     }, $sourceContent);
     return $sourceContent;
 }
コード例 #4
0
 /**
  * @see	\wcf\system\template\ICompilerTemplatePlugin::executeEnd()
  */
 public function executeEnd(TemplateScriptingCompiler $compiler)
 {
     $compiler->popTag('implode');
     $tagArgs = array_pop($this->tagStack);
     $phpCode = "<?php\n";
     $phpCode .= "if (++\$_i" . $tagArgs['hash'] . " < \$_length" . $tagArgs['hash'] . ") { echo " . $tagArgs['glue'] . "; }\n";
     $phpCode .= "} ?>";
     return $phpCode;
 }
コード例 #5
0
 /**
  * @see wcf\system\template\IPrefilterTemplatePlugin::execute()
  */
 public function execute($templateName, $sourceContent, TemplateScriptingCompiler $compiler)
 {
     $ldq = preg_quote($compiler->getLeftDelimiter(), '~');
     $rdq = preg_quote($compiler->getRightDelimiter(), '~');
     $sourceContent = preg_replace_callback("~{$ldq}event\\ name\\=\\'([\\w]+)\\'{$rdq}~", function ($match) use($templateName) {
         return WCF::getTPL()->getTemplateListenerCode($templateName, $match[1]);
     }, $sourceContent);
     return $sourceContent;
 }
コード例 #6
0
	/**
	 * @see	wcf\system\template\ICompilerTemplatePlugin::executeEnd()
	 */
	public function executeEnd(TemplateScriptingCompiler $compiler) {
		$compiler->popTag('lang');
		return "<?php echo wcf\system\WCF::getLanguage()->getDynamicVariable(ob_get_clean(), \$this->tagStack[count(\$this->tagStack) - 1][1], (isset(\$this->tagStack[count(\$this->tagStack) - 1][1]['__optional']) ? \$this->tagStack[count(\$this->tagStack) - 1][1]['__optional'] : false)); array_pop(\$this->tagStack); ?>";
	}
コード例 #7
0
 /**
  * @see wcf\system\template\ICompilerTemplatePlugin::executeEnd()
  */
 public function executeEnd(TemplateScriptingCompiler $compiler)
 {
     throw new SystemException($compiler->formatSyntaxError("unknown tag {/append}", $compiler->getCurrentIdentifier(), $compiler->getCurrentLineNo()));
 }
コード例 #8
0
 /**
  * @see wcf\system\template\ICompilerTemplatePlugin::executeEnd()
  */
 public function executeEnd(TemplateScriptingCompiler $compiler)
 {
     $compiler->popTag('icon');
     return "<?php echo wcf\\system\\style\\StyleHandler::getInstance()->getStyle()->getIconPath(ob_get_clean(), '" . $this->size . "'); ?>";
 }
コード例 #9
0
 /**
  * @see wcf\system\template\ICompilerTemplatePlugin::executeEnd()
  */
 public function executeEnd(TemplateScriptingCompiler $compiler)
 {
     $compiler->popTag('staticlang');
     return "<?php echo \\wcf\\system\\WCF::getLanguage()->get(ob_get_clean()); ?>";
 }