2 namespace sfjp\Wiki\Formatter;
5 function __construct() {
8 function __destruct() {
9 unset($this->processor);
12 public function cleanup() {}
14 public function reset() {}
16 public function setProcessor($proc) {
17 $this->processor = $proc;
20 public function getProcessor() {
21 return $this->processor;
24 public function setContext($c) {
25 return $this->getProcessor()->setContext($c);
28 public function getContext($key = null) {
29 return $this->getProcessor()->getContext($key);
32 public function __($text, $args=array()) {
33 return $this->getProcessor()->__($text, $args);
36 abstract public function raw_node($string);
37 abstract public function text_node($text);
38 abstract public function open_element($neme, $opt = null);
39 abstract public function close_element($name, $opt = null);
41 static public function escape_id_value($str) {
42 $str = preg_replace_callback('/[^A-Za-z0-9_:.-]+/',
43 create_function('$m', '$p = unpack("H*", $m[0]); return $p[1];'),
45 if (!ctype_alpha(substr($str, 0, 1))) $str = "badid-".$str;