Changeset 29734 for trunk/src/wp-includes/ID3/getid3.lib.php
- Timestamp:
- 09/11/2014 07:06:33 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ID3/getid3.lib.php
r29378 r29734 4 4 // available at http://getid3.sourceforge.net // 5 5 // or http://www.getid3.org // 6 // also https://github.com/JamesHeinrich/getID3 // 6 7 ///////////////////////////////////////////////////////////////// 7 8 // // … … 283 284 } else { 284 285 throw new Exception('ERROR: Cannot have signed integers larger than '.(8 * PHP_INT_SIZE).'-bits ('.strlen($byteword).') in self::BigEndian2Int()'); 285 break;286 286 } 287 287 } … … 636 636 if (is_readable($filename_source) && is_file($filename_source) && ($fp_src = fopen($filename_source, 'rb'))) { 637 637 if (($fp_dest = fopen($filename_dest, 'wb'))) { 638 if (fseek($fp_src, $offset , SEEK_SET) == 0) {638 if (fseek($fp_src, $offset) == 0) { 639 639 $byteslefttowrite = $length; 640 640 while (($byteslefttowrite > 0) && ($buffer = fread($fp_src, min($byteslefttowrite, getID3::FREAD_BUFFER_SIZE)))) { … … 987 987 } 988 988 989 public static function recursiveMultiByteCharString2HTML($data, $charset='ISO-8859-1') { 990 if (is_string($data)) { 991 return self::MultiByteCharString2HTML($data, $charset); 992 } elseif (is_array($data)) { 993 $return_data = array(); 994 foreach ($data as $key => $value) { 995 $return_data[$key] = self::recursiveMultiByteCharString2HTML($value, $charset); 996 } 997 return $return_data; 998 } 999 // integer, float, objects, resources, etc 1000 return $data; 1001 } 989 1002 990 1003 public static function MultiByteCharString2HTML($string, $charset='ISO-8859-1') { … … 1211 1224 foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) { 1212 1225 $oldvaluelength = strlen(trim($existingvalue)); 1213 if (( $newvaluelength > $oldvaluelength) && (substr(trim($value), 0, strlen($existingvalue)) == $existingvalue)) {1226 if ((strlen($existingvalue) > 10) && ($newvaluelength > $oldvaluelength) && (substr(trim($value), 0, strlen($existingvalue)) == $existingvalue)) { 1214 1227 $ThisFileInfo['comments'][$tagname][$existingkey] = trim($value); 1215 break 2; 1228 //break 2; 1229 break; 1216 1230 } 1217 1231 } … … 1220 1234 if (is_array($value) || empty($ThisFileInfo['comments'][$tagname]) || !in_array(trim($value), $ThisFileInfo['comments'][$tagname])) { 1221 1235 $value = (is_string($value) ? trim($value) : $value); 1222 $ThisFileInfo['comments'][$tagname][] = $value; 1236 if (!is_numeric($key)) { 1237 $ThisFileInfo['comments'][$tagname][$key] = $value; 1238 } else { 1239 $ThisFileInfo['comments'][$tagname][] = $value; 1240 } 1223 1241 } 1224 1242 } … … 1228 1246 1229 1247 // Copy to ['comments_html'] 1230 foreach ($ThisFileInfo['comments'] as $field => $values) { 1231 if ($field == 'picture') { 1232 // pictures can take up a lot of space, and we don't need multiple copies of them 1233 // let there be a single copy in [comments][picture], and not elsewhere 1234 continue; 1235 } 1236 foreach ($values as $index => $value) { 1237 if (is_array($value)) { 1238 $ThisFileInfo['comments_html'][$field][$index] = $value; 1239 } else { 1240 $ThisFileInfo['comments_html'][$field][$index] = str_replace('�', '', self::MultiByteCharString2HTML($value, $ThisFileInfo['encoding'])); 1248 if (!empty($ThisFileInfo['comments'])) { 1249 foreach ($ThisFileInfo['comments'] as $field => $values) { 1250 if ($field == 'picture') { 1251 // pictures can take up a lot of space, and we don't need multiple copies of them 1252 // let there be a single copy in [comments][picture], and not elsewhere 1253 continue; 1254 } 1255 foreach ($values as $index => $value) { 1256 if (is_array($value)) { 1257 $ThisFileInfo['comments_html'][$field][$index] = $value; 1258 } else { 1259 $ThisFileInfo['comments_html'][$field][$index] = str_replace('�', '', self::MultiByteCharString2HTML($value, $ThisFileInfo['encoding'])); 1260 } 1241 1261 } 1242 1262 } 1243 1263 } 1264 1244 1265 } 1245 1266 return true; … … 1340 1361 return $filesize; 1341 1362 } 1363 1364 1365 /** 1366 * Workaround for Bug #37268 (https://bugs.php.net/bug.php?id=37268) 1367 * @param string $path A path. 1368 * @param string $suffix If the name component ends in suffix this will also be cut off. 1369 * @return string 1370 */ 1371 public static function mb_basename($path, $suffix = null) { 1372 $splited = preg_split('#/#', rtrim($path, '/ ')); 1373 return substr(basename('X'.$splited[count($splited) - 1], $suffix), 1); 1374 } 1375 1342 1376 }
Note: See TracChangeset
for help on using the changeset viewer.