From a50a1937ca193ca10553e93c609351a396fe4942 Mon Sep 17 00:00:00 2001
From: ben
\s*
|', "\n\n", $pee);
+ // Space things out a little
+ $allblocks = '(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr)';
+ $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee);
+ $pee = preg_replace('!(' . $allblocks . '>)!', "$1\n\n", $pee);
+ $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
+ if ( strpos($pee, '
\s*(?' . $allblocks . '[^>]*>)!', "$1", $pee); + $pee = preg_replace('!(?' . $allblocks . '[^>]*>)\s*
!', "$1", $pee); + if ($br) { + $pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', create_function('$matches', 'return str_replace("\n", ")(.*?)!is', 'clean_pre', $pee ); + $pee = preg_replace( "|\n$|", '', $pee ); + + return $pee; + } + function input_init() { global $CONFIG; $CONFIG->allowedtags = array ('address' => array (), 'a' => array ('href' => array (), 'title' => array (), 'rel' => array (), 'rev' => array (), 'name' => array ()), 'abbr' => array ('title' => array ()), 'acronym' => array ('title' => array ()), 'b' => array (), 'big' => array (), 'blockquote' => array ('cite' => array ()), 'br' => array (), 'button' => array ('disabled' => array (), 'name' => array (), 'type' => array (), 'value' => array ()), 'caption' => array ('align' => array ()), 'code' => array (), 'col' => array ('align' => array (), 'char' => array (), 'charoff' => array (), 'span' => array (), 'valign' => array (), 'width' => array ()), 'del' => array ('datetime' => array ()), 'dd' => array (), 'div' => array ('align' => array ()), 'dl' => array (), 'dt' => array (), 'em' => array (), 'fieldset' => array (), 'font' => array ('color' => array (), 'face' => array (), 'size' => array ()), 'form' => array ('action' => array (), 'accept' => array (), 'accept-charset' => array (), 'enctype' => array (), 'method' => array (), 'name' => array (), 'target' => array ()), 'h1' => array ('align' => array ()), 'h2' => array ('align' => array ()), 'h3' => array ('align' => array ()), 'h4' => array ('align' => array ()), 'h5' => array ('align' => array ()), 'h6' => array ('align' => array ()), 'hr' => array ('align' => array (), 'noshade' => array (), 'size' => array (), 'width' => array ()), 'i' => array (), 'img' => array ('alt' => array (), 'align' => array (), 'border' => array (), 'height' => array (), 'hspace' => array (), 'longdesc' => array (), 'vspace' => array (), 'src' => array (), 'width' => array ()), 'ins' => array ('datetime' => array (), 'cite' => array ()), 'kbd' => array (), 'label' => array ('for' => array ()), 'legend' => array ('align' => array ()), 'li' => array (), 'p' => array ('align' => array ()), 'pre' => array ('width' => array ()), 'q' => array ('cite' => array ()), 's' => array (), 'strike' => array (), 'strong' => array (), 'sub' => array (), 'sup' => array (), 'table' => array ('align' => array (), 'bgcolor' => array (), 'border' => array (), 'cellpadding' => array (), 'cellspacing' => array (), 'rules' => array (), 'summary' => array (), 'width' => array ()), 'tbody' => array ('align' => array (), 'char' => array (), 'charoff' => array (), 'valign' => array ()), 'td' => array ('abbr' => array (), 'align' => array (), 'axis' => array (), 'bgcolor' => array (), 'char' => array (), 'charoff' => array (), 'colspan' => array (), 'headers' => array (), 'height' => array (), 'nowrap' => array (), 'rowspan' => array (), 'scope' => array (), 'valign' => array (), 'width' => array ()), 'textarea' => array ('cols' => array (), 'rows' => array (), 'disabled' => array (), 'name' => array (), 'readonly' => array ()), 'tfoot' => array ('align' => array (), 'char' => array (), 'charoff' => array (), 'valign' => array ()), 'th' => array ('abbr' => array (), 'align' => array (), 'axis' => array (), 'bgcolor' => array (), 'char' => array (), 'charoff' => array (), 'colspan' => array (), 'headers' => array (), 'height' => array (), 'nowrap' => array (), 'rowspan' => array (), 'scope' => array (), 'valign' => array (), 'width' => array ()), 'thead' => array ('align' => array (), 'char' => array (), 'charoff' => array (), 'valign' => array ()), 'title' => array (), 'tr' => array ('align' => array (), 'bgcolor' => array (), 'char' => array (), 'charoff' => array (), 'valign' => array ()), 'tt' => array (), 'u' => array (), 'ul' => array (), 'ol' => array (), 'var' => array () ); diff --git a/mod/profile/views/default/profile/userdetails.php b/mod/profile/views/default/profile/userdetails.php index de9169922..0a6427afa 100644 --- a/mod/profile/views/default/profile/userdetails.php +++ b/mod/profile/views/default/profile/userdetails.php @@ -121,7 +121,7 @@
description); ?>
description); ?>
" . nl2br(elgg_echo("admin:description")) . "
"; + echo "" . autop(elgg_echo("admin:description")) . "
"; diff --git a/views/default/admin/plugins.php b/views/default/admin/plugins.php index b4339f83a..b680bc039 100644 --- a/views/default/admin/plugins.php +++ b/views/default/admin/plugins.php @@ -12,7 +12,7 @@ */ // Description of what's going on - echo "" . nl2br(elgg_echo("admin:plugins:description")) . "
"; + echo "" . autop(elgg_echo("admin:plugins:description")) . "
"; $limit = get_input('limit', 10); $offset = get_input('offset', 0); diff --git a/views/default/admin/site.php b/views/default/admin/site.php index 8792431c2..202f493d5 100644 --- a/views/default/admin/site.php +++ b/views/default/admin/site.php @@ -14,7 +14,7 @@ global $CONFIG; // Description of what's going on - echo "" . nl2br(elgg_echo("admin:site:description")) . "
"; + echo "" . autop(elgg_echo("admin:site:description")) . "
"; echo elgg_view("settings/system",array("action" => $CONFIG->wwwroot."action/admin/site/update_basic")); // Always want to do this first. ?> \ No newline at end of file diff --git a/views/default/admin/statistics.php b/views/default/admin/statistics.php index 4c2035f0d..f79812b51 100644 --- a/views/default/admin/statistics.php +++ b/views/default/admin/statistics.php @@ -12,6 +12,6 @@ global $CONFIG; - echo "" . nl2br(elgg_echo("admin:statistics:description")) . "
"; + echo "" . autop(elgg_echo("admin:statistics:description")) . "
"; ?> \ No newline at end of file diff --git a/views/default/admin/user.php b/views/default/admin/user.php index 2e5445628..d3d80e6f7 100644 --- a/views/default/admin/user.php +++ b/views/default/admin/user.php @@ -12,7 +12,7 @@ */ // Description of what's going on - echo "" . nl2br(elgg_echo("admin:user:description")) . "
"; + echo "" . autop(elgg_echo("admin:user:description")) . "
"; echo elgg_view("admin/user_opt/adduser"); diff --git a/views/default/messages/errors/error.php b/views/default/messages/errors/error.php index 078e25949..ddcd0009c 100644 --- a/views/default/messages/errors/error.php +++ b/views/default/messages/errors/error.php @@ -16,5 +16,5 @@ ?>- +
\ No newline at end of file diff --git a/views/default/messages/exceptions/exception.php b/views/default/messages/exceptions/exception.php index 8df557b48..f56927123 100644 --- a/views/default/messages/exceptions/exception.php +++ b/views/default/messages/exceptions/exception.php @@ -21,7 +21,7 @@ getMessage()); + echo autop($vars['object']->getMessage()); ?> @@ -32,7 +32,7 @@ diff --git a/views/default/messages/messages/message.php b/views/default/messages/messages/message.php index 1622c29e8..355afeb15 100644 --- a/views/default/messages/messages/message.php +++ b/views/default/messages/messages/message.php @@ -16,5 +16,5 @@ ?>- +
\ No newline at end of file diff --git a/views/default/output/longtext.php b/views/default/output/longtext.php index 88c8a925c..85ab99fd4 100644 --- a/views/default/output/longtext.php +++ b/views/default/output/longtext.php @@ -15,5 +15,5 @@ * */ - echo nl2br($vars['value']); + echo autop($vars['value']); ?> \ No newline at end of file diff --git a/views/default/settings/install.php b/views/default/settings/install.php index 8de795da4..17d263349 100644 --- a/views/default/settings/install.php +++ b/views/default/settings/install.php @@ -12,7 +12,7 @@ * */ - echo "" . nl2br(elgg_echo("installation:settings:description")) . "
"; + echo "" . autop(elgg_echo("installation:settings:description")) . "
"; echo elgg_view("settings/system",array("action" => "action/systemsettings/install")); diff --git a/views/default/usersettings/main.php b/views/default/usersettings/main.php index 1b0ed11e8..22bbc8e8f 100644 --- a/views/default/usersettings/main.php +++ b/views/default/usersettings/main.php @@ -12,5 +12,5 @@ */ // Description of what's going on - echo "" . nl2br(elgg_echo("usersettings:description")) . "
"; + echo "" . autop(elgg_echo("usersettings:description")) . "
"; ?> \ No newline at end of file diff --git a/views/default/usersettings/plugins.php b/views/default/usersettings/plugins.php index 730950178..70dfc5e14 100644 --- a/views/default/usersettings/plugins.php +++ b/views/default/usersettings/plugins.php @@ -11,7 +11,7 @@ */ // Description of what's going on - echo "" . nl2br(elgg_echo("usersettings:plugins:description")) . "
"; + echo "" . autop(elgg_echo("usersettings:plugins:description")) . "
"; $limit = get_input('limit', 10); $offset = get_input('offset', 0); diff --git a/views/default/usersettings/statistics.php b/views/default/usersettings/statistics.php index f01e48bc8..8ab6712c6 100644 --- a/views/default/usersettings/statistics.php +++ b/views/default/usersettings/statistics.php @@ -12,5 +12,5 @@ global $CONFIG; - echo "" . nl2br(elgg_echo("usersettings:statistics:description")) . "
"; + echo "" . autop(elgg_echo("usersettings:statistics:description")) . "
"; ?> \ No newline at end of file diff --git a/views/failsafe/messages/exceptions/exception.php b/views/failsafe/messages/exceptions/exception.php index c8c630f3b..0b280107f 100644 --- a/views/failsafe/messages/exceptions/exception.php +++ b/views/failsafe/messages/exceptions/exception.php @@ -21,7 +21,7 @@ getMessage()); + echo autop($vars['object']->getMessage()); ?> @@ -32,7 +32,7 @@ diff --git a/views/failsafe/messages/sanitisation/htaccess.php b/views/failsafe/messages/sanitisation/htaccess.php index 99bfe4159..bca1b3243 100644 --- a/views/failsafe/messages/sanitisation/htaccess.php +++ b/views/failsafe/messages/sanitisation/htaccess.php @@ -12,6 +12,6 @@ * @link http://elgg.org/ */ - echo nl2br(elgg_echo('installation:error:htaccess')); + echo autop(elgg_echo('installation:error:htaccess')); ?> \ No newline at end of file diff --git a/views/failsafe/messages/sanitisation/settings.php b/views/failsafe/messages/sanitisation/settings.php index 798bfbd91..e4ea720a8 100644 --- a/views/failsafe/messages/sanitisation/settings.php +++ b/views/failsafe/messages/sanitisation/settings.php @@ -24,7 +24,7 @@ else { - echo nl2br(elgg_echo('installation:error:settings')); + echo autop(elgg_echo('installation:error:settings')); ?>