plugin updates

This commit is contained in:
Tony Volpe
2024-09-17 10:43:54 -04:00
parent 44b413346f
commit b7c8882c8c
1359 changed files with 58219 additions and 11364 deletions

View File

@@ -38,13 +38,19 @@ class WC_Settings_Advanced extends WC_Settings_Page {
* @return array
*/
protected function get_own_sections() {
return array(
$sections = array(
'' => __( 'Page setup', 'woocommerce' ),
'keys' => __( 'REST API', 'woocommerce' ),
'webhooks' => __( 'Webhooks', 'woocommerce' ),
'legacy_api' => __( 'Legacy API', 'woocommerce' ),
'woocommerce_com' => __( 'WooCommerce.com', 'woocommerce' ),
);
if ( Features::is_enabled( 'blueprint' ) ) {
$sections['blueprint'] = __( 'Blueprint', 'woocommerce' );
}
return $sections;
}
/**
@@ -426,6 +432,27 @@ class WC_Settings_Advanced extends WC_Settings_Page {
return apply_filters( 'woocommerce_settings_rest_api', $settings );
}
/**
* Get settings for the Blueprint section.
*
* @return array
*/
protected function get_settings_for_blueprint_section() {
$settings =
array(
array(
'title' => esc_html__( 'Blueprint', 'woocommerce' ),
'type' => 'title',
),
array(
'id' => 'wc_settings_blueprint_slotfill',
'type' => 'slotfill_placeholder',
),
);
return $settings;
}
/**
* Form method.
*

View File

@@ -130,19 +130,6 @@ class WC_Settings_Emails extends WC_Settings_Page {
'desc_tip' => true,
),
array(
'title' => __( 'Footer text', 'woocommerce' ),
/* translators: %s: Available placeholders for use */
'desc' => __( 'The text to appear in the footer of all WooCommerce emails.', 'woocommerce' ) . ' ' . sprintf( __( 'Available placeholders: %s', 'woocommerce' ), '{site_title} {site_url}' ),
'id' => 'woocommerce_email_footer_text',
'css' => 'width:400px; height: 75px;',
'placeholder' => __( 'N/A', 'woocommerce' ),
'type' => 'textarea',
'default' => '{site_title} — Built with {WooCommerce}',
'autoload' => false,
'desc_tip' => true,
),
array(
'title' => __( 'Base color', 'woocommerce' ),
/* translators: %s: default color */
@@ -191,6 +178,31 @@ class WC_Settings_Emails extends WC_Settings_Page {
'desc_tip' => true,
),
array(
'title' => __( 'Footer text', 'woocommerce' ),
/* translators: %s: Available placeholders for use */
'desc' => __( 'The text to appear in the footer of all WooCommerce emails.', 'woocommerce' ) . ' ' . sprintf( __( 'Available placeholders: %s', 'woocommerce' ), '{site_title} {site_url}' ),
'id' => 'woocommerce_email_footer_text',
'css' => 'width:400px; height: 75px;',
'placeholder' => __( 'N/A', 'woocommerce' ),
'type' => 'textarea',
'default' => '{site_title} — Built with {WooCommerce}',
'autoload' => false,
'desc_tip' => true,
),
array(
'title' => __( 'Footer text color', 'woocommerce' ),
/* translators: %s: footer default color */
'desc' => sprintf( __( 'The footer text color. Default %s.', 'woocommerce' ), '<code>#3c3c3c</code>' ),
'id' => 'woocommerce_email_footer_text_color',
'type' => 'color',
'css' => 'width:6em;',
'default' => '#3c3c3c',
'autoload' => false,
'desc_tip' => true,
),
array(
'type' => 'sectionend',
'id' => 'email_template_options',

View File

@@ -0,0 +1,172 @@
<?php
declare( strict_types = 1);
// @codingStandardsIgnoreLine.
/**
* WooCommerce Checkout Settings
*
* @package WooCommerce\Admin
*/
defined( 'ABSPATH' ) || exit;
if ( class_exists( 'WC_Settings_Payment_Gateways_React', false ) ) {
return new WC_Settings_Payment_Gateways_React();
}
/**
* WC_Settings_Payment_Gateways_React.
*/
class WC_Settings_Payment_Gateways_React extends WC_Settings_Page {
/**
* Get the whitelist of sections to render using React.
*
* @return array List of section identifiers.
*/
private function get_reactify_render_sections() {
$sections = array(
'offline',
'woocommerce_payments',
'main',
);
/**
* Filters the list of payment settings sections to be rendered using React.
*
* @since 9.3.0
*
* @param array $sections List of section identifiers.
*/
return apply_filters( 'experimental_woocommerce_admin_payment_reactify_render_sections', $sections );
}
/**
* Constructor.
*/
public function __construct() {
$this->id = 'checkout';
$this->label = _x( 'Payments', 'Settings tab label', 'woocommerce' );
parent::__construct();
}
/**
* Output the settings.
*/
public function output() {
//phpcs:disable WordPress.Security.NonceVerification.Recommended
global $current_section;
// Load gateways so we can show any global options they may have.
$payment_gateways = WC()->payment_gateways->payment_gateways();
if ( $this->should_render_react_section( $current_section ) ) {
$this->render_react_section( $current_section );
} elseif ( $current_section ) {
$this->render_classic_gateway_settings_page( $payment_gateways, $current_section );
} else {
$this->render_react_section( 'main' );
}
parent::output();
//phpcs:enable
}
/**
* Check if the given section should be rendered using React.
*
* @param string $section The section to check.
* @return bool Whether the section should be rendered using React.
*/
private function should_render_react_section( $section ) {
return in_array( $section, $this->get_reactify_render_sections(), true );
}
/**
* Render the React section.
*
* @param string $section The section to render.
*/
private function render_react_section( $section ) {
global $hide_save_button;
$hide_save_button = true;
echo '<div id="experimental_wc_settings_payments_' . esc_attr( $section ) . '"></div>';
}
/**
* Render the classic gateway settings page.
*
* @param array $payment_gateways The payment gateways.
* @param string $current_section The current section.
*/
private function render_classic_gateway_settings_page( $payment_gateways, $current_section ) {
foreach ( $payment_gateways as $gateway ) {
if ( in_array( $current_section, array( $gateway->id, sanitize_title( get_class( $gateway ) ) ), true ) ) {
if ( isset( $_GET['toggle_enabled'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$enabled = $gateway->get_option( 'enabled' );
if ( $enabled ) {
$gateway->settings['enabled'] = wc_string_to_bool( $enabled ) ? 'no' : 'yes';
}
}
$this->run_gateway_admin_options( $gateway );
break;
}
}
}
/**
* Run the 'admin_options' method on a given gateway.
* This method exists to easy unit testing.
*
* @param object $gateway The gateway object to run the method on.
*/
protected function run_gateway_admin_options( $gateway ) {
$gateway->admin_options();
}
/**
* Don't show any section links.
*
* @return array
*/
public function get_sections() {
return array();
}
/**
* Save settings.
*/
public function save() {
global $current_section;
$wc_payment_gateways = WC_Payment_Gateways::instance();
$this->save_settings_for_current_section();
if ( ! $current_section ) {
// If section is empty, we're on the main settings page. This makes sure 'gateway ordering' is saved.
$wc_payment_gateways->process_admin_options();
$wc_payment_gateways->init();
} else {
// There is a section - this may be a gateway or custom section.
foreach ( $wc_payment_gateways->payment_gateways() as $gateway ) {
if ( in_array( $current_section, array( $gateway->id, sanitize_title( get_class( $gateway ) ) ), true ) ) {
/**
* Fires update actions for payment gateways.
*
* @since 3.4.0
*
* @param int $gateway->id Gateway ID.
*/
do_action( 'woocommerce_update_options_payment_gateways_' . $gateway->id );
$wc_payment_gateways->init();
}
}
$this->do_update_options_action();
}
}
}
return new WC_Settings_Payment_Gateways_React();

View File

@@ -8,7 +8,20 @@ if ( ! defined( 'ABSPATH' ) ) {
<span><?php esc_html_e( 'Shipping zones', 'woocommerce' ); ?></span>
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping&zone_id=new' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Add zone', 'woocommerce' ); ?></a>
</h2>
<p class="wc-shipping-zone-heading-help-text"><?php echo esc_html_e( 'A shipping zone consists of the region(s) you\'d like to ship to and the shipping method(s) offered. A shopper can only be matched to one zone, and we\'ll use their shipping address to show them the methods available in their area.', 'woocommerce' ); ?></p>
<p class="wc-shipping-zone-heading-help-text">
<?php
echo wp_kses_post(
sprintf(
/* translators: %s: URL to local pickup settings */
__(
"A shipping zone consists of the region(s) you'd like to ship to and the shipping method(s) offered. A shopper can only be matched to one zone, and we'll use their shipping address to show them the methods available in their area. To offer local pickup, configure your pickup locations in the <a href='%s'>local pickup settings</a>.",
'woocommerce'
),
esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping&section=pickup_location' ) )
)
);
?>
</p>
<table class="wc-shipping-zones widefat">
<thead>
<tr>
@@ -56,14 +69,13 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php if ( 0 === $method_count ) : ?>
<tr>
<td class="wc-shipping-zones-blank-state" colspan="5">
<p class="main"><?php _e( 'A shipping zone is a geographic region where a certain set of shipping methods and rates apply.', 'woocommerce' ); ?></p>
<p><?php _e( 'For example:', 'woocommerce' ); ?></p>
<p class="main"><?php esc_html_e( 'A shipping zone is a geographic region where a certain set of shipping methods and rates apply.', 'woocommerce' ); ?></p>
<p><?php esc_html_e( 'For example:', 'woocommerce' ); ?></p>
<ul>
<li><?php _e( 'Local zone = California ZIP 90210 = Local pickup', 'woocommerce' ); ?>
<li><?php _e( 'US domestic zone = All US states = Flat rate shipping', 'woocommerce' ); ?>
<li><?php _e( 'Europe zone = Any country in Europe = Flat rate shipping', 'woocommerce' ); ?>
<li><?php esc_html_e( 'US domestic zone = All US states = Flat rate shipping', 'woocommerce' ); ?>
<li><?php esc_html_e( 'Europe zone = Any country in Europe = Flat rate shipping', 'woocommerce' ); ?>
</ul>
<p><?php _e( 'Add as many zones as you need &ndash; customers will only see the methods available for their address.', 'woocommerce' ); ?></p>
<p><?php esc_html_e( 'Add as many zones as you need &ndash; customers will only see the methods available for their address.', 'woocommerce' ); ?></p>
<a class="button button-primary wc-shipping-zone-add" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping&zone_id=new' ) ); ?>"><?php _e( 'Add shipping zone', 'woocommerce' ); ?></a>
</td>
</tr>
@@ -95,9 +107,9 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="wc-backbone-modal-content">
<section class="wc-backbone-modal-main" role="main">
<header class="wc-backbone-modal-header">
<h1><?php _e( 'Add shipping method', 'woocommerce' ); ?></h1>
<h1><?php esc_html_e( 'Add shipping method', 'woocommerce' ); ?></h1>
<button class="modal-close modal-close-link dashicons dashicons-no-alt">
<span class="screen-reader-text"><?php _e( 'Close modal panel', 'woocommerce' ); ?></span>
<span class="screen-reader-text"><?php esc_html_e( 'Close modal panel', 'woocommerce' ); ?></span>
</button>
</header>
<article>