parent
fb62b9d511
commit
43af207558
|
@ -24,6 +24,7 @@ class WC_Admin {
|
|||
public function __construct() {
|
||||
add_action( 'init', array( $this, 'includes' ) );
|
||||
add_action( 'current_screen', array( $this, 'conditional_includes' ) );
|
||||
add_action( 'admin_init', array( $this, 'buffer' ), 1 );
|
||||
add_action( 'admin_init', array( $this, 'preview_emails' ) );
|
||||
add_action( 'admin_init', array( $this, 'prevent_admin_access' ) );
|
||||
add_action( 'admin_init', array( $this, 'admin_redirects' ) );
|
||||
|
@ -31,6 +32,13 @@ class WC_Admin {
|
|||
add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Output buffering allows admin screens to make redirects later on.
|
||||
*/
|
||||
public function buffer() {
|
||||
ob_start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Include any classes we need within admin.
|
||||
*/
|
||||
|
|
|
@ -127,7 +127,7 @@ class WC_Settings_Shipping extends WC_Settings_Page {
|
|||
// Load shipping methods so we can show any global options they may have
|
||||
$shipping_methods = WC()->shipping->load_shipping_methods();
|
||||
|
||||
if ( '' == $current_section ) {
|
||||
if ( '' === $current_section ) {
|
||||
$this->output_zones_screen();
|
||||
} elseif ( 'options' === $current_section ) {
|
||||
$settings = $this->get_settings();
|
||||
|
|
|
@ -31,6 +31,18 @@ class WC_Shipping_Legacy_Flat_Rate extends WC_Shipping_Method {
|
|||
add_action( 'woocommerce_flat_rate_shipping_add_rate', array( $this, 'calculate_extra_shipping' ), 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Process and redirect if disabled.
|
||||
*/
|
||||
public function process_admin_options() {
|
||||
parent::process_admin_options();
|
||||
|
||||
if ( 'no' === $this->settings[ 'enabled' ] ) {
|
||||
wp_redirect( admin_url( 'admin.php?page=wc-settings&tab=shipping§ion=options' ) );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of the option in the WP DB.
|
||||
* @since 2.6.0
|
||||
|
|
|
@ -32,6 +32,18 @@ class WC_Shipping_Legacy_Free_Shipping extends WC_Shipping_Method {
|
|||
$this->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Process and redirect if disabled.
|
||||
*/
|
||||
public function process_admin_options() {
|
||||
parent::process_admin_options();
|
||||
|
||||
if ( 'no' === $this->settings[ 'enabled' ] ) {
|
||||
wp_redirect( admin_url( 'admin.php?page=wc-settings&tab=shipping§ion=options' ) );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of the option in the WP DB.
|
||||
* @since 2.6.0
|
||||
|
|
|
@ -26,6 +26,18 @@ class WC_Shipping_Legacy_Local_Delivery extends WC_Shipping_Local_Pickup {
|
|||
$this->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Process and redirect if disabled.
|
||||
*/
|
||||
public function process_admin_options() {
|
||||
parent::process_admin_options();
|
||||
|
||||
if ( 'no' === $this->settings[ 'enabled' ] ) {
|
||||
wp_redirect( admin_url( 'admin.php?page=wc-settings&tab=shipping§ion=options' ) );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of the option in the WP DB.
|
||||
* @since 2.6.0
|
||||
|
|
|
@ -26,6 +26,18 @@ class WC_Shipping_Legacy_Local_Pickup extends WC_Shipping_Method {
|
|||
$this->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Process and redirect if disabled.
|
||||
*/
|
||||
public function process_admin_options() {
|
||||
parent::process_admin_options();
|
||||
|
||||
if ( 'no' === $this->settings[ 'enabled' ] ) {
|
||||
wp_redirect( admin_url( 'admin.php?page=wc-settings&tab=shipping§ion=options' ) );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of the option in the WP DB.
|
||||
* @since 2.6.0
|
||||
|
|
Loading…
Reference in New Issue