Changeset 12819 for extensions
- Timestamp:
- Jan 1, 2012, 10:09:17 PM (12 years ago)
- Location:
- extensions/PHP_Optimisateur
- Files:
-
- 1 deleted
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/PHP_Optimisateur/include/display_config.php
r10337 r12819 1 1 <?php 2 2 /***************************************\ 3 | PHP OPTIMISATEUR|4 | Version 1.2|3 | PHP OPTIMISATEUR | 4 | Version 1.2 | 5 5 \***************************************/ 6 6 7 7 $PAGE['content'] .= '<div class="generic config"> 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 8 <h2>'.l10n('Configuration').'</h2> 9 <ul> 10 <li> 11 <span class="title">'.l10n('Folders').'</span> 12 <table> 13 <tr> 14 <td><b>'.l10n('FolderIn').' :</b></td> 15 <td>'.$CONF['DIRsource'].'</td> 16 </tr> 17 <tr> 18 <td><b>'.l10n('FolderOut').' :</b></td> 19 <td>'.$CONF['DIRsortie'].'</td> 20 </tr> 21 </table> 22 </li> 23 <li> 24 <span class="title">'.l10n('Options').'</span> 25 <table> 26 <tr> 27 <td><b>'.l10n('silentORNOT').' :</b></td> 28 <td>'.l10n($CONF['silentORNOT']).'</td> 29 </tr> 30 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 31 <tr> 32 <td><b>'.l10n('DIRhighORNOT').' :</b></td> 33 <td>'.bool_to_string($CONF['DIRhighORNOT']).'</td> 34 </tr> 35 <tr> 36 <td><b>'.l10n('DIMhdORNOT').' :</b></td> 37 <td>'.bool_to_string($CONF['DIMhdORNOT']).'</td> 38 </tr> 39 <tr> 40 <td><b>'.l10n('renameORNOT').' :</b></td> 41 <td>'.bool_to_string($CONF['renameORNOT']).'</td> 42 </tr> 43 <tr> 44 <td><b>'.l10n('indexORNOT').' :</b></td> 45 <td>'.bool_to_string($CONF['indexORNOT']).'</td> 46 </tr> 47 <tr> 48 <td><b>'.l10n('prefixe_mini').' :</b></td> 49 <td>'.$CONF['prefixe_mini'].'</td> 50 </tr> 51 </table> 52 </li> 53 <li> 54 <span class="title">'.l10n('Sizes and quality').'</span> 55 <table> 56 <tr> 57 <td><b>'.l10n('DIMhd').' :</b></td> 58 <td>'.$CONF['DIMhd'].' px</td> 59 </tr> 60 <tr> 61 <td><b>'.l10n('DIMnormal').' :</b></td> 62 <td>'.$CONF['DIMnormal'].' px</td> 63 </tr> 64 <tr> 65 <td><b>'.l10n('DIMthumbnail').' :</b></td> 66 <td>'.$CONF['DIMthumbnail'].' px</td> 67 </tr> 68 <tr> 69 <td><b>'.l10n('Qhd').' :</b></td> 70 <td>'.$CONF['Qhd'].' %</td> 71 </tr> 72 <tr> 73 <td><b>'.l10n('Qnormal').' :</b></td> 74 <td>'.$CONF['Qnormal'].' %</td> 75 </tr> 76 <tr> 77 <td><b>'.l10n('Qthumbnail').' :</b></td> 78 <td>'.$CONF['Qthumbnail'].' %</td> 79 </tr> 80 <tr> 81 <td><b>'.l10n('DPI').' :</b></td> 82 <td>'.$CONF['DPI'].' dpi</td> 83 </tr> 84 </table> 85 </li> 86 <li> 87 <span class="title">'.l10n('Copyright').'</span> 88 <table> 89 <tr> 90 <td><b>'.l10n('Content').' :</b></td> 91 <td>'.$CONF['copyright'].'</td> 92 </tr> 93 <tr> 94 <td><b>'.l10n('copyONhd').' :</b></td> 95 <td>'.bool_to_string($CONF['copyONhd']).'</td> 96 </tr> 97 <tr> 98 <td><b>'.l10n('copyONnormal').' :</b></td> 99 <td>'.bool_to_string($CONF['copyONnormal']).'</td> 100 </tr> 101 <tr> 102 <td><b>'.l10n('copyPOS%s', '').' :</b></td> 103 <td>'.$CONF['copyPOS'].'</td> 104 </tr> 105 <tr> 106 <td><b>'.l10n('copySIZE').' :</b></td> 107 <td>'.$CONF['copySIZE'].'</td> 108 </tr> 109 <tr> 110 <td><b>'.l10n('copyCOLOR').' :</b></td> 111 <td> 112 #'.nice_hex_color($CONF['copyCOLOR']).' 113 <span class="color-display" style="background-color:#'.nice_hex_color($CONF['copyCOLOR']).';"> </span> 114 </td> 115 </tr> 116 <tr> 117 <td><b>'.l10n('copyFONT').' :</b></td> 118 <td>'.$CONF['copyFONT'].'</td> 119 </tr> 120 </table> 121 </li> 122 </ul> 123 124 <h2>'.l10n('Plugins').'</h2> 125 <ul>'; 126 // Affichage des plugins 127 $PLUGIN_ACTION = 'read_config'; 128 129 foreach ($CONF['Plugins'] as $plugin_id => $plugin_config) { 130 $PAGE['content'] .= '<li> 131 <div class="plugin-title"> 132 <span class="title">'.$plugin_config['name'].' :</span> 133 134 <span class="plugin-active">'; 135 if ($plugin_config['active']) { 136 $PAGE['content'] .= '<b class="new">'.l10n('Active').'</b>'; 137 } else { 138 $PAGE['content'] .= '<b class="miss">'.l10n('Inactive').'</b>'; 139 } 140 $PAGE['content'] .= '</span> 141 142 </div>'; 143 144 // On affiche sa configuration 145 if (file_exists('plugins/'.$plugin_id.'/setup.php')) { 146 include('plugins/'.$plugin_id.'/setup.php'); 147 } 148 $PAGE['content'] .= '</li>'; 149 } 150 $PAGE['content'] .= '</ul> 151 </div>'; 152 152 ?> -
extensions/PHP_Optimisateur/include/functions.php
r10337 r12819 3 3 // Affiche les textes localisés 4 4 function l10n($code) { 5 6 7 8 9 10 11 12 13 14 15 16 5 global $Lang; 6 if (isset($Lang[$code])) { 7 $args = func_get_args(); 8 if (count($args) > 1) { 9 array_shift($args); 10 return vsprintf($Lang[$code], $args); 11 } else { 12 return $Lang[$code]; 13 } 14 } else { 15 return $code; 16 } 17 17 } 18 18 19 19 // Retourne la langue de l'utilisateur et les langues installées 20 20 function GetLanguage() { 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 21 // tableau avec les langues installées 22 $dh = opendir('language'); 23 while ($file = readdir($dh)) { 24 if ($file !== '.' && $file !== '..' && is_dir('language/'.$file)) { 25 $name = (file_exists('language/'.$file.'/iso.txt')) ? file_get_contents('language/'.$file.'/iso.txt') : $file; 26 $languages[$file] = $name; 27 } 28 } 29 closedir($dh); 30 31 // recherche du paramètre get ou session, ou langue du navigateur 32 if (isset($_GET['Lang'])) { 33 $user_lang = $_GET['Lang']; 34 } else if (isset($_SESSION['Lang']) AND $_SESSION['Lang'] != NULL) { 35 $user_lang = $_SESSION['Lang']; 36 } else { 37 $user_lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2); 38 } 39 40 // si langue navigateur cherche une correspondance dans la tableau 41 if (strlen($user_lang) == 2) { 42 foreach (array_keys($languages) as $lang) { 43 if ($user_lang == substr($lang,0,2)) { 44 $user_lang = $lang; 45 break; 46 } 47 } 48 } 49 50 // si pas de correspondance OU get faux, langue par défaut 51 if (!in_array($user_lang, array_keys($languages))) { 52 $user_lang = 'en_UK'; 53 } 54 55 $_SESSION['Lang'] = $user_lang; 56 return array('user_lang' => $_SESSION['Lang'], 'languages' => $languages); 57 57 } 58 58 59 59 // Supprime tous les caractères speciaux 60 60 function delete_special_car($string) { 61 62 63 64 65 66 67 68 69 70 61 global $CONF; 62 63 $search = array ('#[éèêë]#','#[ÊËÈÉ]#','#[àâäã]#','#[ÂÄÁÀ]#','#[îïíì]#','#[ÎÏÍÌ]#','#[ûùüúµ]#','#[ÛÙÚÜ]#','#[ôóòõö]#','#[ÓÒÖÔÕ]#','#[ç]#','#[Ç]#','#[ñ]#','#[Ñ]#','#[ýÿ]#','#[Ý]#','#[ \&\!\?\#\"\(\)\{\}\[\]\=\+\~\%]#','#[^a-zA-Z0-9_\.\-]#'); 64 $replace = array ('e','E','a','A','i','I','u','U','o','O','c','C',',n','N','y','Y','_',''); 65 66 if ($CONF['renameORNOT']) { 67 return preg_replace($search, $replace, $string); 68 } else { 69 return str_replace(array('%','$',' '), '_', $string); 70 } 71 71 } 72 72 73 73 // Teste si un dossier est vide 74 74 function is_dir_empty($dir) { 75 76 77 78 79 80 75 $array = scandir($dir); 76 if (count($array) > 2) { 77 return false; 78 } else { 79 return true; 80 } 81 81 } 82 82 83 83 // Supprime un repertoire non-vide 84 84 function rrmdir($dir) { 85 86 87 88 89 90 91 92 93 94 95 96 85 $dir = rtrim($dir, '/'); 86 $objects = scandir($dir); 87 88 foreach ($objects as $object) { 89 if ($object !== '.' && $object !== '..') { 90 $path = $dir.'/'.$object; 91 if (filetype($path) == 'dir') rrmdir($path); 92 else unlink($path); 93 } 94 } 95 96 rmdir($dir); 97 97 } 98 98 99 99 // Parcours récursivement un dossier 100 100 function recursive_readdir($dir, $array, $dirs=false) { 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 101 # si $dirs=true liste les dossiers plutot que les fichiers 102 global ${$array}; // Charge la tableau pour la sortie, déclaré à l'exterieur à cause de l'appel recursif de la fonction 103 $dir = rtrim($dir, '/'); 104 $dh = opendir($dir); 105 106 while (($file = readdir($dh)) !== false ) { 107 if ($file !== '.' && $file !== '..') { 108 $path = $dir.'/'.$file; 109 if (is_dir($path)) { 110 if($dirs) ${$array}[] = $path; 111 recursive_readdir($path, $array, $dirs); 112 } else { 113 if(!$dirs) ${$array}[] = $path; 114 } 115 } 116 } 117 closedir($dh); 118 118 } 119 119 120 120 // Parse le fichier de configuration 121 121 function XMLParse($xml) { 122 123 124 125 126 127 128 129 130 122 $content = array(); 123 foreach ($xml as $nom => $elem) { 124 if (trim($elem) == '' AND $elem != '') { 125 $content[$nom] = XMLParse($elem->children()); 126 } else { 127 $content[$nom] = utf8_encode(utf8_decode($elem)); 128 } 129 } 130 return $content; 131 131 } 132 132 133 133 // Crée le fichier de configuration 134 134 function XMLCreate($array, $level=0) { 135 136 137 138 for($i=0;$i<=$level;$i++) $content .= "\t";139 140 141 for($i=0;$i<=$level;$i++) $content .= "\t";142 143 144 for($i=0;$i<=$level;$i++) $content .= "\t";145 146 147 148 135 $content = null; 136 foreach ($array as $nom => $elem) { 137 if (is_array($elem)) { 138 for($i=0;$i<=$level;$i++) $content .= " "; 139 $content .= '<'.$nom.'>'."\n"; 140 $content .= XMLCreate($elem, $level+1); 141 for($i=0;$i<=$level;$i++) $content .= " "; 142 $content .= '</'.$nom.'>'."\n"; 143 } else { 144 for($i=0;$i<=$level;$i++) $content .= " "; 145 $content .= '<'.$nom.'>'.$elem.'</'.$nom.'>'."\n"; 146 } 147 } 148 return $content; 149 149 } 150 150 151 151 // Charge la configuration 152 152 function load_config($file) { 153 154 155 156 153 $config = simplexml_load_file($file); 154 $config = XMLParse($config); 155 $config = array_settype($config); 156 return $config; 157 157 } 158 158 159 159 // Convertit les booléens, entiers et flotants d'un tableau de 'string' 160 160 function array_settype($array) { 161 162 163 164 165 166 $array[$key] = true; 167 168 $array[$key] = false; 169 170 171 172 settype($array[$key], 'int'); 173 174 settype($array[$key], 'float'); 175 176 177 178 179 161 foreach ($array as $key => $value) { 162 if (is_array($value)) { 163 $array[$key] = array_settype($value); 164 } else { 165 if ($value === 'true') { 166 $array[$key] = true; 167 } else if ($value === 'false') { 168 $array[$key] = false; 169 } else if ($value == null) { 170 // rien à faire ^^ 171 } else if (preg_match('#^([0-9]*)$#', $value)) { 172 settype($array[$key], 'int'); 173 } else if (preg_match('#^([0-9]*)(\.)([0-9]*)$#', $value)) { 174 settype($array[$key], 'float'); 175 } 176 } 177 } 178 179 return $array; 180 180 } 181 181 182 182 // Booléen vers français ou texte 183 183 function bool_to_string($string, $just_echo=0) { 184 185 186 187 188 189 190 191 192 193 194 195 196 184 global $Lang; 185 # $just_echo pour pouvoir afficher un booléen tel quel (echo true; n'affiche rien) 186 if (is_bool($string)) { 187 if ($string) { 188 if ($just_echo) return 'true'; 189 else return l10n('yes'); 190 } else { 191 if ($just_echo) return 'false'; 192 else return l10n('no'); 193 } 194 } else { 195 return $string; 196 } 197 197 } 198 198 199 199 // Converti une chaine de config (param:value;param:value[;]) en tableau associatif 200 200 function ExplodeString($string, $sep1=';', $sep2=':') { 201 202 203 204 205 206 207 208 209 201 $string = preg_replace('#[;]$#', '', $string); 202 $result = array(); 203 $a = explode($sep1, $string); 204 205 foreach ($a as $s) { 206 $v = explode($sep2, $s); 207 $result[$v[0]] = $v[1]; 208 } 209 return $result; 210 210 } 211 211 212 212 // Converti un tableau associatif en chaine de config (param:value;param:value;) 213 213 function ImplodeArray($array, $sep1=';', $sep2=':') { 214 215 216 217 218 214 $result = null; 215 foreach ($array as $key => $value) { 216 $result .= $key.$sep2.$value.$sep1; 217 } 218 return $result; 219 219 } 220 220 221 221 // Convertit les couleurs 'numériques' et gère les 0 manquants 222 222 function nice_hex_color($hex) { 223 224 225 226 227 223 $hex = strval($hex); 224 for ($i=strlen($hex); $i<6; $i++) { 225 $hex = '0'.$hex; 226 } 227 return $hex; 228 228 } 229 229 230 230 // Converti une couleur HEX et RGB 231 231 function hex2RGB($hexStr, $returnAsString = false, $seperator = ',') { 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 232 $hexStr = preg_replace("/[^0-9A-Fa-f]/", '', $hexStr); // Gets a proper hex string 233 234 if (strlen($hexStr) == 6) { //If a proper hex code, convert using bitwise operation. No overhead... faster 235 $colorVal = hexdec($hexStr); 236 $rgbArray['r'] = 0xFF & ($colorVal >> 0x10); 237 $rgbArray['g'] = 0xFF & ($colorVal >> 0x8); 238 $rgbArray['b'] = 0xFF & $colorVal; 239 } elseif (strlen($hexStr) == 3) { //if shorthand notation, need some string manipulations 240 $rgbArray['r'] = hexdec(str_repeat(substr($hexStr, 0, 1), 2)); 241 $rgbArray['g'] = hexdec(str_repeat(substr($hexStr, 1, 1), 2)); 242 $rgbArray['b'] = hexdec(str_repeat(substr($hexStr, 2, 1), 2)); 243 } else { 244 return false; //Invalid hex color code 245 } 246 247 return $returnAsString ? implode($seperator, $rgbArray) : $rgbArray; // returns the rgb string or the associative array 248 248 } 249 249 250 250 // Verifie si une chaine est un nombre décimal (plus strict que is_numeric qui fonctionne avec les hexadecimaux) 251 251 function is_decimal($num) { 252 253 254 255 256 252 if((is_numeric($num) === true AND (float)$num == $num) OR $num === '0') { 253 return true; 254 } else { 255 return false; 256 } 257 257 } 258 258 259 259 // Charge le fichier de langue d'un plugin 260 260 function load_plugin_lang($plugin_id) { 261 262 263 264 265 266 261 global $CONF, $Lang; 262 if (file_exists('plugins/'.$plugin_id.'/language/'.$CONF['user_lang'].'.php')) { 263 include('plugins/'.$plugin_id.'/language/'.$CONF['user_lang'].'.php'); 264 } else { 265 include('plugins/'.$plugin_id.'/language/en_UK.php'); 266 } 267 267 } 268 268 269 269 // fonction nconvert avec gestion du log 270 270 function nconvert($param, $log=true) { 271 272 273 274 275 276 277 278 279 //$LOG[] = "\t" . $param;280 281 282 271 global $LOG; 272 273 exec('include\nconvert.exe '. $param .' 2>&1', $out); 274 275 if ($log) { 276 for ($i=0; $i<=3; $i++) 277 unset($out[$i]); 278 if (count($out)) $LOG[] = array_values($out); 279 //$LOG[] = " " . $param; 280 } else { 281 return $out; 282 } 283 283 } 284 284 285 285 // fonction mkdir avec gestion du log 286 286 function mkdir_log($dir) { 287 288 289 287 global $LOG; 288 mkdir($dir, 0777, true); 289 $LOG[] = 'Dir '.$dir.' created'; 290 290 } 291 291 292 292 // fonction copy avec gestion du log 293 293 function copy_log($src, $dest) { 294 295 296 294 global $LOG; 295 copy($src, $dest); 296 $LOG[] = 'Copy '.$src.' to '.$dest; 297 297 } 298 298 299 299 // fonction rename avec gestion du log 300 300 function rename_log($path, $new_path, $move=false) { 301 302 303 304 305 306 301 global $LOG; 302 rename($path, $new_path); 303 if ($move) 304 $LOG[] = 'Move '.$path.' to '.$new_path; 305 else 306 $LOG[] = 'Rename '.$path.' into '.$new_path; 307 307 } 308 308 309 309 // enregistre le log dans un fichier 310 310 function print_log($nb, $s) { 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 311 global $APPversion, $LOG; 312 313 $config = file_get_contents('config.xml'); 314 315 $string = 316 "PHP Optimisateur " . $APPversion . "\r\n". 317 date('r') . "\r\n". 318 $nb . " files in " . $s . " seconds" . "\r\n\r\n". 319 320 $config . "\r\n\r\n"; 321 322 foreach ($LOG as $event) { 323 if (is_array($event)) { 324 $string .= implode("\r\n", $event) . "\r\n"; 325 } else { 326 $string .= $event . "\r\n"; 327 } 328 } 329 330 if (!file_exists('logs')) { 331 mkdir('logs', 0777, true); 332 } 333 334 $filename = 'log_' . date('Y-m-d_H-i-s') . '.txt'; 335 file_put_contents('logs/'.$filename, $string); 336 return $filename; 337 337 } 338 338 339 339 // case insentive version of in_array 340 340 function in_arrayi($needle, $haystack) { 341 342 343 341 $needle = strtolower($needle); 342 $haystack = array_map('strtolower', $haystack); 343 return in_array($needle, $haystack); 344 344 } 345 345 -
extensions/PHP_Optimisateur/include/header.php
r10337 r12819 2 2 echo '<?xml version="1.0" encoding="utf-8"?> 3 3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 4 4 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 5 5 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> 6 6 <head> 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 7 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 8 <title>PHP Optimisateur '.$APPversion.'</title> 9 <link href="template/favicon.png" rel="icon" type="image/x-icon" /> 10 11 <link rel="stylesheet" type="text/css" media="screen" href="template/css/screen.css"/> 12 <link rel="stylesheet" type="text/css" media="screen" href="template/css/colorpicker.css"/> 13 <link rel="stylesheet" type="text/css" media="screen" href="template/css/jqtransform.css"/> 14 15 <script type="text/javascript" src="template/js/jquery.js"></script> 16 <script type="text/javascript" src="template/js/colorpicker.js"></script> 17 <script type="text/javascript" src="template/js/jqtransform.js"></script> 18 19 <script language="javascript"> 20 $(function(){ 21 $("form").jqTransform({imgPath:"template/images/"}); 22 }); 23 function Load() { 24 $(\'#ready-text\').html(\''.l10n('Processing').'\'); 25 $(\'#loader\').html(\'<img src="template/images/loader.gif" alt="Load..."/>\'); 26 $(\'#overlay\').css(\'display\',\'block\'); 27 } 28 29 jQuery().ready(function(){ 30 jQuery("#languageSwitchLink").mouseover(function() { 31 jQuery("#languageSwitchBox").toggle(); 32 }); 33 jQuery("#languageSwitchBox").mouseleave(function() { 34 jQuery("#languageSwitchBox").toggle(); 35 }); 36 }); 37 </script> 38 39 '.$PAGE['header'].' 40 41 41 </head> 42 42 … … 46 46 47 47 <div class="generic title"> 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 48 PHP Optimisateur '.$APPversion.' 49 50 <div id="languageSwitchLink" title="Change Language"> 51 <ul> 52 <li><a href="#"><img src="language/'.$CONF['user_lang'].'/flag.png" alt="'.$CONF['languages'][$CONF['user_lang']].'"/> '.$CONF['languages'][$CONF['user_lang']].'</a></li> 53 </ul> 54 </div> 55 56 <div id="languageSwitchBox" style="display:none;" class="generic"> 57 <ul>'; 58 foreach ($CONF['languages'] as $key => $name) { 59 echo '<li><a class="lang" href="index.php?Lang='.$key.'" title="'.$name.'"><img src="language/'.$key.'/flag.png" alt="'.$name.'"/> '.$name.'</a></li>'; 60 } 61 echo ' </ul> 62 </div> 63 64 64 </div>'; 65 65 ?> -
extensions/PHP_Optimisateur/include/main.php
r10337 r12819 2 2 // Si mode silencieux vidage automatique du dossier de sortie 3 3 if ($CONF['silentORNOT'] == 'erase') { 4 5 4 @rrmdir($CONF['DIRsortie']); 5 @mkdir($CONF['DIRsortie']); 6 6 } 7 7 … … 10 10 // Les caractères '%' et '$' sont systématiquement échappés, ca génère des bugs dans les noms de fichiers 11 11 function recursive_delete_special_car($dir) { 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 12 $dir = rtrim($dir, '/'); 13 $dh = opendir($dir); 14 15 while (($file = readdir($dh)) !== false ) { 16 if ($file !== '.' && $file !== '..') { 17 $path = $dir.'/'.$file; 18 $new_path = $dir.'/'.delete_special_car($file); 19 20 if ($path != $new_path) { 21 rename_log($path, $new_path); 22 } 23 24 if (is_dir($new_path)) { 25 recursive_delete_special_car($new_path); 26 } 27 } 28 } 29 closedir($dh); 30 30 } 31 31 … … 38 38 39 39 if ($CONF['copyONhd']) { 40 40 $CONF['copyHD'] = '-text_font "'.$CONF['copyFONT'].'" '.$CONF['DIMnormal']*$CONF['copySIZE'].' -text_color '.$CONF['copyCOLOR'].' -text_flag '.$CONF['copyPOS'].' -text_pos 0 0 -text "'.$CONF['copyright'].'"'; 41 41 } else { 42 42 $CONF['copyHD'] = null; 43 43 } 44 44 45 45 if ($CONF['copyONnormal']) { 46 46 $CONF['copyNormal'] = '-text_font "'.$CONF['copyFONT'].'" '.$CONF['DIMnormal']*$CONF['copySIZE'].' -text_color '.$CONF['copyCOLOR'].' -text_flag '.$CONF['copyPOS'].' -text_pos 0 0 -text "'.$CONF['copyright'].'"'; 47 47 } else { 48 48 $CONF['copyNormal'] = null; 49 49 } 50 50 … … 55 55 ### Plugins avant execution ### 56 56 foreach ($CONF['Plugins'] as $plugin_id => $plugin_config) { 57 58 59 57 if ($plugin_config['mode'] == 'Before' AND $plugin_config['active']) { 58 include('plugins/'.$plugin_id.'/main.php'); 59 } 60 60 } 61 61 … … 71 71 // Boucle sur tous les fichiers 72 72 for ($i=0; $i<count($FilesSource); $i++) { 73 74 preg_match('#^(.*)/(.*)\.([a-z0-9]{2,4})$#', $FilesSource[$i], $matches);75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 73 // Découpe le nom de fichier : dossier/fichier/extension 74 preg_match('#^(.*)/(.*)\.([a-z0-9]{2,4})$#i', $FilesSource[$i], $matches); 75 $file['folder_src'] = $matches[1].'/'; // dossier d'entrée 76 $file['folder_out'] = str_replace($CONF['DIRsource'], $CONF['DIRsortie'], $file['folder_src']); // dossier de sortie 77 $file['name'] = $matches[2]; // nom final 78 $file['ext'] = $matches[3]; // extension orginale 79 80 // Crée les sous-dossiers de sortie & 'pwg_high' & 'thumbnail' 81 if (!file_exists($file['folder_out'].'pwg_high') AND $CONF['DIRhighORNOT']) { 82 mkdir_log($file['folder_out'].'pwg_high'); 83 } 84 if (!file_exists($file['folder_out'].'thumbnail')) { 85 mkdir_log($file['folder_out'].'thumbnail'); 86 } 87 88 if (!in_arrayi($file['ext'], $CONF['allowedExt'])) { 89 $BlockAll['main'] = true; 90 $LOG[] = 'Not image file : '.$FilesSource[$i]; 91 } 92 93 if (!isset($BlockAll)) { 94 // Informations sur le fichier 95 exec('include\nconvert.exe -info "'.$FilesSource[$i].'"', $FileInfos); 96 97 for ($m=0; $m<=5; $m++) { 98 unset($FileInfos[$m]); 99 } 100 foreach ($FileInfos as $key) { 101 if ($key != '') { 102 $a = explode(':', $key); 103 $FileInfos[trim($a[0])] = trim($a[1]); 104 } 105 } 106 } 107 108 // Plugins pendant l'execution, haute priorité 109 foreach ($CONF['Plugins'] as $plugin_id => $plugin_config) { 110 if ($plugin_config['mode'] == 'ProcessHigh' AND $plugin_config['active']) { 111 include('plugins/'.$plugin_id.'/main.php'); 112 } 113 } 114 115 // Plugins pendant l'execution 116 foreach ($CONF['Plugins'] as $plugin_id => $plugin_config) { 117 if ($plugin_config['mode'] == 'Process' AND $plugin_config['active']) { 118 include('plugins/'.$plugin_id.'/main.php'); 119 } 120 } 121 122 // Compresse les fichiers dans le dossier de sortie 123 if (!isset($BlockNormal) AND !isset($BlockAll)) { 124 nconvert('-q '.$CONF['Qnormal'].' -out jpeg -o "'.$file['folder_out'].$file['name'].'.jpg" -dpi 72 '.$CONF['convOptions'].' -resize '.$CONF['DIMnormal'].' '.$CONF['DIMnormal'].' '.$CONF['copyNormal'].' "'.$FilesSource[$i].'"'); 125 } 126 if (!isset($BlockThumbnail) AND !isset($BlockAll)) { 127 nconvert('-q '.$CONF['Qthumbnail'].' -out jpeg -o "'.$file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg" -dpi 72 '.$CONF['convOptions'].' -resize '.$CONF['DIMthumbnail'].' '.$CONF['DIMthumbnail'].' -rmeta -rexifthumb "'.$FilesSource[$i].'"'); 128 } 129 if (!isset($BlockHigh) AND $CONF['DIRhighORNOT'] AND !isset($BlockAll)) { 130 if ($CONF['DIMhdORNOT']) { 131 nconvert('-q '.$CONF['Qhd'].' -out jpeg -o "'.$file['folder_out'].'pwg_high/'.$file['name'].'.jpg" -dpi '.$CONF['DPI'].' '.$CONF['convOptions'].' -resize '.$CONF['DIMhd'].' '.$CONF['DIMhd'].' '.$CONF['copyHD'].' "'.$FilesSource[$i].'"'); 132 } else if (strtolower($file['ext']) != 'jpg') { 133 nconvert('-q '.$CONF['Qhd'].' -out jpeg -o "'.$file['folder_out'].'pwg_high/'.$file['name'].'.jpg" "'.$FilesSource[$i].'"'); 134 } else { 135 copy_log($FilesSource[$i], $file['folder_out'].'pwg_high/'.$file['name'].'.jpg'); 136 } 137 } 138 139 // Réinitialise les variables 140 unset($file, $FileInfos, $BlockNormal, $BlockThumbnail, $BlockHigh, $BlockAll); 141 $LOG[] = "\r\n"; 142 142 } 143 143 … … 148 148 149 149 foreach($DirsSortie as $dir) { 150 151 152 153 154 150 if (is_dir_empty($dir)) { 151 rmdir($dir); 152 } else if ($CONF['indexORNOT']) { 153 copy_log('include/index.php', $dir.'/index.php'); 154 } 155 155 } 156 156 … … 160 160 ### Plugins après execution ### 161 161 foreach ($CONF['Plugins'] as $plugin_id => $plugin_config) { 162 163 164 162 if ($plugin_config['mode'] == 'After' AND $plugin_config['active']) { 163 include('plugins/'.$plugin_id.'/main.php'); 164 } 165 165 } 166 166 ?> -
extensions/PHP_Optimisateur/include/save_config.php
r10337 r12819 1 1 <?php 2 2 // Quelques traitements 3 $_POST['copyPOS'] = implode('-', $_POST['copyPOS']); 3 if ($_POST['copyPOS'][0] == 'center' and $_POST['copyPOS'][1] == 'center') { 4 $_POST['copyPOS'] = 'center'; 5 } else { 6 $_POST['copyPOS'] = implode('-', $_POST['copyPOS']); 7 } 4 8 $_POST['copyCOLOR'] = str_replace('#', null, $_POST['copyCOLOR']); 5 9 $_POST['prefixe_mini'] = delete_special_car($_POST['prefixe_mini']); … … 9 13 // Vérifications 10 14 if (!is_decimal($_POST['Qhd']) OR $_POST['Qhd'] > 100) { 11 12 15 $_POST['Qhd'] = 100; 16 $ERRORS['conf'][] = array(l10n('Qhd'), 'must_be_integer_100'); 13 17 } 14 18 if (!is_decimal($_POST['Qnormal']) OR $_POST['Qnormal'] > 100) { 15 16 19 $_POST['Qnormal'] = 100; 20 $ERRORS['conf'][] = array(l10n('Qnormal'), 'must_be_integer_100'); 17 21 } 18 22 if (!is_decimal($_POST['Qthumbnail']) OR $_POST['Qthumbnail'] > 100) { 19 20 23 $_POST['Qthumbnail'] = 100; 24 $ERRORS['conf'][] = array(l10n('Qthumbnail'), 'must_be_integer_100'); 21 25 } 22 26 if (!is_decimal($_POST['DIMhd'])) { 23 24 27 $_POST['DIMhd'] = 2560; 28 $ERRORS['conf'][] = array(l10n('DIMhd'), 'must_be_integer'); 25 29 } 26 30 if (!is_decimal($_POST['DIMnormal']) OR $_POST['DIMnormal'] > $_POST['DIMhd']) { 27 28 31 $_POST['DIMnormal'] = 800; 32 $ERRORS['conf'][] = array(l10n('DIMnormal'), 'must_be_integer'); 29 33 } 30 34 if (!is_decimal($_POST['DIMthumbnail']) OR $_POST['DIMthumbnail'] > $_POST['DIMnormal']) { 31 32 35 $_POST['DIMthumbnail'] = 120; 36 $ERRORS['conf'][] = array(l10n('DIMthumbnail'), 'must_be_integer'); 33 37 } 34 38 if (!is_decimal($_POST['DPI'])) { 35 36 39 $_POST['DPI'] = 72; 40 $ERRORS['conf'][] = array(l10n('DPI'), 'must_be_integer'); 37 41 } 38 42 if (!is_decimal($_POST['copySIZE'])) { 39 40 43 $_POST['copySIZE'] = 0.05; 44 $ERRORS['conf'][] = array(l10n('copySIZE'), 'must_be_decimal'); 41 45 } 42 46 43 47 44 48 // Plugins : supprime les plugins manquants & charge les actions de configuration … … 46 50 47 51 foreach ($_POST['Plugins'] as $plugin_id => $plugin_config) { 48 49 50 51 52 52 if (isset($plugin_config['delete'])) { 53 unset($_POST['Plugins'][$plugin_id]); 54 } else if (file_exists('plugins/'.$plugin_id.'/setup.php')) { 55 include('plugins/'.$plugin_id.'/setup.php'); 56 } 53 57 } 54 58 … … 65 69 66 70 if (!isset($ERRORS['conf'])) { 67 68 $PAGE['header'] .= '<meta http-equiv="refresh" content="3;url=index.php">';69 71 // header('Location:index.php'); 72 $PAGE['header'] .= '<meta http-equiv="refresh" content="2;url=index.php">'; 73 $PAGE['end'] .= '<div class="generic finish">'.l10n('Saved').'</div>'; 70 74 } 71 75 -
extensions/PHP_Optimisateur/include/setup.php
r10337 r12819 6 6 7 7 foreach ($Available_Plugins as $plugin) { 8 9 10 11 12 13 8 $plugin_id = str_replace('plugins/', '', $plugin); // id du plugin 9 if (!array_key_exists($plugin_id, $CONF['Plugins'])) { 10 $CONF['Plugins'][$plugin_id] = load_config('plugins/'.$plugin_id.'/config.xml'); // configuration du plugin 11 $CONF['Plugins'][$plugin_id]['active'] = false; 12 $NewPlugins[$plugin_id] = true; 13 } 14 14 } 15 15 … … 17 17 ### Gestion des plugins manquants ### 18 18 foreach ($CONF['Plugins'] as $plugin_id => $plugin_config) { 19 20 21 19 if (!file_exists('plugins/'.$plugin_id)) { 20 $MissingPlugins[$plugin_id] = true; 21 } 22 22 } 23 23 24 24 25 25 ### Formulaire ### 26 $CONF['copyPOS'] = explode('-', $CONF['copyPOS']);27 26 $CONF['copyCOLOR'] = nice_hex_color($CONF['copyCOLOR']); 27 if ($CONF['copyPOS'] == 'center') { 28 $CONF['copyPOS'] = array('center', 'center'); 29 } else { 30 $CONF['copyPOS'] = explode('-', $CONF['copyPOS']); 31 } 28 32 29 33 $PAGE['content'] .= '<form action="index.php?page=setup" method="post"> 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 34 <div class="generic config"> 35 <h2>'.l10n('Configuration').'</h2> 36 <ul> 37 <li> 38 <span class="title">'.l10n('Folders').'</span> 39 <table> 40 <tr> 41 <td>'.l10n('FolderIn').' :</td> 42 <td><input type="text" name="DIRsource" value="'.$CONF['DIRsource'].'"/></td> 43 </tr> 44 <tr> 45 <td>'.l10n('FolderOut').' :</td> 46 <td><input type="text" name="DIRsortie" value="'.$CONF['DIRsortie'].'"/></td> 47 </tr> 48 </table> 49 </li> 50 <li> 51 <span class="title">'.l10n('Options').'</span> 52 <table> 53 <tr> 54 <td>'.l10n('silentORNOT').' :</td> 55 <td> 56 <input type="radio" id="silentORNOT1" name="silentORNOT" value="erase" '.(($CONF['silentORNOT']=='erase')?'checked="checked"':'').'/> 57 <label for="silentORNOT1">'.l10n('erase').'</label> 58 <input type="radio" id="silentORNOT2" name="silentORNOT" value="block" '.(($CONF['silentORNOT']=='block')?'checked="checked"':'').'/> 59 <label for="silentORNOT2">'.l10n('block').'</label> 60 <input type="radio" id="silentORNOT3" name="silentORNOT" value="pass" '.(($CONF['silentORNOT']=='pass')?'checked="checked"':'').'/> 61 <label for="silentORNOT3">'.l10n('pass').'</label> 62 </td> 63 </tr> 64 <tr> 65 <td>'.l10n('DIRhighORNOT').' :</td> 66 <td> 67 <input type="radio" id="DIRhighORNOT1" name="DIRhighORNOT" value="true" '.(($CONF['DIRhighORNOT'])?'checked="checked"':'').'/> 68 <label for="DIRhighORNOT1">'.l10n('yes').'</label> 69 <input type="radio" id="DIRhighORNOT2" name="DIRhighORNOT" value="false" '.((!$CONF['DIRhighORNOT'])?'checked="checked"':'').'/> 70 <label for="DIRhighORNOT2">'.l10n('no').'</label> 71 </td> 72 </tr> 73 <tr> 74 <td>'.l10n('DIMhdORNOT').' :</td> 75 <td> 76 <input type="radio" id="DIMhdORNOT1" name="DIMhdORNOT" value="true" '.(($CONF['DIMhdORNOT'])?'checked="checked"':'').'/> 77 <label for="DIMhdORNOT1">'.l10n('yes').'</label> 78 <input type="radio" id="DIMhdORNOT" name="DIMhdORNOT" value="false" '.((!$CONF['DIMhdORNOT'])?'checked="checked"':'').'/> 79 <label for="DIMhdORNOT2">'.l10n('no').'</label> 80 </td> 81 </tr> 82 <tr> 83 <td>'.l10n('renameORNOT').' :</td> 84 <td> 85 <input type="radio" id="renameORNOT1" name="renameORNOT" value="true" '.(($CONF['renameORNOT'])?'checked="checked"':'').'/> 86 <label for="renameORNOT1">'.l10n('yes').'</label> 87 <input type="radio" id="renameORNOT2" name="renameORNOT" value="false" '.((!$CONF['renameORNOT'])?'checked="checked"':'').'/> 88 <label for="renameORNOT2">'.l10n('no').'</label> 89 </td> 90 </tr> 91 <tr> 92 <td>'.l10n('indexORNOT').' :</td> 93 <td> 94 <input type="radio" id="indexORNOT1" name="indexORNOT" value="true" '.(($CONF['indexORNOT'])?'checked="checked"':'').'/> 95 <label for="indexORNOT1">'.l10n('yes').'</label> 96 <input type="radio" id="indexORNOT2" name="indexORNOT" value="false" '.((!$CONF['indexORNOT'])?'checked="checked"':'').'/> 97 <label for="indexORNOT2">'.l10n('no').'</label> 98 </td> 99 </tr> 100 <tr> 101 <td>'.l10n('prefixe_mini').' :</td> 102 <td><input type="text" name="prefixe_mini" value="'.$CONF['prefixe_mini'].'" size="8"/></td> 103 </tr> 104 </table> 105 </li> 106 <li> 107 <span class="title">'.l10n('Sizes and quality').'</span> 108 <table> 109 <tr> 110 <td>'.l10n('DIMhd').' :</td> 111 <td><input type="text" name="DIMhd" value="'.$CONF['DIMhd'].'" size="4"/>px</td> 112 </tr> 113 <tr> 114 <td>'.l10n('DIMnormal').' :</td> 115 <td><input type="text" name="DIMnormal" value="'.$CONF['DIMnormal'].'" size="3"/>px</td> 116 </tr> 117 <tr> 118 <td>'.l10n('DIMthumbnail').' :</td> 119 <td><input type="text" name="DIMthumbnail" value="'.$CONF['DIMthumbnail'].'" size="3"/>px</td> 120 </tr> 121 <tr> 122 <td>'.l10n('Qhd').' :</td> 123 <td><input type="text" name="Qhd" value="'.$CONF['Qhd'].'" size="3"/>%</td> 124 </tr> 125 <tr> 126 <td>'.l10n('Qnormal').' :</td> 127 <td><input type="text" name="Qnormal" value="'.$CONF['Qnormal'].'" size="3"/>%</td> 128 </tr> 129 <tr> 130 <td>'.l10n('Qthumbnail').' :</td> 131 <td><input type="text" name="Qthumbnail" value="'.$CONF['Qthumbnail'].'" size="3"/>%</td> 132 </tr> 133 <tr> 134 <td>'.l10n('DPI').' :</td> 135 <td><input type="text" name="DPI" value="'.$CONF['DPI'].'" size="3"/>dpi</td> 136 </tr> 137 </table> 138 </li> 139 <li> 140 <span class="title">'.l10n('Copyright').'</span> 141 <table> 142 <tr> 143 <td>'.l10n('Content').' :</td> 144 <td><input type="text" name="copyright" value="'.$CONF['copyright'].'"/></td> 145 </tr> 146 <tr> 147 <td>'.l10n('copyONhd').' :</td> 148 <td> 149 <input type="radio" id="copyONhd1" name="copyONhd" value="true" '.(($CONF['copyONhd'])?'checked="checked"':'').'/> 150 <label for="copyONhd1">'.l10n('yes').'</label> 151 <input type="radio" id="copyONhd2" name="copyONhd" value="false" '.((!$CONF['copyONhd'])?'checked="checked"':'').'/> 152 <label for="copyONhd2">'.l10n('no').'</label> 153 </td> 154 </tr> 155 <tr> 156 <td>'.l10n('copyONnormal').' :</td> 157 <td> 158 <input type="radio" id="copyONnormal1" name="copyONnormal" value="true" '.(($CONF['copyONnormal'])?'checked="checked"':'').'/> 159 <label for="copyONnormal1">'.l10n('yes').'</label> 160 <input type="radio" id="copyONnormal2" name="copyONnormal" value="false" '.((!$CONF['copyONnormal'])?'checked="checked"':'').'/> 161 <label for="copyONnormal2">'.l10n('no').'</label> 162 </td> 163 </tr> 164 <tr> 165 <td>'.l10n('copyPOS%s', l10n('copyPOSv')).' :</td> 166 <td> 167 <input type="radio" id="copyPOS01" name="copyPOS[0]" value="top" '.(($CONF['copyPOS'][0]=='top')?'checked="checked"':'').'/> 168 <label for="copyPOS01">'.l10n('top').'</label> 169 <input type="radio" id="copyPOS02" name="copyPOS[0]" value="center" '.(($CONF['copyPOS'][0]=='center')?'checked="checked"':'').'/> 170 <label for="copyPOS02">'.l10n('center').'</label> 171 <input type="radio" id="copyPOS03" name="copyPOS[0]" value="bottom" '.(($CONF['copyPOS'][0]=='bottom')?'checked="checked"':'').'/> 172 <label for="copyPOS03">'.l10n('bottom').'</label> 173 </td> 174 </tr> 175 <tr> 176 <td>'.l10n('copyPOS%s', l10n('copyPOSh')).' :</td> 177 <td> 178 <input type="radio" id="copyPOS11" name="copyPOS[1]" value="left" '.(($CONF['copyPOS'][1]=='left')?'checked="checked"':'').'/> 179 <label for="copyPOS11">'.l10n('left').'</label> 180 <input type="radio" id="copyPOS12" name="copyPOS[1]" value="center" '.(($CONF['copyPOS'][1]=='center')?'checked="checked"':'').'/> 181 <label for="copyPOS12">'.l10n('center').'</label> 182 <input type="radio" id="copyPOS13" name="copyPOS[1]" value="right" '.(($CONF['copyPOS'][1]=='right')?'checked="checked"':'').'/> 183 <label for="copyPOS13">'.l10n('right').'</label> 184 </td> 185 </tr> 186 <tr> 187 <td>'.l10n('copySIZE').' :</td> 188 <td><input type="text" name="copySIZE" value="'.$CONF['copySIZE'].'" size="5"/></td> 189 </tr> 190 <tr> 191 <td>'.l10n('copyCOLOR').' :</td> 192 <td><input type="text" id="colorpicker" name="copyCOLOR" value="'.$CONF['copyCOLOR'].'" size="6"/></td> 193 <script type="text/javascript"> 194 $("#colorpicker").ColorPicker({ 195 onSubmit: function(hsb, hex, rgb, el) { $(el).val(hex); $(el).ColorPickerHide(); }, 196 onChange: function(hsb, hex, rgb, el) { $("#colorpicker").val(hex); }, 197 onBeforeShow: function () { $(this).ColorPickerSetColor(this.value); } 198 }) .bind("keyup", function(){ $(this).ColorPickerSetColor(this.value); }); 199 </script> 200 </tr> 201 <tr> 202 <td>'.l10n('copyFONT').' :</td> 203 <td><input type="text" name="copyFONT" value="'.$CONF['copyFONT'].'"/></td> 204 </tr> 205 </table> 206 </li> 207 </ul> 208 </div> 209 210 <div class="generic config"> 211 <h2>'.l10n('Plugins').'</h2> 212 <ul>'; 213 214 // Affichage des plugins 215 $PLUGIN_ACTION = 'edit_config'; 216 217 foreach ($CONF['Plugins'] as $plugin_id => $plugin_config) { 218 $PAGE['content'] .= '<li> 219 <div class="plugin-title"> 220 <span class="title">'.$plugin_config['name'].' :</span> 221 <input type="hidden" name="Plugins['.$plugin_id.'][name]" value="'.$plugin_config['name'].'"/> 222 <input type="hidden" name="Plugins['.$plugin_id.'][mode]" value="'.$plugin_config['mode'].'"/>'; 223 224 // Cas spéciaux dans le titre (nouveau, manquant) 225 if (isset($NewPlugins[$plugin_id])) { 226 $PAGE['content'] .= ' <b class="new">'.l10n('New !').'</b>'; 227 } else if (isset($MissingPlugins[$plugin_id])) { 228 $PAGE['content'] .= ' <b class="miss">'.l10n('Missing !').'</b>'; 229 } 230 231 // Si il est manquant on ne met que la checkbox de suppression, sinon boutons d'activation 232 $PAGE['content'] .= '<span class="plugin-active">'; 233 if (isset($MissingPlugins[$plugin_id])) { 234 $PAGE['content'] .= '<label><input type="checkbox" name="Plugins['.$plugin_id.'][delete]" value="true" checked="checked"/> '.l10n('erase').'</label>'; 235 } else { 236 $PAGE['content'] .= '<input type="radio" id="" id="active-'.$plugin_id.'" name="Plugins['.$plugin_id.'][active]" value="true" '.(($plugin_config['active'])?'checked="checked"':'').'/> 237 <label for="active-'.$plugin_id.'">'.l10n('Active').'</label> 238 <input type="radio" id="" id="inactive-'.$plugin_id.'"name="Plugins['.$plugin_id.'][active]" value="false" '.((!$plugin_config['active'])?'checked="checked"':'').'/> 239 <label for="inactive-'.$plugin_id.'">'.l10n('Inactive').'</label>'; 240 } 241 $PAGE['content'] .= '</span> 242 243 </div>'; 244 245 246 // On affiche sa configuration 247 if (!isset($MissingPlugins[$plugin_id]) AND file_exists('plugins/'.$plugin_id.'/setup.php')) { 248 include('plugins/'.$plugin_id.'/setup.php'); 249 } 250 $PAGE['content'] .= '</li>'; 251 } 252 253 $PAGE['content'] .= '</ul> 254 </div>'; 255 256 257 $PAGE['end'] .= '<div class="generic link"> 258 <input type="submit" name="submit" value="'.l10n('Valid').'"/> 259 <input type="reset" onclick="location.href=\'index.php\'" value="'.l10n('Back').'"/> 260 </div> 257 261 </form>'; 258 262 ?> -
extensions/PHP_Optimisateur/index.php
r10338 r12819 1 1 <?php 2 2 /***************************************\ 3 | PHP OPTIMISATEUR|4 | Version 1.4|3 | PHP OPTIMISATEUR | 4 | Version 1.4 | 5 5 \***************************************/ 6 6 … … 14 14 $LOG = array(); 15 15 $PAGE = array( 16 17 18 19 20 16 'section' => 'home', 17 'header' => null, 18 'content' => null, 19 'msgs' => null, 20 'end' => null, 21 21 ); 22 22 … … 28 28 ### CONFIGURATION ### 29 29 if (!file_exists('config.xml')) { 30 30 $ERRORS['fatal'][] = 'ErrorConfigFile'; 31 31 } else { 32 32 $CONF = load_config('config.xml'); 33 33 } 34 34 35 35 if (!file_exists('include/nconvert.exe')) { 36 36 $ERRORS['fatal'][] = 'ErrorNconvert'; 37 37 } 38 38 … … 44 44 ### PROCESSUS ### 45 45 switch ($PAGE['section']) { 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 46 case 'home': 47 if (!isset($ERRORS['fatal'])) { 48 if (!file_exists($CONF['DIRsource'])) { 49 mkdir($CONF['DIRsource']); 50 } 51 if (!file_exists($CONF['DIRsortie'])) { 52 mkdir($CONF['DIRsortie']); 53 } 54 if (is_dir_empty($CONF['DIRsource'])) { 55 $ERRORS['fatal'][] = 'ErrorFolderIn'; 56 } 57 if ($CONF['silentORNOT'] == 'block' AND !is_dir_empty($CONF['DIRsortie'])) { 58 $ERRORS['fatal'][] = 'ErrorFolderOut'; 59 } else if ($CONF['silentORNOT'] == 'erase' AND !is_dir_empty($CONF['DIRsortie'])) { 60 $ERRORS['notice'][] = 'EraseFolderOut'; 61 } 62 } 63 break; 64 65 case 'setup': 66 if (isset($_POST['submit'])) { 67 include('include/save_config.php'); 68 } 69 break; 70 71 case 'process': 72 include('include/main.php'); 73 break; 74 74 } 75 75 … … 78 78 ### AFFICHAGE ### 79 79 switch ($PAGE['section']) { 80 81 82 83 84 85 86 87 88 80 case 'home': 81 include('include/display_config.php'); 82 83 if (isset($ERRORS['fatal'])) { 84 $PAGE['end'] .= ' 85 <div class="generic link"> 86 <a class="input-submit" href="index.php">'.l10n('Reload').'</a> 87 <a class="input-submit" href="index.php?page=setup">'.l10n('Config').'</a> 88 </div>'; 89 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 90 } else { 91 $PAGE['end'] .= ' 92 <div class="generic finish"> 93 <span id="ready-text">'.l10n('Ready').'</span> 94 <span id="loader"><img src="template/favicon.png" alt="PHP OPT"/></span> 95 </div> 96 <div class="generic link"> 97 <a class="input-submit" href="index.php?page=process" onclick="Load();">'.l10n('Launch').'</a> 98 <a class="input-submit" href="index.php?page=setup">'.l10n('Config').'</a> 99 </div>'; 100 } 101 break; 102 103 case 'setup': 104 if (isset($ERRORS['fatal'])) { 105 $PAGE['end'] .= ' 106 <div class="generic link"> 107 <a class="input-submit" href="index.php">'.l10n('Back').'</a> 108 <a class="input-submit" href="index.php?page=setup">'.l10n('Reload').'</a> 109 </div>'; 110 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 111 } else { 112 include('include/setup.php'); 113 } 114 break; 115 116 case 'process': 117 ### Affichage des fichiers traités et création du log ### 118 $nb_files = count($FilesSource); 119 $time = intval((microtime(true)-$TIME_START)); 120 $logfile = print_log($nb_files, $time); 121 122 $PAGE['content'] .= ' 123 <div class="generic files"> 124 <h2>'.l10n('Source files').'</h2> 125 <ul>'; 126 foreach ($FilesSource as $value) { 127 $PAGE['content'] .= '<li>'.$value.'</li>'; 128 } 129 $PAGE['content'] .= '</ul> 130 <i>'.l10n('%d files', $nb_files).'</i><br> 131 <b>Log :</b> <a href="logs/'.$logfile.'">'.$logfile.'</a> 132 </div>'; 133 134 134 135 136 137 138 139 140 141 142 143 144 135 unset($FilesSource); 136 unset($FilesSortie); 137 138 $PAGE['end'] .= ' 139 <div class="generic finish">'.l10n('Finish %d seconds', $time).'</div> 140 <div class="generic link"> 141 <a class="input-submit" href="index.php">'.l10n('Back').'</a> 142 <a class="input-submit" href="index.php?page=setup">'.l10n('Config').'</a> 143 </div>'; 144 break; 145 145 } 146 146 … … 150 150 // erreurs fatales 151 151 if (isset($ERRORS['fatal'])) { 152 153 154 155 156 152 $PAGE['msgs'] .= '<div class="generic error">'; 153 foreach ($ERRORS['fatal'] as $key) { 154 $PAGE['msgs'] .= '<div>'.l10n('fatal.'.$key).'</div>'; 155 } 156 $PAGE['msgs'] .= '</div>'; 157 157 } 158 158 // informations 159 159 if (isset($ERRORS['notice'])) { 160 161 162 163 164 160 $PAGE['msgs'] .= '<div class="generic notice">'; 161 foreach ($ERRORS['notice'] as $key) { 162 $PAGE['msgs'] .= '<div>'.l10n('notice.'.$key).'</div>'; 163 } 164 $PAGE['msgs'] .= '</div>'; 165 165 } 166 166 // erreurs de configuration 167 167 if (isset($ERRORS['conf'])) { 168 169 170 171 172 168 $PAGE['msgs'] .= '<div class="generic notice conf">'; 169 foreach ($ERRORS['conf'] as $key) { 170 $PAGE['msgs'] .= '<div>'.l10n('notice.'.$key[1].' %s', '<i>'.$key[0].'</i>').'</div>'; 171 } 172 $PAGE['msgs'] .= '</div>'; 173 173 } 174 174 … … 183 183 echo ' 184 184 <div class="generic footer"> 185 185 2010/2011 - <a href="http://www.strangeplanet.fr">Damien Sorel</a> - <a href="http://fr.piwigo.org/forum/viewtopic.php?id=19117">Forum</a> - <a href="http://fr.piwigo.org/doc/doku.php?id=tools:php_o">Documentation</a> 186 186 </div> 187 187 -
extensions/PHP_Optimisateur/plugins/charlies_content/main.php
r10338 r12819 1 1 <?php 2 2 /***************************************\ 3 | PHP OPTIMISATEUR|4 | Plugin Charlie's Content 1.0|3 | PHP OPTIMISATEUR | 4 | Plugin Charlie's Content 1.0 | 5 5 \***************************************/ 6 6 … … 8 8 9 9 $CC_charlies_exts = array( // all extensions supported by Charlies' Content 10 11 12 13 10 'flv','swf','pls','m3u','wav','mid','au','aif','mp3','pdf', 11 'asf','wmv','divx','xvid','aiff','aac','bmp','gsm','mov','mpg', 12 'mpeg','mp4','m4a','psd','qt','qtif','qif','qti','snd','tif', 13 'tiff','3g2','3pg','zip','rar','gpx','3gp', 14 14 ); 15 15 $CC_video_exts = array( // extensions tested with FFmpeg 16 17 16 'wmv','mov','mkv','mp4','mpg','flv','asf','xvid','divx','mpeg', 17 'avi','rm', # <-- additional formats 18 18 ); 19 19 $CC_video_time = $CONF['Plugins']['charlies_content']['video_time']; … … 21 21 if (!function_exists('ffmpeg')) { 22 22 function ffmpeg($param, $log=true) { 23 23 global $LOG; 24 24 25 26 27 28 29 30 31 25 exec('include\ffmpeg.exe '. $param .' 2>&1', $out); 26 27 if ($log) { 28 $LOG[] = 'FFmpeg conversion : ' . $param; 29 } else { 30 return $out; 31 } 32 32 } 33 33 } 34 34 35 35 if (in_arrayi($file['ext'], $CC_video_exts)) { 36 37 38 39 40 41 42 43 44 45 46 47 48 49 36 // copie la video 37 copy_log($FilesSource[$i], $FilesSortie[$i]); 38 39 // infos sur le fichier 40 $infos = ffmpeg('-i "'. $FilesSource[$i] .'"', false); 41 $infos = implode('|', $infos); 42 43 // taille de la video 44 if (preg_match('#\, (\d+)x(\d+)#s', $infos, $sizes)) { 45 $FileInfos = array( 46 'Width' => $sizes[1], 47 'Height' => $sizes[2], 48 ); 49 } 50 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 ffmpeg('-i "'. $FilesSource[$i] .'" -an -ss '.$second.' -t 1 -r 1 -y -vcodec mjpeg -f mjpeg "temp/'.$file['name'].'.jpg"'); 65 66 67 68 69 70 71 72 73 74 75 76 77 78 51 // position de la miniature 52 $second = 10; 53 if ($CC_video_time == 'rand') { 54 if (preg_match('#Duration: ((\d+):(\d+):(\d+))#s', $infos, $time)) { 55 $total = ($time[2] * 3600) + ($time[3] * 60) + $time[4]; 56 $second = rand(1, ($total - 1)); 57 } 58 } else if (is_int($CC_video_time)) { 59 $second = $CC_video_time; 60 } 61 62 // création d'un ficher pleine taille temporaire 63 mkdir('temp', 0777, true); 64 ffmpeg('-i "'. $FilesSource[$i] .'" -an -ss '.$second.' -t 1 -r 1 -y -vcodec mjpeg -f mjpeg "temp/'.$file['name'].'.jpg"'); 65 66 // miniature, utilise Create Custom Thumbs si activé 67 if ( 68 isset($CONF['Plugins']['create_custom_thumbs']) 69 AND $CONF['Plugins']['create_custom_thumbs']['active'] 70 ) { 71 unset($BlockAll); 72 $CCT_filesource = 'temp/'.$file['name'].'.jpg'; 73 include('plugins/create_custom_thumbs/main.php'); 74 $BlockAll['main'] = true; 75 76 } else { 77 nconvert('-q '.$CONF['Qthumbnail'].' -out jpeg -o "'.$file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg" -dpi 72 '.$CONF['convOptions'].' -resize '.$CONF['DIMthumbnail'].' '.$CONF['DIMthumbnail'].' -rmeta -rexifthumb "temp/'.$file['name'].'.jpg"'); 78 } 79 79 80 81 82 83 84 85 86 80 // suppression des fichiers temporaires 81 @rrmdir('temp'); 82 83 $BlockThumbnail['charlies_content'] = true; 84 $BlockNormal['charlies_content'] = true; 85 $BlockHigh['charlies_content'] = true; 86 87 87 } else if (in_arrayi($file['ext'], $CC_charlies_exts)) { 88 89 90 91 92 93 88 // copie le fichier 89 copy_log($FilesSource[$i], $FilesSortie[$i]); 90 91 $BlockThumbnail['charlies_content'] = true; 92 $BlockNormal['charlies_content'] = true; 93 $BlockHigh['charlies_content'] = true; 94 94 } 95 95 -
extensions/PHP_Optimisateur/plugins/charlies_content/setup.php
r10337 r12819 3 3 4 4 switch ($PLUGIN_ACTION) { 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 5 // Affichage simple de la configuration 6 case 'read_config': 7 // vérifie que ffmpeg est bien présent 8 if (!file_exists('include/ffmpeg.exe') AND $plugin_config['active']) { 9 $ERRORS['fatal'][] = 'charlies_content.error_ffmpeg'; 10 } 11 12 $PAGE['content'] .= ' 13 <table> 14 <tr> 15 <td>'.l10n('charlies_content.video_time').' :</td> 16 <td>'.bool_to_string($plugin_config['video_time']).($plugin_config['video_time']!=='rand' ? ' sec':'om').'</td> 17 </tr> 18 </table>'; 19 break; 20 21 22 // Actions avant enregistrement 23 case 'save_config': 24 if (!is_decimal($_POST['Plugins']['charlies_content']['video_time']) AND $_POST['Plugins']['charlies_content']['video_time'] != 'rand') { 25 $_POST['Plugins']['charlies_content']['video_time'] = 'rand'; 26 $ERRORS['conf'][] = array(l10n('charlies_content.video_time'), 'must_be_integer'); 27 } 28 28 29 29 break; 30 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 31 32 // Formulaire d'édition 33 case 'edit_config': 34 $PAGE['content'] .=' 35 <table> 36 <tr> 37 <td>'.l10n('charlies_content.video_time').' :</td> 38 <td> 39 <input type="text" name="Plugins[charlies_content][video_time]" value="'.$plugin_config['video_time'].'" size="3"/>sec 40 <i>'.l10n('charlies_content.rand').'</i> 41 </td> 42 </tr> 43 </table>'; 44 break; 45 45 } 46 46 ?> -
extensions/PHP_Optimisateur/plugins/convert_pan/main.php
r10337 r12819 1 1 <?php 2 2 /***************************************\ 3 | PHP OPTIMISATEUR|4 | Plugin ConvertPan 1.3|3 | PHP OPTIMISATEUR | 4 | Plugin ConvertPan 1.3 | 5 5 \***************************************/ 6 6 … … 8 8 ## Crée des miniatures rognées pour ne pas avoir de minuscules images 9 9 10 $CP_namepanorama = $CONF['Plugins']['convert_pan']['NAMEpanorama']; 11 $CP_detectmode = $CONF['Plugins']['convert_pan']['DetectMode']; 12 $CP_dimpanorama = $CONF['Plugins']['convert_pan']['DIMpanorama']; 13 $CP_ratiopan = $CONF['Plugins']['convert_pan']['RatioPan']; 14 $CP_ratiopanthumb = $CONF['Plugins']['convert_pan']['RatioPanThumb']; 10 $CP_namepanorama = $CONF['Plugins']['convert_pan']['NAMEpanorama']; // Suffixe des panoramas 11 $CP_detectmode = $CONF['Plugins']['convert_pan']['DetectMode']; // Mode de détection 12 $CP_dimpanorama = $CONF['Plugins']['convert_pan']['DIMpanorama']; // Hauteur des panoramas normaux 13 $CP_ratiopan = $CONF['Plugins']['convert_pan']['RatioPan']; // Ratio des panoramas 14 $CP_ratiopanthumb = $CONF['Plugins']['convert_pan']['RatioPanThumb']; // Ratio des miniatures 15 15 16 16 if (!isset($BlockAll)) { 17 17 18 18 if ( 19 20 19 ($CP_detectmode == 'name' AND strpos($file['name'],$CP_namepanorama) !== false) OR 20 ($CP_detectmode == 'ratio' AND $FileInfos['Width']/$FileInfos['Height'] >= $CP_ratiopan) 21 21 ) { 22 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 23 if (!isset($BlockNormal) AND $CP_dimpanorama != 0) { 24 nconvert('-q '.$CONF['Qnormal'].' -out jpeg -o "'.$file['folder_out'].$file['name'].'.jpg" -dpi 72 '.$CONF['convOptions'].' -resize 0 '.$CP_dimpanorama.' '.$CONF['copyNormal'].' "'.$FilesSource[$i].'"'); 25 $BlockNormal['convert_pan'] = true; 26 } 27 28 if (!isset($BlockThumbnail) AND $CP_ratiopanthumb != 0) { 29 $DIMthumbnailV = $CONF['DIMthumbnail']/$CP_ratiopanthumb; 30 31 // on prend la miniature au milieu du panorama 32 $tmp_x = $FileInfos['Width'] * $DIMthumbnailV / $FileInfos['Height']; 33 $offset_x = ($tmp_x - $CONF['DIMthumbnail']) / 2; 34 35 nconvert('-q '.$CONF['Qthumbnail'].' -out jpeg -o "'.$file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg" -dpi 72 '.$CONF['convOptions'].' -resize 0 '.$DIMthumbnailV.' -crop '.$offset_x.' 0 '.$CONF['DIMthumbnail'].' '.$DIMthumbnailV.' -rmeta -rexifthumb "'.$FilesSource[$i].'"'); 36 $BlockThumbnail['convert_pan'] = true; 37 } 38 38 } 39 39 -
extensions/PHP_Optimisateur/plugins/convert_pan/setup.php
r10337 r12819 3 3 4 4 switch ($PLUGIN_ACTION) { 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 5 // Affichage simple de la configuration 6 case 'read_config': 7 $PAGE['content'] .= ' 8 <table> 9 <tr> 10 <td>'.l10n('convert_pan.DetectMode').' :</td> 11 <td>'.$plugin_config['DetectMode'].'</td> 12 </tr>'; 13 14 if ($plugin_config['DetectMode'] == 'name') { 15 $PAGE['content'] .= ' 16 <tr> 17 <td>'.l10n('convert_pan.NAMEpanorama').' :</td> 18 <td>'.$plugin_config['NAMEpanorama'].'</td> 19 </tr>'; 20 } else if ($plugin_config['DetectMode'] == 'ratio') { 21 $PAGE['content'] .= ' 22 <tr> 23 <td>'.l10n('convert_pan.RatioPan').' :</td> 24 <td>'.$plugin_config['RatioPan'].'</td> 25 </tr>'; 26 } 27 28 $PAGE['content'] .= ' 29 <tr> 30 <td>'.l10n('convert_pan.DIMpanorama').' :</td> 31 <td>'.$plugin_config['DIMpanorama'].' px</td> 32 </tr> 33 <tr> 34 <td>'.l10n('convert_pan.RatioPanThumb').' :</td> 35 <td>'.$plugin_config['RatioPanThumb'].'</td> 36 </tr> 37 </table>'; 38 break; 39 40 // Actions avant enregistrement 41 case 'save_config': 42 $_POST['Plugins']['convert_pan']['NAMEpanorama'] = delete_special_car($_POST['Plugins']['convert_pan']['NAMEpanorama']); 43 44 if (!is_decimal($_POST['Plugins']['convert_pan']['DIMpanorama'])) { 45 $_POST['Plugins']['convert_pan']['DIMpanorama'] = 500; 46 $ERRORS['conf'][] = array(l10n('convert_pan.DIMpanorama'), 'must_be_integer'); 47 } 48 if (!is_decimal($_POST['Plugins']['convert_pan']['RatioPanThumb'])) { 49 $_POST['Plugins']['convert_pan']['RatioPanThumb'] = 1.7; 50 $ERRORS['conf'][] = array(l10n('convert_pan.RatioPanThumb'), 'must_be_decimal'); 51 } 52 if (!is_decimal($_POST['Plugins']['convert_pan']['RatioPan'])) { 53 $_POST['Plugins']['convert_pan']['RatioPan'] = 2.85; 54 $ERRORS['conf'][] = array(l10n('convert_pan.RatioPan'), 'must_be_decimal'); 55 } 56 57 break; 58 59 // Formulaire d'édition 60 case 'edit_config': 61 $PAGE['content'] .= ' 62 <script type="text/javascript"> 63 function ToggleConfig(sel, section){ 64 var obj = $("#convert_pan-tr-"+section); 65 if(sel.checked){ 66 obj.show(); 67 }else{ 68 obj.hide(); 69 } 70 } 71 </script> 72 73 <table> 74 <tr> 75 <td>'.l10n('convert_pan.DetectMode').' :</td> 76 <td> 77 <input type="radio" id="convert_pan-radio-name" name="Plugins[convert_pan][DetectMode]" value="name" onchange="ToggleConfig(this,\'name\');" '.(($plugin_config['DetectMode']=='name')?'checked="checked"':'').'/> 78 <label for="convert_pan-radio-name">'.l10n('convert_pan.DetectMode.name').'</label> 79 <input type="radio" id="convert_pan.radio.ratio" name="Plugins[convert_pan][DetectMode]" value="ratio" onchange="ToggleConfig(this,\'ratio\');" '.(($plugin_config['DetectMode']=='ratio')?'checked="checked"':'').'/> 80 <label for="convert_pan-radio-ratio">'.l10n('convert_pan.DetectMode.ratio').'</label> 81 </td> 82 </tr> 83 <tr id="convert_pan-tr-name"> 84 <td>'.l10n('convert_pan.NAMEpanorama').' :</td> 85 <td><input type="text" name="Plugins[convert_pan][NAMEpanorama]" value="'.$plugin_config['NAMEpanorama'].'" size="6"/></td> 86 </tr> 87 <tr id="convert_pan-tr-ratio"> 88 <td>'.l10n('convert_pan.RatioPan').' :</td> 89 <td><input type="text" name="Plugins[convert_pan][RatioPan]" value="'.$plugin_config['RatioPan'].'" size="3"/>px</td> 90 </tr> 91 92 <tr> 93 <td>'.l10n('convert_pan.DIMpanorama').' :</td> 94 <td> 95 <input type="text" name="Plugins[convert_pan][DIMpanorama]" value="'.$plugin_config['DIMpanorama'].'" size="3"/>px 96 <i>'.l10n('convert_pan.unactive').'</i> 97 </td> 98 </tr> 99 <tr> 100 <td>'.l10n('convert_pan.RatioPanThumb').' :</td> 101 <td> 102 <input type="text" name="Plugins[convert_pan][RatioPanThumb]" value="'.$plugin_config['RatioPanThumb'].'" size="3"/> 103 <i>'.l10n('convert_pan.unactive').'</i> 104 </td> 105 </tr> 106 </table> 107 108 <script type="text/javascript"> 109 ToggleConfig(document.forms[0].elements["Plugins[convert_pan][DetectMode]"][0], "name"); 110 ToggleConfig(document.forms[0].elements["Plugins[convert_pan][DetectMode]"][1], "ratio"); 111 </script>'; 112 break; 113 113 } 114 114 ?> -
extensions/PHP_Optimisateur/plugins/create_custom_thumbs/main.php
r10337 r12819 1 1 <?php 2 2 /***************************************\ 3 | PHP OPTIMISATEUR|4 | Plugin CreateCustomThumbs 1.1|3 | PHP OPTIMISATEUR | 4 | Plugin CreateCustomThumbs 1.1 | 5 5 \***************************************/ 6 6 … … 8 8 ## Dépend de la valeur de $CONF['DIMthumbnail'] 9 9 10 if(!isset($CCT_filesource)) $CCT_filesource = $FilesSource[$i]; // fichier de travail 11 $CCT_dimthumbnail = $CONF['Plugins']['create_custom_thumbs']['DIMthumbnailV']; // Hauteur de l'image 12 $CCT_frameparams = $CONF['Plugins']['create_custom_thumbs']['FRAMEparams']; // Paramètres du cadre 13 10 14 if (!isset($BlockAll)) { 11 15 12 16 // CreateCustomThumbs à la priorité sur ConvertPan 13 17 if (isset($BlockThumbnail['convert_pan']) OR !isset($BlockThumbnail)) { 18 19 // Miniature de taille personnalisée 20 if ($CCT_dimthumbnail != 0) { 21 $max = max($CONF['DIMthumbnail'], $CCT_dimthumbnail); 14 22 15 if(!isset($CCT_filesource)) $CCT_filesource = $FilesSource[$i]; // fichier de travail 16 $CCT_dimthumbnail = $CONF['Plugins']['create_custom_thumbs']['DIMthumbnailV']; // Hauteur de l'image 17 $CCT_frameparams = $CONF['Plugins']['create_custom_thumbs']['FRAMEparams']; // Paramètres du cadre 18 19 // Miniature de taille personnalisée 20 if ($CCT_dimthumbnail != 0) { 21 $max = max($CONF['DIMthumbnail'], $CCT_dimthumbnail); 23 // on prend la miniature au milieu de l'image 24 if ($FileInfos['Height'] >= $FileInfos['Width']) { 25 $resize_param = $max.' 0'; 26 $tmp_x = $max; 27 $tmp_y = $max * $FileInfos['Height'] / $FileInfos['Width']; 28 } else { 29 $resize_param = '0 '.$max; 30 $tmp_x = $max * $FileInfos['Width'] / $FileInfos['Height']; 31 $tmp_y = $max; 32 } 33 34 $offset_x = ceil(($tmp_x - $CONF['DIMthumbnail']) / 2); 35 $offset_y = ceil(($tmp_y - $CCT_dimthumbnail) / 2); 36 37 nconvert('-overwrite -q '.$CONF['Qthumbnail'].' -out jpeg -o "'.$file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg" -dpi 72 '.$CONF['convOptions'].' -resize '.$resize_param.' -crop '.$offset_x.' '.$offset_y.' '.$CONF['DIMthumbnail'].' '.$CCT_dimthumbnail.' -rmeta -rexifthumb "'.$CCT_filesource.'"'); 38 39 $BlockThumbnail['create_custom_thumbs'] = true; 40 $CCT_filesource = $file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg'; 41 } 22 42 23 // on prend la miniature au milieu de l'image 24 if ($FileInfos['Height'] >= $FileInfos['Width']) { 25 $resize_param = $max.' 0'; 26 $tmp_x = $max; 27 $tmp_y = $max * $FileInfos['Height'] / $FileInfos['Width']; 28 } else { 29 $resize_param = '0 '.$max; 30 $tmp_x = $max * $FileInfos['Width'] / $FileInfos['Height']; 31 $tmp_y = $max; 32 } 33 34 $offset_x = ceil(($tmp_x - $CONF['DIMthumbnail']) / 2); 35 $offset_y = ceil(($tmp_y - $CCT_dimthumbnail) / 2); 36 37 nconvert('-overwrite -q '.$CONF['Qthumbnail'].' -out jpeg -o "'.$file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg" -dpi 72 '.$CONF['convOptions'].' -resize '.$resize_param.' -crop '.$offset_x.' '.$offset_y.' '.$CONF['DIMthumbnail'].' '.$CCT_dimthumbnail.' -rmeta -rexifthumb "'.$CCT_filesource.'"'); 38 39 $BlockThumbnail['create_custom_thumbs'] = true; 40 $CCT_filesource = $file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg'; 41 } 43 // Cadre autour de la miniature 44 if ($CCT_frameparams['size1'] != 0 OR $CCT_frameparams['size2'] != 0) { 45 // Si la miniature n'a pas encore été générée il faut le faire 46 if ($CCT_filesource == $FilesSource[$i]) { 47 nconvert('-q '.$CONF['Qthumbnail'].' -out jpeg -o "'.$file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg" -dpi 72 '.$CONF['convOptions'].' -resize '.$CONF['DIMthumbnail'].' '.$CONF['DIMthumbnail'].' -rmeta -rexifthumb "'.$FilesSource[$i].'"'); 48 $CCT_filesource = $file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg'; 49 } 42 50 43 // Cadre autour de la miniature 44 if ($CCT_frameparams['size1'] != 0 OR $CCT_frameparams['size2'] != 0) { 45 // Si la miniature n'a pas encore été générée il faut le faire 46 if ($CCT_filesource == $FilesSource[$i]) { 47 nconvert('-q '.$CONF['Qthumbnail'].' -out jpeg -o "'.$file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg" -dpi 72 '.$CONF['convOptions'].' -resize '.$CONF['DIMthumbnail'].' '.$CONF['DIMthumbnail'].' -rmeta -rexifthumb "'.$FilesSource[$i].'"'); 48 $CCT_filesource = $file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg'; 49 } 51 $img = imagecreatefromjpeg($CCT_filesource); 52 $x = imagesx($img)-1; 53 $y = imagesy($img)-1; 54 55 $colors[0] = hex2RGB($CCT_frameparams['color1']); 56 $colors[1] = hex2RGB($CCT_frameparams['color2']); 57 $colors[0] = imagecolorallocate($img, $colors[0]['r'], $colors[0]['g'], $colors[0]['b']); 58 $colors[1] = imagecolorallocate($img, $colors[1]['r'], $colors[1]['g'], $colors[1]['b']); 50 59 51 $img = imagecreatefromjpeg($CCT_filesource); 52 $x = imagesx($img)-1; 53 $y = imagesy($img)-1; 54 55 $colors[0] = hex2RGB($CCT_frameparams['color1']); 56 $colors[1] = hex2RGB($CCT_frameparams['color2']); 57 $colors[0] = imagecolorallocate($img, $colors[0]['r'], $colors[0]['g'], $colors[0]['b']); 58 $colors[1] = imagecolorallocate($img, $colors[1]['r'], $colors[1]['g'], $colors[1]['b']); 59 60 for ($m=0; $m<$CCT_frameparams['size1']; $m++) { 61 imagerectangle($img, $m, $m, $x-$m, $y-$m, $colors[0]); 62 } 63 for ($m=$CCT_frameparams['size1']; $m<$CCT_frameparams['size1']+$CCT_frameparams['size2']; $m++) { 64 imagerectangle($img, $m, $m, $x-$m, $y-$m, $colors[1]); 65 } 66 67 imagejpeg($img, $file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg', $CONF['Qthumbnail']); 68 imagedestroy($img); 69 70 $BlockThumbnail['create_custom_thumbs'] = true; 71 $CCT_filesource = $file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg'; 72 } 60 for ($m=0; $m<$CCT_frameparams['size1']; $m++) { 61 imagerectangle($img, $m, $m, $x-$m, $y-$m, $colors[0]); 62 } 63 for ($m=$CCT_frameparams['size1']; $m<$CCT_frameparams['size1']+$CCT_frameparams['size2']; $m++) { 64 imagerectangle($img, $m, $m, $x-$m, $y-$m, $colors[1]); 65 } 66 67 imagejpeg($img, $file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg', $CONF['Qthumbnail']); 68 imagedestroy($img); 69 70 $BlockThumbnail['create_custom_thumbs'] = true; 71 $CCT_filesource = $file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg'; 72 } 73 73 } 74 74 -
extensions/PHP_Optimisateur/plugins/create_custom_thumbs/setup.php
r10337 r12819 3 3 4 4 switch ($PLUGIN_ACTION) { 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 5 // Affichage simple de la configuration 6 case 'read_config': 7 $plugin_config['FRAMEparams']['color1'] = nice_hex_color($plugin_config['FRAMEparams']['color1']); 8 $plugin_config['FRAMEparams']['color2'] = nice_hex_color($plugin_config['FRAMEparams']['color2']); 9 10 $PAGE['content'] .= ' 11 <table> 12 <tr> 13 <td>'.l10n('create_custom_thumbs.DIMthumbnailV').' :</td> 14 <td>'.bool_to_string($plugin_config['DIMthumbnailV']).' px</td> 15 </tr> 16 <tr> 17 <td>'.l10n('create_custom_thumbs.FRAMEparams').' 1 :</td> 18 <td> 19 #'.$plugin_config['FRAMEparams']['color1'].' 20 <span class="color-display" style="background-color:#'.nice_hex_color($plugin_config['FRAMEparams']['color1']).';"> </span> 21 '.$plugin_config['FRAMEparams']['size1'].'px 22 </td> 23 </tr> 24 <tr> 25 <td>'.l10n('create_custom_thumbs.FRAMEparams').' 2 :</td> 26 <td> 27 #'.$plugin_config['FRAMEparams']['color2'].' 28 <span class="color-display" style="background-color:#'.nice_hex_color($plugin_config['FRAMEparams']['color2']).';"> </span> 29 '.$plugin_config['FRAMEparams']['size2'].'px 30 </td> 31 </tr> 32 </table>'; 33 break; 34 35 36 // Actions avant enregistrement 37 case 'save_config': 38 $_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['color1'] = str_replace('#',null, $_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['color1']); 39 $_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['color2'] = str_replace('#',null, $_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['color2']); 40 41 if (!is_decimal($_POST['Plugins']['create_custom_thumbs']['DIMthumbnailV'])) { 42 $_POST['Plugins']['create_custom_thumbs']['DIMthumbnailV'] = 0; 43 $ERRORS['conf'][] = array(l10n('create_custom_thumbs.DIMthumbnailV'), 'must_be_integer'); 44 } 45 if (!is_decimal($_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['size1'])) { 46 $_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['size1'] = 0; 47 $ERRORS['conf'][] = array(l10n('create_custom_thumbs.FRAMEparams').' 1', 'must_be_integer'); 48 } 49 if (!is_decimal($_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['size2'])) { 50 $_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['size2'] = 0; 51 $ERRORS['conf'][] = array(l10n('create_custom_thumbs.FRAMEparams').' 2', 'must_be_integer'); 52 } 53 54 break; 55 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 56 57 // Formulaire d'édition 58 case 'edit_config': 59 $plugin_config['FRAMEparams']['color1'] = nice_hex_color($plugin_config['FRAMEparams']['color1']); 60 $plugin_config['FRAMEparams']['color2'] = nice_hex_color($plugin_config['FRAMEparams']['color2']); 61 62 $PAGE['content'] .=' 63 <table> 64 <tr> 65 <td>'.l10n('create_custom_thumbs.DIMthumbnailV').' :</td> 66 <td> 67 <input type="text" name="Plugins[create_custom_thumbs][DIMthumbnailV]" value="'.$plugin_config['DIMthumbnailV'].'" size="3"/>px 68 <i>'.l10n('create_custom_thumbs.unactive').'</i> 69 </td> 70 </tr> 71 <tr> 72 <td>'.l10n('create_custom_thumbs.FRAMEparams').' 1 :</td> 73 <td> 74 <input type="text" id="CCT-color1" name="Plugins[create_custom_thumbs][FRAMEparams][color1]" value="'.$plugin_config['FRAMEparams']['color1'].'" size="6"/> 75 <input type="text" name="Plugins[create_custom_thumbs][FRAMEparams][size1]" value="'.$plugin_config['FRAMEparams']['size1'].'" size="1"/>px 76 <i>'.l10n('create_custom_thumbs.unactive').'</i> 77 </td> 78 </tr> 79 <tr> 80 <td>'.l10n('create_custom_thumbs.FRAMEparams').' 2 :</td> 81 <td> 82 <input type="text" id="CCT-color2" name="Plugins[create_custom_thumbs][FRAMEparams][color2]" value="'.$plugin_config['FRAMEparams']['color2'].'" size="6"/> 83 <input type="text" name="Plugins[create_custom_thumbs][FRAMEparams][size2]" value="'.$plugin_config['FRAMEparams']['size2'].'" size="1"/>px 84 <i>'.l10n('create_custom_thumbs.unactive').'</i> 85 </td> 86 </tr> 87 <script type="text/javascript"> 88 $("#CCT-color1").ColorPicker({ 89 onSubmit: function(hsb, hex, rgb, el) { $(el).val(hex); $(el).ColorPickerHide(); }, 90 onChange: function(hsb, hex, rgb, el) { $("#CCT-color1").val(hex); }, 91 onBeforeShow: function () { $(this).ColorPickerSetColor(this.value); } 92 }) .bind("keyup", function(){ $(this).ColorPickerSetColor(this.value); }); 93 $("#CCT-color2").ColorPicker({ 94 onSubmit: function(hsb, hex, rgb, el) { $(el).val(hex); (el).ColorPickerHide(); }, 95 onChange: function(hsb, hex, rgb, el) { $("#CCT-color2").val(hex); }, 96 onBeforeShow: function () { $(this).ColorPickerSetColor(this.value); } 97 }) .bind("keyup", function(){ $(this).ColorPickerSetColor(this.value); }); 98 </script> 99 </table>'; 100 break; 101 101 } 102 102 ?> -
extensions/PHP_Optimisateur/plugins/create_folders_alpha/main.php
r10337 r12819 1 1 <?php 2 2 /***************************************\ 3 | PHP OPTIMISATEUR|4 | Plugin CreateFoldersAlpha 1.2|3 | PHP OPTIMISATEUR | 4 | Plugin CreateFoldersAlpha 1.2 | 5 5 \***************************************/ 6 6 … … 11 11 12 12 while ($file = readdir($handle)) { 13 14 15 16 17 13 if ($file != '.' && $file != '..' && !is_dir($CONF['DIRsource'].'/'.$file)) { 14 // Récupère le parties du nom servant à créer les dossiers 15 if (preg_match('#^(.{1})([^_.]*)_(.*)#', $file, $matches)) { 16 $Letter = strtoupper($matches[1]); 17 $FolderName = $matches[1].$matches[2]; 18 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 19 // Crée les dossier 20 if (!file_exists($CONF['DIRsource'].$Letter.'/'.$FolderName)) { 21 mkdir_log($CONF['DIRsource'].$Letter.'/'.$FolderName); 22 } 23 24 // Déplace le fichier 25 rename_log($CONF['DIRsource'].$file, $CONF['DIRsource'].$Letter.'/'.$FolderName.'/'.$file, true); 26 27 } else { 28 $LOG[] = 'The file '.$CONF['DIRsource'].$file.' doesn\'t match the patern #^(.{1})([^_.]*)_(.*)#, not moved'; 29 } 30 31 $done = true; 32 } 33 33 } 34 34 -
extensions/PHP_Optimisateur/plugins/front2back_support/main.php
r10337 r12819 1 1 <?php 2 2 /***************************************\ 3 | PHP OPTIMISATEUR|4 | Plugin Front2Back Support 1.2|3 | PHP OPTIMISATEUR | 4 | Plugin Front2Back Support 1.2 | 5 5 \***************************************/ 6 6 … … 17 17 // applique le tag au fichier normal si il existe un verso 18 18 if (file_exists($file['folder_src'].$file['name'].$F2B_nameverso.'.'.$file['ext']) AND !empty($F2B_tagverso)) { 19 20 19 nconvert('-iptc_add 25 "'.$F2B_tagverso.'" "'.$FilesSource[$i].'"'); 20 $LOG[] = 'Tag "'.$F2B_tagverso.'" added to '.$FilesSource[$i]; 21 21 } 22 22 23 23 if (strpos($file['name'], $F2B_nameverso) !== false) { 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 24 $file['name_clean'] = str_replace($F2B_nameverso,null,$file['name']); 25 26 if (!empty($F2B_tagverso)) { 27 nconvert('-iptc_add 25 "'.$F2B_tagverso.'" "'.$FilesSource[$i].'"'); 28 $LOG[] = 'Tag "'.$F2B_tagverso.'" added to '.$FilesSource[$i]; 29 } 30 31 // Image normale 32 if (!file_exists($file['folder_out'].'thumbnail/verso')) { 33 mkdir_log($file['folder_out'].'thumbnail/verso'); 34 } 35 nconvert('-q '.$CONF['Qnormal'].' -out jpeg -o "'.$file['folder_out'].'thumbnail/verso/'.$file['name_clean'].'.jpg" -dpi 72 '.$CONF['convOptions'].' -resize '.$CONF['DIMnormal'].' '.$CONF['DIMnormal'].' '.$CONF['copyNormal'].' "'.$FilesSource[$i].'"'); 36 37 // Image hd 38 if ($CONF['DIRhighORNOT']) { 39 if (!file_exists($file['folder_out'].'pwg_high/verso')) { 40 mkdir($file['folder_out'].'pwg_high/verso'); 41 $LOG[] = 'Dir '.$file['folder_out'].'pwg_high/verso/ created'; 42 } 43 if ($CONF['DIMhdORNOT']) { 44 nconvert('-q '.$CONF['Qhd'].' -out jpeg -o "'.$file['folder_out'].'pwg_high/verso/'.$file['name_clean'].'.jpg" -dpi '.$CONF['DPI'].' '.$CONF['convOptions'].' -resize '.$CONF['DIMhd'].' '.$CONF['DIMhd'].' '.$CONF['copyHD'].' "'.$FilesSource[$i].'"'); 45 } else if (strtolower($file['ext']) != 'jpg') { 46 nconvert('-q '.$CONF['Qhd'].' -out jpeg -o "'.$file['folder_out'].'pwg_high/'.$file['name_clean'].'.jpg" "'.$FilesSource[$i].'"'); 47 } else { 48 copy_log($FilesSource[$i], $file['folder_out'].'pwg_high/verso/'.$file['name_clean'].'.jpg'); 49 } 50 } 51 52 // Déplacement de l'image originale 53 if ($F2B_moveverso) { 54 if (!file_exists($file['folder_src'].'verso')) { 55 mkdir_log($file['folder_src'].'verso', 0777, true); 56 } 57 rename_log($file['folder_src'].$file['name'].'.'.$file['ext'], $file['folder_src'].'verso/'.$file['name_clean'].'.'.$file['ext'], true); 58 } 59 60 // Suppression de la miniature si déjà crée (par un autre plugin) 61 if (file_exists($file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg')) { 62 unlink($file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg'); 63 } 64 // Suppression de l'image HD si déjà crée (par un autre plugin) 65 if (file_exists($file['folder_out'].'pwg_high/'.$file['name'].'.jpg')) { 66 unlink($file['folder_out'].'pwg_high/'.$file['name'].'.jpg'); 67 } 68 69 $BlockNormal['front2back_support'] = true; 70 $BlockThumbnail['front2back_support'] = true; 71 $BlockHigh['front2back_support'] = true; 72 72 } 73 73 -
extensions/PHP_Optimisateur/plugins/front2back_support/setup.php
r10337 r12819 3 3 4 4 switch ($PLUGIN_ACTION) { 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 5 // Affichage simple de la configuration 6 case 'read_config': 7 $PAGE['content'] .= ' 8 <table> 9 <tr> 10 <td>'.l10n('front2back_support.NAMEverso').' :</td> 11 <td>'.$plugin_config['NAMEverso'].'</td> 12 </tr> 13 <tr> 14 <td>'.l10n('front2back_support.MOVEverso').' :</td> 15 <td>'.bool_to_string($plugin_config['MOVEverso']).'</td> 16 </tr> 17 <tr> 18 <td>'.l10n('front2back_support.TAGverso').' :</td> 19 <td>'.$plugin_config['TAGverso'].'</td> 20 </tr> 21 </table>'; 22 break; 23 24 // Actions avant enregistrement 25 case 'save_config': 26 $_POST['Plugins']['front2back_support']['NAMEverso'] = delete_special_car($_POST['Plugins']['front2back_support']['NAMEverso']); 27 break; 28 29 // Formulaire d'édition 30 case 'edit_config': 31 $PAGE['content'] .= ' 32 <table> 33 <tr> 34 <td>'.l10n('front2back_support.NAMEverso').' :</td> 35 <td><input type="text" name="Plugins[front2back_support][NAMEverso]" value="'.$plugin_config['NAMEverso'].'" size="6"/></td> 36 </tr> 37 <tr> 38 <td>'.l10n('front2back_support.MOVEverso').' :</td> 39 <td> 40 <input type="radio" id="front2back_support-move1" name="Plugins[front2back_support][MOVEverso]" value="true" '.(($plugin_config['MOVEverso'])?'checked="checked"':'').'/> 41 <label for="front2back_support-move1">'.l10n('yes').'</label> 42 <input type="radio" id="front2back_support-move2" name="Plugins[front2back_support][MOVEverso]" value="false" '.((!$plugin_config['MOVEverso'])?'checked="checked"':'').'/> 43 <label for="front2back_support-move2">'.l10n('no').'</label> 44 </td> 45 </tr> 46 <tr> 47 <td>'.l10n('front2back_support.TAGverso').' :</td> 48 <td> 49 <input type="text" name="Plugins[front2back_support][TAGverso]" value="'.$plugin_config['TAGverso'].'" size="10"/> 50 <i>'.l10n('front2back_support.unactive').'</i> 51 </td> 52 </tr> 53 </table>'; 54 break; 55 55 } 56 56 ?> -
extensions/PHP_Optimisateur/plugins/watermark/main.php
r9276 r12819 1 1 <?php 2 2 /***************************************\ 3 | PHP OPTIMISATEUR|4 | Plugin Watermark 1.1|3 | PHP OPTIMISATEUR | 4 | Plugin Watermark 1.1 | 5 5 \***************************************/ 6 6 … … 8 8 ## Dépend des valeurs de $CONF['copyONhd'], $CONF['copyONnormal'] et $CONF['copyPOS'] 9 9 10 $WM_waterfile = $CONF['Plugins']['watermark']['waterFILE']; // Fichier à incruster10 $WM_waterfile = $CONF['Plugins']['watermark']['waterFILE']; // Fichier à incruster 11 11 $WM_wateralpha = $CONF['Plugins']['watermark']['waterALPHA']; // Opacité 12 12 13 13 if (file_exists($WM_waterfile)) { 14 15 16 17 18 19 20 14 if ($CONF['copyONhd']) { 15 $CONF['copyHD'] = '-wmfile "'.$WM_waterfile.'" -wmflag '.$CONF['copyPOS'].' -wmpos 0 0 -wmopacity '.$WM_wateralpha.''; 16 } 17 18 if ($CONF['copyONnormal']) { 19 $CONF['copyNormal'] = '-wmfile "'.$WM_waterfile.'" -wmflag '.$CONF['copyPOS'].' -wmpos 0 0 -wmopacity '.$WM_wateralpha.''; 20 } 21 21 } 22 22 ?> -
extensions/PHP_Optimisateur/plugins/watermark/setup.php
r10337 r12819 3 3 4 4 switch ($PLUGIN_ACTION) { 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 5 // Affichage simple de la configuration 6 case 'read_config': 7 $PAGE['content'] .= ' 8 <table> 9 <tr> 10 <td>'.l10n('watermark.waterFILE').' :</td> 11 <td>'.$plugin_config['waterFILE'].'</td> 12 </tr> 13 <tr> 14 <td>'.l10n('watermark.waterALPHA').' :</td> 15 <td>'.$plugin_config['waterALPHA'].' %</td> 16 </tr> 17 </table>'; 18 break; 19 20 // Actions avant enregistrement 21 case 'save_config': 22 if (!is_decimal($_POST['Plugins']['watermark']['waterALPHA'])) { 23 $_POST['Plugins']['watermark']['waterALPHA'] = 80; 24 $ERRORS['conf'][] = array(l10n('watermark.waterALPHA'), 'must_be_integer'); 25 } 26 27 break; 28 29 // Formulaire d'édition 30 case 'edit_config': 31 $PAGE['content'] .= ' 32 <table> 33 <tr> 34 <td>'.l10n('watermark.waterFILE').' :</td> 35 <td><input type="text" name="Plugins[watermark][waterFILE]" value="'.$plugin_config['waterFILE'].'" size="10"/></td> 36 </tr> 37 <tr> 38 <td>'.l10n('watermark.waterALPHA').' :</td> 39 <td><input type="text" name="Plugins[watermark][waterALPHA]" value="'.$plugin_config['waterALPHA'].'" size="3"/>%</td> 40 </tr> 41 </table>'; 42 break; 43 43 } 44 44 ?> -
extensions/PHP_Optimisateur/template/css/colorpicker.css
r9201 r12819 1 1 .colorpicker { 2 3 4 5 6 7 8 2 width: 286px; 3 height: 176px; 4 overflow: hidden; 5 position: absolute; 6 background: url(../images/colorpicker_background.png); 7 font-family: Arial, Helvetica, sans-serif; 8 display: none; 9 9 } 10 10 .colorpicker_color { 11 12 13 14 15 16 17 18 11 width: 150px; 12 height: 150px; 13 left: 14px; 14 top: 13px; 15 position: absolute; 16 background: #f00; 17 overflow: hidden; 18 cursor: crosshair; 19 19 } 20 20 .colorpicker_color div { 21 22 23 24 25 26 21 position: absolute; 22 top: 0; 23 left: 0; 24 width: 150px; 25 height: 150px; 26 background: url(../images/colorpicker_overlay.png); 27 27 } 28 28 .colorpicker_color div div { 29 30 31 32 33 34 35 36 29 position: absolute; 30 top: 0; 31 left: 0; 32 width: 11px; 33 height: 11px; 34 overflow: hidden; 35 background: url(../images/colorpicker_select.gif); 36 margin: -5px 0 0 -5px; 37 37 } 38 38 .colorpicker_hue { 39 40 41 42 43 44 39 position: absolute; 40 top: 13px; 41 left: 171px; 42 width: 35px; 43 height: 150px; 44 cursor: n-resize; 45 45 } 46 46 .colorpicker_hue div { 47 48 49 50 51 52 53 47 position: absolute; 48 width: 35px; 49 height: 9px; 50 overflow: hidden; 51 background: url(../images/colorpicker_indic.gif) left top; 52 margin: -4px 0 0 0; 53 left: 0px; 54 54 } 55 55 .colorpicker_new_color { 56 57 58 59 60 61 56 position: absolute; 57 width: 60px; 58 height: 30px; 59 left: 213px; 60 top: 13px; 61 background: #f00; 62 62 } 63 63 .colorpicker_current_color { 64 64 display:none; 65 65 } 66 66 .colorpicker input { 67 68 69 70 71 72 73 74 75 76 77 78 67 background-color: transparent; 68 border: 1px solid transparent; 69 position: absolute; 70 font-size: 10px; 71 font-family: Arial, Helvetica, sans-serif; 72 color: #898989; 73 top: 4px; 74 right: 11px; 75 text-align: right; 76 margin: 0; 77 padding: 0; 78 height: 11px; 79 79 } 80 80 /* annulation des styles généraux */ 81 81 .colorpicker input:hover, .colorpicker input:focus { 82 83 84 85 82 border:none; 83 background:none; 84 -moz-box-shadow:none; 85 -webkit-box-shadow:none; 86 86 } 87 87 .colorpicker_hex { 88 88 display:none; 89 89 } 90 90 .colorpicker_field { 91 92 93 94 91 height: 22px; 92 width: 62px; 93 background-position: top; 94 position: absolute; 95 95 } 96 96 .colorpicker_field span { 97 98 99 100 101 102 103 97 position: absolute; 98 width: 12px; 99 height: 22px; 100 overflow: hidden; 101 top: 0; 102 right: 0; 103 cursor: n-resize; 104 104 } 105 105 .colorpicker_rgb_r { 106 107 108 106 background-image: url(../images/colorpicker_rgb_r.png); 107 top: 52px; 108 left: 212px; 109 109 } 110 110 .colorpicker_rgb_g { 111 112 113 111 background-image: url(../images/colorpicker_rgb_g.png); 112 top: 82px; 113 left: 212px; 114 114 } 115 115 .colorpicker_rgb_b { 116 117 118 116 background-image: url(../images/colorpicker_rgb_b.png); 117 top: 112px; 118 left: 212px; 119 119 } 120 120 .colorpicker_hsb_h, .colorpicker_hsb_s, .colorpicker_hsb_b { 121 121 display:none; 122 122 } 123 123 .colorpicker_submit { 124 125 126 127 128 129 130 124 position: absolute; 125 width: 22px; 126 height: 22px; 127 background: url(../images/colorpicker_submit.png) top; 128 right: 6px; 129 bottom: 6px; 130 overflow: hidden; 131 131 } 132 132 .colorpicker_focus { 133 133 background-position: center; 134 134 } 135 135 .colorpicker_hex.colorpicker_focus { 136 136 background-position: bottom; 137 137 } 138 138 .colorpicker_submit.colorpicker_focus { 139 139 background-position: bottom; 140 140 } 141 141 .colorpicker_slider { 142 142 background-position: bottom; 143 143 } -
extensions/PHP_Optimisateur/template/css/jqtransform.css
r9201 r12819 1 1 form.jqtransformdone label{ 2 3 2 display:block; 3 float:left; 4 4 } 5 5 .jqTransformRadioWrapper { 6 7 8 6 display:block; 7 float:left; 8 margin:2px 4px -2px 4px; 9 9 } 10 10 .jqTransformRadio { 11 12 13 14 15 11 background:url(../images/radio.png) no-repeat center top; 12 vertical-align:middle; 13 height:12px; 14 width:12px; 15 display:block; 16 16 } 17 17 .jqTransformCheckboxWrapper{ 18 19 20 18 display:block; 19 float:left; 20 margin:2px 4px -2px 4px; 21 21 } 22 22 .jqTransformCheckbox { 23 24 25 26 27 23 background:url(../images/checkbox.png) no-repeat center top; 24 vertical-align:middle; 25 height:12px; 26 width:12px; 27 display:block; 28 28 } 29 29 .jqTransformChecked { background-position:center bottom; } -
extensions/PHP_Optimisateur/template/css/screen.css
r10337 r12819 1 1 * { 2 3 4 2 margin:0px; 3 padding:0px; 4 border:0px; 5 5 } 6 6 7 7 body { 8 9 10 11 12 13 8 font-size:13px; 9 font-family:"Calibri",sans-serif; 10 background:#0a0a0a; 11 color:#777; 12 width:990px; 13 margin:0 auto; 14 14 } 15 15 16 16 #overlay { 17 18 19 20 21 22 23 24 25 17 position:fixed; 18 z-index:9999; 19 top:0; 20 left:0; 21 width:100%; 22 height:100%; 23 background:#000; 24 opacity:0.3; 25 filter:alpha(opacity=30); 26 26 } 27 27 28 28 div.generic { 29 width:450px; 30 margin:10px; 31 padding:10px; 32 border:1px solid #333; 33 float:left; 34 -moz-border-radius:3px; 35 -webkit-border-radius:3px; 36 } 37 div.title { 38 float:none; 39 width:942px; 40 text-align:center; 41 font-weight:bold; 42 font-size:1.5em; 43 color:#eee; 44 text-shadow:0 0 4px #07f; 45 border-color:#07F; 46 -moz-box-shadow:0 0 6px #07F, inset 0 0 5px #07F; 47 -webkit-box-shadow:0 0 6px #07F, inset 0 0 5px #07F; 48 background-color:#222; 49 background-image:-moz-linear-gradient(center bottom, #111, #333); 50 background-image:-webkit-gradient(linear,center bottom,center top,color-stop(0, #111),color-stop(1, #333)); 51 } 52 div.footer { 53 clear:both; 54 width:942px; 55 text-align:center; 56 border:none; 57 } 58 div.files li { 59 margin-top:0; 60 } 61 62 div.finish { 63 background:#030; 64 color:#eee; 65 text-shadow:0 0 4px #0b0; 66 border-color:#0b0; 67 -moz-box-shadow:0 0 6px #0b0, inset 0 0 5px #0b0; 68 -webkit-box-shadow:0 0 6px #0b0, inset 0 0 5px #0b0; 69 font-weight:bold; 70 font-size:1.2em; 71 } 72 73 div.error { 74 background:#300; 75 color:#eee; 76 text-shadow:0 0 4px #B00; 77 border-color:#B00; 78 -moz-box-shadow:0 0 6px #B00, inset 0 0 5px #B00; 79 -webkit-box-shadow:0 0 6px #B00, inset 0 0 5px #B00; 80 font-weight:bold; 81 font-size:1.2em; 82 } 83 div.notice { 84 background:#440; 85 color:#eee; 86 text-shadow:0 0 4px #ff0; 87 border-color:#ff0; 88 -moz-box-shadow:0 0 6px #ff0, inset 0 0 5px #ff0; 89 -webkit-box-shadow:0 0 6px #ff0, inset 0 0 5px #ff0; 90 font-weight:bold; 91 font-size:1.2em; 92 } 93 div.notice.conf { 94 font-weight:normal; 95 font-size:1em; 96 } 97 div.link { 98 float:right; 99 font-size:1.1em; 100 border:none; 101 text-align:center; 102 } 103 29 width:450px; 30 margin:10px; 31 padding:10px; 32 border:1px solid #333; 33 float:left; 34 -moz-border-radius:3px; 35 -webkit-border-radius:3px; 36 overflow-x:hidden; 37 } 38 div.title { 39 float:none; 40 width:942px; 41 text-align:center; 42 font-weight:bold; 43 font-size:1.5em; 44 color:#eee; 45 text-shadow:0 0 4px #07f; 46 border-color:#07F; 47 -moz-box-shadow:0 0 6px #07F, inset 0 0 5px #07F; 48 -webkit-box-shadow:0 0 6px #07F, inset 0 0 5px #07F; 49 background-color:#222; 50 background-image:-moz-linear-gradient(center bottom, #111, #333); 51 background-image:-webkit-gradient(linear,center bottom,center top,color-stop(0, #111),color-stop(1, #333)); 52 } 53 div.footer { 54 clear:both; 55 width:942px; 56 text-align:center; 57 border:none; 58 } 59 div.files li { 60 margin-top:0; 61 } 62 63 div.finish { 64 background:#030; 65 color:#eee; 66 text-shadow:0 0 4px #0b0; 67 border-color:#0b0; 68 -moz-box-shadow:0 0 6px #0b0, inset 0 0 5px #0b0; 69 -webkit-box-shadow:0 0 6px #0b0, inset 0 0 5px #0b0; 70 font-weight:bold; 71 font-size:1.2em; 72 } 73 74 div.error { 75 background:#300; 76 color:#eee; 77 text-shadow:0 0 4px #B00; 78 border-color:#B00; 79 -moz-box-shadow:0 0 6px #B00, inset 0 0 5px #B00; 80 -webkit-box-shadow:0 0 6px #B00, inset 0 0 5px #B00; 81 font-weight:bold; 82 font-size:1.2em; 83 } 84 div.notice { 85 background:#440; 86 color:#eee; 87 text-shadow:0 0 4px #ff0; 88 border-color:#ff0; 89 -moz-box-shadow:0 0 6px #ff0, inset 0 0 5px #ff0; 90 -webkit-box-shadow:0 0 6px #ff0, inset 0 0 5px #ff0; 91 font-weight:bold; 92 font-size:1.2em; 93 } 94 div.notice.conf { 95 font-weight:normal; 96 font-size:1em; 97 } 98 div.link { 99 float:right; 100 font-size:1.1em; 101 border:none; 102 text-align:center; 103 } 104 104 105 a { 105 106 107 108 109 110 } 111 112 113 114 115 116 117 118 119 } 106 text-decoration:none; 107 font-style:italic; 108 font-family:"Consolas"; 109 color:#e80; 110 text-shadow:0 0 4px #f70; 111 } 112 a:hover { 113 color:#07F; 114 text-shadow:0 0 4px #07f; 115 } 116 .link a { 117 margin:0 10px; 118 float:right; 119 margin-bottom:1px; 120 } 120 121 121 122 h2 { 122 123 124 123 margin-top:-5px; 124 color:#eee; 125 text-shadow:0 0 5px #ddd; 125 126 } 126 127 127 128 ul { 128 margin:0 0 0 20px; 129 } 130 li { 131 margin-top:5px; 132 } 133 li ul li { 134 margin-top:0; 135 } 136 137 input[type="submit"], input[type="reset"], input[type="text"], a.input-submit { 138 color:#666; 139 border:1px solid #555; 140 -moz-border-radius:3px; 141 -webkit-border-radius:3px; 142 background:#111; 143 font-family:"Calibri",sans-serif; 144 } 145 input[type="submit"]:hover, input[type="reset"]:hover, input[type="text"]:hover, a.input-submit:hover { 146 border-color:#07f; 147 -moz-box-shadow:0 0 3px #07f; 148 -webkit-box-shadow:0 0 3px #07f; 149 } 150 input[type="submit"]:focus, input[type="reset"]:focus, input[type="text"]:focus { 151 color:#999; 152 background:#222; 153 border-color:#f70; 154 -moz-box-shadow:0 0 3px #F70; 155 -webkit-box-shadow:0 0 3px #F70; 156 } 157 input[type="submit"], input[type="reset"], a.input-submit { 158 margin:-5px 10px 0 10px; 159 padding:3px 8px 3px 6px; 160 color:#777; 161 font-size:1.1em; 162 font-style:italic; 163 -moz-border-radius:20px; 164 -webkit-border-radius:20px; 165 background-image:-moz-linear-gradient(center bottom, #111, #333); 166 background-image:-webkit-gradient(linear,center bottom,center top,color-stop(0, #111),color-stop(1, #333)); 167 } 168 input[type="submit"]:hover, input[type="reset"]:hover, a.input-submit:hover { 169 color:#07f; 170 text-shadow:0 0 3px #07f; 171 background-image:-moz-linear-gradient(center top, #111, #222); 172 background-image:-webkit-gradient(linear,center top,center bottom,color-stop(0, #111),color-stop(1, #222)); 173 } 174 129 margin:0 0 0 20px; 130 } 131 li { 132 margin-top:5px; 133 } 134 li ul li { 135 margin-top:0; 136 } 137 138 input[type="submit"], input[type="reset"], input[type="text"], a.input-submit, textarea { 139 color:#666; 140 border:1px solid #555; 141 -moz-border-radius:3px; 142 -webkit-border-radius:3px; 143 background:#111; 144 font-family:"Calibri",sans-serif; 145 font-size:12px; 146 line-height:1em; 147 } 148 input[type="submit"]:hover, input[type="reset"]:hover, input[type="text"]:hover, a.input-submit:hover, textarea:hover { 149 border-color:#07f; 150 -moz-box-shadow:0 0 3px #07f; 151 -webkit-box-shadow:0 0 3px #07f; 152 } 153 input[type="submit"]:focus, input[type="reset"]:focus, input[type="text"]:focus, textarea:focus { 154 color:#999; 155 background:#222; 156 border-color:#f70; 157 -moz-box-shadow:0 0 3px #F70; 158 -webkit-box-shadow:0 0 3px #F70; 159 } 160 input[type="submit"], input[type="reset"], a.input-submit { 161 margin:-5px 10px 0 10px; 162 padding:3px 8px 3px 6px; 163 color:#777; 164 font-size:1.1em; 165 font-style:italic; 166 -moz-border-radius:20px; 167 -webkit-border-radius:20px; 168 background-image:-moz-linear-gradient(center bottom, #111, #333); 169 background-image:-webkit-gradient(linear,center bottom,center top,color-stop(0, #111),color-stop(1, #333)); 170 } 171 input[type="submit"]:hover, input[type="reset"]:hover, a.input-submit:hover { 172 color:#07f; 173 text-shadow:0 0 3px #07f; 174 background-image:-moz-linear-gradient(center top, #111, #222); 175 background-image:-webkit-gradient(linear,center top,center bottom,color-stop(0, #111),color-stop(1, #222)); 176 } 177 175 178 a.input-submit { 176 177 178 179 180 179 float:none; 180 display:inline-block; 181 margin-top:1px; 182 padding:3px 10px 5px 10px; 183 text-shadow:none; 181 184 } 182 185 183 186 184 187 b.new { 185 186 188 color:#0b0; 189 font-style:italic; 187 190 } 188 191 b.miss { 189 190 192 color:#B00; 193 font-style:italic; 191 194 } 192 195 193 196 span.title { 194 195 196 197 198 197 font-weight:bold; 198 text-decoration:underline; 199 font-size:1.1em; 200 color:#eee; 201 text-shadow:0 0 3px #ddd; 199 202 } 200 203 201 204 table { 202 min-width:50%; 203 } 204 tr td:first-child { 205 text-align:right; 206 padding-right:5px; 207 font-weight:bold; 208 } 209 tr td.legend { 210 font-weight:normal; 211 text-align:left; 212 } 213 205 min-width:50%; 206 } 207 tr td:first-child { 208 text-align:right; 209 padding-right:5px; 210 font-weight:bold; 211 min-width:100px; 212 } 213 tr td.legend { 214 font-weight:normal; 215 text-align:left; 216 } 217 214 218 #loader { 215 216 219 float:right; 220 margin:-8px 0 -10px 0; 217 221 } 218 222 219 223 .plugin-title .plugin-active { 220 224 float:right; 221 225 } 222 226 223 227 .color-display { 224 225 226 227 228 229 230 231 232 233 228 width:30px; 229 height:15px; 230 margin:-10px 0; 231 display:inline-block; 232 vertical-align:middle; 233 border:1px solid #888; 234 -moz-border-radius:3px; 235 -webkit-border-radius:3px; 236 -moz-box-shadow: 0 0 2px #888, inset 0 0 2px #888; 237 -webkit-box-shadow: 0 0 2px #888, inset 0 0 2px #888; 234 238 } 235 239 236 240 #languageSwitchLink { 237 238 239 240 241 float:right; 242 width:100px; 243 padding:0 5px; 244 text-align:left; 241 245 } 242 246 243 247 #languageSwitchBox { 244 245 246 247 248 249 250 251 252 253 254 255 256 248 position:absolute; 249 top:5px; 250 right:50%; 251 margin-right:-470px; 252 width:100px; 253 z-index:99; 254 padding:5px; 255 background:#0a0a0a; 256 -moz-box-shadow:0 0 5px #000; 257 -webkit-box-shadow:0 0 5px #000; 258 text-align:left; 259 opacity:0.8; 260 filter:alpha(opacity=80); 257 261 } 258 262 259 263 #languageSwitchBox *, #languageSwitchLink * { 260 261 262 263 264 font-size:13px; 265 text-shadow:none; 266 font-weight:normal; 267 color:#eee; 264 268 } 265 269 266 270 #languageSwitchBox ul, #languageSwitchLink ul { 267 268 269 } 271 list-style:none; 272 margin:0 5px 0 5px; 273 }
Note: See TracChangeset
for help on using the changeset viewer.