"Fossies" - the Fresh Open Source Software Archive

Member "icingaweb2-2.11.4/library/vendor/Zend/Controller/Action/Helper/Abstract.php" (26 Jan 2023, 3777 Bytes) of package /linux/www/icingaweb2-2.11.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 <?php
    2 /**
    3  * Zend Framework
    4  *
    5  * LICENSE
    6  *
    7  * This source file is subject to the new BSD license that is bundled
    8  * with this package in the file LICENSE.txt.
    9  * It is also available through the world-wide-web at this URL:
   10  * http://framework.zend.com/license/new-bsd
   11  * If you did not receive a copy of the license and are unable to
   12  * obtain it through the world-wide-web, please send an email
   13  * to license@zend.com so we can send you a copy immediately.
   14  *
   15  * @category   Zend
   16  * @package    Zend_Controller
   17  * @subpackage Zend_Controller_Action_Helper
   18  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
   19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
   20  * @version    $Id$
   21  */
   22 
   23 /**
   24  * @see Zend_Controller_Action
   25  */
   26 
   27 /**
   28  * @category   Zend
   29  * @package    Zend_Controller
   30  * @subpackage Zend_Controller_Action_Helper
   31  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
   32  * @license    http://framework.zend.com/license/new-bsd     New BSD License
   33  */
   34 abstract class Zend_Controller_Action_Helper_Abstract
   35 {
   36     /**
   37      * $_actionController
   38      *
   39      * @var Zend_Controller_Action $_actionController
   40      */
   41     protected $_actionController = null;
   42 
   43     /**
   44      * @var mixed $_frontController
   45      */
   46     protected $_frontController = null;
   47 
   48     /**
   49      * setActionController()
   50      *
   51      * @param  Zend_Controller_Action $actionController
   52      * @return Zend_Controller_ActionHelper_Abstract Provides a fluent interface
   53      */
   54     public function setActionController(Zend_Controller_Action $actionController = null)
   55     {
   56         $this->_actionController = $actionController;
   57         return $this;
   58     }
   59 
   60     /**
   61      * Retrieve current action controller
   62      *
   63      * @return Zend_Controller_Action
   64      */
   65     public function getActionController()
   66     {
   67         return $this->_actionController;
   68     }
   69 
   70     /**
   71      * Retrieve front controller instance
   72      *
   73      * @return Zend_Controller_Front
   74      */
   75     public function getFrontController()
   76     {
   77         return Zend_Controller_Front::getInstance();
   78     }
   79 
   80     /**
   81      * Hook into action controller initialization
   82      *
   83      * @return void
   84      */
   85     public function init()
   86     {
   87     }
   88 
   89     /**
   90      * Hook into action controller preDispatch() workflow
   91      *
   92      * @return void
   93      */
   94     public function preDispatch()
   95     {
   96     }
   97 
   98     /**
   99      * Hook into action controller postDispatch() workflow
  100      *
  101      * @return void
  102      */
  103     public function postDispatch()
  104     {
  105     }
  106 
  107     /**
  108      * getRequest() -
  109      *
  110      * @return Zend_Controller_Request_Abstract $request
  111      */
  112     public function getRequest()
  113     {
  114         $controller = $this->getActionController();
  115         if (null === $controller) {
  116             $controller = $this->getFrontController();
  117         }
  118 
  119         return $controller->getRequest();
  120     }
  121 
  122     /**
  123      * getResponse() -
  124      *
  125      * @return Zend_Controller_Response_Abstract $response
  126      */
  127     public function getResponse()
  128     {
  129         $controller = $this->getActionController();
  130         if (null === $controller) {
  131             $controller = $this->getFrontController();
  132         }
  133 
  134         return $controller->getResponse();
  135     }
  136 
  137     /**
  138      * getName()
  139      *
  140      * @return string
  141      */
  142     public function getName()
  143     {
  144         $fullClassName = get_class($this);
  145         if (strpos($fullClassName, '_') !== false) {
  146             $helperName = strrchr($fullClassName, '_');
  147             return ltrim($helperName, '_');
  148         } elseif (strpos($fullClassName, '\\') !== false) {
  149             $helperName = strrchr($fullClassName, '\\');
  150             return ltrim($helperName, '\\');
  151         } else {
  152             return $fullClassName;
  153         }
  154     }
  155 }