From 79bdd6a0a6127cc1eaf36a90b0451b0ffb36613b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Ramirez=20Giraldo?= <52968528+julianramirez2@users.noreply.github.com> Date: Thu, 9 Nov 2023 10:28:52 -0500 Subject: [PATCH] fix: file and class names corrected based on wordpress requirements (#53) * fix: files name fixed based on wordpress reqs * fix: corrected classes and namespaces name * fix: change naming to commerce * fix: change form names * docs: add the naming ADR --------- Co-authored-by: Maria Fernanda Magallanes Zubillaga --- .github/workflows/continuous-integration.yml | 12 ++-- README.txt | 4 +- ...n.php => class-openedx-commerce-admin.php} | 36 +++++----- ...n.css => class-openedx-commerce-admin.css} | 0 ...gin-admin.js => class-openedx-commerce.js} | 0 ...php => openedx-commerce-admin-display.php} | 4 +- ...openedx-commerce-enrollment-info-form.php} | 40 +++++------ ...hp => class-openedx-commerce-settings.php} | 12 ++-- .../decisions/0004-naming-of-the-plugin.rst | 43 +++++++++++ ...p => class-openedx-commerce-activator.php} | 10 +-- ...=> class-openedx-commerce-deactivator.php} | 10 +-- ...8n.php => class-openedx-commerce-i18n.php} | 12 ++-- ....php => class-openedx-commerce-loader.php} | 10 +-- ...-plugin.php => class-openedx-commerce.php} | 72 +++++++++---------- ...p => class-openedx-commerce-api-calls.php} | 6 +- ... => class-openedx-commerce-enrollment.php} | 36 +++++----- ...log.php => class-openedx-commerce-log.php} | 4 +- ...p => class-openedx-commerce-post-type.php} | 22 +++--- ...mmerce-plugin.pot => openedx-commerce.pot} | 0 openedx-ecommerce.php => openedx-commerce.php | 42 +++++------ ....php => class-openedx-commerce-public.php} | 22 +++--- ...public.css => openedx-commerce-public.css} | 0 ...n-public.js => openedx-commerce-public.js} | 0 ...hp => openedx-commerce-public-display.php} | 4 +- test/class-enrollment-test.php | 28 ++++---- uninstall.php | 2 +- utils/openedx-utils.php | 14 ++-- 27 files changed, 244 insertions(+), 201 deletions(-) rename admin/{class-openedx-woocommerce-plugin-admin.php => class-openedx-commerce-admin.php} (92%) rename admin/css/{openedx-woocommerce-plugin-admin.css => class-openedx-commerce-admin.css} (100%) rename admin/js/{openedx-woocommerce-plugin-admin.js => class-openedx-commerce.js} (100%) rename admin/partials/{openedx-woocommerce-plugin-admin-display.php => openedx-commerce-admin-display.php} (73%) rename admin/views/{class-openedx-woocommerce-plugin-enrollment-info-form.php => class-openedx-commerce-enrollment-info-form.php} (85%) rename admin/views/{class-openedx-woocommerce-plugin-settings.php => class-openedx-commerce-settings.php} (96%) create mode 100644 docs/source/decisions/0004-naming-of-the-plugin.rst rename includes/{class-openedx-woocommerce-plugin-activator.php => class-openedx-commerce-activator.php} (67%) rename includes/{class-openedx-woocommerce-plugin-deactivator.php => class-openedx-commerce-deactivator.php} (67%) rename includes/{class-openedx-woocommerce-plugin-i18n.php => class-openedx-commerce-i18n.php} (74%) rename includes/{class-openedx-woocommerce-plugin-loader.php => class-openedx-commerce-loader.php} (96%) rename includes/{class-openedx-woocommerce-plugin.php => class-openedx-commerce.php} (78%) rename includes/model/{class-openedx-woocommerce-plugin-api-calls.php => class-openedx-commerce-api-calls.php} (99%) rename includes/model/{class-openedx-woocommerce-plugin-enrollment.php => class-openedx-commerce-enrollment.php} (92%) rename includes/model/{class-openedx-woocommerce-plugin-log.php => class-openedx-commerce-log.php} (98%) rename includes/model/{class-openedx-woocommerce-plugin-post-type.php => class-openedx-commerce-post-type.php} (84%) rename languages/{openedx-woocommerce-plugin.pot => openedx-commerce.pot} (100%) rename openedx-ecommerce.php => openedx-commerce.php (68%) rename public/{class-openedx-woocommerce-plugin-public.php => class-openedx-commerce-public.php} (73%) rename public/css/{openedx-woocommerce-plugin-public.css => openedx-commerce-public.css} (100%) rename public/js/{openedx-woocommerce-plugin-public.js => openedx-commerce-public.js} (100%) rename public/partials/{openedx-woocommerce-plugin-public-display.php => openedx-commerce-public-display.php} (73%) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index ad713d6..5854332 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -30,14 +30,14 @@ jobs: with: find: "Version: *[0-9.]*" replace: "Version: ${{ steps.tag_version.outputs.new_version }}" - include: "openedx-ecommerce.php" + include: "openedx-commerce.php" - name: Update php file version - define statement uses: jacobtomlinson/gha-find-replace@v3 with: - find: "(define\\( 'OPENEDX_WOOCOMMERCE_PLUGIN_VERSION', ')([^']*)(.*);" - replace: "define( 'OPENEDX_WOOCOMMERCE_PLUGIN_VERSION', '${{ steps.tag_version.outputs.new_version }}' );" - include: "openedx-ecommerce.php" + find: "(define\\( 'OPENEDX_COMMERCE_VERSION', ')([^']*)(.*);" + replace: "define( 'OPENEDX_COMMERCE_VERSION', '${{ steps.tag_version.outputs.new_version }}' );" + include: "openedx-commerce.php" - name: Update README version uses: jacobtomlinson/gha-find-replace@v3 @@ -60,7 +60,7 @@ jobs: with: branch: ${{ github.ref }} commit_message: "docs(bumpversion): ${{ steps.tag_version.outputs.previous_tag }} → ${{ steps.tag_version.outputs.new_tag }}" - file_pattern: README.txt CHANGELOG.md openedx-ecommerce.php + file_pattern: README.txt CHANGELOG.md openedx-commerce.php release: needs: bumpversion @@ -92,4 +92,4 @@ jobs: tag: ${{ steps.tag_version.outputs.new_tag }} name: Release ${{ steps.tag_version.outputs.new_tag }} body: ${{ steps.tag_version.outputs.changelog }} - artifacts: "openedx-woocommerce-plugin.zip" + artifacts: "openedx-commerce.zip" diff --git a/README.txt b/README.txt index 9525dbf..7c522df 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -=== Open edX Ecommerce === +=== Open edX Commerce === Contributors: felipemontoya, julianrg2, mafermazu Tags: openedx, open edx, ecommerce, lms, courses Requires at least: 6.3 @@ -12,7 +12,7 @@ You can sell your Open edX courses with WooCommerce using this free and open-sou == Description == -The "Open edX Ecommerce" package is a free and open-source WordPress plugin that allows you to integrate WooCommerce with your Open edX platform. +The "Open edX Commerce" package is a free and open-source WordPress plugin that allows you to integrate WooCommerce with your Open edX platform. **What does this mean?** You can create Open edX courses as products in WooCommerce, and when you perform purchase or refund operations for these products, your Open edX platform will reflect these changes. diff --git a/admin/class-openedx-woocommerce-plugin-admin.php b/admin/class-openedx-commerce-admin.php similarity index 92% rename from admin/class-openedx-woocommerce-plugin-admin.php rename to admin/class-openedx-commerce-admin.php index e219714..292e7cd 100644 --- a/admin/class-openedx-woocommerce-plugin-admin.php +++ b/admin/class-openedx-commerce-admin.php @@ -5,15 +5,15 @@ * * @category Admin * @package WordPress - * @subpackage Openedx_Woocommerce_Plugin + * @subpackage Openedx_Commerce * @since 1.0.0 */ namespace App\admin; -use App\model\Openedx_Woocommerce_Plugin_Enrollment; -use App\model\Openedx_Woocommerce_Plugin_Post_Type; -use App\admin\views\Openedx_Woocommerce_Plugin_Enrollment_Info_Form; +use App\model\Openedx_Commerce_Enrollment; +use App\model\Openedx_Commerce_Post_Type; +use App\admin\views\Openedx_Commerce_Enrollment_Info_Form; use App\utils; /** @@ -22,8 +22,8 @@ * @link https://edunext.co/ * @since 1.0.0 * - * @package Openedx_Woocommerce_Plugin - * @subpackage Openedx_Woocommerce_Plugin/admin + * @package Openedx_Commerce + * @subpackage Openedx_Commerce/admin */ /** @@ -32,11 +32,11 @@ * Defines the plugin name, version, and two examples hooks for how to * enqueue the admin-specific stylesheet and JavaScript. * - * @package Openedx_Woocommerce_Plugin - * @subpackage Openedx_Woocommerce_Plugin/admin + * @package Openedx_Commerce + * @subpackage Openedx_Commerce/admin * @author eduNEXT */ -class Openedx_Woocommerce_Plugin_Admin { +class Openedx_Commerce_Admin { /** * The ID of this plugin. @@ -84,14 +84,14 @@ public function __construct( $plugin_name, $version, $test = null ) { } /** - * Create an instance of the Openedx_Woocommerce_Plugin_Enrollment class. + * Create an instance of the Openedx_Commerce_Enrollment class. * * @since 1.0.0 * * @return void */ public function create_enrollment_class() { - $this->openedx_enrollment = new Openedx_Woocommerce_Plugin_Enrollment( $this ); + $this->openedx_enrollment = new Openedx_Commerce_Enrollment( $this ); } /** @@ -105,10 +105,10 @@ public function enqueue_styles() { * This function is provided for demonstration purposes only. * * An instance of this class should be passed to the run() function - * defined in Openedx_Woocommerce_Plugin_Loader as all of the hooks are defined + * defined in Openedx_Commerce_Loader as all of the hooks are defined * in that particular class. * - * The Openedx_Woocommerce_Plugin_Loader will then create the relationship + * The Openedx_Commerce_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ @@ -127,10 +127,10 @@ public function enqueue_scripts() { * This function is provided for demonstration purposes only. * * An instance of this class should be passed to the run() function - * defined in Openedx_Woocommerce_Plugin_Loader as + * defined in Openedx_Commerce_Loader as * all of the hooks are defined in that particular class. * - * The Openedx_Woocommerce_Plugin_Loader will then create the relationship + * The Openedx_Commerce_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ @@ -152,7 +152,7 @@ public function register_enrollment_custom_post_type() { * @since 1.0.0 */ public function render_enrollment_info_form( $post ) { - $this->openedx_enrollment_info_form = new Openedx_Woocommerce_Plugin_Enrollment_Info_Form( $post ); + $this->openedx_enrollment_info_form = new Openedx_Commerce_Enrollment_Info_Form( $post ); } /** @@ -178,7 +178,7 @@ public function register_post_type( $post_type = '', $plural = '', $single = '', } /** - * Create a new instance of the Openedx_Woocommerce_Plugin_Post_Type class and register a new post type. + * Create a new instance of the Openedx_Commerce_Post_Type class and register a new post type. * * @param string $post_type Post type name. * @param string $plural Post type item plural name. @@ -194,7 +194,7 @@ public function create_post_type( $description = '', array $options ) { - return new Openedx_Woocommerce_Plugin_Post_Type( $post_type, $plural, $single, $description, $options ); + return new Openedx_Commerce_Post_Type( $post_type, $plural, $single, $description, $options ); } /** diff --git a/admin/css/openedx-woocommerce-plugin-admin.css b/admin/css/class-openedx-commerce-admin.css similarity index 100% rename from admin/css/openedx-woocommerce-plugin-admin.css rename to admin/css/class-openedx-commerce-admin.css diff --git a/admin/js/openedx-woocommerce-plugin-admin.js b/admin/js/class-openedx-commerce.js similarity index 100% rename from admin/js/openedx-woocommerce-plugin-admin.js rename to admin/js/class-openedx-commerce.js diff --git a/admin/partials/openedx-woocommerce-plugin-admin-display.php b/admin/partials/openedx-commerce-admin-display.php similarity index 73% rename from admin/partials/openedx-woocommerce-plugin-admin-display.php rename to admin/partials/openedx-commerce-admin-display.php index de1b3b7..9546153 100644 --- a/admin/partials/openedx-woocommerce-plugin-admin-display.php +++ b/admin/partials/openedx-commerce-admin-display.php @@ -7,8 +7,8 @@ * @link https://edunext.co/ * @since 1.0.0 * - * @package Openedx_Woocommerce_Plugin - * @subpackage Openedx_Woocommerce_Plugin/admin/partials + * @package Openedx_Commerce + * @subpackage Openedx_Commerce/admin/partials */ ?> diff --git a/admin/views/class-openedx-woocommerce-plugin-enrollment-info-form.php b/admin/views/class-openedx-commerce-enrollment-info-form.php similarity index 85% rename from admin/views/class-openedx-woocommerce-plugin-enrollment-info-form.php rename to admin/views/class-openedx-commerce-enrollment-info-form.php index 9f00b4d..ff17185 100644 --- a/admin/views/class-openedx-woocommerce-plugin-enrollment-info-form.php +++ b/admin/views/class-openedx-commerce-enrollment-info-form.php @@ -4,13 +4,13 @@ * * @category Views * @package WordPress - * @subpackage Openedx_Woocommerce_Plugin + * @subpackage Openedx_Commerce * @since 1.0.0 */ namespace App\admin\views; -use App\model\Openedx_Woocommerce_Plugin_Log; +use App\model\Openedx_Commerce_Log; use App\utils; if ( ! defined( 'ABSPATH' ) ) { @@ -20,7 +20,7 @@ /** * The Enrollment Info Form code for the form. */ -class Openedx_Woocommerce_Plugin_Enrollment_Info_Form { +class Openedx_Commerce_Enrollment_Info_Form { /** * The name for the Open edX enrollment custom post type. @@ -34,7 +34,7 @@ class Openedx_Woocommerce_Plugin_Enrollment_Info_Form { /** * The log manager. * - * @var Openedx_Woocommerce_Plugin_Log + * @var Openedx_Commerce_Log * @access private * @since 1.1.1 */ @@ -43,7 +43,7 @@ class Openedx_Woocommerce_Plugin_Enrollment_Info_Form { /** * Constructor function. * - * @param Openedx_Woocommerce_Plugin_Enrollment $enrollment_request The enrollment request object. + * @param Openedx_Commerce_Enrollment $enrollment_request The enrollment request object. * * @access public * @since 1.0.0 @@ -61,7 +61,7 @@ public function __construct( $enrollment_request ) { * @return void */ public function register_log_manager() { - $this->log_manager = new Openedx_Woocommerce_Plugin_Log(); + $this->log_manager = new Openedx_Commerce_Log(); } /** @@ -113,7 +113,7 @@ public function render_enrollment_info_form( $post ) { ?> > ? - + @@ -123,8 +123,8 @@ public function render_enrollment_info_form( $post ) { ? - - + + @@ -138,7 +138,7 @@ public function render_enrollment_info_form( $post ) { ? - + @@ -157,7 +157,7 @@ public function render_enrollment_info_form( $post ) { ?> > ? - + @@ -192,31 +192,31 @@ public function render_enrollment_info_form( $post ) { ?> ? - + - + ? - + - + ? - + - + - + diff --git a/admin/views/class-openedx-woocommerce-plugin-settings.php b/admin/views/class-openedx-commerce-settings.php similarity index 96% rename from admin/views/class-openedx-woocommerce-plugin-settings.php rename to admin/views/class-openedx-commerce-settings.php index 2c84bdf..073d648 100644 --- a/admin/views/class-openedx-woocommerce-plugin-settings.php +++ b/admin/views/class-openedx-commerce-settings.php @@ -4,13 +4,13 @@ * * @category Views * @package WordPress - * @subpackage Openedx_Woocommerce_Plugin + * @subpackage Openedx_Commerce * @since 1.6.0 */ namespace App\admin\views; -use App\model\Openedx_Woocommerce_Plugin_Api_Calls; +use App\model\Openedx_Commerce_Api_Calls; use DateTime; use DateInterval; @@ -18,11 +18,11 @@ * This class allows the user to configure the plugin settings * focusing on the connection between Open edX platform and the store. */ -class Openedx_Woocommerce_Plugin_Settings { +class Openedx_Commerce_Settings { /** * API call variable. * - * @var Openedx_Woocommerce_Plugin_Api_Calls + * @var Openedx_Commerce_Api_Calls */ private $api_call; @@ -34,7 +34,7 @@ class Openedx_Woocommerce_Plugin_Settings { * @return void */ public function __construct() { - $this->api_call = new Openedx_Woocommerce_Plugin_Api_Calls(); + $this->api_call = new Openedx_Commerce_Api_Calls(); } /** @@ -161,7 +161,7 @@ public function openedx_settings_init() { /** * Make API call to generate new JWT token. * - * Calls the Openedx_Woocommerce_Plugin_Api_Calls class to generate + * Calls the Openedx_Commerce_Api_Calls class to generate * a new JWT token using the Open edX API credentials saved in options. * * Handles errors from the API request and redirects back to the settings diff --git a/docs/source/decisions/0004-naming-of-the-plugin.rst b/docs/source/decisions/0004-naming-of-the-plugin.rst new file mode 100644 index 0000000..11f1b2b --- /dev/null +++ b/docs/source/decisions/0004-naming-of-the-plugin.rst @@ -0,0 +1,43 @@ +4. Naming of the plugin +======================== + +Status +****** + +Accepted + + +Context +******* + +Initially, we wanted a very descriptive name for this plugin (Open edX WooCommerce Plugin) to avoid confusion because there are different types of plugins in Open edX. Still, for `WordPress plugin guidelines`_, we cannot submit a plugin with the word "plugin" or trademarks as "woocommerce." + +Decision +******** + +- Change the name of the plugin to "Open edX Commerce." + + +Consequences +************ + +- Change the name in all the code, including files and database names. + +- The WordPress plugin doesn't have the same name as the GitHub repository to store more information about this plugin that adds information in the Open edX context. + + +Rejected Alternatives +********************* + +- Use "ecommerce" in the name: to avoid confusion with the current e-commerce service. + + +References +********** + +- `WordPress plugin guidelines`_. +- `Current ecommerce service`_. + + +.. _WordPress plugin guidelines: https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/#17-plugins-must-respect-trademarks-copyrights-and-project-names +.. _Current ecommerce service: https://github.com/openedx/ecommerce diff --git a/includes/class-openedx-woocommerce-plugin-activator.php b/includes/class-openedx-commerce-activator.php similarity index 67% rename from includes/class-openedx-woocommerce-plugin-activator.php rename to includes/class-openedx-commerce-activator.php index b4f3b3e..b395732 100644 --- a/includes/class-openedx-woocommerce-plugin-activator.php +++ b/includes/class-openedx-commerce-activator.php @@ -5,8 +5,8 @@ * @link https://edunext.co/ * @since 1.0.0 * - * @package Openedx_Woocommerce_Plugin - * @subpackage Openedx_Woocommerce_Plugin/includes + * @package Openedx_Commerce + * @subpackage Openedx_Commerce/includes */ namespace App; @@ -17,11 +17,11 @@ * This class defines all code necessary to run during the plugin's activation. * * @since 1.0.0 - * @package Openedx_Woocommerce_Plugin - * @subpackage Openedx_Woocommerce_Plugin/includes + * @package Openedx_Commerce + * @subpackage Openedx_Commerce/includes * @author eduNEXT */ -class Openedx_Woocommerce_Plugin_Activator { +class Openedx_Commerce_Activator { /** * Short Description. (use period) diff --git a/includes/class-openedx-woocommerce-plugin-deactivator.php b/includes/class-openedx-commerce-deactivator.php similarity index 67% rename from includes/class-openedx-woocommerce-plugin-deactivator.php rename to includes/class-openedx-commerce-deactivator.php index ca3b4b8..ea53b7e 100644 --- a/includes/class-openedx-woocommerce-plugin-deactivator.php +++ b/includes/class-openedx-commerce-deactivator.php @@ -5,8 +5,8 @@ * @link https://edunext.co/ * @since 1.0.0 * - * @package Openedx_Woocommerce_Plugin - * @subpackage Openedx_Woocommerce_Plugin/includes + * @package Openedx_Commerce + * @subpackage Openedx_Commerce/includes */ namespace App; @@ -17,11 +17,11 @@ * This class defines all code necessary to run during the plugin's deactivation. * * @since 1.0.0 - * @package Openedx_Woocommerce_Plugin - * @subpackage Openedx_Woocommerce_Plugin/includes + * @package Openedx_Commerce + * @subpackage Openedx_Commerce/includes * @author eduNEXT */ -class Openedx_Woocommerce_Plugin_Deactivator { +class Openedx_Commerce_Deactivator { /** * Short Description. (use period) diff --git a/includes/class-openedx-woocommerce-plugin-i18n.php b/includes/class-openedx-commerce-i18n.php similarity index 74% rename from includes/class-openedx-woocommerce-plugin-i18n.php rename to includes/class-openedx-commerce-i18n.php index 92c35d4..40bca34 100644 --- a/includes/class-openedx-woocommerce-plugin-i18n.php +++ b/includes/class-openedx-commerce-i18n.php @@ -8,8 +8,8 @@ * @link https://edunext.co/ * @since 1.0.0 * - * @package Openedx_Woocommerce_Plugin - * @subpackage Openedx_Woocommerce_Plugin/includes + * @package Openedx_Commerce + * @subpackage Openedx_Commerce/includes */ namespace App; @@ -21,11 +21,11 @@ * so that it is ready for translation. * * @since 1.0.0 - * @package Openedx_Woocommerce_Plugin - * @subpackage Openedx_Woocommerce_Plugin/includes + * @package Openedx_Commerce + * @subpackage Openedx_Commerce/includes * @author eduNEXT */ -class Openedx_Woocommerce_Plugin_I18n { +class Openedx_Commerce_I18n { /** @@ -36,7 +36,7 @@ class Openedx_Woocommerce_Plugin_I18n { public function load_plugin_textdomain() { load_plugin_textdomain( - 'openedx-woocommerce-plugin', + 'openedx-commerce', false, dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' ); diff --git a/includes/class-openedx-woocommerce-plugin-loader.php b/includes/class-openedx-commerce-loader.php similarity index 96% rename from includes/class-openedx-woocommerce-plugin-loader.php rename to includes/class-openedx-commerce-loader.php index 91597e3..9b8bdc8 100644 --- a/includes/class-openedx-woocommerce-plugin-loader.php +++ b/includes/class-openedx-commerce-loader.php @@ -5,8 +5,8 @@ * @link https://edunext.co/ * @since 1.0.0 * - * @package Openedx_Woocommerce_Plugin - * @subpackage Openedx_Woocommerce_Plugin/includes + * @package Openedx_Commerce + * @subpackage Openedx_Commerce/includes */ namespace App; @@ -18,11 +18,11 @@ * the plugin, and register them with the WordPress API. Call the * run function to execute the list of actions and filters. * - * @package Openedx_Woocommerce_Plugin - * @subpackage Openedx_Woocommerce_Plugin/includes + * @package Openedx_Commerce + * @subpackage Openedx_Commerce/includes * @author eduNEXT */ -class Openedx_Woocommerce_Plugin_Loader { +class Openedx_Commerce_Loader { /** * The array of actions registered with WordPress. diff --git a/includes/class-openedx-woocommerce-plugin.php b/includes/class-openedx-commerce.php similarity index 78% rename from includes/class-openedx-woocommerce-plugin.php rename to includes/class-openedx-commerce.php index 4d89a15..ac8700a 100644 --- a/includes/class-openedx-woocommerce-plugin.php +++ b/includes/class-openedx-commerce.php @@ -9,22 +9,22 @@ * version of the plugin. * * @since 1.0.0 - * @package Openedx_Woocommerce_Plugin - * @subpackage Openedx_Woocommerce_Plugin/includes + * @package Openedx_Commerce + * @subpackage Openedx_Commerce/includes * @author eduNEXT */ namespace App; -use App\admin\Openedx_Woocommerce_Plugin_Admin; -use App\public\Openedx_Woocommerce_Plugin_Public; -use App\admin\views\Openedx_Woocommerce_Plugin_Settings; -use App\model\Openedx_Woocommerce_Plugin_Enrollment; +use App\admin\Openedx_Commerce_Admin; +use App\public\Openedx_Commerce_Public; +use App\admin\views\Openedx_Commerce_Settings; +use App\model\Openedx_Commerce_Enrollment; /** * This class contains the function to register a new custom post type. */ -class Openedx_Woocommerce_Plugin { +class Openedx_Commerce { /** @@ -33,7 +33,7 @@ class Openedx_Woocommerce_Plugin { * * @since 1.0.0 * @access protected - * @var Openedx_Woocommerce_Plugin_Loader $loader Maintains and registers all hooks for the plugin. + * @var Openedx_Commerce_Loader $loader Maintains and registers all hooks for the plugin. */ protected $loader; @@ -65,12 +65,12 @@ class Openedx_Woocommerce_Plugin { * @since 1.0.0 */ public function __construct() { - if ( defined( 'OPENEDX_WOOCOMMERCE_PLUGIN_VERSION' ) ) { - $this->version = OPENEDX_WOOCOMMERCE_PLUGIN_VERSION; + if ( defined( 'OPENEDX_COMMERCE_VERSION' ) ) { + $this->version = OPENEDX_COMMERCE_VERSION; } else { $this->version = '1.0.0'; } - $this->plugin_name = 'openedx-woocommerce-plugin'; + $this->plugin_name = 'openedx-commerce'; $this->load_dependencies(); $this->set_locale(); @@ -85,10 +85,10 @@ public function __construct() { * * Include the following files that make up the plugin: * - * - Openedx_Woocommerce_Plugin_Loader. Orchestrates the hooks of the plugin. - * - Openedx_Woocommerce_Plugin_i18n. Defines internationalization functionality. - * - Openedx_Woocommerce_Plugin_Admin. Defines all hooks for the admin area. - * - Openedx_Woocommerce_Plugin_Public. Defines all hooks for the public side of the site. + * - Openedx_Commerce_Loader. Orchestrates the hooks of the plugin. + * - Openedx_Commerce_I18n. Defines internationalization functionality. + * - Openedx_Commerce_Admin. Defines all hooks for the admin area. + * - Openedx_Commerce_Public. Defines all hooks for the public side of the site. * * Create an instance of the loader which will be used to register the hooks * with WordPress. @@ -103,50 +103,50 @@ private function load_dependencies() { * core plugin. */ include_once plugin_dir_path( __DIR__ ) - . 'includes/class-openedx-woocommerce-plugin-loader.php'; + . 'includes/class-openedx-commerce-loader.php'; /** * The class responsible for defining internationalization functionality * of the plugin. */ include_once plugin_dir_path( __DIR__ ) - . 'includes/class-openedx-woocommerce-plugin-i18n.php'; + . 'includes/class-openedx-commerce-i18n.php'; /** * The class responsible for defining all actions that occur in the admin area. */ include_once plugin_dir_path( __DIR__ ) - . 'admin/class-openedx-woocommerce-plugin-admin.php'; + . 'admin/class-openedx-commerce-admin.php'; /** * The class responsible for defining all actions that occur in the public-facing * side of the site. */ include_once plugin_dir_path( __DIR__ ) - . 'public/class-openedx-woocommerce-plugin-public.php'; + . 'public/class-openedx-commerce-public.php'; - $this->loader = new Openedx_Woocommerce_Plugin_Loader(); + $this->loader = new Openedx_Commerce_Loader(); /** * The class responsible for defining the enrollment object */ include_once plugin_dir_path( __DIR__ ) - . 'includes/model/class-openedx-woocommerce-plugin-enrollment.php'; + . 'includes/model/class-openedx-commerce-enrollment.php'; /** * The class responsible for defining the custom-post-type object */ include_once plugin_dir_path( __DIR__ ) - . 'includes/model/class-openedx-woocommerce-plugin-post-type.php'; + . 'includes/model/class-openedx-commerce-post-type.php'; include_once plugin_dir_path( __DIR__ ) - . 'includes/model/class-openedx-woocommerce-plugin-log.php'; + . 'includes/model/class-openedx-commerce-log.php'; /** * The class responsible for rendering the enrollment info form */ include_once plugin_dir_path( __DIR__ ) - . 'admin/views/class-openedx-woocommerce-plugin-enrollment-info-form.php'; + . 'admin/views/class-openedx-commerce-enrollment-info-form.php'; /** * The file that contains variables and functions used repeatedly in the plugin. @@ -158,18 +158,18 @@ private function load_dependencies() { * The file that contains variables and functions used repeatedly in the plugin. */ include_once plugin_dir_path( __DIR__ ) - . 'admin/views/class-openedx-woocommerce-plugin-settings.php'; + . 'admin/views/class-openedx-commerce-settings.php'; /** - * Includes the Openedx_Woocommerce_Plugin_Api_Calls model class file. + * Includes the Openedx_Commerce_Api_Calls model class file. * - * This includes the file defining the Openedx_Woocommerce_Plugin_Api_Calls class + * This includes the file defining the Openedx_Commerce_Api_Calls class * which handles making API requests to the Open edX platform. * * The path is relative to the main plugin file directory. */ include_once plugin_dir_path( __DIR__ ) - . 'includes/model/class-openedx-woocommerce-plugin-api-calls.php'; + . 'includes/model/class-openedx-commerce-api-calls.php'; include_once plugin_dir_path( __DIR__ ) . 'test/class-enrollment-test.php'; @@ -178,7 +178,7 @@ private function load_dependencies() { /** * Define the locale for this plugin for internationalization. * - * Uses the Openedx_Woocommerce_Plugin_i18n class in order to set the domain and to register the hook + * Uses the Openedx_Commerce_I18n class in order to set the domain and to register the hook * with WordPress. * * @since 1.0.0 @@ -186,7 +186,7 @@ private function load_dependencies() { */ private function set_locale() { - $plugin_i18n = new Openedx_Woocommerce_Plugin_i18n(); + $plugin_i18n = new Openedx_Commerce_I18n(); $this->loader->add_action( 'plugins_loaded', @@ -204,7 +204,7 @@ private function set_locale() { */ private function define_admin_hooks() { - $plugin_admin = new Openedx_Woocommerce_Plugin_Admin( + $plugin_admin = new Openedx_Commerce_Admin( $this->get_plugin_name(), $this->get_version() ); @@ -223,7 +223,7 @@ private function define_admin_hooks() { $this->loader->add_filter( 'gettext', $this, 'openedx_plugin_custom_post_message', 10, 3 ); $this->loader->wp_enqueue_style( $this->plugin_name, - plugin_dir_url( __FILE__ ) . '../admin/css/openedx-woocommerce-plugin-admin.css', + plugin_dir_url( __FILE__ ) . '../admin/css/class-openedx-commerce-admin.css', array(), $this->version, 'all' @@ -259,7 +259,7 @@ private function define_admin_hooks() { */ private function define_public_hooks() { - $plugin_public = new Openedx_Woocommerce_Plugin_Public( + $plugin_public = new Openedx_Commerce_Public( $this->get_plugin_name(), $this->get_version() ); @@ -285,14 +285,14 @@ private function define_enqueue_scripts() { /** * Define the plugin settings hooks. * - * Initializes the Openedx_Woocommerce_Plugin_Settings class + * Initializes the Openedx_Commerce_Settings class * and registers its admin menu and settings hooks using the loader. * * @return void */ private function define_plugin_settings_hooks() { - $plugin_settings = new Openedx_Woocommerce_Plugin_Settings(); + $plugin_settings = new Openedx_Commerce_Settings(); $this->loader->add_action( 'admin_menu', $plugin_settings, 'openedx_settings_submenu' ); $this->loader->add_action( 'admin_init', $plugin_settings, 'openedx_settings_init' ); @@ -338,7 +338,7 @@ public function get_plugin_name() { * The reference to the class that orchestrates the hooks with the plugin. * * @since 1.0.0 - * @return Openedx_Woocommerce_Plugin_Loader Orchestrates the hooks of the plugin. + * @return Openedx_Commerce_Loader Orchestrates the hooks of the plugin. */ public function get_loader() { return $this->loader; diff --git a/includes/model/class-openedx-woocommerce-plugin-api-calls.php b/includes/model/class-openedx-commerce-api-calls.php similarity index 99% rename from includes/model/class-openedx-woocommerce-plugin-api-calls.php rename to includes/model/class-openedx-commerce-api-calls.php index 8265764..ba17592 100644 --- a/includes/model/class-openedx-woocommerce-plugin-api-calls.php +++ b/includes/model/class-openedx-commerce-api-calls.php @@ -5,7 +5,7 @@ * * @category Model * @package WordPress - * @subpackage Openedx_Woocommerce_Plugin + * @subpackage Openedx_Commerce * @since 1.6.0 */ @@ -26,7 +26,7 @@ * This class contains all the API calls necessary for the plugin, * these calls include a hard error handling for all responses and requests. */ -class Openedx_Woocommerce_Plugin_Api_Calls { +class Openedx_Commerce_Api_Calls { // API constants for the Open edX API calls. @@ -439,7 +439,7 @@ public function get_enrollment_process_body( $enrollment_data, $use_old_endpoint ), 'enrollment_attributes' => array( array( - 'namespace' => 'openedx-woocommerce-plugin', + 'namespace' => 'openedx-commerce', 'name' => 'message', 'value' => 'Enrollment request response.', ), diff --git a/includes/model/class-openedx-woocommerce-plugin-enrollment.php b/includes/model/class-openedx-commerce-enrollment.php similarity index 92% rename from includes/model/class-openedx-woocommerce-plugin-enrollment.php rename to includes/model/class-openedx-commerce-enrollment.php index af80f4a..0816501 100644 --- a/includes/model/class-openedx-woocommerce-plugin-enrollment.php +++ b/includes/model/class-openedx-commerce-enrollment.php @@ -6,16 +6,16 @@ * * @category Model * @package WordPress - * @subpackage Openedx_Woocommerce_Plugin + * @subpackage Openedx_Commerce * @since 1.0.0 */ namespace App\model; -use App\model\Openedx_Woocommerce_Plugin_Log; -use App\Openedx_Woocommerce_Plugin; -use App\admin\Openedx_Woocommerce_Plugin_Admin; -use App\model\Openedx_Woocommerce_Plugin_Api_Calls; +use App\model\Openedx_Commerce_Log; +use App\Openedx_Commerce; +use App\admin\Openedx_Commerce_Admin; +use App\model\Openedx_Commerce_Api_Calls; if ( ! defined( 'ABSPATH' ) ) { exit; @@ -24,7 +24,7 @@ /** * This class contains every step to process the enrollment post type operations. */ -class Openedx_Woocommerce_Plugin_Enrollment { +class Openedx_Commerce_Enrollment { /** @@ -68,7 +68,7 @@ public function __construct( $parent_name ) { * @return void */ public function register_log_manager() { - $this->log_manager = new Openedx_Woocommerce_Plugin_Log(); + $this->log_manager = new Openedx_Commerce_Log(); } /** @@ -148,7 +148,7 @@ public function register_status() { register_post_status( 'success', array( - 'label' => __( 'success', 'wp-openedx-woocommerce-plugin' ), + 'label' => __( 'success', 'wp-openedx-commerce' ), 'public' => false, 'internal' => true, 'private' => true, @@ -156,13 +156,13 @@ public function register_status() { 'show_in_admin_all_list' => true, 'show_in_admin_status_list' => true, // translators: %s: number of items. - 'label_count' => _n_noop( 'Success (%s)', 'Success (%s)', 'wp-openedx-woocommerce-plugin' ), + 'label_count' => _n_noop( 'Success (%s)', 'Success (%s)', 'wp-openedx-commerce' ), ) ); register_post_status( 'no_process', array( - 'label' => __( 'success', 'wp-openedx-woocommerce-plugin' ), + 'label' => __( 'success', 'wp-openedx-commerce' ), 'public' => false, 'internal' => true, 'private' => true, @@ -170,13 +170,13 @@ public function register_status() { 'show_in_admin_all_list' => true, 'show_in_admin_status_list' => true, // translators: %s: number of items. - 'label_count' => _n_noop( 'No process (%s)', 'No process (%s)', 'wp-openedx-woocommerce-plugin' ), + 'label_count' => _n_noop( 'No process (%s)', 'No process (%s)', 'wp-openedx-commerce' ), ) ); register_post_status( 'pending', array( - 'label' => __( 'pending', 'wp-openedx-woocommerce-plugin' ), + 'label' => __( 'pending', 'wp-openedx-commerce' ), 'public' => false, 'internal' => true, 'private' => true, @@ -184,13 +184,13 @@ public function register_status() { 'show_in_admin_all_list' => true, 'show_in_admin_status_list' => true, // translators: %s: number of items. - 'label_count' => _n_noop( 'Pending (%s)', 'Pending (%s)', 'wp-openedx-woocommerce-plugin' ), + 'label_count' => _n_noop( 'Pending (%s)', 'Pending (%s)', 'wp-openedx-commerce' ), ) ); register_post_status( 'error', array( - 'label' => __( 'error', 'wp-openedx-woocommerce-plugin' ), + 'label' => __( 'error', 'wp-openedx-commerce' ), 'public' => false, 'internal' => true, 'private' => true, @@ -198,7 +198,7 @@ public function register_status() { 'show_in_admin_all_list' => true, 'show_in_admin_status_list' => true, // translators: %s: number of items. - 'label_count' => _n_noop( 'Error (%s)', 'Error (%s)', 'wp-openedx-woocommerce-plugin' ), + 'label_count' => _n_noop( 'Error (%s)', 'Error (%s)', 'wp-openedx-commerce' ), ) ); } @@ -348,7 +348,7 @@ public function save_enrollment( $post, $enrollment_arr, $enrollment_action, $or $this->update_post( $post_id ); } - $api = new Openedx_Woocommerce_Plugin_Api_Calls(); + $api = new Openedx_Commerce_Api_Calls(); $enrollment_api_response = $api->request_handler( $enrollment_data, $enrollment_action ); // The $enrollment_api_response[0] is the status of the request. @@ -356,8 +356,8 @@ public function save_enrollment( $post, $enrollment_arr, $enrollment_action, $or $this->log_manager->create_change_log( $post_id, $old_data, $enrollment_data, $enrollment_action, $enrollment_api_response ); if ( null !== $order_id ) { - $plugin_class = new Openedx_Woocommerce_Plugin(); - $admin_class = new Openedx_Woocommerce_Plugin_Admin( $plugin_class->get_plugin_name(), $plugin_class->get_version() ); + $plugin_class = new Openedx_Commerce(); + $admin_class = new Openedx_Commerce_Admin( $plugin_class->get_plugin_name(), $plugin_class->get_version() ); $admin_class->show_enrollment_logs( $order_id, $enrollment_api_response ); } } diff --git a/includes/model/class-openedx-woocommerce-plugin-log.php b/includes/model/class-openedx-commerce-log.php similarity index 98% rename from includes/model/class-openedx-woocommerce-plugin-log.php rename to includes/model/class-openedx-commerce-log.php index 9f2bb43..c4543b4 100644 --- a/includes/model/class-openedx-woocommerce-plugin-log.php +++ b/includes/model/class-openedx-commerce-log.php @@ -5,7 +5,7 @@ * * @category Model * @package WordPress - * @subpackage Openedx_Woocommerce_Plugin + * @subpackage Openedx_Commerce * @since 1.4.0 */ @@ -19,7 +19,7 @@ * This class contains every functions to process * logs that can be created by the plugin. */ -class Openedx_Woocommerce_Plugin_Log { +class Openedx_Commerce_Log { /** * Creates a new log entry in the database. * diff --git a/includes/model/class-openedx-woocommerce-plugin-post-type.php b/includes/model/class-openedx-commerce-post-type.php similarity index 84% rename from includes/model/class-openedx-woocommerce-plugin-post-type.php rename to includes/model/class-openedx-commerce-post-type.php index d00f1b6..2708b62 100644 --- a/includes/model/class-openedx-woocommerce-plugin-post-type.php +++ b/includes/model/class-openedx-commerce-post-type.php @@ -4,7 +4,7 @@ * * @category Model * @package WordPress - * @subpackage Openedx_Woocommerce_Plugin + * @subpackage Openedx_Commerce * @since 1.0.0 */ @@ -17,7 +17,7 @@ /** * This class contains the function to register a new custom post type. */ -class Openedx_Woocommerce_Plugin_Post_Type { +class Openedx_Commerce_Post_Type { /** * The name for the custom post type. @@ -101,23 +101,23 @@ public function register_post_type() { 'name' => $this->plural, 'singular_name' => $this->single, 'name_admin_bar' => $this->single, - 'add_new' => _x( 'Add New', $this->post_type, 'wp-openedx-woocommerce-plugin' ), // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralContext + 'add_new' => _x( 'Add New', $this->post_type, 'wp-openedx-commerce' ), // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralContext // translators: %s: Name of the post type in singular. - 'add_new_item' => sprintf( __( 'Add New %s', 'wp-openedx-woocommerce-plugin' ), $this->single ), + 'add_new_item' => sprintf( __( 'Add New %s', 'wp-openedx-commerce' ), $this->single ), // translators: %s: Name of the post type in singular. - 'edit_item' => sprintf( __( 'Edit %s', 'wp-openedx-woocommerce-plugin' ), $this->single ), + 'edit_item' => sprintf( __( 'Edit %s', 'wp-openedx-commerce' ), $this->single ), // translators: %s: Name of the post type in singular. - 'new_item' => sprintf( __( 'New %s', 'wp-openedx-woocommerce-plugin' ), $this->single ), + 'new_item' => sprintf( __( 'New %s', 'wp-openedx-commerce' ), $this->single ), // translators: %s: Name of the post type in plural. - 'all_items' => sprintf( __( 'All %s', 'wp-openedx-woocommerce-plugin' ), $this->plural ), + 'all_items' => sprintf( __( 'All %s', 'wp-openedx-commerce' ), $this->plural ), // translators: %s: Name of the post type in singular. - 'view_item' => sprintf( __( 'View %s', 'wp-openedx-woocommerce-plugin' ), $this->single ), + 'view_item' => sprintf( __( 'View %s', 'wp-openedx-commerce' ), $this->single ), // translators: %s: Name of the post type in plural. - 'search_items' => sprintf( __( 'Search %s', 'wp-openedx-woocommerce-plugin' ), $this->plural ), + 'search_items' => sprintf( __( 'Search %s', 'wp-openedx-commerce' ), $this->plural ), // translators: %s: Name of the post type in plural. - 'not_found' => sprintf( __( 'No %s Found', 'wp-openedx-woocommerce-plugin' ), $this->plural ), + 'not_found' => sprintf( __( 'No %s Found', 'wp-openedx-commerce' ), $this->plural ), // translators: %s: Name of the post type in plural. - 'not_found_in_trash' => sprintf( __( 'No %s Found In Trash', 'wp-openedx-woocommerce-plugin' ), $this->plural ), + 'not_found_in_trash' => sprintf( __( 'No %s Found In Trash', 'wp-openedx-commerce' ), $this->plural ), // translators: %s: Name of the post type in singular. 'parent_item_colon' => sprintf( __( 'Parent %s' ), $this->single ), 'menu_name' => $this->plural, diff --git a/languages/openedx-woocommerce-plugin.pot b/languages/openedx-commerce.pot similarity index 100% rename from languages/openedx-woocommerce-plugin.pot rename to languages/openedx-commerce.pot diff --git a/openedx-ecommerce.php b/openedx-commerce.php similarity index 68% rename from openedx-ecommerce.php rename to openedx-commerce.php index 27033ef..4dde570 100644 --- a/openedx-ecommerce.php +++ b/openedx-commerce.php @@ -1,6 +1,6 @@ run(); } -run_openedx_woocommerce_plugin(); +run_openedx_commerce_plugin(); diff --git a/public/class-openedx-woocommerce-plugin-public.php b/public/class-openedx-commerce-public.php similarity index 73% rename from public/class-openedx-woocommerce-plugin-public.php rename to public/class-openedx-commerce-public.php index bc3781e..ee181ee 100644 --- a/public/class-openedx-woocommerce-plugin-public.php +++ b/public/class-openedx-commerce-public.php @@ -5,8 +5,8 @@ * @link https://edunext.co/ * @since 1.0.0 * - * @package Openedx_Woocommerce_Plugin - * @subpackage Openedx_Woocommerce_Plugin/public + * @package Openedx_Commerce + * @subpackage Openedx_Commerce/public */ namespace App\public; @@ -17,11 +17,11 @@ * Defines the plugin name, version, and two examples hooks for how to * enqueue the public-facing stylesheet and JavaScript. * - * @package Openedx_Woocommerce_Plugin - * @subpackage Openedx_Woocommerce_Plugin/public + * @package Openedx_Commerce + * @subpackage Openedx_Commerce/public * @author eduNEXT */ -class Openedx_Woocommerce_Plugin_Public { +class Openedx_Commerce_Public { /** * The ID of this plugin. @@ -65,15 +65,15 @@ public function enqueue_styles() { * This function is provided for demonstration purposes only. * * An instance of this class should be passed to the run() function - * defined in Openedx_Woocommerce_Plugin_Loader as all of the hooks are defined + * defined in Openedx_Commerce_Loader as all of the hooks are defined * in that particular class. * - * The Openedx_Woocommerce_Plugin_Loader will then create the relationship + * The Openedx_Commerce_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/openedx-woocommerce-plugin-public.css', array(), $this->version, 'all' ); + wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/openedx-commerce-public.css', array(), $this->version, 'all' ); } /** @@ -87,14 +87,14 @@ public function enqueue_scripts() { * This function is provided for demonstration purposes only. * * An instance of this class should be passed to the run() function - * defined in Openedx_Woocommerce_Plugin_Loader as all of the hooks are defined + * defined in Openedx_Commerce_Loader as all of the hooks are defined * in that particular class. * - * The Openedx_Woocommerce_Plugin_Loader will then create the relationship + * The Openedx_Commerce_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ - wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/openedx-woocommerce-plugin-public.js', array( 'jquery' ), $this->version, false ); + wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/openedx-commerce-public.js', array( 'jquery' ), $this->version, false ); } } diff --git a/public/css/openedx-woocommerce-plugin-public.css b/public/css/openedx-commerce-public.css similarity index 100% rename from public/css/openedx-woocommerce-plugin-public.css rename to public/css/openedx-commerce-public.css diff --git a/public/js/openedx-woocommerce-plugin-public.js b/public/js/openedx-commerce-public.js similarity index 100% rename from public/js/openedx-woocommerce-plugin-public.js rename to public/js/openedx-commerce-public.js diff --git a/public/partials/openedx-woocommerce-plugin-public-display.php b/public/partials/openedx-commerce-public-display.php similarity index 73% rename from public/partials/openedx-woocommerce-plugin-public-display.php rename to public/partials/openedx-commerce-public-display.php index 9107f28..1a66305 100644 --- a/public/partials/openedx-woocommerce-plugin-public-display.php +++ b/public/partials/openedx-commerce-public-display.php @@ -7,8 +7,8 @@ * @link https://edunext.co/ * @since 1.0.0 * - * @package Openedx_Woocommerce_Plugin - * @subpackage Openedx_Woocommerce_Plugin/public/partials + * @package Openedx_Commerce + * @subpackage Openedx_Commerce/public/partials */ ?> diff --git a/test/class-enrollment-test.php b/test/class-enrollment-test.php index 55f1d95..dfedd63 100644 --- a/test/class-enrollment-test.php +++ b/test/class-enrollment-test.php @@ -2,15 +2,15 @@ /** * This class contains a test case for the register_enrollment_custom_post_type() method in the EnrollmentTest class. * - * @package openedx-woocommerce-plugin - * @subpackage openedx-woocommerce-plugin/tests + * @package openedx-commerce + * @subpackage openedx-commerce/tests */ namespace App\tests; -use App\model\Openedx_Woocommerce_Plugin_Enrollment; -use App\model\Openedx_Woocommerce_Plugin_Post_Type; -use App\admin\Openedx_Woocommerce_Plugin_Admin; +use App\model\Openedx_Commerce_Enrollment; +use App\model\Openedx_Commerce_Post_Type; +use App\admin\Openedx_Commerce_Admin; use PHPUnit\Framework\TestCase; /** @@ -24,20 +24,20 @@ class Enrollment_Test extends TestCase { */ public function test_register_enrollment_custom_post_type() { - $new_class = get_class( new Openedx_Woocommerce_Plugin_Admin( 'openedx-woocommerce-plugin', '1.0.0', 'test' ) ); + $new_class = get_class( new Openedx_Commerce_Admin( 'openedx-commerce', '1.0.0', 'test' ) ); - $admin = $this->getMockBuilder( Openedx_Woocommerce_Plugin_Admin::class ) - ->setConstructorArgs( array( 'openedx-woocommerce-plugin', '1.0.0', 'test' ) ) + $admin = $this->getMockBuilder( Openedx_Commerce_Admin::class ) + ->setConstructorArgs( array( 'openedx-commerce', '1.0.0', 'test' ) ) ->onlyMethods( array( 'create_enrollment_class' ) ) ->getMock(); - $admin = $this->getMockBuilder( Openedx_Woocommerce_Plugin_Admin::class ) - ->setConstructorArgs( array( 'openedx-woocommerce-plugin', '1.0.0', 'test' ) ) + $admin = $this->getMockBuilder( Openedx_Commerce_Admin::class ) + ->setConstructorArgs( array( 'openedx-commerce', '1.0.0', 'test' ) ) ->onlyMethods( array( 'create_post_type' ) ) ->getMock(); - $admin = $this->getMockBuilder( Openedx_Woocommerce_Plugin_Admin::class ) - ->setConstructorArgs( array( 'openedx-woocommerce-plugin', '1.0.0', 'test' ) ) + $admin = $this->getMockBuilder( Openedx_Commerce_Admin::class ) + ->setConstructorArgs( array( 'openedx-commerce', '1.0.0', 'test' ) ) ->onlyMethods( array( 'register_post_type' ) ) ->getMock(); @@ -54,9 +54,9 @@ public function test_register_enrollment_custom_post_type() { $admin->expects( $this->once() ) ->method( 'register_post_type' ) ->with( 'openedx_enrollment', 'Open edX Enrollment Requests', 'Open edX Enrollment Request', '', $enrollment_cpt_options ) - ->willReturn( Openedx_Woocommerce_Plugin_Post_Type::class ); + ->willReturn( Openedx_Commerce_Post_Type::class ); $output = $admin->register_post_type( 'openedx_enrollment', 'Open edX Enrollment Requests', 'Open edX Enrollment Request', '', $enrollment_cpt_options ); - $this->assertEquals( Openedx_Woocommerce_Plugin_Post_Type::class, $output ); + $this->assertEquals( Openedx_Commerce_Post_Type::class, $output ); } } diff --git a/uninstall.php b/uninstall.php index b4abb91..7817d06 100644 --- a/uninstall.php +++ b/uninstall.php @@ -21,7 +21,7 @@ * @link https://edunext.co/ * @since 1.0.0 * - * @package Openedx_Woocommerce_Plugin + * @package Openedx_Commerce */ // If uninstall not called from WordPress, then exit. diff --git a/utils/openedx-utils.php b/utils/openedx-utils.php index e192031..7388c83 100644 --- a/utils/openedx-utils.php +++ b/utils/openedx-utils.php @@ -2,7 +2,7 @@ /** * Open edX WooCommerce Plugin utils. * - * @package openedx-woocommerce-plugin + * @package openedx-commerce * @since 1.6.0 */ @@ -13,11 +13,11 @@ */ function get_enrollment_options() { return array( - 'Honor' => __( 'Honor', 'wp-openedx-woocommerce-plugin' ), - 'Audit' => __( 'Audit', 'wp-openedx-woocommerce-plugin' ), - 'Verified' => __( 'Verified', 'wp-openedx-woocommerce-plugin' ), - 'Credit' => __( 'Credit', 'wp-openedx-woocommerce-plugin' ), - 'Professional' => __( 'Professional', 'wp-openedx-woocommerce-plugin' ), - 'No ID Professional' => __( 'No ID Professional', 'wp-openedx-woocommerce-plugin' ), + 'Honor' => __( 'Honor', 'wp-openedx-commerce' ), + 'Audit' => __( 'Audit', 'wp-openedx-commerce' ), + 'Verified' => __( 'Verified', 'wp-openedx-commerce' ), + 'Credit' => __( 'Credit', 'wp-openedx-commerce' ), + 'Professional' => __( 'Professional', 'wp-openedx-commerce' ), + 'No ID Professional' => __( 'No ID Professional', 'wp-openedx-commerce' ), ); }