Development

/branches/1.1/lib/plugins/sfCompat10Plugin/lib/filter/sfFillInFormFilter.class.php

You must first sign up to be able to contribute.

root/branches/1.1/lib/plugins/sfCompat10Plugin/lib/filter/sfFillInFormFilter.class.php

Revision 10270, 2.1 kB (checked in by Carl.Vondrick, 6 years ago)

1.1: added deprecated warnings to all sfCompatPlugin classes (closes #3882)

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 <?php
2
3 /*
4  * This file is part of the symfony package.
5  * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 /**
12  * sfFillInFormFilter fills in forms.
13  *
14  * WARNING: This class is deprecated and will be removed in symfony 1.2.
15  *
16  * @package    symfony
17  * @subpackage filter
18  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
19  * @version    SVN: $Id$
20  * @deprecated Deprecated since symfony 1.1
21  */
22 class sfFillInFormFilter extends sfFilter
23 {
24   /**
25    * Executes this filter.
26    *
27    * @param sfFilterChain A sfFilterChain instance
28    */
29   public function execute($filterChain)
30   {
31     // execute next filter
32     $filterChain->execute();
33
34     $response = $this->context->getResponse();
35     $request  = $this->context->getRequest();
36
37     $fillInForm = new sfFillInForm();
38
39     // converters
40     foreach ($this->getParameter('converters', array()) as $functionName => $fields)
41     {
42       $fillInForm->addConverter($functionName, $fields);
43     }
44
45     // skip fields
46     $fillInForm->setSkipFields((array) $this->getParameter('skip_fields', array()));
47
48     // types
49     $excludeTypes = (array) $this->getParameter('exclude_types', array('hidden', 'password'));
50     $checkTypes   = (array) $this->getParameter('check_types',   array('text', 'checkbox', 'radio', 'password', 'hidden'));
51     $fillInForm->setTypes(array_diff($checkTypes, $excludeTypes));
52
53     // fill in
54     $method = 'fillIn'.ucfirst(strtolower($this->getParameter('content_type', 'Html')));
55
56     try
57     {
58       $content = $fillInForm->$method($response->getContent(), $this->getParameter('name'), $this->getParameter('id'), $request->getParameterHolder()->getAll());
59       $response->setContent($content);
60     }
61     catch (sfException $e)
62     {
63       if (sfConfig::get('sf_logging_enabled'))
64       {
65         $this->context->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array($e->getMessage(), 'priority' => sfLogger::ERR)));
66       }
67     }
68   }
69 }
70
Note: See TracBrowser for help on using the browser.