Source for file contactemailmessage.php

Documentation is available at contactemailmessage.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.  * JFormRule for com_contact to make sure the message body contains no banned word.
  14.  *
  15.  * @package     Joomla.Site
  16.  * @subpackage  com_contact
  17.  */
  18. {
  19.     /**
  20.      * Method to test a message for banned words
  21.      *
  22.      * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  23.      * @param   mixed             $value    The form field value to validate.
  24.      * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  25.      *                                       For example if the field has name="foo" and the group value is set to "bar" then the
  26.      *                                       full field name would end up being "bar[foo]".
  27.      * @param   JRegistry         $input    An optional JRegistry object with the entire data set to validate against the entire form.
  28.      * @param   JForm             $form     The form object for which the field is being tested.
  29.      *
  30.      * @return  boolean  True if the value is valid, false otherwise.
  31.      */
  32.     public function test(SimpleXMLElement $element$value$group nullJRegistry $input nullJForm $form null)
  33.     {
  34.         $params JComponentHelper::getParams('com_contact');
  35.         $banned $params->get('banned_text');
  36.  
  37.         if ($banned)
  38.         {
  39.             foreach(explode(';'$bannedas $item)
  40.             {
  41.                 if (JString::stristr($value$item!== false)
  42.                 {
  43.                     return false;
  44.                 }
  45.             }
  46.         }
  47.  
  48.         return true;
  49.     }
  50. }

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