403Webshell
Server IP : 162.0.217.223  /  Your IP : 216.73.216.153
Web Server : LiteSpeed
System : Linux premium269.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : mypckeys ( 1539)
PHP Version : 8.1.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/mypckeys/yeslicense.org/wp-content/plugins/yaymail/src/Controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/mypckeys/yeslicense.org/wp-content/plugins/yaymail/src/Controllers/SettingController.php
<?php

namespace YayMail\Controllers;

use YayMail\Abstracts\BaseController;
use YayMail\Models\SettingModel;
use YayMail\Utils\SingletonTrait;

/**
 * Settings Controller
 * * @method static SettingController get_instance()
 */
class SettingController extends BaseController {
    use SingletonTrait;

    private $model = null;

    protected function __construct() {
        $this->model = SettingModel::get_instance();
        $this->init_hooks();
    }

    protected function init_hooks() {
        register_rest_route(
            YAYMAIL_REST_NAMESPACE,
            '/settings',
            [
                [
                    'methods'             => \WP_REST_Server::READABLE,
                    'callback'            => [ $this, 'exec_get_settings' ],
                    'permission_callback' => [ $this, 'permission_callback' ],
                ],
                [
                    'methods'             => \WP_REST_Server::EDITABLE,
                    'callback'            => [ $this, 'exec_update_settings' ],
                    'permission_callback' => [ $this, 'permission_callback' ],
                ],
            ]
        );
    }

    public function exec_get_settings( \WP_REST_Request $request ) {
        return $this->exec( [ $this, 'get_settings' ], $request );
    }

    public function get_settings() {
        $settings = $this->model::find_all();
        return $settings;
    }

    public function exec_update_settings( \WP_REST_Request $request ) {
        return $this->exec( [ $this, 'update_settings' ], $request );
    }

    public function update_settings( \WP_REST_Request $request ) {
        $settings               = is_array( $request->get_param( 'settings' ) ) ? array_map( 'sanitize_text_field', wp_unslash( $request->get_param( 'settings' ) ) ) : [];
        $settings['custom_css'] = wp_strip_all_tags( isset( $request->get_param( 'settings' )['custom_css'] ) ? $request->get_param( 'settings' )['custom_css'] : '' );
        $this->model::update( $settings );
        return [
            'success' => true,
            'data'    => $settings,
        ];
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit