Merged in feature/117-dev-dev01 (pull request #8)
auto-patch 117-dev-dev01-2023-12-15T16_09_06 * auto-patch 117-dev-dev01-2023-12-15T16_09_06
This commit is contained in:
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
*
|
||||
* The main entry-point for all things related to the Helper.
|
||||
* The Helper manages the connection between the store and
|
||||
* an account on WooCommerce.com.
|
||||
* an account on Woo.com.
|
||||
*/
|
||||
class WC_Helper_Admin {
|
||||
|
||||
@@ -52,38 +52,36 @@ class WC_Helper_Admin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the URL for connecting or disconnecting the store to/from WooCommerce.com.
|
||||
* Generates the URL for connecting or disconnecting the store to/from Woo.com.
|
||||
* Approach taken from existing helper code that isn't exposed.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_connection_url() {
|
||||
// No active connection.
|
||||
if ( ! WC_Helper::is_site_connected() ) {
|
||||
$connect_url = add_query_arg(
|
||||
array(
|
||||
'page' => 'wc-addons',
|
||||
'section' => 'helper',
|
||||
'wc-helper-connect' => 1,
|
||||
'wc-helper-nonce' => wp_create_nonce( 'connect' ),
|
||||
),
|
||||
admin_url( 'admin.php' )
|
||||
);
|
||||
global $current_screen;
|
||||
|
||||
return $connect_url;
|
||||
}
|
||||
|
||||
$connect_url = add_query_arg(
|
||||
array(
|
||||
'page' => 'wc-addons',
|
||||
'section' => 'helper',
|
||||
'wc-helper-disconnect' => 1,
|
||||
'wc-helper-nonce' => wp_create_nonce( 'disconnect' ),
|
||||
),
|
||||
admin_url( 'admin.php' )
|
||||
$connect_url_args = array(
|
||||
'page' => 'wc-addons',
|
||||
'section' => 'helper',
|
||||
);
|
||||
|
||||
return $connect_url;
|
||||
// No active connection.
|
||||
if ( WC_Helper::is_site_connected() ) {
|
||||
$connect_url_args['wc-helper-disconnect'] = 1;
|
||||
$connect_url_args['wc-helper-nonce'] = wp_create_nonce( 'disconnect' );
|
||||
} else {
|
||||
$connect_url_args['wc-helper-connect'] = 1;
|
||||
$connect_url_args['wc-helper-nonce'] = wp_create_nonce( 'connect' );
|
||||
}
|
||||
|
||||
if ( isset( $current_screen->id ) && 'woocommerce_page_wc-admin' === $current_screen->id ) {
|
||||
$connect_url_args['redirect-to-wc-admin'] = 1;
|
||||
}
|
||||
|
||||
return add_query_arg(
|
||||
$connect_url_args,
|
||||
admin_url( 'admin.php' )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,7 +110,7 @@ class WC_Helper_Admin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch featured procucts from WooCommerce.com and serve them
|
||||
* Fetch featured products from Woo.com and serve them
|
||||
* as JSON.
|
||||
*/
|
||||
public static function get_featured() {
|
||||
@@ -124,7 +122,6 @@ class WC_Helper_Admin {
|
||||
|
||||
wp_send_json( $featured );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WC_Helper_Admin::load();
|
||||
|
||||
Reference in New Issue
Block a user