]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
more coding standard fixes
authorcash <cash.costello@gmail.com>
Fri, 15 Mar 2013 15:18:05 +0000 (11:18 -0400)
committercash <cash.costello@gmail.com>
Fri, 15 Mar 2013 15:18:05 +0000 (11:18 -0400)
15 files changed:
engine/classes/ElggEntity.php
engine/classes/ElggGroup.php
engine/classes/ElggMenuBuilder.php
engine/classes/ElggObject.php
engine/classes/ElggSite.php
engine/classes/ElggTranslit.php
engine/classes/ElggUser.php
engine/lib/configuration.php
engine/lib/elgglib.php
engine/lib/languages.php
engine/lib/location.php
engine/lib/metadata.php
engine/lib/plugins.php
engine/lib/relationships.php
engine/lib/views.php

index f44e730237c40a39a48c3b5170e32608274cd58e..5a63c7b151d2ffacda929ab9744c570a5da83e6f 100644 (file)
@@ -375,12 +375,11 @@ abstract class ElggEntity extends ElggData implements
                        }
 
                        return $result;
-               }
-
-               // unsaved entity. store in temp array
-               // returning single entries instead of an array of 1 element is decided in
-               // getMetaData(), just like pulling from the db.
-               else {
+               } else {
+                       // unsaved entity. store in temp array
+                       // returning single entries instead of an array of 1 element is decided in
+                       // getMetaData(), just like pulling from the db.
+                       // 
                        // if overwrite, delete first
                        if (!$multiple || !isset($this->temp_metadata[$name])) {
                                $this->temp_metadata[$name] = array();
index 61f699f1aec5f7e827dd7eb103f7f21956ffdedd..7ab0bfa48a968d1743a0353a350c531b15c8fefc 100644 (file)
@@ -48,21 +48,18 @@ class ElggGroup extends ElggEntity
                                        $msg = elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid->guid));
                                        throw new IOException($msg);
                                }
-
-                       // Is $guid is an ElggGroup? Use a copy constructor
                        } else if ($guid instanceof ElggGroup) {
+                               // $guid is an ElggGroup so this is a copy constructor
                                elgg_deprecated_notice('This type of usage of the ElggGroup constructor was deprecated. Please use the clone method.', 1.7);
 
                                foreach ($guid->attributes as $key => $value) {
                                        $this->attributes[$key] = $value;
                                }
-
-                       // Is this is an ElggEntity but not an ElggGroup = ERROR!
                        } else if ($guid instanceof ElggEntity) {
+                               // @todo why separate from else
                                throw new InvalidParameterException(elgg_echo('InvalidParameterException:NonElggGroup'));
-
-                       // Is it a GUID
                        } else if (is_numeric($guid)) {
+                               // $guid is a GUID so load entity
                                if (!$this->load($guid)) {
                                        throw new IOException(elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid)));
                                }
index 639e347557079e30d00ef2a759ab9e4e45492624..198018f3ce2cc83ecee8ce508f625ee39dd17edf 100644 (file)
@@ -235,8 +235,8 @@ class ElggMenuBuilder {
        /**
         * Compare two menu items by their display text
         *
-        * @param ElggMenuItem $a
-        * @param ElggMenuItem $b
+        * @param ElggMenuItem $a Menu item
+        * @param ElggMenuItem $b Menu item
         * @return bool
         */
        public static function compareByText($a, $b) {
@@ -253,8 +253,8 @@ class ElggMenuBuilder {
        /**
         * Compare two menu items by their identifiers
         *
-        * @param ElggMenuItem $a
-        * @param ElggMenuItem $b
+        * @param ElggMenuItem $a Menu item
+        * @param ElggMenuItem $b Menu item
         * @return bool
         */
        public static function compareByName($a, $b) {
@@ -271,8 +271,8 @@ class ElggMenuBuilder {
        /**
         * Compare two menu items by their priority
         *
-        * @param ElggMenuItem $a
-        * @param ElggMenuItem $b
+        * @param ElggMenuItem $a Menu item
+        * @param ElggMenuItem $b Menu item
         * @return bool
         *
         * @todo change name to compareByPriority
index 6263f84f63860f22d2854154742d594628a7e6ce..3cb76ffaf067e114d4fc0ca89560a41c32cbd220 100644 (file)
@@ -66,21 +66,18 @@ class ElggObject extends ElggEntity {
                                        $msg = elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid->guid));
                                        throw new IOException($msg);
                                }
-
-                       // Is $guid is an ElggObject? Use a copy constructor
                        } else if ($guid instanceof ElggObject) {
+                               // $guid is an ElggObject so this is a copy constructor
                                elgg_deprecated_notice('This type of usage of the ElggObject constructor was deprecated. Please use the clone method.', 1.7);
 
                                foreach ($guid->attributes as $key => $value) {
                                        $this->attributes[$key] = $value;
                                }
-
-                       // Is this is an ElggEntity but not an ElggObject = ERROR!
                        } else if ($guid instanceof ElggEntity) {
+                               // @todo remove - do not need separate exception
                                throw new InvalidParameterException(elgg_echo('InvalidParameterException:NonElggObject'));
-
-                       // Is it a GUID
                        } else if (is_numeric($guid)) {
+                               // $guid is a GUID so load
                                if (!$this->load($guid)) {
                                        throw new IOException(elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid)));
                                }
index 1a34df195bdff12310376097b3e9d58dc271125a..deba5087ec851cea35f9b5c6acc3311f04eb7b72 100644 (file)
@@ -77,28 +77,24 @@ class ElggSite extends ElggEntity {
                                        $msg = elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid->guid));
                                        throw new IOException($msg);
                                }
-
-                       // Is $guid is an ElggSite? Use a copy constructor
                        } else if ($guid instanceof ElggSite) {
+                               // $guid is an ElggSite so this is a copy constructor
                                elgg_deprecated_notice('This type of usage of the ElggSite constructor was deprecated. Please use the clone method.', 1.7);
 
                                foreach ($guid->attributes as $key => $value) {
                                        $this->attributes[$key] = $value;
                                }
-
-                       // Is this is an ElggEntity but not an ElggSite = ERROR!
                        } else if ($guid instanceof ElggEntity) {
+                               // @todo remove and just use else clause
                                throw new InvalidParameterException(elgg_echo('InvalidParameterException:NonElggSite'));
-
-                       // See if this is a URL
                        } else if (strpos($guid, "http") !== false) {
+                               // url so retrieve by url
                                $guid = get_site_by_url($guid);
                                foreach ($guid->attributes as $key => $value) {
                                        $this->attributes[$key] = $value;
                                }
-
-                       // Is it a GUID
                        } else if (is_numeric($guid)) {
+                               // $guid is a GUID so load
                                if (!$this->load($guid)) {
                                        throw new IOException(elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid)));
                                }
index 79116fc018eb42c726aa821b234e1227f463a578..601965c11ad9e427667a7d0d8c6abf6e5e8e97c8 100644 (file)
@@ -58,15 +58,15 @@ class ElggTranslit {
                // remove all ASCII except 0-9a-zA-Z, hyphen, underscore, and whitespace
                // note: "x" modifier did not work with this pattern.
                $string = preg_replace('~['
-                       . '\x00-\x08'  # control chars
-                       . '\x0b\x0c'   # vert tab, form feed
-                       . '\x0e-\x1f'  # control chars
-                       . '\x21-\x2c'  # ! ... ,
-                       . '\x2e\x2f'   # . slash
-                       . '\x3a-\x40'  # : ... @
-                       . '\x5b-\x5e'  # [ ... ^
-                       . '\x60'       # `
-                       . '\x7b-\x7f'  # { ... DEL
+                       . '\x00-\x08'  // control chars
+                       . '\x0b\x0c'   // vert tab, form feed
+                       . '\x0e-\x1f'  // control chars
+                       . '\x21-\x2c'  // ! ... ,
+                       . '\x2e\x2f'   // . slash
+                       . '\x3a-\x40'  // : ... @
+                       . '\x5b-\x5e'  // [ ... ^
+                       . '\x60'       // `
+                       . '\x7b-\x7f'  // { ... DEL
                        . ']~', '', $string);
                $string = strtr($string, '', '');
 
@@ -80,10 +80,10 @@ class ElggTranslit {
                // note: we cannot use [^0-9a-zA-Z] because that matches multibyte chars.
                // note: "x" modifier did not work with this pattern.
                $pattern = '~['
-                       . '\x00-\x2f'  # controls ... slash
-                       . '\x3a-\x40'  # : ... @
-                       . '\x5b-\x60'  # [ ... `
-                       . '\x7b-\x7f'  # { ... DEL
+                       . '\x00-\x2f'  // controls ... slash
+                       . '\x3a-\x40'  // : ... @
+                       . '\x5b-\x60'  // [ ... `
+                       . '\x7b-\x7f'  // { ... DEL
                        . ']+~x';
 
                // ['internationalization', 'and', '日本語']
index 6c1cdc1de33c0121be63f653cf6c0cea9db3a04d..b80065b272193b8223765d870e68e06fc6222da1 100644 (file)
@@ -65,30 +65,26 @@ class ElggUser extends ElggEntity
                                        $msg = elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid->guid));
                                        throw new IOException($msg);
                                }
-
-                       // See if this is a username
                        } else if (is_string($guid)) {
+                               // $guid is a username
                                $user = get_user_by_username($guid);
                                if ($user) {
                                        foreach ($user->attributes as $key => $value) {
                                                $this->attributes[$key] = $value;
                                        }
                                }
-
-                       // Is $guid is an ElggUser? Use a copy constructor
                        } else if ($guid instanceof ElggUser) {
+                               // $guid is an ElggUser so this is a copy constructor
                                elgg_deprecated_notice('This type of usage of the ElggUser constructor was deprecated. Please use the clone method.', 1.7);
 
                                foreach ($guid->attributes as $key => $value) {
                                        $this->attributes[$key] = $value;
                                }
-
-                       // Is this is an ElggEntity but not an ElggUser = ERROR!
                        } else if ($guid instanceof ElggEntity) {
+                               // @todo why have a special case here
                                throw new InvalidParameterException(elgg_echo('InvalidParameterException:NonElggUser'));
-
-                       // Is it a GUID
                        } else if (is_numeric($guid)) {
+                               // $guid is a GUID so load entity
                                if (!$this->load($guid)) {
                                        throw new IOException(elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid)));
                                }
index a0f297f0c628fba01d037c55ab24cc7cc9253190..55e5bbd36c9f26f344781406493a33d7e82da5e2 100644 (file)
@@ -486,9 +486,9 @@ function get_config($name, $site_guid = 0) {
        // @todo these haven't really been implemented in Elgg 1.8. Complete in 1.9.
        // show dep message
        if ($new_name) {
-       //      $msg = "Config value $name has been renamed as $new_name";
+               //      $msg = "Config value $name has been renamed as $new_name";
                $name = $new_name;
-       //      elgg_deprecated_notice($msg, $dep_version);
+               //      elgg_deprecated_notice($msg, $dep_version);
        }
 
        // decide from where to return the value
index 74b70f9fb7cf76e7bf4709cbf447ddb6db82bad2..281b23535f946571f0bff350b98dc258da179c2d 100644 (file)
@@ -1383,8 +1383,8 @@ function elgg_http_build_url(array $parts, $html_encode = TRUE) {
  * add tokens to the action.  The form view automatically handles
  * tokens.
  *
- * @param string  $url         Full action URL
- * @param bool $html_encode HTML encode the url? (default: false)
+ * @param string $url         Full action URL
+ * @param bool   $html_encode HTML encode the url? (default: false)
  *
  * @return string URL with action tokens
  * @since 1.7.0
@@ -1446,7 +1446,7 @@ function elgg_http_remove_url_query_element($url, $element) {
  * Adds an element or elements to a URL's query string.
  *
  * @param string $url      The URL
- * @param array $elements Key/value pairs to add to the URL
+ * @param array  $elements Key/value pairs to add to the URL
  *
  * @return string The new URL with the query strings added
  * @since 1.7.0
index 17db14d98926a161db3688995b0e0b4e2efa343f..61ba91ddbca59166fd3c62a7112de824a733824f 100644 (file)
@@ -139,6 +139,9 @@ function get_language() {
        return false;
 }
 
+/**
+ * @access private
+ */
 function _elgg_load_translations() {
        global $CONFIG;
 
index b319bb3bb613628c086bf7a79aa9c2b5d1342128..1534c7d7ba0baf1fb58a7c593727783cda70e002 100644 (file)
@@ -139,7 +139,7 @@ function elgg_get_entities_from_location(array $options = array()) {
 /**
  * Returns a viewable list of entities from location
  *
- * @param array $options
+ * @param array $options Options array
  *
  * @see elgg_list_entities()
  * @see elgg_get_entities_from_location()
index 305e9918b9f51abe6c33538a0833f88fef0f78d7..a1ebfa5f1b66216d8a37a2498d1697fbd134f3e5 100644 (file)
@@ -920,8 +920,8 @@ function elgg_get_metadata_cache() {
  * Invalidate the metadata cache based on options passed to various *_metadata functions
  *
  * @param string $action  Action performed on metadata. "delete", "disable", or "enable"
- *
- * @param array $options  Options passed to elgg_(delete|disable|enable)_metadata
+ * @param array  $options Options passed to elgg_(delete|disable|enable)_metadata
+ * @return void
  */
 function elgg_invalidate_metadata_cache($action, array $options) {
        // remove as little as possible, optimizing for common cases
index f281b141607147812094a1e2a1bc81b518434a43..6fc000cf93d92b3330356c9ddb8cd84d36b389b7 100644 (file)
@@ -865,7 +865,7 @@ function elgg_set_plugin_user_setting($name, $value, $user_guid = null, $plugin_
  * Unsets a user-specific plugin setting
  *
  * @param string $name      Name of the setting
- * @param int $user_guid Defaults to logged in user
+ * @param int    $user_guid Defaults to logged in user
  * @param string $plugin_id Defaults to contextual plugin name
  *
  * @return bool
index fe0b8364d04af64f275f47f32b35e9b7bd6bf769..b0cd627fc10547de69c2626b7d19918409ad68da 100644 (file)
@@ -363,7 +363,7 @@ $relationship_guid = NULL, $inverse_relationship = FALSE) {
 /**
  * Returns a viewable list of entities by relationship
  *
- * @param array $options
+ * @param array $options Options array for retrieval of entities
  *
  * @see elgg_list_entities()
  * @see elgg_get_entities_from_relationship()
index 7d83478637d94ceeffab8ac522e171b72e69c22f..c4b349fc6d6d99a4a30981aa31fb34c4bedefc3e 100644 (file)
@@ -1107,7 +1107,7 @@ function elgg_view_entity_annotations(ElggEntity $entity, $full_view = true) {
  * This is a shortcut for {@elgg_view page/elements/title}.
  *
  * @param string $title The page title
- * @param array $vars   View variables (was submenu be displayed? (deprecated))
+ * @param array  $vars  View variables (was submenu be displayed? (deprecated))
  *
  * @return string The HTML (etc)
  */
@@ -1179,7 +1179,7 @@ function elgg_view_comments($entity, $add_comment = true, array $vars = array())
  *
  * @param string $image The icon and other information
  * @param string $body  Description content
- * @param array $vars   Additional parameters for the view
+ * @param array  $vars  Additional parameters for the view
  *
  * @return string
  * @since 1.8.0
@@ -1236,15 +1236,17 @@ function elgg_view_river_item($item, array $vars = array()) {
                // subject is disabled or subject/object deleted
                return '';
        }
+
+       // @todo this needs to be cleaned up
        // Don't hide objects in closed groups that a user can see.
        // see http://trac.elgg.org/ticket/4789
-//     else {
-//             // hide based on object's container
-//             $visibility = ElggGroupItemVisibility::factory($object->container_guid);
-//             if ($visibility->shouldHideItems) {
-//                     return '';
-//             }
-//     }
+       //      else {
+       //              // hide based on object's container
+       //              $visibility = ElggGroupItemVisibility::factory($object->container_guid);
+       //              if ($visibility->shouldHideItems) {
+       //                      return '';
+       //              }
+       //      }
 
        $vars['item'] = $item;