Plugin Directory

Changeset 1796003


Ignore:
Timestamp:
01/02/2018 06:03:01 PM (8 years ago)
Author:
maxtongh
Message:

Improvements for update process

Location:
top-3-jackpots/trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • top-3-jackpots/trunk/inc/shortcodes.php

    r1792374 r1796003  
    1818//Shortcode Handler
    1919function top3jp_shortcode_handler( $atts ){
     20   
     21    //Stop further execution if PHP CURL is disabled on server and notify admin about the issue
     22    if( !function_exists( 'curl_init' ) ){
     23        add_action( 'admin_notices', 'top3jps_admin_notice_curl_issue' );
     24        return '';
     25    }
    2026
    2127    $lottodata_ = get_option( 'top3jps_lottodata', false );
  • top-3-jackpots/trunk/inc/updates.php

    r1792374 r1796003  
    5151
    5252function top3jps_cron_update_jackpots(){
    53    
    54     $content = file_get_contents( base64_decode( 'aHR0cDovL2ZlZWRzLmxvdHRvZWxpdGUuY29tL3Jzcy5waHA/bGFuZz1lbiZhY2NvdW50PW9mZnBpc3RhJnNpdGU9MiZ0eXBlPTM=' ) );
    55     $x = new SimpleXmlElement( $content );
     53
     54    //Stop further execution if PHP CURL is disabled on server and notify admin about the issue
     55    if( !function_exists( 'curl_init' ) ){
     56        add_action( 'admin_notices', 'top3jps_admin_notice_curl_issue' );
     57        return;
     58    }
     59
     60    $request_headers = array(
     61        'User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36',
     62        'Accept: text/html,application/xhtml+xml,application/xml;',
     63        'Accept-Language:en-GB,en-US;q=0.9,en;q=0.8'
     64    );
     65
     66    $ch = curl_init();
     67    curl_setopt( $ch, CURLOPT_URL, base64_decode( 'aHR0cDovL2ZlZWRzLmxvdHRvZWxpdGUuY29tL3Jzcy5waHA/bGFuZz1lbiZhY2NvdW50PWY4YmEwMzk2JnNpdGU9MiZ0eXBlPTM=' ) );
     68    curl_setopt( $ch, CURLOPT_HTTPHEADER, $request_headers );
     69    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
     70    curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 10 );
     71    curl_setopt( $ch, CURLOPT_TIMEOUT, 10 );
     72    $response = curl_exec( $ch );
     73
     74    $x = new SimpleXmlElement( $response );
    5675
    5776    $site_url = site_url();
  • top-3-jackpots/trunk/index.php

    r1792497 r1796003  
    44 * Plugin URI: https://wordpress.org/plugins/top-3-jackpots/
    55 * Description: This plugin is made for you to monetize your WordPress website's traffic with a great lottery offer! Shortcode: [top3jackpots]
    6  * Version: 1.0.3
     6 * Version: 1.0.4
    77 * Author: maxtongh
    88 * Author URI: https://www.offpista.com/
     
    3636/*-------------------------------------------- INCLUDES -------------------------------------------*/
    3737/*-------------------------------------------------------------------------------------------------*/
     38include_once TOP_3_JP_ROOT_DIR . 'inc/admin-notices.php';
    3839include_once TOP_3_JP_ROOT_DIR . 'inc/frontend-editor/template.php';
    3940include_once TOP_3_JP_ROOT_DIR . 'inc/frontend-editor/receiver.php';
Note: See TracChangeset for help on using the changeset viewer.