403Webshell
Server IP : 104.21.28.229  /  Your IP : 216.73.216.142
Web Server : Apache/2
System : Linux hosting8537.lvs 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : mienphi ( 1014)
PHP Version : 8.2.14
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/mienphi/public_html/wp-content/plugins/learnpress/inc/MetaBox/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/mienphi/public_html/wp-content/plugins/learnpress/inc/MetaBox/LPMetaBoxField.php
<?php

namespace LearnPress\MetaBox;
use LearnPress\Helpers\Template;

/**
 * LP_Meta_Box_Field
 *
 * @version 1.0.0
 * @since 4.2.3.1
 */
class LPMetaBoxField {
	const TEXT     = 'text';
	const NUMBER   = 'number';
	const CHECKBOX = 'checkbox';
	const SELECT   = 'select';

	/**
	 * Extra options of field.
	 *
	 * @var string $class
	 */
	public $extra = array();

	public static function render( string $type, string $name, array $extra = [], array $el_wrapper = [] ) {
		$content = '';
		$value   = $extra['value'] ?? ( $extra['default'] ?? '' );

		switch ( $type ) {
			case self::TEXT:
			case self::NUMBER:
				$content = sprintf(
					'<input type="%s" name="%s" id="%s" value="%s" placeholder="%s" />',
					esc_attr( $type ),
					esc_attr( $name ),
					esc_attr( $extra['id'] ?? '' ),
					esc_attr( $value ),
					esc_attr( $extra['placeholder'] ?? '' )
				);
				break;
			case self::CHECKBOX:
				$content = sprintf(
					'<input type="checkbox" name="%s" id="%s" value="1" %s />',
					esc_attr( $name ),
					esc_attr( $extra['id'] ?? '' ),
					checked( $value, 1, false ) ? 'checked' : ''
				);
				break;
			case self::SELECT:
				$select = [
					sprintf(
						'<select name="%s" id="%s">',
						esc_attr( $name ),
						esc_attr( $extra['id'] ?? '' )
					) => '</select>',
				];

				$options = '';
				foreach ( $extra['options'] ?? [] as $key => $value_option ) {
					if ( $value === $key ) {
						$options .= sprintf( '<option value="%s" selected>%s</option>', esc_attr( $key ), wp_kses_post( $value_option ) );
						continue;
					}
					$options .= sprintf( '<option value="%s">%s</option>', esc_attr( $key ), wp_kses_post( $value_option ) );
				}

				$content = Template::instance()->nest_elements( $select, $options );
				break;
			case apply_filters( 'learn-press/meta-box-field-type', 'custom' ):
				$content = apply_filters( 'learn-press/meta-box-field-content', '', $type, $name, $extra );
				break;
			default:
				echo 'Not support type';
				break;
		}

		echo Template::instance()->nest_elements( $el_wrapper, $content );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit