OSDN Git Service

MERGE: リビジョン1721をマージ。主要なクラス名をUpperCamelCaseに統一。
[nucleus-jp/nucleus-next.git] / nucleus / libs / MEDIA.php
index bc673e8..11199d9 100644 (file)
@@ -23,19 +23,20 @@ define('READ_ONLY_MEDIA_FOLDER', '(Read Only)');
 /**\r
   * Represents the media objects for a certain member\r
   */\r
-class MEDIA {\r
-\r
+class Media\r
+{\r
        /**\r
-         * Gets the list of collections available to the currently logged\r
-         * in member\r
-         *\r
-         * @returns array of dirname => display name\r
-         */\r
-       function getCollectionList($exceptReadOnly = false) {\r
+        * Gets the list of collections available to the currently logged\r
+        * in member\r
+        *\r
+        * @returns array of dirname => display name\r
+        */\r
+       public function getCollectionList($exceptReadOnly = false)\r
+       {\r
                global $member, $DIR_MEDIA;\r
-\r
+               \r
                $collections = array();\r
-\r
+               \r
                // add private directory for member\r
                $collections[$member->getID()] = PRIVATE_COLLECTION;\r
 \r
@@ -63,7 +64,7 @@ class MEDIA {
        }\r
 \r
        /**\r
-         * Returns an array of MEDIAOBJECT objects for a certain collection\r
+         * Returns an array of MediaObject objects for a certain collection\r
          *\r
          * @param $collection\r
          *             name of the collection\r
@@ -85,8 +86,8 @@ class MEDIA {
                $dirhandle = opendir($mediadir);\r
                while ($filename = readdir($dirhandle)) {\r
                        // only add files that match the filter\r
-                       if (!@is_dir($filename) && MEDIA::checkFilter($filename, $filter))\r
-                               array_push($filelist, new MEDIAOBJECT($collection, $filename, filemtime($mediadir . $filename)));\r
+                       if (!@is_dir($filename) && Media::checkFilter($filename, $filter))\r
+                               array_push($filelist, new MediaObject($collection, $filename, filemtime($mediadir . $filename)));\r
                }\r
                closedir($dirhandle);\r
 \r
@@ -114,7 +115,7 @@ class MEDIA {
                if ($collectionName === (string)$member->getID())\r
                        return true;\r
                        \r
-               $collections = MEDIA::getCollectionList($exceptReadOnly);\r
+               $collections = Media::getCollectionList($exceptReadOnly);\r
                $dirname = $collections[$collectionName];\r
                if ($dirname == NULL || $dirname === PRIVATE_COLLECTION)\r
                        return false;  \r
@@ -153,7 +154,7 @@ class MEDIA {
 \r
                // don't allow uploads to unknown or forbidden collections\r
                $exceptReadOnly = true;\r
-               if (!MEDIA::isValidCollection($collection,$exceptReadOnly))\r
+               if (!Media::isValidCollection($collection,$exceptReadOnly))\r
                        return _ERROR_DISALLOWED;\r
 \r
                // check dir permissions (try to create dir if it does not exist)\r
@@ -269,28 +270,27 @@ class MEDIA {
   *  - collection: collection to which the file belongs (can also be a owner ID, for private collections)\r
   *  - private: true if the media belongs to a private member collection\r
   */\r
-class MEDIAOBJECT {\r
-\r
-       var $private;\r
-       var $collection;\r
-       var $filename;\r
-       var $timestamp;\r
-\r
-       function MEDIAOBJECT($collection, $filename, $timestamp) {\r
+class MediaObject\r
+{\r
+       public $private;\r
+       public $collection;\r
+       public $filename;\r
+       public $timestamp;\r
+       \r
+       public function __construct($collection, $filename, $timestamp)\r
+       {\r
                $this->private = is_numeric($collection);\r
                $this->collection = $collection;\r
                $this->filename = $filename;\r
                $this->timestamp = $timestamp;\r
+               return;\r
        }\r
-\r
 }\r
 \r
 /**\r
-  * User-defined sort method to sort an array of MEDIAOBJECTS\r
+  * User-defined sort method to sort an array of MediaObjects\r
   */\r
 function sort_media($a, $b) {\r
        if ($a->timestamp == $b->timestamp) return 0;\r
        return ($a->timestamp > $b->timestamp) ? -1 : 1;\r
 }\r
-\r
-?>\r