diff --git a/admin/class-openedx-commerce-admin.php b/admin/class-openedx-commerce-admin.php index f67b49a..dbe2204 100644 --- a/admin/class-openedx-commerce-admin.php +++ b/admin/class-openedx-commerce-admin.php @@ -9,12 +9,12 @@ * @since 1.0.0 */ -namespace OpenedXCommerce\admin; +namespace OpenedX_Commerce\admin; -use OpenedXCommerce\model\Openedx_Commerce_Enrollment; -use OpenedXCommerce\model\Openedx_Commerce_Post_Type; -use OpenedXCommerce\admin\views\Openedx_Commerce_Enrollment_Info_Form; -use OpenedXCommerce\utils; +use OpenedX_Commerce\model\Openedx_Commerce_Enrollment; +use OpenedX_Commerce\model\Openedx_Commerce_Post_Type; +use OpenedX_Commerce\admin\views\Openedx_Commerce_Enrollment_Info_Form; +use OpenedX_Commerce\utils; /** diff --git a/admin/views/class-openedx-commerce-enrollment-info-form.php b/admin/views/class-openedx-commerce-enrollment-info-form.php index e9c2b02..92a46f8 100644 --- a/admin/views/class-openedx-commerce-enrollment-info-form.php +++ b/admin/views/class-openedx-commerce-enrollment-info-form.php @@ -8,10 +8,10 @@ * @since 1.0.0 */ -namespace OpenedXCommerce\admin\views; +namespace OpenedX_Commerce\admin\views; -use OpenedXCommerce\model\Openedx_Commerce_Log; -use OpenedXCommerce\utils; +use OpenedX_Commerce\model\Openedx_Commerce_Log; +use OpenedX_Commerce\utils; if ( ! defined( 'ABSPATH' ) ) { exit; diff --git a/admin/views/class-openedx-commerce-settings.php b/admin/views/class-openedx-commerce-settings.php index e29d237..518c8cf 100644 --- a/admin/views/class-openedx-commerce-settings.php +++ b/admin/views/class-openedx-commerce-settings.php @@ -8,9 +8,9 @@ * @since 1.6.0 */ -namespace OpenedXCommerce\admin\views; +namespace OpenedX_Commerce\admin\views; -use OpenedXCommerce\model\Openedx_Commerce_Api_Calls; +use OpenedX_Commerce\model\Openedx_Commerce_Api_Calls; use DateTime; use DateInterval; diff --git a/composer.json b/composer.json index 83dc14f..a5824c4 100644 --- a/composer.json +++ b/composer.json @@ -29,13 +29,13 @@ "test/" ], "psr-4": { - "OpenedXCommerce\\": "includes/", - "OpenedXCommerce\\model\\": "includes/model/", - "OpenedXCommerce\\admin\\": "admin/", - "OpenedXCommerce\\admin\\views\\": "admin/views/", - "OpenedXCommerce\\public\\": "public/", - "OpenedXCommerce\\utils\\": "utils/", - "OpenedXCommerce\\tests\\": "test/" + "OpenedX_Commerce\\": "includes/", + "OpenedX_Commerce\\model\\": "includes/model/", + "OpenedX_Commerce\\admin\\": "admin/", + "OpenedX_Commerce\\admin\\views\\": "admin/views/", + "OpenedX_Commerce\\public\\": "public/", + "OpenedX_Commerce\\utils\\": "utils/", + "OpenedX_Commerce\\tests\\": "test/" } }, "require": { diff --git a/includes/class-openedx-commerce-activator.php b/includes/class-openedx-commerce-activator.php index 384a1e3..795534f 100644 --- a/includes/class-openedx-commerce-activator.php +++ b/includes/class-openedx-commerce-activator.php @@ -9,7 +9,7 @@ * @subpackage Openedx_Commerce/includes */ -namespace OpenedXCommerce; +namespace OpenedX_Commerce; /** * Fired during plugin activation. diff --git a/includes/class-openedx-commerce-deactivator.php b/includes/class-openedx-commerce-deactivator.php index c9ceb19..48b32fd 100644 --- a/includes/class-openedx-commerce-deactivator.php +++ b/includes/class-openedx-commerce-deactivator.php @@ -9,7 +9,7 @@ * @subpackage Openedx_Commerce/includes */ -namespace OpenedXCommerce; +namespace OpenedX_Commerce; /** * Fired during plugin deactivation. diff --git a/includes/class-openedx-commerce-i18n.php b/includes/class-openedx-commerce-i18n.php index 19d9f73..035ba20 100644 --- a/includes/class-openedx-commerce-i18n.php +++ b/includes/class-openedx-commerce-i18n.php @@ -12,7 +12,7 @@ * @subpackage Openedx_Commerce/includes */ -namespace OpenedXCommerce; +namespace OpenedX_Commerce; /** * Define the internationalization functionality. diff --git a/includes/class-openedx-commerce-loader.php b/includes/class-openedx-commerce-loader.php index 59f0c6b..287f06c 100644 --- a/includes/class-openedx-commerce-loader.php +++ b/includes/class-openedx-commerce-loader.php @@ -9,7 +9,7 @@ * @subpackage Openedx_Commerce/includes */ -namespace OpenedXCommerce; +namespace OpenedX_Commerce; /** * Register all actions and filters for the plugin. diff --git a/includes/class-openedx-commerce.php b/includes/class-openedx-commerce.php index 6a025e1..6f3a5c0 100644 --- a/includes/class-openedx-commerce.php +++ b/includes/class-openedx-commerce.php @@ -14,12 +14,12 @@ * @author eduNEXT */ -namespace OpenedXCommerce; +namespace OpenedX_Commerce; -use OpenedXCommerce\admin\Openedx_Commerce_Admin; -use OpenedXCommerce\public\Openedx_Commerce_Public; -use OpenedXCommerce\admin\views\Openedx_Commerce_Settings; -use OpenedXCommerce\model\Openedx_Commerce_Enrollment; +use OpenedX_Commerce\admin\Openedx_Commerce_Admin; +use OpenedX_Commerce\public\Openedx_Commerce_Public; +use OpenedX_Commerce\admin\views\Openedx_Commerce_Settings; +use OpenedX_Commerce\model\Openedx_Commerce_Enrollment; /** * This class contains the function to register a new custom post type. diff --git a/includes/model/class-openedx-commerce-api-calls.php b/includes/model/class-openedx-commerce-api-calls.php index 58b53ea..e029ec7 100644 --- a/includes/model/class-openedx-commerce-api-calls.php +++ b/includes/model/class-openedx-commerce-api-calls.php @@ -9,7 +9,7 @@ * @since 1.6.0 */ -namespace OpenedXCommerce\model; +namespace OpenedX_Commerce\model; require_once plugin_dir_path( dirname( __DIR__ ) ) . 'vendor/autoload.php'; use DateTime; diff --git a/includes/model/class-openedx-commerce-enrollment.php b/includes/model/class-openedx-commerce-enrollment.php index 7d6fda6..b65930e 100644 --- a/includes/model/class-openedx-commerce-enrollment.php +++ b/includes/model/class-openedx-commerce-enrollment.php @@ -10,12 +10,12 @@ * @since 1.0.0 */ -namespace OpenedXCommerce\model; +namespace OpenedX_Commerce\model; -use OpenedXCommerce\model\Openedx_Commerce_Log; -use OpenedXCommerce\Openedx_Commerce; -use OpenedXCommerce\admin\Openedx_Commerce_Admin; -use OpenedXCommerce\model\Openedx_Commerce_Api_Calls; +use OpenedX_Commerce\model\Openedx_Commerce_Log; +use OpenedX_Commerce\Openedx_Commerce; +use OpenedX_Commerce\admin\Openedx_Commerce_Admin; +use OpenedX_Commerce\model\Openedx_Commerce_Api_Calls; if ( ! defined( 'ABSPATH' ) ) { exit; diff --git a/includes/model/class-openedx-commerce-log.php b/includes/model/class-openedx-commerce-log.php index ec219c0..d401588 100644 --- a/includes/model/class-openedx-commerce-log.php +++ b/includes/model/class-openedx-commerce-log.php @@ -9,7 +9,7 @@ * @since 1.4.0 */ -namespace OpenedXCommerce\model; +namespace OpenedX_Commerce\model; if ( ! defined( 'ABSPATH' ) ) { exit; diff --git a/includes/model/class-openedx-commerce-post-type.php b/includes/model/class-openedx-commerce-post-type.php index 90089b8..eb37317 100644 --- a/includes/model/class-openedx-commerce-post-type.php +++ b/includes/model/class-openedx-commerce-post-type.php @@ -8,7 +8,7 @@ * @since 1.0.0 */ -namespace OpenedXCommerce\model; +namespace OpenedX_Commerce\model; if ( ! defined( 'ABSPATH' ) ) { exit; @@ -124,7 +124,7 @@ public function register_post_type() { ); $args = array( - 'labels' => apply_filters( $this->post_type . '_labels', $labels ), + 'labels' => apply_filters( "openedx_commerce_{$this->post_type}_labels", $labels ), 'description' => $this->description, 'public' => true, 'publicly_queryable' => true, @@ -148,6 +148,6 @@ public function register_post_type() { $args = array_merge( $args, $this->options ); - register_post_type( $this->post_type, apply_filters( $this->post_type . '_register_args', $args, $this->post_type ) ); + register_post_type( $this->post_type, apply_filters( "openedx_commerce_{$this->post_type}_register_args", $args, $this->post_type ) ); } } diff --git a/openedx-commerce.php b/openedx-commerce.php index 5ed6dfd..9658b4f 100644 --- a/openedx-commerce.php +++ b/openedx-commerce.php @@ -13,14 +13,14 @@ * Requires at least: 6.3 * Requires PHP: 8.0 * - * @package Openedx_Commerce + * @package OpenedX_Commerce * * @wordpress-plugin */ -use OpenedXCommerce\Openedx_Commerce_Activator; -use OpenedXCommerce\Openedx_Commerce_Deactivator; -use OpenedXCommerce\Openedx_Commerce; +use OpenedX_Commerce\Openedx_Commerce_Activator; +use OpenedX_Commerce\Openedx_Commerce_Deactivator; +use OpenedX_Commerce\Openedx_Commerce; // If this file is called directly, abort. if ( ! defined( 'WPINC' ) ) { @@ -38,7 +38,7 @@ * The code that runs during plugin activation. * This action is documented in includes/class-openedx-commerce-activator.php */ -function activate_openedx_commerce_plugin() { +function openedx_commerce_plugin_activate() { include_once plugin_dir_path( __FILE__ ) . 'includes/class-openedx-commerce-activator.php'; Openedx_Commerce_Activator::activate(); } @@ -47,7 +47,7 @@ function activate_openedx_commerce_plugin() { * The code that runs during plugin deactivation. * This action is documented in includes/class-openedx-commerce-deactivator.php */ -function deactivate_openedx_commerce_plugin() { +function openedx_commerce_plugin_deactivate() { include_once plugin_dir_path( __FILE__ ) . 'includes/class-openedx-commerce-deactivator.php'; Openedx_Commerce_Deactivator::deactivate(); } @@ -55,7 +55,7 @@ function deactivate_openedx_commerce_plugin() { /** * Create the table for the logs on plugin activation */ -function create_enrollment_logs_table() { +function openedx_commerce_create_enrollment_logs_table() { global $wpdb; $logs_table = wp_cache_get( 'enrollment_logs_req_table', 'db' ); $logs_table_name = $wpdb->prefix . 'enrollment_logs_req_table'; @@ -85,9 +85,9 @@ function create_enrollment_logs_table() { } } -register_activation_hook( __FILE__, 'activate_openedx_commerce_plugin' ); -register_activation_hook( __FILE__, 'create_enrollment_logs_table' ); -register_deactivation_hook( __FILE__, 'deactivate_openedx_commerce_plugin' ); +register_activation_hook( __FILE__, 'openedx_commerce_plugin_activate' ); +register_activation_hook( __FILE__, 'openedx_commerce_create_enrollment_logs_table' ); +register_deactivation_hook( __FILE__, 'openedx_commerce_plugin_deactivate' ); /** * The core plugin class that is used to define internationalization, @@ -104,9 +104,9 @@ function create_enrollment_logs_table() { * * @since 1.0.0 */ -function run_openedx_commerce_plugin() { +function openedx_commerce_plugin_run() { $plugin = new Openedx_Commerce(); $plugin->run(); } -run_openedx_commerce_plugin(); +openedx_commerce_plugin_run(); diff --git a/phpcs.xml b/phpcs.xml index 222dd59..98fc306 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -18,6 +18,11 @@ + + + + + diff --git a/public/class-openedx-commerce-public.php b/public/class-openedx-commerce-public.php index 36cb691..da3b7e2 100644 --- a/public/class-openedx-commerce-public.php +++ b/public/class-openedx-commerce-public.php @@ -9,7 +9,7 @@ * @subpackage Openedx_Commerce/public */ -namespace OpenedXCommerce\public; +namespace OpenedX_Commerce\public; /** * The public-facing functionality of the plugin. diff --git a/test/class-enrollment-test.php b/test/class-enrollment-test.php index 68664a2..034d81c 100644 --- a/test/class-enrollment-test.php +++ b/test/class-enrollment-test.php @@ -6,11 +6,11 @@ * @subpackage openedx-commerce/tests */ -namespace OpenedXCommerce\tests; +namespace OpenedX_Commerce\tests; -use OpenedXCommerce\model\Openedx_Commerce_Enrollment; -use OpenedXCommerce\model\Openedx_Commerce_Post_Type; -use OpenedXCommerce\admin\Openedx_Commerce_Admin; +use OpenedX_Commerce\model\Openedx_Commerce_Enrollment; +use OpenedX_Commerce\model\Openedx_Commerce_Post_Type; +use OpenedX_Commerce\admin\Openedx_Commerce_Admin; use PHPUnit\Framework\TestCase; /** diff --git a/utils/openedx-utils.php b/utils/openedx-utils.php index eb641c8..955db8a 100644 --- a/utils/openedx-utils.php +++ b/utils/openedx-utils.php @@ -6,7 +6,7 @@ * @since 1.6.0 */ -namespace OpenedXCommerce\utils; +namespace OpenedX_Commerce\utils; /** * Enrollment Request mode options.