Changeset 23590 for extensions/download_by_size/main.inc.php
- Timestamp:
- Jun 27, 2013, 3:30:48 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/download_by_size/main.inc.php
r23325 r23590 68 68 } 69 69 70 /** 71 * getFilename function, copied from Batch Manager 72 */ 73 function dlsize_getFilename($row, $filesize=array()) 74 { 75 global $conf; 76 77 if (!isset($conf['download_by_size_file_pattern'])) 78 { 79 $conf['download_by_size_file_pattern'] = '%filename%_%dimensions%'; 80 } 81 82 $row['filename'] = stripslashes(get_filename_wo_extension($row['file'])); 83 84 $search = array('%id%', '%filename%', '%author%', '%dimensions%'); 85 $replace = array($row['id'], $row['filename']); 86 87 if (!empty($row['author'])) $replace[] = $row['author']; 88 else $replace[] = null; 89 90 if (!empty($filesize)) $replace[] = $filesize['width'].'x'.$filesize['height']; 91 else $replace[] = null; 92 93 $filename = str_replace($search, $replace, $conf['download_by_size_file_pattern']); 94 $filename = preg_replace(array('#_+#', '#^_#', '#_$#'), array('_', null, null), $filename); 95 96 if (empty($filename) || $filename == $conf['download_by_size_file_pattern']) 97 { 98 $filename = $row['filename']; 99 } 100 101 $filename.= '.'.get_extension($row['path']); 102 103 return $filename; 104 } 70 105 ?>
Note: See TracChangeset
for help on using the changeset viewer.