| 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/Storage/ |
Upload File : |
<?php
namespace YahnisElsts\AdminMenuEditor\Customizable\Storage;
class Slot extends StorageMethods implements StorageInterface {
/**
* @var StorageInterface
*/
protected $store;
/**
* @var array
*/
protected $pathPrefix;
/**
* @param StorageInterface $store
* @param string|string[] $path
*/
public function __construct(StorageInterface $store, $path) {
parent::__construct();
$this->store = $store;
$this->pathPrefix = $this->parsePath($path);
}
protected function rawGetValue($defaultValue = null) {
return $this->store->getPath($this->pathPrefix, $defaultValue);
}
public function setValue($value) {
return $this->store->setPath($this->pathPrefix, $value);
}
protected function rawGetPath($path, $defaultValue = null) {
return $this->store->getPath(
$this->addPrefixToPath($this->pathPrefix, $path),
$defaultValue
);
}
public function setPath($path, $value) {
return $this->store->setPath(
$this->addPrefixToPath($this->pathPrefix, $path),
$value
);
}
public function deleteValue() {
$this->store->deletePath($this->pathPrefix);
}
public function deletePath($path) {
$this->store->deletePath(
$this->addPrefixToPath($this->pathPrefix, $path)
);
}
public function buildSlot($path) {
//We could simply return "new Slot($this, $path)", but that would lead to
//unnecessary nested getPath() calls when retrieving the value. Using
//the underlying storage should be more efficient.
return new Slot(
$this->store,
$this->addPrefixToPath($this->pathPrefix, $path)
);
}
public function addReadAliases($aliases) {
/*
* Forward the aliases to the underlying storage, but prefix them with
* the path of this slot.
*
* We could store aliases on the slot, but then buildSlot() would not be able
* to use the underlying storage because that storage would not know about
* the aliases. Using the $store only when there are no aliases also wouldn't
* work sometimes because aliases could be added later.
*/
foreach($aliases as $alias => $path) {
$nestedAlias = $this->addPrefixToPath($this->pathPrefix, $alias);
$nestedPath = $this->addPrefixToPath($this->pathPrefix, $path);
$this->store->addReadAliases([
implode(self::PATH_SEPARATOR, $nestedAlias) => implode(self::PATH_SEPARATOR, $nestedPath),
]);
}
}
public function getSmallestSavable() {
return $this->store->getSmallestSavable();
}
public function setPreviewValue($value) {
return $this->store->setPreviewByPath($this->pathPrefix, $value);
}
public function setPreviewByPath($path, $value) {
return $this->store->setPreviewByPath(
$this->addPrefixToPath($this->pathPrefix, $path),
$value
);
}
}