adding zend project folders into old campcaster.

This commit is contained in:
naomiaro 2010-12-07 14:19:27 -05:00
parent 56abfaf28e
commit 7ef0c18b26
4045 changed files with 1054952 additions and 0 deletions

View file

@ -0,0 +1,356 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Controller
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @category Zend
* @package Zend_Controller
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Controller_Request_Abstract
{
/**
* Has the action been dispatched?
* @var boolean
*/
protected $_dispatched = false;
/**
* Module
* @var string
*/
protected $_module;
/**
* Module key for retrieving module from params
* @var string
*/
protected $_moduleKey = 'module';
/**
* Controller
* @var string
*/
protected $_controller;
/**
* Controller key for retrieving controller from params
* @var string
*/
protected $_controllerKey = 'controller';
/**
* Action
* @var string
*/
protected $_action;
/**
* Action key for retrieving action from params
* @var string
*/
protected $_actionKey = 'action';
/**
* Request parameters
* @var array
*/
protected $_params = array();
/**
* Retrieve the module name
*
* @return string
*/
public function getModuleName()
{
if (null === $this->_module) {
$this->_module = $this->getParam($this->getModuleKey());
}
return $this->_module;
}
/**
* Set the module name to use
*
* @param string $value
* @return Zend_Controller_Request_Abstract
*/
public function setModuleName($value)
{
$this->_module = $value;
return $this;
}
/**
* Retrieve the controller name
*
* @return string
*/
public function getControllerName()
{
if (null === $this->_controller) {
$this->_controller = $this->getParam($this->getControllerKey());
}
return $this->_controller;
}
/**
* Set the controller name to use
*
* @param string $value
* @return Zend_Controller_Request_Abstract
*/
public function setControllerName($value)
{
$this->_controller = $value;
return $this;
}
/**
* Retrieve the action name
*
* @return string
*/
public function getActionName()
{
if (null === $this->_action) {
$this->_action = $this->getParam($this->getActionKey());
}
return $this->_action;
}
/**
* Set the action name
*
* @param string $value
* @return Zend_Controller_Request_Abstract
*/
public function setActionName($value)
{
$this->_action = $value;
/**
* @see ZF-3465
*/
if (null === $value) {
$this->setParam($this->getActionKey(), $value);
}
return $this;
}
/**
* Retrieve the module key
*
* @return string
*/
public function getModuleKey()
{
return $this->_moduleKey;
}
/**
* Set the module key
*
* @param string $key
* @return Zend_Controller_Request_Abstract
*/
public function setModuleKey($key)
{
$this->_moduleKey = (string) $key;
return $this;
}
/**
* Retrieve the controller key
*
* @return string
*/
public function getControllerKey()
{
return $this->_controllerKey;
}
/**
* Set the controller key
*
* @param string $key
* @return Zend_Controller_Request_Abstract
*/
public function setControllerKey($key)
{
$this->_controllerKey = (string) $key;
return $this;
}
/**
* Retrieve the action key
*
* @return string
*/
public function getActionKey()
{
return $this->_actionKey;
}
/**
* Set the action key
*
* @param string $key
* @return Zend_Controller_Request_Abstract
*/
public function setActionKey($key)
{
$this->_actionKey = (string) $key;
return $this;
}
/**
* Get an action parameter
*
* @param string $key
* @param mixed $default Default value to use if key not found
* @return mixed
*/
public function getParam($key, $default = null)
{
$key = (string) $key;
if (isset($this->_params[$key])) {
return $this->_params[$key];
}
return $default;
}
/**
* Retrieve only user params (i.e, any param specific to the object and not the environment)
*
* @return array
*/
public function getUserParams()
{
return $this->_params;
}
/**
* Retrieve a single user param (i.e, a param specific to the object and not the environment)
*
* @param string $key
* @param string $default Default value to use if key not found
* @return mixed
*/
public function getUserParam($key, $default = null)
{
if (isset($this->_params[$key])) {
return $this->_params[$key];
}
return $default;
}
/**
* Set an action parameter
*
* A $value of null will unset the $key if it exists
*
* @param string $key
* @param mixed $value
* @return Zend_Controller_Request_Abstract
*/
public function setParam($key, $value)
{
$key = (string) $key;
if ((null === $value) && isset($this->_params[$key])) {
unset($this->_params[$key]);
} elseif (null !== $value) {
$this->_params[$key] = $value;
}
return $this;
}
/**
* Get all action parameters
*
* @return array
*/
public function getParams()
{
return $this->_params;
}
/**
* Set action parameters en masse; does not overwrite
*
* Null values will unset the associated key.
*
* @param array $array
* @return Zend_Controller_Request_Abstract
*/
public function setParams(array $array)
{
$this->_params = $this->_params + (array) $array;
foreach ($this->_params as $key => $value) {
if (null === $value) {
unset($this->_params[$key]);
}
}
return $this;
}
/**
* Unset all user parameters
*
* @return Zend_Controller_Request_Abstract
*/
public function clearParams()
{
$this->_params = array();
return $this;
}
/**
* Set flag indicating whether or not request has been dispatched
*
* @param boolean $flag
* @return Zend_Controller_Request_Abstract
*/
public function setDispatched($flag = true)
{
$this->_dispatched = $flag ? true : false;
return $this;
}
/**
* Determine if the request has been dispatched
*
* @return boolean
*/
public function isDispatched()
{
return $this->_dispatched;
}
}

View file

@ -0,0 +1,82 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Controller
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Apache404.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Controller_Request_Http */
require_once 'Zend/Controller/Request/Http.php';
/** Zend_Uri */
require_once 'Zend/Uri.php';
/**
* Zend_Controller_Request_Apache404
*
* HTTP request object for use with Zend_Controller family. Extends basic HTTP
* request object to allow for two edge cases when using Apache:
* - Using Apache's 404 handler instead of mod_rewrite to direct requests
* - Using the PT flag in rewrite rules
*
* In each case, the URL to check against is found in REDIRECT_URL, not
* REQUEST_URI.
*
* @uses Zend_Controller_Request_Http
* @package Zend_Controller
* @subpackage Request
*/
class Zend_Controller_Request_Apache404 extends Zend_Controller_Request_Http
{
public function setRequestUri($requestUri = null)
{
$parseUriGetVars = false;
if ($requestUri === null) {
if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { // check this first so IIS will catch
$requestUri = $_SERVER['HTTP_X_REWRITE_URL'];
} elseif (isset($_SERVER['REDIRECT_URL'])) { // Check if using mod_rewrite
$requestUri = $_SERVER['REDIRECT_URL'];
if (isset($_SERVER['REDIRECT_QUERYSTRING'])) {
$parseUriGetVars = $_SERVER['REDIRECT_QUERYSTRING'];
}
} elseif (isset($_SERVER['REQUEST_URI'])) {
$requestUri = $_SERVER['REQUEST_URI'];
} elseif (isset($_SERVER['ORIG_PATH_INFO'])) { // IIS 5.0, PHP as CGI
$requestUri = $_SERVER['ORIG_PATH_INFO'];
if (!empty($_SERVER['QUERY_STRING'])) {
$requestUri .= '?' . $_SERVER['QUERY_STRING'];
}
} else {
return $this;
}
} elseif (!is_string($requestUri)) {
return $this;
} else {
if (false !== ($pos = strpos($requestUri, '?'))) {
$parseUriGetVars = substr($requestUri, $pos + 1);
}
}
if ($parseUriGetVars) {
// Set GET items, if available
parse_str($parseUriGetVars, $_GET);
}
$this->_requestUri = $requestUri;
return $this;
}
}

View file

@ -0,0 +1,37 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Controller
* @subpackage Request
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Controller_Exception */
require_once 'Zend/Controller/Exception.php';
/**
* @category Zend
* @package Zend_Controller
* @subpackage Request
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Controller_Request_Exception extends Zend_Controller_Exception
{}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,276 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Controller
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: HttpTestCase.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Controller_Request_Http
*/
require_once 'Zend/Controller/Request/Http.php';
/**
* Zend_Controller_Request_HttpTestCase
*
* HTTP request object for use with Zend_Controller family.
*
* @uses Zend_Controller_Request_Http
* @package Zend_Controller
* @subpackage Request
*/
class Zend_Controller_Request_HttpTestCase extends Zend_Controller_Request_Http
{
/**
* Request headers
* @var array
*/
protected $_headers = array();
/**
* Request method
* @var string
*/
protected $_method = 'GET';
/**
* Raw POST body
* @var string|null
*/
protected $_rawBody;
/**
* Valid request method types
* @var array
*/
protected $_validMethodTypes = array(
'DELETE',
'GET',
'HEAD',
'OPTIONS',
'POST',
'PUT',
);
/**
* Clear GET values
*
* @return Zend_Controller_Request_HttpTestCase
*/
public function clearQuery()
{
$_GET = array();
return $this;
}
/**
* Clear POST values
*
* @return Zend_Controller_Request_HttpTestCase
*/
public function clearPost()
{
$_POST = array();
return $this;
}
/**
* Set raw POST body
*
* @param string $content
* @return Zend_Controller_Request_HttpTestCase
*/
public function setRawBody($content)
{
$this->_rawBody = (string) $content;
return $this;
}
/**
* Get RAW POST body
*
* @return string|null
*/
public function getRawBody()
{
return $this->_rawBody;
}
/**
* Clear raw POST body
*
* @return Zend_Controller_Request_HttpTestCase
*/
public function clearRawBody()
{
$this->_rawBody = null;
return $this;
}
/**
* Set a cookie
*
* @param string $key
* @param mixed $value
* @return Zend_Controller_Request_HttpTestCase
*/
public function setCookie($key, $value)
{
$_COOKIE[(string) $key] = $value;
return $this;
}
/**
* Set multiple cookies at once
*
* @param array $cookies
* @return void
*/
public function setCookies(array $cookies)
{
foreach ($cookies as $key => $value) {
$_COOKIE[$key] = $value;
}
return $this;
}
/**
* Clear all cookies
*
* @return Zend_Controller_Request_HttpTestCase
*/
public function clearCookies()
{
$_COOKIE = array();
return $this;
}
/**
* Set request method
*
* @param string $type
* @return Zend_Controller_Request_HttpTestCase
*/
public function setMethod($type)
{
$type = strtoupper(trim((string) $type));
if (!in_array($type, $this->_validMethodTypes)) {
require_once 'Zend/Controller/Exception.php';
throw new Zend_Controller_Exception('Invalid request method specified');
}
$this->_method = $type;
return $this;
}
/**
* Get request method
*
* @return string|null
*/
public function getMethod()
{
return $this->_method;
}
/**
* Set a request header
*
* @param string $key
* @param string $value
* @return Zend_Controller_Request_HttpTestCase
*/
public function setHeader($key, $value)
{
$key = $this->_normalizeHeaderName($key);
$this->_headers[$key] = (string) $value;
return $this;
}
/**
* Set request headers
*
* @param array $headers
* @return Zend_Controller_Request_HttpTestCase
*/
public function setHeaders(array $headers)
{
foreach ($headers as $key => $value) {
$this->setHeader($key, $value);
}
return $this;
}
/**
* Get request header
*
* @param string $header
* @param mixed $default
* @return string|null
*/
public function getHeader($header, $default = null)
{
$header = $this->_normalizeHeaderName($header);
if (array_key_exists($header, $this->_headers)) {
return $this->_headers[$header];
}
return $default;
}
/**
* Get all request headers
*
* @return array
*/
public function getHeaders()
{
return $this->_headers;
}
/**
* Clear request headers
*
* @return Zend_Controller_Request_HttpTestCase
*/
public function clearHeaders()
{
$this->_headers = array();
return $this;
}
/**
* Get REQUEST_URI
*
* @return null|string
*/
public function getRequestUri()
{
return $this->_requestUri;
}
/**
* Normalize a header name for setting and retrieval
*
* @param string $name
* @return string
*/
protected function _normalizeHeaderName($name)
{
$name = strtoupper((string) $name);
$name = str_replace('-', '_', $name);
return $name;
}
}

View file

@ -0,0 +1,55 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Controller
* @subpackage Request
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Simple.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Controller_Request_Abstract */
require_once 'Zend/Controller/Request/Abstract.php';
/**
* @category Zend
* @package Zend_Controller
* @subpackage Request
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Controller_Request_Simple extends Zend_Controller_Request_Abstract
{
public function __construct($action = null, $controller = null, $module = null, array $params = array())
{
if ($action) {
$this->setActionName($action);
}
if ($controller) {
$this->setControllerName($controller);
}
if ($module) {
$this->setModuleName($module);
}
if ($params) {
$this->setParams($params);
}
}
}