| 1 |
<?php |
| 2 |
/** |
| 3 |
* Compatibility Action. |
| 4 |
* |
| 5 |
* @package ULTP\Notice |
| 6 |
* @since v.1.1.0 |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace ULTP; |
| 10 |
|
| 11 |
defined('ABSPATH') || exit; |
| 12 |
|
| 13 |
/** |
| 14 |
* Compatibility class. |
| 15 |
*/ |
| 16 |
class Compatibility{ |
| 17 |
|
| 18 |
/** |
| 19 |
* Setup class. |
| 20 |
* |
| 21 |
* @since v.1.1.0 |
| 22 |
*/ |
| 23 |
public function __construct() { |
| 24 |
add_action( 'upgrader_process_complete', array($this, 'plugin_upgrade_completed'), 10, 2 ); |
| 25 |
} |
| 26 |
|
| 27 |
|
| 28 |
/** |
| 29 |
* Compatibility Class Run after Plugin Upgrade |
| 30 |
* |
| 31 |
* @since v.1.1.0 |
| 32 |
*/ |
| 33 |
public function plugin_upgrade_completed( $upgrader_object, $options ) { |
| 34 |
if ($options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] )) { |
| 35 |
foreach( $options['plugins'] as $plugin ) { |
| 36 |
if ($plugin == ULTP_BASE ) { |
| 37 |
$set_settings = array( |
| 38 |
'disable_view_cookies' => '', |
| 39 |
'ultp_category' => 'false', |
| 40 |
'ultp_templates' => 'true', |
| 41 |
'ultp_elementor' => 'true', |
| 42 |
'ultp_table_of_content' => 'true', |
| 43 |
'ultp_builder' => 'true', |
| 44 |
'post_grid_1' => 'yes', |
| 45 |
'post_grid_2' => 'yes', |
| 46 |
'post_grid_3' => 'yes', |
| 47 |
'post_grid_4' => 'yes', |
| 48 |
'post_grid_5' => 'yes', |
| 49 |
'post_grid_6' => 'yes', |
| 50 |
'post_grid_7' => 'yes', |
| 51 |
'post_list_1' => 'yes', |
| 52 |
'post_list_2' => 'yes', |
| 53 |
'post_list_3' => 'yes', |
| 54 |
'post_list_4' => 'yes', |
| 55 |
'post_module_1' => 'yes', |
| 56 |
'post_module_2' => 'yes', |
| 57 |
'post_slider_1' => 'yes', |
| 58 |
'heading' => 'yes', |
| 59 |
'image' => 'yes', |
| 60 |
'taxonomy' => 'yes', |
| 61 |
'wrapper' => 'yes', |
| 62 |
'news_ticker' => 'yes', |
| 63 |
'builder_advance_post_meta' => 'yes', |
| 64 |
'builder_archive_title' => 'yes', |
| 65 |
'builder_author_box' => 'yes', |
| 66 |
'builder_post_next_previous'=> 'yes', |
| 67 |
'builder_post_author_meta' => 'yes', |
| 68 |
'builder_post_breadcrumb' => 'yes', |
| 69 |
'builder_post_category' => 'yes', |
| 70 |
'builder_post_comment_count'=> 'yes', |
| 71 |
'builder_post_comments' => 'yes', |
| 72 |
'builder_post_content' => 'yes', |
| 73 |
'builder_post_date_meta' => 'yes', |
| 74 |
'builder_post_excerpt' => 'yes', |
| 75 |
'builder_post_featured_image'=> 'yes', |
| 76 |
'builder_post_reading_time' => 'yes', |
| 77 |
'builder_post_social_share' => 'yes', |
| 78 |
'builder_post_tag' => 'yes', |
| 79 |
'builder_post_title' => 'yes', |
| 80 |
'builder_post_view_count' => 'yes', |
| 81 |
'save_version' => rand(1, 1000) |
| 82 |
); |
| 83 |
$addon_data = ultimate_post()->get_setting(); |
| 84 |
foreach ($set_settings as $key => $value) { |
| 85 |
if (!isset($addon_data[$key])) { |
| 86 |
ultimate_post()->set_setting($key, $value); |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
|
| 91 |
// License Check And Active |
| 92 |
if (defined('ULTP_PRO_VER')) { |
| 93 |
$license = get_option( 'edd_ultp_license_key' ); |
| 94 |
$response = wp_remote_post( |
| 95 |
'https://www.wpxpo.com', |
| 96 |
array( |
| 97 |
'timeout' => 15, |
| 98 |
'sslverify' => false, |
| 99 |
'body' => array( |
| 100 |
'edd_action' => 'activate_license', |
| 101 |
'license' => $license, |
| 102 |
'item_id' => 181, |
| 103 |
'url' => home_url() |
| 104 |
) |
| 105 |
) |
| 106 |
); |
| 107 |
if (!is_wp_error( $response ) && 200 == wp_remote_retrieve_response_code( $response ) ) { |
| 108 |
$license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
| 109 |
update_option( 'edd_ultp_license_status', $license_data->license ); |
| 110 |
} |
| 111 |
} |
| 112 |
} |
| 113 |
} |
| 114 |
} |
| 115 |
} |
| 116 |
} |