3 /* the actual text container..
5 does a quick bit of parsing to see if it a {template}var ..
8 class XML_SvgToPDF_Tspan extends XML_SvgToPDF_Base {
10 var $content = ''; // applies to tspan only..
13 var $args = array(); // arguments..
16 function fromXmlNode($node)
18 parent::fromXmlNode($node);
19 $this->content = $node->textContent;
24 function fromNode($node)
26 parent::fromNode($node);
28 $this->content = $node->content;
37 if (isset($this->x)) {
40 if (isset($this->y)) {
44 static $trans = false;
46 $trans = array_flip(get_html_translation_table(HTML_ENTITIES));
49 if (!empty($this->content) && strlen($this->content)) {
51 if (strpos($this->content,'&') !== false) {
52 $this->content = strtr($this->content, $trans);
53 $this->content = str_replace(''',"'",$this->content);
55 $this->content = preg_replace_callback('/&#(\d+);/m', array($this, 'content_replace'),
58 if (!empty($node->language)) {
59 // todo - other conversions....
60 $this->content = mb_convert_encoding($this->content,'BIG-5','UTF-8');
64 if (false === strpos($this->content,'{')) {
67 preg_match_all('/\{([a-z0-9_.]+(\(\))?)\}/i',$this->content,$matches);
69 $this->args = $matches[1];
70 foreach($this->args as $v) {
71 $this->content = str_replace('{'.$v.'}', '%s',$this->content);
73 //$this->content = preg_replace('/\{('.implode('|',$matches[1]).')\}/','%s',$this->content);
79 function content_replace($matches) { // php5.2 needs this to be a function...
80 return chr($matches[1]);
84 function shift($x,$y) // disable shifting on text