]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Refs #2450: Documented a few more classes.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 22 Sep 2010 16:56:55 +0000 (16:56 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 22 Sep 2010 16:56:55 +0000 (16:56 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@6956 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/classes/ElggAnnotation.php
engine/classes/ElggExtender.php
engine/classes/ElggPlugin.php
engine/classes/ElggRelationship.php

index 0275663dc805719ba79a212c6cde34dc3e0a54e8..709e284333e0f0860e2c5c8f551a9083c542f340 100644 (file)
@@ -6,6 +6,8 @@
  * They are essentially the same as metadata, but with additional\r
  * helper functions.\r
  *\r
+ * @internal Annotations are stored in the annotations table.\r
+ *\r
  * @package Elgg.Core\r
  * @subpackage DataModel.Annotations\r
  * @link http://docs.elgg.org/DataModel/Annotations\r
index ec7a21f35ead706bf2de43c970214c2a99487cac..1a544b9a936bb025302e0873ec421a701115c916 100644 (file)
@@ -1,11 +1,21 @@
 <?php\r
-\r
 /**\r
- * ElggExtender\r
+ * The base class for ElggEntity extenders.\r
+ *\r
+ * Extenders allow you to attach extended information to an\r
+ * ElggEntity.  Core supports two: ElggAnnotation, ElggMetadata,\r
+ * and ElggRelationship\r
+ *\r
+ * Saving the extender data to database is handled by the child class.\r
+ *\r
+ * @tip Plugin authors would probably want to extend either ElggAnnotation\r
+ * or ElggMetadata instead of this class.\r
  *\r
- * @author Curverider Ltd\r
- * @package Elgg\r
- * @subpackage Core\r
+ * @package Elgg.Core\r
+ * @subpackage DataModel.Extender\r
+ * @see ElggAnnotation\r
+ * @see ElggMetadata\r
+ * @link http://docs.elgg.org/DataModel/Extenders\r
  */\r
 abstract class ElggExtender implements\r
        Exportable,\r
@@ -14,13 +24,14 @@ abstract class ElggExtender implements
        ArrayAccess // Override for array access\r
 {\r
        /**\r
-        * This contains the site's main properties (id, etc)\r
+        * Holds attributes to save to database\r
+        *\r
         * @var array\r
         */\r
        protected $attributes;\r
 \r
        /**\r
-        * Get an attribute\r
+        * Returns an attribute\r
         *\r
         * @param string $name\r
         * @return mixed\r
@@ -66,18 +77,18 @@ abstract class ElggExtender implements
        }\r
 \r
        /**\r
-        * Return the owner of this annotation.\r
+        * Return the owner guid of this extender.\r
         *\r
-        * @return mixed\r
+        * @return int\r
         */\r
        public function getOwner() {\r
                return $this->owner_guid;\r
        }\r
 \r
        /**\r
-        * Return the owner entity\r
+        * Return the owner entity.\r
         *\r
-        * @return mixed\r
+        * @return ElggEntity|false\r
         * @since 1.7.0\r
         */\r
        public function getOwnerEntity() {\r
@@ -85,7 +96,7 @@ abstract class ElggExtender implements
        }\r
 \r
        /**\r
-        * Returns the entity this is attached to\r
+        * Return the entity this describes.\r
         *\r
         * @return ElggEntity The enttiy\r
         */\r
@@ -104,10 +115,10 @@ abstract class ElggExtender implements
        abstract public function delete();\r
 \r
        /**\r
-        * Determines whether or not the specified user can edit this\r
+        * Returns if a user can edit this extended data.\r
         *\r
         * @param int $user_guid The GUID of the user (defaults to currently logged in user)\r
-        * @return true|false\r
+        * @return bool\r
         */\r
        public function canEdit($user_guid = 0) {\r
                return can_edit_extender($this->id,$this->type,$user_guid);\r
@@ -120,10 +131,14 @@ abstract class ElggExtender implements
         */\r
        public abstract function getURL();\r
 \r
-       // EXPORTABLE INTERFACE ////////////////////////////////////////////////////////////\r
+       /*\r
+        * EXPORTABLE INTERFACE\r
+        */\r
 \r
        /**\r
         * Return an array of fields which can be exported.\r
+        *\r
+        * @return array\r
         */\r
        public function getExportableValues() {\r
                return array(\r
@@ -151,7 +166,9 @@ abstract class ElggExtender implements
                return $meta;\r
        }\r
 \r
-       // SYSTEM LOG INTERFACE ////////////////////////////////////////////////////////////\r
+       /*\r
+        * SYSTEM LOG INTERFACE\r
+        */\r
 \r
        /**\r
         * Return an identification for the object for storage in the system log.\r
@@ -165,6 +182,8 @@ abstract class ElggExtender implements
 \r
        /**\r
         * Return the class name of the object.\r
+        *\r
+        * @return string\r
         */\r
        public function getClassName() {\r
                return get_class($this);\r
@@ -172,13 +191,17 @@ abstract class ElggExtender implements
 \r
        /**\r
         * Return the GUID of the owner of this object.\r
+        *\r
+        * @return int\r
         */\r
        public function getObjectOwnerGUID() {\r
                return $this->owner_guid;\r
        }\r
 \r
        /**\r
-        * Return a type of the object - eg. object, group, user, relationship, metadata, annotation etc\r
+        * Return a type of extension.\r
+        *\r
+        * @return string\r
         */\r
        public function getType() {\r
                return $this->type;\r
@@ -187,18 +210,22 @@ abstract class ElggExtender implements
        /**\r
         * Return a subtype. For metadata & annotations this is the 'name' and\r
         * for relationship this is the relationship type.\r
+        *\r
+        * @return string\r
         */\r
        public function getSubtype() {\r
                return $this->name;\r
        }\r
 \r
 \r
-       // ITERATOR INTERFACE //////////////////////////////////////////////////////////////\r
+       /*\r
+        * ITERATOR INTERFACE\r
+        */\r
+\r
        /*\r
         * This lets an entity's attributes be displayed using foreach as a normal array.\r
         * Example: http://www.sitepoint.com/print/php5-standard-library\r
         */\r
-\r
        private $valid = FALSE;\r
 \r
        function rewind() {\r
@@ -221,12 +248,14 @@ abstract class ElggExtender implements
                return $this->valid;\r
        }\r
 \r
-       // ARRAY ACCESS INTERFACE //////////////////////////////////////////////////////////\r
+       /*\r
+        * ARRAY ACCESS INTERFACE\r
+        */\r
+\r
        /*\r
         * This lets an entity's attributes be accessed like an associative array.\r
         * Example: http://www.sitepoint.com/print/php5-standard-library\r
         */\r
-\r
        function offsetSet($key, $value) {\r
                if ( array_key_exists($key, $this->attributes) ) {\r
                        $this->attributes[$key] = $value;\r
index 921665f4df390a1e95b30524851ba7315236f9a1..c666b8438872a218ec9cf526da7c4fe632e9d042 100644 (file)
@@ -1,8 +1,12 @@
 <?php\r
 /**\r
- * @class ElggPlugin Object representing a plugin's settings for a given site.\r
- * This class is currently a stub, allowing a plugin to saving settings in an object's metadata for each site.\r
- * @author Curverider Ltd\r
+ * Stores site-side plugin settings as private data.\r
+ *\r
+ * This class is currently a stub, allowing a plugin to\r
+ * save settings in an object's private settings for each site.\r
+ *\r
+ * @package Elgg.Core\r
+ * @subpackage Plugins.Settings\r
  */\r
 class ElggPlugin extends ElggObject {\r
        protected function initialise_attributes() {\r
@@ -16,7 +20,10 @@ class ElggPlugin extends ElggObject {
        }\r
 \r
        /**\r
-        * Override entity get and sets in order to save data to private data store.\r
+        * Get a value from private settings.\r
+        *\r
+        * @param string $name\r
+        * @return mixed\r
         */\r
        public function get($name) {\r
                // See if its in our base attribute\r
@@ -37,7 +44,10 @@ class ElggPlugin extends ElggObject {
        }\r
 \r
        /**\r
-        * Override entity get and sets in order to save data to private data store.\r
+        * Save a value to private settings.\r
+        *\r
+        * @param string $name\r
+        * @param mixed $value\r
         */\r
        public function set($name, $value) {\r
                if (array_key_exists($name, $this->attributes)) {\r
index 4d14941a9a23d32c110a9143ca3635c7cdd1ad82..e7574eb3b40ffd14a2cbd782ef517397dda42bbc 100644 (file)
@@ -1,10 +1,8 @@
 <?php\r
-\r
 /**\r
  * Relationship class.\r
  *\r
- * @author Curverider Ltd\r
- * @package Elgg\r
+ * @package Elgg.Core\r
  * @subpackage Core\r
  */\r
 class ElggRelationship implements\r