WC_Shortcode_My_Account::output()public staticWC 1.0

Output the shortcode.

Метод класса: WC_Shortcode_My_Account{}

Возвращает

null. Ничего (null).

Использование

$result = WC_Shortcode_My_Account::output( $atts );
$atts(массив) (обязательный)
Shortcode attributes.

Код WC_Shortcode_My_Account::output() WC 8.7.0

public static function output( $atts ) {
	global $wp;

	// Check cart class is loaded or abort.
	if ( is_null( WC()->cart ) ) {
		return;
	}

	if ( ! is_user_logged_in() || isset( $wp->query_vars['lost-password'] ) ) {
		$message = apply_filters( 'woocommerce_my_account_message', '' );

		if ( ! empty( $message ) ) {
			wc_add_notice( $message );
		}

		// After password reset, add confirmation message.
		if ( ! empty( $_GET['password-reset'] ) ) { // WPCS: input var ok, CSRF ok.
			wc_add_notice( __( 'Your password has been reset successfully.', 'woocommerce' ) );
		}

		if ( isset( $wp->query_vars['lost-password'] ) ) {
			self::lost_password();
		} else {
			wc_get_template( 'myaccount/form-login.php' );
		}
	} else {
		// Start output buffer since the html may need discarding for BW compatibility.
		ob_start();

		if ( isset( $wp->query_vars['customer-logout'] ) ) {
			/* translators: %s: logout url */
			wc_add_notice( sprintf( __( 'Are you sure you want to log out? <a href="%s">Confirm and log out</a>', 'woocommerce' ), wc_logout_url() ) );
		}

		// Collect notices before output.
		$notices = wc_get_notices();

		// Output the new account page.
		self::my_account( $atts );

		/**
		 * Deprecated my-account.php template handling. This code should be
		 * removed in a future release.
		 *
		 * If woocommerce_account_content did not run, this is an old template
		 * so we need to render the endpoint content again.
		 */
		if ( ! did_action( 'woocommerce_account_content' ) ) {
			if ( ! empty( $wp->query_vars ) ) {
				foreach ( $wp->query_vars as $key => $value ) {
					if ( 'pagename' === $key ) {
						continue;
					}
					if ( has_action( 'woocommerce_account_' . $key . '_endpoint' ) ) {
						ob_clean(); // Clear previous buffer.
						wc_set_notices( $notices );
						wc_print_notices();
						do_action( 'woocommerce_account_' . $key . '_endpoint', $value );
						break;
					}
				}

				wc_deprecated_function( 'Your theme version of my-account.php template', '2.6', 'the latest version, which supports multiple account pages and navigation, from WC 2.6.0' );
			}
		}

		// Send output buffer.
		ob_end_flush();
	}
}