C:\xampp\htdocs\landing\wp-content\updraft\themes-old\pennews_\wp-updates-theme.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/*
WPUpdates Theme Updater Class
http://wp-updates.com
v2.0

Example Usage:
require_once('wp-updates-theme.php');
new WPUpdatesThemeUpdater_2239( 'http://wp-updates.com/api/2/theme', basename(get_template_directory()) );
*/

if( !class_exists('WPUpdatesThemeUpdater_2239') ) {
    class 
WPUpdatesThemeUpdater_2239 {
    
        var 
$api_url;
        var 
$theme_id 2239;
        var 
$theme_slug;
        var 
$license_key;
    
        function 
__construct$api_url$theme_slug$license_key null ) {
            
$this->api_url $api_url;
            
$this->theme_slug $theme_slug;
            
$this->license_key $license_key;
    
            
add_filter'pre_set_site_transient_update_themes', array(&$this'check_for_update') );
            
            
// This is for testing only!
            //set_site_transient('update_themes', null);
        
}
        
        function 
check_for_update$transient ) {
            if (empty(
$transient->checked)) return $transient;
            
            
$request_args = array(
                
'id' => $this->theme_id,
                
'slug' => $this->theme_slug,
                
'version' => $transient->checked[$this->theme_slug]
            );
            if (
$this->license_key$request_args['license'] = $this->license_key;
            
            
$request_string $this->prepare_request'theme_update'$request_args );
            
$raw_response wp_remote_post$this->api_url$request_string );
            
            
$response null;
            if( !
is_wp_error($raw_response) && ($raw_response['response']['code'] == 200) )
                
$response unserialize($raw_response['body']);
            
            if( !empty(
$response) ) // Feed the update data into WP updater
                
$transient->response[$this->theme_slug] = $response;
            
            return 
$transient;
        }
        
        function 
prepare_request$action$args ) {
            global 
$wp_version;
            
            return array(
                
'body' => array(
                    
'action' => $action
                    
'request' => serialize($args),
                    
'api-key' => md5(home_url())
                ),
                
'user-agent' => 'WordPress/'$wp_version .'; 'home_url()
            );    
        }

    }
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586