Source for file contactemail.php

Documentation is available at contactemail.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Site
  4.  * @subpackage  com_contact
  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.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12.  
  13. /**
  14.  * JFormRule for com_contact to make sure the E-Mail adress is not blocked.
  15.  *
  16.  * @package     Joomla.Site
  17.  * @subpackage  com_contact
  18.  */
  19. {
  20.     /**
  21.      * Method to test for banned e-mail addresses
  22.      *
  23.      * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  24.      * @param   mixed             $value    The form field value to validate.
  25.      * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  26.      *                                       For example if the field has name="foo" and the group value is set to "bar" then the
  27.      *                                       full field name would end up being "bar[foo]".
  28.      * @param   JRegistry         $input    An optional JRegistry object with the entire data set to validate against the entire form.
  29.      * @param   JForm             $form     The form object for which the field is being tested.
  30.      *
  31.      * @return  boolean  True if the value is valid, false otherwise.
  32.      */
  33.     public function test(SimpleXMLElement $element$value$group nullJRegistry $input nullJForm $form null)
  34.     {
  35.         if (!parent::test($element$value$group$input$form))
  36.         {
  37.             return false;
  38.         }
  39.  
  40.         $params JComponentHelper::getParams('com_contact');
  41.         $banned $params->get('banned_email');
  42.  
  43.         if ($banned)
  44.         {
  45.             foreach(explode(';'$bannedas $item)
  46.             {
  47.                 if (JString::stristr($value$item!== false)
  48.                 {
  49.                     return false;
  50.                 }
  51.             }
  52.         }
  53.  
  54.         return true;
  55.     }
  56. }

Documentation generated on Tue, 19 Nov 2013 14:56:42 +0100 by phpDocumentor 1.4.3