@@ -401,6 +401,9 @@ |
||
| 401 | 401 | ///////////////////////////////////////////////////////////////// |
| 402 | 402 | |
| 403 | 403 | |
| 404 | +/** |
|
| 405 | + * @param string $string |
|
| 406 | + */ |
|
| 404 | 407 | function RemoveAccents($string) { |
| 405 | 408 | // Revised version by markstewardרotmail*com |
| 406 | 409 | // Again revised by James Heinrich (19-June-2006) |
@@ -1,6 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if (!function_exists('PrintHexBytes')) { |
| 4 | + |
|
| 5 | + /** |
|
| 6 | + * @param string $string |
|
| 7 | + */ |
|
| 4 | 8 | function PrintHexBytes($string) { |
| 5 | 9 | $returnstring = ''; |
| 6 | 10 | for ($i = 0; $i < strlen($string); $i++) { |
@@ -118,6 +122,10 @@ discard block |
||
| 118 | 122 | } |
| 119 | 123 | |
| 120 | 124 | if (!function_exists('fileextension')) { |
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * @param string $filename |
|
| 128 | + */ |
|
| 121 | 129 | function fileextension($filename, $numextensions=1) { |
| 122 | 130 | if (strstr($filename, '.')) { |
| 123 | 131 | $reversedfilename = strrev($filename); |
@@ -135,6 +143,10 @@ discard block |
||
| 135 | 143 | } |
| 136 | 144 | |
| 137 | 145 | if (!function_exists('RemoveAccents')) { |
| 146 | + |
|
| 147 | + /** |
|
| 148 | + * @param string $string |
|
| 149 | + */ |
|
| 138 | 150 | function RemoveAccents($string) { |
| 139 | 151 | // return strtr($string, '¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ', 'SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy'); |
| 140 | 152 | // Revised version by [email protected] |
@@ -219,6 +231,10 @@ discard block |
||
| 219 | 231 | } |
| 220 | 232 | |
| 221 | 233 | if (!function_exists('DecimalBinary2Float')) { |
| 234 | + |
|
| 235 | + /** |
|
| 236 | + * @param string $binarynumerator |
|
| 237 | + */ |
|
| 222 | 238 | function DecimalBinary2Float($binarynumerator) { |
| 223 | 239 | $numerator = Bin2Dec($binarynumerator); |
| 224 | 240 | $denominator = Bin2Dec(str_repeat('1', strlen($binarynumerator))); |
@@ -227,6 +243,10 @@ discard block |
||
| 227 | 243 | } |
| 228 | 244 | |
| 229 | 245 | if (!function_exists('NormalizeBinaryPoint')) { |
| 246 | + |
|
| 247 | + /** |
|
| 248 | + * @param string $binarypointnumber |
|
| 249 | + */ |
|
| 230 | 250 | function NormalizeBinaryPoint($binarypointnumber, $maxbits=52) { |
| 231 | 251 | // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html |
| 232 | 252 | if (strpos($binarypointnumber, '.') === false) { |
@@ -307,6 +327,10 @@ discard block |
||
| 307 | 327 | } |
| 308 | 328 | |
| 309 | 329 | if (!function_exists('BigEndian2Float')) { |
| 330 | + |
|
| 331 | + /** |
|
| 332 | + * @param string $byteword |
|
| 333 | + */ |
|
| 310 | 334 | function BigEndian2Float($byteword) { |
| 311 | 335 | // ANSI/IEEE Standard 754-1985, Standard for Binary Floating Point Arithmetic |
| 312 | 336 | // http://www.psc.edu/general/software/packages/ieee/ieee.html |
@@ -381,6 +405,10 @@ discard block |
||
| 381 | 405 | } |
| 382 | 406 | |
| 383 | 407 | if (!function_exists('BigEndian2Int')) { |
| 408 | + |
|
| 409 | + /** |
|
| 410 | + * @param string $byteword |
|
| 411 | + */ |
|
| 384 | 412 | function BigEndian2Int($byteword, $synchsafe=false, $signed=false) { |
| 385 | 413 | $intvalue = 0; |
| 386 | 414 | $bytewordlen = strlen($byteword); |
@@ -453,6 +481,10 @@ discard block |
||
| 453 | 481 | } |
| 454 | 482 | |
| 455 | 483 | if (!function_exists('Dec2Bin')) { |
| 484 | + |
|
| 485 | + /** |
|
| 486 | + * @param integer $number |
|
| 487 | + */ |
|
| 456 | 488 | function Dec2Bin($number) { |
| 457 | 489 | while ($number >= 256) { |
| 458 | 490 | $bytes[] = (($number / 256) - (floor($number / 256))) * 256; |
@@ -738,6 +770,10 @@ discard block |
||
| 738 | 770 | } |
| 739 | 771 | |
| 740 | 772 | if (!function_exists('CloseMatch')) { |
| 773 | + |
|
| 774 | + /** |
|
| 775 | + * @param integer $tolerance |
|
| 776 | + */ |
|
| 741 | 777 | function CloseMatch($value1, $value2, $tolerance) { |
| 742 | 778 | return (abs($value1 - $value2) <= $tolerance); |
| 743 | 779 | } |
@@ -2242,6 +2278,9 @@ discard block |
||
| 2242 | 2278 | return true; |
| 2243 | 2279 | } |
| 2244 | 2280 | |
| 2281 | +/** |
|
| 2282 | + * @param boolean $ScanAsCBR |
|
| 2283 | + */ |
|
| 2245 | 2284 | function RecursiveFrameScanning(&$fd, &$ThisFileInfo, &$offset, &$nextframetestoffset, $ScanAsCBR) { |
| 2246 | 2285 | for ($i = 0; $i < MPEG_VALID_CHECK_FRAMES; $i++) { |
| 2247 | 2286 | // check next MPEG_VALID_CHECK_FRAMES frames for validity, to make sure we haven't run across a false synch |
@@ -2769,6 +2808,9 @@ discard block |
||
| 2769 | 2808 | return $MPEGrawHeader; |
| 2770 | 2809 | } |
| 2771 | 2810 | |
| 2811 | +/** |
|
| 2812 | + * @param integer $padding |
|
| 2813 | + */ |
|
| 2772 | 2814 | function MPEGaudioFrameLength(&$bitrate, &$version, &$layer, $padding, &$samplerate) { |
| 2773 | 2815 | static $AudioFrameLengthCache = array(); |
| 2774 | 2816 | |
@@ -54,6 +54,9 @@ discard block |
||
| 54 | 54 | )); |
| 55 | 55 | |
| 56 | 56 | |
| 57 | +/** |
|
| 58 | + * @param string $string |
|
| 59 | + */ |
|
| 57 | 60 | function RemoveAccents($string) { |
| 58 | 61 | // Revised version by markstewardØhotmail*com |
| 59 | 62 | return strtr(strtr($string, 'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ', 'SZszYAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy'), array('Þ' => 'TH', 'þ' => 'th', 'Ð' => 'DH', 'ð' => 'dh', 'ß' => 'ss', '' => 'OE', '' => 'oe', 'Æ' => 'AE', 'æ' => 'ae', 'µ' => 'u')); |
@@ -81,6 +84,9 @@ discard block |
||
| 81 | 84 | return '<span style="color: #'.BitrateColor($bitrate).'">'.number_format($bitrate, $decimals).' kbps</span>'; |
| 82 | 85 | } |
| 83 | 86 | |
| 87 | +/** |
|
| 88 | + * @param string $filename |
|
| 89 | + */ |
|
| 84 | 90 | function fileextension($filename, $numextensions=1) { |
| 85 | 91 | if (strstr($filename, '.')) { |
| 86 | 92 | $reversedfilename = strrev($filename); |
@@ -152,6 +158,9 @@ discard block |
||
| 152 | 158 | return $filename; |
| 153 | 159 | } |
| 154 | 160 | |
| 161 | +/** |
|
| 162 | + * @param string $SQLquery |
|
| 163 | + */ |
|
| 155 | 164 | function mysql_query_safe($SQLquery) { |
| 156 | 165 | static $TimeSpentQuerying = 0; |
| 157 | 166 | if ($SQLquery === null) { |
@@ -2095,6 +2104,9 @@ discard block |
||
| 2095 | 2104 | return $DirectoryName.'/'.BetterUCwords($BaseFilename).'.'.strtolower($FileExtension); |
| 2096 | 2105 | } |
| 2097 | 2106 | |
| 2107 | +/** |
|
| 2108 | + * @param string $string |
|
| 2109 | + */ |
|
| 2098 | 2110 | function BetterUCwords($string) { |
| 2099 | 2111 | $stringlength = strlen($string); |
| 2100 | 2112 | |
@@ -94,7 +94,7 @@ |
||
| 94 | 94 | /** |
| 95 | 95 | * __construct() |
| 96 | 96 | * @param string $table holds name of sqlite table |
| 97 | - * @return type |
|
| 97 | + * @return boolean |
|
| 98 | 98 | */ |
| 99 | 99 | public function __construct($table='getid3_cache', $hide=false) { |
| 100 | 100 | $this->table = $table; // Set table |
@@ -99,6 +99,9 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | |
| 102 | + /** |
|
| 103 | + * @param string $binarynumerator |
|
| 104 | + */ |
|
| 102 | 105 | public static function DecimalBinary2Float($binarynumerator) { |
| 103 | 106 | $numerator = self::Bin2Dec($binarynumerator); |
| 104 | 107 | $denominator = self::Bin2Dec('1'.str_repeat('0', strlen($binarynumerator))); |
@@ -106,6 +109,9 @@ discard block |
||
| 106 | 109 | } |
| 107 | 110 | |
| 108 | 111 | |
| 112 | + /** |
|
| 113 | + * @param string $binarypointnumber |
|
| 114 | + */ |
|
| 109 | 115 | public static function NormalizeBinaryPoint($binarypointnumber, $maxbits=52) { |
| 110 | 116 | // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html |
| 111 | 117 | if (strpos($binarypointnumber, '.') === false) { |
@@ -146,6 +152,9 @@ discard block |
||
| 146 | 152 | } |
| 147 | 153 | |
| 148 | 154 | |
| 155 | + /** |
|
| 156 | + * @param integer $bits |
|
| 157 | + */ |
|
| 149 | 158 | public static function Float2String($floatvalue, $bits) { |
| 150 | 159 | // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee-expl.html |
| 151 | 160 | switch ($bits) { |
@@ -177,6 +186,9 @@ discard block |
||
| 177 | 186 | } |
| 178 | 187 | |
| 179 | 188 | |
| 189 | + /** |
|
| 190 | + * @param string $byteword |
|
| 191 | + */ |
|
| 180 | 192 | public static function LittleEndian2Float($byteword) { |
| 181 | 193 | return self::BigEndian2Float(strrev($byteword)); |
| 182 | 194 | } |
@@ -355,6 +367,9 @@ discard block |
||
| 355 | 367 | } |
| 356 | 368 | |
| 357 | 369 | |
| 370 | + /** |
|
| 371 | + * @param string $binstring |
|
| 372 | + */ |
|
| 358 | 373 | public static function Bin2String($binstring) { |
| 359 | 374 | // return 'hi' for input of '0110100001101001' |
| 360 | 375 | $string = ''; |
@@ -366,6 +381,9 @@ discard block |
||
| 366 | 381 | } |
| 367 | 382 | |
| 368 | 383 | |
| 384 | + /** |
|
| 385 | + * @param integer $number |
|
| 386 | + */ |
|
| 369 | 387 | public static function LittleEndian2String($number, $minbytes=1, $synchsafe=false) { |
| 370 | 388 | $intstring = ''; |
| 371 | 389 | while ($number > 0) { |
@@ -472,22 +490,34 @@ discard block |
||
| 472 | 490 | } |
| 473 | 491 | |
| 474 | 492 | |
| 493 | + /** |
|
| 494 | + * @param string $rawdata |
|
| 495 | + */ |
|
| 475 | 496 | public static function FixedPoint8_8($rawdata) { |
| 476 | 497 | return self::BigEndian2Int(substr($rawdata, 0, 1)) + (float) (self::BigEndian2Int(substr($rawdata, 1, 1)) / pow(2, 8)); |
| 477 | 498 | } |
| 478 | 499 | |
| 479 | 500 | |
| 501 | + /** |
|
| 502 | + * @param string $rawdata |
|
| 503 | + */ |
|
| 480 | 504 | public static function FixedPoint16_16($rawdata) { |
| 481 | 505 | return self::BigEndian2Int(substr($rawdata, 0, 2)) + (float) (self::BigEndian2Int(substr($rawdata, 2, 2)) / pow(2, 16)); |
| 482 | 506 | } |
| 483 | 507 | |
| 484 | 508 | |
| 509 | + /** |
|
| 510 | + * @param string $rawdata |
|
| 511 | + */ |
|
| 485 | 512 | public static function FixedPoint2_30($rawdata) { |
| 486 | 513 | $binarystring = self::BigEndian2Bin($rawdata); |
| 487 | 514 | return self::Bin2Dec(substr($binarystring, 0, 2)) + (float) (self::Bin2Dec(substr($binarystring, 2, 30)) / pow(2, 30)); |
| 488 | 515 | } |
| 489 | 516 | |
| 490 | 517 | |
| 518 | + /** |
|
| 519 | + * @param string $Separator |
|
| 520 | + */ |
|
| 491 | 521 | public static function CreateDeepArray($ArrayPath, $Separator, $Value) { |
| 492 | 522 | // assigns $Value to a nested array path: |
| 493 | 523 | // $foo = self::CreateDeepArray('/path/to/my', '/', 'file.txt') |
@@ -545,6 +575,9 @@ discard block |
||
| 545 | 575 | return false; |
| 546 | 576 | } |
| 547 | 577 | |
| 578 | + /** |
|
| 579 | + * @param SimpleXMLElement $XMLobject |
|
| 580 | + */ |
|
| 548 | 581 | public static function SimpleXMLelement2array($XMLobject) { |
| 549 | 582 | if (!is_object($XMLobject) && !is_array($XMLobject)) { |
| 550 | 583 | return $XMLobject; |
@@ -645,6 +678,9 @@ discard block |
||
| 645 | 678 | return $result; |
| 646 | 679 | } |
| 647 | 680 | |
| 681 | + /** |
|
| 682 | + * @param string $filename_dest |
|
| 683 | + */ |
|
| 648 | 684 | public static function CopyFileParts($filename_source, $filename_dest, $offset, $length) { |
| 649 | 685 | if (!self::intValueSupported($offset + $length)) { |
| 650 | 686 | throw new Exception('cannot copy file portion, it extends beyond the '.round(PHP_INT_MAX / 1073741824).'GB limit'); |
@@ -877,6 +913,10 @@ discard block |
||
| 877 | 913 | } |
| 878 | 914 | |
| 879 | 915 | // UTF-16BE => UTF-8 |
| 916 | + |
|
| 917 | + /** |
|
| 918 | + * @param string $string |
|
| 919 | + */ |
|
| 880 | 920 | public static function iconv_fallback_utf16be_utf8($string) { |
| 881 | 921 | if (substr($string, 0, 2) == "\xFE\xFF") { |
| 882 | 922 | // strip BOM |
@@ -891,6 +931,10 @@ discard block |
||
| 891 | 931 | } |
| 892 | 932 | |
| 893 | 933 | // UTF-16LE => UTF-8 |
| 934 | + |
|
| 935 | + /** |
|
| 936 | + * @param string $string |
|
| 937 | + */ |
|
| 894 | 938 | public static function iconv_fallback_utf16le_utf8($string) { |
| 895 | 939 | if (substr($string, 0, 2) == "\xFF\xFE") { |
| 896 | 940 | // strip BOM |
@@ -905,6 +949,10 @@ discard block |
||
| 905 | 949 | } |
| 906 | 950 | |
| 907 | 951 | // UTF-16BE => ISO-8859-1 |
| 952 | + |
|
| 953 | + /** |
|
| 954 | + * @param string $string |
|
| 955 | + */ |
|
| 908 | 956 | public static function iconv_fallback_utf16be_iso88591($string) { |
| 909 | 957 | if (substr($string, 0, 2) == "\xFE\xFF") { |
| 910 | 958 | // strip BOM |
@@ -919,6 +967,10 @@ discard block |
||
| 919 | 967 | } |
| 920 | 968 | |
| 921 | 969 | // UTF-16LE => ISO-8859-1 |
| 970 | + |
|
| 971 | + /** |
|
| 972 | + * @param string $string |
|
| 973 | + */ |
|
| 922 | 974 | public static function iconv_fallback_utf16le_iso88591($string) { |
| 923 | 975 | if (substr($string, 0, 2) == "\xFF\xFE") { |
| 924 | 976 | // strip BOM |
@@ -1324,6 +1376,12 @@ discard block |
||
| 1324 | 1376 | } |
| 1325 | 1377 | |
| 1326 | 1378 | |
| 1379 | + /** |
|
| 1380 | + * @param integer $begin |
|
| 1381 | + * @param integer $end |
|
| 1382 | + * @param string $file |
|
| 1383 | + * @param string $name |
|
| 1384 | + */ |
|
| 1327 | 1385 | public static function EmbeddedLookup($key, $begin, $end, $file, $name) { |
| 1328 | 1386 | |
| 1329 | 1387 | // Cached |
@@ -1370,6 +1428,10 @@ discard block |
||
| 1370 | 1428 | return (isset($cache[$file][$name][$key]) ? $cache[$file][$name][$key] : ''); |
| 1371 | 1429 | } |
| 1372 | 1430 | |
| 1431 | + /** |
|
| 1432 | + * @param string $filename |
|
| 1433 | + * @param string $sourcefile |
|
| 1434 | + */ |
|
| 1373 | 1435 | public static function IncludeDependency($filename, $sourcefile, $DieOnFailure=false) { |
| 1374 | 1436 | global $GETID3_ERRORARRAY; |
| 1375 | 1437 | |
@@ -1124,6 +1124,9 @@ discard block |
||
| 1124 | 1124 | |
| 1125 | 1125 | |
| 1126 | 1126 | |
| 1127 | + /** |
|
| 1128 | + * @param string $filedata |
|
| 1129 | + */ |
|
| 1127 | 1130 | public function GetFileFormat(&$filedata, $filename='') { |
| 1128 | 1131 | // this function will determine the format of a file based on usually |
| 1129 | 1132 | // the first 2-4 bytes of the file (8 bytes for PNG, 16 bytes for JPG, |
@@ -1308,6 +1311,9 @@ discard block |
||
| 1308 | 1311 | return true; |
| 1309 | 1312 | } |
| 1310 | 1313 | |
| 1314 | + /** |
|
| 1315 | + * @param string $algorithm |
|
| 1316 | + */ |
|
| 1311 | 1317 | public function getHashdata($algorithm) { |
| 1312 | 1318 | switch ($algorithm) { |
| 1313 | 1319 | case 'md5': |
@@ -1601,6 +1607,9 @@ discard block |
||
| 1601 | 1607 | return tempnam($this->tempdir, 'gI3'); |
| 1602 | 1608 | } |
| 1603 | 1609 | |
| 1610 | + /** |
|
| 1611 | + * @param string $name |
|
| 1612 | + */ |
|
| 1604 | 1613 | public function include_module($name) { |
| 1605 | 1614 | //if (!file_exists($this->include_path.'module.'.$name.'.php')) { |
| 1606 | 1615 | if (!file_exists(GETID3_INCLUDEPATH.'module.'.$name.'.php')) { |
@@ -1628,6 +1637,9 @@ discard block |
||
| 1628 | 1637 | private $dependency_to = null; |
| 1629 | 1638 | |
| 1630 | 1639 | |
| 1640 | + /** |
|
| 1641 | + * @param string $call_module |
|
| 1642 | + */ |
|
| 1631 | 1643 | public function __construct(getID3 $getid3, $call_module=null) { |
| 1632 | 1644 | $this->getid3 = $getid3; |
| 1633 | 1645 | |
@@ -1708,6 +1720,9 @@ discard block |
||
| 1708 | 1720 | return $contents; |
| 1709 | 1721 | } |
| 1710 | 1722 | |
| 1723 | + /** |
|
| 1724 | + * @param integer $whence |
|
| 1725 | + */ |
|
| 1711 | 1726 | protected function fseek($bytes, $whence=SEEK_SET) { |
| 1712 | 1727 | if ($this->data_string_flag) { |
| 1713 | 1728 | switch ($whence) { |
@@ -1745,10 +1760,16 @@ discard block |
||
| 1745 | 1760 | return feof($this->getid3->fp); |
| 1746 | 1761 | } |
| 1747 | 1762 | |
| 1763 | + /** |
|
| 1764 | + * @param string $module |
|
| 1765 | + */ |
|
| 1748 | 1766 | final protected function isDependencyFor($module) { |
| 1749 | 1767 | return $this->dependency_to == $module; |
| 1750 | 1768 | } |
| 1751 | 1769 | |
| 1770 | + /** |
|
| 1771 | + * @param string $text |
|
| 1772 | + */ |
|
| 1752 | 1773 | protected function error($text) { |
| 1753 | 1774 | $this->getid3->info['error'][] = $text; |
| 1754 | 1775 | |
@@ -1759,6 +1780,9 @@ discard block |
||
| 1759 | 1780 | return $this->getid3->warning($text); |
| 1760 | 1781 | } |
| 1761 | 1782 | |
| 1783 | + /** |
|
| 1784 | + * @param string $text |
|
| 1785 | + */ |
|
| 1762 | 1786 | protected function notice($text) { |
| 1763 | 1787 | // does nothing for now |
| 1764 | 1788 | } |
@@ -153,6 +153,10 @@ |
||
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | // Converts the file type |
| 156 | + |
|
| 157 | + /** |
|
| 158 | + * @param string $typflag |
|
| 159 | + */ |
|
| 156 | 160 | public function get_flag_type($typflag) { |
| 157 | 161 | static $flag_types = array( |
| 158 | 162 | '0' => 'LF_NORMAL', |
@@ -426,6 +426,9 @@ |
||
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | |
| 429 | + /** |
|
| 430 | + * @param integer $index |
|
| 431 | + */ |
|
| 429 | 432 | public static function ZIPversionOSLookup($index) { |
| 430 | 433 | static $ZIPversionOSLookup = array( |
| 431 | 434 | 0 => 'MS-DOS and OS/2 (FAT / VFAT / FAT32 file systems)', |
@@ -1684,6 +1684,10 @@ |
||
| 1684 | 1684 | return (isset($lookup[$WMpictureType]) ? $lookup[$WMpictureType] : ''); |
| 1685 | 1685 | } |
| 1686 | 1686 | |
| 1687 | + /** |
|
| 1688 | + * @param string $asf_header_extension_object_data |
|
| 1689 | + * @param integer $unhandled_sections |
|
| 1690 | + */ |
|
| 1687 | 1691 | public function HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) { |
| 1688 | 1692 | // http://msdn.microsoft.com/en-us/library/bb643323.aspx |
| 1689 | 1693 | |