readability + moved stuff
This commit is contained in:
parent
152f5fbf26
commit
7d49e21792
2 changed files with 27 additions and 25 deletions
|
@ -556,6 +556,30 @@ function getMimeType($file, $ext="") {
|
|||
return 'application/octet-stream';
|
||||
}
|
||||
|
||||
|
||||
function getExtension ($mime_type){
|
||||
if(empty($mime_type)){
|
||||
return false;
|
||||
}
|
||||
|
||||
$extensions = array(
|
||||
'image/jpeg' => 'jpg',
|
||||
'image/gif' => 'gif',
|
||||
'image/png' => 'png',
|
||||
'application/x-shockwave-flash' => 'swf',
|
||||
'image/x-icon' => 'ico',
|
||||
'image/svg+xml' => 'svg',
|
||||
'audio/mpeg' => 'mp3',
|
||||
'video/x-flv' => 'flv',
|
||||
'audio/mp4' => 'mp4',
|
||||
'video/mp4' => 'mp4',
|
||||
'audio/webm' => 'webm',
|
||||
'video/webm' => 'webm'
|
||||
);
|
||||
|
||||
return $extensions[$mime_type];
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
|
@ -877,29 +901,6 @@ if (!function_exists('http_parse_headers')) { #http://www.php.net/manual/en/func
|
|||
}
|
||||
}
|
||||
|
||||
function getExtension ($mime_type){
|
||||
if(empty($mime_type)){
|
||||
return false;
|
||||
}
|
||||
|
||||
$extensions = array(
|
||||
'image/jpeg' => 'jpg',
|
||||
'image/gif' => 'gif',
|
||||
'image/png' => 'png',
|
||||
'application/x-shockwave-flash' => 'swf',
|
||||
'image/x-icon' => 'ico',
|
||||
'image/svg+xml' => 'svg',
|
||||
'audio/mpeg' => 'mp3',
|
||||
'video/x-flv' => 'flv',
|
||||
'audio/mp4' => 'mp4',
|
||||
'video/mp4' => 'mp4',
|
||||
'audio/webm' => 'webm',
|
||||
'video/webm' => 'webm'
|
||||
);
|
||||
|
||||
return $extensions[$mime_type];
|
||||
}
|
||||
|
||||
$_included = array();
|
||||
/**
|
||||
* Get the active contents of a .php file
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
* <ul>
|
||||
* <li>source=http://example.com -- find all images with "http://example.com" in the source
|
||||
* </ul>
|
||||
* <li>order (id, width, height, filesize, filename)_(ASC, DESC), eg
|
||||
* <li>order=(id, width, height, filesize, filename)_(ASC, DESC), eg
|
||||
* <ul>
|
||||
* <li>order=width -- find all images sorted from highest > lowest width
|
||||
* <li>order=filesize_asc -- find all images sorted from lowest > highest filesize
|
||||
|
@ -329,7 +329,8 @@ class Index extends Extension {
|
|||
else if(preg_match("/^order[=|:](id|width|height|filesize|filename)[_]?(desc|asc)?$/i", $event->term, $matches)){
|
||||
global $order_sql;
|
||||
$ord = strtolower($matches[1]);
|
||||
$sort = isset($matches[2]) ? strtoupper($matches[2]) : (preg_match("/^(id|filename)$/", $matches[1]) ? "ASC" : "DESC");
|
||||
$default_order_for_column = preg_match("/^(id|filename)$/", $matches[1]) ? "ASC" : "DESC";
|
||||
$sort = isset($matches[2]) ? strtoupper($matches[2]) : $default_order_for_column;
|
||||
$order_sql = "$ord $sort";
|
||||
$event->add_querylet(new Querylet("1=1")); //small hack to avoid metatag being treated as normal tag
|
||||
}
|
||||
|
|
Reference in a new issue