2008-10-23 21:11:29 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Injector that displays the URL of an anchor instead of linking to it, in addition to showing the text of the link.
|
|
|
|
*/
|
|
|
|
class HTMLPurifier_Injector_DisplayLinkURI extends HTMLPurifier_Injector
|
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-10-23 21:11:29 +00:00
|
|
|
public $name = 'DisplayLinkURI';
|
|
|
|
public $needed = array('a');
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-10-23 21:11:29 +00:00
|
|
|
public function handleElement(&$token) {
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-10-23 21:11:29 +00:00
|
|
|
public function handleEnd(&$token) {
|
|
|
|
if (isset($token->start->attr['href'])){
|
|
|
|
$url = $token->start->attr['href'];
|
|
|
|
unset($token->start->attr['href']);
|
|
|
|
$token = array($token, new HTMLPurifier_Token_Text(" ($url)"));
|
|
|
|
} else {
|
|
|
|
// nothing to display
|
|
|
|
}
|
|
|
|
}
|
2008-12-06 09:24:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// vim: et sw=4 sts=4
|