wp-includes/ID3/getid3.php
Lines:
1 to 100 of 122
<?php ///////////////////////////////////////////////////////////////// /// getID3() by James Heinrich <info@getid3.org> // // available at https://github.com/JamesHeinrich/getID3 // // or https://www.getid3.org // // or http://getid3.sourceforge.net // // // // Please see readme.txt for more information // // /// ///////////////////////////////////////////////////////////////// // define a constant rather than looking up every time it is needed if (!defined('GETID3_OS_ISWINDOWS')) { define('GETID3_OS_ISWINDOWS', (stripos(PHP_OS, 'WIN') === 0)); } // Get base path of getID3() - ONCE if (!defined('GETID3_INCLUDEPATH')) { define('GETID3_INCLUDEPATH', dirname(__FILE__).DIRECTORY_SEPARATOR); } if (!defined('ENT_SUBSTITUTE')) { // PHP5.3 adds ENT_IGNORE, PHP5.4 adds ENT_SUBSTITUTE define('ENT_SUBSTITUTE', (defined('ENT_IGNORE') ? ENT_IGNORE : 8)); } /* https://www.getid3.org/phpBB3/viewtopic.php?t=2114 If you are running into a the problem where filenames with special characters are being handled incorrectly by external helper programs (e.g. metaflac), notably with the special characters removed, and you are passing in the filename in UTF8 (typically via a HTML form), try uncommenting this line: */ //setlocale(LC_CTYPE, 'en_US.UTF-8'); // attempt to define temp dir as something flexible but reliable $temp_dir = ini_get('upload_tmp_dir'); if ($temp_dir && (!is_dir($temp_dir) || !is_readable($temp_dir))) { $temp_dir = ''; } if (!$temp_dir && function_exists('sys_get_temp_dir')) { // sys_get_temp_dir added in PHP v5.2.1 // sys_get_temp_dir() may give inaccessible temp dir, e.g. with open_basedir on virtual hosts $temp_dir = sys_get_temp_dir(); } $temp_dir = @realpath($temp_dir); // see https://github.com/JamesHeinrich/getID3/pull/10 $open_basedir = ini_get('open_basedir'); if ($open_basedir) { // e.g. "/var/www/vhosts/getid3.org/httpdocs/:/tmp/" $temp_dir = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $temp_dir); $open_basedir = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $open_basedir); if (substr($temp_dir, -1, 1) != DIRECTORY_SEPARATOR) { $temp_dir .= DIRECTORY_SEPARATOR; } $found_valid_tempdir = false; $open_basedirs = explode(PATH_SEPARATOR, $open_basedir); foreach ($open_basedirs as $basedir) { if (substr($basedir, -1, 1) != DIRECTORY_SEPARATOR) { $basedir .= DIRECTORY_SEPARATOR; } if (strpos($temp_dir, $basedir) === 0) { $found_valid_tempdir = true; break; } } if (!$found_valid_tempdir) { $temp_dir = ''; } unset($open_basedirs, $found_valid_tempdir, $basedir); } if (!$temp_dir) { $temp_dir = '*'; // invalid directory name should force tempnam() to use system default temp dir } // $temp_dir = '/something/else/'; // feel free to override temp dir here if it works better for your system if (!defined('GETID3_TEMP_DIR')) { define('GETID3_TEMP_DIR', $temp_dir); } unset($open_basedir, $temp_dir); // End: Defines /* class getID3 */ /* function getID3::__construct() – */ /* function getID3::version() – */ /* function getID3::fread_buffer_size() – */ /* function getID3::setOption() – */ /* function getID3::openfile() – */ /* function getID3::analyze() – analyze file */ /* function getID3::error() – Error handling. */ /* function getID3::warning() – Warning handling. */ /* function getID3::CleanUp() – */ /* function getID3::GetFileFormatArray() – Return array containing information about all supported formats. */ /* function getID3::GetFileFormat() – */ /* function getID3::CharConvert() – Converts array to $encoding charset from $this->encoding. */ /* function getID3::HandleAllTags() – */ /* function getID3::CopyTagsToComments() – Calls getid3_lib::CopyTagsToComments() but passes in the option_tags_html setting from this instance of getID3 */ /* function getID3::getHashdata() – */ /* function getID3::ChannelsBitratePlaytimeCalculations() – */ /* function getID3::CalculateCompressionRatioVideo() – */ /* function getID3::CalculateCompressionRatioAudio() – */ /* function getID3::CalculateReplayGain() – */ /* function getID3::ProcessAudioStreams() – */ /* function getID3::getid3_tempnam() – */ /* function getID3::include_module() – */