Changeset 48278 for trunk/src/wp-includes/ID3/getid3.php
- Timestamp:
- 07/02/2020 03:46:17 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ID3/getid3.php
r47737 r48278 100 100 public $encoding_id3v1 = 'ISO-8859-1'; 101 101 102 /** 103 * ID3v1 should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'Windows-1251' or 'KOI8-R'. If true attempt to detect these encodings, but may return incorrect values for some tags actually in ISO-8859-1 encoding 104 * 105 * @var bool 106 */ 107 public $encoding_id3v1_autodetect = false; 108 102 109 /* 103 110 * Optional tag checks - disable for speed. … … 251 258 protected $startup_warning = ''; 252 259 253 const VERSION = '1.9. 19-201912211559';260 const VERSION = '1.9.20-202006061653'; 254 261 const FREAD_BUFFER_SIZE = 32768; 255 262 … … 290 297 } 291 298 292 if (($mbstring_func_overload = (int) ini_get('mbstring.func_overload')) && ($mbstring_func_overload & 0x02)) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated 299 // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated 300 if (($mbstring_func_overload = (int) ini_get('mbstring.func_overload')) && ($mbstring_func_overload & 0x02)) { 293 301 // http://php.net/manual/en/mbstring.overload.php 294 302 // "mbstring.func_overload in php.ini is a positive value that represents a combination of bitmasks specifying the categories of functions to be overloaded. It should be set to 1 to overload the mail() function. 2 for string functions, 4 for regular expression functions" 295 303 // getID3 cannot run when string functions are overloaded. It doesn't matter if mail() or ereg* functions are overloaded since getID3 does not use those. 296 $this->startup_error .= 'WARNING: php.ini contains "mbstring.func_overload = '.ini_get('mbstring.func_overload').'", getID3 cannot run with this setting (bitmask 2 (string functions) cannot be set). Recommended to disable entirely.'."\n"; // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated 304 // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated 305 $this->startup_error .= 'WARNING: php.ini contains "mbstring.func_overload = '.ini_get('mbstring.func_overload').'", getID3 cannot run with this setting (bitmask 2 (string functions) cannot be set). Recommended to disable entirely.'."\n"; 297 306 } 298 307 … … 301 310 // Check for magic_quotes_runtime 302 311 if (function_exists('get_magic_quotes_runtime')) { 303 if (get_magic_quotes_runtime()) { // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_runtimeDeprecated 312 // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_runtimeDeprecated 313 if (get_magic_quotes_runtime()) { 304 314 $this->startup_error .= 'magic_quotes_runtime must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_runtime(0) and set_magic_quotes_runtime(1).'."\n"; 305 315 } … … 307 317 // Check for magic_quotes_gpc 308 318 if (function_exists('get_magic_quotes_gpc')) { 309 if (get_magic_quotes_gpc()) { // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_gpcDeprecated 319 // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_gpcDeprecated 320 if (get_magic_quotes_gpc()) { 310 321 $this->startup_error .= 'magic_quotes_gpc must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_gpc(0) and set_magic_quotes_gpc(1).'."\n"; 311 322 } … … 847 858 ), 848 859 860 // DSDIFF - audio - Direct Stream Digital Interchange File Format 861 'dsdiff' => array( 862 'pattern' => '^FRM8', 863 'group' => 'audio', 864 'module' => 'dsdiff', 865 'mime_type' => 'audio/dsd', 866 ), 867 849 868 // DTS - audio - Dolby Theatre System 850 869 'dts' => array( … … 974 993 ), 975 994 995 // TAK - audio - Tom's lossless Audio Kompressor 996 'tak' => array( 997 'pattern' => '^tBaK', 998 'group' => 'audio', 999 'module' => 'tak', 1000 'mime_type' => 'application/octet-stream', 1001 ), 1002 976 1003 // TTA - audio - TTA Lossless Audio Compressor (http://tta.corecodec.org) 977 1004 'tta' => array( … … 1032 1059 'module' => 'flv', 1033 1060 'mime_type' => 'video/x-flv', 1061 ), 1062 1063 // IVF - audio/video - IVF 1064 'ivf' => array( 1065 'pattern' => '^DKIF', 1066 'group' => 'audio-video', 1067 'module' => 'ivf', 1068 'mime_type' => 'video/x-ivf', 1034 1069 ), 1035 1070 … … 1218 1253 ), 1219 1254 1255 // HPK - data - HPK compressed data 1256 'hpk' => array( 1257 'pattern' => '^BPUL', 1258 'group' => 'archive', 1259 'module' => 'hpk', 1260 'mime_type' => 'application/octet-stream', 1261 'fail_id3' => 'ERROR', 1262 'fail_ape' => 'ERROR', 1263 ), 1264 1220 1265 // RAR - data - RAR compressed data 1221 1266 'rar' => array( … … 1223 1268 'group' => 'archive', 1224 1269 'module' => 'rar', 1225 'mime_type' => 'application/ octet-stream',1270 'mime_type' => 'application/vnd.rar', 1226 1271 'fail_id3' => 'ERROR', 1227 1272 'fail_ape' => 'ERROR', … … 1425 1470 'divxtag' => array('divx' , 'ISO-8859-1'), 1426 1471 'iptc' => array('iptc' , 'ISO-8859-1'), 1472 'dsdiff' => array('dsdiff' , 'ISO-8859-1'), 1427 1473 ); 1428 1474 } … … 1527 1573 1528 1574 /** 1575 * Calls getid3_lib::CopyTagsToComments() but passes in the option_tags_html setting from this instance of getID3 1576 * 1577 * @param array $ThisFileInfo 1578 * 1579 * @return bool 1580 */ 1581 public function CopyTagsToComments(&$ThisFileInfo) { 1582 return getid3_lib::CopyTagsToComments($ThisFileInfo, $this->option_tags_html); 1583 } 1584 1585 /** 1529 1586 * @param string $algorithm 1530 1587 * … … 1561 1618 // currently vorbiscomment only works on OggVorbis files. 1562 1619 1563 if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved 1620 // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved 1621 if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { 1564 1622 1565 1623 $this->warning('Failed making system call to vorbiscomment.exe - '.$algorithm.'_data is incorrect - error returned: PHP running in Safe Mode (backtick operator not available)'); … … 2055 2113 2056 2114 /** 2115 * @return string|false 2116 * 2117 * @throws getid3_exception 2118 */ 2119 protected function fgets() { 2120 // must be able to handle CR/LF/CRLF but not read more than one lineend 2121 $buffer = ''; // final string we will return 2122 $prevchar = ''; // save previously-read character for end-of-line checking 2123 if ($this->data_string_flag) { 2124 while (true) { 2125 $thischar = substr($this->data_string, $this->data_string_position++, 1); 2126 if (($prevchar == "\r") && ($thischar != "\n")) { 2127 // read one byte too many, back up 2128 $this->data_string_position--; 2129 break; 2130 } 2131 $buffer .= $thischar; 2132 if ($thischar == "\n") { 2133 break; 2134 } 2135 if ($this->data_string_position >= $this->data_string_length) { 2136 // EOF 2137 break; 2138 } 2139 $prevchar = $thischar; 2140 } 2141 2142 } else { 2143 2144 // Ideally we would just use PHP's fgets() function, however... 2145 // it does not behave consistently with regards to mixed line endings, may be system-dependent 2146 // and breaks entirely when given a file with mixed \r vs \n vs \r\n line endings (e.g. some PDFs) 2147 //return fgets($this->getid3->fp); 2148 while (true) { 2149 $thischar = fgetc($this->getid3->fp); 2150 if (($prevchar == "\r") && ($thischar != "\n")) { 2151 // read one byte too many, back up 2152 fseek($this->getid3->fp, -1, SEEK_CUR); 2153 break; 2154 } 2155 $buffer .= $thischar; 2156 if ($thischar == "\n") { 2157 break; 2158 } 2159 if (feof($this->getid3->fp)) { 2160 break; 2161 } 2162 $prevchar = $thischar; 2163 } 2164 2165 } 2166 return $buffer; 2167 } 2168 2169 /** 2057 2170 * @return bool 2058 2171 */
Note: See TracChangeset
for help on using the changeset viewer.