This commit is contained in:
Paul Sealock 2019-03-08 10:05:59 +13:00
parent 68573f6ed5
commit e9d02699c4
2 changed files with 59 additions and 51 deletions

View File

@ -190,8 +190,8 @@ class WC_Admin_Setup_Wizard {
'i18n' => array(
'extra_plugins' => array(
'payment' => array(
'stripe_create_account' => __( 'Stripe setup is powered by Jetpack and WooCommerce Services.', 'woocommerce' ),
'ppec_paypal_reroute_requests' => __( 'PayPal setup is powered by Jetpack and WooCommerce Services.', 'woocommerce' ),
'stripe_create_account' => __( 'Stripe setup is powered by Jetpack and WooCommerce Services.', 'woocommerce' ),
'ppec_paypal_reroute_requests' => __( 'PayPal setup is powered by Jetpack and WooCommerce Services.', 'woocommerce' ),
'stripe_create_account,ppec_paypal_reroute_requests' => __( 'Stripe and PayPal setup are powered by Jetpack and WooCommerce Services.', 'woocommerce' ),
),
),
@ -790,8 +790,8 @@ class WC_Admin_Setup_Wizard {
* @param string $input_prefix Input prefix.
*/
protected function shipping_method_selection_form( $country_code, $currency_code, $input_prefix ) {
$selected = 'flat_rate';
$shipping_methods = $this->get_wizard_shipping_methods( $country_code, $currency_code );
$selected = 'flat_rate';
$shipping_methods = $this->get_wizard_shipping_methods( $country_code, $currency_code );
?>
<div class="wc-wizard-shipping-method-select">
<div class="wc-wizard-shipping-method-dropdown">
@ -966,7 +966,7 @@ class WC_Admin_Setup_Wizard {
'class' => array(),
'data-tip' => array(),
),
'a' => array(
'a' => array(
'href' => array(),
'target' => array(),
),
@ -985,28 +985,32 @@ class WC_Admin_Setup_Wizard {
<ul class="wc-setup-shipping-recommended">
<?php
if ( $is_wcs_labels_supported ) :
$this->display_recommended_item( array(
'type' => 'woocommerce_services',
'title' => __( 'Print shipping labels at home', 'woocommerce' ),
'description' => __( 'We recommend WooCommerce Services & Jetpack. These plugins will save you time at the Post Office by enabling you to print your shipping labels at home.', 'woocommerce' ),
'img_url' => WC()->plugin_url() . '/assets/images/obw-woocommerce-services-icon.png',
'img_alt' => __( 'WooCommerce Services icon', 'woocommerce' ),
'plugins' => $this->get_wcs_requisite_plugins(),
) );
$this->display_recommended_item(
array(
'type' => 'woocommerce_services',
'title' => __( 'Print shipping labels at home', 'woocommerce' ),
'description' => __( 'We recommend WooCommerce Services & Jetpack. These plugins will save you time at the Post Office by enabling you to print your shipping labels at home.', 'woocommerce' ),
'img_url' => WC()->plugin_url() . '/assets/images/obw-woocommerce-services-icon.png',
'img_alt' => __( 'WooCommerce Services icon', 'woocommerce' ),
'plugins' => $this->get_wcs_requisite_plugins(),
)
);
elseif ( $is_shipstation_supported ) :
$this->display_recommended_item( array(
'type' => 'shipstation',
'title' => __( 'Print shipping labels at home', 'woocommerce' ),
'description' => __( 'We recommend using ShipStation to save time at the Post Office by printing your shipping labels at home. Try ShipStation free for 30 days.', 'woocommerce' ),
'img_url' => WC()->plugin_url() . '/assets/images/obw-shipstation-icon.png',
'img_alt' => __( 'ShipStation icon', 'woocommerce' ),
'plugins' => array(
array(
'name' => __( 'ShipStation', 'woocommerce' ),
'slug' => 'woocommerce-shipstation-integration',
$this->display_recommended_item(
array(
'type' => 'shipstation',
'title' => __( 'Print shipping labels at home', 'woocommerce' ),
'description' => __( 'We recommend using ShipStation to save time at the Post Office by printing your shipping labels at home. Try ShipStation free for 30 days.', 'woocommerce' ),
'img_url' => WC()->plugin_url() . '/assets/images/obw-shipstation-icon.png',
'img_alt' => __( 'ShipStation icon', 'woocommerce' ),
'plugins' => array(
array(
'name' => __( 'ShipStation', 'woocommerce' ),
'slug' => 'woocommerce-shipstation-integration',
),
),
),
) );
)
);
endif;
endif;
?>
@ -1023,7 +1027,7 @@ class WC_Admin_Setup_Wizard {
$this->get_product_dimension_selection()
),
array(
'span' => array(
'span' => array(
'class' => array(),
),
'select' => array(
@ -1873,7 +1877,7 @@ class WC_Admin_Setup_Wizard {
&& $this->should_show_automated_tax()
&& $this->should_show_mailchimp()
) :
esc_html_e( 'Select from the list below to enable automated taxes and MailChimps best-in-class email services — and design your store with our official, free WooCommerce theme.', 'woocommerce' );
esc_html_e( 'Select from the list below to enable automated taxes and MailChimps best-in-class email services — and design your store with our official, free WooCommerce theme.', 'woocommerce' );
else :
esc_html_e( 'Enhance your store with these recommended features.', 'woocommerce' );
endif;

View File

@ -3,14 +3,12 @@
* WooCommerce Admin
*
* @class WC_Admin
* @author WooThemes
* @category Admin
* @package WooCommerce/Admin
* @version 2.6.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit; // Exit if accessed directly.
}
/**
@ -66,12 +64,12 @@ class WC_Admin {
include_once WC_ABSPATH . 'includes/tracks/class-wc-tracks-footer-pixel.php';
include_once WC_ABSPATH . 'includes/tracks/class-wc-site-tracking.php';
// Help Tabs
// Help Tabs.
if ( apply_filters( 'woocommerce_enable_admin_help_tab', true ) ) {
include_once dirname( __FILE__ ) . '/class-wc-admin-help.php';
}
// Setup/welcome
// Setup/welcome.
if ( ! empty( $_GET['page'] ) ) {
switch ( $_GET['page'] ) {
case 'wc-setup':
@ -80,12 +78,12 @@ class WC_Admin {
}
}
// Importers
// Importers.
if ( defined( 'WP_LOAD_IMPORTERS' ) ) {
include_once dirname( __FILE__ ) . '/class-wc-admin-importers.php';
}
// Helper
// Helper.
include_once dirname( __FILE__ ) . '/helper/class-wc-helper-options.php';
include_once dirname( __FILE__ ) . '/helper/class-wc-helper-api.php';
include_once dirname( __FILE__ ) . '/helper/class-wc-helper-updater.php';
@ -95,7 +93,7 @@ class WC_Admin {
}
/**
* Preloads some functionality of the Helper to be loaded on the `plugins_loaded` hook
* Preloads some functionality of the Helper to be loaded on the `plugins_loaded` hook.
*/
public function preload_helper() {
include_once dirname( __FILE__ ) . '/helper/class-wc-helper-file-headers.php';
@ -105,7 +103,9 @@ class WC_Admin {
* Include admin files conditionally.
*/
public function conditional_includes() {
if ( ! $screen = get_current_screen() ) {
$screen = get_current_screen();
if ( ! $screen ) {
return;
}
@ -138,9 +138,9 @@ class WC_Admin {
* For setup wizard, transient must be present, the user must have access rights, and we must ignore the network/bulk plugin updaters.
*/
public function admin_redirects() {
// Nonced plugin install redirects (whitelisted)
// Nonced plugin install redirects (whitelisted).
if ( ! empty( $_GET['wc-install-plugin-redirect'] ) ) {
$plugin_slug = wc_clean( $_GET['wc-install-plugin-redirect'] );
$plugin_slug = wc_clean( wp_unslash( $_GET['wc-install-plugin-redirect'] ) );
if ( current_user_can( 'install_plugins' ) && in_array( $plugin_slug, array( 'woocommerce-gateway-stripe' ) ) ) {
$nonce = wp_create_nonce( 'install-plugin_' . $plugin_slug );
@ -153,15 +153,19 @@ class WC_Admin {
exit;
}
// Setup wizard redirect
// Setup wizard redirect.
if ( get_transient( '_wc_activation_redirect' ) ) {
delete_transient( '_wc_activation_redirect' );
if ( ( ! empty( $_GET['page'] ) && in_array( $_GET['page'], array( 'wc-setup' ) ) ) || is_network_admin() || isset( $_GET['activate-multi'] ) || ! current_user_can( 'manage_woocommerce' ) || apply_filters( 'woocommerce_prevent_automatic_wizard_redirect', false ) ) {
if ( ( ! empty( $_GET['page'] ) &&
in_array( wp_unslash( $_GET['page'] ), array( 'wc-setup' ) ) ) ||
is_network_admin() || isset( $_GET['activate-multi'] ) ||
! current_user_can( 'manage_woocommerce' ) ||
apply_filters( 'woocommerce_prevent_automatic_wizard_redirect', false ) ) {
return;
}
// If the user needs to install, send them to the setup wizard
// If the user needs to install, send them to the setup wizard.
if ( WC_Admin_Notices::has_notice( 'install' ) ) {
wp_safe_redirect( admin_url( 'index.php?page=wc-setup' ) );
exit;
@ -175,7 +179,7 @@ class WC_Admin {
public function prevent_admin_access() {
$prevent_access = false;
if ( apply_filters( 'woocommerce_disable_admin_bar', true ) && ! is_ajax() && basename( $_SERVER["SCRIPT_FILENAME"] ) !== 'admin-post.php' ) {
if ( apply_filters( 'woocommerce_disable_admin_bar', true ) && ! is_ajax() && basename( wp_unslash( $_SERVER['SCRIPT_FILENAME'] ) ) !== 'admin-post.php' ) {
$has_cap = false;
$access_caps = array( 'edit_posts', 'manage_woocommerce', 'view_admin_dashboard' );
@ -203,28 +207,28 @@ class WC_Admin {
public function preview_emails() {
if ( isset( $_GET['preview_woocommerce_mail'] ) ) {
if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'preview-mail' ) ) {
if ( ! wp_verify_nonce( wp_unslash( $_REQUEST['_wpnonce'], 'preview-mail' ) ) ) {
die( 'Security check' );
}
// load the mailer class
// load the mailer class.
$mailer = WC()->mailer();
// get the preview email subject
// get the preview email subject.
$email_heading = __( 'HTML email template', 'woocommerce' );
// get the preview email content
// get the preview email content.
ob_start();
include 'views/html-email-template-preview.php';
$message = ob_get_clean();
// create a new email
// create a new email.
$email = new WC_Email();
// wrap the content with the email template and then add styles
// wrap the content with the email template and then add styles.
$message = apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) );
// print the preview email
// print the preview email.
echo $message;
exit;
}
@ -234,7 +238,7 @@ class WC_Admin {
* Change the admin footer text on WooCommerce admin pages.
*
* @since 2.3
* @param string $footer_text
* @param string $footer_text text to be rendered in the footer.
* @return string
*/
public function admin_footer_text( $footer_text ) {
@ -249,7 +253,7 @@ class WC_Admin {
// Check to make sure we're on a WooCommerce admin page.
if ( isset( $current_screen->id ) && apply_filters( 'woocommerce_display_admin_footer_text', in_array( $current_screen->id, $wc_pages ) ) ) {
// Change the footer text
// Change the footer text.
if ( ! get_option( 'woocommerce_admin_footer_text_rated' ) ) {
$footer_text = sprintf(
/* translators: 1: WooCommerce 2:: five stars */