Line | |
---|
1 | <?php
|
---|
2 | class FeedWordPressHTML {
|
---|
3 | 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 | function attributeMatch ($matches) {
|
---|
20 | $suffix = (isset($matches[12]) ? $matches[12] : $matches[9]);
|
---|
21 | $value = (isset($matches[10]) ? $matches[10] : $matches[7]);
|
---|
22 |
|
---|
23 | return array(
|
---|
24 | "tag" => $matches[3],
|
---|
25 | "attribute" => $matches[4],
|
---|
26 | "value" => $value,
|
---|
27 | "quote" => $matches[6],
|
---|
28 | "prefix" => $matches[1].$matches[6],
|
---|
29 | "suffix" => $matches[6].$suffix,
|
---|
30 | "before_attribute" => $matches[2],
|
---|
31 | "after_attribute" => $suffix,
|
---|
32 | );
|
---|
33 | } /* function FeedWordPressHTML::attributeMatch () */
|
---|
34 | } /* class FeedWordPressHTML */
|
---|
35 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.