[SPIP] v3.2.1-->v3.2.3
[lhc/web/www.git] / www / plugins-dist / medias / lib / getid3 / module.tag.apetag.php
index 938625a..37971a6 100644 (file)
@@ -1,11 +1,11 @@
 <?php
+
 /////////////////////////////////////////////////////////////////
 /// getID3() by James Heinrich <info@getid3.org>               //
-//  available at http://getid3.sourceforge.net                 //
-//            or http://www.getid3.org                         //
-//          also https://github.com/JamesHeinrich/getID3       //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details                             //
+//  available at https://github.com/JamesHeinrich/getID3       //
+//            or https://www.getid3.org                        //
+//            or http://getid3.sourceforge.net                 //
+//  see readme.txt for more details                            //
 /////////////////////////////////////////////////////////////////
 //                                                             //
 // module.tag.apetag.php                                       //
 
 class getid3_apetag extends getid3_handler
 {
-       public $inline_attachments = true; // true: return full data for all attachments; false: return no data for all attachments; integer: return data for attachments <= than this; string: save as file to this directory
+       /**
+        * true: return full data for all attachments;
+        * false: return no data for all attachments;
+        * integer: return data for attachments <= than this;
+        * string: save as file to this directory.
+        *
+        * @var int|bool|string
+        */
+       public $inline_attachments = true;
+
        public $overrideendoffset  = 0;
 
+       /**
+        * @return bool
+        */
        public function Analyze() {
                $info = &$this->getid3->info;
 
@@ -286,7 +298,7 @@ class getid3_apetag extends getid3_handler
                                                        }
                                                } elseif (is_string($this->inline_attachments)) {
                                                        $this->inline_attachments = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->inline_attachments), DIRECTORY_SEPARATOR);
-                                                       if (!is_dir($this->inline_attachments) || !is_writable($this->inline_attachments)) {
+                                                       if (!is_dir($this->inline_attachments) || !getID3::is_writable($this->inline_attachments)) {
                                                                // cannot write, skip
                                                                $this->warning('attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$this->inline_attachments.'" (not writable)');
                                                                unset($thisfile_ape_items_current['data']);
@@ -296,7 +308,7 @@ class getid3_apetag extends getid3_handler
                                                // if we get this far, must be OK
                                                if (is_string($this->inline_attachments)) {
                                                        $destination_filename = $this->inline_attachments.DIRECTORY_SEPARATOR.md5($info['filenamepath']).'_'.$thisfile_ape_items_current['data_offset'];
-                                                       if (!file_exists($destination_filename) || is_writable($destination_filename)) {
+                                                       if (!file_exists($destination_filename) || getID3::is_writable($destination_filename)) {
                                                                file_put_contents($destination_filename, $thisfile_ape_items_current['data']);
                                                        } else {
                                                                $this->warning('attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$destination_filename.'" (not writable)');
@@ -335,6 +347,11 @@ class getid3_apetag extends getid3_handler
                return true;
        }
 
+       /**
+        * @param string $APEheaderFooterData
+        *
+        * @return array|false
+        */
        public function parseAPEheaderFooter($APEheaderFooterData) {
                // http://www.uni-jena.de/~pfk/mpp/sv8/apeheader.html
 
@@ -359,6 +376,11 @@ class getid3_apetag extends getid3_handler
                return $headerfooterinfo;
        }
 
+       /**
+        * @param int $rawflagint
+        *
+        * @return array
+        */
        public function parseAPEtagFlags($rawflagint) {
                // "Note: APE Tags 1.0 do not use any of the APE Tag flags.
                // All are set to zero on creation and ignored on reading."
@@ -374,6 +396,11 @@ class getid3_apetag extends getid3_handler
                return $flags;
        }
 
+       /**
+        * @param int $contenttypeid
+        *
+        * @return string
+        */
        public function APEcontentTypeFlagLookup($contenttypeid) {
                static $APEcontentTypeFlagLookup = array(
                        0 => 'utf-8',
@@ -384,6 +411,11 @@ class getid3_apetag extends getid3_handler
                return (isset($APEcontentTypeFlagLookup[$contenttypeid]) ? $APEcontentTypeFlagLookup[$contenttypeid] : 'invalid');
        }
 
+       /**
+        * @param string $itemkey
+        *
+        * @return bool
+        */
        public function APEtagItemIsUTF8Lookup($itemkey) {
                static $APEtagItemIsUTF8Lookup = array(
                        'title',