Changeset 23893 for extensions/download_by_size
- Timestamp:
- Jul 9, 2013, 8:22:09 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/download_by_size/main.inc.php
r23592 r23893 82 82 $row['filename'] = stripslashes(get_filename_wo_extension($row['file'])); 83 83 84 // datas 84 85 $search = array('%id%', '%filename%', '%author%', '%dimensions%'); 85 86 $replace = array($row['id'], $row['filename']); … … 89 90 90 91 $filename = str_replace($search, $replace, $conf['download_by_size_file_pattern']); 92 93 // functions 94 $filename = preg_replace_callback('#\$escape\((.*?)\)#', create_function('$m', 'return str2url($m[1]);'), $filename); 95 $filename = preg_replace_callback('#\$upper\((.*?)\)#', create_function('$m', 'return str2upper($m[1]);'), $filename); 96 $filename = preg_replace_callback('#\$lower\((.*?)\)#', create_function('$m', 'return str2lower($m[1]);'), $filename); 97 $filename = preg_replace_callback('#\$strpad\((.*?),(.*?),(.*?)\)#', create_function('$m', 'return str_pad($m[1],$m[2],$m[3],STR_PAD_LEFT);'), $filename); 98 99 // cleanup 91 100 $filename = preg_replace( 92 101 array('#_+#', '#-+#', '# +#', '#^([_\- ]+)#', '#([_\- ]+)$#'), … … 94 103 $filename 95 104 ); 96 105 97 106 if (empty($filename) || $filename == $conf['download_by_size_file_pattern']) 98 107 { 99 108 $filename = $row['filename']; 100 109 } 101 110 102 111 $filename.= '.'.get_extension($row['path']); 103 112 104 113 return $filename; 105 114 } 115 116 if (!function_exists('str2lower')) 117 { 118 if (function_exists('mb_strtolower') && defined('PWG_CHARSET')) 119 { 120 function str2lower($term) 121 { 122 return mb_strtolower($term, PWG_CHARSET); 123 } 124 function str2upper($term) 125 { 126 return mb_strtoupper($term, PWG_CHARSET); 127 } 128 } 129 else 130 { 131 function str2lower($term) 132 { 133 return strtolower($term); 134 } 135 function str2upper($term) 136 { 137 return strtoupper($term); 138 } 139 } 140 } 106 141 ?>
Note: See TracChangeset
for help on using the changeset viewer.