]>
Commit | Line | Data |
---|---|---|
d4949327 NL |
1 | <?php\r |
2 | \r | |
3 | /**\r | |
4 | * Injector that displays the URL of an anchor instead of linking to it, in addition to showing the text of the link.\r | |
5 | */\r | |
6 | class HTMLPurifier_Injector_DisplayLinkURI extends HTMLPurifier_Injector\r | |
7 | {\r | |
8 | /**\r | |
9 | * @type string\r | |
10 | */\r | |
11 | public $name = 'DisplayLinkURI';\r | |
12 | \r | |
13 | /**\r | |
14 | * @type array\r | |
15 | */\r | |
16 | public $needed = array('a');\r | |
17 | \r | |
18 | /**\r | |
19 | * @param $token\r | |
20 | */\r | |
21 | public function handleElement(&$token)\r | |
22 | {\r | |
23 | }\r | |
24 | \r | |
25 | /**\r | |
26 | * @param HTMLPurifier_Token $token\r | |
27 | */\r | |
28 | public function handleEnd(&$token)\r | |
29 | {\r | |
30 | if (isset($token->start->attr['href'])) {\r | |
31 | $url = $token->start->attr['href'];\r | |
32 | unset($token->start->attr['href']);\r | |
33 | $token = array($token, new HTMLPurifier_Token_Text(" ($url)"));\r | |
34 | } else {\r | |
35 | // nothing to display\r | |
36 | }\r | |
37 | }\r | |
38 | }\r | |
39 | \r | |
40 | // vim: et sw=4 sts=4\r |