Zikula_Template_Plugins
[ class tree: Zikula_Template_Plugins ] [ index: Zikula_Template_Plugins ] [ all elements ]

Source for file function.pnformemailinput.php

Documentation is available at function.pnformemailinput.php

  1. <?php
  2. /**
  3.  * E-mail input plugin
  4.  *
  5.  * @copyright (c) 2006, Zikula Development Team
  6.  * @link http://www.zikula.org
  7.  * @version $Id: function.pnformdateinput.php 22632 2007-08-25 17:23:12Z rgasch $
  8.  * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
  9.  * @author Jorn Wildt
  10.  * @package Zikula_Template_Plugins
  11.  * @subpackage Functions
  12.  */
  13.  
  14. /** Make sure to use require_once() instead of Loader::requireOnce() since "function.pnformtextinput.php"
  15.  is loaded by Smarty (the base render class) with the use of require_once(). We do not want to
  16.  get in conflict with that.*/
  17. require_once('system/pnForm/plugins/function.pnformtextinput.php');
  18.  
  19.  
  20. /**
  21.  * E-mail input for pnForms
  22.  *
  23.  * The e-mail input plugin is a text input plugin that only allows e-mails to be posted.
  24.  *
  25.  * You can also use all of the features from the pnFormTextInput plugin since the e-mail input
  26.  * inherits from it.
  27.  *
  28.  * @package pnForm
  29.  * @subpackage Plugins
  30.  */
  31. {
  32.     function getFilename()
  33.     {
  34.         return __FILE__// FIXME: may be found in smarty's data???
  35.     }
  36.  
  37.  
  38.     function create(&$render&$params)
  39.     {
  40.        $this->maxLength 100;
  41.  
  42.        parent::create($render$params);
  43.        
  44.        $this->cssClass .= ' email';
  45.     }
  46.     
  47.     
  48.     function validate(&$render)
  49.     {
  50.         parent::validate($render);
  51.         if (!$this->isValid)
  52.             return;
  53.  
  54.         if (!empty($this->text))
  55.         {
  56.             if (!pnVarValidate($this->text'email'))
  57.                 $this->setError(_NOTAVALIDEMAIL);
  58.         }
  59.     }
  60. }
  61.  
  62.  
  63. function smarty_function_pnformemailinput($params&$render)
  64. {
  65.     return $render->pnFormRegisterPlugin('pnFormEMailInput'$params);
  66. }

Documentation generated on Fri, 18 Jul 2008 21:45:50 +0200 by phpDocumentor 1.4.1