import v1.1.0_beta1 | 2009-08-21

This commit is contained in:
2019-07-17 22:16:19 +02:00
parent 2c1152f0d3
commit 8dee6b1a10
2306 changed files with 251360 additions and 23428 deletions

View File

@ -63,12 +63,12 @@ class Zend_Cache_Frontend_Page extends Zend_Cache_Core
* - (boolean) makeIdWithXXXVariables (XXXX = 'Get', 'Post', 'Session', 'Files' or 'Cookie') :
* if true, we have to use the content of this superglobal array to make a cache id
* if false, the cache id won't be dependent of the content of this superglobal array
* - (int) specific_lifetime : cache specific lifetime
* (false => global lifetime is used, null => infinite lifetime,
* integer => this lifetime is used), this "lifetime" is probably only
* - (int) specific_lifetime : cache specific lifetime
* (false => global lifetime is used, null => infinite lifetime,
* integer => this lifetime is used), this "lifetime" is probably only
* usefull when used with "regexps" array
* - (array) tags : array of tags (strings)
* - (int) priority : integer between 0 (very low priority) and 10 (maximum priority) used by
* - (array) tags : array of tags (strings)
* - (int) priority : integer between 0 (very low priority) and 10 (maximum priority) used by
* some particular backends
*
* ====> (array) regexps :
@ -116,7 +116,7 @@ class Zend_Cache_Frontend_Page extends Zend_Cache_Core
*
* @var boolean
*/
private $_cancel = false;
protected $_cancel = false;
/**
* Constructor
@ -131,17 +131,17 @@ class Zend_Cache_Frontend_Page extends Zend_Cache_Core
while (list($name, $value) = each($options)) {
$name = strtolower($name);
switch ($name) {
case 'regexps':
$this->_setRegexps($value);
break;
case 'default_options':
$this->_setDefaultOptions($value);
break;
case 'content_type_memorization':
$this->_setContentTypeMemorization($value);
break;
default:
$this->setOption($name, $value);
case 'regexps':
$this->_setRegexps($value);
break;
case 'default_options':
$this->_setDefaultOptions($value);
break;
case 'content_type_memorization':
$this->_setContentTypeMemorization($value);
break;
default:
$this->setOption($name, $value);
}
}
if (isset($this->_specificOptions['http_conditional'])) {
@ -165,10 +165,11 @@ class Zend_Cache_Frontend_Page extends Zend_Cache_Core
Zend_Cache::throwException('default_options must be an array !');
}
foreach ($options as $key=>$value) {
if (!is_string($key)) {
Zend_Cache::throwException("invalid option [$key] !");
}
$key = strtolower($key);
if (!isset($this->_specificOptions['default_options'][$key])) {
Zend_Cache::throwException("unknown option [$key] !");
} else {
if (isset($this->_specificOptions['default_options'][$key])) {
$this->_specificOptions['default_options'][$key] = $value;
}
}
@ -218,9 +219,12 @@ class Zend_Cache_Frontend_Page extends Zend_Cache_Core
}
$validKeys = array_keys($this->_specificOptions['default_options']);
foreach ($conf as $key=>$value) {
if (!is_string($key)) {
Zend_Cache::throwException("unknown option [$key] !");
}
$key = strtolower($key);
if (!in_array($key, $validKeys)) {
Zend_Cache::throwException("unknown option [$key] !");
unset($regexps[$regexp][$key]);
}
}
}
@ -244,7 +248,7 @@ class Zend_Cache_Frontend_Page extends Zend_Cache_Core
}
}
$this->_activeOptions = $this->_specificOptions['default_options'];
if (!is_null($lastMatchingRegexp)) {
if ($lastMatchingRegexp !== null) {
$conf = $this->_specificOptions['regexps'][$lastMatchingRegexp];
foreach ($conf as $key=>$value) {
$this->_activeOptions[$key] = $value;
@ -263,15 +267,15 @@ class Zend_Cache_Frontend_Page extends Zend_Cache_Core
if ($array !== false) {
$data = $array['data'];
$headers = $array['headers'];
if ($this->_specificOptions['debug_header']) {
echo 'DEBUG HEADER : This is a cached page !';
}
if (!headers_sent()) {
foreach ($headers as $key=>$headerCouple) {
$name = $headerCouple[0];
$value = $headerCouple[1];
header("$name: $value");
}
}
if ($this->_specificOptions['debug_header']) {
echo 'DEBUG HEADER : This is a cached page !';
}
echo $data;
if ($doNotDie) {
@ -316,7 +320,7 @@ class Zend_Cache_Frontend_Page extends Zend_Cache_Core
$storedHeaders[] = array($headerSentName, $headerSentValue);
}
}
}
}
$array = array(
'data' => $data,
'headers' => $storedHeaders
@ -333,8 +337,10 @@ class Zend_Cache_Frontend_Page extends Zend_Cache_Core
protected function _makeId()
{
$tmp = $_SERVER['REQUEST_URI'];
$array = explode('?', $tmp, 2);
$tmp = $array[0];
foreach (array('Get', 'Post', 'Session', 'Files', 'Cookie') as $arrayName) {
$tmp2 = $this->_makePartialId($arrayName, $this->_activeOptions['cache_with_' . strtolower($arrayName) . '_variables'], $this->_activeOptions['make_id_with_' . strtolower($arrayName) . '_variables']);
$tmp2 = $this->_makePartialId($arrayName, $this->_activeOptions['cache_with_' . strtolower($arrayName) . '_variables'], $this->_activeOptions['make_id_with_' . strtolower($arrayName) . '_variables']);
if ($tmp2===false) {
return false;
}
@ -353,7 +359,7 @@ class Zend_Cache_Frontend_Page extends Zend_Cache_Core
*/
protected function _makePartialId($arrayName, $bool1, $bool2)
{
switch ($arrayName) {
switch ($arrayName) {
case 'Get':
$var = $_GET;
break;