Changeset 3306383
- Timestamp:
- 06/04/2025 12:24:59 PM (10 months ago)
- Location:
- vite-rewards/trunk
- Files:
-
- 10 edited
-
readme.txt (modified) (1 diff)
-
vite-rewards.php (modified) (1 diff)
-
vite_reward_lite/core/class-vite-reward-lite.php (modified) (2 diffs)
-
vite_reward_lite/core/class-vite-reward-module-lite.php (modified) (2 diffs)
-
vite_reward_lite/modules/class-appsbd-related-app.php (modified) (1 diff)
-
vite_reward_lite/modules/class-vite-email-template.php (modified) (1 diff)
-
vite_reward_lite/modules/class-vite-reward-badge.php (modified) (1 diff)
-
vite_reward_lite/modules/class-vite-reward-points-table.php (modified) (1 diff)
-
vite_reward_lite/modules/class-vite-reward-rules.php (modified) (1 diff)
-
vite_reward_lite/modules/class-vite-reward-settings.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
vite-rewards/trunk/readme.txt
r3277607 r3306383 6 6 Tested up to: 6.8 7 7 Requires PHP: 7.2 8 Stable tag: 1.0. 58 Stable tag: 1.0.6 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
vite-rewards/trunk/vite-rewards.php
r3277607 r3306383 4 4 * Plugin URI: https://appsbd.com 5 5 * Description: It's a plugin for WooCommerce and vitepos reward calculation. 6 * Version: 1.0. 56 * Version: 1.0.6 7 7 * Author: appsbd 8 8 * Author URI: http://www.appsbd.com -
vite-rewards/trunk/vite_reward_lite/core/class-vite-reward-lite.php
r3277607 r3306383 144 144 $this->add_script( 'apbd-reward-admin' ); 145 145 $jv_object = new \stdClass(); 146 $jv_object->ajax_url = wp_nonce_url( admin_url( 'admin-ajax.php' ), ' reward-point' );146 $jv_object->ajax_url = wp_nonce_url( admin_url( 'admin-ajax.php' ), 'appsbd' ); 147 147 $jv_object->base_slug = $this->get_action_prefix(); 148 148 $jv_object->currency_symbol = get_woocommerce_currency_symbol(); 149 149 $jv_object->decimal_places = wc_get_price_decimals(); 150 150 $jv_object->assets_path = Vite_Reward_Settings::get_module_instance()->get_plugin_url( 'assets/' ); 151 $jv_object->ajax_nonce = wp_create_nonce( ' reward' );151 $jv_object->ajax_nonce = wp_create_nonce( 'appsbd' ); 152 152 $jv_object->app_version = $this->get_plugin_version(); 153 153 $jv_object->translation_obj = new \stdClass(); … … 247 247 248 248 $jv_object = new \stdClass(); 249 $jv_object->ajax_url = wp_nonce_url( admin_url( 'admin-ajax.php' ) );249 $jv_object->ajax_url = wp_nonce_url( admin_url( 'admin-ajax.php' ), 'appsbd' ); 250 250 $jv_object->base_slug = 'apbd-rep'; 251 251 $jv_object->ajax_nonce = ''; -
vite-rewards/trunk/vite_reward_lite/core/class-vite-reward-module-lite.php
r3272301 r3306383 9 9 10 10 use Appsbd_Lite\V4\Core\BaseModule; 11 use Appsbd_Lite\V4\libs\Ajax_Confirm_Response; 11 12 12 13 if ( ! defined( 'ABSPATH' ) ) { … … 21 22 abstract class Vite_Reward_Module_Lite extends BaseModule { 22 23 24 public function on_init() { 25 $this->add_admin_ajax_action( 'option', array( $this, 'ajax_request_callback' ) ); 26 $this->add_admin_ajax_action( 'get-option', array( $this, 'get_admin_options' ) ); 27 $this->add_admin_ajax_action( 'data', array( $this, 'data' ) ); 28 $this->add_admin_ajax_action( 'confirm', array( $this, 'confirm' ) ); 29 } 30 /** 31 * The check user action access is generated by appsbd 32 * 33 * @param mixed $action_name Its action_name param. 34 * 35 * @return bool 36 */ 37 public function check_user_action_access( $action_name ) { 38 return $this->check_user_access(); 39 } 40 /** 41 * The check ajax referer is generated by appsbd 42 * 43 * @param bool $is_return Its checking security. 44 * 45 * @return bool 46 */ 47 public function app_check_ajax_referer( $is_return = false ) { 23 48 49 if ( $this->kernel_object->is_develop_mode() ) { 50 $headers = getallheaders(); 51 if ( ! empty( $headers['appsbd_dev'] ) ) { 52 return true; 53 } 54 } 55 56 if ( ! check_ajax_referer( 'appsbd', '_wpnonce', false ) ) { 57 if ( $is_return ) { 58 return false; 59 } 60 $main_response = new Ajax_Confirm_Response(); 61 $this->add_error( 'Nonce error' ); 62 $main_response->display_with_response( false, null, 403 ); 63 } 64 65 return true; 66 } 67 68 /** 69 * The AddAjaxAction is generated by appsbd 70 * 71 * @param any $action_name Its action_name param. 72 * @param callable $function_to_add Its function_to_add param. 73 */ 74 public function add_admin_ajax_action( $action_name, $function_to_add ) { 75 if ( ! $this->check_user_action_access( $action_name ) ) { 76 $action_name = $this->get_action_name( $action_name ); 77 add_action( 78 'wp_ajax_' . $action_name, 79 function () { 80 $main_response = new Ajax_Confirm_Response(); 81 $this->add_error( 'User privilege error' ); 82 $main_response->display_with_response( false, null, 403 ); 83 } 84 ); 85 return; 86 } 87 $action_name = $this->get_action_name( $action_name ); 88 if ( $this->app_check_ajax_referer( true ) ) { 89 add_action( 'wp_ajax_' . $action_name, $function_to_add ); 90 } else { 91 add_action( 92 'wp_ajax_' . $action_name, 93 function () { 94 $main_response = new Ajax_Confirm_Response(); 95 $this->add_error( 'Nonce error' ); 96 $main_response->display_with_response( false, null, 403 ); 97 } 98 ); 99 } 100 } 101 102 /** 103 * The add ajax action is generated by appsbd 104 * 105 * @param mixed $action_name It is action_name param. 106 * @param mixed $function_to_add It is function_to_add param. 107 */ 108 public function add_ajax_action( $action_name, $function_to_add ) { 109 $action_name = $this->get_action_name( $action_name ); 110 if ( $this->app_check_ajax_referer( true ) ) { 111 add_action( 'wp_ajax_' . $action_name, $function_to_add ); 112 } else { 113 add_action( 114 'wp_ajax_' . $action_name, 115 function () { 116 $main_response = new Ajax_Confirm_Response(); 117 $this->add_error( 'Nonce error' ); 118 $main_response->display_with_response( false, null, 403 ); 119 } 120 ); 121 } 122 } 24 123 } -
vite-rewards/trunk/vite_reward_lite/modules/class-appsbd-related-app.php
r3277607 r3306383 34 34 public function on_init() { 35 35 if ( $this->check_user_access() ) { 36 $this->add_a jax_action( 'data', array( $this, 'data' ) );37 $this->add_a jax_action( 'install-lite', array( $this, 'install_related_plugin' ) );36 $this->add_admin_ajax_action( 'data', array( $this, 'data' ) ); 37 $this->add_admin_ajax_action( 'install-lite', array( $this, 'install_related_plugin' ) ); 38 38 } 39 39 parent::on_init(); -
vite-rewards/trunk/vite_reward_lite/modules/class-vite-email-template.php
r3272301 r3306383 46 46 public function on_init() { 47 47 parent::on_init(); 48 $this->add_a jax_action( 'get-template-list', array( $this, 'get_template_list' ) );49 $this->add_a jax_action( 'update-template', array( $this, 'update_template' ) );50 $this->add_a jax_action( 'get-template-details', array( $this, 'template_details' ) );51 $this->add_a jax_action( 'change-status', array( $this, 'change_status' ) );48 $this->add_admin_ajax_action( 'get-template-list', array( $this, 'get_template_list' ) ); 49 $this->add_admin_ajax_action( 'update-template', array( $this, 'update_template' ) ); 50 $this->add_admin_ajax_action( 'get-template-details', array( $this, 'template_details' ) ); 51 $this->add_admin_ajax_action( 'change-status', array( $this, 'change_status' ) ); 52 52 } 53 53 -
vite-rewards/trunk/vite_reward_lite/modules/class-vite-reward-badge.php
r3272301 r3306383 37 37 public function on_init() { 38 38 parent::on_init(); 39 $this->add_a jax_action( 'add-badge', array( $this, 'add_badge' ) );40 $this->add_a jax_action( 'get-badge-details', array( $this, 'get_badge_details' ) );41 $this->add_a jax_action( 'update-badge', array( $this, 'update_badge' ) );42 $this->add_a jax_action( 'delete-badge', array( $this, 'delete_badge' ) );43 $this->add_a jax_action( 'change-default', array( $this, 'change_default' ) );44 $this->add_a jax_action( 'change-status', array( $this, 'change_status' ) );39 $this->add_admin_ajax_action( 'add-badge', array( $this, 'add_badge' ) ); 40 $this->add_admin_ajax_action( 'get-badge-details', array( $this, 'get_badge_details' ) ); 41 $this->add_admin_ajax_action( 'update-badge', array( $this, 'update_badge' ) ); 42 $this->add_admin_ajax_action( 'delete-badge', array( $this, 'delete_badge' ) ); 43 $this->add_admin_ajax_action( 'change-default', array( $this, 'change_default' ) ); 44 $this->add_admin_ajax_action( 'change-status', array( $this, 'change_status' ) ); 45 45 } 46 46 -
vite-rewards/trunk/vite_reward_lite/modules/class-vite-reward-points-table.php
r3272301 r3306383 38 38 public function on_init() { 39 39 parent::on_init(); 40 $this->add_a jax_action( 'update-user-points', array( $this, 'update_user_points' ) );40 $this->add_admin_ajax_action( 'update-user-points', array( $this, 'update_user_points' ) ); 41 41 } 42 42 -
vite-rewards/trunk/vite_reward_lite/modules/class-vite-reward-rules.php
r3272301 r3306383 38 38 public function on_init() { 39 39 parent::on_init(); 40 $this->add_a jax_action( 'get-rules', array( $this, 'get_rules' ) );41 $this->add_a jax_action( 'update-rule', array( $this, 'update_rule' ) );42 $this->add_a jax_action( 'change-email-status', array( $this, 'update_rule_send_email_status' ) );40 $this->add_admin_ajax_action( 'get-rules', array( $this, 'get_rules' ) ); 41 $this->add_admin_ajax_action( 'update-rule', array( $this, 'update_rule' ) ); 42 $this->add_admin_ajax_action( 'change-email-status', array( $this, 'update_rule_send_email_status' ) ); 43 43 } 44 44 -
vite-rewards/trunk/vite_reward_lite/modules/class-vite-reward-settings.php
r3277607 r3306383 55 55 public function on_init() { 56 56 parent::on_init(); 57 $this->add_a jax_action( 'option', 'ajax_request_callback' );58 $this->add_a jax_action( 'get-option', 'get_admin_options' );57 $this->add_admin_ajax_action( 'option', 'ajax_request_callback' ); 58 $this->add_admin_ajax_action( 'get-option', 'get_admin_options' ); 59 59 $this->add_ajax_both_action( 'user-reward-data', array( $this, 'user_reward_data' ) ); 60 $this->add_a jax_action( 'user-point-redemption', array( $this, 'user_point_redemption' ) );60 $this->add_admin_ajax_action( 'user-point-redemption', array( $this, 'user_point_redemption' ) ); 61 61 add_action( 'appsbd/reward/action/apply-order-reward', array( $this, 'apply_reward_in_cart' ) ); 62 62
Note: See TracChangeset
for help on using the changeset viewer.