Skip to content

Commit

Permalink
fix: use openedxcommerce instead of openedx_commerce as a prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
MaferMazu committed Apr 4, 2024
1 parent 26c1093 commit 2d831fc
Show file tree
Hide file tree
Showing 19 changed files with 149 additions and 149 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ jobs:
- name: Update php file version - define statement
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "(define\\( 'OPENEDX_COMMERCE_VERSION', ')([^']*)(.*);"
replace: "define( 'OPENEDX_COMMERCE_VERSION', '${{ steps.tag_version.outputs.new_version }}' );"
find: "(define\\( 'OPENEDXCOMMERCE_VERSION', ')([^']*)(.*);"
replace: "define( 'OPENEDXCOMMERCE_VERSION', '${{ steps.tag_version.outputs.new_version }}' );"
include: "openedx-commerce.php"

- name: Update README version
Expand Down
56 changes: 28 additions & 28 deletions admin/class-openedx-commerce-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
*
* @category Admin
* @package WordPress
* @subpackage Openedx_Commerce
* @subpackage OpenedxCommerce
* @since 1.0.0
*/

namespace OpenedXCommerce\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\model\OpenedxCommerce_Enrollment;
use OpenedXCommerce\model\OpenedxCommerce_Post_Type;
use OpenedXCommerce\admin\views\OpenedxCommerce_Enrollment_Info_Form;
use OpenedXCommerce\utils;


Expand All @@ -23,8 +23,8 @@
* @link https://edunext.co/
* @since 1.0.0
*
* @package Openedx_Commerce
* @subpackage Openedx_Commerce/admin
* @package OpenedxCommerce
* @subpackage OpenedxCommerce/admin
*/

/**
Expand All @@ -33,11 +33,11 @@
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the admin-specific stylesheet and JavaScript.
*
* @package Openedx_Commerce
* @subpackage Openedx_Commerce/admin
* @package OpenedxCommerce
* @subpackage OpenedxCommerce/admin
* @author eduNEXT <[email protected]>
*/
class Openedx_Commerce_Admin {
class OpenedxCommerce_Admin {

/**
* The ID of this plugin.
Expand Down Expand Up @@ -85,14 +85,14 @@ public function __construct( $plugin_name, $version, $test = null ) {
}

/**
* Create an instance of the Openedx_Commerce_Enrollment class.
* Create an instance of the OpenedxCommerce_Enrollment class.
*
* @since 1.0.0
*
* @return void
*/
public function create_enrollment_class() {
$this->openedx_enrollment = new Openedx_Commerce_Enrollment( $this );
$this->openedx_enrollment = new OpenedxCommerce_Enrollment( $this );
}

/**
Expand All @@ -106,10 +106,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_Commerce_Loader as all of the hooks are defined
* defined in OpenedxCommerce_Loader as all of the hooks are defined
* in that particular class.
*
* The Openedx_Commerce_Loader will then create the relationship
* The OpenedxCommerce_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
Expand All @@ -128,10 +128,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_Commerce_Loader as
* defined in OpenedxCommerce_Loader as
* all of the hooks are defined in that particular class.
*
* The Openedx_Commerce_Loader will then create the relationship
* The OpenedxCommerce_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
Expand All @@ -153,7 +153,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_Commerce_Enrollment_Info_Form( $post );
$this->openedx_enrollment_info_form = new OpenedxCommerce_Enrollment_Info_Form( $post );
}

/**
Expand All @@ -179,7 +179,7 @@ public function register_post_type( $post_type = '', $plural = '', $single = '',
}

/**
* Create a new instance of the Openedx_Commerce_Post_Type class and register a new post type.
* Create a new instance of the OpenedxCommerce_Post_Type class and register a new post type.
*
* @param string $post_type Post type name.
* @param string $plural Post type item plural name.
Expand All @@ -195,7 +195,7 @@ public function create_post_type(
$description = '',
array $options
) {
return new Openedx_Commerce_Post_Type( $post_type, $plural, $single, $description, $options );
return new OpenedxCommerce_Post_Type( $post_type, $plural, $single, $description, $options );
}

/**
Expand Down Expand Up @@ -232,8 +232,8 @@ public function add_openedx_course_product_type( $type_options ) {
* @return void
*/
public function save_openedx_option( $post_id ) {
if ( ! isset( $_POST['openedx_commerce_custom_product_nonce'] ) ||
! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['openedx_commerce_custom_product_nonce'] ) ), 'openedx_commerce_custom_product_nonce' )
if ( ! isset( $_POST['openedxcommerce_custom_product_nonce'] ) ||
! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['openedxcommerce_custom_product_nonce'] ) ), 'openedxcommerce_custom_product_nonce' )
) {
return;
}
Expand All @@ -250,11 +250,11 @@ public function add_custom_product_fields() {

global $post;

$nonce = wp_create_nonce( 'openedx_commerce_custom_product_nonce' );
$nonce = wp_create_nonce( 'openedxcommerce_custom_product_nonce' );

echo '<div class="custom_options_group">';

echo '<input type="hidden" name="openedx_commerce_custom_product_nonce" value="' . esc_attr( $nonce ) . '">';
echo '<input type="hidden" name="openedxcommerce_custom_product_nonce" value="' . esc_attr( $nonce ) . '">';

woocommerce_wp_text_input(
array(
Expand Down Expand Up @@ -313,7 +313,7 @@ public function add_admin_order_item_values( $product, $item, $item_id = null )

// Check if the product has a non-empty "_course_id" metadata.
$course_id = '';
$nonce = wp_create_nonce( 'openedx_commerce_order_item_nonce' );
$nonce = wp_create_nonce( 'openedxcommerce_order_item_nonce' );

if ( $product ) {
$course_id = get_post_meta( $product->get_id(), '_course_id', true );
Expand All @@ -327,7 +327,7 @@ public function add_admin_order_item_values( $product, $item, $item_id = null )
$order_url = esc_url( admin_url( 'post.php?post=' . intval( $input_value ) . '&action=edit' ) );

$html_output = '<td>';
$html_output .= '<input type="hidden" name="openedx_commerce_order_item_nonce" value="' . esc_attr( $nonce ) . '">';
$html_output .= '<input type="hidden" name="openedxcommerce_order_item_nonce" value="' . esc_attr( $nonce ) . '">';
$html_output .= '<input style="height:30px;" type="text" name="openedx_order_id_input' . esc_attr( $item_id ) . '" value="' . esc_attr( $input_value ) . '" pattern="\d*" />';
$html_output .= '<a href="' . $order_url . '" class="button" style="margin-left: 5px; vertical-align: bottom;' . ( $input_value ? '' : 'pointer-events: none; opacity: 0.6;' ) . '">View Request</a>';
$html_output .= '</td>';
Expand Down Expand Up @@ -376,8 +376,8 @@ public function save_order_meta_data( $order_id ) {

$items = wc_get_order( $order_id )->get_items();

if ( ! isset( $_POST['openedx_commerce_order_item_nonce'] ) ||
! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['openedx_commerce_order_item_nonce'] ) ), 'openedx_commerce_order_item_nonce' )
if ( ! isset( $_POST['openedxcommerce_order_item_nonce'] ) ||
! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['openedxcommerce_order_item_nonce'] ) ), 'openedxcommerce_order_item_nonce' )
) {
return;
}
Expand All @@ -398,8 +398,8 @@ public function save_order_meta_data( $order_id ) {
* @since 1.1.1
*/
public function save_custom_product_fields( $post_id ) {
if ( ! isset( $_POST['openedx_commerce_custom_product_nonce'] ) ||
! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['openedx_commerce_custom_product_nonce'] ) ), 'openedx_commerce_custom_product_nonce' )
if ( ! isset( $_POST['openedxcommerce_custom_product_nonce'] ) ||
! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['openedxcommerce_custom_product_nonce'] ) ), 'openedxcommerce_custom_product_nonce' )
) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions admin/partials/openedx-commerce-admin-display.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* @link https://edunext.co/
* @since 1.0.0
*
* @package Openedx_Commerce
* @subpackage Openedx_Commerce/admin/partials
* @package OpenedxCommerce
* @subpackage OpenedxCommerce/admin/partials
*/

?>
Expand Down
14 changes: 7 additions & 7 deletions admin/views/class-openedx-commerce-enrollment-info-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
*
* @category Views
* @package WordPress
* @subpackage Openedx_Commerce
* @subpackage OpenedxCommerce
* @since 1.0.0
*/

namespace OpenedXCommerce\admin\views;

use OpenedXCommerce\model\Openedx_Commerce_Log;
use OpenedXCommerce\model\OpenedxCommerce_Log;
use OpenedXCommerce\utils;

if ( ! defined( 'ABSPATH' ) ) {
Expand All @@ -21,7 +21,7 @@
/**
* The Enrollment Info Form code for the form.
*/
class Openedx_Commerce_Enrollment_Info_Form {
class OpenedxCommerce_Enrollment_Info_Form {

/**
* The name for the Open edX enrollment custom post type.
Expand All @@ -35,7 +35,7 @@ class Openedx_Commerce_Enrollment_Info_Form {
/**
* The log manager.
*
* @var Openedx_Commerce_Log
* @var OpenedxCommerce_Log
* @access private
* @since 1.1.1
*/
Expand All @@ -44,7 +44,7 @@ class Openedx_Commerce_Enrollment_Info_Form {
/**
* Constructor function.
*
* @param Openedx_Commerce_Enrollment $enrollment_request The enrollment request object.
* @param OpenedxCommerce_Enrollment $enrollment_request The enrollment request object.
*
* @access public
* @since 1.0.0
Expand All @@ -62,7 +62,7 @@ public function __construct( $enrollment_request ) {
* @return void
*/
public function register_log_manager() {
$this->log_manager = new Openedx_Commerce_Log();
$this->log_manager = new OpenedxCommerce_Log();
}

/**
Expand Down Expand Up @@ -93,7 +93,7 @@ public function render_enrollment_info_form( $post ) {
$openedx_new_enrollment = true;
}

wp_nonce_field( 'openedx_commerce_enrollment_form', 'openedx_commerce_enrollment_form_nonce' );
wp_nonce_field( 'openedxcommerce_enrollment_form', 'openedxcommerce_enrollment_form_nonce' );

?>
<div id="namediv" class="postbox">
Expand Down
18 changes: 9 additions & 9 deletions admin/views/class-openedx-commerce-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
*
* @category Views
* @package WordPress
* @subpackage Openedx_Commerce
* @subpackage OpenedxCommerce
* @since 1.6.0
*/

namespace OpenedXCommerce\admin\views;

use OpenedXCommerce\model\Openedx_Commerce_Api_Calls;
use OpenedXCommerce\model\OpenedxCommerce_Api_Calls;
use DateTime;
use DateInterval;

Expand All @@ -19,11 +19,11 @@
* This class allows the user to configure the plugin settings
* focusing on the connection between Open edX platform and the store.
*/
class Openedx_Commerce_Settings {
class OpenedxCommerce_Settings {
/**
* API call variable.
*
* @var Openedx_Commerce_Api_Calls
* @var OpenedxCommerce_Api_Calls
*/
private $api_call;

Expand All @@ -35,7 +35,7 @@ class Openedx_Commerce_Settings {
* @return void
*/
public function __construct() {
$this->api_call = new Openedx_Commerce_Api_Calls();
$this->api_call = new OpenedxCommerce_Api_Calls();
}

/**
Expand Down Expand Up @@ -149,8 +149,8 @@ public function openedx_settings_init() {
'sanitize_text_field'
);

if ( ! isset( $_POST['openedx_commerce_new_token_nonce'] ) ||
! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['openedx_commerce_new_token_nonce'] ) ), 'openedx_commerce_token' )
if ( ! isset( $_POST['openedxcommerce_new_token_nonce'] ) ||
! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['openedxcommerce_new_token_nonce'] ) ), 'openedxcommerce_token' )
) {
return;
}
Expand All @@ -168,7 +168,7 @@ public function openedx_settings_init() {
/**
* Make API call to generate new JWT token.
*
* Calls the Openedx_Commerce_Api_Calls class to generate
* Calls the OpenedxCommerce_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
Expand Down Expand Up @@ -290,7 +290,7 @@ public function openedx_jwt_token_callback() {
$masked_value = '';
}

wp_nonce_field( 'openedx_commerce_token', 'openedx_commerce_new_token_nonce' );
wp_nonce_field( 'openedxcommerce_token', 'openedxcommerce_new_token_nonce' );

?>

Expand Down
10 changes: 5 additions & 5 deletions includes/class-openedx-commerce-activator.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* @link https://edunext.co/
* @since 1.0.0
*
* @package Openedx_Commerce
* @subpackage Openedx_Commerce/includes
* @package OpenedxCommerce
* @subpackage OpenedxCommerce/includes
*/

namespace OpenedXCommerce;
Expand All @@ -17,11 +17,11 @@
* This class defines all code necessary to run during the plugin's activation.
*
* @since 1.0.0
* @package Openedx_Commerce
* @subpackage Openedx_Commerce/includes
* @package OpenedxCommerce
* @subpackage OpenedxCommerce/includes
* @author eduNEXT <[email protected]>
*/
class Openedx_Commerce_Activator {
class OpenedxCommerce_Activator {

/**
* Short Description. (use period)
Expand Down
10 changes: 5 additions & 5 deletions includes/class-openedx-commerce-deactivator.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* @link https://edunext.co/
* @since 1.0.0
*
* @package Openedx_Commerce
* @subpackage Openedx_Commerce/includes
* @package OpenedxCommerce
* @subpackage OpenedxCommerce/includes
*/

namespace OpenedXCommerce;
Expand All @@ -17,11 +17,11 @@
* This class defines all code necessary to run during the plugin's deactivation.
*
* @since 1.0.0
* @package Openedx_Commerce
* @subpackage Openedx_Commerce/includes
* @package OpenedxCommerce
* @subpackage OpenedxCommerce/includes
* @author eduNEXT <[email protected]>
*/
class Openedx_Commerce_Deactivator {
class OpenedxCommerce_Deactivator {

/**
* Short Description. (use period)
Expand Down
Loading

0 comments on commit 2d831fc

Please sign in to comment.