@@ 178-180 (lines=3) @@ | ||
175 | * \---------^ |
|
176 | */ |
|
177 | $pos = tln_skipspace($body, $lt + 1); |
|
178 | if ($pos >= mb_strlen($body)) { |
|
179 | return [false, false, false, $lt, mb_strlen($body)]; |
|
180 | } |
|
181 | /** |
|
182 | * There are 3 kinds of tags: |
|
183 | * 1. Opening tag, e.g.: |
|
@@ 226-228 (lines=3) @@ | ||
223 | * Look for next [\W-_], which will indicate the end of the tag name. |
|
224 | */ |
|
225 | $regary = tln_findnxreg($body, $pos, '[^\w\-_]'); |
|
226 | if (false == $regary) { |
|
227 | return [false, false, false, $lt, mb_strlen($body)]; |
|
228 | } |
|
229 | list($pos, $tagname, $match) = $regary; |
|
230 | $tagname = mb_strtolower($tagname); |
|
231 | ||
@@ 287-292 (lines=6) @@ | ||
284 | ||
285 | while ($pos <= mb_strlen($body)) { |
|
286 | $pos = tln_skipspace($body, $pos); |
|
287 | if ($pos == mb_strlen($body)) { |
|
288 | /** |
|
289 | * Non-closed tag. |
|
290 | */ |
|
291 | return [false, false, false, $lt, $pos]; |
|
292 | } |
|
293 | /** |
|
294 | * See if we arrived at a ">" or "/>", which means that we reached |
|
295 | * the end of the tag. |
|
@@ 329-334 (lines=6) @@ | ||
326 | * attrname="yes". |
|
327 | */ |
|
328 | $regary = tln_findnxreg($body, $pos, '[^\w\-_]'); |
|
329 | if (false == $regary) { |
|
330 | /** |
|
331 | * Looks like body ended before the end of tag. |
|
332 | */ |
|
333 | return [false, false, false, $lt, mb_strlen($body)]; |
|
334 | } |
|
335 | list($pos, $attname, $match) = $regary; |
|
336 | $attname = mb_strtolower($attname); |
|
337 | /** |
|
@@ 394-396 (lines=3) @@ | ||
391 | $quot = mb_substr($body, $pos, 1); |
|
392 | if ('\'' == $quot) { |
|
393 | $regary = tln_findnxreg($body, $pos + 1, '\''); |
|
394 | if (false == $regary) { |
|
395 | return [false, false, false, $lt, mb_strlen($body)]; |
|
396 | } |
|
397 | list($pos, $attval, $match) = $regary; |
|
398 | $pos++; |
|
399 | $attary[$attname] = '\'' . $attval . '\''; |
|
@@ 402-404 (lines=3) @@ | ||
399 | $attary[$attname] = '\'' . $attval . '\''; |
|
400 | } elseif ('"' == $quot) { |
|
401 | $regary = tln_findnxreg($body, $pos + 1, '\"'); |
|
402 | if (false == $regary) { |
|
403 | return [false, false, false, $lt, mb_strlen($body)]; |
|
404 | } |
|
405 | list($pos, $attval, $match) = $regary; |
|
406 | $pos++; |
|
407 | $attary[$attname] = '"' . $attval . '"'; |
|
@@ 413-415 (lines=3) @@ | ||
410 | * These are hateful. Look for \s, or >. |
|
411 | */ |
|
412 | $regary = tln_findnxreg($body, $pos, '[\s>]'); |
|
413 | if (false == $regary) { |
|
414 | return [false, false, false, $lt, mb_strlen($body)]; |
|
415 | } |
|
416 | list($pos, $attval, $match) = $regary; |
|
417 | /** |
|
418 | * If it's ">" it will be caught at the top. |