Show
Ignore:
Timestamp:
06/20/08 12:37:15 (5 months ago)
Author:
llaumgui
Message:
 
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • ez_publish/myutils/trunk/autoloads/myutils_operators.php

    r184 r185  
    3939        function __construct() 
    4040        { 
    41                 /* Opérateurs */ 
     41                /* Opérateurs */ 
    4242                $this->Operators = array(       'get_siteaccess', 
    4343                                                                        'gmdate', 
     
    7171                                                                                                        ), 
    7272                                                 
    73                                                 'is_debug_enabled'                              => array( 
    74                                                                                                         ), 
     73                                                'is_debug_enabled'                              => array( ), 
    7574 
    7675                                                'path_to_path_array'                    => array( 
     
    109108 
    110109                        case 'gmdate': 
    111                         $operatorValue = $this->gmDate( $namedParameters['format'], 
    112                                                                                         $namedParameters['timestamp'] ); 
     110                        $operatorValue = gmdate( $namedParameters['format'], $namedParameters['timestamp'] ); 
    113111                        break; 
    114112                 
     
    118116                         
    119117                case 'path_to_path_array': 
    120                         $operatorValue = $this->path2PathArray(         $namedParameters['path'] ); 
     118                        $operatorValue = myUtilsFunctions::path2PathArray( $namedParameters['path'] ); 
    121119                        break; 
    122120 
    123121                        case 'redirect': 
    124                         $operatorValue = $this->redirect(       $namedParameters['url'], 
    125                                                                                                 $namedParameters['type'] ); 
     122                        $operatorValue = myUtilsFunctions::redirect( $namedParameters['url'], $namedParameters['type'] ); 
    126123                        break; 
    127124 
    128125                        case 'str_ireplace': 
    129                         $operatorValue = $this->strIReplace(    $namedParameters['search'], 
    130                                                                                                         $namedParameters['replace'], 
    131                                                                                                         $namedParameters['subject'] ); 
     126                        $operatorValue = str_ireplace(  $namedParameters['search'], 
     127                                                                                        $namedParameters['replace'], 
     128                                                                                        $namedParameters['subject'] ); 
    132129                        break; 
    133130 
    134131                        case 'str_replace': 
    135                         $operatorValue = $this->strReplace(     $namedParameters['search'], 
    136                                                                                                 $namedParameters['replace'], 
    137                                                                                                 $namedParameters['subject'] ); 
     132                        $operatorValue = str_replace(   $namedParameters['search'], 
     133                                                                                        $namedParameters['replace'], 
     134                                                                                        $namedParameters['subject'] ); 
    138135                        break; 
    139136                } 
    140137        } 
    141138 
    142          
    143         /** ##################################################################### 
    144          *  
    145          * 
    146          * 
    147          * ###################################################################### */ 
    148          
    149         /** 
    150          * Fonction gmdate dans eZ (pour les flux RSS par exemple). 
    151          *        
    152          * @author Guillaume Kulakowski <guillaume_AT_llaumgui_DOT_com> 
    153          * @since 1.1 
    154          *  
    155          * @param string format 
    156          * @param integer timestamp 
    157          * @return string 
    158          */ 
    159         function gmDate( $format, $timestamp) 
    160         { 
    161                 return gmdate( $format, $timestamp); 
    162         } 
    163  
    164  
    165  
    166         /** 
    167          * Converti un "path" en "path_array". 
    168          * Permet de retrouver un équivalent de $node.path_array là où il n'y a que 
    169          * les informations path, par exemple dans le pagelayout ($module_result.path). 
    170          *        
    171          * @author Guillaume Kulakowski <guillaume_AT_llaumgui_DOT_com> 
    172          * @since 1.0 
    173          * 
    174          * @param array $path 
    175          * @return array 
    176          */ 
    177         function path2PathArray( $path ) 
    178         { 
    179                 $path_array     = array(); 
    180                 if ( !is_array( $path ) ) 
    181                         return array(); 
    182  
    183                 foreach ( $path as $p ) 
    184                 { 
    185                         $path_array[]=$p['node_id']; 
    186                 } 
    187                 return $path_array; 
    188         } 
    189  
    190  
    191  
    192         /** 
    193          * Fonction header() de php mise en forme pour faire des redirections. 
    194          * 
    195          * @author Guillaume Kulakowski <guillaume_AT_llaumgui_DOT_com> 
    196          * @since 1.0 
    197          *        
    198          * @param string $url URL de redirection 
    199          * @param integer $type Type de redirection 
    200          */ 
    201         private function redirect( $url, $type ) 
    202         { 
    203                 switch( $type ) 
    204                 { 
    205                         case 301: 
    206                                 header("HTTP/1.1 301 Moved Permanently"); 
    207                                 break; 
    208                         case 307: 
    209                                 header("HTTP/1.1 307 Temporary Redirect"); 
    210                                 break; 
    211                 } 
    212                 header ('location: '.$url); 
    213                 eZExecution::cleanExit(); 
    214         } 
    215  
    216  
    217  
    218         /** 
    219          * Fonction str_replace de php. 
    220          * 
    221          * @author Guillaume Kulakowski <guillaume_AT_llaumgui_DOT_com> 
    222          * @since 1.0 
    223          * 
    224          * @param string $search 
    225          * @param string $replace 
    226          * @param string $subject 
    227          * @return string 
    228          */ 
    229         function strIReplace( $search, $replace, $subject ) 
    230         { 
    231                 return str_replace( $search, $replace, $subject ); 
    232         } 
    233  
    234  
    235  
    236         /** 
    237          * Fonction str_ireplace de php. 
    238          * 
    239          * @author Guillaume Kulakowski <guillaume_AT_llaumgui_DOT_com> 
    240          * @since 1.0 
    241          * 
    242          * @param string $search 
    243          * @param string $replace 
    244          * @param string $subject 
    245          * @return string 
    246          */ 
    247         function strReplace( $search, $replace, $subject ) 
    248         { 
    249                 return str_ireplace( $search, $replace, $subject ); 
    250         }        
    251  
    252  
    253139} // EOC 
    254140