Source for file email.php

Documentation is available at email.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Platform
  4.  * @subpackage  Form
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10. defined('JPATH_PLATFORM') or die;
  11.  
  12.  
  13. /**
  14.  * Form Field class for the Joomla Platform.
  15.  * Provides and input field for e-mail addresses
  16.  *
  17.  * @package     Joomla.Platform
  18.  * @subpackage  Form
  19.  * @link        http://www.w3.org/TR/html-markup/input.email.html#input.email
  20.  * @see         JFormRuleEmail
  21.  * @since       11.1
  22.  */
  23. {
  24.     /**
  25.      * The form field type.
  26.      *
  27.      * @var    string 
  28.      * @since  11.1
  29.      */
  30.     protected $type = 'Email';
  31.  
  32.     /**
  33.      * Method to get the field input markup for e-mail addresses.
  34.      *
  35.      * @return  string  The field input markup.
  36.      *
  37.      * @since   11.1
  38.      */
  39.     protected function getInput()
  40.     {
  41.         // Translate placeholder text
  42.         $hint = $this->translateHint ? JText::_($this->hint) : $this->hint;
  43.  
  44.         // Initialize some field attributes.
  45.         $size         = !empty($this->size) ? ' size="' . $this->size . '"' : '';
  46.         $maxLength    = !empty($this->maxLength) ? ' maxlength="' . $this->maxLength . '"' : '';
  47.         $class        = !empty($this->class) ? ' class="validate-email ' . $this->class . '"' : ' class="validate-email"';
  48.         $readonly     = $this->readonly ? ' readonly' : '';
  49.         $disabled     = $this->disabled ? ' disabled' : '';
  50.         $required     = $this->required ? ' required aria-required="true"' : '';
  51.         $hint         = $hint ? ' placeholder="' . $hint . '"' : '';
  52.         $autocomplete = !$this->autocomplete ? ' autocomplete="off"' : ' autocomplete="' . $this->autocomplete . '"';
  53.         $autocomplete = $autocomplete == ' autocomplete="on"' ? '' : $autocomplete;
  54.         $autofocus    = $this->autofocus ? ' autofocus' : '';
  55.         $multiple     = $this->multiple ? ' multiple' : '';
  56.         $spellcheck   = $this->spellcheck ? '' : ' spellcheck="false"';
  57.  
  58.         // Initialize JavaScript field attributes.
  59.         $onchange = $this->onchange ? ' onchange="' . $this->onchange . '"' : '';
  60.  
  61.         // Including fallback code for HTML5 non supported browsers.
  62.         JHtml::_('jquery.framework');
  63.         JHtml::_('script', 'system/html5fallback.js', false, true);
  64.  
  65.         return '<input type="email" name="' . $this->name . '"' . $class . ' id="' . $this->id . '" value="'
  66.             . JStringPunycode::emailToUTF8($this->value, ENT_COMPAT, 'UTF-8') . '"' . $spellcheck . $size . $disabled . $readonly . $onchange . $autocomplete
  67.             . $multiple . $maxLength . $hint . $required . $autofocus . ' />';
  68.     }
  69. }

Documentation generated on Tue, 19 Nov 2013 15:02:26 +0100 by phpDocumentor 1.4.3