File indexing completed on 2024-12-22 05:36:33

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Controller
0017  * @subpackage Zend_Controller_Plugin
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  * @version    $Id$
0021  */
0022 
0023 /**
0024  * @see Zend_Controller_Plugin_Abstract
0025  */
0026 // require_once 'Zend/Controller/Plugin/Abstract.php';
0027 
0028 /**
0029  * @see Zend_Controller_Request_Http
0030  */
0031 // require_once 'Zend/Controller/Request/Http.php';
0032 
0033 /**
0034  * Plugin to digest PUT request body and make params available just like POST
0035  *
0036  * @package    Zend_Controller
0037  * @subpackage Zend_Controller_Plugin
0038  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0039  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0040  */
0041 class Zend_Controller_Plugin_PutHandler extends Zend_Controller_Plugin_Abstract
0042 {
0043     /**
0044      * Before dispatching, digest PUT request body and set params
0045      *
0046      * @param Zend_Controller_Request_Abstract $request
0047      */
0048     public function preDispatch(Zend_Controller_Request_Abstract $request)
0049     {
0050         if (!$request instanceof Zend_Controller_Request_Http) {
0051             return;
0052         }
0053 
0054         if ($this->_request->isPut()) {
0055             $putParams = array();
0056             parse_str($this->_request->getRawBody(), $putParams);
0057             $request->setParams($putParams);
0058         }
0059     }
0060 }