Changeset 4
- Timestamp:
- 04/05/04 22:09:31
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/extensions/http/patXMLRendererHttpExtension.php
r2 r4 1 1 <?PHP 2 2 /** 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 */ 12 class patXMLRendererHttpExtension extends patXMLRendererExtension 13 { 14 /** 15 * name of the extension 16 * @var string $name 17 */ 18 var $name = 'patXMLHttpExtension'; 11 19 12 class patXMLRendererHttpExtension extends patXMLRendererExtension 13 { 20 /** 21 * version of the extension 22 * @var string $version 23 */ 24 var $version = '0.2'; 14 25 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'; 32 31 33 /**34 *array containing a flag for each supported tag to indicate if this tag is cacheable35 *@var array $cacheAble36 */32 /** 33 * array containing a flag for each supported tag to indicate if this tag is cacheable 34 * @var array $cacheAble 35 */ 37 36 var $cacheAble = array( 38 "HEADER"=> true,39 "SETCOOKIE"=> true37 'HEADER' => true, 38 'SETCOOKIE' => true 40 39 ); 41 /**42 *array containing a flag for each supported tag to indicate if this tag returns markup43 *@var array $containsMarkup44 */40 /** 41 * array containing a flag for each supported tag to indicate if this tag returns markup 42 * @var array $containsMarkup 43 */ 45 44 var $containsMarkup = array( 46 "HEADER"=> false,47 "SETCOOKIE"=> false45 'HEADER' => false, 46 'SETCOOKIE' => false 48 47 ); 49 /**50 *handle an end element51 *52 *@param int $parser resource id of the current parser53 *@param string $ns namespace54 *@param string $name name of the element55 */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 */ 56 55 function endElement( $parser, $ns, $tag ) 57 56 { … … 62 61 switch( $tag ) 63 62 { 64 case "HEADER":63 case 'HEADER': 65 64 header( $data ); 66 65 return false; 67 66 break; 68 67 69 case "SETCOOKIE":68 case 'SETCOOKIE': 70 69 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(); 73 74 74 $attributes[ "SECURE"] = $this->convertBoolean( $attributes["SECURE"] );75 $attributes['SECURE'] = $this->convertBoolean( $attributes['SECURE'] ); 75 76 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'] ); 77 78 return false; 78 79 … … 84 85 } 85 86 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 */ 94 94 function convertBoolean( $value ) 95 95 { 96 96 switch( $value ) 97 97 { 98 case "on":99 case "yes":100 case "true":101 case "1":98 case 'on': 99 case 'yes': 100 case 'true': 101 case '1': 102 102 case 1: 103 103 case true; trunk/extensions/http/patXMLRendererHttpExtension.xml
r2 r4 7 7 <configValue type="string" name="name">HTTP Extension</configValue> 8 8 <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> 10 10 <configValue type="string" name="requiredRandyVersion">0.5</configValue> 11 11 <configValue type="string" name="description">
