]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
coding standard fixes to engine
authorCash Costello <cash.costello@gmail.com>
Mon, 9 Jan 2012 23:53:19 +0000 (18:53 -0500)
committerCash Costello <cash.costello@gmail.com>
Mon, 9 Jan 2012 23:53:19 +0000 (18:53 -0500)
15 files changed:
engine/classes/ElggBatch.php
engine/classes/ElggEntity.php
engine/classes/ElggMemcache.php
engine/classes/ElggWidget.php
engine/classes/XMLRPCCall.php
engine/handlers/export_handler.php
engine/lib/actions.php
engine/lib/configuration.php
engine/lib/filestore.php
engine/lib/metadata.php
engine/lib/navigation.php
engine/lib/output.php
engine/lib/private_settings.php
engine/lib/users.php
engine/lib/views.php

index 2a97f9ff51cdc5b001991019cb6815b6720e4648..3d01133fa0c7b48155f5d089a8e89eda093d27f8 100644 (file)
@@ -236,13 +236,11 @@ class ElggBatch
                        }
 
                        // if original limit < chunk size, set limit to original limit
+                       // else if the number of results we'll fetch if greater than the original limit
                        if ($this->limit < $this->chunkSize) {
                                $limit = $this->limit;
-                       }
-
-                       // if the number of results we'll fetch is greater than the original limit,
-                       // set the limit to the number of results remaining in the original limit
-                       elseif ($this->retrievedResults + $this->chunkSize > $this->limit) {
+                       } elseif ($this->retrievedResults + $this->chunkSize > $this->limit) {
+                               // set the limit to the number of results remaining in the original limit
                                $limit = $this->limit - $this->retrievedResults;
                        }
                }
index df87082fe084a62adf174445dd3e51d23b1f4ba3..2fa8e99393de55524e927480c82c4cebddfe6d12 100644 (file)
@@ -1583,36 +1583,36 @@ abstract class ElggEntity extends ElggData implements
                foreach ($this->attributes as $k => $v) {
                        $meta = NULL;
 
-                       if (in_array( $k, $exportable_values)) {
+                       if (in_array($k, $exportable_values)) {
                                switch ($k) {
-                                       case 'guid' :                   // Dont use guid in OpenDD
-                                       case 'type' :                   // Type and subtype already taken care of
-                                       case 'subtype' :
-                                       break;
+                                       case 'guid'                   // Dont use guid in OpenDD
+                                       case 'type'                   // Type and subtype already taken care of
+                                       case 'subtype':
+                                               break;
 
-                                       case 'time_created' :   // Created = published
+                                       case 'time_created'   // Created = published
                                                $odd->setAttribute('published', date("r", $v));
-                                       break;
+                                               break;
 
-                                       case 'site_guid' : // Container
+                                       case 'site_guid':       // Container
                                                $k = 'site_uuid';
                                                $v = guid_to_uuid($v);
                                                $meta = new ODDMetaData($uuid . "attr/$k/", $uuid, $k, $v);
-                                       break;
+                                               break;
 
-                                       case 'container_guid' : // Container
+                                       case 'container_guid' // Container
                                                $k = 'container_uuid';
                                                $v = guid_to_uuid($v);
                                                $meta = new ODDMetaData($uuid . "attr/$k/", $uuid, $k, $v);
-                                       break;
+                                               break;
 
-                                       case 'owner_guid' :                     // Convert owner guid to uuid, this will be stored in metadata
+                                       case 'owner_guid'                     // Convert owner guid to uuid, this will be stored in metadata
                                                $k = 'owner_uuid';
                                                $v = guid_to_uuid($v);
                                                $meta = new ODDMetaData($uuid . "attr/$k/", $uuid, $k, $v);
-                                       break;
+                                               break;
 
-                                       default :
+                                       default:
                                                $meta = new ODDMetaData($uuid . "attr/$k/", $uuid, $k, $v);
                                }
 
index a54c29723af356808cd4b878f50bb52b0b5d1b7f..f27b017d0802aac9742e2f6b43f31638ff7f4ad1 100644 (file)
@@ -110,22 +110,6 @@ class ElggMemcache extends ElggSharedMemoryCache {
                $this->expires = $expires;
        }
 
-       /**
-        * Combine a key with the namespace.
-        * Memcache can only accept <250 char key. If the given key is too long it is shortened.
-        *
-        * @deprecated 1.8 Use ElggMemcache::_makeMemcacheKey()
-        *
-        * @param string $key The key
-        *
-        * @return string The new key.
-        */
-       private function make_memcache_key($key) {
-               elgg_deprecated_notice('ElggMemcache::make_memcache_key() is deprecated by ::_makeMemcacheKey()', 1.8);
-
-               return $this->_makeMemcacheKey($key);
-       }
-
        /**
         * Combine a key with the namespace.
         * Memcache can only accept <250 char key. If the given key is too long it is shortened.
@@ -134,7 +118,7 @@ class ElggMemcache extends ElggSharedMemoryCache {
         *
         * @return string The new key.
         */
-       private function _makeMemcacheKey($key) {
+       private function makeMemcacheKey($key) {
                $prefix = $this->getNamespace() . ":";
 
                if (strlen($prefix . $key) > 250) {
@@ -154,7 +138,7 @@ class ElggMemcache extends ElggSharedMemoryCache {
         * @return bool
         */
        public function save($key, $data, $expires = null) {
-               $key = $this->_makeMemcacheKey($key);
+               $key = $this->makeMemcacheKey($key);
 
                if ($expires === null) {
                        $expires = $this->expires;
@@ -178,7 +162,7 @@ class ElggMemcache extends ElggSharedMemoryCache {
         * @return mixed
         */
        public function load($key, $offset = 0, $limit = null) {
-               $key = $this->_makeMemcacheKey($key);
+               $key = $this->makeMemcacheKey($key);
 
                $result = $this->memcache->get($key);
                if ($result === false) {
@@ -196,7 +180,7 @@ class ElggMemcache extends ElggSharedMemoryCache {
         * @return bool
         */
        public function delete($key) {
-               $key = $this->_makeMemcacheKey($key);
+               $key = $this->makeMemcacheKey($key);
 
                return $this->memcache->delete($key, 0);
        }
index 70eaf8a73e6ab4b7846a49ac78eec31b9b48dec0..e703b84cb5d23f9580c05c6a73941028f489847b 100644 (file)
@@ -133,7 +133,7 @@ class ElggWidget extends ElggObject {
                if ($rank == 0) {
                        // top of the column
                        $this->order = $widgets[0]->order - 10;
-               } elseif ($rank == (count($widgets)-1)) {
+               } elseif ($rank == (count($widgets) - 1)) {
                        // bottom of the column
                        $this->order = end($widgets)->order + 10;
                } else {
index 8eeba0c290f591edfc00a453523a2e88bffcad60..fd28f1e3ed13115410925bfca298e3cc449382c1 100644 (file)
@@ -18,7 +18,7 @@ class XMLRPCCall {
         * @param string $xml XML
         */
        function __construct($xml) {
-               $this->_parse($xml);
+               $this->parse($xml);
        }
 
        /**
@@ -45,7 +45,7 @@ class XMLRPCCall {
         *
         * @return void
         */
-       private function _parse($xml) {
+       private function parse($xml) {
                $xml = xml_to_object($xml);
 
                // sanity check
index b91a037e8d4f818edea05f9968056e2a8204ba86..aa5214c2342219f5a572eb05ce00d3fde8b96fa5 100644 (file)
@@ -72,8 +72,10 @@ if (($guid != "") && ($type == "") && ($id_or_name == "")) {
                        $r = get_relationship($id_or_name);
                        break;
                case 'volatile' :
-                       $m = elgg_trigger_plugin_hook('volatile', 'metadata',
-                               array('guid' => $guid, 'varname' => $id_or_name));
+                       $m = elgg_trigger_plugin_hook('volatile', 'metadata', array(
+                               'guid' => $guid,
+                               'varname' => $id_or_name,
+                       ));
                        break;
 
                default :
index f415842ab7bd230c273a5458252d2381ce0e76e2..c6613e6d6c863445f35c4abc898500b062cb4b85 100644 (file)
@@ -459,8 +459,7 @@ function ajax_forward_hook($hook, $type, $reason, $params) {
                // however some browsers will not accept the JSON MIME type.
                if (stripos($_SERVER['HTTP_ACCEPT'], 'application/json') === FALSE) {
                        header("Content-type: text/plain");
-               }
-               else {
+               } else {
                        header("Content-type: application/json");
                }
 
index 615063f3dd1cebd3122bac84770355d5b6f2e22a..3fade8155a3c92f7aa5b5302fa68f23d65423293 100644 (file)
@@ -555,7 +555,7 @@ function set_default_config() {
                'path'                  =>      "$install_root/",
                'view_path'             =>      "$install_root/views/",
                'plugins_path'  =>      "$install_root/mod/",
-               'wwwroot'               =>      $www_root,
+               'wwwroot'               =>      $www_root,
                'url'                   =>      $www_root,
                'site_name'             =>      'New Elgg site',
                'language'              =>      'en',
index a13d8aa27d23e52fa798d5e61db4cce41359c385..86f6d9baaa4351936636b2c1ef969ab2209e1a65 100644 (file)
@@ -18,7 +18,7 @@
  */
 function get_dir_size($dir, $totalsize = 0) {
        $handle = @opendir($dir);
-       while ($file = @readdir ($handle)) {
+       while ($file = @readdir($handle)) {
                if (eregi("^\.{1,2}$", $file)) {
                        continue;
                }
index 352e98a61adbfd6b5648d96e2b87c7ec0501f7ff..6e1b8b39cfbe0f19b0745c0a10ff500c9222b87b 100644 (file)
@@ -402,15 +402,15 @@ function elgg_enable_metadata(array $options) {
  */
 function elgg_get_entities_from_metadata(array $options = array()) {
        $defaults = array(
-               'metadata_names'                                        =>      ELGG_ENTITIES_ANY_VALUE,
-               'metadata_values'                                       =>      ELGG_ENTITIES_ANY_VALUE,
-               'metadata_name_value_pairs'                     =>      ELGG_ENTITIES_ANY_VALUE,
+               'metadata_names'                     => ELGG_ENTITIES_ANY_VALUE,
+               'metadata_values'                    => ELGG_ENTITIES_ANY_VALUE,
+               'metadata_name_value_pairs'          => ELGG_ENTITIES_ANY_VALUE,
 
-               'metadata_name_value_pairs_operator'=>  'AND',
-               'metadata_case_sensitive'                       =>      TRUE,
-               'order_by_metadata'                                     =>      array(),
+               'metadata_name_value_pairs_operator' => 'AND',
+               'metadata_case_sensitive'            => TRUE,
+               'order_by_metadata'                  => array(),
 
-               'metadata_owner_guids'                          =>      ELGG_ENTITIES_ANY_VALUE,
+               'metadata_owner_guids'               => ELGG_ENTITIES_ANY_VALUE,
        );
 
        $options = array_merge($defaults, $options);
@@ -633,7 +633,7 @@ $owner_guids = NULL) {
                        $i++;
                }
 
-               if ($where = implode (" $pair_operator ", $pair_wheres)) {
+               if ($where = implode(" $pair_operator ", $pair_wheres)) {
                        $wheres[] = "($where)";
                }
        }
index 956ca220aaf704dfccee4b27d2eb04ade76a6ec8..dcbd7b397cafbc6ca6f788d3c8326291acacd2cc 100644 (file)
@@ -301,7 +301,7 @@ function elgg_site_menu_setup($hook, $type, $return, $params) {
                // if only one item on more menu, stick it with the rest
                $num_menu_items = count($return['default']);
                if ($num_menu_items > ($max_display_items + 1)) {
-                       $return['more'] =  array_splice($return['default'], $max_display_items);
+                       $return['more'] = array_splice($return['default'], $max_display_items);
                }
        }
 
index 65f51f854ee3190b0ee16356df17c5ae99c6a816..b96cf354cf37d6f96cae062cdc807a329a3ec3a8 100644 (file)
@@ -67,7 +67,7 @@ function autop($pee, $br = 1) {
        $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
        $pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
        $pee = preg_replace('!<p>([^<]+)\s*?(</(?:div|address|form)[^>]*>)!', "<p>$1</p>$2", $pee);
-       $pee = preg_replace( '|<p>|', "$1<p>", $pee );
+       $pee = preg_replace('|<p>|', "$1<p>", $pee);
        $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
        $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
        $pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);
@@ -85,7 +85,7 @@ function autop($pee, $br = 1) {
        //      mind the space between the ? and >.  Only there because of the comment.
        //      $pee = preg_replace_callback('!(<pre.*? >)(.*?)</pre>!is', 'clean_pre', $pee );
        //}
-       $pee = preg_replace( "|\n</p>$|", '</p>', $pee );
+       $pee = preg_replace("|\n</p>$|", '</p>', $pee);
 
        return $pee;
 }
index 386af5279a517995807854656b39c816c9695fac..1fa9bdb664f93ac497a041d72462d0575ce06f41 100644 (file)
@@ -240,7 +240,7 @@ $pairs = NULL, $pair_operator = 'AND', $name_prefix = '') {
                        $i++;
                }
 
-               $where = implode (" $pair_operator ", $pair_wheres);
+               $where = implode(" $pair_operator ", $pair_wheres);
                if ($where) {
                        $wheres[] = "($where)";
                }
index c030521720eeafd1e7ca7a216a1ecf66fbed5789..c38bb676e61ff3a1051376d4df8c2505de58f15b 100644 (file)
@@ -1486,7 +1486,7 @@ function users_pagesetup() {
        if ($viewer) {
                elgg_register_menu_item('topbar', array(
                        'name' => 'profile',
-                       'href' =>  $viewer->getURL(),
+                       'href' => $viewer->getURL(),
                        'text' => elgg_view('output/img', array(
                                'src' => $viewer->getIconURL('topbar'),
                                'alt' => $viewer->name,
index b938dd60e20cc120cf2c917f6650c6a59c965885..85319b2d7305591578e842145c789cd3b75acc14 100644 (file)
@@ -415,7 +415,6 @@ function elgg_view($view, $vars = array(), $bypass = false, $debug = false, $vie
        if (isset($vars['internalname']) && !isset($vars['__ignoreInternalname']) && !isset($vars['name'])) {
                elgg_deprecated_notice('You should pass $vars[\'name\'] now instead of $vars[\'internalname\']', 1.8, 2);
                $vars['name'] = $vars['internalname'];
-               $test=false;
        } elseif (isset($vars['name'])) {
                if (!isset($vars['internalname'])) {
                        $vars['__ignoreInternalname'] = '';
@@ -1628,12 +1627,12 @@ function elgg_views_boot() {
        // set default icon sizes - can be overridden in settings.php or with plugin
        if (!elgg_get_config('icon_sizes')) {
                $icon_sizes = array(
-                       'topbar' => array('w'=>16, 'h'=>16, 'square'=>TRUE, 'upscale'=>TRUE),
-                       'tiny' => array('w'=>25, 'h'=>25, 'square'=>TRUE, 'upscale'=>TRUE),
-                       'small' => array('w'=>40, 'h'=>40, 'square'=>TRUE, 'upscale'=>TRUE),
-                       'medium' => array('w'=>100, 'h'=>100, 'square'=>TRUE, 'upscale'=>TRUE),
-                       'large' => array('w'=>200, 'h'=>200, 'square'=>FALSE, 'upscale'=>FALSE),
-                       'master' => array('w'=>550, 'h'=>550, 'square'=>FALSE, 'upscale'=>FALSE),
+                       'topbar' => array('w' => 16, 'h' => 16, 'square' => TRUE, 'upscale' => TRUE),
+                       'tiny' => array('w' => 25, 'h' => 25, 'square' => TRUE, 'upscale' => TRUE),
+                       'small' => array('w' => 40, 'h' => 40, 'square' => TRUE, 'upscale' => TRUE),
+                       'medium' => array('w' => 100, 'h' => 100, 'square' => TRUE, 'upscale' => TRUE),
+                       'large' => array('w' => 200, 'h' => 200, 'square' => FALSE, 'upscale' => FALSE),
+                       'master' => array('w' => 550, 'h' => 550, 'square' => FALSE, 'upscale' => FALSE),
                );
                elgg_set_config('icon_sizes', $icon_sizes);
        }