mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-10-17 06:56:06 +02:00
PSR-2 reformatting PHPDoc corrections
With minor corrections. Signed-off-by: Marcus Bointon <marcus@synchromedia.co.uk> Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
committed by
Edward Z. Yang
parent
19eee14899
commit
fac747bdbd
@@ -5,12 +5,24 @@
|
||||
*/
|
||||
class HTMLPurifier_Injector_Linkify extends HTMLPurifier_Injector
|
||||
{
|
||||
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
public $name = 'Linkify';
|
||||
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
public $needed = array('a' => array('href'));
|
||||
|
||||
public function handleText(&$token) {
|
||||
if (!$this->allowsElement('a')) return;
|
||||
/**
|
||||
* @param HTMLPurifier_Token $token
|
||||
*/
|
||||
public function handleText(&$token)
|
||||
{
|
||||
if (!$this->allowsElement('a')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (strpos($token->data, '://') === false) {
|
||||
// our really quick heuristic failed, abort
|
||||
@@ -31,7 +43,9 @@ class HTMLPurifier_Injector_Linkify extends HTMLPurifier_Injector
|
||||
// $l = is link
|
||||
for ($i = 0, $c = count($bits), $l = false; $i < $c; $i++, $l = !$l) {
|
||||
if (!$l) {
|
||||
if ($bits[$i] === '') continue;
|
||||
if ($bits[$i] === '') {
|
||||
continue;
|
||||
}
|
||||
$token[] = new HTMLPurifier_Token_Text($bits[$i]);
|
||||
} else {
|
||||
$token[] = new HTMLPurifier_Token_Start('a', array('href' => $bits[$i]));
|
||||
@@ -39,9 +53,7 @@ class HTMLPurifier_Injector_Linkify extends HTMLPurifier_Injector
|
||||
$token[] = new HTMLPurifier_Token_End('a');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// vim: et sw=4 sts=4
|
||||
|
Reference in New Issue
Block a user