| version 1.3, 2005/11/07 22:24:36 |
version 1.4, 2005/11/25 09:49:46 |
|
|
| <?php |
<?php
|
| /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ |
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
| |
|
| /** |
/**
|
| * HTTP |
* HTTP
|
| * |
*
|
| * PHP versions 4 and 5 |
* PHP versions 4 and 5
|
| * |
*
|
| * LICENSE: This source file is subject to version 3.0 of the PHP license |
* @category HTTP
|
| * that is available through the world-wide-web at the following URI: |
* @package HTTP
|
| * http://www.php.net/license/3_0.txt. If you did not receive a copy of |
* @author Stig Bakken <ssb@fast.no>
|
| * the PHP License and are unable to obtain it through the web, please |
* @author Sterling Hughes <sterling@php.net>
|
| * send a note to license@php.net so we can mail you a copy immediately. |
* @author Tomas V.V.Cox <cox@idecnet.com>
|
| * |
* @author Richard Heyes <richard@php.net>
|
| * @category HTTP |
* @author Philippe Jausions <Philippe.Jausions@11abacus.com>
|
| * @package HTTP |
* @author Michael Wallner <mike@php.net>
|
| * @author Stig Bakken <ssb@fast.no> |
* @copyright 2002-2005 The Authors
|
| * @author Sterling Hughes <sterling@php.net> |
* @license BSD, revised
|
| * @author Tomas V.V.Cox <cox@idecnet.com> |
* @version CVS: $Id$
|
| * @author Richard Heyes <richard@php.net> |
* @link http://pear.php.net/package/HTTP
|
| * @author Philippe Jausions <Philippe.Jausions@11abacus.com> |
*/
|
| * @author Michael Wallner <mike@php.net> |
|
| * @copyright 2002-2005 The Authors |
/**
|
| * @license http://www.php.net/license/3_0.txt PHP License 3.0 |
* Miscellaneous HTTP Utilities
|
| * @version CVS: $Id$ |
*
|
| * @link http://pear.php.net/package/HTTP |
* PEAR::HTTP provides static shorthand methods for generating HTTP dates,
|
| */ |
* issueing HTTP HEAD requests, building absolute URIs, firing redirects and
|
| |
* negotiating user preferred language.
|
| /** |
*
|
| * Miscellaneous HTTP Utilities |
* @package HTTP
|
| * |
* @category HTTP
|
| * PEAR::HTTP provides static shorthand methods for generating HTTP dates, |
* @access public
|
| * issueing HTTP HEAD requests, building absolute URIs, firing redirects and |
* @static
|
| * negotiating user preferred language. |
* @version $Revision$
|
| * |
*/
|
| * @package HTTP |
class HTTP
|
| * @category HTTP |
{
|
| * @license PHP License |
/**
|
| * @access public |
* Date
|
| * @static |
*
|
| * @version $Revision$ |
* Format a RFC compliant GMT date HTTP header. This function honors the
|
| */ |
* "y2k_compliance" php.ini directive and formats the GMT date corresponding
|
| class HTTP |
* to either RFC850 or RFC822.
|
| { |
*
|
| /** |
* @static
|
| * Date |
* @access public
|
| * |
* @return mixed GMT date string, or false for an invalid $time parameter
|
| * Format a RFC compliant GMT date HTTP header. This function honors the |
* @param mixed $time unix timestamp or date (default = current time)
|
| * "y2k_compliance" php.ini directive and formats the GMT date corresponding |
*/
|
| * to either RFC850 or RFC822. |
function Date($time = null)
|
| * |
{
|
| * @static |
if (!isset($time)) {
|
| * @access public |
$time = time();
|
| * @return mixed GMT date string, or false for an invalid $time parameter |
} elseif (!is_numeric($time) && (-1 === $time = strtotime($time))) {
|
| * @param mixed $time unix timestamp or date (default = current time) |
return false;
|
| */ |
}
|
| function Date($time = null) |
|
| { |
// RFC822 or RFC850
|
| if (!isset($time)) { |
$format = ini_get('y2k_compliance') ? 'D, d M Y' : 'l, d-M-y';
|
| $time = time(); |
|
| } elseif (!is_numeric($time) && (-1 === $time = strtotime($time))) { |
return gmdate($format .' H:i:s \G\M\T', $time);
|
| return false; |
}
|
| } |
|
| |
/**
|
| // RFC822 or RFC850 |
* Negotiate Language
|
| $format = ini_get('y2k_compliance') ? 'D, d M Y' : 'l, d-M-y'; |
*
|
| |
* Negotiate language with the user's browser through the Accept-Language
|
| return gmdate($format .' H:i:s \G\M\T', $time); |
* HTTP header or the user's host address. Language codes are generally in
|
| } |
* the form "ll" for a language spoken in only one country, or "ll-CC" for a
|
| |
* language spoken in a particular country. For example, U.S. English is
|
| /** |
* "en-US", while British English is "en-UK". Portugese as spoken in
|
| * Negotiate Language |
* Portugal is "pt-PT", while Brazilian Portugese is "pt-BR".
|
| * |
*
|
| * Negotiate language with the user's browser through the Accept-Language |
* Quality factors in the Accept-Language: header are supported, e.g.:
|
| * HTTP header or the user's host address. Language codes are generally in |
* Accept-Language: en-UK;q=0.7, en-US;q=0.6, no, dk;q=0.8
|
| * the form "ll" for a language spoken in only one country, or "ll-CC" for a |
*
|
| * language spoken in a particular country. For example, U.S. English is |
* <code>
|
| * "en-US", while British English is "en-UK". Portugese as spoken in |
* require_once 'HTTP.php';
|
| * Portugal is "pt-PT", while Brazilian Portugese is "pt-BR". |
* $langs = array(
|
| * |
* 'en' => 'locales/en',
|
| * Quality factors in the Accept-Language: header are supported, e.g.: |
* 'en-US'=> 'locales/en',
|
| * Accept-Language: en-UK;q=0.7, en-US;q=0.6, no, dk;q=0.8 |
* 'en-UK'=> 'locales/en',
|
| * |
* 'de' => 'locales/de',
|
| * <code> |
* 'de-DE'=> 'locales/de',
|
| * require_once 'HTTP.php'; |
* 'de-AT'=> 'locales/de',
|
| * $langs = array( |
* );
|
| * 'en' => 'locales/en', |
* $neg = HTTP::negotiateLanguage($langs);
|
| * 'en-US'=> 'locales/en', |
* $dir = $langs[$neg];
|
| * 'en-UK'=> 'locales/en', |
* </code>
|
| * 'de' => 'locales/de', |
*
|
| * 'de-DE'=> 'locales/de', |
* @static
|
| * 'de-AT'=> 'locales/de', |
* @access public
|
| * ); |
* @return string The negotiated language result or the supplied default.
|
| * $neg = HTTP::negotiateLanguage($langs); |
* @param array $supported An associative array of supported languages,
|
| * $dir = $langs[$neg]; |
* whose values must evaluate to true.
|
| * </code> |
* @param string $default The default language to use if none is found.
|
| * |
*/
|
| * @static |
function negotiateLanguage($supported, $default = 'en-US')
|
| * @access public |
{
|
| * @return string The negotiated language result or the supplied default. |
$supp = array();
|
| * @param array $supported An associative array of supported languages, |
foreach ($supported as $lang => $isSupported) {
|
| * whose values must evaluate to true. |
if ($isSupported) {
|
| * @param string $default The default language to use if none is found. |
$supp[strToLower($lang)] = $lang;
|
| */ |
}
|
| function negotiateLanguage($supported, $default = 'en-US') |
}
|
| { |
|
| $supp = array(); |
if (!count($supp)) {
|
| foreach ($supported as $lang => $isSupported) { |
return $default;
|
| if ($isSupported) { |
}
|
| $supp[strToLower($lang)] = $lang; |
|
| } |
$matches = array();
|
| } |
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
| |
foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang) {
|
| if (!count($supp)) { |
$lang = array_map('trim', explode(';', $lang));
|
| return $default; |
if (isset($lang[1])) {
|
| } |
$l = strtolower($lang[0]);
|
| |
$q = (float) str_replace('q=', '', $lang[1]);
|
| $matches = array(); |
} else {
|
| if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
$l = strtolower($lang[0]);
|
| foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang) { |
$q = null;
|
| $lang = array_map('trim', explode(';', $lang)); |
}
|
| if (isset($lang[1])) { |
if (isset($supp[$l])) {
|
| $l = strtolower($lang[0]); |
$matches[$l] = isset($q) ? $q : 1000 - count($matches);
|
| $q = (float) str_replace('q=', '', $lang[1]); |
}
|
| } else { |
}
|
| $l = strtolower($lang[0]); |
}
|
| $q = null; |
|
| } |
if (count($matches)) {
|
| if (isset($supp[$l])) { |
asort($matches, SORT_NUMERIC);
|
| $matches[$l] = isset($q) ? $q : 1000 - count($matches); |
return $supp[end($l = array_keys($matches))];
|
| } |
}
|
| } |
|
| } |
if (isset($_SERVER['REMOTE_HOST'])) {
|
| |
$lang = strtolower(end($h = explode('.', $_SERVER['REMOTE_HOST'])));
|
| if (count($matches)) { |
if (isset($supp[$lang])) {
|
| asort($matches, SORT_NUMERIC); |
return $supp[$lang];
|
| return $supp[array_pop(array_keys($matches))]; |
}
|
| } |
}
|
| |
|
| if (isset($_SERVER['REMOTE_HOST'])) { |
return $default;
|
| $lang = strtolower(array_pop(explode('.', $_SERVER['REMOTE_HOST']))); |
}
|
| if (isset($supp[$lang])) { |
|
| return $supp[$lang]; |
/**
|
| } |
* Head
|
| } |
*
|
| |
* Sends a "HEAD" HTTP command to a server and returns the headers
|
| return $default; |
* as an associative array. Example output could be:
|
| } |
* <code>
|
| |
* Array
|
| /** |
* (
|
| * Head |
* [response_code] => 200 // The HTTP response code
|
| * |
* [response] => HTTP/1.1 200 OK // The full HTTP response string
|
| * Sends a "HEAD" HTTP command to a server and returns the headers |
* [Date] => Fri, 11 Jan 2002 01:41:44 GMT
|
| * as an associative array. Example output could be: |
* [Server] => Apache/1.3.20 (Unix) PHP/4.1.1
|
| * <code> |
* [X-Powered-By] => PHP/4.1.1
|
| * Array |
* [Connection] => close
|
| * ( |
* [Content-Type] => text/html
|
| * [response_code] => 200 // The HTTP response code |
* )
|
| * [response] => HTTP/1.1 200 OK // The full HTTP response string |
* </code>
|
| * [Date] => Fri, 11 Jan 2002 01:41:44 GMT |
*
|
| * [Server] => Apache/1.3.20 (Unix) PHP/4.1.1 |
* @see HTTP_Client::head()
|
| * [X-Powered-By] => PHP/4.1.1 |
* @see HTTP_Request
|
| * [Connection] => close |
*
|
| * [Content-Type] => text/html |
* @static
|
| * ) |
* @access public
|
| * </code> |
* @return mixed Returns associative array of response headers on success
|
| * |
* or PEAR error on failure.
|
| * @see HTTP_Client::head() |
* @param string $url A valid URL, e.g.: http://pear.php.net/credits.php
|
| * @see HTTP_Request |
* @param integer $timeout Timeout in seconds (default = 10)
|
| * |
*/
|
| * @static |
function head($url, $timeout = 10)
|
| * @access public |
{
|
| * @return mixed Returns associative array of response headers on success |
$p = parse_url($url);
|
| * or PEAR error on failure. |
if (!isset($p['scheme'])) {
|
| * @param string $url A valid URL, e.g.: http://pear.php.net/credits.php |
$p = parse_url(HTTP::absoluteURI($url));
|
| * @param integer $timeout Timeout in seconds (default = 10) |
} elseif ($p['scheme'] != 'http') {
|
| */ |
return HTTP::raiseError('Unsupported protocol: '. $p['scheme']);
|
| function head($url, $timeout = 10) |
}
|
| { |
|
| $p = parse_url($url); |
$port = isset($p['port']) ? $p['port'] : 80;
|
| if (!isset($p['scheme'])) { |
|
| $p = parse_url(HTTP::absoluteURI($url)); |
if (!$fp = @fsockopen($p['host'], $port, $eno, $estr, $timeout)) {
|
| } elseif ($p['scheme'] != 'http') { |
return HTTP::raiseError("Connection error: $estr ($eno)");
|
| return HTTP::raiseError('Unsupported protocol: '. $p['scheme']); |
}
|
| } |
|
| |
$path = !empty($p['path']) ? $p['path'] : '/';
|
| $port = isset($p['port']) ? $p['port'] : 80; |
$path .= !empty($p['query']) ? '?' . $p['query'] : '';
|
| |
|
| if (!$fp = @fsockopen($p['host'], $port, $eno, $estr, $timeout)) { |
fputs($fp, "HEAD $path HTTP/1.0\r\n");
|
| return HTTP::raiseError("Connection error: $estr ($eno)"); |
fputs($fp, 'Host: ' . $p['host'] . ':' . $port . "\r\n");
|
| } |
fputs($fp, "Connection: close\r\n\r\n");
|
| |
|
| $path = !empty($p['path']) ? $p['path'] : '/'; |
$response = rtrim(fgets($fp, 4096));
|
| $path .= !empty($p['query']) ? '?' . $p['query'] : ''; |
if (preg_match("|^HTTP/[^\s]*\s(.*?)\s|", $response, $status)) {
|
| |
$headers['response_code'] = $status[1];
|
| fputs($fp, "HEAD $path HTTP/1.0\r\n"); |
}
|
| fputs($fp, 'Host: ' . $p['host'] . ':' . $port . "\r\n"); |
$headers['response'] = $response;
|
| fputs($fp, "Connection: close\r\n\r\n"); |
|
| |
while ($line = fgets($fp, 4096)) {
|
| $response = rtrim(fgets($fp, 4096)); |
if (!trim($line)) {
|
| if (preg_match("|^HTTP/[^\s]*\s(.*?)\s|", $response, $status)) { |
break;
|
| $headers['response_code'] = $status[1]; |
}
|
| } |
if (($pos = strpos($line, ':')) !== false) {
|
| $headers['response'] = $response; |
$header = substr($line, 0, $pos);
|
| |
$value = trim(substr($line, $pos + 1));
|
| while ($line = fgets($fp, 4096)) { |
$headers[$header] = $value;
|
| if (!trim($line)) { |
}
|
| break; |
}
|
| } |
fclose($fp);
|
| if (($pos = strpos($line, ':')) !== false) { |
return $headers;
|
| $header = substr($line, 0, $pos); |
}
|
| $value = trim(substr($line, $pos + 1)); |
|
| $headers[$header] = $value; |
/**
|
| } |
* Redirect
|
| } |
*
|
| fclose($fp); |
* This function redirects the client. This is done by issuing
|
| return $headers; |
* a "Location" header and exiting if wanted. If you set $rfc2616 to true
|
| } |
* HTTP will output a hypertext note with the location of the redirect.
|
| |
*
|
| /** |
* @static
|
| * Redirect |
* @access public
|
| * |
* @return mixed Returns true on succes (or exits) or false if headers
|
| * This function redirects the client. This is done by issuing |
* have already been sent.
|
| * a "Location" header and exiting if wanted. If you set $rfc2616 to true |
* @param string $url URL where the redirect should go to.
|
| * HTTP will output a hypertext note with the location of the redirect. |
* @param bool $exit Whether to exit immediately after redirection.
|
| * |
* @param bool $rfc2616 Wheter to output a hypertext note where we're
|
| * @static |
* redirecting to (Redirecting to <a href="...">...</a>.)
|
| * @access public |
*/
|
| * @return mixed Returns true on succes (or exits) or false if headers |
function redirect($url, $exit = true, $rfc2616 = false)
|
| * have already been sent. |
{
|
| * @param string $url URL where the redirect should go to. |
if (headers_sent()) {
|
| * @param bool $exit Whether to exit immediately after redirection. |
return false;
|
| * @param bool $rfc2616 Wheter to output a hypertext note where we're |
}
|
| * redirecting to (Redirecting to <a href="...">...</a>.) |
|
| */ |
$url = HTTP::absoluteURI($url);
|
| function redirect($url, $exit = true, $rfc2616 = false) |
header('Location: '. $url);
|
| { |
|
| if (headers_sent()) { |
if ( $rfc2616 && isset($_SERVER['REQUEST_METHOD']) &&
|
| return false; |
$_SERVER['REQUEST_METHOD'] != 'HEAD') {
|
| } |
printf('Redirecting to: <a href="%s">%s</a>.', $url, $url);
|
| |
}
|
| $url = HTTP::absoluteURI($url); |
if ($exit) {
|
| header('Location: '. $url); |
exit;
|
| |
}
|
| if ( $rfc2616 && isset($_SERVER['REQUEST_METHOD']) && |
return true;
|
| $_SERVER['REQUEST_METHOD'] != 'HEAD') { |
}
|
| printf('Redirecting to: <a href="%s">%s</a>.', $url, $url); |
|
| } |
/**
|
| if ($exit) { |
* Absolute URI
|
| exit; |
*
|
| } |
* This function returns the absolute URI for the partial URL passed.
|
| return true; |
* The current scheme (HTTP/HTTPS), host server, port, current script
|
| } |
* location are used if necessary to resolve any relative URLs.
|
| |
*
|
| /** |
* Offsets potentially created by PATH_INFO are taken care of to resolve
|
| * Absolute URI |
* relative URLs to the current script.
|
| * |
*
|
| * This function returns the absolute URI for the partial URL passed. |
* You can choose a new protocol while resolving the URI. This is
|
| * The current scheme (HTTP/HTTPS), host server, port, current script |
* particularly useful when redirecting a web browser using relative URIs
|
| * location are used if necessary to resolve any relative URLs. |
* and to switch from HTTP to HTTPS, or vice-versa, at the same time.
|
| * |
*
|
| * Offsets potentially created by PATH_INFO are taken care of to resolve |
* @author Philippe Jausions <Philippe.Jausions@11abacus.com>
|
| * relative URLs to the current script. |
* @static
|
| * |
* @access public
|
| * You can choose a new protocol while resolving the URI. This is |
* @return string The absolute URI.
|
| * particularly useful when redirecting a web browser using relative URIs |
* @param string $url Absolute or relative URI the redirect should go to.
|
| * and to switch from HTTP to HTTPS, or vice-versa, at the same time. |
* @param string $protocol Protocol to use when redirecting URIs.
|
| * |
* @param integer $port A new port number.
|
| * @author Philippe Jausions <Philippe.Jausions@11abacus.com> |
*/
|
| * @static |
function absoluteURI($url = null, $protocol = null, $port = null)
|
| * @access public |
{
|
| * @return string The absolute URI. |
// filter CR/LF
|
| * @param string $url Absolute or relative URI the redirect should go to. |
$url = str_replace(array("\r", "\n"), ' ', $url);
|
| * @param string $protocol Protocol to use when redirecting URIs. |
|
| * @param integer $port A new port number. |
// Mess around with already absolute URIs
|
| */ |
if (preg_match('!^([a-z0-9]+)://!i', $url)) {
|
| function absoluteURI($url = null, $protocol = null, $port = null) |
if (empty($protocol) && empty($port)) {
|
| { |
return $url;
|
| // filter CR/LF |
}
|
| $url = str_replace(array("\r", "\n"), ' ', $url); |
if (!empty($protocol)) {
|
| |
$url = $protocol .':'. end($array = explode(':', $url, 2));
|
| // Mess around with already absolute URIs |
}
|
| if (preg_match('!^([a-z0-9]+)://!i', $url)) { |
if (!empty($port)) {
|
| if (empty($protocol) && empty($port)) { |
$url = preg_replace('!^(([a-z0-9]+)://[^/:]+)(:[\d]+)?!i',
|
| return $url; |
'\1:'. $port, $url);
|
| } |
}
|
| if (!empty($protocol)) { |
return $url;
|
| $url = $protocol .':'. array_pop(explode(':', $url, 2)); |
}
|
| } |
|
| if (!empty($port)) { |
$host = 'localhost';
|
| $url = preg_replace('!^(([a-z0-9]+)://[^/:]+)(:[\d]+)?!i', |
if (!empty($_SERVER['HTTP_HOST'])) {
|
| '\1:'. $port, $url); |
list($host) = explode(':', $_SERVER['HTTP_HOST']);
|
| } |
} elseif (!empty($_SERVER['SERVER_NAME'])) {
|
| return $url; |
list($host) = explode(':', $_SERVER['SERVER_NAME']);
|
| } |
}
|
| |
|
| $host = 'localhost'; |
if (empty($protocol)) {
|
| if (!empty($_SERVER['HTTP_HOST'])) { |
if (isset($_SERVER['HTTPS']) && !strcasecmp($_SERVER['HTTPS'], 'on')) {
|
| list($host) = explode(':', $_SERVER['HTTP_HOST']); |
$protocol = 'https';
|
| } elseif (!empty($_SERVER['SERVER_NAME'])) { |
} else {
|
| list($host) = explode(':', $_SERVER['SERVER_NAME']); |
$protocol = 'http';
|
| } |
}
|
| |
if (!isset($port) || $port != intval($port)) {
|
| if (empty($protocol)) { |
$port = isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : 80;
|
| if (isset($_SERVER['HTTPS']) && !strcasecmp($_SERVER['HTTPS'], 'on')) { |
}
|
| $protocol = 'https'; |
}
|
| } else { |
|
| $protocol = 'http'; |
if ($protocol == 'http' && $port == 80) {
|
| } |
unset($port);
|
| if (!isset($port) || $port != intval($port)) { |
}
|
| $port = isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : 80; |
if ($protocol == 'https' && $port == 443) {
|
| } |
unset($port);
|
| } |
}
|
| |
|
| if ($protocol == 'http' && $port == 80) { |
$server = $protocol .'://'. $host . (isset($port) ? ':'. $port : '');
|
| unset($port); |
|
| } |
if (!strlen($url)) {
|
| if ($protocol == 'https' && $port == 443) { |
$url = isset($_SERVER['REQUEST_URI']) ?
|
| unset($port); |
$_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF'];
|
| } |
}
|
| |
|
| $server = $protocol .'://'. $host . (isset($port) ? ':'. $port : ''); |
if ($url{0} == '/') {
|
| |
return $server . $url;
|
| if (!strlen($url)) { |
}
|
| $url = isset($_SERVER['REQUEST_URI']) ? |
|
| $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']; |
// Check for PATH_INFO
|
| } |
if (isset($_SERVER['PATH_INFO']) && strlen($_SERVER['PATH_INFO']) &&
|
| |
$_SERVER['PHP_SELF'] != $_SERVER['PATH_INFO']) {
|
| if ($url{0} == '/') { |
$path = dirname(substr($_SERVER['PHP_SELF'], 0, -strlen($_SERVER['PATH_INFO'])));
|
| return $server . $url; |
} else {
|
| } |
$path = dirname($_SERVER['PHP_SELF']);
|
| |
}
|
| // Check for PATH_INFO |
|
| if (isset($_SERVER['PATH_INFO']) && strlen($_SERVER['PATH_INFO']) && |
if (substr($path = strtr($path, '\\', '/'), -1) != '/') {
|
| $_SERVER['PHP_SELF'] != $_SERVER['PATH_INFO']) { |
$path .= '/';
|
| $path = dirname(substr($_SERVER['PHP_SELF'], 0, -strlen($_SERVER['PATH_INFO']))); |
}
|
| } else { |
|
| $path = dirname($_SERVER['PHP_SELF']); |
return $server . $path . $url;
|
| } |
}
|
| |
|
| if (substr($path = strtr($path, '\\', '/'), -1) != '/') { |
/**
|
| $path .= '/'; |
* Raise Error
|
| } |
*
|
| |
* Lazy raising of PEAR_Errors.
|
| return $server . $path . $url; |
*
|
| } |
* @static
|
| |
* @access protected
|
| /** |
* @return object PEAR_Error
|
| * Raise Error |
* @param mixed $error
|
| * |
* @param int $code
|
| * Lazy raising of PEAR_Errors. |
*/
|
| * |
function raiseError($error = null, $code = null)
|
| * @static |
{
|
| * @access protected |
require_once 'PEAR.php';
|
| * @return object PEAR_Error |
return PEAR::raiseError($error, $code);
|
| * @param mixed $error |
}
|
| * @param int $code |
}
|
| */ |
|
| function raiseError($error = null, $code = null) |
?>
|
| { |
|
| require_once 'PEAR.php'; |
|
| return PEAR::raiseError($error, $code); |
|
| } |
|
| } |
|
| |
|
| ?> |
|