readability + moved stuff
This commit is contained in:
parent
152f5fbf26
commit
7d49e21792
@ -556,6 +556,30 @@ function getMimeType($file, $ext="") {
|
|||||||
return 'application/octet-stream';
|
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
|
* @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();
|
$_included = array();
|
||||||
/**
|
/**
|
||||||
* Get the active contents of a .php file
|
* Get the active contents of a .php file
|
||||||
|
@ -87,7 +87,7 @@
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>source=http://example.com -- find all images with "http://example.com" in the source
|
* <li>source=http://example.com -- find all images with "http://example.com" in the source
|
||||||
* </ul>
|
* </ul>
|
||||||
* <li>order (id, width, height, filesize, filename)_(ASC, DESC), eg
|
* <li>order=(id, width, height, filesize, filename)_(ASC, DESC), eg
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>order=width -- find all images sorted from highest > lowest width
|
* <li>order=width -- find all images sorted from highest > lowest width
|
||||||
* <li>order=filesize_asc -- find all images sorted from lowest > highest filesize
|
* <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)){
|
else if(preg_match("/^order[=|:](id|width|height|filesize|filename)[_]?(desc|asc)?$/i", $event->term, $matches)){
|
||||||
global $order_sql;
|
global $order_sql;
|
||||||
$ord = strtolower($matches[1]);
|
$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";
|
$order_sql = "$ord $sort";
|
||||||
$event->add_querylet(new Querylet("1=1")); //small hack to avoid metatag being treated as normal tag
|
$event->add_querylet(new Querylet("1=1")); //small hack to avoid metatag being treated as normal tag
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user