403Webshell
Server IP : 43.141.49.107  /  Your IP : 113.219.202.141
Web Server : Apache
System : Linux VM-8-5-opencloudos 6.6.34-9.oc9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 19 19:35:45 CST 2024 x86_64
User : www ( 1000)
PHP Version : 8.1.27
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/wwwroot/www.ucppt.com/wp-content/plugins/easy-wp-smtp/src/WPCLI/Options/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/www.ucppt.com/wp-content/plugins/easy-wp-smtp/src/WPCLI/Options/Help.php
<?php

namespace EasyWPSMTP\WPCLI\Options;

/**
 * Renders the shared `## CONFIGURATION FLAGS` section that each WP-CLI
 * command appends to its own longdesc.
 *
 * @since 2.15.0
 */
class Help {

	/**
	 * Logical (not alphabetical) group order; mailers follow
	 * `supported_mailers()` order, Pro groups follow their merge order.
	 *
	 * @since 2.15.0
	 *
	 * @var string[]
	 */
	private static $group_order = [
		'mail',
		'general',
		'smtp',
		'sendgrid',
		'mailgun',
		'postmark',
		'sendlayer',
		'resend',
		'smtpcom',
		'smtp2go',
		'sparkpost',
		'mailjet',
		'mailersend',
		'brevo',
		'elasticemail',
		'amazonses',
		'mandrill',
		'logs',
		'rate_limit',
		'control',
		'alert',
	];

	/**
	 * Render the `## CONFIGURATION FLAGS` section: every registered arg
	 * enumerated under its top-level flag-segment heading.
	 *
	 * @since 2.15.0
	 *
	 * @param Registry $registry Source of args (Lite + Pro via filter).
	 *
	 * @return string
	 */
	public static function configuration_flags( Registry $registry ) { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh

		$grouped = [];

		foreach ( $registry->get_args() as $arg ) {
			$group               = explode( '.', $arg['flag'], 2 )[0];
			$grouped[ $group ][] = $arg;
		}

		// Order known groups first, then anything else in registry order.
		$ordered = [];

		foreach ( self::$group_order as $group ) {
			if ( isset( $grouped[ $group ] ) ) {
				$ordered[ $group ] = $grouped[ $group ];

				unset( $grouped[ $group ] );
			}
		}

		foreach ( $grouped as $group => $args ) {
			$ordered[ $group ] = $args;
		}

		$lines = [];

		$lines[] = '## ' . __( 'CONFIGURATION FLAGS', 'easy-wp-smtp' );
		$lines[] = '';
		$lines[] = __( 'These flags accept their value as a literal (--flag=value), from a file (--flag-file=<path>), or from an environment variable (EASY_WP_SMTP_<UPPER>).', 'easy-wp-smtp' );
		$lines[] = '';

		foreach ( $ordered as $group => $args ) {
			$lines[] = self::group_label( $group ) . ':';
			$lines[] = '';

			foreach ( $args as $arg ) {
				$lines[] = '[--' . $arg['flag'] . '=' . self::value_shape( $arg ) . ']';
				$lines[] = ': ' . self::description( $arg );
				$lines[] = '';
			}
		}

		return rtrim( implode( "\n", $lines ) ) . "\n";
	}

	/**
	 * The `<value-shape>` placeholder for an arg's `--flag=...` form.
	 *
	 * Enum shapes stay `<enum>`; the allowed values are listed in the description.
	 *
	 * @since 2.15.0
	 *
	 * @param array $arg Registry arg.
	 *
	 * @return string
	 */
	private static function value_shape( array $arg ) {

		$shapes = [
			'int'   => '<int>',
			'bool'  => '<bool>',
			'email' => '<email>',
			'enum'  => '<enum>',
		];

		return $shapes[ $arg['type'] ] ?? '<string>';
	}

	/**
	 * Assemble the description line: registry description, then any
	 * required / required_if / sensitive notes appended in that order.
	 *
	 * @since 2.15.0
	 *
	 * @param array $arg Registry arg.
	 *
	 * @return string
	 */
	private static function description( array $arg ) {

		$parts = [ wp_strip_all_tags( $arg['description'] ) ];

		if ( ! empty( $arg['required'] ) ) {
			$parts[] = __( 'Required.', 'easy-wp-smtp' );
		}

		if ( ! empty( $arg['required_if'] ) && is_array( $arg['required_if'] ) ) {
			$conditions = [];

			foreach ( $arg['required_if'] as $flag => $value ) {
				$conditions[] = '--' . $flag . '=' . self::format_required_if_value( $value );
			}

			$parts[] = sprintf(
				/* translators: %s is a list of "--flag=value" conditions joined by " and " (e.g. "--mail.mailer=smtp and --smtp.auth=true"). Flags and values are not translated. */
				__( 'Required when %s.', 'easy-wp-smtp' ),
				implode( ' ' . __( 'and', 'easy-wp-smtp' ) . ' ', $conditions )
			);
		}

		if ( ! empty( $arg['sensitive'] ) ) {
			$env_var = ! empty( $arg['env_var'] )
				? $arg['env_var']
				: 'EASY_WP_SMTP_' . strtoupper( str_replace( '.', '_', $arg['flag'] ) );
			$parts[] = sprintf(
				/* translators: %1$s is the dotted CLI flag (e.g. smtp.pass). %2$s is the matching environment variable name (e.g. EASY_WP_SMTP_SMTP_PASS). Flag and env var name are not translated. */
				__( 'Sensitive: also accepts --%1$s-file=<path> or env var %2$s.', 'easy-wp-smtp' ),
				$arg['flag'],
				$env_var
			);
		}

		return implode( ' ', $parts );
	}

	/**
	 * Map a group slug to its section-header label.
	 *
	 * Brand names stay literal (untranslated); generic labels are translatable;
	 * unknown groups fall back to `ucfirst`.
	 *
	 * @since 2.15.0
	 *
	 * @param string $group Group slug.
	 *
	 * @return string
	 */
	private static function group_label( $group ) {

		$labels = [
			'mail'         => __( 'Mail', 'easy-wp-smtp' ),
			'general'      => __( 'General', 'easy-wp-smtp' ),
			'smtp'         => 'SMTP',
			'sendgrid'     => 'SendGrid',
			'mailgun'      => 'Mailgun',
			'postmark'     => 'Postmark',
			'sendlayer'    => 'SendLayer',
			'resend'       => 'Resend',
			'smtpcom'      => 'SMTP.com',
			'smtp2go'      => 'SMTP2GO',
			'sparkpost'    => 'SparkPost',
			'mailjet'      => 'Mailjet',
			'mailersend'   => 'MailerSend',
			'brevo'        => 'Brevo',
			'elasticemail' => 'Elastic Email',
			'amazonses'    => 'Amazon SES',
			'mandrill'     => 'Mandrill',
			'logs'         => __( 'Email Logs', 'easy-wp-smtp' ),
			'rate_limit'   => __( 'Rate Limiting', 'easy-wp-smtp' ),
			'control'      => __( 'Email Controls', 'easy-wp-smtp' ),
			'alert'        => __( 'Alerts', 'easy-wp-smtp' ),
		];

		return $labels[ $group ] ?? ucfirst( $group );
	}

	/**
	 * Render a `required_if` value for display. Booleans become the literal
	 * strings `true`/`false`; everything else passes through as-is. Matches
	 * how operators type the value on the command line.
	 *
	 * @since 2.15.0
	 *
	 * @param mixed $value Condition value.
	 *
	 * @return string
	 */
	private static function format_required_if_value( $value ) {

		if ( is_bool( $value ) ) {
			return $value ? 'true' : 'false';
		}

		return (string) $value;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit