403Webshell
Server IP : 185.216.8.13  /  Your IP : 216.73.217.9
Web Server : Apache
System : Linux webhost-vie2.sitetide.com 4.18.0-553.156.1.el8_10.x86_64 #1 SMP Mon Aug 17 17:52:57 UTC 2026 x86_64
User : medicalkn ( 9986)
PHP Version : 8.2.33
Disable Function : syslog
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/html/wp-content/plugins/webp-converter-for-media/src/Service/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/plugins/webp-converter-for-media/src/Service/RestApiUnlocker.php
<?php

namespace WebpConverter\Service;

use WebpConverter\Conversion\Endpoint\EndpointIntegrator;
use WebpConverter\HookableInterface;

/**
 * Supports exceptions for blocked REST API endpoints.
 */
class RestApiUnlocker implements HookableInterface {

	/**
	 * {@inheritdoc}
	 */
	public function init_hooks() {
		add_filter( 'rest_authentication_errors', [ $this, 'clear_authentication_error' ], 9999 );
		add_filter(
			'option_mo_api_authentication_protectedrestapi_route_whitelist',
			[ $this, 'handle_wp_rest_api_authentication_plugin' ]
		);
		add_filter( 'jwt_auth_whitelist', [ $this, 'handle_jwt_auth_plugin' ] );
	}

	/**
	 * @param \WP_Error|null|true $result .
	 *
	 * @return \WP_Error|null|true
	 * @internal
	 */
	public function clear_authentication_error( $result ) {
		$current_route = untrailingslashit( $GLOBALS['wp']->query_vars['rest_route'] ?? '' );
		if ( strpos( $current_route, '/' . EndpointIntegrator::ROUTE_NAMESPACE . '/' ) === 0 ) {
			return true;
		}

		return $result;
	}

	/**
	 * @param array|mixed $all_routes .
	 *
	 * @return array|mixed
	 * @internal
	 */
	public function handle_wp_rest_api_authentication_plugin( $all_routes ) {
		if ( ! is_array( $all_routes ) ) {
			return $all_routes;
		}

		foreach ( $all_routes as $route_key => $route_path ) {
			if ( strpos( $route_path, '/' . EndpointIntegrator::ROUTE_NAMESPACE . '/' ) === 0 ) {
				unset( $all_routes[ $route_key ] );
			}
		}
		return $all_routes;
	}

	/**
	 * @param array|mixed $white_routes .
	 *
	 * @return array|mixed
	 * @internal
	 */
	public function handle_jwt_auth_plugin( $white_routes ) {
		if ( ! is_array( $white_routes ) ) {
			return $white_routes;
		}

		$all_routes[] = '/wp-json/' . EndpointIntegrator::ROUTE_NAMESPACE . '/*';
		return $all_routes;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit