403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.148.247.210
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/7779/cwd/plugins/give/src/Promotions/FreeAddonModal/Controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/7779/cwd/plugins/give/src/Promotions/FreeAddonModal/Controllers/CompleteRestApiEndpoint.php
<?php

namespace Give\Promotions\FreeAddonModal\Controllers;

use WP_REST_Request;
use WP_REST_Response;
use WP_REST_Server;

class CompleteRestApiEndpoint
{
    public function __invoke()
    {
        register_rest_route('give/v1', '/promotions/free-addon-modal/complete', [
            'methods' => WP_REST_Server::EDITABLE,
            'callback' => [$this, 'handleModalCompletion'],
            'permission_callback' => function () {
                return current_user_can('manage_options');
            },
            'args' => [
                'reason' => [
                    'required' => true,
                    'type' => 'string',
                    'enum' => ['subscribed', 'rejected'],
                ],
            ],

        ]);
    }

    public function handleModalCompletion(WP_REST_Request $request)
    {
        $reason = $request['reason'];
        $iteration = 1;

        if ( 'rejected' === $reason ) {
            // If the user has rejected the modal before, increase the iteration.
            $status = get_option('give_free_addon_modal_displayed');

            if ( !empty($status) ) {
                // The value will be something like rejected:1:1.18.0. The first number is the number of versions the modal has appeared
                // in, and the second number is the version number of the plugin at the time of last display.
                list($status, $iteration, $version) = explode(':', $status);

                $iteration++;
            }
        }

        update_option('give_free_addon_modal_displayed', implode(':', [
            $request['reason'],
            $iteration,
            GIVE_VERSION,
        ]));

        return new WP_REST_Response(['success' => true]);
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit