X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ffilter%2Ffilter.module;fp=web%2Fcore%2Fmodules%2Ffilter%2Ffilter.module;h=1497aba2eee74c64064c5d468945af6f1b4a7bf8;hp=e3095346ddaa8875230d916e9bd9e1c09ee04d4d;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/filter/filter.module b/web/core/modules/filter/filter.module index e3095346d..1497aba2e 100644 --- a/web/core/modules/filter/filter.module +++ b/web/core/modules/filter/filter.module @@ -287,7 +287,7 @@ function filter_fallback_format() { * @return \Drupal\Component\Render\MarkupInterface * The filtered text. * - * @see filter_process_text() + * @see \Drupal\filter\Plugin\FilterInterface::process() * * @ingroup sanitization */ @@ -496,8 +496,8 @@ function _filter_url($text, $filter) { $valid_url_query_chars = '[a-zA-Z0-9!?\*\'@\(\);:&=\+\$\/%#\[\]\-_\.,~|]'; $valid_url_query_ending_chars = '[a-zA-Z0-9_&=#\/]'; - //full path - //and allow @ in a url, but only in the middle. Catch things like http://example.com/@user/ + // full path + // and allow @ in a url, but only in the middle. Catch things like http://example.com/@user/ $valid_url_path = '(?:(?:' . $valid_url_path_characters . '*(?:' . $valid_url_balanced_parens . $valid_url_path_characters . '*)*' . $valid_url_ending_characters . ')|(?:@' . $valid_url_path_characters . '+\/))'; // Prepare domain name pattern. @@ -729,20 +729,28 @@ function _filter_autop($text) { } } elseif (!$ignore) { - $chunk = preg_replace('|\n*$|', '', $chunk) . "\n\n"; // just to make things a little easier, pad the end + // just to make things a little easier, pad the end + $chunk = preg_replace('|\n*$|', '', $chunk) . "\n\n"; $chunk = preg_replace('|
\s*
|', "\n\n", $chunk); - $chunk = preg_replace('!(<' . $block . '[^>]*>)!', "\n$1", $chunk); // Space things out a little - $chunk = preg_replace('!()!', "$1\n\n", $chunk); // Space things out a little - $chunk = preg_replace("/\n\n+/", "\n\n", $chunk); // take care of duplicates + // Space things out a little + $chunk = preg_replace('!(<' . $block . '[^>]*>)!', "\n$1", $chunk); + // Space things out a little + $chunk = preg_replace('!()!', "$1\n\n", $chunk); + // take care of duplicates + $chunk = preg_replace("/\n\n+/", "\n\n", $chunk); $chunk = preg_replace('/^\n|\n\s*\n$/', '', $chunk); - $chunk = '

' . preg_replace('/\n\s*\n\n?(.)/', "

\n

$1", $chunk) . "

\n"; // make paragraphs, including one at the end - $chunk = preg_replace("|

(|", "$1", $chunk); // problem with nested lists + // make paragraphs, including one at the end + $chunk = '

' . preg_replace('/\n\s*\n\n?(.)/', "

\n

$1", $chunk) . "

\n"; + // problem with nested lists + $chunk = preg_replace("|

(|", "$1", $chunk); $chunk = preg_replace('|

]*)>|i', "

", $chunk); $chunk = str_replace('

', '

', $chunk); - $chunk = preg_replace('|

\s*

\n?|', '', $chunk); // under certain strange conditions it could create a P of entirely whitespace + // under certain strange conditions it could create a P of entirely whitespace + $chunk = preg_replace('|

\s*

\n?|', '', $chunk); $chunk = preg_replace('!

\s*(]*>)!', "$1", $chunk); $chunk = preg_replace('!(]*>)\s*

!', "$1", $chunk); - $chunk = preg_replace('|(?)\s*\n|', "
\n", $chunk); // make line breaks + // make line breaks + $chunk = preg_replace('|(?)\s*\n|', "
\n", $chunk); $chunk = preg_replace('!(]*>)\s*
!', "$1", $chunk); $chunk = preg_replace('!
(\s*)!', '$1', $chunk); $chunk = preg_replace('/&([^#])(?![A-Za-z0-9]{1,8};)/', '&$1', $chunk);