SILENT KILLERPanel

Current Path: > home > codekrsu > > ameliagraphics.com > wp-content > plugins > > forminator > library > fields >


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/codekrsu//ameliagraphics.com/wp-content/plugins//forminator/library/fields/

NameTypeSizeLast ModifiedActions
address.php File 27845 bytes July 14 2025 15:42:34.
calculation.php File 8270 bytes March 03 2025 16:08:12.
captcha.php File 9379 bytes April 14 2025 14:55:34.
consent.php File 6209 bytes July 14 2025 15:42:34.
currency.php File 13254 bytes July 14 2025 15:42:34.
custom.php File 7305 bytes March 03 2025 16:08:12.
date.php File 45471 bytes July 14 2025 15:42:34.
email.php File 14373 bytes July 14 2025 15:42:34.
gdprcheckbox.php File 5432 bytes July 14 2025 15:42:34.
group.php File 7233 bytes July 14 2025 15:42:34.
hidden.php File 5010 bytes April 14 2025 14:55:34.
html.php File 2470 bytes July 14 2025 15:42:34.
multivalue.php File 16995 bytes July 14 2025 15:42:34.
name.php File 22554 bytes July 14 2025 15:42:34.
number.php File 13488 bytes July 14 2025 15:42:34.
page-break.php File 1514 bytes December 24 2024 20:31:58.
password.php File 18982 bytes July 14 2025 15:42:34.
paypal.php File 13706 bytes December 24 2024 20:31:58.
phone.php File 15768 bytes July 14 2025 15:42:34.
postdata.php File 36756 bytes July 14 2025 15:42:34.
radio.php File 17476 bytes July 14 2025 15:42:34.
rating.php File 5749 bytes July 14 2025 15:42:34.
section.php File 3194 bytes December 24 2024 20:31:58.
select.php File 23804 bytes July 14 2025 15:42:34.
slider.php File 14350 bytes July 14 2025 15:42:34.
stripe-payment-element.php File 4076 bytes April 14 2025 14:55:34.
stripe.php File 46882 bytes April 16 2025 18:18:24.
text.php File 11490 bytes July 14 2025 15:42:34.
textarea.php File 11887 bytes July 14 2025 15:42:34.
time.php File 29459 bytes July 14 2025 15:42:34.
upload.php File 34058 bytes July 14 2025 15:42:34.
website.php File 8324 bytes July 14 2025 15:42:34.

Reading File: /home/codekrsu//ameliagraphics.com/wp-content/plugins//forminator/library/fields//rating.php

<?php
/**
 * The Forminator_Rating class.
 *
 * @package Forminator
 */

if ( ! defined( 'ABSPATH' ) ) {
	die();
}

/**
 * Class Forminator_Rating
 *
 * @property  array field
 * @since 1.32
 */
class Forminator_Rating extends Forminator_Field {

	/**
	 * Slug
	 *
	 * @var string
	 */
	public $slug = 'rating';

	/**
	 * Type
	 *
	 * @var string
	 */
	public $type = 'rating';

	/**
	 * Position
	 *
	 * @var int
	 */
	public $position = 28;

	/**
	 * Options
	 *
	 * @var string
	 */
	public $options = array();

	/**
	 * Icon
	 *
	 * @var string
	 */
	public $icon = 'sui-icon-star';

	/**
	 * Forminator_Rating constructor.
	 */
	public function __construct() {
		parent::__construct();

		$this->name = esc_html__( 'Rating', 'forminator' );
		$required   = __( 'This field is required. Please select a rating.', 'forminator' );

		self::$default_required_messages[ $this->type ] = $required;
	}

	/**
	 * Field defaults
	 *
	 * @return array
	 * @since 1.32.0
	 */
	public function defaults(): array {
		return array(
			'validation'  => false,
			'field_label' => esc_html__( 'Rating', 'forminator' ),
			'max_rating'  => 5,
			'suffix'      => true,
			'icon'        => 'star',
			'size'        => 'md',
		);
	}

	/**
	 * Autofill Setting
	 *
	 * @param array $settings Settings.
	 *
	 * @return array
	 * @since 1.32.0
	 */
	public function autofill_settings( $settings = array() ): array {
		return array();
	}

	/**
	 * Field front-end markup
	 *
	 * @param array                  $field Field.
	 * @param Forminator_Render_Form $views_obj Forminator_Render_Form object.
	 * @param array|null             $draft_value Draft value(s).
	 *
	 * @return string
	 * @since 1.32
	 */
	public function markup( $field, $views_obj, $draft_value = array() ): string {
		$this->field = $field;
		$name        = self::get_property( 'element_id', $field );
		$id          = self::get_field_id( $name );
		$required    = self::get_property( 'required', $field, false );
		$label       = self::get_property( 'field_label', $field );
		$description = self::get_property( 'description', $field );
		$icon        = self::get_property( 'icon', $field, 'star' );
		$size        = self::get_property( 'size', $field, 'md' );
		$max_rating  = self::get_property( 'max_rating', $field, 5 );
		$suffix      = self::get_property( 'suffix', $field, true );
		$settings    = $views_obj->model->settings;

		$descr_position = self::get_description_position( $field, $settings );

		$value = 0;
		if ( isset( $draft_value['value'] ) ) {
			$rating_value = explode( '/', $draft_value['value'] )[0] ?? 0;
			$value        = esc_html( $rating_value );
		}

		$attributes = array(
			'name'              => $name,
			'id'                => $id,
			'class'             => 'forminator-rating',
			'aria-errormessage' => $id . '-error',
			'data-type'         => $icon,
			'data-size'         => $size,
			'data-suffix'       => $suffix ? 'true' : 'false',
		);

		if ( ! empty( $description ) ) {
			$attributes['aria-describedby'] = $id . '-description';
		}

		$options = array(
			array(
				'value'    => 0,
				'label'    => 0,
				'disabled' => true,
			),
		);

		$maximum_rating = max( 0, min( $max_rating, 50 ) );
		for ( $rating = 1; $rating <= $maximum_rating; $rating++ ) {
			$options[] = array(
				'value'    => $rating,
				'label'    => $rating,
				'disabled' => false,
			);
		}

		$html = '<div class="forminator-field">';

		$html .= self::create_select(
			$attributes,
			$label,
			$options,
			$value,
			$description,
			$required,
			$descr_position,
		);

		$html .= '</div>';

		return apply_filters( 'forminator_field_rating_markup', $html, $field );
	}

	/**
	 * Return field inline validation rules
	 *
	 * @return string
	 * @since 1.32
	 */
	public function get_validation_rules(): string {
		$field = $this->field;
		$rules = '"' . $this->get_id( $field ) . '": {' . "\n";
		if ( $this->is_required( $field ) ) {
			$rules .= '"required": true,';
		}

		$rules .= '},' . "\n";

		return apply_filters( 'forminator_field_rating_validation_rules', $rules, $this->get_id( $field ), $field );
	}

	/**
	 * Return field inline validation errors
	 *
	 * @return string
	 * @since 1.32
	 */
	public function get_validation_messages(): string {
		$message = '';
		$field   = $this->field;
		if ( $this->is_required( $field ) ) {
			$required_message = self::get_property( 'required_message', $field, self::$default_required_messages[ $this->type ] );
			$required_message = apply_filters(
				'forminator_rating_field_required_validation_message',
				$required_message,
				$this->get_id( $field ),
				$field
			);

			$message = '"' . $this->get_id( $field ) . '": {"required":"' . forminator_addcslashes( $required_message ) . '"},' . "\n";
		}

		return $message;
	}

	/**
	 * Field back-end validation
	 *
	 * @param array        $field Field settings.
	 * @param array|string $data Data to validate.
	 *
	 * @return bool
	 */
	public function validate( $field, $data ): bool {
		$id           = self::get_property( 'element_id', $field );
		$rating_value = explode( '/', $data )[0] ?? 0;
		if ( $this->is_required( $field ) ) {
			$required_error_message =
				$this->get_field_multiple_required_message(
					$id,
					$field,
					'required_message',
					'',
					esc_html( self::$default_required_messages[ $this->type ] )
				);

			if ( empty( $rating_value ) ) {
				$this->validation_message[ $id ] = $required_error_message;

				return false;
			}
		}

		return true;
	}

	/**
	 * Sanitize field value
	 *
	 * @param array        $field Field settings.
	 * @param array|string $data Data to sanitize.
	 *
	 * @return string
	 */
	public function sanitize( $field, $data ): string {
		// Sanitize.
		return esc_html( $data );
	}
}

SILENT KILLER Tool