PluginProbe
FeedWordPress / 2022.0204
FeedWordPress v2022.0204
trunk 0.8 0.9 0.91 0.95 0.96 0.97 0.98 0.981 0.99 0.991 0.992 0.993 2008.1030 2008.1101 2008.1105 2008.1214 2009.0612 2009.0613 2009.0618 2009.0707 2009.1111 2009.1112 2010.0127 2010.0528 All 65 releases
feedwordpress / feedwordpresshtml.class.php

feedwordpresshtml.class.php in FeedWordPress 2022.0204, at feedwordpresshtml.class.php

88 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 class FeedWordPressHTML {
3 static function attributeRegex ($tag, $attr) {
4 return ":(
5 (<($tag)\s+[^>]*)
6 ($attr)=
7 )
8 (
9 \s*(\"|')
10 (((?!\\6).)*)
11 \\6([^>]*>)
12 |
13 \s*(((?!/>)[^\s>])*)
14 ([^>]*>)
15 )
16 :ix";
17 } /* function FeedWordPressHTML::attributeRegex () */
18
19 static function attributeMatch ($matches) {
20 for ($i = 0; $i <= 12; $i++) :
21 if (!isset($matches[$i])) :
22 $matches[$i] = '';
23 endif;
24 endfor;
25
26 $suffix = $matches[12].$matches[9];
27 $value = $matches[10].$matches[7];
28
29 return array(
30 "tag" => $matches[3],
31 "attribute" => $matches[4],
32 "value" => $value,
33 "quote" => $matches[6],
34 "prefix" => $matches[1].$matches[6],
35 "suffix" => $matches[6].$suffix,
36 "before_attribute" => $matches[2],
37 "after_attribute" => $suffix,
38 );
39 } /* function FeedWordPressHTML::attributeMatch () */
40
41 static function tagWithAttributeRegex ($tag, $attr, $value, $closing = true) {
42 return ":(
43 (<($tag)\s+[^>]*)
44 ($attr)=
45 )
46 (
47 \s*(\"|')
48 ((((?!\\6).)*\s)*($value)(\s((?!\\6).)*)*)
49 \\6([^>]*>)
50 |
51 \s*((?!/>)($value))
52 ([^>]*>)
53 )".($closing ? "
54 (((?!</($tag)>).)*)
55 (</($tag)>)
56 " : "")."
57 :ix";
58 } /* FeedWordPressHTML::tagWithAttributeRegex () */
59
60 static function tagWithAttributeMatch ($matches, $closing = true) {
61 for ($i = 0; $i <= 21; $i++) :
62 if (!isset($matches[$i])) :
63 $matches[$i] = '';
64 endif;
65 endfor;
66
67 $suffix = $matches[16].$matches[13];
68 $value = $matches[14].$matches[7];
69
70 return array(
71 "full" => $matches[0],
72 "tag" => $matches[3],
73 "attribute" => $matches[4],
74 "value" => $value,
75 "quote" => $matches[6],
76 "prefix" => $matches[1].$matches[6],
77 "suffix" => $matches[6].$suffix,
78 "before_attribute" => $matches[2],
79 "after_attribute" => $suffix,
80 "open_tag" => $matches[1].$matches[6].$value.$matches[6].$suffix,
81 "content" => ($closing ? $matches[17] : NULL),
82 "close_tag" => ($closing ? $matches[20] : NULL),
83 );
84
85 } /* FeedWordPressHTML::tagWithAttributeMatch () */
86 } /* class FeedWordPressHTML */
87
88