]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
simplify flow, style
authorSteve Clay <steve@mrclay.org>
Tue, 5 Feb 2013 01:55:04 +0000 (20:55 -0500)
committerCash Costello <cash.costello@gmail.com>
Sat, 9 Feb 2013 13:10:40 +0000 (08:10 -0500)
engine/classes/ElggAttributeLoader.php
engine/lib/annotations.php
engine/lib/entities.php
engine/lib/notification.php
engine/lib/objects.php
engine/lib/plugins.php
engine/lib/users.php

index 602bb8bae048e8b194c2c2915e4c027e5903abcf..2d1c1abdedbe617da7313b0d4c8ac40bb1092200 100644 (file)
@@ -148,11 +148,11 @@ class ElggAttributeLoader {
                                if (!is_callable($this->primary_loader)) {
                                        throw new LogicException('Primary attribute loader must be callable');
                                }
-                               if (!$this->requires_access_control) {
+                               if ($this->requires_access_control) {
+                                       $fetched = (array) call_user_func($this->primary_loader, $row['guid']);
+                               } else {
                                        $ignoring_access = elgg_set_ignore_access();
-                               }
-                               $fetched = (array) call_user_func($this->primary_loader, $row['guid']);
-                               if (!$this->requires_access_control) {
+                                       $fetched = (array) call_user_func($this->primary_loader, $row['guid']);
                                        elgg_set_ignore_access($ignoring_access);
                                }
                                if (!$fetched) {
index 3d94a1d55f1586ae5b181dee2d62aa703d9c1f9b..a95aba8f87a68eb38b0d645b38b3ed09e6fb6279 100644 (file)
@@ -469,7 +469,7 @@ function export_annotation_plugin_hook($hook, $entity_type, $returnvalue, $param
 
        $result = elgg_get_annotations(array(
                'guid' => $guid,
-               'limit' => 0
+               'limit' => 0,
        ));
 
        if ($result) {
index 0361ae1957c9854832bcc76ac3508cbab0b30244..e3535c7417df5d1f3033fbf23c4a3ebdacb91f5a 100644 (file)
@@ -1120,16 +1120,17 @@ function _elgg_fetch_entities_from_sql($sql) {
        // Do secondary queries and merge rows
        if ($lookup_types) {
                $dbprefix = elgg_get_config('dbprefix');
-       }
-       foreach ($lookup_types as $type => $guids) {
-               $set = "(" . implode(',', $guids) . ")";
-               $sql = "SELECT * FROM {$dbprefix}{$type}s_entity WHERE guid IN $set";
-               $secondary_rows = get_data($sql);
-               if ($secondary_rows) {
-                       foreach ($secondary_rows as $secondary_row) {
-                               $key = $guid_to_key[$secondary_row->guid];
-                               // cast to arrays to merge then cast back
-                               $rows[$key] = (object)array_merge((array)$rows[$key], (array)$secondary_row);
+
+               foreach ($lookup_types as $type => $guids) {
+                       $set = "(" . implode(',', $guids) . ")";
+                       $sql = "SELECT * FROM {$dbprefix}{$type}s_entity WHERE guid IN $set";
+                       $secondary_rows = get_data($sql);
+                       if ($secondary_rows) {
+                               foreach ($secondary_rows as $secondary_row) {
+                                       $key = $guid_to_key[$secondary_row->guid];
+                                       // cast to arrays to merge then cast back
+                                       $rows[$key] = (object)array_merge((array)$rows[$key], (array)$secondary_row);
+                               }
                        }
                }
        }
index 4191407fcf0f7a453ff791844f19408146f8c2e7..d72b1352a4551b1779deeef6234cdc08f2723705 100644 (file)
@@ -264,7 +264,7 @@ array $params = NULL) {
        $to = $to->email;
 
        // From
-       $site = get_entity($CONFIG->site_guid);
+       $site = elgg_get_site_entity();
        // If there's an email address, use it - but only if its not from a user.
        if (!($from instanceof ElggUser) && $from->email) {
                $from = $from->email;
index 81b6b7f12ab83569e6f4f701f479382bbb140888..ff3cc733f077d17db16c87509782f88c3b7bca9f 100644 (file)
@@ -95,7 +95,7 @@ function get_object_sites($object_guid, $limit = 10, $offset = 0) {
                'relationship_guid' => $object_guid,
                'type' => 'site',
                'limit' => $limit,
-               'offset' => $offset
+               'offset' => $offset,
        ));
 }
 
index 973ca40269982f681149adfb4084492255230fc1..d6f03c7958b24424e15ea75c3970e70835d0af4f 100644 (file)
@@ -139,7 +139,7 @@ function elgg_generate_plugin_entities() {
                        $index = $id_map[$plugin_id];
                        $plugin = $known_plugins[$index];
                        // was this plugin deleted and its entity disabled?
-                       if ($plugin->enabled != 'yes') {
+                       if (!$plugin->isEnabled()) {
                                $plugin->enable();
                                $plugin->deactivate();
                                $plugin->setPriority('last');
index 7365a6b681872ddbfaffd8c3763feeea43131707..c4e06895dc35f439de6c1bd1a462d640362dc695 100644 (file)
@@ -1071,10 +1071,10 @@ function collections_submenu_items() {
  * @return bool
  * @access private
  */
-function friends_page_handler($page_elements, $handler) {
+function friends_page_handler($segments, $handler) {
        elgg_set_context('friends');
        
-       if (isset($page_elements[0]) && $user = get_user_by_username($page_elements[0])) {
+       if (isset($segments[0]) && $user = get_user_by_username($segments[0])) {
                elgg_set_page_owner_guid($user->getGUID());
        }
        if (elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) {