Merge branch 'master' of github.com:woothemes/woocommerce

This commit is contained in:
Claudio Sanches 2016-04-28 13:24:36 -03:00
commit 84f91cad76
10 changed files with 61 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@ -5036,6 +5036,7 @@ table.bar_chart {
font-size: inherit; font-size: inherit;
font-weight: inherit; font-weight: inherit;
padding: 3px 5px; padding: 3px 5px;
width: 100% !important;
} }
.select2-container { .select2-container {
line-height: 1.85em; line-height: 1.85em;

View File

@ -24,6 +24,7 @@ class WC_Admin {
public function __construct() { public function __construct() {
add_action( 'init', array( $this, 'includes' ) ); add_action( 'init', array( $this, 'includes' ) );
add_action( 'current_screen', array( $this, 'conditional_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, 'preview_emails' ) );
add_action( 'admin_init', array( $this, 'prevent_admin_access' ) ); add_action( 'admin_init', array( $this, 'prevent_admin_access' ) );
add_action( 'admin_init', array( $this, 'admin_redirects' ) ); 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 ); 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. * Include any classes we need within admin.
*/ */

View File

@ -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 // Load shipping methods so we can show any global options they may have
$shipping_methods = WC()->shipping->load_shipping_methods(); $shipping_methods = WC()->shipping->load_shipping_methods();
if ( '' == $current_section ) { if ( '' === $current_section ) {
$this->output_zones_screen(); $this->output_zones_screen();
} elseif ( 'options' === $current_section ) { } elseif ( 'options' === $current_section ) {
$settings = $this->get_settings(); $settings = $this->get_settings();

View File

@ -18,6 +18,6 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php if ( empty( $_GET['page'] ) || empty( $_GET['tab'] ) || 'wc-settings' !== $_GET['page'] || 'shipping' !== $_GET['tab'] ) : ?> <?php if ( empty( $_GET['page'] ) || empty( $_GET['tab'] ) || 'wc-settings' !== $_GET['page'] || 'shipping' !== $_GET['tab'] ) : ?>
<a class="button-primary" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping' ) ); ?>"><?php _e( 'Setup shipping zones', 'woocommerce' ); ?></a> <a class="button-primary" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping' ) ); ?>"><?php _e( 'Setup shipping zones', 'woocommerce' ); ?></a>
<?php endif; ?> <?php endif; ?>
<a class="button-secondary" href="<?php echo esc_url( 'https://docs.woothemes.com/document/setting-up-shipping-zones/' ); ?>"><?php _e( 'Lean more about shipping zones', 'woocommerce' ); ?></a> <a class="button-secondary" href="<?php echo esc_url( 'https://docs.woothemes.com/document/setting-up-shipping-zones/' ); ?>"><?php _e( 'Learn more about shipping zones', 'woocommerce' ); ?></a>
</p> </p>
</div> </div>

View File

@ -16,6 +16,6 @@ if ( ! defined( 'ABSPATH' ) ) {
<p class="submit"> <p class="submit">
<a class="button-primary" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping' ) ); ?>"><?php _e( 'Setup shipping zones', 'woocommerce' ); ?></a> <a class="button-primary" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping' ) ); ?>"><?php _e( 'Setup shipping zones', 'woocommerce' ); ?></a>
<a class="button-secondary" href="<?php echo esc_url( 'https://docs.woothemes.com/document/setting-up-shipping-zones/' ); ?>"><?php _e( 'Lean more about shipping zones', 'woocommerce' ); ?></a> <a class="button-secondary" href="<?php echo esc_url( 'https://docs.woothemes.com/document/setting-up-shipping-zones/' ); ?>"><?php _e( 'Learn more about shipping zones', 'woocommerce' ); ?></a>
</p> </p>
</div> </div>

View File

@ -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 ); 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&section=options' ) );
exit;
}
}
/** /**
* Return the name of the option in the WP DB. * Return the name of the option in the WP DB.
* @since 2.6.0 * @since 2.6.0

View File

@ -32,6 +32,18 @@ class WC_Shipping_Legacy_Free_Shipping extends WC_Shipping_Method {
$this->init(); $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&section=options' ) );
exit;
}
}
/** /**
* Return the name of the option in the WP DB. * Return the name of the option in the WP DB.
* @since 2.6.0 * @since 2.6.0

View File

@ -26,6 +26,18 @@ class WC_Shipping_Legacy_Local_Delivery extends WC_Shipping_Local_Pickup {
$this->init(); $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&section=options' ) );
exit;
}
}
/** /**
* Return the name of the option in the WP DB. * Return the name of the option in the WP DB.
* @since 2.6.0 * @since 2.6.0

View File

@ -26,6 +26,18 @@ class WC_Shipping_Legacy_Local_Pickup extends WC_Shipping_Method {
$this->init(); $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&section=options' ) );
exit;
}
}
/** /**
* Return the name of the option in the WP DB. * Return the name of the option in the WP DB.
* @since 2.6.0 * @since 2.6.0