diff options
Diffstat (limited to 'engine/classes')
-rw-r--r-- | engine/classes/ElggBatch.php | 8 | ||||
-rw-r--r-- | engine/classes/ElggCache.php | 6 | ||||
-rw-r--r-- | engine/classes/ElggEntity.php | 28 | ||||
-rw-r--r-- | engine/classes/ElggExtender.php | 11 | ||||
-rw-r--r-- | engine/classes/ElggMemcache.php | 24 | ||||
-rw-r--r-- | engine/classes/ElggMenuBuilder.php | 10 | ||||
-rw-r--r-- | engine/classes/ElggMenuItem.php | 22 | ||||
-rw-r--r-- | engine/classes/ElggMetadata.php | 7 | ||||
-rw-r--r-- | engine/classes/ElggPlugin.php | 6 | ||||
-rw-r--r-- | engine/classes/ElggPluginPackage.php | 2 | ||||
-rw-r--r-- | engine/classes/ElggRiverItem.php | 23 | ||||
-rw-r--r-- | engine/classes/ElggSite.php | 4 | ||||
-rw-r--r-- | engine/classes/ElggUser.php | 21 | ||||
-rw-r--r-- | engine/classes/ElggWidget.php | 3 | ||||
-rw-r--r-- | engine/classes/ODDDocument.php | 2 | ||||
-rw-r--r-- | engine/classes/ODDEntity.php | 72 | ||||
-rw-r--r-- | engine/classes/ODDMetaData.php | 39 | ||||
-rw-r--r-- | engine/classes/ODDRelationship.php | 33 | ||||
-rw-r--r-- | engine/classes/SuccessResult.php | 2 | ||||
-rw-r--r-- | engine/classes/XMLRPCCall.php | 4 |
20 files changed, 161 insertions, 166 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/ElggCache.php b/engine/classes/ElggCache.php index dd53525b8..4317f4be9 100644 --- a/engine/classes/ElggCache.php +++ b/engine/classes/ElggCache.php @@ -191,8 +191,8 @@ abstract class ElggCache implements ArrayAccess { * * @see ArrayAccess::offsetSet() * - * @param mixed $key The key (offset) to assign the value to. - * @param mixed $value The value to set. + * @param mixed $key The key (offset) to assign the value to. + * @param mixed $value The value to set. * * @return void */ @@ -205,7 +205,7 @@ abstract class ElggCache implements ArrayAccess { * * @see ArrayAccess::offsetGet() * - * @param mixed $offset The key (offset) to retrieve. + * @param mixed $key The key (offset) to retrieve. * * @return mixed */ 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/ElggExtender.php b/engine/classes/ElggExtender.php index bc2d67ae2..d94bad837 100644 --- a/engine/classes/ElggExtender.php +++ b/engine/classes/ElggExtender.php @@ -24,8 +24,15 @@ * @property mixed $value The value of the extender (int or string) * @property int $time_created A UNIX timestamp of when the extender was created (read-only, set on first save) */ -abstract class ElggExtender extends ElggData -{ +abstract class ElggExtender extends ElggData { + + /** + * (non-PHPdoc) + * + * @see ElggData::initializeAttributes() + * + * @return void + */ protected function initializeAttributes() { parent::initializeAttributes(); 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/ElggMenuBuilder.php b/engine/classes/ElggMenuBuilder.php index cadfee7f5..de0017599 100644 --- a/engine/classes/ElggMenuBuilder.php +++ b/engine/classes/ElggMenuBuilder.php @@ -4,8 +4,7 @@ * * @package Elgg.Core * @subpackage Navigation - * - * @since 1.8.0 + * @since 1.8.0 */ class ElggMenuBuilder { @@ -16,16 +15,16 @@ class ElggMenuBuilder { /** * ElggMenuBuilder constructor * - * @param string $name Identifier of the menu + * @param array $menu Array of ElggMenuItem objects */ - public function __construct($menu) { + public function __construct(array $menu) { $this->menu = $menu; } /** * Get a prepared menu array * - * @param mixed $sort_by + * @param mixed $sort_by Method to sort the menu by. @see ElggMenuBuilder::sort() * @return array */ public function getMenu($sort_by = 'text') { @@ -80,6 +79,7 @@ class ElggMenuBuilder { /** * Group the menu items into sections + * * @return void */ protected function setupSections() { diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php index 62547134a..4bc9144d4 100644 --- a/engine/classes/ElggMenuItem.php +++ b/engine/classes/ElggMenuItem.php @@ -2,12 +2,11 @@ /** * Elgg Menu Item * - * @package Elgg.Core - * @subpackage Navigation - * * To create a menu item that is not a link, pass false for $href. * - * @since 1.8.0 + * @package Elgg.Core + * @subpackage Navigation + * @since 1.8.0 */ class ElggMenuItem { @@ -70,9 +69,9 @@ class ElggMenuItem { /** * ElggMenuItem constructor * - * @param string $name Identifier of the menu item - * @param string $text Display text of the menu item - * @param string $href URL of the menu item (false if not a link) + * @param string $name Identifier of the menu item + * @param string $text Display text of the menu item + * @param string $href URL of the menu item (false if not a link) */ public function __construct($name, $text, $href) { //$this->name = $name; @@ -182,7 +181,7 @@ class ElggMenuItem { /** * Set the identifier of the menu item * - * @param string Unique identifier + * @param string $name Unique identifier * @return void */ public function setName($name) { @@ -491,7 +490,7 @@ class ElggMenuItem { /** * Set the parent menu item * - * @param ElggMenuItem $parent + * @param ElggMenuItem $parent The parent of this menu item * @return void */ public function setParent($parent) { @@ -510,7 +509,7 @@ class ElggMenuItem { /** * Add a child menu item * - * @param ElggMenuItem $item + * @param ElggMenuItem $item A child menu item * @return void */ public function addChild($item) { @@ -549,9 +548,8 @@ class ElggMenuItem { /** * Get the menu item content (usually a link) * - * @params array $vars Options to pass to output/url if a link + * @param array $vars Options to pass to output/url if a link * @return string - * * @todo View code in a model. How do we feel about that? */ public function getContent(array $vars = array()) { diff --git a/engine/classes/ElggMetadata.php b/engine/classes/ElggMetadata.php index 32e7b32f1..634a122e5 100644 --- a/engine/classes/ElggMetadata.php +++ b/engine/classes/ElggMetadata.php @@ -9,6 +9,13 @@ */ class ElggMetadata extends ElggExtender { + /** + * (non-PHPdoc) + * + * @see ElggData::initializeAttributes() + * + * @return void + */ protected function initializeAttributes() { parent::initializeAttributes(); diff --git a/engine/classes/ElggPlugin.php b/engine/classes/ElggPlugin.php index c4d6ec034..33f14ae37 100644 --- a/engine/classes/ElggPlugin.php +++ b/engine/classes/ElggPlugin.php @@ -707,9 +707,9 @@ class ElggPlugin extends ElggObject { * @throws PluginException */ public function start($flags) { -// if (!$this->canActivate()) { -// return false; -// } + //if (!$this->canActivate()) { + // return false; + //} // include classes if ($flags & ELGG_PLUGIN_REGISTER_CLASSES) { diff --git a/engine/classes/ElggPluginPackage.php b/engine/classes/ElggPluginPackage.php index d240af477..2dc4bdb3d 100644 --- a/engine/classes/ElggPluginPackage.php +++ b/engine/classes/ElggPluginPackage.php @@ -303,6 +303,8 @@ class ElggPluginPackage { /** * Returns an array of present and readable text files + * + * @return array */ public function getTextFilenames() { return $this->textFiles; diff --git a/engine/classes/ElggRiverItem.php b/engine/classes/ElggRiverItem.php index 8fef6bb9d..d3d09cd91 100644 --- a/engine/classes/ElggRiverItem.php +++ b/engine/classes/ElggRiverItem.php @@ -5,19 +5,18 @@ * @package Elgg.Core * @subpackage Core * - * @property int $id The unique identifier (read-only) - * @property int $subject_guid The GUID of the actor - * @property int $object_guid The GUID of the object - * @property int $annotation_id The ID of the annotation involved in the action - * @property string $type The type of one of the entities involved in the action - * @property string $subtype The subtype of one of the entities involved in the action - * @property string $action_type The name of the action - * @property string $view The view for displaying this river item - * @property int $access_id The visibility of the river item - * @property int $posted UNIX timestamp when the action occurred + * @property int $id The unique identifier (read-only) + * @property int $subject_guid The GUID of the actor + * @property int $object_guid The GUID of the object + * @property int $annotation_id The ID of the annotation involved in the action + * @property string $type The type of one of the entities involved in the action + * @property string $subtype The subtype of one of the entities involved in the action + * @property string $action_type The name of the action + * @property string $view The view for displaying this river item + * @property int $access_id The visibility of the river item + * @property int $posted UNIX timestamp when the action occurred */ -class ElggRiverItem -{ +class ElggRiverItem { public $id; public $subject_guid; public $object_guid; diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php index 7ea52a195..b13683a56 100644 --- a/engine/classes/ElggSite.php +++ b/engine/classes/ElggSite.php @@ -196,7 +196,7 @@ class ElggSite extends ElggEntity { * * @note You cannot disable the current site. * - * @param string $reason Optional reason for disabling + * @param string $reason Optional reason for disabling * @param bool $recursive Recursively disable all contained entities? * * @return bool @@ -219,7 +219,7 @@ class ElggSite extends ElggEntity { * accepted by elgg_get_entities(). Common parameters * include 'limit', and 'offset'. * Note: this was $limit before version 1.8 - * @param int $offset Offset @deprecated parameter + * @param int $offset Offset @deprecated parameter * * @todo remove $offset in 2.0 * diff --git a/engine/classes/ElggUser.php b/engine/classes/ElggUser.php index ab0610ac0..bdf57c2c3 100644 --- a/engine/classes/ElggUser.php +++ b/engine/classes/ElggUser.php @@ -105,7 +105,7 @@ class ElggUser extends ElggEntity * * @param int $guid ElggUser GUID * - * @return true|false + * @return bool */ protected function load($guid) { // Test to see if we have the generic stuff @@ -141,7 +141,7 @@ class ElggUser extends ElggEntity /** * Saves this user to the database. * - * @return true|false + * @return bool */ public function save() { // Save generic stuff @@ -261,7 +261,7 @@ class ElggUser extends ElggEntity * @param int $limit The number of results to return * @param int $offset Any indexing offset * - * @return bool + * @return array */ function getSites($subtype = "", $limit = 10, $offset = 0) { return get_user_sites($this->getGUID(), $subtype, $limit, $offset); @@ -272,7 +272,7 @@ class ElggUser extends ElggEntity * * @param int $site_guid The guid of the site to add it to * - * @return true|false + * @return bool */ function addToSite($site_guid) { return add_site_user($site_guid, $this->getGUID()); @@ -283,7 +283,7 @@ class ElggUser extends ElggEntity * * @param int $site_guid The guid of the site to remove it from * - * @return true|false + * @return bool */ function removeFromSite($site_guid) { return remove_site_user($site_guid, $this->getGUID()); @@ -294,7 +294,7 @@ class ElggUser extends ElggEntity * * @param int $friend_guid The GUID of the user to add * - * @return true|false Depending on success + * @return bool */ function addFriend($friend_guid) { return user_add_friend($this->getGUID(), $friend_guid); @@ -305,7 +305,7 @@ class ElggUser extends ElggEntity * * @param int $friend_guid The GUID of the user to remove * - * @return true|false Depending on success + * @return bool */ function removeFriend($friend_guid) { return user_remove_friend($this->getGUID(), $friend_guid); @@ -314,8 +314,7 @@ class ElggUser extends ElggEntity /** * Determines whether or not this user is a friend of the currently logged in user * - * - * @return true|false + * @return bool */ function isFriend() { return $this->isFriendOf(elgg_get_logged_in_user_guid()); @@ -326,7 +325,7 @@ class ElggUser extends ElggEntity * * @param int $user_guid The GUID of the user to check against * - * @return true|false + * @return bool */ function isFriendsWith($user_guid) { return user_is_friend($this->getGUID(), $user_guid); @@ -337,7 +336,7 @@ class ElggUser extends ElggEntity * * @param int $user_guid The GUID of the user to check against * - * @return true|false + * @return bool */ function isFriendOf($user_guid) { return user_is_friend($user_guid, $this->getGUID()); diff --git a/engine/classes/ElggWidget.php b/engine/classes/ElggWidget.php index 70eaf8a73..7914fa140 100644 --- a/engine/classes/ElggWidget.php +++ b/engine/classes/ElggWidget.php @@ -116,6 +116,7 @@ class ElggWidget extends ElggObject { 'type' => 'object', 'subtype' => 'widget', 'container_guid' => $this->container_guid, + 'limit' => false, 'private_setting_name_value_pairs' => array( array('name' => 'context', 'value' => $this->getContext()), array('name' => 'column', 'value' => $column) @@ -133,7 +134,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/ODDDocument.php b/engine/classes/ODDDocument.php index 4d185aba5..540c35a3b 100644 --- a/engine/classes/ODDDocument.php +++ b/engine/classes/ODDDocument.php @@ -70,8 +70,8 @@ class ODDDocument implements Iterator { public function addElement(ODD $element) { if (!is_array($this->elements)) { $this->elements = array(); - $this->elements[] = $element; } + $this->elements[] = $element; } /** diff --git a/engine/classes/ODDEntity.php b/engine/classes/ODDEntity.php index ab3a49168..e9bb5da6a 100644 --- a/engine/classes/ODDEntity.php +++ b/engine/classes/ODDEntity.php @@ -32,75 +32,3 @@ class ODDEntity extends ODD { return "entity"; } } - -/** - * ODD Metadata class. - * - * @package Elgg.Core - * @subpackage ODD - */ -class ODDMetaData extends ODD { - - /** - * New ODD metadata - * - * @param unknown_type $uuid Unique ID - * @param unknown_type $entity_uuid Another unique ID - * @param unknown_type $name Name - * @param unknown_type $value Value - * @param unknown_type $type Type - * @param unknown_type $owner_uuid Owner ID - */ - function __construct($uuid, $entity_uuid, $name, $value, $type = "", $owner_uuid = "") { - parent::__construct(); - - $this->setAttribute('uuid', $uuid); - $this->setAttribute('entity_uuid', $entity_uuid); - $this->setAttribute('name', $name); - $this->setAttribute('type', $type); - $this->setAttribute('owner_uuid', $owner_uuid); - $this->setBody($value); - } - - /** - * Returns 'metadata' - * - * @return 'metadata' - */ - protected function getTagName() { - return "metadata"; - } -} - -/** - * ODD Relationship class. - * - * @package Elgg - * @subpackage Core - */ -class ODDRelationship extends ODD { - - /** - * New ODD Relationship - * - * @param unknown_type $uuid1 First UUID - * @param unknown_type $type Type of telationship - * @param unknown_type $uuid2 Second UUId - */ - function __construct($uuid1, $type, $uuid2) { - parent::__construct(); - - $this->setAttribute('uuid1', $uuid1); - $this->setAttribute('type', $type); - $this->setAttribute('uuid2', $uuid2); - } - - /** - * Returns 'relationship' - * - * @return 'relationship' - */ - protected function getTagName() { - return "relationship"; - } -} diff --git a/engine/classes/ODDMetaData.php b/engine/classes/ODDMetaData.php new file mode 100644 index 000000000..58862e0fb --- /dev/null +++ b/engine/classes/ODDMetaData.php @@ -0,0 +1,39 @@ +<?php +/** + * ODD Metadata class. + * + * @package Elgg.Core + * @subpackage ODD + */ +class ODDMetaData extends ODD { + + /** + * New ODD metadata + * + * @param unknown_type $uuid Unique ID + * @param unknown_type $entity_uuid Another unique ID + * @param unknown_type $name Name + * @param unknown_type $value Value + * @param unknown_type $type Type + * @param unknown_type $owner_uuid Owner ID + */ + function __construct($uuid, $entity_uuid, $name, $value, $type = "", $owner_uuid = "") { + parent::__construct(); + + $this->setAttribute('uuid', $uuid); + $this->setAttribute('entity_uuid', $entity_uuid); + $this->setAttribute('name', $name); + $this->setAttribute('type', $type); + $this->setAttribute('owner_uuid', $owner_uuid); + $this->setBody($value); + } + + /** + * Returns 'metadata' + * + * @return 'metadata' + */ + protected function getTagName() { + return "metadata"; + } +} diff --git a/engine/classes/ODDRelationship.php b/engine/classes/ODDRelationship.php new file mode 100644 index 000000000..2906b1c73 --- /dev/null +++ b/engine/classes/ODDRelationship.php @@ -0,0 +1,33 @@ +<?php +/** + * ODD Relationship class. + * + * @package Elgg + * @subpackage Core + */ +class ODDRelationship extends ODD { + + /** + * New ODD Relationship + * + * @param unknown_type $uuid1 First UUID + * @param unknown_type $type Type of telationship + * @param unknown_type $uuid2 Second UUId + */ + function __construct($uuid1, $type, $uuid2) { + parent::__construct(); + + $this->setAttribute('uuid1', $uuid1); + $this->setAttribute('type', $type); + $this->setAttribute('uuid2', $uuid2); + } + + /** + * Returns 'relationship' + * + * @return 'relationship' + */ + protected function getTagName() { + return "relationship"; + } +} diff --git a/engine/classes/SuccessResult.php b/engine/classes/SuccessResult.php index c8578a2cf..ab5468ad8 100644 --- a/engine/classes/SuccessResult.php +++ b/engine/classes/SuccessResult.php @@ -15,7 +15,7 @@ class SuccessResult extends GenericResult { * * @param string $result The result */ - public function SuccessResult($result) { + public function __construct($result) { $this->setResult($result); $this->setStatusCode(SuccessResult::$RESULT_SUCCESS); } 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 |