From c13f548c43aac69f121363ffafc77a6571a71df1 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 26 Mar 2011 15:51:35 +0000 Subject: some light standardization of the core libraries git-svn-id: http://code.elgg.org/elgg/trunk@8843 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/output.php | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'engine/lib/output.php') diff --git a/engine/lib/output.php b/engine/lib/output.php index 7a38e5b8c..8c2a3d50d 100644 --- a/engine/lib/output.php +++ b/engine/lib/output.php @@ -59,7 +59,7 @@ function autop($pee, $br = 1) { $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee); $pee = preg_replace('!()!', "$1\n\n", $pee); $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines - if ( strpos($pee, ']*)>\s*|', "", $pee); // no pee inside object/embed $pee = preg_replace('|\s*\s*|', '', $pee); } @@ -238,25 +238,22 @@ function elgg_normalize_url($url) { // '#target', '?query=string' if (preg_match("#^(\#|\?|(https?:)?//)#i", $url)) { return $url; - } - // 'javascript:' - elseif (stripos($url, 'javascript:') === 0) { + } elseif (stripos($url, 'javascript:') === 0) { + // 'javascript:' return $url; - } - // 'install.php', 'install.php?step=step' - elseif (preg_match("#^[^/]*\.php(\?.*)?$#i", $url)) { - return elgg_get_site_url().$url; - } + } elseif (preg_match("#^[^/]*\.php(\?.*)?$#i", $url)) { + // 'install.php', 'install.php?step=step' + return elgg_get_site_url() . $url; - // 'example.com', 'example.com/subpage' - elseif (preg_match("#^[^/]*\.#i", $url)) { + } elseif (preg_match("#^[^/]*\.#i", $url)) { + // 'example.com', 'example.com/subpage' return "http://$url"; - } - // 'page/handler', 'mod/plugin/file.php' - else { + } else { + // 'page/handler', 'mod/plugin/file.php' + // trim off any leading / because the site URL is stored // with a trailing / return elgg_get_site_url() . ltrim($url, '/'); -- cgit v1.2.3