Changeset 212
- Timestamp:
- 07/05/08 12:04:10 (6 months ago)
- Location:
- ez_publish/myutils/trunk
- Files:
-
- 5 added
- 4 modified
-
autoloads/eztemplateautoload.php (modified) (1 diff)
-
classes/myutilsfunctions.php (modified) (4 diffs)
-
classes/myutilstemplateoperators.php (modified) (4 diffs)
-
settings/site.ini.append.php (modified) (1 diff)
-
translations (added)
-
translations/fre-FR (added)
-
translations/fre-FR/translation.ts (added)
-
translations/untranslated (added)
-
translations/untranslated/translation.ts (added)
Legend:
- Unmodified
- Added
- Removed
-
ez_publish/myutils/trunk/autoloads/eztemplateautoload.php
r199 r212 40 40 'path_to_path_array', 41 41 'redirect', 42 'r_datetime', 42 43 'str_ireplace', 43 44 'str_replace' -
ez_publish/myutils/trunk/classes/myutilsfunctions.php
r197 r212 22 22 * ###################### END LICENSE BLOCK #################### 23 23 * 24 * myUtilsFunctions : Enssemble de fonctions utilis ée pour l'extension myUtils24 * myUtilsFunctions : Enssemble de fonctions utilisée pour l'extension myUtils 25 25 * 26 26 * @author Guillaume Kulakowski <guillaume_AT_llaumgui_DOT_com> 27 * @version 1.0. 127 * @version 1.0.2 28 28 */ 29 29 … … 63 63 static function cleanRSSDescription( &$str ) { 64 64 65 $str = preg_replace( '#<img src="/(.+?)" alt="(.?)" />#is', '', $str ); 65 $str = preg_replace( '#<img src="/(.+?)" alt="(.?)" />#is', '', $str ); 66 66 } 67 67 … … 160 160 /** 161 161 * Converti un "path" en "path_array". 162 * Permet de retrouver un équivalent de $node.path_array là oùil n'y a que162 * Permet de retrouver un équivalent de $node.path_array là où il n'y a que 163 163 * les informations path, par exemple dans le pagelayout ($module_result.path). 164 164 * … … 209 209 eZExecution::cleanExit(); 210 210 } 211 212 213 214 /** 215 * Fonction datetime relative (Aujourd'hui, hier, etc..) 216 * 217 * @author Guillaume Kulakowski <guillaume_AT_llaumgui_DOT_com> 218 * @since 1.0.2 219 * 220 * @param integer $operatorValue 221 * @param string $class 222 * @param string $data 223 */ 224 static function relatedDatetime( &$operatorValue, $class, $data ) 225 { 226 $locale = eZLocale::instance(); 227 $dateFormat = '%d-%m-%Y'; 228 $date = $locale->formatDateTimeType( $dateFormat, $operatorValue); 229 $today = $locale->formatDateTimeType( $dateFormat); 230 $yesterday = $locale->formatDateTimeType( $dateFormat, time()-86400); 231 232 if ( $class === null ) 233 { 234 return; 235 } 236 237 if ( $class == 'custom' ) 238 { 239 $classFormat = $data; 240 } 241 else 242 { 243 $dtINI = eZINI::instance( 'datetime.ini' ); 244 $formats = $dtINI->variable( 'ClassSettings', 'Formats' ); 245 if ( array_key_exists( $class, $formats ) ) 246 { 247 $classFormat = $formats[$class]; 248 } 249 else 250 { 251 $tpl->error( $operatorName, "DateTime class '$class' is not defined", $placement ); 252 return; 253 } 254 } 255 256 if ( $date == $today ) 257 { 258 $classFormat = preg_replace( '#\$\$(.+?)\$\$#', ezi18n( 'myutils/date', 'Today' ), $classFormat ); 259 } 260 else if ( $date == $yesterday ) 261 { 262 $classFormat = preg_replace( '#\$\$(.+?)\$\$#', ezi18n( 'myutils/date', 'Yesterday' ), $classFormat ); 263 } 264 265 $operatorValue = $locale->formatDateTimeType( str_replace('$$', '', $classFormat ), $operatorValue ); 266 } 211 267 212 268 } // EOC -
ez_publish/myutils/trunk/classes/myutilstemplateoperators.php
r199 r212 39 39 function __construct() 40 40 { 41 /* Op érateurs */41 /* Opérateurs */ 42 42 $this->Operators = array( 'get_siteaccess', 43 43 'gmdate', … … 46 46 'path_to_path_array', 47 47 'redirect', 48 'r_datetime', 48 49 'str_ireplace', 49 50 'str_replace' … … 75 76 76 77 'json_decode' => array( 77 'json' => array( 'type' => 'string', 'required' => true, 'default' => '' ),78 'assoc' => array( 'type' => 'bool', 'required' => false, 'default' => true )78 'json' => array( 'type' => 'string', 'required' => true, 'default' => '' ), 79 'assoc' => array( 'type' => 'bool', 'required' => false, 'default' => true ) 79 80 ), 80 81 81 82 'path_to_path_array' => array( 82 'path' => array( 'type' => 'array', 'required' => true, 'default' => '' ),83 'path' => array( 'type' => 'array', 'required' => true, 'default' => '' ), 83 84 ), 84 85 85 86 'redirect' => array( 86 'url' => array( 'type' => 'string', 'required' => true, 'default' => '' ),87 'url' => array( 'type' => 'string', 'required' => true, 'default' => '' ), 87 88 'type' => array( 'type' => 'integer', 'required' => false, 'default' => '301' ) 89 ), 90 91 'r_datetime' => array( 92 'class' => array( 'type' => 'string', 'required' => true, 'default' => '' ), 93 'data' => array( 'type' => 'string', 'required' => false, 'default' => '' ) 88 94 ), 89 95 … … 132 138 $operatorValue = myUtilsFunctions::redirect( $namedParameters['url'], $namedParameters['type'] ); 133 139 break; 140 141 case 'r_datetime': 142 myUtilsFunctions::relatedDatetime( $operatorValue, 143 $namedParameters['class'], 144 $namedParameters['data'] ); 145 break; 134 146 135 147 case 'str_ireplace': -
ez_publish/myutils/trunk/settings/site.ini.append.php
r104 r212 14 14 DefaultVersion=2.0 15 15 16 [RegionalSettings] 17 TranslationExtensions[]=myutils 18 16 19 */ ?>
