From 71660fa9975cbafcbe3d2b61e5e2259c734bf23a Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Fri, 15 Feb 2019 16:03:32 -0400 Subject: [PATCH 1/2] implement WC_ADMIN_ABSPATH in wc-admin.php --- plugins/woocommerce-admin/wc-admin.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins/woocommerce-admin/wc-admin.php b/plugins/woocommerce-admin/wc-admin.php index 02146e2d2d6..420ccf5e214 100755 --- a/plugins/woocommerce-admin/wc-admin.php +++ b/plugins/woocommerce-admin/wc-admin.php @@ -137,21 +137,21 @@ function wc_admin_plugins_loaded() { } if ( ! function_exists( 'wc_admin_get_feature_config' ) ) { - require_once dirname( __FILE__ ) . '/includes/feature-config.php'; + require_once WC_ADMIN_ABSPATH . '/includes/feature-config.php'; } // Initialize the WC API extensions. - require_once dirname( __FILE__ ) . '/includes/class-wc-admin-reports-sync.php'; - require_once dirname( __FILE__ ) . '/includes/class-wc-admin-install.php'; - require_once dirname( __FILE__ ) . '/includes/class-wc-admin-api-init.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-sync.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-install.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-api-init.php'; // Some common utilities. - require_once dirname( __FILE__ ) . '/lib/common.php'; + require_once WC_ADMIN_ABSPATH . '/lib/common.php'; // Admin note providers. - require_once dirname( __FILE__ ) . '/includes/class-wc-admin-notes-new-sales-record.php'; - require_once dirname( __FILE__ ) . '/includes/class-wc-admin-notes-settings-notes.php'; - require_once dirname( __FILE__ ) . '/includes/class-wc-admin-notes-woo-subscriptions-notes.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-notes-new-sales-record.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-notes-settings-notes.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-notes-woo-subscriptions-notes.php'; // Verify we have a proper build. if ( ! wc_admin_build_file_exists() ) { @@ -160,10 +160,10 @@ function wc_admin_plugins_loaded() { } // Register script files. - require_once dirname( __FILE__ ) . '/lib/client-assets.php'; + require_once WC_ADMIN_ABSPATH . '/lib/client-assets.php'; // Create the Admin pages. - require_once dirname( __FILE__ ) . '/lib/admin.php'; + require_once WC_ADMIN_ABSPATH . '/lib/admin.php'; } add_action( 'plugins_loaded', 'wc_admin_plugins_loaded' ); From e1af3cdf1851d8201a7455bd39a1b5eca8755ca9 Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Tue, 19 Feb 2019 15:27:42 -0400 Subject: [PATCH 2/2] implement WC_ADMIN_ABSPATH in class-wc-admin-api-init.php --- .../includes/class-wc-admin-api-init.php | 160 +++++++++--------- 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/plugins/woocommerce-admin/includes/class-wc-admin-api-init.php b/plugins/woocommerce-admin/includes/class-wc-admin-api-init.php index fa98436ed9a..09c36182cc7 100644 --- a/plugins/woocommerce-admin/includes/class-wc-admin-api-init.php +++ b/plugins/woocommerce-admin/includes/class-wc-admin-api-init.php @@ -33,108 +33,108 @@ class WC_Admin_Api_Init { */ public function init_classes() { // Interfaces. - require_once dirname( __FILE__ ) . '/interfaces/class-wc-admin-reports-data-store-interface.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-query.php'; + require_once WC_ADMIN_ABSPATH . '/includes/interfaces/class-wc-admin-reports-data-store-interface.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-query.php'; // Common date time code. - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-interval.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-interval.php'; // Exceptions. - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-parameter-exception.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-parameter-exception.php'; // WC Class extensions. - require_once dirname( __FILE__ ) . '/class-wc-admin-order.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-order.php'; // Segmentation. - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-segmenting.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-orders-stats-segmenting.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-products-stats-segmenting.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-coupons-stats-segmenting.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-taxes-stats-segmenting.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-segmenting.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-orders-stats-segmenting.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-products-stats-segmenting.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-coupons-stats-segmenting.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-taxes-stats-segmenting.php'; // Query classes for reports. - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-revenue-query.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-orders-query.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-orders-stats-query.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-products-query.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-variations-query.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-products-stats-query.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-categories-query.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-taxes-query.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-taxes-stats-query.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-coupons-query.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-coupons-stats-query.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-downloads-query.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-downloads-stats-query.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-customers-query.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-customers-stats-query.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-reports-stock-stats-query.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-revenue-query.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-orders-query.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-orders-stats-query.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-products-query.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-variations-query.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-products-stats-query.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-categories-query.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-taxes-query.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-taxes-stats-query.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-coupons-query.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-coupons-stats-query.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-downloads-query.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-downloads-stats-query.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-customers-query.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-customers-stats-query.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-reports-stock-stats-query.php'; // Data stores. - require_once dirname( __FILE__ ) . '/data-stores/class-wc-admin-reports-data-store.php'; - require_once dirname( __FILE__ ) . '/data-stores/class-wc-admin-reports-orders-data-store.php'; - require_once dirname( __FILE__ ) . '/data-stores/class-wc-admin-reports-orders-stats-data-store.php'; - require_once dirname( __FILE__ ) . '/data-stores/class-wc-admin-reports-products-data-store.php'; - require_once dirname( __FILE__ ) . '/data-stores/class-wc-admin-reports-variations-data-store.php'; - require_once dirname( __FILE__ ) . '/data-stores/class-wc-admin-reports-products-stats-data-store.php'; - require_once dirname( __FILE__ ) . '/data-stores/class-wc-admin-reports-categories-data-store.php'; - require_once dirname( __FILE__ ) . '/data-stores/class-wc-admin-reports-taxes-data-store.php'; - require_once dirname( __FILE__ ) . '/data-stores/class-wc-admin-reports-taxes-stats-data-store.php'; - require_once dirname( __FILE__ ) . '/data-stores/class-wc-admin-reports-coupons-data-store.php'; - require_once dirname( __FILE__ ) . '/data-stores/class-wc-admin-reports-coupons-stats-data-store.php'; - require_once dirname( __FILE__ ) . '/data-stores/class-wc-admin-reports-downloads-data-store.php'; - require_once dirname( __FILE__ ) . '/data-stores/class-wc-admin-reports-downloads-stats-data-store.php'; - require_once dirname( __FILE__ ) . '/data-stores/class-wc-admin-reports-customers-data-store.php'; - require_once dirname( __FILE__ ) . '/data-stores/class-wc-admin-reports-customers-stats-data-store.php'; - require_once dirname( __FILE__ ) . '/data-stores/class-wc-admin-reports-stock-stats-data-store.php'; + require_once WC_ADMIN_ABSPATH . '/includes/data-stores/class-wc-admin-reports-data-store.php'; + require_once WC_ADMIN_ABSPATH . '/includes/data-stores/class-wc-admin-reports-orders-data-store.php'; + require_once WC_ADMIN_ABSPATH . '/includes/data-stores/class-wc-admin-reports-orders-stats-data-store.php'; + require_once WC_ADMIN_ABSPATH . '/includes/data-stores/class-wc-admin-reports-products-data-store.php'; + require_once WC_ADMIN_ABSPATH . '/includes/data-stores/class-wc-admin-reports-variations-data-store.php'; + require_once WC_ADMIN_ABSPATH . '/includes/data-stores/class-wc-admin-reports-products-stats-data-store.php'; + require_once WC_ADMIN_ABSPATH . '/includes/data-stores/class-wc-admin-reports-categories-data-store.php'; + require_once WC_ADMIN_ABSPATH . '/includes/data-stores/class-wc-admin-reports-taxes-data-store.php'; + require_once WC_ADMIN_ABSPATH . '/includes/data-stores/class-wc-admin-reports-taxes-stats-data-store.php'; + require_once WC_ADMIN_ABSPATH . '/includes/data-stores/class-wc-admin-reports-coupons-data-store.php'; + require_once WC_ADMIN_ABSPATH . '/includes/data-stores/class-wc-admin-reports-coupons-stats-data-store.php'; + require_once WC_ADMIN_ABSPATH . '/includes/data-stores/class-wc-admin-reports-downloads-data-store.php'; + require_once WC_ADMIN_ABSPATH . '/includes/data-stores/class-wc-admin-reports-downloads-stats-data-store.php'; + require_once WC_ADMIN_ABSPATH . '/includes/data-stores/class-wc-admin-reports-customers-data-store.php'; + require_once WC_ADMIN_ABSPATH . '/includes/data-stores/class-wc-admin-reports-customers-stats-data-store.php'; + require_once WC_ADMIN_ABSPATH . '/includes/data-stores/class-wc-admin-reports-stock-stats-data-store.php'; // Data triggers. - require_once dirname( __FILE__ ) . '/data-stores/class-wc-admin-notes-data-store.php'; + require_once WC_ADMIN_ABSPATH . '/includes/data-stores/class-wc-admin-notes-data-store.php'; // CRUD classes. - require_once dirname( __FILE__ ) . '/class-wc-admin-note.php'; - require_once dirname( __FILE__ ) . '/class-wc-admin-notes.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-note.php'; + require_once WC_ADMIN_ABSPATH . '/includes/class-wc-admin-notes.php'; } /** * Init REST API. */ public function rest_api_init() { - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-admin-notes-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-coupons-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-data-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-data-countries-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-data-download-ips-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-orders-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-products-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-product-categories-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-product-variations-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-product-reviews-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-product-variations-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-setting-options-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-system-status-tools-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-categories-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-coupons-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-coupons-stats-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-customers-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-customers-stats-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-downloads-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-downloads-files-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-downloads-stats-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-orders-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-orders-stats-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-products-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-variations-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-products-stats-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-performance-indicators-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-revenue-stats-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-taxes-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-taxes-stats-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-stock-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-reports-stock-stats-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-taxes-controller.php'; - require_once dirname( __FILE__ ) . '/api/class-wc-admin-rest-customers-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-admin-notes-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-coupons-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-data-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-data-countries-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-data-download-ips-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-orders-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-products-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-product-categories-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-product-variations-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-product-reviews-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-product-variations-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-setting-options-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-system-status-tools-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-categories-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-coupons-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-coupons-stats-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-customers-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-customers-stats-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-downloads-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-downloads-files-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-downloads-stats-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-orders-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-orders-stats-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-products-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-variations-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-products-stats-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-performance-indicators-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-revenue-stats-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-taxes-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-taxes-stats-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-stock-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-reports-stock-stats-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-taxes-controller.php'; + require_once WC_ADMIN_ABSPATH . '/includes/api/class-wc-admin-rest-customers-controller.php'; $controllers = apply_filters( 'woocommerce_admin_rest_controllers',