diff options
author | Cash Costello <cash.costello@gmail.com> | 2012-01-09 18:53:19 -0500 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2012-01-09 18:53:19 -0500 |
commit | 66953a2148bb7a19ac79c1a4ccda2852ee87501e (patch) | |
tree | 5fceb3772a744181c5311aa157afb1a8c34aa276 /engine | |
parent | c4b49227819624b14b61e6eedbfa6779cd794d45 (diff) | |
download | elgg-66953a2148bb7a19ac79c1a4ccda2852ee87501e.tar.gz elgg-66953a2148bb7a19ac79c1a4ccda2852ee87501e.tar.bz2 |
coding standard fixes to engine
Diffstat (limited to 'engine')
-rw-r--r-- | engine/classes/ElggBatch.php | 8 | ||||
-rw-r--r-- | engine/classes/ElggEntity.php | 28 | ||||
-rw-r--r-- | engine/classes/ElggMemcache.php | 24 | ||||
-rw-r--r-- | engine/classes/ElggWidget.php | 2 | ||||
-rw-r--r-- | engine/classes/XMLRPCCall.php | 4 | ||||
-rw-r--r-- | engine/handlers/export_handler.php | 6 | ||||
-rw-r--r-- | engine/lib/actions.php | 3 | ||||
-rw-r--r-- | engine/lib/configuration.php | 2 | ||||
-rw-r--r-- | engine/lib/filestore.php | 2 | ||||
-rw-r--r-- | engine/lib/metadata.php | 16 | ||||
-rw-r--r-- | engine/lib/navigation.php | 2 | ||||
-rw-r--r-- | engine/lib/output.php | 4 | ||||
-rw-r--r-- | engine/lib/private_settings.php | 2 | ||||
-rw-r--r-- | engine/lib/users.php | 2 | ||||
-rw-r--r-- | engine/lib/views.php | 13 |
15 files changed, 50 insertions, 68 deletions
diff --git a/engine/classes/ElggBatch.php b/engine/classes/ElggBatch.php index 2a97f9ff5..3d01133fa 100644 --- a/engine/classes/ElggBatch.php +++ b/engine/classes/ElggBatch.php @@ -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; } } diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php index df87082fe..2fa8e9939 100644 --- a/engine/classes/ElggEntity.php +++ b/engine/classes/ElggEntity.php @@ -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); } diff --git a/engine/classes/ElggMemcache.php b/engine/classes/ElggMemcache.php index a54c29723..f27b017d0 100644 --- a/engine/classes/ElggMemcache.php +++ b/engine/classes/ElggMemcache.php @@ -114,27 +114,11 @@ class ElggMemcache extends ElggSharedMemoryCache { * 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. - * * @param string $key The key * * @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); } diff --git a/engine/classes/ElggWidget.php b/engine/classes/ElggWidget.php index 70eaf8a73..e703b84cb 100644 --- a/engine/classes/ElggWidget.php +++ b/engine/classes/ElggWidget.php @@ -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 { diff --git a/engine/classes/XMLRPCCall.php b/engine/classes/XMLRPCCall.php index 8eeba0c29..fd28f1e3e 100644 --- a/engine/classes/XMLRPCCall.php +++ b/engine/classes/XMLRPCCall.php @@ -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 diff --git a/engine/handlers/export_handler.php b/engine/handlers/export_handler.php index b91a037e8..aa5214c23 100644 --- a/engine/handlers/export_handler.php +++ b/engine/handlers/export_handler.php @@ -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 : diff --git a/engine/lib/actions.php b/engine/lib/actions.php index f415842ab..c6613e6d6 100644 --- a/engine/lib/actions.php +++ b/engine/lib/actions.php @@ -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"); } diff --git a/engine/lib/configuration.php b/engine/lib/configuration.php index 615063f3d..3fade8155 100644 --- a/engine/lib/configuration.php +++ b/engine/lib/configuration.php @@ -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', diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php index a13d8aa27..86f6d9baa 100644 --- a/engine/lib/filestore.php +++ b/engine/lib/filestore.php @@ -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; } diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index 352e98a61..6e1b8b39c 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -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)"; } } diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php index 956ca220a..dcbd7b397 100644 --- a/engine/lib/navigation.php +++ b/engine/lib/navigation.php @@ -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); } } diff --git a/engine/lib/output.php b/engine/lib/output.php index 65f51f854..b96cf354c 100644 --- a/engine/lib/output.php +++ b/engine/lib/output.php @@ -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; } diff --git a/engine/lib/private_settings.php b/engine/lib/private_settings.php index 386af5279..1fa9bdb66 100644 --- a/engine/lib/private_settings.php +++ b/engine/lib/private_settings.php @@ -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)"; } diff --git a/engine/lib/users.php b/engine/lib/users.php index c03052172..c38bb676e 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -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, diff --git a/engine/lib/views.php b/engine/lib/views.php index b938dd60e..85319b2d7 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -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); } |