2021-03-01 03:57:53 +00:00
|
|
|
<?php
|
2022-07-27 18:01:18 +00:00
|
|
|
/**
|
|
|
|
* API initialization for beta testing.
|
|
|
|
*
|
|
|
|
* @package WC_Beta_Tester
|
|
|
|
*/
|
2021-03-04 02:36:13 +00:00
|
|
|
|
2023-08-09 00:20:34 +00:00
|
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
|
2022-07-27 18:01:18 +00:00
|
|
|
/**
|
|
|
|
* Register the test helper route.
|
|
|
|
*
|
|
|
|
* @param string $route Route path.
|
|
|
|
* @param string $callback Callback function name.
|
|
|
|
* @param array $additional_options Additional options passed to route registration.
|
|
|
|
*/
|
|
|
|
function register_woocommerce_admin_test_helper_rest_route( $route, $callback, $additional_options = array() ) {
|
|
|
|
add_action(
|
|
|
|
'rest_api_init',
|
2024-06-26 04:09:14 +00:00
|
|
|
function () use ( $route, $callback, $additional_options ) {
|
2022-07-27 18:01:18 +00:00
|
|
|
$default_options = array(
|
2022-12-21 00:58:10 +00:00
|
|
|
'methods' => 'POST',
|
|
|
|
'callback' => $callback,
|
2024-06-26 04:09:14 +00:00
|
|
|
'permission_callback' => function ( $request ) {
|
2022-07-27 18:01:18 +00:00
|
|
|
if ( ! wc_rest_check_manager_permissions( 'settings', 'edit' ) ) {
|
|
|
|
return new \WP_Error(
|
|
|
|
'woocommerce_rest_cannot_edit',
|
2023-08-09 00:20:34 +00:00
|
|
|
__( 'Sorry, you cannot perform this action', 'woocommerce-beta-tester' )
|
2022-07-27 18:01:18 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
);
|
2021-03-04 02:36:13 +00:00
|
|
|
|
2022-07-27 18:01:18 +00:00
|
|
|
$default_options = array_merge( $default_options, $additional_options );
|
2021-03-04 02:36:13 +00:00
|
|
|
|
2022-07-27 18:01:18 +00:00
|
|
|
register_rest_route(
|
|
|
|
'wc-admin-test-helper',
|
|
|
|
$route,
|
|
|
|
$default_options
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
2021-03-03 06:27:47 +00:00
|
|
|
}
|
|
|
|
|
2022-11-30 01:17:27 +00:00
|
|
|
require 'admin-notes/delete-all-notes.php';
|
|
|
|
require 'admin-notes/add-note.php';
|
|
|
|
require 'tools/trigger-wca-install.php';
|
|
|
|
require 'tools/trigger-cron-job.php';
|
|
|
|
require 'tools/run-wc-admin-daily.php';
|
|
|
|
require 'options/rest-api.php';
|
|
|
|
require 'tools/delete-all-products.php';
|
|
|
|
require 'tools/disable-wc-email.php';
|
|
|
|
require 'tools/trigger-update-callbacks.php';
|
2023-10-12 14:05:58 +00:00
|
|
|
require 'tools/reset-cys.php';
|
2024-07-16 11:55:38 +00:00
|
|
|
require 'tools/set-block-template-logging-threshold.php';
|
|
|
|
require 'tools/set-coming-soon-mode.php';
|
2024-08-22 02:27:35 +00:00
|
|
|
require 'tools/fake-woo-payments-gateway.php';
|
2022-11-30 01:17:27 +00:00
|
|
|
require 'tracks/class-tracks-debug-log.php';
|
|
|
|
require 'features/features.php';
|
2023-08-09 00:20:34 +00:00
|
|
|
require 'rest-api-filters/class-wca-test-helper-rest-api-filters.php';
|
2022-11-30 01:17:27 +00:00
|
|
|
require 'rest-api-filters/hook.php';
|
|
|
|
require 'live-branches/manifest.php';
|
2024-04-05 00:47:47 +00:00
|
|
|
require 'live-branches/install.php';
|
|
|
|
require 'remote-spec-validator/class-wca-test-helper-remote-spec-validator.php';
|
2024-06-26 04:09:14 +00:00
|
|
|
require 'remote-inbox-notifications/class-wca-test-helper-remote-inbox-notifications.php';
|
2024-08-08 03:12:51 +00:00
|
|
|
require 'remote-logging/remote-logging.php';
|
2024-08-19 08:35:59 +00:00
|
|
|
require 'tools/wccom-request-errors.php';
|
[Beta tester] Add tool for changing woocommerce.com base URL (#51537)
* Refactor WooCommerce Helper class
This commit refactors the WooCommerce Helper class in the `class-wc-helper.php` file. The changes include:
- Updating the comparison operator from `==` to `===` in the `activate_plugin` condition.
- Renaming the `get_install_base_url` method to `get_woocommerce_com_base_url`.
- Adding a new `get_install_base_url` method that returns the base URL for the plugin auto installer.
These changes improve the readability and maintainability of the code.
* Refactor data source poller classes for marketing recommendations, payment gateway suggestions, shipping partner suggestions, inbox notifications, remote free extensions, and WooPayments promotion
- Refactor the data source poller classes for marketing recommendations, payment gateway suggestions, shipping partner suggestions, inbox notifications, remote free extensions, and WooPayments promotion to use a dynamic base URL for the data sources.
- Update the deprecated DATA_SOURCES constant to an empty array in each class.
- Add a new method get_data_sources() in each class to return the updated data sources with the dynamic base URL.
- Modify the constructor of each class to use the get_data_sources() method instead of the deprecated DATA_SOURCES constant.
* Add changelog
* Add set-woocom-base-url tool
* Add changelog
* Rename woo_com and woocom -> wccom
* Change to falsy check !url
* Change woocom/WOOCOM to wccom/WCCOM
* Change default value to https://woocommerce.com/
---------
Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2024-09-24 11:37:57 +00:00
|
|
|
require 'tools/set-wccom-base-url.php';
|
2024-10-20 23:22:16 +00:00
|
|
|
require 'tools/reset-launch-your-store.php';
|