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 +++++++++++-------------- engine/lib/users.php | 10 +--------- engine/lib/views.php | 12 +++++++----- engine/lib/widgets.php | 7 ++++--- 4 files changed, 23 insertions(+), 31 deletions(-) (limited to 'engine/lib') 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, '/'); diff --git a/engine/lib/users.php b/engine/lib/users.php index 6733c9d3e..987762576 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1075,14 +1075,6 @@ function collections_submenu_items() { 'text' => elgg_echo('friends:collections'), 'href' => "collections/$user->username", )); -/* - elgg_register_menu_item('page', array( - 'name' => 'friends:collections:add', - 'text' => elgg_echo('friends:collections:add'), - 'href' => "collections/add", - )); - * - */ } /** @@ -1244,7 +1236,7 @@ function user_create_hook_add_site_relationship($event, $object_type, $object) { * @param string $hook * @param string $entity_type * @param string $returnvalue - * @param array $params + * @param array $params * @return string */ function user_avatar_hook($hook, $entity_type, $returnvalue, $params) { diff --git a/engine/lib/views.php b/engine/lib/views.php index ff308171f..d3d790f8b 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1216,8 +1216,8 @@ function elgg_view_form($action, $form_vars = array(), $body_vars = array()) { /** * View an item in a list * - * @param object $item ElggEntity or ElggAnnotation - * @param array $vars Additional parameters for the rendering + * @param object $item ElggEntity or ElggAnnotation + * @param array $vars Additional parameters for the rendering * * @return string * @since 1.8.0 @@ -1247,9 +1247,9 @@ function elgg_view_list_item($item, array $vars = array()) { * * Shorthand for * - * @param string $type The specific icon to display + * @param string $name The specific icon to display * - * @returns string The html for displaying an icon + * @return string The html for displaying an icon */ function elgg_view_icon($name) { return ""; @@ -1447,12 +1447,14 @@ function elgg_views_register_core_head_elements() { /** * Add the rss link to the extras when if needed + * + * @return void */ function elgg_views_add_rss_link() { global $autofeed; if (isset($autofeed) && $autofeed == true) { $url = full_url(); - if (substr_count($url,'?')) { + if (substr_count($url, '?')) { $url .= "&view=rss"; } else { $url .= "?view=rss"; diff --git a/engine/lib/widgets.php b/engine/lib/widgets.php index 21fbbcad9..b20f92f74 100644 --- a/engine/lib/widgets.php +++ b/engine/lib/widgets.php @@ -52,9 +52,10 @@ function elgg_get_widgets($user_guid, $context) { /** * Create a new widget instance * - * @param int $entity_guid GUID of entity that owns this widget - * @param string $handler The handler for this widget - * @param int $access_id If not specified, it is set to the default access level + * @param int $owner_guid GUID of entity that owns this widget + * @param string $handler The handler for this widget + * @param string $context The context for this widget + * @param int $access_id If not specified, it is set to the default access level * * @return int|false Widget GUID or false on failure * @since 1.8.0 -- cgit v1.2.3