Plugin Directory

Changeset 3306383


Ignore:
Timestamp:
06/04/2025 12:24:59 PM (10 months ago)
Author:
appsbd
Message:

release version 1.0.6

Location:
vite-rewards/trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • vite-rewards/trunk/readme.txt

    r3277607 r3306383  
    66Tested up to: 6.8
    77Requires PHP: 7.2
    8 Stable tag: 1.0.5
     8Stable tag: 1.0.6
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • vite-rewards/trunk/vite-rewards.php

    r3277607 r3306383  
    44 * Plugin URI: https://appsbd.com
    55 * Description: It's a plugin for WooCommerce and vitepos reward calculation.
    6  * Version: 1.0.5
     6 * Version: 1.0.6
    77 * Author: appsbd
    88 * Author URI: http://www.appsbd.com
  • vite-rewards/trunk/vite_reward_lite/core/class-vite-reward-lite.php

    r3277607 r3306383  
    144144        $this->add_script( 'apbd-reward-admin' );
    145145        $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' );
    147147        $jv_object->base_slug                           = $this->get_action_prefix();
    148148        $jv_object->currency_symbol                     = get_woocommerce_currency_symbol();
    149149        $jv_object->decimal_places                      = wc_get_price_decimals();
    150150        $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' );
    152152        $jv_object->app_version                         = $this->get_plugin_version();
    153153        $jv_object->translation_obj                     = new \stdClass();
     
    247247
    248248        $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' );
    250250        $jv_object->base_slug  = 'apbd-rep';
    251251        $jv_object->ajax_nonce = '';
  • vite-rewards/trunk/vite_reward_lite/core/class-vite-reward-module-lite.php

    r3272301 r3306383  
    99
    1010use Appsbd_Lite\V4\Core\BaseModule;
     11use Appsbd_Lite\V4\libs\Ajax_Confirm_Response;
    1112
    1213if ( ! defined( 'ABSPATH' ) ) {
     
    2122abstract class Vite_Reward_Module_Lite extends BaseModule {
    2223
     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 ) {
    2348
     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    }
    24123}
  • vite-rewards/trunk/vite_reward_lite/modules/class-appsbd-related-app.php

    r3277607 r3306383  
    3434    public function on_init() {
    3535        if ( $this->check_user_access() ) {
    36             $this->add_ajax_action( 'data', array( $this, 'data' ) );
    37             $this->add_ajax_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' ) );
    3838        }
    3939        parent::on_init();
  • vite-rewards/trunk/vite_reward_lite/modules/class-vite-email-template.php

    r3272301 r3306383  
    4646    public function on_init() {
    4747        parent::on_init();
    48         $this->add_ajax_action( 'get-template-list', array( $this, 'get_template_list' ) );
    49         $this->add_ajax_action( 'update-template', array( $this, 'update_template' ) );
    50         $this->add_ajax_action( 'get-template-details', array( $this, 'template_details' ) );
    51         $this->add_ajax_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' ) );
    5252    }
    5353
  • vite-rewards/trunk/vite_reward_lite/modules/class-vite-reward-badge.php

    r3272301 r3306383  
    3737    public function on_init() {
    3838        parent::on_init();
    39         $this->add_ajax_action( 'add-badge', array( $this, 'add_badge' ) );
    40         $this->add_ajax_action( 'get-badge-details', array( $this, 'get_badge_details' ) );
    41         $this->add_ajax_action( 'update-badge', array( $this, 'update_badge' ) );
    42         $this->add_ajax_action( 'delete-badge', array( $this, 'delete_badge' ) );
    43         $this->add_ajax_action( 'change-default', array( $this, 'change_default' ) );
    44         $this->add_ajax_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' ) );
    4545    }
    4646
  • vite-rewards/trunk/vite_reward_lite/modules/class-vite-reward-points-table.php

    r3272301 r3306383  
    3838    public function on_init() {
    3939        parent::on_init();
    40         $this->add_ajax_action( 'update-user-points', array( $this, 'update_user_points' ) );
     40        $this->add_admin_ajax_action( 'update-user-points', array( $this, 'update_user_points' ) );
    4141    }
    4242
  • vite-rewards/trunk/vite_reward_lite/modules/class-vite-reward-rules.php

    r3272301 r3306383  
    3838    public function on_init() {
    3939        parent::on_init();
    40         $this->add_ajax_action( 'get-rules', array( $this, 'get_rules' ) );
    41         $this->add_ajax_action( 'update-rule', array( $this, 'update_rule' ) );
    42         $this->add_ajax_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' ) );
    4343    }
    4444
  • vite-rewards/trunk/vite_reward_lite/modules/class-vite-reward-settings.php

    r3277607 r3306383  
    5555    public function on_init() {
    5656        parent::on_init();
    57         $this->add_ajax_action( 'option', 'ajax_request_callback' );
    58         $this->add_ajax_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' );
    5959        $this->add_ajax_both_action( 'user-reward-data', array( $this, 'user_reward_data' ) );
    60         $this->add_ajax_action( 'user-point-redemption', array( $this, 'user_point_redemption' ) );
     60        $this->add_admin_ajax_action( 'user-point-redemption', array( $this, 'user_point_redemption' ) );
    6161        add_action( 'appsbd/reward/action/apply-order-reward', array( $this, 'apply_reward_in_cart' ) );
    6262
Note: See TracChangeset for help on using the changeset viewer.