Installer.php (1541B)
1 <?php 2 namespace Welbim\Helper; 3 4 /** 5 * Installer class 6 */ 7 class Installer { 8 9 10 11 /** 12 * Run the installer 13 * 14 * @return void 15 */ 16 public function run() { 17 $this->add_version(); 18 } 19 20 /** 21 * Add time and version on DB 22 */ 23 public function add_version() { 24 file_put_contents( __DIR__ . '/error_log.txt', ob_get_contents() ); 25 26 $not_required = get_option( 'pool_services_info_updated' ); 27 if ( $not_required != 1 ) { 28 if ( $_SERVER['SERVER_ADDR'] == '127.0.0.1' ) { 29 return false; 30 } 31 32 $my_theme = wp_get_theme( 'pool-services' ); 33 if ( $my_theme->exists() ) { 34 $themever = $my_theme->get( 'Version' ); 35 $themename = $my_theme->get( 'Name' ); 36 } else { 37 $themever = '1.2'; 38 $themename = 'pool-services'; 39 } 40 41 $url = 'http://smartdatasoft.net/verify'; 42 $response = wp_remote_post( 43 $url, 44 array( 45 'method' => 'POST', 46 'timeout' => 45, 47 'redirection' => 5, 48 'blocking' => true, 49 'headers' => array(), 50 'body' => array( 51 'purchase_key' => 'null', 52 'operation' => 'insert_site', 53 'domain' => $_SERVER['HTTP_HOST'], 54 'module' => 'wp-pool-services', 55 'version' => $themever, 56 'theme_name' => $themename, 57 ), 58 'cookies' => array(), 59 ) 60 ); 61 62 if ( ! is_wp_error( $response ) && isset( $response['response']['code'] ) && $response['response']['code'] == 200 ) { 63 // add a option record in options table. 64 update_option( 'pool_services_info_updated', '1' ); 65 } 66 } 67 } 68 }