Changeset 46112 for trunk/src/wp-includes/ID3/getid3.php
- Timestamp:
- 09/14/2019 07:06:09 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ID3/getid3.php
r41196 r46112 2 2 ///////////////////////////////////////////////////////////////// 3 3 /// getID3() by James Heinrich <info@getid3.org> // 4 // available at http://getid3.sourceforge.net // 5 // or http://www.getid3.org // 6 // also https://github.com/JamesHeinrich/getID3 // 7 ///////////////////////////////////////////////////////////////// 4 // available at https://github.com/JamesHeinrich/getID3 // 5 // or https://www.getid3.org // 6 // or http://getid3.sourceforge.net // 8 7 // // 9 8 // Please see readme.txt for more information // … … 26 25 define('ENT_SUBSTITUTE', (defined('ENT_IGNORE') ? ENT_IGNORE : 8)); 27 26 } 27 28 /* 29 https://www.getid3.org/phpBB3/viewtopic.php?t=2114 30 If you are running into a the problem where filenames with special characters are being handled 31 incorrectly by external helper programs (e.g. metaflac), notably with the special characters removed, 32 and you are passing in the filename in UTF8 (typically via a HTML form), try uncommenting this line: 33 */ 34 //setlocale(LC_CTYPE, 'en_US.UTF-8'); 28 35 29 36 // attempt to define temp dir as something flexible but reliable … … 75 82 class getID3 76 83 { 77 // public: Settings 78 public $encoding = 'UTF-8'; // CASE SENSITIVE! - i.e. (must be supported by iconv()). Examples: ISO-8859-1 UTF-8 UTF-16 UTF-16BE 79 public $encoding_id3v1 = 'ISO-8859-1'; // Should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'EUC-CN' or 'CP1252' 80 81 // public: Optional tag checks - disable for speed. 82 public $option_tag_id3v1 = true; // Read and process ID3v1 tags 83 public $option_tag_id3v2 = true; // Read and process ID3v2 tags 84 public $option_tag_lyrics3 = true; // Read and process Lyrics3 tags 85 public $option_tag_apetag = true; // Read and process APE tags 86 public $option_tags_process = true; // Copy tags to root key 'tags' and encode to $this->encoding 87 public $option_tags_html = true; // Copy tags to root key 'tags_html' properly translated from various encodings to HTML entities 88 89 // public: Optional tag/comment calucations 90 public $option_extra_info = true; // Calculate additional info such as bitrate, channelmode etc 91 92 // public: Optional handling of embedded attachments (e.g. images) 93 public $option_save_attachments = true; // defaults to true (ATTACHMENTS_INLINE) for backward compatibility 94 95 // public: Optional calculations 96 public $option_md5_data = false; // Get MD5 sum of data part - slow 97 public $option_md5_data_source = false; // Use MD5 of source file if availble - only FLAC and OptimFROG 98 public $option_sha1_data = false; // Get SHA1 sum of data part - slow 99 public $option_max_2gb_check = null; // Check whether file is larger than 2GB and thus not supported by 32-bit PHP (null: auto-detect based on PHP_INT_MAX) 100 101 // public: Read buffer size in bytes 84 /* 85 * Settings 86 */ 87 88 /** 89 * CASE SENSITIVE! - i.e. (must be supported by iconv()). Examples: ISO-8859-1 UTF-8 UTF-16 UTF-16BE 90 * 91 * @var string 92 */ 93 public $encoding = 'UTF-8'; 94 95 /** 96 * Should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'EUC-CN' or 'CP1252' 97 * 98 * @var string 99 */ 100 public $encoding_id3v1 = 'ISO-8859-1'; 101 102 /* 103 * Optional tag checks - disable for speed. 104 */ 105 106 /** 107 * Read and process ID3v1 tags 108 * 109 * @var bool 110 */ 111 public $option_tag_id3v1 = true; 112 113 /** 114 * Read and process ID3v2 tags 115 * 116 * @var bool 117 */ 118 public $option_tag_id3v2 = true; 119 120 /** 121 * Read and process Lyrics3 tags 122 * 123 * @var bool 124 */ 125 public $option_tag_lyrics3 = true; 126 127 /** 128 * Read and process APE tags 129 * 130 * @var bool 131 */ 132 public $option_tag_apetag = true; 133 134 /** 135 * Copy tags to root key 'tags' and encode to $this->encoding 136 * 137 * @var bool 138 */ 139 public $option_tags_process = true; 140 141 /** 142 * Copy tags to root key 'tags_html' properly translated from various encodings to HTML entities 143 * 144 * @var bool 145 */ 146 public $option_tags_html = true; 147 148 /* 149 * Optional tag/comment calculations 150 */ 151 152 /** 153 * Calculate additional info such as bitrate, channelmode etc 154 * 155 * @var bool 156 */ 157 public $option_extra_info = true; 158 159 /* 160 * Optional handling of embedded attachments (e.g. images) 161 */ 162 163 /** 164 * Defaults to true (ATTACHMENTS_INLINE) for backward compatibility 165 * 166 * @var bool|string 167 */ 168 public $option_save_attachments = true; 169 170 /* 171 * Optional calculations 172 */ 173 174 /** 175 * Get MD5 sum of data part - slow 176 * 177 * @var bool 178 */ 179 public $option_md5_data = false; 180 181 /** 182 * Use MD5 of source file if availble - only FLAC and OptimFROG 183 * 184 * @var bool 185 */ 186 public $option_md5_data_source = false; 187 188 /** 189 * Get SHA1 sum of data part - slow 190 * 191 * @var bool 192 */ 193 public $option_sha1_data = false; 194 195 /** 196 * Check whether file is larger than 2GB and thus not supported by 32-bit PHP (null: auto-detect based on 197 * PHP_INT_MAX) 198 * 199 * @var bool|null 200 */ 201 public $option_max_2gb_check; 202 203 /** 204 * Read buffer size in bytes 205 * 206 * @var int 207 */ 102 208 public $option_fread_buffer_size = 32768; 103 209 104 210 // Public variables 105 public $filename; // Filename of file being analysed. 106 public $fp; // Filepointer to file being analysed. 107 public $info; // Result array. 211 212 /** 213 * Filename of file being analysed. 214 * 215 * @var string 216 */ 217 public $filename; 218 219 /** 220 * Filepointer to file being analysed. 221 * 222 * @var resource 223 */ 224 public $fp; 225 226 /** 227 * Result array. 228 * 229 * @var array 230 */ 231 public $info; 232 233 /** 234 * @var string 235 */ 108 236 public $tempdir = GETID3_TEMP_DIR; 237 238 /** 239 * @var int 240 */ 109 241 public $memory_limit = 0; 110 242 111 // Protected variables 243 /** 244 * @var string 245 */ 112 246 protected $startup_error = ''; 247 248 /** 249 * @var string 250 */ 113 251 protected $startup_warning = ''; 114 252 115 const VERSION = '1.9.1 4-201706111222';253 const VERSION = '1.9.17-201907240906'; 116 254 const FREAD_BUFFER_SIZE = 32768; 117 255 … … 119 257 const ATTACHMENTS_INLINE = true; 120 258 121 // public: constructor122 259 public function __construct() { 260 261 // Check for PHP version 262 $required_php_version = '5.3.0'; 263 if (version_compare(PHP_VERSION, $required_php_version, '<')) { 264 $this->startup_error .= 'getID3() requires PHP v'.$required_php_version.' or higher - you are running v'.PHP_VERSION."\n"; 265 return; 266 } 123 267 124 268 // Check memory … … 177 321 // Needed for Windows only: 178 322 // Define locations of helper applications for Shorten, VorbisComment, MetaFLAC 179 // as well as other helper functions such as head, tail, md5sum,etc323 // as well as other helper functions such as head, etc 180 324 // This path cannot contain spaces, but the below code will attempt to get the 181 325 // 8.3-equivalent path automatically … … 220 364 throw new getid3_exception($this->startup_error); 221 365 } 222 223 return true; 224 } 225 366 } 367 368 /** 369 * @return string 370 */ 226 371 public function version() { 227 372 return self::VERSION; 228 373 } 229 374 375 /** 376 * @return int 377 */ 230 378 public function fread_buffer_size() { 231 379 return $this->option_fread_buffer_size; 232 380 } 233 381 234 235 // public: setOption 382 /** 383 * @param array $optArray 384 * 385 * @return bool 386 */ 236 387 public function setOption($optArray) { 237 388 if (!is_array($optArray) || empty($optArray)) { … … 247 398 } 248 399 249 250 public function openfile($filename, $filesize=null) { 400 /** 401 * @param string $filename 402 * @param int $filesize 403 * 404 * @return bool 405 * 406 * @throws getid3_exception 407 */ 408 public function openfile($filename, $filesize=null, $fp=null) { 251 409 try { 252 410 if (!empty($this->startup_error)) { … … 271 429 272 430 $filename = str_replace('/', DIRECTORY_SEPARATOR, $filename); 273 $filename = preg_replace('#(?<!gs:)('.preg_quote(DIRECTORY_SEPARATOR).'{2,})#', DIRECTORY_SEPARATOR, $filename);431 //$filename = preg_replace('#(?<!gs:)('.preg_quote(DIRECTORY_SEPARATOR).'{2,})#', DIRECTORY_SEPARATOR, $filename); 274 432 275 433 // open local file 276 //if (is_readable($filename) && is_file($filename) && ($this->fp = fopen($filename, 'rb'))) { // see http://www.getid3.org/phpBB3/viewtopic.php?t=1720 277 if ((is_readable($filename) || file_exists($filename)) && is_file($filename) && ($this->fp = fopen($filename, 'rb'))) { 434 //if (is_readable($filename) && is_file($filename) && ($this->fp = fopen($filename, 'rb'))) { // see https://www.getid3.org/phpBB3/viewtopic.php?t=1720 435 if (($fp != null) && ((get_resource_type($fp) == 'file') || (get_resource_type($fp) == 'stream'))) { 436 $this->fp = $fp; 437 } elseif ((is_readable($filename) || file_exists($filename)) && is_file($filename) && ($this->fp = fopen($filename, 'rb'))) { 278 438 // great 279 439 } else { … … 332 492 unset($this->info['filesize']); 333 493 fclose($this->fp); 334 throw new getid3_exception('PHP seems to think the file is larger than '.round(PHP_INT_MAX / 1073741824).'GB, but filesystem reports it as '.number_format($real_filesize , 3).'GB, please report to info@getid3.org');494 throw new getid3_exception('PHP seems to think the file is larger than '.round(PHP_INT_MAX / 1073741824).'GB, but filesystem reports it as '.number_format($real_filesize / 1073741824, 3).'GB, please report to info@getid3.org'); 335 495 } 336 496 $this->info['filesize'] = $real_filesize; 337 $this->warning('File is larger than '.round(PHP_INT_MAX / 1073741824).'GB (filesystem reports it as '.number_format($real_filesize , 3).'GB) and is not properly supported by PHP.');497 $this->warning('File is larger than '.round(PHP_INT_MAX / 1073741824).'GB (filesystem reports it as '.number_format($real_filesize / 1073741824, 3).'GB) and is not properly supported by PHP.'); 338 498 } 339 499 } … … 347 507 } 348 508 349 // public: analyze file 350 public function analyze($filename, $filesize=null, $original_filename='') { 509 /** 510 * analyze file 511 * 512 * @param string $filename 513 * @param int $filesize 514 * @param string $original_filename 515 * 516 * @return array 517 */ 518 public function analyze($filename, $filesize=null, $original_filename='', $fp=null) { 351 519 try { 352 if (!$this->openfile($filename, $filesize )) {520 if (!$this->openfile($filename, $filesize, $fp)) { 353 521 return $this->info; 354 522 } … … 384 552 if ((substr($header, 0, 3) == 'ID3') && (strlen($header) == 10)) { 385 553 $this->info['id3v2']['header'] = true; 386 $this->info['id3v2']['majorversion'] = ord($header {3});387 $this->info['id3v2']['minorversion'] = ord($header {4});554 $this->info['id3v2']['majorversion'] = ord($header[3]); 555 $this->info['id3v2']['minorversion'] = ord($header[4]); 388 556 $this->info['avdataoffset'] += getid3_lib::BigEndian2Int(substr($header, 6, 4), 1) + 10; // length of ID3v2 tag in 10-byte header doesn't include 10-byte header length 389 557 } … … 498 666 499 667 500 // private: error handling 668 /** 669 * Error handling. 670 * 671 * @param string $message 672 * 673 * @return array 674 */ 501 675 public function error($message) { 502 676 $this->CleanUp(); … … 509 683 510 684 511 // private: warning handling 685 /** 686 * Warning handling. 687 * 688 * @param string $message 689 * 690 * @return bool 691 */ 512 692 public function warning($message) { 513 693 $this->info['warning'][] = $message; … … 516 696 517 697 518 // private: CleanUp 698 /** 699 * @return bool 700 */ 519 701 private function CleanUp() { 520 702 … … 563 745 } 564 746 565 566 // return array containing information about all supported formats 747 /** 748 * Return array containing information about all supported formats. 749 * 750 * @return array 751 */ 567 752 public function GetFileFormatArray() { 568 753 static $format_info = array(); … … 585 770 'group' => 'audio', 586 771 'module' => 'aac', 587 'mime_type' => 'a pplication/octet-stream',772 'mime_type' => 'audio/aac', 588 773 'fail_ape' => 'WARNING', 589 774 ), … … 603 788 'group' => 'audio', 604 789 'module' => 'aac', 605 'mime_type' => 'a pplication/octet-stream',790 'mime_type' => 'audio/aac', 606 791 'fail_ape' => 'WARNING', 607 792 ), … … 650 835 // DSS - audio - Digital Speech Standard 651 836 'dss' => array( 652 'pattern' => '^[\\x02-\\x0 6]ds[s2]',837 'pattern' => '^[\\x02-\\x08]ds[s2]', 653 838 'group' => 'audio', 654 839 'module' => 'dss', … … 669 854 'group' => 'audio', 670 855 'module' => 'flac', 671 'mime_type' => 'audio/ x-flac',856 'mime_type' => 'audio/flac', 672 857 ), 673 858 … … 701 886 'group' => 'audio', 702 887 'module' => 'monkey', 703 'mime_type' => 'a pplication/octet-stream',888 'mime_type' => 'audio/x-monkeys-audio', 704 889 ), 705 890 … … 890 1075 'group' => 'audio-video', 891 1076 'module' => 'riff', 892 'mime_type' => 'audio/ x-wav',1077 'mime_type' => 'audio/wav', 893 1078 'fail_ape' => 'WARNING', 894 1079 ), … … 1054 1239 'group' => 'archive', 1055 1240 'module' => 'gzip', 1056 'mime_type' => 'application/ x-gzip',1241 'mime_type' => 'application/gzip', 1057 1242 'fail_id3' => 'ERROR', 1058 1243 'fail_ape' => 'ERROR', … … 1069 1254 ), 1070 1255 1256 // XZ - data - XZ compressed data 1257 'xz' => array( 1258 'pattern' => '^\\xFD7zXZ\\x00', 1259 'group' => 'archive', 1260 'module' => 'xz', 1261 'mime_type' => 'application/x-xz', 1262 'fail_id3' => 'ERROR', 1263 'fail_ape' => 'ERROR', 1264 ), 1265 1071 1266 1072 1267 // Misc other formats … … 1116 1311 } 1117 1312 1118 1119 1313 /** 1314 * @param string $filedata 1315 * @param string $filename 1316 * 1317 * @return mixed|false 1318 */ 1120 1319 public function GetFileFormat(&$filedata, $filename='') { 1121 1320 // this function will determine the format of a file based on usually … … 1136 1335 1137 1336 if (preg_match('#\\.mp[123a]$#i', $filename)) { 1138 // Too many mp3 encoders on the market put ga bage in front of mpeg files1337 // Too many mp3 encoders on the market put garbage in front of mpeg files 1139 1338 // use assume format on these if format detection failed 1140 1339 $GetFileFormatArray = $this->GetFileFormatArray(); … … 1155 1354 } 1156 1355 1157 1158 // converts array to $encoding charset from $this->encoding 1356 /** 1357 * Converts array to $encoding charset from $this->encoding. 1358 * 1359 * @param array $array 1360 * @param string $encoding 1361 */ 1159 1362 public function CharConvert(&$array, $encoding) { 1160 1363 … … 1179 1382 } 1180 1383 1181 1384 /** 1385 * @return bool 1386 */ 1182 1387 public function HandleAllTags() { 1183 1388 … … 1234 1439 } 1235 1440 if ($tag_key == 'picture') { 1441 // pictures can take up a lot of space, and we don't need multiple copies of them; let there be a single copy in [comments][picture], and not elsewhere 1236 1442 unset($this->info[$comment_name]['comments'][$tag_key]); 1237 1443 } … … 1247 1453 if ($this->option_tags_html) { 1248 1454 foreach ($this->info['tags'][$tag_name] as $tag_key => $valuearray) { 1455 if ($tag_key == 'picture') { 1456 // Do not to try to convert binary picture data to HTML 1457 // https://github.com/JamesHeinrich/getID3/issues/178 1458 continue; 1459 } 1249 1460 $this->info['tags_html'][$tag_name][$tag_key] = getid3_lib::recursiveMultiByteCharString2HTML($valuearray, $this->info[$comment_name]['encoding']); 1250 1461 } … … 1255 1466 } 1256 1467 1257 // pictures can take up a lot of space, and we don't need multiple copies of them 1258 // let there be a single copy in [comments][picture], and not elsewhere 1468 // pictures can take up a lot of space, and we don't need multiple copies of them; let there be a single copy in [comments][picture], and not elsewhere 1259 1469 if (!empty($this->info['tags'])) { 1260 1470 $unset_keys = array('tags', 'tags_html'); … … 1302 1512 } 1303 1513 1514 /** 1515 * @param string $algorithm 1516 * 1517 * @return array|bool 1518 */ 1304 1519 public function getHashdata($algorithm) { 1305 1520 switch ($algorithm) { … … 1366 1581 } else { 1367 1582 1368 $commandline = 'vorbiscomment -w -c "'.$empty.'" "'.$file.'" "'.$temp.'" 2>&1';1369 1583 $commandline = 'vorbiscomment -w -c '.escapeshellarg($empty).' '.escapeshellarg($file).' '.escapeshellarg($temp).' 2>&1'; 1370 1584 $VorbisCommentError = `$commandline`; … … 1424 1638 return true; 1425 1639 } 1426 1427 1640 1428 1641 public function ChannelsBitratePlaytimeCalculations() { … … 1490 1703 } 1491 1704 1492 1705 /** 1706 * @return bool 1707 */ 1493 1708 public function CalculateCompressionRatioVideo() { 1494 1709 if (empty($this->info['video'])) { … … 1538 1753 } 1539 1754 1540 1755 /** 1756 * @return bool 1757 */ 1541 1758 public function CalculateCompressionRatioAudio() { 1542 1759 if (empty($this->info['audio']['bitrate']) || empty($this->info['audio']['channels']) || empty($this->info['audio']['sample_rate']) || !is_numeric($this->info['audio']['sample_rate'])) { … … 1555 1772 } 1556 1773 1557 1774 /** 1775 * @return bool 1776 */ 1558 1777 public function CalculateReplayGain() { 1559 1778 if (isset($this->info['replay_gain'])) { 1560 1779 if (!isset($this->info['replay_gain']['reference_volume'])) { 1561 $this->info['replay_gain']['reference_volume'] = (double)89.0;1780 $this->info['replay_gain']['reference_volume'] = 89.0; 1562 1781 } 1563 1782 if (isset($this->info['replay_gain']['track']['adjustment'])) { … … 1578 1797 } 1579 1798 1799 /** 1800 * @return bool 1801 */ 1580 1802 public function ProcessAudioStreams() { 1581 1803 if (!empty($this->info['audio']['bitrate']) || !empty($this->info['audio']['channels']) || !empty($this->info['audio']['sample_rate'])) { … … 1591 1813 } 1592 1814 1815 /** 1816 * @return string|bool 1817 */ 1593 1818 public function getid3_tempnam() { 1594 1819 return tempnam($this->tempdir, 'gI3'); 1595 1820 } 1596 1821 1822 /** 1823 * @param string $name 1824 * 1825 * @return bool 1826 * 1827 * @throws getid3_exception 1828 */ 1597 1829 public function include_module($name) { 1598 1830 //if (!file_exists($this->include_path.'module.'.$name.'.php')) { … … 1604 1836 } 1605 1837 1606 public static function is_writable ($filename) { 1607 $ret = is_writable($filename); 1608 1609 if (!$ret) { 1610 $perms = fileperms($filename); 1611 $ret = ($perms & 0x0080) || ($perms & 0x0010) || ($perms & 0x0002); 1612 } 1613 1614 return $ret; 1615 } 1838 /** 1839 * @param string $filename 1840 * 1841 * @return bool 1842 */ 1843 public static function is_writable ($filename) { 1844 $ret = is_writable($filename); 1845 if (!$ret) { 1846 $perms = fileperms($filename); 1847 $ret = ($perms & 0x0080) || ($perms & 0x0010) || ($perms & 0x0002); 1848 } 1849 return $ret; 1850 } 1616 1851 1617 1852 } 1618 1853 1619 1854 1620 abstract class getid3_handler { 1855 abstract class getid3_handler 1856 { 1621 1857 1622 1858 /** … … 1625 1861 protected $getid3; // pointer 1626 1862 1627 protected $data_string_flag = false; // analyzing filepointer or string 1628 protected $data_string = ''; // string to analyze 1629 protected $data_string_position = 0; // seek position in string 1630 protected $data_string_length = 0; // string length 1631 1632 private $dependency_to = null; 1633 1634 1863 /** 1864 * Analyzing filepointer or string. 1865 * 1866 * @var bool 1867 */ 1868 protected $data_string_flag = false; 1869 1870 /** 1871 * String to analyze. 1872 * 1873 * @var string 1874 */ 1875 protected $data_string = ''; 1876 1877 /** 1878 * Seek position in string. 1879 * 1880 * @var int 1881 */ 1882 protected $data_string_position = 0; 1883 1884 /** 1885 * String length. 1886 * 1887 * @var int 1888 */ 1889 protected $data_string_length = 0; 1890 1891 /** 1892 * @var string 1893 */ 1894 private $dependency_to; 1895 1896 /** 1897 * getid3_handler constructor. 1898 * 1899 * @param getID3 $getid3 1900 * @param string $call_module 1901 */ 1635 1902 public function __construct(getID3 $getid3, $call_module=null) { 1636 1903 $this->getid3 = $getid3; … … 1641 1908 } 1642 1909 1643 1644 // Analyze from file pointer 1910 /** 1911 * Analyze from file pointer. 1912 * 1913 * @return bool 1914 */ 1645 1915 abstract public function Analyze(); 1646 1916 1647 1648 // Analyze from string instead 1917 /** 1918 * Analyze from string instead. 1919 * 1920 * @param string $string 1921 */ 1649 1922 public function AnalyzeString($string) { 1650 1923 // Enter string mode … … 1672 1945 } 1673 1946 1947 /** 1948 * @param string $string 1949 */ 1674 1950 public function setStringMode($string) { 1675 1951 $this->data_string_flag = true; … … 1678 1954 } 1679 1955 1956 /** 1957 * @return int|bool 1958 */ 1680 1959 protected function ftell() { 1681 1960 if ($this->data_string_flag) { … … 1685 1964 } 1686 1965 1966 /** 1967 * @param int $bytes 1968 * 1969 * @return string|false 1970 * 1971 * @throws getid3_exception 1972 */ 1687 1973 protected function fread($bytes) { 1688 1974 if ($this->data_string_flag) { … … 1697 1983 //return fread($this->getid3->fp, $bytes); 1698 1984 /* 1699 * http ://www.getid3.org/phpBB3/viewtopic.php?t=19301985 * https://www.getid3.org/phpBB3/viewtopic.php?t=1930 1700 1986 * "I found out that the root cause for the problem was how getID3 uses the PHP system function fread(). 1701 1987 * It seems to assume that fread() would always return as many bytes as were requested. … … 1705 1991 $contents = ''; 1706 1992 do { 1993 //if (($this->getid3->memory_limit > 0) && ($bytes > $this->getid3->memory_limit)) { 1994 if (($this->getid3->memory_limit > 0) && (($bytes / $this->getid3->memory_limit) > 0.99)) { // enable a more-fuzzy match to prevent close misses generating errors like "PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 33554464 bytes)" 1995 throw new getid3_exception('cannot fread('.$bytes.' from '.$this->ftell().') that is more than available PHP memory ('.$this->getid3->memory_limit.')', 10); 1996 } 1707 1997 $part = fread($this->getid3->fp, $bytes); 1708 1998 $partLength = strlen($part); … … 1713 2003 } 1714 2004 2005 /** 2006 * @param int $bytes 2007 * @param int $whence 2008 * 2009 * @return int 2010 * 2011 * @throws getid3_exception 2012 */ 1715 2013 protected function fseek($bytes, $whence=SEEK_SET) { 1716 2014 if ($this->data_string_flag) { … … 1743 2041 } 1744 2042 2043 /** 2044 * @return bool 2045 */ 1745 2046 protected function feof() { 1746 2047 if ($this->data_string_flag) { … … 1750 2051 } 1751 2052 2053 /** 2054 * @param string $module 2055 * 2056 * @return bool 2057 */ 1752 2058 final protected function isDependencyFor($module) { 1753 2059 return $this->dependency_to == $module; 1754 2060 } 1755 2061 2062 /** 2063 * @param string $text 2064 * 2065 * @return bool 2066 */ 1756 2067 protected function error($text) { 1757 2068 $this->getid3->info['error'][] = $text; … … 1760 2071 } 1761 2072 2073 /** 2074 * @param string $text 2075 * 2076 * @return bool 2077 */ 1762 2078 protected function warning($text) { 1763 2079 return $this->getid3->warning($text); 1764 2080 } 1765 2081 2082 /** 2083 * @param string $text 2084 */ 1766 2085 protected function notice($text) { 1767 2086 // does nothing for now 1768 2087 } 1769 2088 2089 /** 2090 * @param string $name 2091 * @param int $offset 2092 * @param int $length 2093 * @param string $image_mime 2094 * 2095 * @return string|null 2096 * 2097 * @throws Exception 2098 * @throws getid3_exception 2099 */ 1770 2100 public function saveAttachment($name, $offset, $length, $image_mime=null) { 1771 2101 try { … … 1821 2151 if (isset($fp_dest) && is_resource($fp_dest)) { 1822 2152 fclose($fp_dest); 2153 } 2154 2155 if (isset($dest) && file_exists($dest)) { 1823 2156 unlink($dest); 1824 2157 }
Note: See TracChangeset
for help on using the changeset viewer.