NexusLeads Webshell
NexusLeads


Server : LiteSpeed
System : Linux server 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64
User : alsaif ( 1057)
PHP Version : 7.4.33
Disable Function : show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Directory :  /home/alsaif/public_html/administrator/components/com_convertforms/ConvertForms/Field/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/alsaif/public_html/administrator/components/com_convertforms/ConvertForms/Field/Text.php
<?php

/**
 * @package         Convert Forms
 * @version         4.3.3 Pro
 * 
 * @author          Tassos Marinos <info@tassos.gr>
 * @link            https://www.tassos.gr
 * @copyright       Copyright © 2023 Tassos All Rights Reserved
 * @license         GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/

namespace ConvertForms\Field;

use Joomla\String\StringHelper;

defined('_JEXEC') or die('Restricted access');

class Text extends \ConvertForms\Field
{
    
    /**
	 *  Validate form submitted value
	 *
	 *  @param   mixed  $value           The field's value to validate (Passed by reference)
	 *
	 *  @return  mixed                   True on success, throws an exception on error
	 */
	public function validate(&$value)
	{
		$isEmpty = $this->isEmpty($value);
		$isRequired = $this->field->get('required');

		// If the field is empty and its not required, skip validation
		if ($isEmpty && !$isRequired)
		{
			return;
		}

		if ($isEmpty && $isRequired)
		{
			$this->throwError(\JText::_('COM_CONVERTFORMS_FIELD_REQUIRED'));
		}

		// Validate Min / Max characters
		$min_chars = $this->field->get('minchars', 0);
		$max_chars = $this->field->get('maxchars', 0);
		$value_length = StringHelper::strlen($value);

		if ($min_chars > 0 && $value_length < $min_chars)
		{
			$this->throwError(\JText::sprintf('COM_CONVERTFORMS_FIELD_VALIDATION_MIN_CHARS', $min_chars, $value_length));
		}

		if ($max_chars > 0 && $value_length > $max_chars)
		{
			$this->throwError(\JText::sprintf('COM_CONVERTFORMS_FIELD_VALIDATION_MAX_CHARS', $max_chars, $value_length));
		}

		// Validate Min / Max words
		$min_words = $this->field->get('minwords', 0);
		$max_words = $this->field->get('maxwords', 0);

		// Find words count
		$words_temp = preg_replace('/\s+/', ' ', trim($value));
		$words_temp = array_filter(explode(' ', $words_temp));
		$words_count = count($words_temp);

		if ($min_words > 0 && $words_count < $min_words)
		{
			$this->throwError(\JText::sprintf('COM_CONVERTFORMS_FIELD_VALIDATION_MIN_WORDS', $min_words, $words_count));
		}

		if ($max_words > 0 && $words_count > $max_words)
		{
			$this->throwError(\JText::sprintf('COM_CONVERTFORMS_FIELD_VALIDATION_MAX_WORDS', $max_words, $words_count));
		}

		// Let's do some filtering.
		$value = $this->filterInput($value);
	}
}

?>

NexusLeads