403Webshell
Server IP : 195.58.49.151  /  Your IP : 216.73.217.39
Web Server : Apache/2.4.67 (Debian) mod_fcgid/2.3.9 OpenSSL/3.0.20
System : Linux hs.hsdns.ru 6.1.0-48-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.172-1 (2026-05-15) x86_64
User : antilam ( 1007)
PHP Version : 8.4.22
Disable Function : system,passthru,popen
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /home/antilam/web/antilam.ru/public_html/wp-content/plugins/cyr2lat/src/php/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/antilam/web/antilam.ru/public_html/wp-content/plugins/cyr2lat/src/php/WPCli.php
<?php
/**
 * WP-CLI support.
 *
 * @package cyr-to-lat
 * @link    https://github.com/mihdan/wp-rocket-cli/blob/master/command.php
 */

// phpcs:disable Generic.Commenting.DocComment.MissingShort
/** @noinspection PhpUndefinedNamespaceInspection */
/** @noinspection PhpUndefinedClassInspection */
/** @noinspection PhpUndefinedFunctionInspection */
// phpcs:disable Generic.Commenting.DocComment.MissingShort

namespace CyrToLat;

use cli\progress\Bar;
use WP_CLI;
use WP_CLI\NoOp;
use WP_CLI_Command;
use function WP_CLI\Utils\make_progress_bar;

/**
 * Class WPCli
 *
 * @class WPCli
 */
class WPCli extends WP_CLI_Command {

	/**
	 * Converter class.
	 *
	 * @var Converter
	 */
	private $converter;

	/**
	 * WP_CLI constructor.
	 *
	 * @param Converter $converter Converter.
	 */
	public function __construct( Converter $converter ) {
		parent::__construct();
		$this->converter = $converter;
	}

	/**
	 * Regenerate old slugs.
	 *
	 * ## EXAMPLES
	 *
	 *     $ wp cyr2lat regenerate
	 *     Success: Regenerate Completed.
	 *
	 * @subcommand regenerate
	 *
	 * @param array $args       Arguments.
	 * @param array $assoc_args Arguments in associative array.
	 *
	 * @noinspection PhpUnusedParameterInspection
	 */
	public function regenerate( array $args = [], array $assoc_args = [] ): void {

		/**
		 * Notify instance.
		 *
		 * @var Bar $notify
		 */
		$notify = $this->make_progress_bar();

		$result = [];

		if ( ! empty( $assoc_args['post_status'] ) ) {
			$result['post_status'] = explode( ',', $assoc_args['post_status'] );
			$result['post_status'] = array_values( array_filter( array_map( 'trim', $result['post_status'] ) ) );
		}

		if ( ! empty( $assoc_args['post_type'] ) ) {
			$result['post_type'] = explode( ',', $assoc_args['post_type'] );
			$result['post_type'] = array_values( array_filter( array_map( 'trim', $result['post_type'] ) ) );
		}

		$this->converter->convert_existing_slugs( $result );
		$notify->tick();
		$notify->finish();

		WP_CLI::success( 'Regenerate Completed.' );
	}

	/**
	 * Make progress bar.
	 *
	 * @return Bar|NoOp
	 */
	protected function make_progress_bar() {
		return make_progress_bar( 'Regenerate existing slugs', 1 );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit