Skip to content
Browse files

Standardized code in all of core, not including language files, tests…

…, or core mods.

git-svn-id: http://code.elgg.org/elgg/trunk@7124 36083f99-b078-4883-b0ff-0f9b5a30f544
  • Loading branch information...
1 parent bd34844 commit 7ddd9521b3f3a397da3b0a6b56238d31414eb4be @brettp brettp committed
Showing with 3,285 additions and 1,391 deletions.
  1. +29 −2 CHANGES.txt
  2. +1 −1 _css/css.php
  3. +1 −1 _css/js.php
  4. +1 −1 actions/admin/menu_items.php
  5. +2 −1 actions/admin/plugins/simple_update_states.php
  6. +9 −7 actions/comments/add.php
  7. +1 −1 actions/email/save.php
  8. +6 −6 actions/friends/add.php
  9. +5 −8 actions/friends/addcollection.php
  10. +2 −5 actions/friends/deletecollection.php
  11. +2 −3 actions/friends/editcollection.php
  12. +3 −3 actions/friends/remove.php
  13. +5 −3 actions/likes/add.php
  14. +2 −1 actions/likes/delete.php
  15. +14 −14 actions/login.php
  16. +1 −1 actions/register.php
  17. +1 −1 actions/user/language.php
  18. +2 −2 actions/user/password.php
  19. +4 −3 actions/user/spotlight.php
  20. +7 −3 actions/useradd.php
  21. +3 −3 actions/usersettings/save.php
  22. +3 −3 actions/widgets/add.php
  23. +2 −2 actions/widgets/reorder.php
  24. +4 −4 actions/widgets/save.php
  25. +2 −1 engine/classes/APIException.php
  26. +1 −1 engine/classes/CallException.php
  27. +1 −1 engine/classes/ClassException.php
  28. +1 −1 engine/classes/ClassNotFoundException.php
  29. +1 −1 engine/classes/ConfigurationException.php
  30. +1 −1 engine/classes/CronException.php
  31. +1 −1 engine/classes/DataFormatException.php
  32. +1 −1 engine/classes/DatabaseException.php
  33. +33 −5 engine/classes/ElggAccess.php
  34. +19 −10 engine/classes/ElggAnnotation.php
  35. +99 −19 engine/classes/ElggCache.php
  36. +93 −65 engine/classes/ElggDiskFilestore.php
  37. +258 −95 engine/classes/ElggEntity.php
  38. +102 −15 engine/classes/ElggExtender.php
  39. +101 −24 engine/classes/ElggFile.php
  40. +79 −31 engine/classes/ElggFileCache.php
  41. +39 −14 engine/classes/ElggFilestore.php
  42. +142 −47 engine/classes/ElggGroup.php
  43. +18 −12 engine/classes/ElggHMACCache.php
  44. +66 −7 engine/classes/ElggMemcache.php
  45. +22 −9 engine/classes/ElggMetadata.php
  46. +47 −35 engine/classes/ElggObject.php
  47. +25 −10 engine/classes/ElggPlugin.php
  48. +105 −12 engine/classes/ElggRelationship.php
  49. +70 −14 engine/classes/ElggSession.php
  50. +8 −2 engine/classes/ElggSharedMemoryCache.php
  51. +72 −43 engine/classes/ElggSite.php
  52. +37 −6 engine/classes/ElggStaticVariableCache.php
  53. +97 −46 engine/classes/ElggUser.php
  54. +32 −5 engine/classes/ElggWidget.php
  55. +16 −5 engine/classes/ErrorResult.php
  56. +2 −2 engine/classes/ExportException.php
  57. +5 −2 engine/classes/Exportable.php
  58. +30 −9 engine/classes/Friendable.php
  59. +28 −9 engine/classes/GenericResult.php
  60. +2 −2 engine/classes/IOException.php
  61. +2 −2 engine/classes/ImportException.php
  62. +5 −1 engine/classes/Importable.php
  63. +2 −2 engine/classes/InstallationException.php
  64. +2 −2 engine/classes/InvalidClassException.php
  65. +2 −2 engine/classes/InvalidParameterException.php
  66. +16 −3 engine/classes/Locatable.php
  67. +19 −3 engine/classes/Loggable.php
  68. +4 −4 engine/classes/NotImplementedException.php
  69. +18 −7 engine/classes/Notable.php
  70. +3 −0 engine/classes/NotificationException.php
  71. +42 −4 engine/classes/ODD.php
  72. +75 −1 engine/classes/ODDDocument.php
  73. +56 −7 engine/classes/ODDEntity.php
  74. +4 −3 engine/classes/PluginException.php
  75. +1 −1 engine/classes/RegistrationException.php
  76. +4 −3 engine/classes/SecurityException.php
  77. +16 −3 engine/classes/SuccessResult.php
  78. +28 −19 engine/classes/XMLRPCArrayParameter.php
  79. +14 −9 engine/classes/XMLRPCBase64Parameter.php
  80. +21 −10 engine/classes/XMLRPCBoolParameter.php
  81. +28 −25 engine/classes/XMLRPCCall.php
  82. +18 −11 engine/classes/XMLRPCDateParameter.php
  83. +21 −10 engine/classes/XMLRPCDoubleParameter.php
  84. +12 −9 engine/classes/XMLRPCErrorResponse.php
  85. +21 −10 engine/classes/XMLRPCIntParameter.php
  86. +9 −4 engine/classes/XMLRPCParameter.php
  87. +55 −12 engine/classes/XMLRPCResponse.php
  88. +21 −10 engine/classes/XMLRPCStringParameter.php
  89. +29 −22 engine/classes/XMLRPCStructParameter.php
  90. +11 −7 engine/classes/XMLRPCSuccessResponse.php
  91. +7 −6 engine/classes/XmlElement.php
  92. +2 −2 engine/handlers/xml-rpc_handler.php
  93. +147 −84 engine/lib/access.php
  94. +29 −14 engine/lib/actions.php
  95. +37 −15 engine/lib/admin.php
  96. +330 −185 engine/lib/annotations.php
  97. +232 −125 engine/lib/api.php
  98. +176 −112 engine/lib/calendar.php
Sorry, we could not display the entire diff because it was too big.
View
31 CHANGES.txt
@@ -8,8 +8,35 @@ Version 1.8.0 (Jackie)
Generic API changes:
* Added elgg_instanceof().
* Added remove_subtype() and update_subtype().
- * Added elgg_format_url()
-
+ * Added elgg_format_url().
+ * ElggDiskFilestore supports non-user owners.
+
+ Deprecated APIs:
+ * ElggAccess::get_ignore_access() by ElggAccess::getIgnoreAccess().
+ * ElggAccess::set_ignore_access() by ElggAccess::setIgnoreAccess().
+ * ElggCache::set_variable() by ElggCache::setVariable().
+ * ElggCache::get_variable() by ElggCache::getVariable().
+ * ElggDiskFilestore::make_directory_root() by ElggDiskFilestore::makeDirectoryRoot().
+ * ElggDiskFilestore::make_file_matrix() and ElggDiskFilestore::user_file_matrix() by
+ ElggDiskFilestore::makeFileMatrix().
+ * ElggDiskFilestore::mb_string_split() removed.
+ * ElggEntity::initialise_attriutes() by ElggEntity::initializeAttributes(). Same for
+ all sub classes of ElggEntity.
+ * ElggFileCache::create_file() by ::createFile().
+ * ElggFileCache::sanitise_filename() by ::sanitizeFilename().
+ * ElggMemcache::make_memcache_key() by ::_makeMemcacheKey().
+ * ElggGroup::initialise_attributes() by ::initializeAttributes().
+ * ElggPlugin::initialise_attributes() by ::initializeAttributes().
+ * XMLRPCCall::parse() by XMLRPCCALL::_parse().
+ * __get_annotations_calculate_x() by get_annotations_calculate_x().
+ * __get_entities_from_annotations_calculate_x() by get_entities_from_annotations_calculate_x().
+ * __php_api_error_handler() by _php_api_error_handler().
+ * __php_api_exception_handler() by _php_api_exception_handler().
+ * __elgg_php_error_handler() by _elgg_php_error_handler().
+ * __elgg_php_exception_handler() by _elgg_php_exception_handler().
+ * __process_element() by _process_element().
+ * All __elgg_session_*() by _elgg_session_*().
+
UI/UX API changes:
* Added elgg_push_breadcrumb(), elgg_pop_breadcrumb(), and elgg_get_breadcrumbs().
* Added navigation/breadcrumbs.
View
2 _css/css.php
@@ -30,7 +30,7 @@
$viewinput['viewtype'] = $_GET['viewtype'];
header("Content-type: text/css", true);
-header('Expires: ' . date('r',time() + 86400000), true);
+header('Expires: ' . date('r', time() + 86400000), true);
header("Pragma: public", true);
header("Cache-Control: public", true);
View
2 _css/js.php
@@ -33,7 +33,7 @@
$viewinput['viewtype'] = $_GET['viewtype'];
header('Content-type: text/javascript');
-header('Expires: ' . date('r',time() + 864000000));
+header('Expires: ' . date('r', time() + 864000000));
header("Pragma: public");
header("Cache-Control: public");
View
2 actions/admin/menu_items.php
@@ -29,7 +29,7 @@
// save the custom items
$custom_count = count($custom_item_names);
$custom_items = array();
-for ($i=0; $i<$custom_count; $i++) {
+for ($i = 0; $i < $custom_count; $i++) {
if (isset($custom_item_names[$i]) && isset($custom_item_names[$i])) {
$name = $custom_item_names[$i];
$url = $custom_item_urls[$i];
View
3 actions/admin/plugins/simple_update_states.php
@@ -23,7 +23,8 @@
foreach ($installed_plugins as $plugin => $info) {
// this is only for simple plugins.
- if (!isset($info['manifest']['admin_interface']) || $info['manifest']['admin_interface'] != 'simple') {
+ $interface_type = elgg_get_array_value('admin_interface', $info['manifest'], NULL);
+ if (!$interface_type || $interface_type != 'simple') {
continue;
}
View
16 actions/comments/add.php
@@ -2,7 +2,8 @@
/**
* Elgg add comment action
*
- * @package Elgg
+ * @package Elgg.Core
+ * @subpackage Comments
*/
// Make sure we're logged in; forward to the front page if not
@@ -27,11 +28,11 @@
$user = get_loggedin_user();
-$annotation = create_annotation($entity->guid,
+$annotation = create_annotation($entity->guid,
'generic_comment',
- $comment_text,
- "",
- $user->guid,
+ $comment_text,
+ "",
+ $user->guid,
$entity->access_id);
// tell user annotation posted
@@ -42,7 +43,7 @@
// notify if poster wasn't owner
if ($entity->owner_guid != $user->guid) {
-
+
notify_user($entity->owner_guid,
$user->guid,
elgg_echo('generic_comment:email:subject'),
@@ -59,8 +60,9 @@
}
system_message(elgg_echo("generic_comment:posted"));
+
//add to river
-add_to_river('annotation/annotate','comment',$user->guid,$entity->guid, "", 0, $annotation);
+add_to_river('annotation/annotate', 'comment', $user->guid, $entity->guid, "", 0, $annotation);
// Forward to the page the action occurred on
forward($_SERVER['HTTP_REFERER']);
View
2 actions/email/save.php
@@ -23,7 +23,7 @@
}
if ($user) {
- if (strcmp($email, $user->email)!=0) {
+ if (strcmp($email, $user->email) != 0) {
if (!get_user_by_email($email)) {
if ($user->email != $email) {
View
12 actions/friends/add.php
@@ -2,8 +2,8 @@
/**
* Elgg add friend action
*
- * @package Elgg
- * @subpackage Core
+ * @package Elgg.Core
+ * @subpackage Friends.Management
*/
// Ensure we are logged in
@@ -21,13 +21,13 @@
$errors = true;
}
} catch (Exception $e) {
- register_error(sprintf(elgg_echo("friends:add:failure"),$friend->name));
+ register_error(sprintf(elgg_echo("friends:add:failure"), $friend->name));
$errors = true;
}
-if (!$errors){
+if (!$errors) {
// add to river
- add_to_river('friends/river/create','friend',get_loggedin_userid(),$friend_guid);
- system_message(sprintf(elgg_echo("friends:add:successful"),$friend->name));
+ add_to_river('friends/river/create', 'friend', get_loggedin_userid(), $friend_guid);
+ system_message(sprintf(elgg_echo("friends:add:successful"), $friend->name));
}
// Forward back to the page you friended the user on
View
13 actions/friends/addcollection.php
@@ -1,12 +1,9 @@
<?php
-
/**
* Elgg collection add page
*
- * @package Elgg
- * @subpackage Core
-
-
+ * @package Elgg.Core
+ * @subpackage Friends.Collections
*/
//must be logged in
@@ -16,15 +13,15 @@
$friends = get_input('friends_collection');
//first check to make sure that a collection name has been set and create the new colection
-if($collection_name){
+if ($collection_name) {
//create the collection
$create_collection = create_access_collection($collection_name, get_loggedin_userid());
//if the collection was created and the user passed some friends from the form, add them
- if($create_collection && (!empty($friends))){
+ if ($create_collection && (!empty($friends))) {
//add friends to the collection
- foreach($friends as $friend) {
+ foreach ($friends as $friend) {
add_user_to_access_collection($friend, $create_collection);
}
}
View
7 actions/friends/deletecollection.php
@@ -1,12 +1,9 @@
<?php
-
/**
* Elgg friends: delete collection action
*
- * @package Elgg
- * @subpackage Core
-
-
+ * @package Elgg.Core
+ * @subpackage Friends.Collections
*/
// Make sure we're logged in (send us to the front page if not)
View
5 actions/friends/editcollection.php
@@ -1,10 +1,9 @@
<?php
-
/**
* Elgg collection add page
*
- * @package Elgg
- * @subpackage Core
+ * @package Elgg.Core
+ * @subpackage Friends.Collections
*/
$collection_id = get_input('collection_id');
View
6 actions/friends/remove.php
@@ -2,8 +2,8 @@
/**
* Elgg remove friend action
*
- * @package Elgg
- * @subpackage Core
+ * @package Elgg.Core
+ * @subpackage Friends.Management
*/
// Ensure we are logged in
@@ -18,7 +18,7 @@
try{
if ($friend instanceof ElggUser) {
get_loggedin_user()->removeFriend($friend_guid);
- } else{
+ } else {
register_error(sprintf(elgg_echo("friends:remove:failure"), $friend->name));
$errors = true;
}
View
8 actions/likes/add.php
@@ -2,14 +2,15 @@
/**
* Elgg add like action
*
- * @package Elgg
+ * @package Elgg.Core
+ * @subpackage Likes
*/
gatekeeper();
$entity_guid = (int) get_input('guid');
//check to see if the user has already liked the item
-if (elgg_annotation_exists($entity_guid, 'likes')){
+if (elgg_annotation_exists($entity_guid, 'likes')) {
system_message(elgg_echo("likes:alreadyliked"));
forward($_SERVER['HTTP_REFERER']);
}
@@ -53,8 +54,9 @@
}
system_message(elgg_echo("likes:likes"));
+
//add to river
-add_to_river('annotation/annotatelike','likes',$user->guid,$entity->guid, "", 0, $annotation);
+add_to_river('annotation/annotatelike', 'likes', $user->guid, $entity->guid, "", 0, $annotation);
// Forward back to the page where the user 'liked' the object
forward($_SERVER['HTTP_REFERER']);
View
3 actions/likes/delete.php
@@ -2,7 +2,8 @@
/**
* Elgg delete like action
*
- * @package Elgg
+ * @package Elgg.Core
+ * @subpackage Likes
*/
// Ensure we're logged in
View
28 actions/login.php
@@ -45,20 +45,20 @@
}
} else {
register_error(elgg_echo('loginerror'));
-// // let a plugin hook say why login failed or react to it.
-// $params = array(
-// 'username' => $username,
-// 'password' => $password,
-// 'persistent' => $persistent,
-// 'user' => $user
-// );
-//
-// // Returning FALSE to this function will generate a standard
-// // "Could not log you in" message.
-// // Plugins should use this hook to provide details, and then return TRUE.
-// if (!trigger_plugin_hook('failed_login', 'user', $params, FALSE)) {
-// register_error(elgg_echo('loginerror'));
-// }
+ // // let a plugin hook say why login failed or react to it.
+ // $params = array(
+ // 'username' => $username,
+ // 'password' => $password,
+ // 'persistent' => $persistent,
+ // 'user' => $user
+ // );
+ //
+ // // Returning FALSE to this function will generate a standard
+ // // "Could not log you in" message.
+ // // Plugins should use this hook to provide details, and then return TRUE.
+ // if (!trigger_plugin_hook('failed_login', 'user', $params, FALSE)) {
+ // register_error(elgg_echo('loginerror'));
+ // }
}
forward(REFERRER);
View
2 actions/register.php
@@ -14,7 +14,7 @@
$password2 = get_input('password2');
$email = get_input('email');
$name = get_input('name');
-$friend_guid = (int) get_input('friend_guid',0);
+$friend_guid = (int) get_input('friend_guid', 0);
$invitecode = get_input('invitecode');
if ($CONFIG->allow_registration) {
View
2 actions/user/language.php
@@ -18,7 +18,7 @@
}
if (($user) && ($language)) {
- if (strcmp($language, $user->language)!=0) {
+ if (strcmp($language, $user->language) != 0) {
$user->language = $language;
if ($user->save()) {
system_message(elgg_echo('user:language:success'));
View
4 actions/user/password.php
@@ -18,8 +18,8 @@
$user = get_entity($user_id);
}
-if (($user) && ($password!="")) {
- if (strlen($password)>=4) {
+if (($user) && ($password != "")) {
+ if (strlen($password) >= 4) {
if ($password == $password2) {
$user->salt = generate_random_cleartext_password(); // Reset the salt
$user->password = generate_user_password($user, $password);
View
7 actions/user/spotlight.php
@@ -2,13 +2,14 @@
/**
* Close or open spotlight.
*
- * @package Elgg
- * @subpackage Core
+ * @package Elgg.Core
+ * @subpackage Spotlight
+ * @todo This is deprecated in 1.8
*/
gatekeeper();
-$closed = get_input('closed','true');
+$closed = get_input('closed', 'true');
if ($closed != 'true') {
$closed = false;
} else {
View
10 actions/useradd.php
@@ -25,7 +25,7 @@
try {
$guid = register_user($username, $password, $name, $email, TRUE);
- if (((trim($password) != "") && (strcmp($password, $password2)==0)) && ($guid)) {
+ if (((trim($password) != "") && (strcmp($password, $password2) == 0)) && ($guid)) {
$new_user = get_entity($guid);
if (($guid) && ($admin)) {
$new_user->makeAdmin();
@@ -35,9 +35,13 @@
$new_user->created_by_guid = get_loggedin_userid();
set_user_validation_status($new_user->getGUID(), TRUE, 'admin_created');
- notify_user($new_user->guid, $CONFIG->site->guid, elgg_echo('useradd:subject'), sprintf(elgg_echo('useradd:body'), $name, $CONFIG->site->name, $CONFIG->site->url, $username, $password));
+ $subject = elgg_echo('useradd:subject');
+ $body = sprintf(elgg_echo('useradd:body'), $name,
+ $CONFIG->site->name, $CONFIG->site->url, $username, $password);
- system_message(sprintf(elgg_echo("adduser:ok"),$CONFIG->sitename));
+ notify_user($new_user->guid, $CONFIG->site->guid, $subject, $body);
+
+ system_message(sprintf(elgg_echo("adduser:ok"), $CONFIG->sitename));
} else {
register_error(elgg_echo("adduser:bad"));
}
View
6 actions/usersettings/save.php
@@ -2,14 +2,14 @@
/**
* Aggregate action for saving settings
*
- * @package Elgg
- * @subpackage Core
+ * @package Elgg.Core
+ * @subpackage UserSettings
*/
global $CONFIG;
gatekeeper();
-trigger_plugin_hook('usersettings:save','user');
+trigger_plugin_hook('usersettings:save', 'user');
forward($_SERVER['HTTP_REFERER']);
View
6 actions/widgets/add.php
@@ -2,8 +2,8 @@
/**
* Elgg widget add action
*
- * @package Elgg
- * @subpackage Core
+ * @package Elgg.Core
+ * @subpackage Widgets.Management
*/
$guid = get_input('user');
@@ -16,7 +16,7 @@
if (!empty($guid)) {
if ($user = get_entity($guid)) {
if ($user->canEdit()) {
- $result = add_widget($user->getGUID(),$handler,$context,0,$column);
+ $result = add_widget($user->getGUID(), $handler, $context, 0, $column);
}
}
}
View
4 actions/widgets/reorder.php
@@ -2,8 +2,8 @@
/**
* Elgg widget reorder action
*
- * @package Elgg
- * @subpackage Core
+ * @package Elgg.Core
+ * @subpackage Widgets.Management
*/
$owner = get_input('owner');
View
8 actions/widgets/save.php
@@ -2,19 +2,19 @@
/**
* Elgg widget save action
*
- * @package Elgg
- * @subpackage Core
+ * @package Elgg.Core
+ * @subpackage Widgets.Management
*/
$guid = get_input('guid');
$params = $_REQUEST['params'];
$pageurl = get_input('pageurl');
-$noforward = get_input('noforward',false);
+$noforward = get_input('noforward', false);
$result = false;
if (!empty($guid)) {
- $result = save_widget_info($guid,$params);
+ $result = save_widget_info($guid, $params);
}
if ($noforward) {
View
3 engine/classes/APIException.php
@@ -1,10 +1,11 @@
<?php
+
/**
* API Exception Stub
*
* Generic parent class for API exceptions.
*
- * @package Elgg.Core
+ * @package Elgg.Core
* @subpackage Exceptions.Stub
*/
class APIException extends Exception {}
View
2 engine/classes/CallException.php
@@ -4,7 +4,7 @@
*
* Generic parent class for Call exceptions
*
- * @package Elgg.Core
+ * @package Elgg.Core
* @subpackage Exceptions.Stub
*/
class CallException extends Exception {}
View
2 engine/classes/ClassException.php
@@ -4,7 +4,7 @@
*
* A generic parent class for Class exceptions
*
- * @package Elgg.Core
+ * @package Elgg.Core
* @subpackage Exceptions.Stub
*/
class ClassException extends Exception {}
View
2 engine/classes/ClassNotFoundException.php
@@ -4,7 +4,7 @@
*
* Thrown when trying to load a class that doesn't exist.
*
- * @package Elgg.Core
+ * @package Elgg.Core
* @subpackage Exceptions
*/
class ClassNotFoundException extends ClassException {}
View
2 engine/classes/ConfigurationException.php
@@ -4,7 +4,7 @@
*
* A generic parent class for Configuration exceptions
*
- * @package Elgg
+ * @package Elgg
* @subpackage Exceptions.Stub
*/
class ConfigurationException extends Exception {}
View
2 engine/classes/CronException.php
@@ -4,7 +4,7 @@
*
* A generic parent class for cron exceptions
*
- * @package Elgg
+ * @package Elgg
* @subpackage Exceptions.Stub
*/
class CronException extends Exception {}
View
2 engine/classes/DataFormatException.php
@@ -3,7 +3,7 @@
* Data format exception
* An exception thrown when there is a problem in the format of some data.
*
- * @package Elgg.Core
+ * @package Elgg.Core
* @subpackage Exceptions.Stub
*/
class DataFormatException extends Exception {}
View
2 engine/classes/DatabaseException.php
@@ -4,7 +4,7 @@
*
* A generic parent class for database exceptions
*
- * @package Elgg.Core
+ * @package Elgg.Core
* @subpackage Exceptions.Stub
*/
class DatabaseException extends Exception {}
View
38 engine/classes/ElggAccess.php
@@ -2,11 +2,12 @@
/**
* Class used to determin if access is being ignored.
*
- * @access private
- * @todo I don't remember why this was required beyond scope concerns.
- * @see elgg_get_ignore_access()
- * @package Elgg.Core
+ * @package Elgg.Core
* @subpackage Access
+ * @access private
+ * @see elgg_get_ignore_access()
+ *
+ * @todo I don't remember why this was required beyond scope concerns.
*/
class ElggAccess {
/**
@@ -17,19 +18,46 @@ class ElggAccess {
/**
* Get current ignore access setting.
+ *
* @return bool
+ * @deprecated 1.8 Use ElggAccess::getIgnoreAccess()
*/
public function get_ignore_access() {
+ elgg_deprecated_notice('ElggAccess::get_ignore_access() is deprecated by ElggAccess::getIgnoreAccess()', 1.8);
+ return $this->getIgnoreAccess();
+ }
+
+ /**
+ * Get current ignore access setting.
+ *
+ * @return bool
+ */
+ public function getIgnoreAccess() {
return $this->ignore_access;
}
/**
* Set ignore access.
*
- * @param $ignore bool true || false to ignore
+ * @param bool $ignore Ignore access
+ *
* @return bool Previous setting
+ *
+ * @deprecated 1.8 Use ElggAccess:setIgnoreAccess()
*/
public function set_ignore_access($ignore = true) {
+ elgg_deprecated_notice('ElggAccess::set_ignore_access() is deprecated by ElggAccess::setIgnoreAccess()', 1.8);
+ return $this->setIgnoreAccess($ignore);
+ }
+
+ /**
+ * Set ignore access.
+ *
+ * @param bool $ignore Ignore access
+ *
+ * @return bool Previous setting
+ */
+ public function setIgnoreAccess($ignore = true) {
$prev = $this->ignore_access;
$this->ignore_access = $ignore;
View
29 engine/classes/ElggAnnotation.php
@@ -8,16 +8,16 @@
*
* @internal Annotations are stored in the annotations table.
*
- * @package Elgg.Core
+ * @package Elgg.Core
* @subpackage DataModel.Annotations
- * @link http://docs.elgg.org/DataModel/Annotations
+ * @link http://docs.elgg.org/DataModel/Annotations
*/
class ElggAnnotation extends ElggExtender {
/**
* Construct a new annotation, optionally from a given id value or db object.
*
- * @param mixed $id
+ * @param mixed $id The annotation ID
*/
function __construct($id = null) {
$this->attributes = array();
@@ -32,7 +32,7 @@ function __construct($id = null) {
if ($annotation) {
$objarray = (array) $annotation;
- foreach($objarray as $key => $value) {
+ foreach ($objarray as $key => $value) {
$this->attributes[$key] = $value;
}
@@ -44,7 +44,8 @@ function __construct($id = null) {
/**
* Class member get overloading
*
- * @param string $name
+ * @param string $name The name of the value to get
+ *
* @return mixed
*/
function __get($name) {
@@ -54,9 +55,10 @@ function __get($name) {
/**
* Class member set overloading
*
- * @param string $name
- * @param mixed $value
- * @return void
+ * @param string $name The name of the value to set
+ * @param mixed $value The value to set
+ *
+ * @return mixed
*/
function __set($name, $value) {
return $this->set($name, $value);
@@ -69,7 +71,8 @@ function __set($name, $value) {
*/
function save() {
if ($this->id > 0) {
- return update_annotation($this->id, $this->name, $this->value, $this->value_type, $this->owner_guid, $this->access_id);
+ return update_annotation($this->id, $this->name, $this->value, $this->value_type,
+ $this->owner_guid, $this->access_id);
} else {
$this->id = create_annotation($this->entity_guid, $this->name, $this->value,
$this->value_type, $this->owner_guid, $this->access_id);
@@ -83,6 +86,8 @@ function save() {
/**
* Delete the annotation.
+ *
+ * @return bool
*/
function delete() {
return delete_annotation($this->id);
@@ -97,12 +102,16 @@ public function getURL() {
return get_annotation_url($this->id);
}
- // SYSTEM LOG INTERFACE ////////////////////////////////////////////////////////////
+ // SYSTEM LOG INTERFACE
/**
* For a given ID, return the object associated with it.
* This is used by the river functionality primarily.
* This is useful for checking access permissions etc on objects.
+ *
+ * @param int $id An annotation ID.
+ *
+ * @return ElggAnnotation
*/
public function getObjectFromID($id) {
return get_annotation($id);
View
118 engine/classes/ElggCache.php
@@ -3,7 +3,7 @@
* ElggCache The elgg cache superclass.
* This defines the interface for a cache (wherever that cache is stored).
*
- * @package Elgg.Core
+ * @package Elgg.Core
* @subpackage Cache
*/
abstract class ElggCache implements
@@ -26,10 +26,27 @@ function __construct() {
/**
* Set a cache variable.
*
- * @param string $variable
- * @param string $value
+ * @param string $variable Name
+ * @param string $value Value
+ *
+ * @return void
+ *
+ * @deprecated 1.8 Use ElggAccess:setVariable()
*/
public function set_variable($variable, $value) {
+ elgg_deprecated_notice('ElggCache::set_variable() is deprecated by ElggCache::setVariable()', 1.8);
+ $this->setVariable($variable, $value);
+ }
+
+ /**
+ * Set a cache variable.
+ *
+ * @param string $variable Name
+ * @param string $value Value
+ *
+ * @return void
+ */
+ public function setVariable($variable, $value) {
if (!is_array($this->variables)) {
$this->variables = array();
}
@@ -40,10 +57,25 @@ public function set_variable($variable, $value) {
/**
* Get variables for this cache.
*
- * @param string $variable
- * @return mixed The variable or null;
+ * @param string $variable Name
+ *
+ * @return mixed The value or null;
+ *
+ * @deprecated 1.8 Use ElggCache::getVariable()
*/
public function get_variable($variable) {
+ elgg_deprecated_notice('ElggCache::get_variable() is deprecated by ElggCache::getVariable()', 1.8);
+ return $this->getVariable($variable);
+ }
+
+ /**
+ * Get variables for this cache.
+ *
+ * @param string $variable Name
+ *
+ * @return mixed The variable or null;
+ */
+ public function getVariable($variable) {
if (isset($this->variables[$variable])) {
return $this->variables[$variable];
}
@@ -54,7 +86,8 @@ public function get_variable($variable) {
/**
* Class member get overloading, returning key using $this->load defaults.
*
- * @param string $key
+ * @param string $key Name
+ *
* @return mixed
*/
function __get($key) {
@@ -64,8 +97,9 @@ function __get($key) {
/**
* Class member set overloading, setting a key using $this->save defaults.
*
- * @param string $key
- * @param mixed $value
+ * @param string $key Name
+ * @param mixed $value Value
+ *
* @return mixed
*/
function __set($key, $value) {
@@ -76,6 +110,7 @@ function __set($key, $value) {
* Supporting isset, using $this->load() with default values.
*
* @param string $key The name of the attribute or metadata.
+ *
* @return bool
*/
function __isset($key) {
@@ -86,6 +121,8 @@ function __isset($key) {
* Supporting unsetting of magic attributes.
*
* @param string $key The name of the attribute or metadata.
+ *
+ * @return bool
*/
function __unset($key) {
return $this->delete($key);
@@ -94,8 +131,9 @@ function __unset($key) {
/**
* Save data in a cache.
*
- * @param string $key
- * @param string $data
+ * @param string $key Name
+ * @param string $data Value
+ *
* @return bool
*/
abstract public function save($key, $data);
@@ -103,9 +141,10 @@ function __unset($key) {
/**
* Load data from the cache using a given key.
*
- * @param string $key
- * @param int $offset
- * @param int $limit
+ * @param string $key Name
+ * @param int $offset Offset
+ * @param int $limit Limit
+ *
* @return mixed The stored data or false.
*/
abstract public function load($key, $offset = 0, $limit = null);
@@ -113,7 +152,8 @@ function __unset($key) {
/**
* Invalidate a key
*
- * @param string $key
+ * @param string $key Name
+ *
* @return bool
*/
abstract public function delete($key);
@@ -121,16 +161,18 @@ function __unset($key) {
/**
* Clear out all the contents of the cache.
*
+ * @return bool
*/
abstract public function clear();
/**
* Add a key only if it doesn't already exist.
- * Implemented simply here, if you extend this class and your caching engine provides a better way then
- * override this accordingly.
+ * Implemented simply here, if you extend this class and your caching engine
+ * provides a better way then override this accordingly.
+ *
+ * @param string $key Name
+ * @param string $data Value
*
- * @param string $key
- * @param string $data
* @return bool
*/
public function add($key, $data) {
@@ -142,20 +184,58 @@ public function add($key, $data) {
}
// ARRAY ACCESS INTERFACE //////////////////////////////////////////////////////////
+
+ /**
+ * Set offset
+ *
+ * @see ArrayAccess::offsetSet()
+ *
+ * @param mixed $key Name
+ * @param mixed $value Value
+ *
+ * @return void
+ */
function offsetSet($key, $value) {
$this->save($key, $value);
}
+ /**
+ * Get offset
+ *
+ * @see ArrayAccess::offsetGet()
+ *
+ * @param mixed $key Name
+ *
+ * @return void
+ */
function offsetGet($key) {
return $this->load($key);
}
+ /**
+ * Unsets offset
+ *
+ * @see ArrayAccess::offsetUnset()
+ *
+ * @param mixed $key Name
+ *
+ * @return void
+ */
function offsetUnset($key) {
- if ( isset($this->key) ) {
+ if (isset($this->key)) {
unset($this->key);
}
}
+ /**
+ * Does offset exist
+ *
+ * @see ArrayAccess::offsetExists()
+ *
+ * @param mixed $offset Offset
+ *
+ * @return void
+ */
function offsetExists($offset) {
return isset($this->$offset);
}
View
158 engine/classes/ElggDiskFilestore.php
@@ -5,9 +5,9 @@
* @warning This should be used by a wrapper class
* like {@link ElggFile}.
*
- * @package Elgg.Core
+ * @package Elgg.Core
* @subpackage FileStore.Disk
- * @link http://docs.elgg.org/DataModel/FileStore/Disk
+ * @link http://docs.elgg.org/DataModel/FileStore/Disk
*/
class ElggDiskFilestore extends ElggFilestore {
/**
@@ -42,8 +42,9 @@ public function __construct($directory_root = "") {
* @warning This will try to create the a directory if it doesn't exist,
* even in read-only mode.
*
- * @param ElggFile $file
- * @param string $mode read, write, or append.
+ * @param ElggFile $file The file to open
+ * @param string $mode read, write, or append.
+ *
* @throws InvalidParameterException
* @return resource File pointer resource
* @todo This really shouldn't try to create directories if not writing.
@@ -52,8 +53,8 @@ public function open(ElggFile $file, $mode) {
$fullname = $this->getFilenameOnFilestore($file);
// Split into path and name
- $ls = strrpos($fullname,"/");
- if ($ls===false) {
+ $ls = strrpos($fullname, "/");
+ if ($ls === false) {
$ls = 0;
}
@@ -67,7 +68,7 @@ public function open(ElggFile $file, $mode) {
}
- if (($mode!='write') && (!file_exists($fullname))) {
+ if (($mode != 'write') && (!file_exists($fullname))) {
return false;
}
@@ -82,7 +83,8 @@ public function open(ElggFile $file, $mode) {
$mode = "a+b";
break;
default:
- throw new InvalidParameterException(sprintf(elgg_echo('InvalidParameterException:UnrecognisedFileMode'), $mode));
+ $msg = sprintf(elgg_echo('InvalidParameterException:UnrecognisedFileMode'), $mode);
+ throw new InvalidParameterException($msg);
}
return fopen($fullname, $mode);
@@ -92,8 +94,9 @@ public function open(ElggFile $file, $mode) {
/**
* Write data to a file.
*
- * @param resource $f File pointer resource
- * @param mixed $data The data to write.
+ * @param resource $f File pointer resource
+ * @param mixed $data The data to write.
+ *
* @return bool
*/
public function write($f, $data) {
@@ -103,9 +106,10 @@ public function write($f, $data) {
/**
* Read data from a file.
*
- * @param resource $f File pointer resource
- * @param int $length The number of bytes to read
- * @param inf $offset The number of bytes to start after
+ * @param resource $f File pointer resource
+ * @param int $length The number of bytes to read
+ * @param inf $offset The number of bytes to start after
+ *
* @return mixed Contents of file or false on fail.
*/
public function read($f, $length, $offset = 0) {
@@ -120,6 +124,7 @@ public function read($f, $length, $offset = 0) {
* Close a file pointer
*
* @param resource $f A file pointer resource
+ *
* @return bool
*/
public function close($f) {
@@ -130,6 +135,7 @@ public function close($f) {
* Delete an ElggFile file.
*
* @param ElggFile $file File to delete
+ *
* @return bool
*/
public function delete(ElggFile $file) {
@@ -144,8 +150,10 @@ public function delete(ElggFile $file) {
/**
* Seek to the specified position.
*
- * @param resource $f File resource
- * @param int $position Position in bytes
+ * @param resource $f File resource
+ * @param int $position Position in bytes
+ *
+ * @return bool
*/
public function seek($f, $position) {
return fseek($f, $position);
@@ -155,6 +163,8 @@ public function seek($f, $position) {
* Return the current location of the internal pointer
*
* @param resource $f File pointer resource
+ *
+ * @return int|false
*/
public function tell($f) {
return ftell($f);
@@ -162,7 +172,10 @@ public function tell($f) {
/**
* Tests for end of file on a file pointer
+ *
* @param resource $f File pointer resource
+ *
+ * @return bool
*/
public function eof($f) {
return feof($f);
@@ -171,7 +184,8 @@ public function eof($f) {
/**
* Returns the file size of an ElggFile file.
*
- * @param ElggFile $file
+ * @param ElggFile $file File object
+ *
* @return int The file size
*/
public function getFileSize(ElggFile $file) {
@@ -181,7 +195,8 @@ public function getFileSize(ElggFile $file) {
/**
* Returns the filename as saved on disk for an ElggFile object
*
- * @param ElggFile $file
+ * @param ElggFile $file File object
+ *
* @return string The full path of where the file is stored
*/
public function getFilenameOnFilestore(ElggFile $file) {
@@ -191,7 +206,9 @@ public function getFilenameOnFilestore(ElggFile $file) {
}
if ((!$owner) || (!$owner->username)) {
- throw new InvalidParameterException(sprintf(elgg_echo('InvalidParameterException:MissingOwner'), $file->getFilename(), $file->guid));
+ $msg = sprintf(elgg_echo('InvalidParameterException:MissingOwner'),
+ $file->getFilename(), $file->guid);
+ throw new InvalidParameterException($msg);
}
return $this->dir_root . $this->make_file_matrix($owner->guid) . $file->getFilename();
@@ -200,7 +217,8 @@ public function getFilenameOnFilestore(ElggFile $file) {
/**
* Returns the contents of the ElggFile file.
*
- * @param ElggFile $file
+ * @param ElggFile $file File object
+ *
* @return mixed
*/
public function grabFile(ElggFile $file) {
@@ -210,7 +228,8 @@ public function grabFile(ElggFile $file) {
/**
* Tests if an ElggFile file exists.
*
- * @param ElggFile $file
+ * @param ElggFile $file File object
+ *
* @return bool
*/
public function exists(ElggFile $file) {
@@ -220,8 +239,9 @@ public function exists(ElggFile $file) {
/**
* Returns the size of all data stored under a directory in the disk store.
*
- * @param string $prefix Optional/ The prefix to check under.
+ * @param string $prefix Optional/ The prefix to check under.
* @param string $container_guid The guid of the entity whose data you want to check.
+ *
* @return int|false
*/
public function getSize($prefix = '', $container_guid) {
@@ -236,10 +256,26 @@ public function getSize($prefix = '', $container_guid) {
* Create a directory $dirroot
*
* @param string $dirroot The full path of the directory to create
+ *
* @throws IOException
* @return true
+ * @deprecated 1.8 Use ElggDiskFilestore::makeDirectoryRoot()
*/
protected function make_directory_root($dirroot) {
+ elgg_deprecated_notice('ElggDiskFilestore::make_directory_root() is deprecated by ::makeDirectoryRoot()', 1.8);
+
+ return $this->makeDirectoryRoot($dirroot);
+ }
+
+ /**
+ * Create a directory $dirroot
+ *
+ * @param string $dirroot The full path of the directory to create
+ *
+ * @throws IOException
+ * @return true
+ */
+ protected function makeDirectoryRoot($dirroot) {
if (!file_exists($dirroot)) {
if (!@mkdir($dirroot, 0700, true)) {
throw new IOException(sprintf(elgg_echo('IOException:CouldNotMake'), $dirroot));
@@ -252,15 +288,18 @@ protected function make_directory_root($dirroot) {
/**
* Multibyte string tokeniser.
*
- * Splits a string into an array. Will fail safely if mbstring is not installed (although this may still
- * not handle .
+ * Splits a string into an array. Will fail safely if mbstring is
+ * not installed.
*
- * @param string $string String
+ * @param string $string String
* @param string $charset The charset, defaults to UTF8
+ *
* @return array
- * @todo Can be deprecated since we no long split on usernames
+ * @deprecated 1.8 Files are stored by date and guid; no need for this.
*/
private function mb_str_split($string, $charset = 'UTF8') {
+ elgg_deprecated_notice('ElggDiskFilestore::mb_str_split() is deprecated.', 1.8);
+
if (is_callable('mb_substr')) {
$length = mb_strlen($string);
$array = array();
@@ -283,15 +322,34 @@ private function mb_str_split($string, $charset = 'UTF8') {
/**
* Construct a file path matrix for an entity.
*
- * @param int The guide of the entity to store the data under.
+ * @param int $identifier The guide of the entity to store the data under.
+ *
* @return str The path where the entity's data will be stored.
+ * @deprecated 1.8 Use ElggDiskFilestore::makeFileMatrix()
*/
protected function make_file_matrix($identifier) {
- if (is_numeric($identifier)) {
- return $this->user_file_matrix($identifier);
+ elgg_deprecated_notice('ElggDiskFilestore::make_file_matrix() is deprecated by ::makeFileMatrix()', 1.8);
+
+ return $this->makefileMatrix($identifier);
+ }
+
+ /**
+ * Construct a file path matrix for an entity.
+ *
+ * @param int $guid The guide of the entity to store the data under.
+ *
+ * @return str The path where the entity's data will be stored.
+ */
+ protected function makeFileMatrix($guid) {
+ $entity = get_entity($guid);
+
+ if (!($entity instanceof ElggEntity) || !$entity->time_created) {
+ return false;
}
- return $this->deprecated_file_matrix($identifier);
+ $time_created = date('Y/m/d', $entity->time_created);
+
+ return "$time_created/$entity->guid/";
}
/**
@@ -304,45 +362,13 @@ protected function make_file_matrix($identifier) {
* YYYY/MM/DD/guid/
*
* @param int $guid The entity to contrust a matrix for
+ *
* @return str The
- * @todo This would work with non-users. Why is it restricted to only users?
*/
protected function user_file_matrix($guid) {
- // lookup the entity
- $user = get_entity($guid);
- if ($user->type != 'user') {
- // only to be used for user directories
- return FALSE;
- }
-
- if (!$user->time_created) {
- // fall back to deprecated method
- return $this->deprecated_file_matrix($user->username);
- }
-
- $time_created = date('Y/m/d', $user->time_created);
- return "$time_created/$user->guid/";
- }
+ elgg_deprecated_notice('ElggDiskFilestore::user_file_matrix() is deprecated by ::makeFileMatrix()', 1.8);
- /**
- * Construct the filename matrix using a string
- *
- * Particularly, this is used with a username to generate the file storage
- * location.
- *
- * @deprecated for user directories: use user_file_matrix() instead.
- *
- * @param str $filename
- * @return str
- */
- protected function deprecated_file_matrix($filename) {
- // throw a warning for using deprecated method
- $error = 'Deprecated use of ElggDiskFilestore::make_file_matrix. ';
- $error .= 'Username passed instead of guid.';
- elgg_log($error, WARNING);
-
- $user = new ElggUser($filename);
- return $this->user_file_matrix($user->guid);
+ return $this->makeFileMatrix($guid);
}
/**
@@ -358,7 +384,9 @@ public function getParameters() {
/**
* Sets parameters that should be saved to database.
*
- * return bool
+ * @param array $parameters Set parameters to save to DB for this filestore.
+ *
+ * @return bool
*/
public function setParameters(array $parameters) {
if (isset($parameters['dir_root'])) {
View
353 engine/classes/ElggEntity.php
@@ -22,9 +22,9 @@
* @tip Most plugin authors will want to extend the ElggObject class
* instead of this class.
*
- * @package Elgg.Core
+ * @package Elgg.Core
* @subpackage DataMode.Entities
- * @link http://docs.elgg.org/DataModel/ElggEntity
+ * @link http://docs.elgg.org/DataModel/ElggEntity
*/
abstract class ElggEntity implements
Notable, // Calendar interface
@@ -54,12 +54,14 @@
protected $icon_override;
/**
- * Holds metadata until entity is saved. Once the entity is saved, metadata are written immediately to the database.
+ * Holds metadata until entity is saved. Once the entity is saved,
+ * metadata are written immediately to the database.
*/
protected $temp_metadata;
/**
- * Holds annotations until entity is saved. Once the entity is saved, annotations are written immediately to the database.
+ * Holds annotations until entity is saved. Once the entity is saved,
+ * annotations are written immediately to the database.
*/
protected $temp_annotations;
@@ -76,8 +78,22 @@
* This is vital to distinguish between metadata and base parameters.
*
* @return void
+ * @deprecated 1.8 Use initializeAttributes()
*/
protected function initialise_attributes() {
+ elgg_deprecated_notice('ElggEntity::initialise_attributes() is deprecated by ::initializeAttributes()', 1.8);
+
+ $this->initializeAttributes();
+ }
+
+ /**
+ * Initialize the attributes array.
+ *
+ * This is vital to distinguish between metadata and base parameters.
+ *
+ * @return void
+ */
+ protected function initializeAttributes() {
initialise_entity_cache();
// Create attributes array if not already created
@@ -109,12 +125,16 @@ protected function initialise_attributes() {
$this->attributes['enabled'] = "yes";
// There now follows a bit of a hack
- /* Problem: To speed things up, some objects are split over several tables, this means that it requires
- * n number of database reads to fully populate an entity. This causes problems for caching and create events
+ /* Problem: To speed things up, some objects are split over several tables,
+ * this means that it requires n number of database reads to fully populate
+ * an entity. This causes problems for caching and create events
* since it is not possible to tell whether a subclassed entity is complete.
- * Solution: We have two counters, one 'tables_split' which tells whatever is interested how many tables
- * are going to need to be searched in order to fully populate this object, and 'tables_loaded' which is how
- * many have been loaded thus far.
+ *
+ * Solution: We have two counters, one 'tables_split' which tells whatever is
+ * interested how many tables are going to need to be searched in order to fully
+ * populate this object, and 'tables_loaded' which is how many have been
+ * loaded thus far.
+ *
* If the two are the same then this object is complete.
*
* Use: isFullyLoaded() to check
@@ -133,6 +153,8 @@ protected function initialise_attributes() {
*
* @note metadata will have its owner and access id set when the entity is saved
* and it will be the same as that of the entity.
+ *
+ * @return void
*/
public function __clone() {
$orig_entity = get_entity($this->guid);
@@ -174,12 +196,14 @@ public function __clone() {
* Q: Why are we not using __get overload here?
* A: Because overload operators cause problems during subclassing, so we put the code here and
* create overloads in subclasses.
+ *
* @todo What problems are these?
*
* @warning Subtype is returned as an id rather than the subtype string. Use getSubtype()
* to get the subtype string.
*
- * @param string $name
+ * @param string $name Name
+ *
* @return mixed Returns the value of a given value, or null.
*/
public function get($name) {
@@ -201,16 +225,19 @@ public function get($name) {
* If $name is defined in $this->attributes that value is set, otherwise it will
* set the appropriate item of metadata.
*
- * @warning It is important that your class populates $this->attributes with keys for all base attributes, anything
- * not in their gets set as METADATA.
+ * @warning It is important that your class populates $this->attributes with keys
+ * for all base attributes, anything not in their gets set as METADATA.
*
* Q: Why are we not using __set overload here?
* A: Because overload operators cause problems during subclassing, so we put the code here and
* create overloads in subclasses.
+ *
* @todo What problems?
*
- * @param string $name
- * @param mixed $value
+ * @param string $name Name
+ * @param mixed $value Value
+ *
+ * @return bool
*/
public function set($name, $value) {
if (array_key_exists($name, $this->attributes)) {
@@ -236,7 +263,8 @@ public function set($name, $value) {
/**
* Return the value of a piece of metadata.
*
- * @param string $name
+ * @param string $name Name
+ *
* @return mixed The value, or NULL if not found.
*/
public function getMetaData($name) {
@@ -260,7 +288,8 @@ public function getMetaData($name) {
/**
* Return an attribute or a piece of metadata.
*
- * @param string $name
+ * @param string $name Name
+ *
* @return mixed
*/
function __get($name) {
@@ -270,8 +299,9 @@ function __get($name) {
/**
* Set an attribute or a piece of metadata.
*
- * @param string $name
- * @param mixed $value
+ * @param string $name Name
+ * @param mixed $value Value
+ *
* @return mixed
*/
function __set($name, $value) {
@@ -284,6 +314,7 @@ function __set($name, $value) {
* @tip Use isset($entity->property)
*
* @param string $name The name of the attribute or metadata.
+ *
* @return bool
*/
function __isset($name) {
@@ -296,12 +327,13 @@ function __isset($name) {
* @warning If you use this to unset an attribute, you must save the object!
*
* @param string $name The name of the attribute or metadata.
+ *
+ * @return void
*/
function __unset($name) {
if (array_key_exists($name, $this->attributes)) {
$this->attributes[$name] = "";
- }
- else {
+ } else {
$this->clearMetaData($name);
}
}
@@ -312,10 +344,12 @@ function __unset($name) {
* @tip Plugin authors should use the magic methods.
*
* @access private
- * @param string $name Name of the metadata
- * @param mixed $value Value of the metadata
+ *
+ * @param string $name Name of the metadata
+ * @param mixed $value Value of the metadata
* @param string $value_type Types supported: integer and string. Will auto-identify if not set
- * @param bool $multiple (does not support associative arrays)
+ * @param bool $multiple Allow multiple values for a single name (doesn't support assoc arrays)
+ *
* @return bool
*/
public function setMetaData($name, $value, $value_type = "", $multiple = false) {
@@ -338,8 +372,7 @@ public function setMetaData($name, $value, $value_type = "", $multiple = false)
}
$this->temp_metadata[$name][] = $value;
- }
- else {
+ } else {
$this->temp_metadata[$name] = $value;
}
}
@@ -349,7 +382,8 @@ public function setMetaData($name, $value, $value_type = "", $multiple = false)
} else {
unset($this->temp_metadata[$name]);
if ((int) $this->guid > 0) {
- $result = create_metadata($this->getGUID(), $name, $value, $value_type, $this->getOwner(), $this->getAccessID(), $multiple);
+ $result = create_metadata($this->getGUID(), $name, $value, $value_type,
+ $this->getOwner(), $this->getAccessID(), $multiple);
return (bool)$result;
} else {
if (($multiple) && (isset($this->temp_metadata[$name]))) {
@@ -360,8 +394,7 @@ public function setMetaData($name, $value, $value_type = "", $multiple = false)
}
$this->temp_metadata[$name][] = $value;
- }
- else {
+ } else {
$this->temp_metadata[$name] = $value;
}
@@ -374,8 +407,10 @@ public function setMetaData($name, $value, $value_type = "", $multiple = false)
* Remove metadata
*
* @warning Calling this with no or empty arguments will clear all metadata on the entity.
- * @param string The name of the metadata to clear
- * @return mixed The n
+ *
+ * @param string $name The name of the metadata to clear
+ *
+ * @return mixed bool
*/
public function clearMetaData($name = "") {
if (empty($name)) {
@@ -390,6 +425,7 @@ public function clearMetaData($name = "") {
* Get a piece of volatile (non-persisted) data on this entity.
*
* @param string $name The name of the volatile data
+ *
* @return mixed The value or NULL if not found.
*/
public function getVolatileData($name) {
@@ -408,8 +444,10 @@ public function getVolatileData($name) {
/**
* Set a piece of volatile (non-persisted) data on this entity
*
- * @param string $name
- * @param mixed $value
+ * @param string $name Name
+ * @param mixed $value Value
+ *
+ * @return void
*/
public function setVolatileData($name, $value) {
if (!is_array($this->volatile)) {
@@ -439,8 +477,9 @@ public function clearRelationships() {
*
* @tip Read the relationship like "$guid is a $relationship of this entity."
*
- * @param int $guid Entity to link to.
+ * @param int $guid Entity to link to.
* @param string $relationship The type of relationship.
+ *
* @return bool
* @see ElggEntity::removeRelationship()
* @see ElggEntity::clearRelationships()
@@ -452,8 +491,9 @@ public function addRelationship($guid, $relationship) {
/**
* Remove a relationship
*
- * @param int $guid
- * @param str $relationship
+ * @param int $guid GUID of the entity to make a relationship with
+ * @param str $relationship Name of relationship
+ *
* @return bool
* @see ElggEntity::addRelationship()
* @see ElggEntity::clearRelationships()
@@ -468,8 +508,9 @@ public function removeRelationship($guid, $relationship) {
* Private settings are similar to metadata but will not
* be searched and there are fewer helper functions for them.
*
- * @param $name
- * @param $value
+ * @param string $name Name of private setting
+ * @param mixed $value Value of private setting
+ *
* @return bool
* @link http://docs.elgg.org/DataModel/Entities/PrivateSettings
*/
@@ -480,7 +521,8 @@ function setPrivateSetting($name, $value) {
/**
* Returns a private setting value
*
- * @param $name
+ * @param string $name Name of the private setting
+ *
* @return mixed
*/
function getPrivateSetting($name) {
@@ -490,7 +532,8 @@ function getPrivateSetting($name) {
/**
* Removes private setting
*
- * @param $name
+ * @param string $name Name of the private setting
+ *
* @return bool
*/
function removePrivateSetting($name) {
@@ -502,11 +545,14 @@ function removePrivateSetting($name) {
*
* @warning By default, annotations are private.
*
- * @param string $name
- * @param mixed $value
- * @param int $access_id
- * @param int $owner_id
- * @param string $vartype
+ * @param string $name Annotation name
+ * @param mixed $value Annotation value
+ * @param int $access_id Access ID
+ * @param int $owner_id GUID of the annotation owner
+ * @param string $vartype The type of annotation value
+ *
+ * @return bool
+ *
* @link http://docs.elgg.org/DataModel/Annotations
*/
function annotate($name, $value, $access_id = ACCESS_PRIVATE, $owner_id = 0, $vartype = "") {