/** * Applies the prefilters to the given string. * * @param string $string * @return string */ public function applyPrefilters($string) { foreach ($this->template->getPrefilters() as $prefilter) { if (!is_object($prefilter)) { $filename = $this->template->getPluginFilename('prefilter', $prefilter); if (!file_exists($filename)) { throw new SystemException('unable to find class file ' . $filename, 11000); } require_once $filename; $className = 'TemplatePluginPrefilter' . StringUtil::firstCharToUpperCase(StringUtil::toLowerCase($prefilter)); if (!class_exists($className)) { throw new SystemException($this->formatSyntaxError('unable to find prefilter class ' . $className, $this->currentIdentifier), 11001); } $prefilter = new $className(); } if ($prefilter instanceof TemplatePluginPrefilter) { $string = $prefilter->execute($string, $this); } else { throw new SystemException($this->formatSyntaxError("Prefilter '" . $prefilter . "' does not implement the interface 'TemplatePluginPrefilter'", $this->currentIdentifier), 11010); } } return $string; }