Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
Tag.php
001 <?php
002
003 /*
004 * @package s9e\TextFormatter
005 * @copyright Copyright (c) 2010-2016 The s9e Authors
006 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
007 */
008 namespace s9e\TextFormatter\Parser;
009 class Tag
010 {
011 const START_TAG = 1;
012 const END_TAG = 2;
013 const SELF_CLOSING_TAG = 3;
014 protected $attributes = array();
015 protected $cascade = array();
016 protected $endTag = \null;
017 protected $flags = 0;
018 protected $invalid = \false;
019 protected $len;
020 protected $name;
021 protected $pos;
022 protected $sortPriority;
023 protected $startTag = \null;
024 protected $type;
025 public function __construct($type, $name, $pos, $len, $priority = 0)
026 {
027 $this->type = (int) $type;
028 $this->name = $name;
029 $this->pos = (int) $pos;
030 $this->len = (int) $len;
031 $this->sortPriority = (int) $priority;
032 }
033 public function addFlags($flags)
034 {
035 $this->flags |= $flags;
036 }
037 public function cascadeInvalidationTo(Tag $tag)
038 {
039 $this->cascade[] = $tag;
040 if ($this->invalid)
041 $tag->invalidate();
042 }
043 public function invalidate()
044 {
045 if ($this->invalid)
046 return;
047 $this->invalid = \true;
048 foreach ($this->cascade as $tag)
049 $tag->invalidate();
050 }
051 public function pairWith(Tag $tag)
052 {
053 if ($this->name === $tag->name)
054 if ($this->type === self::START_TAG
055 && $tag->type === self::END_TAG
056 && $tag->pos >= $this->pos)
057 {
058 $this->endTag = $tag;
059 $tag->startTag = $this;
060 $this->cascadeInvalidationTo($tag);
061 }
062 elseif ($this->type === self::END_TAG
063 && $tag->type === self::START_TAG
064 && $tag->pos <= $this->pos)
065 {
066 $this->startTag = $tag;
067 $tag->endTag = $this;
068 }
069 }
070 public function removeFlags($flags)
071 {
072 $this->flags &= ~$flags;
073 }
074 public function setFlags($flags)
075 {
076 $this->flags = $flags;
077 }
078 public function setSortPriority($sortPriority)
079 {
080 $this->sortPriority = $sortPriority;
081 \trigger_error('setSortPriority() is deprecated. Set the priority when calling adding the tag instead. See http://s9etextformatter.readthedocs.io/Internals/API_changes/#070', \E_USER_DEPRECATED);
082 }
083 public function getAttributes()
084 {
085 return $this->attributes;
086 }
087 public function getEndTag()
088 {
089 return $this->endTag;
090 }
091 public function getFlags()
092 {
093 return $this->flags;
094 }
095 public function getLen()
096 {
097 return $this->len;
098 }
099 public function getName()
100 {
101 return $this->name;
102 }
103 public function getPos()
104 {
105 return $this->pos;
106 }
107 public function getSortPriority()
108 {
109 return $this->sortPriority;
110 }
111 public function getStartTag()
112 {
113 return $this->startTag;
114 }
115 public function getType()
116 {
117 return $this->type;
118 }
119 public function canClose(Tag $startTag)
120 {
121 if ($this->invalid
122 || $this->name !== $startTag->name
123 || $startTag->type !== self::START_TAG
124 || $this->type !== self::END_TAG
125 || $this->pos < $startTag->pos
126 || ($this->startTag && $this->startTag !== $startTag)
127 || ($startTag->endTag && $startTag->endTag !== $this))
128 return \false;
129 return \true;
130 }
131 public function isBrTag()
132 {
133 return ($this->name === 'br');
134 }
135 public function isEndTag()
136 {
137 return (bool) ($this->type & self::END_TAG);
138 }
139 public function isIgnoreTag()
140 {
141 return ($this->name === 'i');
142 }
143 public function isInvalid()
144 {
145 return $this->invalid;
146 }
147 public function isParagraphBreak()
148 {
149 return ($this->name === 'pb');
150 }
151 public function isSelfClosingTag()
152 {
153 return ($this->type === self::SELF_CLOSING_TAG);
154 }
155 public function isSystemTag()
156 {
157 return (\strpos('br i pb v', $this->name) !== \false);
158 }
159 public function isStartTag()
160 {
161 return (bool) ($this->type & self::START_TAG);
162 }
163 public function isVerbatim()
164 {
165 return ($this->name === 'v');
166 }
167 public function getAttribute($attrName)
168 {
169 return $this->attributes[$attrName];
170 }
171 public function hasAttribute($attrName)
172 {
173 return isset($this->attributes[$attrName]);
174 }
175 public function removeAttribute($attrName)
176 {
177 unset($this->attributes[$attrName]);
178 }
179 public function setAttribute($attrName, $attrValue)
180 {
181 $this->attributes[$attrName] = $attrValue;
182 }
183 public function setAttributes(array $attributes)
184 {
185 $this->attributes = $attributes;
186 }
187 }