Plugin Directory

Changeset 3158633


Ignore:
Timestamp:
09/27/2024 09:18:18 AM (18 months ago)
Author:
wpscreens
Message:

file upload 2.5.3 version ( fixed slider)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wpscreens/tags/2.5.3/admin/class-wp-screens-admin.php

    r3156150 r3158633  
    258258     
    259259    }
    260     public function wpscrn_check_if_wpscreens_licence_addon_is_active()
    261     {
    262 
     260    public function wpscrn_check_if_wpscreens_licence_addon_is_active() {
     261        // Get the license from options
    263262        $wpscreens_licence = get_option('wpscreen_addon_licence');
    264 
     263   
     264        // Extracting type from the license
    265265        $type = explode('-', esc_html($wpscreens_licence));
    266 
     266   
    267267        if ('Ad' === $type[0] || 'AD' === $type[0]) {
    268             //define('WPSCRN_AD_PRODUCT_ID', 'WPS-ADDON-20');
    269268            $licence_val = 3;
    270         }
    271 
    272 
    273        
    274 
     269        } else {
     270            // You might want to handle other types here
     271            $licence_val = 0; // Default value if not 'Ad'
     272        }
     273   
     274        // Determine the protocol (http or https)
    275275        $protocol = ('off' !== !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] || 443 == $_SERVER['SERVER_PORT']) ? 'https://' : 'http://';
    276276        define('WPSCRN_SL_INSTANCE', str_replace($protocol, '', get_bloginfo('wpurl')));
    277 
    278         // $args = array(
    279         //     'woo_sl_action' => 'status-check',
    280         //     'licence_key' => $wpscreens_licence,
    281         //     'product_unique_id' => 'WPS-ADDON-20',
    282         //     'domain' => WPSCRN_SL_INSTANCE,
    283         // );
    284       $request_uri = "https://wpscreens.com/?woo_sl_action=activate&licence_key=" . $wpscreens_licence . "&product_unique_id=WPS-ADDON-20&domain=" . str_replace($protocol, '', get_bloginfo('wpurl'));;
     277   
     278        // Prepare the request URI
     279        $request_uri = "https://wpscreens.com/?woo_sl_action=activate&licence_key=" . $wpscreens_licence . "&product_unique_id=WPS-ADDON-20&domain=" . str_replace($protocol, '', get_bloginfo('wpurl'));
     280   
     281        // Make the remote request
    285282        $data = wp_remote_get($request_uri);
    286 
     283   
     284        // Check for errors in the request
     285        if (is_wp_error($data)) {
     286            // Log the error message
     287            error_log('WP Remote Get Error: ' . $data->get_error_message());
     288            return; // Exit the function on error
     289        }
     290   
     291        // Decode the response body
    287292        $data_body = json_decode($data['body']);
    288 
     293   
     294        // Check the response for status
    289295        if (isset($data_body[0]->status)) {
    290 
    291             if (('success' == $data_body[0]->status)) {
     296            if ('success' == $data_body[0]->status) {
     297                // License is valid
    292298                update_option('wpscreens_valid_licence_addon', $licence_val);
    293299                update_option('wpscreens_valid_licence_message_addon', $data_body[0]->message);
    294300            } else {
     301                // License is not valid
    295302                update_option('wpscreens_valid_licence_addon', '0');
    296303                update_option('wpscreens_valid_licence_message_addon', $data_body[0]->message);
    297304            }
    298305        } else {
    299         }
    300     }
     306            // Handle cases where status is not set
     307            error_log('Invalid response structure: ' . print_r($data_body, true));
     308        }
     309    }
     310   
    301311    public function wpscrn_check_if_wpscreens_licence_is_active()
    302312    {
Note: See TracChangeset for help on using the changeset viewer.