Changeset 154
- Timestamp:
- 05/30/08 17:41:07 (5 months ago)
- Location:
- ez_publish/myutils/trunk/autoloads
- Files:
-
- 2 modified
-
eztemplateautoload.php (modified) (1 diff)
-
myutils_operators.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ez_publish/myutils/trunk/autoloads/eztemplateautoload.php
r108 r154 34 34 'operator_names' => array( 'is_debug_enabled', 35 35 'path_to_path_array', 36 'php_tidy', 36 37 'redirect', 37 38 'str_ireplace', -
ez_publish/myutils/trunk/autoloads/myutils_operators.php
r108 r154 25 25 * 26 26 * @author Guillaume Kulakowski <guillaume_AT_llaumgui_DOT_com> 27 * @version 1. 027 * @version 1.1 28 28 */ 29 29 … … 42 42 $this->Operators = array( 'is_debug_enabled', 43 43 'path_to_path_array', 44 'php_tidy', 44 45 'redirect', 45 46 'str_ireplace', 46 'str_replace' 47 'str_replace' 47 48 ); 48 49 } … … 62 63 function namedParameterList() 63 64 { 64 return array( 'is_debug_enabled' => array(65 return array( 'is_debug_enabled' => array( 65 66 ), 66 67 67 68 'path_to_path_array' => array( 68 'path' => array( 'url' => 'array', 'required' => true, 'default' => '' ), 69 ), 70 69 'path' => array( 'type' => 'array', 'required' => true, 'default' => '' ), 70 ), 71 72 'php_tidy' => array( 73 'string' => array( 'type' => 'string', 'required' => true, 'default' => '' ), 74 ), 75 71 76 'redirect' => array( 72 'url' => array( ' url' => 'string', 'required' => true, 'default' => '' ),77 'url' => array( 'type' => 'string', 'required' => true, 'default' => '' ), 73 78 'type' => array( 'type' => 'integer', 'required' => false, 'default' => '301' ) 74 79 ), 75 76 80 77 81 'str_ireplace' => array( 78 82 'search' => array( 'type' => 'string', 'required' => true, 'default' => '' ), … … 96 100 switch ( $operatorName ) 97 101 { 98 case 'is_debug_enabled':102 case 'is_debug_enabled': 99 103 $operatorValue = $this->isDebugEnabled(); 100 104 break; … … 103 107 $operatorValue = $this->path2PathArray( $namedParameters['path'] ); 104 108 break; 109 110 case 'php_tidy': 111 $operatorValue = $this->phpTidy( $namedParameters['string'] ); 112 break; 113 105 114 case 'redirect': 106 115 $operatorValue = $this->redirect( $namedParameters['url'], … … 169 178 } 170 179 171 180 181 182 /** 183 * Métrosexualisation du code avec Tidy 184 * 185 * @author Guillaume Kulakowski <guillaume_AT_llaumgui_DOT_com> 186 * @since 1.0 187 * 188 * @param array $path 189 * @return array 190 */ 191 function phpTidy( $path ) 192 { 193 if ( function_exists( 'tidy_get_output') ) 194 { 195 $tidy = new tidy(); 196 /* Mettre dans un tidy.conf */ 197 $config = array( 'indent' => true, 198 'output-xhtml' => true, 199 'wrap' => 400, 200 'hide-comments' => false, 201 'doctype' => 'auto', 202 ); 203 $encoding = 'UTF8'; 204 $tidy->parseString( $originalMarkup, $config, $encoding ); 205 $tidy->CleanRepair(); 206 if ( $tidy->errorBuffer ) { 207 //echo "Les erreurs suivantes ont été détectées :\n"; 208 //echo $tidy->errorBuffer; 209 } 210 return (string) $tidy; 211 } 172 212 173 213 /**
