PluginProbe
Tracking Code Manager / 2.3.0
Tracking Code Manager v2.3.0
2.8.0 2.7.0 trunk 1.11.8 1.11.9 1.12.0 1.12.1 1.12.2 1.12.3 1.4 1.5 2.0.0 2.0.1 2.0.13 2.0.14 2.0.15 2.0.16 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.2.0 All 29 releases
tracking-code-manager / includes / classes / html / HTMLTag.php
HTMLTag.php
62 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) exit;
3
4 class IRP_HTMLTag {
5 var $tags;
6 var $tag;
7 var $openTag;
8 var $closeTag;
9
10 public function __construct() {
11 $this->tags = array();
12 $this->tag='';
13 $this->openTag='';
14 $this->closeTag='';
15 }
16
17 public function hasTagContent() {
18 return TRUE;
19 }
20 public function pushTag(IRP_HTMLTag $child) {
21 if(count($this->tags)>0) {
22 //replace the TextContent tag that only contains \r\n with NewLineText
23 //due to now we use the substrln is impossible that we enter here
24 $last=$this->tags[count($this->tags)-1];
25 if(isset($last->body)) {
26 $newline=TRUE;
27 if($last->body=="\n" || $last->body=="\r\n") {
28 //we dont have to do nothing... sure this is a newlinetext!
29 } else {
30 for($i=0; $i<strlen($last->body); $i++) {
31 $c=substr($last->body, $i, 1);
32 if($c!="\n" && $c!="\n") {
33 $newline=FALSE;
34 break;
35 }
36 }
37 }
38
39 if($newline) {
40 $tag=new IRP_NewLineText();
41 $tag->body=$last->body;
42 $this->tags[count($this->tags)-1]=$tag;
43 }
44 }
45 }
46 $this->tags[] = $child;
47 }
48
49 public function write(IRP_HTMLContext $context) {
50 $context->write($this->openTag);
51 foreach($this->tags as $tag) {
52 $tag->write($context);
53 }
54 $context->write($this->closeTag);
55 }
56 public function analyseText(IRP_HTMLContext $context) {
57 foreach ($this->tags as $tag) {
58 $tag->analyseText($context);
59 }
60 }
61 }
62