phpcs
This commit is contained in:
parent
68573f6ed5
commit
e9d02699c4
|
@ -985,16 +985,19 @@ class WC_Admin_Setup_Wizard {
|
||||||
<ul class="wc-setup-shipping-recommended">
|
<ul class="wc-setup-shipping-recommended">
|
||||||
<?php
|
<?php
|
||||||
if ( $is_wcs_labels_supported ) :
|
if ( $is_wcs_labels_supported ) :
|
||||||
$this->display_recommended_item( array(
|
$this->display_recommended_item(
|
||||||
|
array(
|
||||||
'type' => 'woocommerce_services',
|
'type' => 'woocommerce_services',
|
||||||
'title' => __( 'Print shipping labels at home', 'woocommerce' ),
|
'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' ),
|
'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_url' => WC()->plugin_url() . '/assets/images/obw-woocommerce-services-icon.png',
|
||||||
'img_alt' => __( 'WooCommerce Services icon', 'woocommerce' ),
|
'img_alt' => __( 'WooCommerce Services icon', 'woocommerce' ),
|
||||||
'plugins' => $this->get_wcs_requisite_plugins(),
|
'plugins' => $this->get_wcs_requisite_plugins(),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
elseif ( $is_shipstation_supported ) :
|
elseif ( $is_shipstation_supported ) :
|
||||||
$this->display_recommended_item( array(
|
$this->display_recommended_item(
|
||||||
|
array(
|
||||||
'type' => 'shipstation',
|
'type' => 'shipstation',
|
||||||
'title' => __( 'Print shipping labels at home', 'woocommerce' ),
|
'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' ),
|
'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' ),
|
||||||
|
@ -1006,7 +1009,8 @@ class WC_Admin_Setup_Wizard {
|
||||||
'slug' => 'woocommerce-shipstation-integration',
|
'slug' => 'woocommerce-shipstation-integration',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
endif;
|
endif;
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -3,14 +3,12 @@
|
||||||
* WooCommerce Admin
|
* WooCommerce Admin
|
||||||
*
|
*
|
||||||
* @class WC_Admin
|
* @class WC_Admin
|
||||||
* @author WooThemes
|
|
||||||
* @category Admin
|
|
||||||
* @package WooCommerce/Admin
|
* @package WooCommerce/Admin
|
||||||
* @version 2.6.0
|
* @version 2.6.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
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-tracks-footer-pixel.php';
|
||||||
include_once WC_ABSPATH . 'includes/tracks/class-wc-site-tracking.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 ) ) {
|
if ( apply_filters( 'woocommerce_enable_admin_help_tab', true ) ) {
|
||||||
include_once dirname( __FILE__ ) . '/class-wc-admin-help.php';
|
include_once dirname( __FILE__ ) . '/class-wc-admin-help.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup/welcome
|
// Setup/welcome.
|
||||||
if ( ! empty( $_GET['page'] ) ) {
|
if ( ! empty( $_GET['page'] ) ) {
|
||||||
switch ( $_GET['page'] ) {
|
switch ( $_GET['page'] ) {
|
||||||
case 'wc-setup':
|
case 'wc-setup':
|
||||||
|
@ -80,12 +78,12 @@ class WC_Admin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Importers
|
// Importers.
|
||||||
if ( defined( 'WP_LOAD_IMPORTERS' ) ) {
|
if ( defined( 'WP_LOAD_IMPORTERS' ) ) {
|
||||||
include_once dirname( __FILE__ ) . '/class-wc-admin-importers.php';
|
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-options.php';
|
||||||
include_once dirname( __FILE__ ) . '/helper/class-wc-helper-api.php';
|
include_once dirname( __FILE__ ) . '/helper/class-wc-helper-api.php';
|
||||||
include_once dirname( __FILE__ ) . '/helper/class-wc-helper-updater.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() {
|
public function preload_helper() {
|
||||||
include_once dirname( __FILE__ ) . '/helper/class-wc-helper-file-headers.php';
|
include_once dirname( __FILE__ ) . '/helper/class-wc-helper-file-headers.php';
|
||||||
|
@ -105,7 +103,9 @@ class WC_Admin {
|
||||||
* Include admin files conditionally.
|
* Include admin files conditionally.
|
||||||
*/
|
*/
|
||||||
public function conditional_includes() {
|
public function conditional_includes() {
|
||||||
if ( ! $screen = get_current_screen() ) {
|
$screen = get_current_screen();
|
||||||
|
|
||||||
|
if ( ! $screen ) {
|
||||||
return;
|
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.
|
* 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() {
|
public function admin_redirects() {
|
||||||
// Nonced plugin install redirects (whitelisted)
|
// Nonced plugin install redirects (whitelisted).
|
||||||
if ( ! empty( $_GET['wc-install-plugin-redirect'] ) ) {
|
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' ) ) ) {
|
if ( current_user_can( 'install_plugins' ) && in_array( $plugin_slug, array( 'woocommerce-gateway-stripe' ) ) ) {
|
||||||
$nonce = wp_create_nonce( 'install-plugin_' . $plugin_slug );
|
$nonce = wp_create_nonce( 'install-plugin_' . $plugin_slug );
|
||||||
|
@ -153,15 +153,19 @@ class WC_Admin {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup wizard redirect
|
// Setup wizard redirect.
|
||||||
if ( get_transient( '_wc_activation_redirect' ) ) {
|
if ( get_transient( '_wc_activation_redirect' ) ) {
|
||||||
delete_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;
|
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' ) ) {
|
if ( WC_Admin_Notices::has_notice( 'install' ) ) {
|
||||||
wp_safe_redirect( admin_url( 'index.php?page=wc-setup' ) );
|
wp_safe_redirect( admin_url( 'index.php?page=wc-setup' ) );
|
||||||
exit;
|
exit;
|
||||||
|
@ -175,7 +179,7 @@ class WC_Admin {
|
||||||
public function prevent_admin_access() {
|
public function prevent_admin_access() {
|
||||||
$prevent_access = false;
|
$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;
|
$has_cap = false;
|
||||||
$access_caps = array( 'edit_posts', 'manage_woocommerce', 'view_admin_dashboard' );
|
$access_caps = array( 'edit_posts', 'manage_woocommerce', 'view_admin_dashboard' );
|
||||||
|
|
||||||
|
@ -203,28 +207,28 @@ class WC_Admin {
|
||||||
public function preview_emails() {
|
public function preview_emails() {
|
||||||
|
|
||||||
if ( isset( $_GET['preview_woocommerce_mail'] ) ) {
|
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' );
|
die( 'Security check' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// load the mailer class
|
// load the mailer class.
|
||||||
$mailer = WC()->mailer();
|
$mailer = WC()->mailer();
|
||||||
|
|
||||||
// get the preview email subject
|
// get the preview email subject.
|
||||||
$email_heading = __( 'HTML email template', 'woocommerce' );
|
$email_heading = __( 'HTML email template', 'woocommerce' );
|
||||||
|
|
||||||
// get the preview email content
|
// get the preview email content.
|
||||||
ob_start();
|
ob_start();
|
||||||
include 'views/html-email-template-preview.php';
|
include 'views/html-email-template-preview.php';
|
||||||
$message = ob_get_clean();
|
$message = ob_get_clean();
|
||||||
|
|
||||||
// create a new email
|
// create a new email.
|
||||||
$email = new WC_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 ) ) );
|
$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;
|
echo $message;
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -234,7 +238,7 @@ class WC_Admin {
|
||||||
* Change the admin footer text on WooCommerce admin pages.
|
* Change the admin footer text on WooCommerce admin pages.
|
||||||
*
|
*
|
||||||
* @since 2.3
|
* @since 2.3
|
||||||
* @param string $footer_text
|
* @param string $footer_text text to be rendered in the footer.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function admin_footer_text( $footer_text ) {
|
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.
|
// 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 ) ) ) {
|
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' ) ) {
|
if ( ! get_option( 'woocommerce_admin_footer_text_rated' ) ) {
|
||||||
$footer_text = sprintf(
|
$footer_text = sprintf(
|
||||||
/* translators: 1: WooCommerce 2:: five stars */
|
/* translators: 1: WooCommerce 2:: five stars */
|
||||||
|
|
Loading…
Reference in New Issue