/** * Returns a list of all defined frog tags. The list is cached in the * private static member variable $tagList. */ public static function get() { try { if (!isset(self::$tagList)) { self::set_tag_list(); } } catch (Exception $e) { $controller = new FrogTagsController(); $controller->error_page('Fatal Error', $e->getMessage()); } return self::$tagList; }
/** * Runs the preprocessor. The preprocessor has two assignments. * * First it replaces empty tags that correspond to the pattern * <f:name ... /> with <f:name ...></f:name>. * * Secondly it marks top-level tags with sign '@' before the tag's name. * Top-level tags are tags that are not surrounded by other tags. As the * tag parser will only parse marked tags it will only parse top-level * tags. * * The content of the top-level tags can afterwards be parsed inside of the * tag definition using the method 'expand' of class FrogTags. */ public function run($string) { try { // replace empty tags $string = preg_replace("|<f:(\\w+?)([^<>]*)/>|U", "<f:\\1\\2></f:\\1>", $string); // replace nested tags (e. g. <f:children:each> with <f:children><f:each>) $string = preg_replace_callback("|<(/?)f:([:\\w]+?)([^<>]*)>|U", array($this, 'replace_nested_tag'), $string); // mark top-level tags $this->parentTags = array(); $string = preg_replace_callback("|<(/?)f:(\\w+?)([^<>]*)>|U", array($this, 'process_tag'), $string); } catch (Exception $e) { $controller = new FrogTagsController(); $controller->error_page('Fatal Parsing Error', $e->getMessage()); } return $string; }