Changeset 7991 for extensions/PHP_Optimisateur/files
- Timestamp:
- Dec 3, 2010, 11:50:00 PM (13 years ago)
- Location:
- extensions/PHP_Optimisateur/files
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/PHP_Optimisateur/files/functions.php
r7988 r7991 2 2 /***************************************\ 3 3 | PHP OPTIMISATEUR | 4 | Version 1. 0|4 | Version 1.1 | 5 5 \***************************************/ 6 6 … … 12 12 $replace = array ('e','E','a','A','i','I','u','U','o','O','c','C',',n','N','y','Y','_',''); 13 13 14 if ($renameORNOT) { 15 return preg_replace($search, $replace, $string); 16 } else { 17 return $string; 18 } 14 return preg_replace($search, $replace, $string); 19 15 } 20 16 … … 49 45 # si $dirs=true liste les dossiers plutot que les fichiers 50 46 global ${$array}; // Charge la tableau pour la sortie, déclaré à l'exterieur à cause de l'appel recursif de la fonction 51 $dir = rtrim($dir, '/'); // on vire un eventuel slash mis par l'utilisateur de la fonction a droite du repertoire47 $dir = rtrim($dir, '/'); 52 48 53 49 if (is_dir($dir)) { … … 56 52 exit; 57 53 } 58 while (($file = readdir($dh)) !== false ) { //boucle pour parcourir le repertoire54 while (($file = readdir($dh)) !== false ) { 59 55 if ($file !== '.' && $file !== '..') { 60 56 $path = $dir.'/'.$file; 61 if (is_dir($path)) { //si on tombe sur un sous-repertoire57 if (is_dir($path)) { 62 58 if($dirs) ${$array}[] = $path; 63 recursive_readdir($path, $array, $dirs); // appel recursif pour lire a l'interieur de ce sous-repertoire64 } else { // si il s'agit d'un fichier59 recursive_readdir($path, $array, $dirs); 60 } else { 65 61 if(!$dirs) ${$array}[] = $path; 66 62 } … … 69 65 closedir($dh); 70 66 } 67 68 // Parse le fichier de configuration 69 function XMLParse($xml) { 70 $content = array(); 71 foreach ($xml as $nom => $elem) { 72 if (trim($elem) == '') { 73 $content[$nom] = XMLParse($elem->children()); 74 } else { 75 $content[$nom] = utf8_encode(utf8_decode($elem)); 76 } 77 } 78 return $content; 79 } 80 81 // Crée le fichier de configuration 82 function XMLCreate($array, $level) { 83 $content = null; 84 foreach ($array as $nom => $elem) { 85 if (is_array($elem)) { 86 for($i=0;$i<=$level;$i++) $content .= "\t"; 87 $content .= '<'.$nom.'>'."\n"; 88 $content .= XMLCreate($elem, $level+1); 89 for($i=0;$i<=$level;$i++) $content .= "\t"; 90 $content .= '</'.$nom.'>'."\n"; 91 } else { 92 for($i=0;$i<=$level;$i++) $content .= "\t"; 93 $content .= '<'.$nom.'>'.$elem.'</'.$nom.'>'."\n"; 94 } 95 } 96 return $content; 97 } 98 99 // Convertit les booléens, entiers et flotants d'un tableau de 'string' 100 function array_settype($array) { 101 foreach ($array as $key => $value) { 102 if (is_array($value)) { 103 $array[$key] = array_settype($value); 104 } else { 105 if ($value === 'true') { 106 $array[$key] = true; 107 } else if ($value === 'false') { 108 $array[$key] = false; 109 } else if (preg_match('#^([0-9]*)$#', $value)) { 110 settype($array[$key], 'int'); 111 } else if (preg_match('#^([0-9]*)(.|,)([0-9]*)$#', $value)) { 112 settype($array[$key], 'float'); 113 } 114 } 115 } 116 117 return $array; 118 } 119 120 // Booléen vers français ou texte 121 function bool_to_string($bool, $just_echo=0) { 122 # $just_echo pour pouvoir afficher un booléen tel quel 123 if (is_bool($bool)) { 124 if ($bool) { 125 if ($just_echo) return 'true'; 126 else return 'oui'; 127 } else { 128 if ($just_echo) return 'false'; 129 else return 'non'; 130 } 131 } else { 132 return $bool; 133 } 134 } 71 135 ?> -
extensions/PHP_Optimisateur/files/style.css
r7988 r7991 6 6 7 7 body { 8 font-size:1 2px;9 font-family: Verdanna;8 font-size:13px; 9 font-family:Calibri,sans-serif; 10 10 background:#eee; 11 11 color:#333; 12 width:990px; 13 margin:0 auto; 12 14 } 13 15 14 16 div { 15 width:4 0%;17 width:450px; 16 18 margin:10px; 17 19 padding:10px; 18 20 border:1px dotted #333; 19 21 float:left; 22 } 23 24 a { 25 color:#EF9700; 26 text-decoration:none; 27 padding:0 10px; 28 float:right; 29 margin-bottom:1px; 30 } 31 a:hover { 32 color:#555; 33 border-bottom:1px dotted #555; 34 margin-bottom:0; 20 35 } 21 36 … … 34 49 } 35 50 36 .title { 37 width:80%; 51 div.title { 52 float:none; 53 width:902px; 38 54 padding:10px 30px; 39 55 font-weight:bold; … … 59 75 font-size:1.2em; 60 76 } 77 78 input { 79 border:1px solid #888; 80 -moz-border-radius:3px; 81 } 82 83 b.new:after { 84 content:' New !'; 85 color:#0ABF00; 86 font-style:italic; 87 } 88 89 span.title { 90 font-weight:bold; 91 text-decoration:underline; 92 font-size:1.1em; 93 } 94 95 td { 96 width:50%; 97 } 98 tr td:first-child { 99 text-align:right; 100 padding-right:5px; 101 }
Note: See TracChangeset
for help on using the changeset viewer.