Total Complexity | 140 |
Total Lines | 1113 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Complex classes like getid3 often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use getid3, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
25 | class getid3 |
||
26 | { |
||
27 | //// Settings Section - do NOT modify this file - change setting after newing getid3! |
||
28 | |||
29 | // Encoding |
||
30 | public $encoding = 'ISO-8859-1'; // CASE SENSITIVE! - i.e. (must be supported by iconv() - see http://www.gnu.org/software/libiconv/). Examples: ISO-8859-1 UTF-8 UTF-16 UTF-16BE. |
||
31 | public $encoding_id3v1 = 'ISO-8859-1'; // Override SPECIFICATION encoding for broken ID3v1 tags caused by bad tag programs. Examples: 'EUC-CN' for "Chinese MP3s" and 'CP1251' for "Cyrillic". |
||
32 | public $encoding_id3v2 = 'ISO-8859-1'; // Override ISO-8859-1 encoding for broken ID3v2 tags caused by BRAINDEAD tag programs that writes system codepage as 'ISO-8859-1' instead of UTF-8. |
||
33 | |||
34 | // Tags - disable for speed |
||
35 | public $option_tag_id3v1 = true; // Read and process ID3v1 tags. |
||
36 | public $option_tag_id3v2 = true; // Read and process ID3v2 tags. |
||
37 | public $option_tag_lyrics3 = true; // Read and process Lyrics3 tags. |
||
38 | public $option_tag_apetag = true; // Read and process APE tags. |
||
39 | |||
40 | // Misc calucations - disable for speed |
||
41 | public $option_analyze = true; // Analyze file - disable if you only need to detect file format. |
||
42 | public $option_accurate_results = true; // Disable to greatly speed up parsing of some file formats at the cost of accuracy. |
||
43 | public $option_tags_process = true; // Copy tags to root key 'tags' and 'comments' and encode to $this->encoding. |
||
44 | public $option_tags_images = false; // Scan tags for binary image data - ID3v2 and vorbiscomments only. |
||
45 | public $option_extra_info = true; // Calculate/return additional info such as bitrate, channelmode etc. |
||
46 | public $option_max_2gb_check = false; // Check whether file is larger than 2 Gb and thus not supported by PHP. |
||
47 | |||
48 | // Misc data hashes - slow - require hash module |
||
49 | public $option_md5_data = false; // Get MD5 sum of data part - slow. |
||
50 | public $option_md5_data_source = false; // Use MD5 of source file if available - only FLAC, MAC, OptimFROG and Wavpack4. |
||
51 | public $option_sha1_data = false; // Get SHA1 sum of data part - slow. |
||
52 | |||
53 | // Public variables |
||
54 | public $filename; // Filename of file being analysed. |
||
55 | public $fp; // Filepointer to file being analysed. |
||
56 | public $info; // Result array. |
||
57 | |||
58 | // Protected variables |
||
59 | protected $include_path; // getid3 include path. |
||
60 | protected $warnings = array (); |
||
61 | protected $iconv_present; |
||
62 | |||
63 | // Class constants |
||
64 | const VERSION = '2.0.0b4'; |
||
65 | const FREAD_BUFFER_SIZE = 16384; // Read buffer size in bytes. |
||
66 | const ICONV_TEST_STRING = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~�������������������������������� ��������������������������������������������������������������������������������������������'; |
||
67 | |||
68 | |||
69 | |||
70 | // Constructor - check PHP enviroment and load library. |
||
71 | public function __construct() { |
||
72 | |||
73 | // Static varibles - no need to recalc every time we new getid3. |
||
74 | static $include_path; |
||
75 | static $iconv_present; |
||
76 | |||
77 | |||
78 | static $initialized; |
||
79 | if ($initialized) { |
||
80 | |||
81 | // Import static variables |
||
82 | $this->include_path = $include_path; |
||
83 | $this->iconv_present = $iconv_present; |
||
84 | |||
85 | // Run init checks only on first instance. |
||
86 | return; |
||
87 | } |
||
88 | |||
89 | // Get include_path |
||
90 | $this->include_path = $include_path = dirname(__FILE__) . '/'; |
||
91 | |||
92 | // Check for presence of iconv() and make sure it works (simpel test only). |
||
93 | if (function_exists('iconv') && @iconv('UTF-16LE', 'ISO-8859-1', @iconv('ISO-8859-1', 'UTF-16LE', getid3::ICONV_TEST_STRING)) == getid3::ICONV_TEST_STRING) { |
||
94 | $this->iconv_present = $iconv_present = true; |
||
95 | } |
||
96 | |||
97 | // iconv() not present - load replacement module. |
||
98 | else { |
||
99 | $this->include_module('lib.iconv_replacement'); |
||
100 | $this->iconv_present = $iconv_present = false; |
||
101 | } |
||
102 | |||
103 | |||
104 | // Require magic_quotes_runtime off |
||
105 | if (get_magic_quotes_runtime()) { |
||
106 | throw new getid3_exception('magic_quotes_runtime must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_runtime(0) and set_magic_quotes_runtime(1).'); |
||
107 | } |
||
108 | |||
109 | |||
110 | // Check memory limit. |
||
111 | $memory_limit = ini_get('memory_limit'); |
||
112 | if (eregi('([0-9]+)M', $memory_limit, $matches)) { |
||
|
|||
113 | // could be stored as "16M" rather than 16777216 for example |
||
114 | $memory_limit = $matches[1] * 1048576; |
||
115 | } |
||
116 | if ($memory_limit <= 0) { |
||
117 | // Should not happen. |
||
118 | } elseif ($memory_limit <= 4194304) { |
||
119 | $this->warning('[SERIOUS] PHP has less than 4 Mb available memory and will very likely run out. Increase memory_limit in php.ini.'); |
||
120 | } elseif ($memory_limit <= 12582912) { |
||
121 | $this->warning('PHP has less than 12 Mb available memory and might run out if all modules are loaded. Increase memory_limit in php.ini if needed.'); |
||
122 | } |
||
123 | |||
124 | |||
125 | // Check safe_mode off |
||
126 | if ((bool)ini_get('safe_mode')) { |
||
127 | $this->warning('Safe mode is on, shorten support disabled, md5data/sha1data for ogg vorbis disabled, ogg vorbis/flac tag writing disabled.'); |
||
128 | } |
||
129 | |||
130 | $initialized = true; |
||
131 | } |
||
132 | |||
133 | |||
134 | |||
135 | // Analyze file by name |
||
136 | public function Analyze($filename) { |
||
137 | |||
138 | // Init and save values |
||
139 | $this->filename = $filename; |
||
140 | $this->warnings = array (); |
||
141 | |||
142 | // Init result array and set parameters |
||
143 | $this->info = array (); |
||
144 | $this->info['GETID3_VERSION'] = getid3::VERSION; |
||
145 | |||
146 | // Remote files not supported |
||
147 | if (preg_match('/^(ht|f)tp:\/\//', $filename)) { |
||
148 | throw new getid3_exception('Remote files are not supported - please copy the file locally first.'); |
||
149 | } |
||
150 | |||
151 | // Open local file |
||
152 | if (!$this->fp = @fopen($filename, 'rb')) { |
||
153 | throw new getid3_exception('Could not open file "'.$filename.'"'); |
||
154 | } |
||
155 | |||
156 | // Set filesize related parameters |
||
157 | $this->info['filesize'] = filesize($filename); |
||
158 | $this->info['avdataoffset'] = 0; |
||
159 | $this->info['avdataend'] = $this->info['filesize']; |
||
160 | |||
161 | // Option_max_2gb_check |
||
162 | if ($this->option_max_2gb_check) { |
||
163 | // PHP doesn't support integers larger than 31-bit (~2GB) |
||
164 | // filesize() simply returns (filesize % (pow(2, 32)), no matter the actual filesize |
||
165 | // ftell() returns 0 if seeking to the end is beyond the range of unsigned integer |
||
166 | fseek($this->fp, 0, SEEK_END); |
||
167 | if ((($this->info['filesize'] != 0) && (ftell($this->fp) == 0)) || |
||
168 | ($this->info['filesize'] < 0) || |
||
169 | (ftell($this->fp) < 0)) { |
||
170 | unset($this->info['filesize']); |
||
171 | fclose($this->fp); |
||
172 | throw new getid3_exception('File is most likely larger than 2GB and is not supported by PHP.'); |
||
173 | } |
||
174 | } |
||
175 | |||
176 | |||
177 | // ID3v2 detection (NOT parsing) done to make fileformat easier. |
||
178 | if (!$this->option_tag_id3v2) { |
||
179 | |||
180 | fseek($this->fp, 0, SEEK_SET); |
||
181 | $header = fread($this->fp, 10); |
||
182 | if (substr($header, 0, 3) == 'ID3' && strlen($header) == 10) { |
||
183 | $this->info['id3v2']['header'] = true; |
||
184 | $this->info['id3v2']['majorversion'] = ord($header{3}); |
||
185 | $this->info['id3v2']['minorversion'] = ord($header{4}); |
||
186 | $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 |
||
187 | } |
||
188 | } |
||
189 | |||
190 | |||
191 | // Handle tags |
||
192 | foreach (array ("id3v2", "id3v1", "apetag", "lyrics3") as $tag_name) { |
||
193 | |||
194 | $option_tag = 'option_tag_' . $tag_name; |
||
195 | if ($this->$option_tag) { |
||
196 | $this->include_module('tag.'.$tag_name); |
||
197 | try { |
||
198 | $tag_class = 'getid3_' . $tag_name; |
||
199 | $tag = new $tag_class($this); |
||
200 | $tag->Analyze(); |
||
201 | } |
||
202 | catch (getid3_exception $e) { |
||
203 | throw $e; |
||
204 | } |
||
205 | } |
||
206 | } |
||
207 | |||
208 | |||
209 | |||
210 | //// Determine file format by magic bytes in file header. |
||
211 | |||
212 | // Read 32 kb file data |
||
213 | fseek($this->fp, $this->info['avdataoffset'], SEEK_SET); |
||
214 | $filedata = fread($this->fp, 32774); |
||
215 | |||
216 | // Get huge FileFormatArray |
||
217 | $file_format_array = getid3::GetFileFormatArray(); |
||
218 | |||
219 | // Identify file format - loop through $format_info and detect with reg expr |
||
220 | foreach ($file_format_array as $name => $info) { |
||
221 | |||
222 | if (preg_match('/'.$info['pattern'].'/s', $filedata)) { // The /s switch on preg_match() forces preg_match() NOT to treat newline (0x0A) characters as special chars but do a binary match |
||
223 | |||
224 | // Format detected but not supported |
||
225 | if (!@$info['module'] || !@$info['group']) { |
||
226 | fclose($this->fp); |
||
227 | $this->info['fileformat'] = $name; |
||
228 | $this->info['mime_type'] = $info['mime_type']; |
||
229 | $this->warning('Format only detected. Parsing not available yet.'); |
||
230 | $this->info['warning'] = $this->warnings; |
||
231 | return $this->info; |
||
232 | } |
||
233 | |||
234 | $determined_format = $info; // copy $info deleted by foreach() |
||
235 | continue; |
||
236 | } |
||
237 | } |
||
238 | |||
239 | // Unable to determine file format |
||
240 | if (!@$determined_format) { |
||
241 | |||
242 | // Too many mp3 encoders on the market put gabage in front of mpeg files |
||
243 | // use assume format on these if format detection failed |
||
244 | if (preg_match('/\.mp[123a]$/i', $filename)) { |
||
245 | $determined_format = $file_format_array['mp3']; |
||
246 | } |
||
247 | |||
248 | else { |
||
249 | fclose($this->fp); |
||
250 | throw new getid3_exception('Unable to determine file format'); |
||
251 | } |
||
252 | } |
||
253 | |||
254 | // Free memory |
||
255 | unset($file_format_array); |
||
256 | |||
257 | // Check for illegal ID3 tags |
||
258 | if (@$determined_format['fail_id3'] && (@$this->info['id3v1'] || @$this->info['id3v2'])) { |
||
259 | if ($determined_format['fail_id3'] === 'ERROR') { |
||
260 | fclose($this->fp); |
||
261 | throw new getid3_exception('ID3 tags not allowed on this file type.'); |
||
262 | } |
||
263 | elseif ($determined_format['fail_id3'] === 'WARNING') { |
||
264 | @$this->info['id3v1'] and $this->warning('ID3v1 tags not allowed on this file type.'); |
||
265 | @$this->info['id3v2'] and $this->warning('ID3v2 tags not allowed on this file type.'); |
||
266 | } |
||
267 | } |
||
268 | |||
269 | // Check for illegal APE tags |
||
270 | if (@$determined_format['fail_ape'] && @$this->info['tags']['ape']) { |
||
271 | if ($determined_format['fail_ape'] === 'ERROR') { |
||
272 | fclose($this->fp); |
||
273 | throw new getid3_exception('APE tags not allowed on this file type.'); |
||
274 | } elseif ($determined_format['fail_ape'] === 'WARNING') { |
||
275 | $this->warning('APE tags not allowed on this file type.'); |
||
276 | } |
||
277 | } |
||
278 | |||
279 | |||
280 | // Set mime type |
||
281 | $this->info['mime_type'] = $determined_format['mime_type']; |
||
282 | |||
283 | // Calc module file name |
||
284 | $determined_format['include'] = 'module.'.$determined_format['group'].'.'.$determined_format['module'].'.php'; |
||
285 | |||
286 | // Supported format signature pattern detected, but module deleted. |
||
287 | if (!file_exists($this->include_path.$determined_format['include'])) { |
||
288 | fclose($this->fp); |
||
289 | throw new getid3_exception('Format not supported, module, '.$determined_format['include'].', was removed.'); |
||
290 | } |
||
291 | |||
292 | // Include module |
||
293 | $this->include_module($determined_format['group'].'.'.$determined_format['module']); |
||
294 | |||
295 | // Instantiate module class and analyze |
||
296 | $class_name = 'getid3_'.$determined_format['module']; |
||
297 | if (!class_exists($class_name)) { |
||
298 | throw new getid3_exception('Format not supported, module, '.$determined_format['include'].', is corrupt.'); |
||
299 | } |
||
300 | $class = new $class_name($this); |
||
301 | |||
302 | try { |
||
303 | $this->option_analyze and $class->Analyze(); |
||
304 | } |
||
305 | catch (getid3_exception $e) { |
||
306 | throw $e; |
||
307 | } |
||
308 | catch (Exception $e) { |
||
309 | throw new getid3_exception('Corrupt file.'); |
||
310 | } |
||
311 | |||
312 | // Close file |
||
313 | fclose($this->fp); |
||
314 | |||
315 | // Optional - Process all tags - copy to 'tags' and convert charsets |
||
316 | if ($this->option_tags_process) { |
||
317 | $this->HandleAllTags(); |
||
318 | } |
||
319 | |||
320 | |||
321 | //// Optional - perform more calculations |
||
322 | if ($this->option_extra_info) { |
||
323 | |||
324 | // Set channelmode on audio |
||
325 | if (@$this->info['audio']['channels'] == '1') { |
||
326 | $this->info['audio']['channelmode'] = 'mono'; |
||
327 | } elseif (@$this->info['audio']['channels'] == '2') { |
||
328 | $this->info['audio']['channelmode'] = 'stereo'; |
||
329 | } |
||
330 | |||
331 | // Calculate combined bitrate - audio + video |
||
332 | $combined_bitrate = 0; |
||
333 | $combined_bitrate += (isset($this->info['audio']['bitrate']) ? $this->info['audio']['bitrate'] : 0); |
||
334 | $combined_bitrate += (isset($this->info['video']['bitrate']) ? $this->info['video']['bitrate'] : 0); |
||
335 | if (($combined_bitrate > 0) && empty($this->info['bitrate'])) { |
||
336 | $this->info['bitrate'] = $combined_bitrate; |
||
337 | } |
||
338 | if (!isset($this->info['playtime_seconds']) && !empty($this->info['bitrate'])) { |
||
339 | $this->info['playtime_seconds'] = (($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['bitrate']; |
||
340 | } |
||
341 | |||
342 | // Set playtime string |
||
343 | if (!empty($this->info['playtime_seconds']) && empty($this->info['playtime_string'])) { |
||
344 | $this->info['playtime_string'] = floor(round($this->info['playtime_seconds']) / 60) . ':' . str_pad(floor(round($this->info['playtime_seconds']) % 60), 2, 0, STR_PAD_LEFT);; |
||
345 | } |
||
346 | |||
347 | |||
348 | // CalculateCompressionRatioVideo() { |
||
349 | if (@$this->info['video'] && @$this->info['video']['resolution_x'] && @$this->info['video']['resolution_y'] && @$this->info['video']['bits_per_sample']) { |
||
350 | |||
351 | // From static image formats |
||
352 | if (in_array($this->info['video']['dataformat'], array ('bmp', 'gif', 'jpeg', 'jpg', 'png', 'tiff'))) { |
||
353 | $frame_rate = 1; |
||
354 | $bitrate_compressed = $this->info['filesize'] * 8; |
||
355 | } |
||
356 | |||
357 | // From video formats |
||
358 | else { |
||
359 | $frame_rate = @$this->info['video']['frame_rate']; |
||
360 | $bitrate_compressed = @$this->info['video']['bitrate']; |
||
361 | } |
||
362 | |||
363 | if ($frame_rate && $bitrate_compressed) { |
||
364 | $this->info['video']['compression_ratio'] = $bitrate_compressed / ($this->info['video']['resolution_x'] * $this->info['video']['resolution_y'] * $this->info['video']['bits_per_sample'] * $frame_rate); |
||
365 | } |
||
366 | } |
||
367 | |||
368 | |||
369 | // CalculateCompressionRatioAudio() { |
||
370 | if (@$this->info['audio']['bitrate'] && @$this->info['audio']['channels'] && @$this->info['audio']['sample_rate']) { |
||
371 | $this->info['audio']['compression_ratio'] = $this->info['audio']['bitrate'] / ($this->info['audio']['channels'] * $this->info['audio']['sample_rate'] * (@$this->info['audio']['bits_per_sample'] ? $this->info['audio']['bits_per_sample'] : 16)); |
||
372 | } |
||
373 | |||
374 | if (@$this->info['audio']['streams']) { |
||
375 | foreach ($this->info['audio']['streams'] as $stream_number => $stream_data) { |
||
376 | if (@$stream_data['bitrate'] && @$stream_data['channels'] && @$stream_data['sample_rate']) { |
||
377 | $this->info['audio']['streams'][$stream_number]['compression_ratio'] = $stream_data['bitrate'] / ($stream_data['channels'] * $stream_data['sample_rate'] * (@$stream_data['bits_per_sample'] ? $stream_data['bits_per_sample'] : 16)); |
||
378 | } |
||
379 | } |
||
380 | } |
||
381 | |||
382 | |||
383 | // CalculateReplayGain() { |
||
384 | if (@$this->info['replay_gain']) { |
||
385 | if (!@$this->info['replay_gain']['reference_volume']) { |
||
386 | $this->info['replay_gain']['reference_volume'] = 89; |
||
387 | } |
||
388 | if (isset($this->info['replay_gain']['track']['adjustment'])) { |
||
389 | $this->info['replay_gain']['track']['volume'] = $this->info['replay_gain']['reference_volume'] - $this->info['replay_gain']['track']['adjustment']; |
||
390 | } |
||
391 | if (isset($this->info['replay_gain']['album']['adjustment'])) { |
||
392 | $this->info['replay_gain']['album']['volume'] = $this->info['replay_gain']['reference_volume'] - $this->info['replay_gain']['album']['adjustment']; |
||
393 | } |
||
394 | |||
395 | if (isset($this->info['replay_gain']['track']['peak'])) { |
||
396 | $this->info['replay_gain']['track']['max_noclip_gain'] = 0 - 20 * log10($this->info['replay_gain']['track']['peak']); |
||
397 | } |
||
398 | if (isset($this->info['replay_gain']['album']['peak'])) { |
||
399 | $this->info['replay_gain']['album']['max_noclip_gain'] = 0 - 20 * log10($this->info['replay_gain']['album']['peak']); |
||
400 | } |
||
401 | } |
||
402 | |||
403 | |||
404 | // ProcessAudioStreams() { |
||
405 | if (@!$this->info['audio']['streams'] && (@$this->info['audio']['bitrate'] || @$this->info['audio']['channels'] || @$this->info['audio']['sample_rate'])) { |
||
406 | foreach ($this->info['audio'] as $key => $value) { |
||
407 | if ($key != 'streams') { |
||
408 | $this->info['audio']['streams'][0][$key] = $value; |
||
409 | } |
||
410 | } |
||
411 | } |
||
412 | } |
||
413 | |||
414 | |||
415 | // Get the md5/sha1sum of the audio/video portion of the file - without ID3/APE/Lyrics3/etc header/footer tags. |
||
416 | if ($this->option_md5_data || $this->option_sha1_data) { |
||
417 | |||
418 | // Load data-hash library if needed |
||
419 | $this->include_module('lib.data_hash'); |
||
420 | |||
421 | if ($this->option_sha1_data) { |
||
422 | new getid3_lib_data_hash($this, 'sha1'); |
||
423 | } |
||
424 | |||
425 | if ($this->option_md5_data) { |
||
426 | |||
427 | // no md5_data_source or option disabled -- md5_data_source supported by FLAC, MAC, OptimFROG, Wavpack4 |
||
428 | if (!$this->option_md5_data_source || !@$this->info['md5_data_source']) { |
||
429 | new getid3_lib_data_hash($this, 'md5'); |
||
430 | } |
||
431 | |||
432 | // copy md5_data_source to md5_data if option set to true |
||
433 | elseif ($this->option_md5_data_source && @$this->info['md5_data_source']) { |
||
434 | $this->info['md5_data'] = $this->info['md5_data_source']; |
||
435 | } |
||
436 | } |
||
437 | } |
||
438 | |||
439 | // Set warnings |
||
440 | if ($this->warnings) { |
||
441 | $this->info['warning'] = $this->warnings; |
||
442 | } |
||
443 | |||
444 | // Return result |
||
445 | return $this->info; |
||
446 | } |
||
447 | |||
448 | |||
449 | |||
450 | // Return array of warnings |
||
451 | public function warnings() { |
||
452 | |||
453 | return $this->warnings; |
||
454 | } |
||
455 | |||
456 | |||
457 | |||
458 | // Add warning(s) to $this->warnings[] |
||
459 | public function warning($message) { |
||
460 | |||
461 | if (is_array($message)) { |
||
462 | $this->warnings = array_merge($this->warnings, $message); |
||
463 | } |
||
464 | else { |
||
465 | $this->warnings[] = $message; |
||
466 | } |
||
467 | } |
||
468 | |||
469 | |||
470 | |||
471 | // Clear all warnings when cloning |
||
472 | public function __clone() { |
||
473 | |||
474 | $this->warnings = array (); |
||
475 | |||
476 | // Copy info array, otherwise it will be a reference. |
||
477 | $temp = $this->info; |
||
478 | unset($this->info); |
||
479 | $this->info = $temp; |
||
480 | } |
||
481 | |||
482 | |||
483 | |||
484 | // Convert string between charsets -- iconv() wrapper |
||
485 | public function iconv($in_charset, $out_charset, $string, $drop01 = false) { |
||
486 | |||
487 | if ($drop01 && ($string === "\x00" || $string === "\x01")) { |
||
488 | return ''; |
||
489 | } |
||
490 | |||
491 | |||
492 | if (!$this->iconv_present) { |
||
493 | return getid3_iconv_replacement::iconv($in_charset, $out_charset, $string); |
||
494 | } |
||
495 | |||
496 | |||
497 | // iconv() present |
||
498 | if ($result = @iconv($in_charset, $out_charset.'//TRANSLIT', $string)) { |
||
499 | |||
500 | if ($out_charset == 'ISO-8859-1') { |
||
501 | return rtrim($result, "\x00"); |
||
502 | } |
||
503 | return $result; |
||
504 | } |
||
505 | |||
506 | $this->warning('iconv() was unable to convert the string: "' . $string . '" from ' . $in_charset . ' to ' . $out_charset); |
||
507 | return $string; |
||
508 | } |
||
509 | |||
510 | |||
511 | |||
512 | public function include_module($name) { |
||
513 | |||
514 | if (!file_exists($this->include_path.'module.'.$name.'.php')) { |
||
515 | throw new getid3_exception('Required module.'.$name.'.php is missing.'); |
||
516 | } |
||
517 | |||
518 | include_once($this->include_path.'module.'.$name.'.php'); |
||
519 | } |
||
520 | |||
521 | |||
522 | |||
523 | public function include_module_optional($name) { |
||
524 | |||
525 | if (!file_exists($this->include_path.'module.'.$name.'.php')) { |
||
526 | return; |
||
527 | } |
||
528 | |||
529 | include_once($this->include_path.'module.'.$name.'.php'); |
||
530 | return true; |
||
531 | } |
||
532 | |||
533 | |||
534 | // Return array containing information about all supported formats |
||
535 | public static function GetFileFormatArray() { |
||
1009 | } |
||
1010 | |||
1011 | |||
1012 | |||
1013 | // Recursive over array - converts array to $encoding charset from $this->encoding |
||
1014 | function CharConvert(&$array, $encoding) { |
||
1015 | |||
1016 | // Identical encoding - end here |
||
1017 | if ($encoding == $this->encoding) { |
||
1018 | return; |
||
1019 | } |
||
1020 | |||
1021 | // Loop thru array |
||
1022 | foreach ($array as $key => $value) { |
||
1023 | |||
1024 | // Go recursive |
||
1025 | if (is_array($value)) { |
||
1026 | $this->CharConvert($array[$key], $encoding); |
||
1027 | } |
||
1028 | |||
1029 | // Convert string |
||
1030 | elseif (is_string($value)) { |
||
1031 | $array[$key] = $this->iconv($encoding, $this->encoding, $value); |
||
1032 | } |
||
1033 | } |
||
1034 | } |
||
1035 | |||
1036 | |||
1037 | |||
1038 | // Convert and copy tags |
||
1039 | protected function HandleAllTags() { |
||
1138 | } |
||
1139 | } |
||
1140 | |||
1141 | |||
1142 | abstract class getid3_handler |
||
1143 | { |
||
1144 | |||
1145 | protected $getid3; // pointer |
||
1598 | ?> |
||
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.