cvs: pear /HTTP_Header Header.php

From: Date: Tue, 09 Dec 2003 18:00:40 +0000
Subject: cvs: pear /HTTP_Header Header.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-14734@lists.php.net to get a copy of this message
cain Tue Dec 9 13:00:40 2003 EDT Modified files: /pear/HTTP_Header Header.php Log: + added get*() to statusText() and statusType() + some BC stuff Index: pear/HTTP_Header/Header.php diff -u pear/HTTP_Header/Header.php:1.10 pear/HTTP_Header/Header.php:1.11 --- pear/HTTP_Header/Header.php:1.10 Mon Dec 1 16:32:46 2003 +++ pear/HTTP_Header/Header.php Tue Dec 9 13:00:39 2003 @@ -15,7 +15,7 @@ // | Authors: Wolfram Kriesing <wk@visionp.de> | // | | // +----------------------------------------------------------------------+// -// $Id: Header.php,v 1.10 2003/12/01 21:32:46 cain Exp $ +// $Id: Header.php,v 1.11 2003/12/09 18:00:39 cain Exp $ require_once 'HTTP.php'; @@ -116,18 +116,18 @@ * @param * @param mixed if the value is not given the default value depends on the $key */ - function setHeader ( $key , $value=null ) + function setHeader($key, $value=null) { //FIXXXME do sanity checks, i.e. if the headers are valid, etc. // may be check protocol too (HTTP 1.0/1.1) // is the 'last-modified' value a timestamp? if the value is an int then we assume so, or if it is not given - if( strtolower($key) == 'last-modified' && ( $value == null || (int)$value==$value ) ) { - if( $value == null ) + if(strtolower($key)=='last-modified' && ($value==null || (int)$value==$value)) { + if ($value == null) { $value = time(); + } $this->_headers[$key] = HTTP::Date($value);//date('D, d M Y H:i:s T',$value); - } - else { + } else { $this->_headers[$key] = $value; } } @@ -136,11 +136,11 @@ * * */ - function getHeader ( $key=null ) + function getHeader ($key=null) { - if( $key==null ) + if ($key==null) { return $this->_headers; - + } return $this->_headers[$key]; } @@ -149,10 +149,10 @@ * @param array the keys that shall be sent, if the array is empty all * the headers will be sent (all headers that you would get vie $this->getHeader()) */ - function sendHeaders( $keys=array()) + function sendHeaders($keys=array()) { - foreach ( $this->_headers as $key=>$value ) { - header( "$key: $value" ); + foreach ($this->_headers as $key=>$value) { + header("$key: $value"); } } @@ -260,7 +260,7 @@ * @return int|false */ - function statusType($http_code) + function getStatusType($http_code) { if(defined('HTTP_HEADER_STATUS_' .$http_code)) { $type = substr($http_code,0,1); @@ -287,7 +287,7 @@ * @return string|false */ - function statusText($http_code) + function getStatusText($http_code) { if ($this->statusType($http_code)) { return constant('HTTP_HEADER_STATUS_' .$http_code);

« previous php.pear.cvs (#14734) next »