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/admin-menu-editor-pro/customizables/Settings/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/yespkg.com/wp-content/plugins/admin-menu-editor-pro/customizables/Settings/Setting.php
<?php

namespace YahnisElsts\AdminMenuEditor\Customizable\Settings;

use YahnisElsts\AdminMenuEditor\Customizable\Storage\StorageInterface;

class Setting extends AbstractSetting {
	protected $defaultValue = null;

	public function __construct($id, StorageInterface $store = null, $params = array()) {
		parent::__construct($id, $store, $params);

		if ( array_key_exists('default', $params) ) {
			$this->defaultValue = $params['default'];
		}
		$this->dataType = isset($params['type']) ? $params['type'] : $this->dataType;
	}

	public function getValue($customDefault = null) {
		$currentDefault = ($customDefault !== null) ? $customDefault : $this->defaultValue;
		if ( $this->store ) {
			return $this->store->getValue($currentDefault);
		}
		return $currentDefault;
	}

	/**
	 * Update the value of this setting.
	 *
	 * @param $validValue
	 * @return boolean
	 */
	public function update($validValue) {
		if ( $this->store ) {
			$isSuccess = $this->store->setValue($validValue);
			$this->notifyUpdated();
			return $isSuccess;
		}
		return false;
	}

	/**
	 * Convert a setting value to a string usable in HTML forms.
	 *
	 * This does NOT encode special HTML characters. It is only intended to convert
	 * non-string values - like booleans and NULLs - to a format suitable for form field.
	 *
	 * @param $value
	 * @return string
	 */
	public function encodeForForm($value) {
		//Subclasses that require more advanced encoding should override this method.
		return (string)$value;
	}

	/**
	 * Convert submitted form data to a type suitable for validation.
	 * This is not necessarily the same as the setting data type.
	 *
	 * @param string $value
	 */
	public function decodeSubmittedValue($value) {
		//The default implementation is a no-op. Subclasses can override this.
		return $value;
	}

	/**
	 * @param \WP_Error $errors
	 * @param $value
	 * @param bool $stopOnFirstError
	 * @return \WP_Error|mixed
	 */
	public function validate($errors, $value, $stopOnFirstError = false) {
		//Should be overridden by subclasses.
		return $value;
	}

	public function validateFormValue($errors, $value, $stopOnFirstError = false) {
		$decodedValue = $this->decodeSubmittedValue($value);
		return $this->validate($errors, $decodedValue, $stopOnFirstError);
	}

	protected function canTreatAsNull($inputValue) {
		if ( $this->isNullable() && (($inputValue === null) || ($inputValue === '')) ) {
			return true;
		}
		return false;
	}

	public function isNullable() {
		return ($this->defaultValue === null);
	}

	/**
	 * @return mixed|null
	 */
	public function getDefaultValue() {
		return $this->defaultValue;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit