Exemplo n.º 1
0
 /**
  * Run output (which has been cleaned and maybe cached) on each hit. 
  * Result will be immediately displayed and not reused, so we don't need to keep track of special tags for next execution.
  */
 protected function run($sReturn, $bRunDynamicParsing, $bRunDynamicPhp)
 {
     $sReturn = AnwPlugins::vhook('output_run_before', $sReturn, $this->oPage);
     self::debug("run : dynamicParsing=" . $bRunDynamicParsing . ", dynamicPhp=" . $bRunDynamicPhp);
     //execute user's php code (if any)
     //it seems safer to execute PHP code before that any dynamic transformation to the content is applied (cache, loops...)
     //so that we are *sure* that the PHP code being executed comes directly from the edited content,
     //and not generated from a compromised dynamic transformation.
     if ($bRunDynamicPhp) {
         AnwDebug::startbench("runPhp", true);
         $sReturn = AnwUtils::evalMixedPhpCode($sReturn);
         AnwDebug::stopbench("runPhp");
     }
     //PHP code has been executed, we should never go back in this function!
     if ($bRunDynamicParsing) {
         $sReturn = $this->getParser()->parse($sReturn);
     }
     $sReturn = AnwPlugins::vhook('output_run', $sReturn, $this->oPage);
     return $sReturn;
 }