PluginProbe
FeedWordPress / 2025.1211
FeedWordPress v2025.1211
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
← All changes | feedwordpresshtml.class.php +57 -5 2009.11112025.1211 View file →
@@ -1,7 +1,7 @@
1 -<?php
1 +<?php
2 2 class FeedWordPressHTML {
3 - function attributeRegex ($tag, $attr) {
3 + static function attributeRegex ($tag, $attr) {
4 4 return ":(
5 5 (<($tag)\s+[^>]*)
6 6 ($attr)=
7 7 )
@@ -15,12 +15,18 @@
15 15 )
16 16 :ix";
17 17 } /* function FeedWordPressHTML::attributeRegex () */
18 18
19 - function attributeMatch ($matches) {
20 - $suffix = (isset($matches[12]) ? $matches[12] : $matches[9]);
21 - $value = (isset($matches[10]) ? $matches[10] : $matches[7]);
19 + static function attributeMatch ($matches) {
20 + for ($i = 0; $i <= 12; $i++) :
21 + if ( !isset($matches[$i])) :
22 + $matches[$i] = '';
23 + endif;
24 + endfor;
22 25
26 + $suffix = $matches[12].$matches[9];
27 + $value = $matches[10].$matches[7];
28 +
23 29 return array(
24 30 "tag" => $matches[3],
25 31 "attribute" => $matches[4],
26 32 "value" => $value,
@@ -30,6 +36,52 @@
30 36 "before_attribute" => $matches[2],
31 37 "after_attribute" => $suffix,
32 38 );
33 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 () */
34 86 } /* class FeedWordPressHTML */
35 87