Plugin Directory

Changeset 2793402


Ignore:
Timestamp:
10/03/2022 11:39:15 AM (4 years ago)
Author:
wiloke
Message:

Resolved verify purchase code issue

Location:
myshopkit-popup-smartbar-slidein/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • myshopkit-popup-smartbar-slidein/trunk/README.md

    r2790696 r2793402  
    66Tested up to: 6.0.2
    77Requires PHP: 7.4
    8 Stable tag: 1.0.6
     8Stable tag: 1.0.7
    99License: GPLv2 or later
    1010
  • myshopkit-popup-smartbar-slidein/trunk/myshopkit-popup-smartbar-slidein.php

    r2790696 r2793402  
    44 * Plugin URI: https://popup-smartbar-slidein.myshopkit.app
    55 * Description: The one kit to boost sales
    6  * Version: 1.0.6
     6 * Version: 1.0.7
    77 * Author: Wiloke
    88 * Author URI: https://woocommerce.myshopkit.app/
     
    3333
    3434
    35 define('MYSHOOKITPSS_VERSION', '1.0.6');
     35define('MYSHOOKITPSS_VERSION', '1.0.7');
    3636define('MYSHOOKITPSS_NAMESPACE', 'mskpss');
    3737define('MYSHOOKITPSS_HOOK_PREFIX', 'mskpss/');
  • myshopkit-popup-smartbar-slidein/trunk/src/Dashboard/Assets/Js/Script.js

    r2790696 r2793402  
    33
    44    const ajax_init = {
    5         url: window.MYSHOOKITPSS_GLOBAL.restBase,
     5        url: window.MYSHOOKITPSS_GLOBAL.purchaseCodeUrl,
     6        purchaseCodeUrl: window.MYSHOOKITPSS_GLOBAL.purchaseCodeUrl,
     7        // url: window.MYSHOOKITPSS_GLOBAL.restBase,
    68        token: "",
    79        plan: window.MYSHOOKITPSS_GLOBAL.purchaseCode === "free" || window.MYSHOOKITPSS_GLOBAL.purchaseCode === "" ? "free" : "enterprise",
     
    7173            return;
    7274        }
    73         const { payload, type } = event.data
     75        const {payload, type} = event.data
    7476
    7577        /** Dashboard page */
  • myshopkit-popup-smartbar-slidein/trunk/src/Dashboard/Controllers/AuthController.php

    r2786223 r2793402  
    3232        add_filter('determine_current_user', [$this, 'determineCurrentUser']);
    3333
     34        add_action('wp_ajax_mks_popup_purchase_code', [$this, 'ajaxSavePurchaseCode']);
    3435        add_filter('wp_is_application_passwords_available', function () {
    3536            return $this->isSSL();
     
    168169            ]
    169170        );
     171    }
     172
     173    public function ajaxSavePurchaseCode()
     174    {
     175        if (current_user_can('administrator')) {
     176            wp_send_json_error();
     177        }
     178
     179        if (isset($_POST['purchase_code']) && !empty($_POST['purchase_code'])) {
     180            update_option(AutoPrefix::namePrefix('purchase_code'), sanitize_text_field($_POST['purchase_code']));
     181        }
    170182    }
    171183
     
    333345                throw new Exception($aResponse['message'], $aResponse['code']);
    334346            }
    335             update_option(AutoPrefix::namePrefix('purchase_code'), '');
     347            update_option(AutoPrefix::namePrefix('purchase_code'), 'free');
    336348            return MessageFactory::factory('ajax')->success($aResponse['message'], $aResponse['code']);
    337349        }
  • myshopkit-popup-smartbar-slidein/trunk/src/Dashboard/Controllers/DashboardController.php

    r2790696 r2793402  
    2626        wp_localize_script('jquery', self::MYSHOOKITPSS_GLOBAL, [
    2727            'url'              => admin_url('admin-ajax.php'),
     28            'purchaseCodeUrl'  => add_query_arg([
     29                'action' => 'mks_popup_purchase_code'
     30            ], admin_url('admin-ajax.php')),
    2831            'restBase'         => trailingslashit(rest_url(MYSHOOKITPSS_REST_BASE)),
    2932            'email'            => get_option('admin_email'),
  • myshopkit-popup-smartbar-slidein/trunk/src/Dashboard/Shared/GeneralHelper.php

    r2786223 r2793402  
    1010trait GeneralHelper
    1111{
    12     protected string $dashboardSlug = 'dashboard';
    13     protected string $authSlug = 'auth-settings';
     12    protected string $dashboardSlug = 'dashboard';
     13    protected string $authSlug      = 'auth-settings';
    1414
    15     protected function getDashboardSlug(): string
    16     {
    17         return AutoPrefix::namePrefix($this->dashboardSlug);
    18     }
     15    protected function getDashboardSlug(): string
     16    {
     17        return AutoPrefix::namePrefix($this->dashboardSlug);
     18    }
    1919
    20     protected function getAuthSlug(): string
    21     {
    22         return AutoPrefix::namePrefix($this->authSlug);
    23     }
     20    protected function getAuthSlug(): string
     21    {
     22        return AutoPrefix::namePrefix($this->authSlug);
     23    }
    2424
    2525    private function getToken()
Note: See TracChangeset for help on using the changeset viewer.