File indexing completed on 2025-02-02 05:48:40
0001 <?php 0002 0003 /** 0004 * Injector that displays the URL of an anchor instead of linking to it, in addition to showing the text of the link. 0005 */ 0006 class HTMLPurifier_Injector_DisplayLinkURI extends HTMLPurifier_Injector 0007 { 0008 /** 0009 * @type string 0010 */ 0011 public $name = 'DisplayLinkURI'; 0012 0013 /** 0014 * @type array 0015 */ 0016 public $needed = array('a'); 0017 0018 /** 0019 * @param $token 0020 */ 0021 public function handleElement(&$token) 0022 { 0023 } 0024 0025 /** 0026 * @param HTMLPurifier_Token $token 0027 */ 0028 public function handleEnd(&$token) 0029 { 0030 if (isset($token->start->attr['href'])) { 0031 $url = $token->start->attr['href']; 0032 unset($token->start->attr['href']); 0033 $token = array($token, new HTMLPurifier_Token_Text(" ($url)")); 0034 } else { 0035 // nothing to display 0036 } 0037 } 0038 } 0039 0040 // vim: et sw=4 sts=4