mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-23 00:41:52 +00:00
Fit everything to width=80.
git-svn-id: http://htmlpurifier.org/svnroot/html_purifier/trunk@48 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
e3c4faae41
commit
3f123d6f53
@ -75,7 +75,14 @@ class HTML_Lexer
|
||||
|
||||
if (!$inside_tag && $position_next_lt !== false) {
|
||||
// We are not inside tag and there still is another tag to parse
|
||||
$array[] = new MF_Text(html_entity_decode(substr($string, $cursor, $position_next_lt - $cursor)));
|
||||
$array[] = new
|
||||
MF_Text(
|
||||
html_entity_decode(
|
||||
substr(
|
||||
$string, $cursor, $position_next_lt - $cursor
|
||||
)
|
||||
)
|
||||
);
|
||||
$cursor = $position_next_lt + 1;
|
||||
$inside_tag = true;
|
||||
continue;
|
||||
@ -84,7 +91,14 @@ class HTML_Lexer
|
||||
// If we're already at the end, break
|
||||
if ($cursor === strlen($string)) break;
|
||||
// Create Text of rest of string
|
||||
$array[] = new MF_Text(html_entity_decode(substr($string, $cursor)));
|
||||
$array[] = new
|
||||
MF_Text(
|
||||
html_entity_decode(
|
||||
substr(
|
||||
$string, $cursor
|
||||
)
|
||||
)
|
||||
);
|
||||
break;
|
||||
} elseif ($inside_tag && $position_next_gt !== false) {
|
||||
// We are in tag and it is well formed
|
||||
@ -92,8 +106,16 @@ class HTML_Lexer
|
||||
$segment = substr($string, $cursor, $position_next_gt-$cursor);
|
||||
|
||||
// Check if it's a comment
|
||||
if (substr($segment,0,3) == '!--' && substr($segment,strlen($segment)-2,2) == '--') {
|
||||
$array[] = new MF_Comment(substr($segment,3,strlen($segment)-5));
|
||||
if (
|
||||
substr($segment,0,3) == '!--' &&
|
||||
substr($segment,strlen($segment)-2,2) == '--'
|
||||
) {
|
||||
$array[] = new
|
||||
MF_Comment(
|
||||
substr(
|
||||
$segment, 3, strlen($segment) - 5
|
||||
)
|
||||
);
|
||||
$inside_tag = false;
|
||||
$cursor = $position_next_gt + 1;
|
||||
continue;
|
||||
@ -133,7 +155,12 @@ class HTML_Lexer
|
||||
|
||||
// Grab out all the data
|
||||
$type = substr($segment, 0, $position_first_space);
|
||||
$attribute_string = trim(substr($segment, $position_first_space));
|
||||
$attribute_string =
|
||||
trim(
|
||||
substr(
|
||||
$segment, $position_first_space
|
||||
)
|
||||
);
|
||||
$attributes = $this->tokenizeAttributeString($attribute_string);
|
||||
if ($is_self_closing) {
|
||||
$array[] = new MF_EmptyTag($type, $attributes);
|
||||
@ -144,7 +171,13 @@ class HTML_Lexer
|
||||
$inside_tag = false;
|
||||
continue;
|
||||
} else {
|
||||
$array[] = new MF_Text('<' . html_entity_decode(substr($string, $cursor)));
|
||||
$array[] = new
|
||||
MF_Text(
|
||||
'<' .
|
||||
html_entity_decode(
|
||||
substr($string, $cursor)
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -189,7 +222,11 @@ class HTML_Lexer
|
||||
$position_next_space === false)) {
|
||||
//attr="asdf"
|
||||
// grab the key
|
||||
$key = trim(substr($string, $cursor, $position_next_equal - $cursor));
|
||||
$key = trim(
|
||||
substr(
|
||||
$string, $cursor, $position_next_equal - $cursor
|
||||
)
|
||||
);
|
||||
|
||||
// set cursor right after the equal sign
|
||||
$cursor = $position_next_equal + 1;
|
||||
@ -223,7 +260,9 @@ class HTML_Lexer
|
||||
|
||||
// otherwise, regular attribute
|
||||
$quote = $string{$position_next_quote};
|
||||
$position_end_quote = strpos($string, $quote, $position_next_quote + 1);
|
||||
$position_end_quote = strpos(
|
||||
$string, $quote, $position_next_quote + 1
|
||||
);
|
||||
|
||||
// check if the ending quote is missing
|
||||
if ($position_end_quote === false) {
|
||||
|
Loading…
Reference in New Issue
Block a user