| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 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,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.3/wp-content/plugins/stackable-ultimate-gutenberg-blocks/src/ |
Upload File : |
<?php
/**
* This allows non-admin users to read Stackable Options for Global Settings in the Editor
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Stackable_Admin_Settings' ) ) {
class Stackable_Admin_Settings extends WP_REST_Settings_Controller {
/**
* Constructor.
*
*/
public function __construct() {
$this->namespace = 'stackable/v3';
$this->rest_base = 'settings';
add_action( 'rest_api_init', array( $this, 'register_routes' ) );
}
public function register_routes() {
register_rest_route(
$this->namespace,
'/' . $this->rest_base,
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'get_item' ),
'args' => array(),
'permission_callback' => array( $this, 'retrieve_item_permissions_check' ),
)
);
}
public function retrieve_item_permissions_check( $request ) {
return current_user_can( 'edit_posts' );
}
/**
* Retrieves only the Stackable registered options
*
* @return array Array of registered options.
*/
protected function get_registered_options() {
$rest_options = parent::get_registered_options();
$rest_options = array_filter(
$rest_options,
function( $key ) {
return strpos( $key, 'stackable' ) === 0;
},
ARRAY_FILTER_USE_KEY
);
return $rest_options;
}
}
new Stackable_Admin_Settings();
}