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

@ -19,18 +19,11 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Controller_Exception
*/
require_once 'Zend/Controller/Action/Exception.php';
/**
* @see Zend_Controller_Action
*/
require_once 'Zend/Controller/Action.php';
/**
* @category Zend
* @package Zend_Controller
@ -76,7 +69,7 @@ abstract class Zend_Controller_Action_Helper_Abstract
/**
* Retrieve front controller instance
*
*
* @return Zend_Controller_Front
*/
public function getFrontController()

View File

@ -17,7 +17,7 @@
* @subpackage Zend_Controller_Action_Helper
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: ContextSwitch.php 12315 2008-11-05 22:31:23Z sidhighwind $
* @version $Id: ContextSwitch.php 12811 2008-11-24 20:44:26Z matthew $
*/
/**
@ -114,6 +114,12 @@ class Zend_Controller_Action_Helper_ContextSwitch extends Zend_Controller_Action
*/
protected $_viewRenderer;
/**
* Original view suffix prior to detecting context switch
* @var string
*/
protected $_viewSuffixOrig;
/**
* Constructor
*
@ -144,6 +150,25 @@ class Zend_Controller_Action_Helper_ContextSwitch extends Zend_Controller_Action
)
));
}
$this->init();
}
/**
* Initialize at start of action controller
*
* Reset the view script suffix to the original state, or store the
* original state.
*
* @return void
*/
public function init()
{
if (null === $this->_viewSuffixOrig) {
$this->_viewSuffixOrig = $this->_getViewRenderer()->getViewSuffix();
} else {
$this->_getViewRenderer()->setViewSuffix($this->_viewSuffixOrig);
}
}
/**
@ -248,6 +273,7 @@ class Zend_Controller_Action_Helper_ContextSwitch extends Zend_Controller_Action
}
$suffix = $this->getSuffix($context);
$this->_getViewRenderer()->setViewSuffix($suffix);
$headers = $this->getHeaders($context);

View File

@ -17,7 +17,7 @@
* @subpackage Zend_Controller_Action_Helper
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Json.php 9098 2008-03-30 19:29:10Z thomas $
* @version $Id: Json.php 15052 2009-04-21 15:34:02Z matthew $
*/
/**
@ -46,12 +46,19 @@ class Zend_Controller_Action_Helper_Json extends Zend_Controller_Action_Helper_A
/**
* Create JSON response
*
* Encodes and returns data to JSON. Content-Type header set to
* 'application/json', and disables layouts and viewRenderer (if being
* Encodes and returns data to JSON. Content-Type header set to
* 'application/json', and disables layouts and viewRenderer (if being
* used).
*
* @param mixed $data
* @param boolean $keepLayouts
* @param boolean|array $keepLayouts
* NOTE: if boolean, establish $keepLayouts to true|false
* if array, admit params for Zend_Json::encode as enableJsonExprFinder=>true|false
* if $keepLayouts and parmas for Zend_Json::encode are required
* then, the array can contains a 'keepLayout'=>true|false
* that will not be passed to Zend_Json::encode method but will be passed
* to Zend_View_Helper_Json
* @throws Zend_Controller_Action_Helper_Json
* @return string
*/
@ -77,9 +84,15 @@ class Zend_Controller_Action_Helper_Json extends Zend_Controller_Action_Helper_A
/**
* Encode JSON response and immediately send
*
* @param mixed $data
* @param boolean $keepLayouts
*
* @param mixed $data
* @param boolean|array $keepLayouts
* NOTE: if boolean, establish $keepLayouts to true|false
* if array, admit params for Zend_Json::encode as enableJsonExprFinder=>true|false
* if $keepLayouts and parmas for Zend_Json::encode are required
* then, the array can contains a 'keepLayout'=>true|false
* that will not be passed to Zend_Json::encode method but will be passed
* to Zend_View_Helper_Json
* @return string|void
*/
public function sendJson($data, $keepLayouts = false)
@ -99,12 +112,12 @@ class Zend_Controller_Action_Helper_Json extends Zend_Controller_Action_Helper_A
/**
* Strategy pattern: call helper as helper broker method
*
* Allows encoding JSON. If $sendNow is true, immediately sends JSON
* response.
*
* @param mixed $data
* @param boolean $sendNow
* @param boolean $keepLayouts
* Allows encoding JSON. If $sendNow is true, immediately sends JSON
* response.
*
* @param mixed $data
* @param boolean $sendNow
* @param boolean $keepLayouts
* @return string|void
*/
public function direct($data, $sendNow = true, $keepLayouts = false)

View File

@ -19,11 +19,6 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Controller_Action_Exception
*/
require_once 'Zend/Controller/Action/Exception.php';
/**
* @see Zend_Controller_Action_Helper_Abstract
*/
@ -69,6 +64,12 @@ class Zend_Controller_Action_Helper_Redirector extends Zend_Controller_Action_He
*/
protected $_useAbsoluteUri = false;
/**
* Whether or not to close the session before exiting
* @var boolean
*/
protected $_closeSessionOnExit = true;
/**
* Retrieve HTTP status code to emit on {@link _redirect()} call
*
@ -90,10 +91,7 @@ class Zend_Controller_Action_Helper_Redirector extends Zend_Controller_Action_He
{
$code = (int)$code;
if ((300 > $code) || (307 < $code) || (304 == $code) || (306 == $code)) {
/**
* @see Zend_Controller_Exception
*/
require_once 'Zend/Controller/Exception.php';
require_once 'Zend/Controller/Action/Exception.php';
throw new Zend_Controller_Action_Exception('Invalid redirect HTTP status code (' . $code . ')');
}
@ -158,6 +156,29 @@ class Zend_Controller_Action_Helper_Redirector extends Zend_Controller_Action_He
return $this;
}
/**
* Retrieve flag for whether or not {@link redirectAndExit()} shall close the session before
* exiting.
*
* @return boolean
*/
public function getCloseSessionOnExit()
{
return $this->_closeSessionOnExit;
}
/**
* Set flag for whether or not {@link redirectAndExit()} shall close the session before exiting.
*
* @param boolean $flag
* @return Zend_Controller_Action_Helper_Redirector Provides a fluent interface
*/
public function setCloseSessionOnExit($flag)
{
$this->_closeSessionOnExit = ($flag) ? true : false;
return $this;
}
/**
* Return use absolute URI flag
*
@ -256,8 +277,8 @@ class Zend_Controller_Action_Helper_Redirector extends Zend_Controller_Action_He
if (null === $module) {
$module = $curModule;
}
}
if ($module == $dispatcher->getDefaultModule()) {
$module = '';
}
@ -325,9 +346,6 @@ class Zend_Controller_Action_Helper_Redirector extends Zend_Controller_Action_He
// prevent header injections
$url = str_replace(array("\n", "\r"), '', $url);
$exit = $this->getExit();
$prependBase = $this->getPrependBase();
$code = $this->getCode();
if (null !== $options) {
if (isset($options['exit'])) {
$this->setExit(($options['exit']) ? true : false);
@ -455,11 +473,13 @@ class Zend_Controller_Action_Helper_Redirector extends Zend_Controller_Action_He
*/
public function redirectAndExit()
{
// Close session, if started
if (class_exists('Zend_Session', false) && Zend_Session::isStarted()) {
Zend_Session::writeClose();
} elseif (isset($_SESSION)) {
session_write_close();
if ($this->getCloseSessionOnExit()) {
// Close session, if started
if (class_exists('Zend_Session', false) && Zend_Session::isStarted()) {
Zend_Session::writeClose();
} elseif (isset($_SESSION)) {
session_write_close();
}
}
$this->getResponse()->sendHeaders();
@ -485,9 +505,9 @@ class Zend_Controller_Action_Helper_Redirector extends Zend_Controller_Action_He
* Overloading
*
* Overloading for old 'goto', 'setGoto', and 'gotoAndExit' methods
*
* @param string $method
* @param array $args
*
* @param string $method
* @param array $args
* @return mixed
* @throws Zend_Controller_Action_Exception for invalid methods
*/

View File

@ -281,7 +281,7 @@ class Zend_Controller_Action_Helper_ViewRenderer extends Zend_Controller_Action_
$this->_inflector->setStaticRuleReference('moduleDir', $this->_moduleDir) // moduleDir must be specified before the less specific 'module'
->addRules(array(
':module' => array('Word_CamelCaseToDash', 'StringToLower'),
':controller' => array('Word_CamelCaseToDash', new Zend_Filter_Word_UnderscoreToSeparator('/'), 'StringToLower'),
':controller' => array('Word_CamelCaseToDash', new Zend_Filter_Word_UnderscoreToSeparator('/'), 'StringToLower', new Zend_Filter_PregReplace('/\./', '-')),
':action' => array('Word_CamelCaseToDash', new Zend_Filter_PregReplace('#[^a-z0-9' . preg_quote('/', '#') . ']+#i', '-'), 'StringToLower'),
))
->setStaticRuleReference('suffix', $this->_viewSuffix)
@ -391,7 +391,7 @@ class Zend_Controller_Action_Helper_ViewRenderer extends Zend_Controller_Action_
$parts = array(
'module' => (($moduleName = $request->getModuleName()) != '') ? $dispatcher->formatModuleName($moduleName) : $moduleName,
'controller' => substr($dispatcher->formatControllerName($request->getControllerName()), 0, -10),
'controller' => $request->getControllerName(),
'action' => $dispatcher->formatActionName($request->getActionName())
);
@ -844,7 +844,7 @@ class Zend_Controller_Action_Helper_ViewRenderer extends Zend_Controller_Action_
$request = $this->getRequest();
$dispatcher = $this->_frontController->getDispatcher();
$module = $dispatcher->formatModuleName($request->getModuleName());
$controller = substr($dispatcher->formatControllerName($request->getControllerName()), 0, -10);
$controller = $request->getControllerName();
$action = $dispatcher->formatActionName($request->getActionName());
$params = compact('module', 'controller', 'action');

View File

@ -0,0 +1,68 @@
<?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 Zend_Controller_Action
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @category Zend
* @package Zend_Controller
* @subpackage Zend_Controller_Action
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Controller_Action_Interface
{
/**
* Class constructor
*
* The request and response objects should be registered with the
* controller, as should be any additional optional arguments; these will be
* available via {@link getRequest()}, {@link getResponse()}, and
* {@link getInvokeArgs()}, respectively.
*
* When overriding the constructor, please consider this usage as a best
* practice and ensure that each is registered appropriately; the easiest
* way to do so is to simply call parent::__construct($request, $response,
* $invokeArgs).
*
* After the request, response, and invokeArgs are set, the
* {@link $_helper helper broker} is initialized.
*
* Finally, {@link init()} is called as the final action of
* instantiation, and may be safely overridden to perform initialization
* tasks; as a general rule, override {@link init()} instead of the
* constructor to customize an action controller's instantiation.
*
* @param Zend_Controller_Request_Abstract $request
* @param Zend_Controller_Response_Abstract $response
* @param array $invokeArgs Any additional invocation arguments
* @return void
*/
public function __construct(Zend_Controller_Request_Abstract $request,
Zend_Controller_Response_Abstract $response,
array $invokeArgs = array());
/**
* Dispatch the requested action
*
* @param string $action Method name of action
* @return void
*/
public function dispatch($action);
}