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