Changeset 30901 for extensions/GDThumb/main.inc.php
- Timestamp:
- Jan 23, 2015, 7:56:01 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/GDThumb/main.inc.php
r30890 r30901 2 2 /* 3 3 Plugin Name: gdThumb 4 Version: 1.0.1 45 Description: Display thumbnails as patchwork4 Version: 1.0.15 5 Description: Apply Masonry style to album or image thumbs 6 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=771 7 7 Author: Serge Dosyukov … … 19 19 // | Plugin constants | 20 20 // +-----------------------------------------------------------------------+ 21 define('GDTHUMB_VERSION', '1.0.1 4');21 define('GDTHUMB_VERSION', '1.0.15'); 22 22 define('GDTHUMB_ID', basename(dirname(__FILE__))); 23 23 define('GDTHEME_PATH' , PHPWG_THEMES_PATH . 'greydragon/'); … … 59 59 function GDThumb_index() { 60 60 global $template; 61 61 62 $template->smarty->registerPlugin("function", "media_type", "GDThumb_media_type"); 62 63 $template->set_prefilter('index', 'GDThumb_prefilter'); 63 64 64 65 add_event_handler('loc_end_index_thumbnails', 'GDThumb_process_thumb', 50, 2); 66 } 67 68 function GDThumb_endsWith($needles, $haystack) { 69 if(empty($needles) || empty($haystack)): 70 return false; 71 else: 72 $arr_needles = explode(',', $needles); 73 74 foreach ((array) $arr_needles as $needle) { 75 if ((string) $needle === substr($haystack, -strlen($needle))) return true; 76 } 77 return false; 78 endif; 79 } 80 81 function GDThumb_media_type($params, $smarty) { 82 if(empty($params["file"])) 83 return "image"; 84 85 $file = $params["file"]; 86 if (GDThumb_endsWith("webm,webmv,ogv,m4v,flv,mp4", $file)) 87 return "video"; 88 if (GDThumb_endsWith("mp3,ogg,oga,m4a,webma,fla,wav", $file)) 89 return "music"; 90 if (GDThumb_endsWith("pdf", $file)) 91 return "pdf"; 92 if (GDThumb_endsWith("doc,docx,odt", $file)) 93 return "doc"; 94 if (GDThumb_endsWith("xls,xlsx,ods", $file)) 95 return "xls"; 96 if (GDThumb_endsWith("ppt,pptx,odp", $file)) 97 return "ppt"; 98 99 return "image"; 65 100 } 66 101
Note: See TracChangeset
for help on using the changeset viewer.