plugin_name = $plugin_name; $this->version = $version; $this->purchase_code = get_option("{$plugin_name}-purchase-code",''); $ajax_action = str_replace('-','_',$this->plugin_name)."_update_purchase_code"; add_action('admin_init', array($this, 'updater')); add_action( 'admin_notices', array( $this, 'activate_license_notice' ), 15 ); add_action( "wp_ajax_".$ajax_action, array( $this, 'update_purchase_code' ) ); } /** * Get The home url without protocol * * @return string the home url * * @since 1.0.0 */ public function get_home_url() { $home_url = home_url(); $schemes = array( 'https://', 'http://', 'www.' ); foreach ( $schemes as $scheme ) { $home_url = str_replace( $scheme, '', $home_url ); } if ( strpos( $home_url, '?' ) !== false ) { list( $base, $query ) = explode( '?', $home_url, 2 ); $home_url = $base; } $home_url = untrailingslashit( $home_url ); return $home_url; } /** * Get protected xperts.club api uri * * * @return mixed array * * @since 1.0 */ public function get_api_uri( $request ) { return str_replace( '%request%', $request, $this->api_uri . $this->api_uri_query_args ); } /** * Update plugin if available * * @since 1.2; */ public function updater(){ if (isset($this->purchase_code) && $this->purchase_code!='') { if(!class_exists('Puc_v4_Factory')){ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/licence/updater.php'; } $args = array( 'purchase_code' => $this->purchase_code, 'item_id' => sanitize_text_field( $this->plugin_name ), 'version' => $this->version, 'instance' => $this->get_home_url() ); $api_uri = esc_url_raw( add_query_arg( $args, $this->get_api_uri( '__xc_plugin_update' ) ) ); $updatechecker = Puc_v4_Factory::buildUpdateChecker( $api_uri, XC_WOO_CLOUD_FILE, $this->plugin_name ); } } public function activate_license_notice(){ $show_license_notice = current_user_can( 'update_plugins' ); if ( apply_filters( 'xc_woo_cloud_show_activate_license_notice', $show_license_notice ) && $this->purchase_code == '' ) { $plugin_data = get_plugin_data( XC_WOO_CLOUD_FILE ); $plugin_name = $plugin_data['Name']; ?>

Warning! You didn't set purchase code for which means you're missing out on updates and support.
( How to find your purchase code from CodeCanyon click here )

Add Code
plugin_name; $field_name = $this->plugin_name."-purchase-code"; if (isset($posted_values[$field_name])==false) { wp_send_json(array('code'=>401,'message'=>'Please enter valid purchase code')); } $purchase_code=sanitize_text_field($posted_values[$field_name]); $args = array( 'purchase_code' => $purchase_code, 'item_id' => sanitize_text_field( $this->plugin_name ), 'version' => $this->version, 'instance' => $this->get_home_url() ); $api_uri = esc_url_raw( add_query_arg( $args, $this->get_api_uri( '__xc_plugin_activation' ) ) ); $timeout = apply_filters( 'xc_woo_twilio_licence_timeout', 30, __FUNCTION__ ); $response = wp_remote_get( $api_uri, array( 'timeout' => $timeout ) ); if ( is_wp_error( $response ) ) { $body = array('code'=>301,'message'=>'Connection problem! please contact support'); } else { $body = json_decode( $response[ 'body' ] ); $body = is_object( $body ) ? get_object_vars( $body ) : array('code'=>301,'message'=>'Connection problem! please contact support');; } if ( $body && is_array( $body ) && isset( $body[ 'status' ] ) && $body[ 'status' ] == 'success' ) { update_option("{$plugin_name}-purchase-code", $purchase_code); } wp_send_json( $body ); } }