aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Clay <steve@mrclay.org>2013-02-04 20:55:04 -0500
committerCash Costello <cash.costello@gmail.com>2013-02-09 08:10:40 -0500
commit78e0ec583619cbb728cbe03df857c8219acaac7e (patch)
tree785ec0f364fa5f42b1bf5c82dbbf2d7d88cddf27
parentf416d7ba66000d485260a8e63962541afa248320 (diff)
downloadelgg-78e0ec583619cbb728cbe03df857c8219acaac7e.tar.gz
elgg-78e0ec583619cbb728cbe03df857c8219acaac7e.tar.bz2
simplify flow, style
-rw-r--r--engine/classes/ElggAttributeLoader.php8
-rw-r--r--engine/lib/annotations.php2
-rw-r--r--engine/lib/entities.php21
-rw-r--r--engine/lib/notification.php2
-rw-r--r--engine/lib/objects.php2
-rw-r--r--engine/lib/plugins.php2
-rw-r--r--engine/lib/users.php4
7 files changed, 21 insertions, 20 deletions
diff --git a/engine/classes/ElggAttributeLoader.php b/engine/classes/ElggAttributeLoader.php
index 602bb8bae..2d1c1abde 100644
--- a/engine/classes/ElggAttributeLoader.php
+++ b/engine/classes/ElggAttributeLoader.php
@@ -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) {
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index 3d94a1d55..a95aba8f8 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -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) {
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 0361ae195..e3535c741 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -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);
+ }
}
}
}
diff --git a/engine/lib/notification.php b/engine/lib/notification.php
index 4191407fc..d72b1352a 100644
--- a/engine/lib/notification.php
+++ b/engine/lib/notification.php
@@ -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;
diff --git a/engine/lib/objects.php b/engine/lib/objects.php
index 81b6b7f12..ff3cc733f 100644
--- a/engine/lib/objects.php
+++ b/engine/lib/objects.php
@@ -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,
));
}
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php
index 973ca4026..d6f03c795 100644
--- a/engine/lib/plugins.php
+++ b/engine/lib/plugins.php
@@ -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');
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 7365a6b68..c4e06895d 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -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()) {