403Webshell
Server IP : 43.130.17.34  /  Your IP : 216.73.217.6
Web Server : nginx/1.28.0
System : Linux VM-4-12-opencloudos 6.6.92-34.1.oc9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 25 21:32:13 CST 2025 x86_64
User : www ( 1000)
PHP Version : 8.0.26
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wwwroot/yespkg.com/wp-content/plugins/wpforms/src/Pro/Forms/Fields/DateTime/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/yespkg.com/wp-content/plugins/wpforms/src/Pro/Forms/Fields/DateTime/Frontend.php
<?php

namespace WPForms\Pro\Forms\Fields\DateTime;

use WPForms\Forms\Fields\Base\Frontend as FrontendBase;

/**
 * Frontend class for the Date / Time field.
 *
 * @since 1.8.1
 */
class Frontend extends FrontendBase {

	/**
	 * Hooks.
	 *
	 * @since 1.8.1
	 */
	protected function hooks() {

		if ( wpforms_get_render_engine() !== 'modern' ) {
			return;
		}

		// Hooks for Modern Markup mode only.
		add_filter( "wpforms_frontend_modern_is_field_requires_fieldset_{$this->field_obj->type}", [ $this, 'is_field_requires_fieldset' ], PHP_INT_MAX, 2 );
		add_filter( "wpforms_field_properties_{$this->field_obj->type}", [ $this, 'field_properties_modern' ], 10, 3 );
	}

	/**
	 * Determine whether the field is requires fieldset+legend markup on the frontend.
	 *
	 * @since 1.8.1
	 *
	 * @param bool  $requires_fieldset True if requires. Defaults to false.
	 * @param array $field             Field data.
	 *
	 * @return bool
	 */
	public function is_field_requires_fieldset( $requires_fieldset, $field ) {

		if (
			isset( $field['format'], $field['date_type'] ) &&
			$field['date_type'] !== 'dropdown' &&
			in_array( $field['format'], [ 'date', 'time' ], true )
		) {
			return false;
		}

		return true;
	}

	/**
	 * Additional field properties for the modern markup mode.
	 *
	 * @since 1.8.1
	 *
	 * @param array $properties Field properties.
	 * @param array $field      Field settings.
	 * @param array $form_data  Form data and settings.
	 *
	 * @return array
	 */
	public function field_properties_modern( $properties, $field, $form_data ) {

		// Adjust field label's `for` attribute to match input Id if selected `Time` field format.
		if (
			isset( $field['format'] ) &&
			$field['format'] === 'time'
		) {
			$properties['label']['attr']['for'] .= '-time';
		}

		if (
			isset( $field['date_type'] ) &&
			$field['date_type'] === 'dropdown'
		) {
			$properties['inputs']['date']['d']['attr']['aria-label'] = esc_html__( 'Day', 'wpforms' );
			$properties['inputs']['date']['m']['attr']['aria-label'] = esc_html__( 'Month', 'wpforms' );
			$properties['inputs']['date']['y']['attr']['aria-label'] = esc_html__( 'Year', 'wpforms' );
		}

		return $properties;
	}

	/**
	 * Display Date dropdown element.
	 *
	 * @since 1.8.1
	 *
	 * @param string $label          Field label.
	 * @param string $short          Single char element name: 'd', 'm', 'y'.
	 * @param array  $numbers        Numbers range.
	 * @param int    $current        Current number.
	 * @param array  $atts           Element attributes.
	 * @param string $field_required Is this field required or not, has a HTML attribute or empty.
	 * @param array  $field          Field data and settings.
	 *
	 * @noinspection HtmlUnknownAttribute
	 */
	public function display_date_dropdown_element( $label, $short, $numbers, $current, $atts, $field_required, $field ) {

		printf(
			'<select name="wpforms[fields][%1$d][date][%2$s]" %3$s %4$s>',
			(int) $field['id'],
			esc_attr( $short ),
			wpforms_html_attributes( $atts['id'], $atts['class'], $atts['data'], $atts['attr'] ),
			esc_attr( $field_required )
		);

		echo '<option value="" class="placeholder" selected disabled>' . esc_html( $label ) . '</option>';

		foreach ( $numbers as $num ) {
			printf(
				'<option value="%d" %s>%s</option>',
				(int) $num,
				selected( $num, $current, false ),
				(int) $num
			);
		}

		echo '</select>';
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit