Changeset 4

Show
Ignore:
Timestamp:
04/05/04 22:09:31
Author:
schst
Message:

cleanup, replaced double quotes with single quotes,
fixed small bug with cookies

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/extensions/http/patXMLRendererHttpExtension.php

    r2 r4  
    11<?PHP 
    22/** 
    3 *       pat XML Renderer - HTTP Extension 
    4 *       $Id$ 
    5 
    6 *       @access public 
    7 *       @version        0.1     $Revision$ 
    8 *       @author         Stephan Schmidt <schst@php-tools.de> 
    9 *       @package        patXMLRenderer 
    10 */ 
     3 * pat XML Renderer - HTTP Extension 
     4 * 
     5 * $Id$ 
     6 * 
     7 * @access              public 
     8 * @version             0.2 
     9 * @author              Stephan Schmidt <schst@php-tools.de> 
     10 * @package             patXMLRenderer 
     11 */ 
     12class patXMLRendererHttpExtension extends patXMLRendererExtension 
     13
     14   /** 
     15        * name of the extension 
     16        * @var  string  $name 
     17        */ 
     18        var     $name           =       'patXMLHttpExtension'; 
    1119 
    12         class   patXMLRendererHttpExtension extends patXMLRendererExtension 
    13 
     20   /** 
     21        * version of the extension 
     22        * @var  string  $version 
     23        */ 
     24        var     $version        =       '0.2'; 
    1425 
    15 /** 
    16 *       name of the extension 
    17 *       @var    string  $name 
    18 */ 
    19         var     $name           =       "patXMLHttpExtension"; 
    20  
    21 /** 
    22 *       version of the extension 
    23 *       @var    string  $version 
    24 */ 
    25         var     $version        =       "0.1"; 
    26  
    27 /** 
    28 *       version of patXMLRenderer that is required 
    29 *       @var    string  $requiredRandyVersion 
    30 */ 
    31         var     $requiredRandyVersion   =       "0.5"; 
     26   /** 
     27        * version of patXMLRenderer that is required 
     28        * @var  string  $requiredRandyVersion 
     29        */ 
     30        var     $requiredRandyVersion   =       '0.5'; 
    3231         
    33 /** 
    34 *      array containing a flag for each supported tag to indicate if this tag is cacheable 
    35 *      @var   array   $cacheAble 
    36 */ 
     32   /** 
     33       * array containing a flag for each supported tag to indicate if this tag is cacheable 
     34       * @var array   $cacheAble 
     35       */ 
    3736        var     $cacheAble              =       array( 
    38                                                                         "HEADER"                      =>      true, 
    39                                                                         "SETCOOKIE"                   =>      true 
     37                                                                        'HEADER'                      =>      true, 
     38                                                                        'SETCOOKIE'                   =>      true 
    4039                                                                ); 
    41 /** 
    42 *      array containing a flag for each supported tag to indicate if this tag returns markup 
    43 *      @var   array   $containsMarkup 
    44 */ 
     40   /** 
     41       * array containing a flag for each supported tag to indicate if this tag returns markup 
     42       * @var array   $containsMarkup 
     43       */ 
    4544        var     $containsMarkup =       array(   
    46                                                                         "HEADER"                      =>      false, 
    47                                                                         "SETCOOKIE"                   =>      false 
     45                                                                        'HEADER'                      =>      false, 
     46                                                                        'SETCOOKIE'                   =>      false 
    4847                                                                ); 
    49 /** 
    50 *      handle an end element 
    51 
    52 *      @param int             $parser         resource id of the current parser 
    53 *      @param string  $ns                     namespace 
    54 *      @param string  $name           name of the element 
    55 */ 
     48   /** 
     49       * handle an end element 
     50       
     51       * @param       int             $parser         resource id of the current parser 
     52       * @param       string  $ns                     namespace 
     53       * @param       string  $name           name of the element 
     54       */ 
    5655        function        endElement( $parser, $ns, $tag ) 
    5756        { 
     
    6261                switch( $tag ) 
    6362                { 
    64                         case    "HEADER"
     63                        case    'HEADER'
    6564                                header( $data ); 
    6665                                return  false; 
    6766                                break; 
    6867 
    69                         case    "SETCOOKIE"
     68                        case    'SETCOOKIE'
    7069 
    71                                 if( !isset( $attributes["EXPIRE"] ) ) 
    72                                         $attributes["EXPIRE"]   =       0; 
     70                                if( !isset( $attributes['EXPIRE'] ) ) 
     71                                        $attributes['EXPIRE']   =       0; 
     72                                else 
     73                                        $attributes['EXPIRE']   =       $attributes['EXPIRE'] + time(); 
    7374 
    74                                 $attributes["SECURE"]          =       $this->convertBoolean( $attributes["SECURE"] ); 
     75                                $attributes['SECURE']          =       $this->convertBoolean( $attributes['SECURE'] ); 
    7576 
    76                                 $cookie =       setcookie( $attributes["NAME"], $data, $attributes["EXPIRE"], $attributes["PATH"], $attributes["DOMAIN"], $attributes["SECURE"] ); 
     77                                $cookie =       setcookie( $attributes['NAME'], $data, $attributes['EXPIRE'], $attributes['PATH'], $attributes['DOMAIN'], $attributes['SECURE'] ); 
    7778                                return  false; 
    7879 
     
    8485        } 
    8586 
    86 /** 
    87 *       convert  a value to 0 or 1 
    88 *       needed for secure argument of setcookie 
    89 *        
    90 *       @param  mixed   $value 
    91 *       @return int             $value 
    92 */ 
    93  
     87   /** 
     88        * convert        a value to 0 or 1 
     89        * needed for secure argument of setcookie 
     90        *        
     91        * @param        mixed   $value 
     92        * @return       int             $value 
     93        */ 
    9494        function        convertBoolean( $value ) 
    9595        { 
    9696                switch( $value ) 
    9797                { 
    98                         case    "on"
    99                         case    "yes"
    100                         case    "true"
    101                         case    "1"
     98                        case    'on'
     99                        case    'yes'
     100                        case    'true'
     101                        case    '1'
    102102                        case    1: 
    103103                        case    true; 
  • trunk/extensions/http/patXMLRendererHttpExtension.xml

    r2 r4  
    77                <configValue type="string" name="name">HTTP Extension</configValue> 
    88                <configValue type="string" name="class">patXMLRendererHttpExtension</configValue> 
    9                 <configValue type="float" name="version">0.1</configValue> 
     9                <configValue type="float" name="version">0.2</configValue> 
    1010                <configValue type="string" name="requiredRandyVersion">0.5</configValue> 
    1111                <configValue type="string" name="description">