PSR-4ify the feature loading classes.
This commit is contained in:
parent
ce7267b198
commit
55400474ee
|
@ -9,6 +9,8 @@
|
|||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
use Automattic\WooCommerce\Admin\Features\WC_Admin_Onboarding;
|
||||
|
||||
/**
|
||||
* Onboarding Profile controller.
|
||||
*
|
||||
|
|
|
@ -130,7 +130,7 @@ class WC_Admin_Loader {
|
|||
$features = self::get_features();
|
||||
foreach ( $features as $feature ) {
|
||||
$feature = strtolower( str_replace( '-', '_', $feature ) );
|
||||
$feature = 'WC_Admin_' . ucwords( $feature, '_' );
|
||||
$feature = 'Automattic\WooCommerce\Admin\Features\WC_Admin_' . ucwords( $feature, '_' );
|
||||
|
||||
if ( class_exists( $feature ) ) {
|
||||
new $feature;
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
* @package Woocommerce Admin
|
||||
*/
|
||||
|
||||
namespace Automattic\WooCommerce\Admin\Features;
|
||||
|
||||
use Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes;
|
||||
use Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Settings_Notes;
|
||||
|
|
@ -6,6 +6,8 @@
|
|||
* @package Woocommerce Admin
|
||||
*/
|
||||
|
||||
namespace Automattic\WooCommerce\Admin\Features;
|
||||
|
||||
/**
|
||||
* Contains backend logic for the Analytics feature.
|
||||
*/
|
|
@ -6,6 +6,8 @@
|
|||
* @package Woocommerce Admin
|
||||
*/
|
||||
|
||||
namespace Automattic\WooCommerce\Admin\Features;
|
||||
|
||||
/**
|
||||
* Contains backend logic for the dashboard feature.
|
||||
*/
|
|
@ -6,6 +6,8 @@
|
|||
* @package Woocommerce Admin
|
||||
*/
|
||||
|
||||
namespace Automattic\WooCommerce\Admin\Features;
|
||||
|
||||
/**
|
||||
* Contains backend logic for the onboarding profile and checklist feature.
|
||||
*/
|
||||
|
@ -228,9 +230,9 @@ class WC_Admin_Onboarding {
|
|||
}
|
||||
|
||||
foreach ( $themes as $theme ) {
|
||||
$directory = new RecursiveDirectoryIterator( $theme->theme_root . '/' . $theme->stylesheet );
|
||||
$iterator = new RecursiveIteratorIterator( $directory );
|
||||
$files = new RegexIterator( $iterator, '/^.+\.php$/i', RecursiveRegexIterator::GET_MATCH );
|
||||
$directory = new \RecursiveDirectoryIterator( $theme->theme_root . '/' . $theme->stylesheet );
|
||||
$iterator = new \RecursiveIteratorIterator( $directory );
|
||||
$files = new \RegexIterator( $iterator, '/^.+\.php$/i', \RecursiveRegexIterator::GET_MATCH );
|
||||
|
||||
foreach ( $files as $file ) {
|
||||
$content = file_get_contents( $file[0] );
|
||||
|
@ -361,14 +363,14 @@ class WC_Admin_Onboarding {
|
|||
*/
|
||||
public static function reset_onboarding() {
|
||||
if (
|
||||
! WC_Admin_Loader::is_admin_page() ||
|
||||
! \WC_Admin_Loader::is_admin_page() ||
|
||||
! isset( $_GET['reset_onboarding'] ) || // WPCS: CSRF ok.
|
||||
1 !== absint( $_GET['reset_onboarding'] ) // WPCS: CSRF ok.
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$request = new WP_REST_Request( 'POST', '/wc-admin/v1/onboarding/profile' );
|
||||
$request = new \WP_REST_Request( 'POST', '/wc-admin/v1/onboarding/profile' );
|
||||
$request->set_headers( array( 'content-type' => 'application/json' ) );
|
||||
$request->set_body(
|
||||
wp_json_encode(
|
|
@ -6,6 +6,8 @@
|
|||
* @package Woocommerce Admin
|
||||
*/
|
||||
|
||||
namespace Automattic\WooCommerce\Admin\Features;
|
||||
|
||||
/**
|
||||
* Contains the logic for completing onboarding tasks.
|
||||
*/
|
Loading…
Reference in New Issue