| 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 |
|
| 39 |
// Pro Addons Data Init |
| 40 |
$addon_data = ultimate_post()->get_setting(); |
| 41 |
if (!isset($addon_data['ultp_category'])) { |
| 42 |
$set_settings['ultp_category'] = 'false'; |
| 43 |
} |
| 44 |
if (!isset($addon_data['ultp_templates'])) { |
| 45 |
$set_settings['ultp_templates'] = 'true'; |
| 46 |
} |
| 47 |
if (!isset($addon_data['ultp_elementor'])) { |
| 48 |
$set_settings['ultp_elementor'] = 'true'; |
| 49 |
} |
| 50 |
if (!isset($addon_data['ultp_table_of_content'])) { |
| 51 |
$set_settings['ultp_table_of_content'] = 'true'; |
| 52 |
} |
| 53 |
if (!isset($addon_data['post_grid_1'])) { |
| 54 |
$set_settings['post_grid_1'] = 'yes'; |
| 55 |
} |
| 56 |
if (!isset($addon_data['post_grid_2'])) { |
| 57 |
$set_settings['post_grid_2'] = 'yes'; |
| 58 |
} |
| 59 |
if (!isset($addon_data['post_grid_3'])) { |
| 60 |
$set_settings['post_grid_3'] = 'yes'; |
| 61 |
} |
| 62 |
if (!isset($addon_data['post_grid_4'])) { |
| 63 |
$set_settings['post_grid_4'] = 'yes'; |
| 64 |
} |
| 65 |
if (!isset($addon_data['post_grid_5'])) { |
| 66 |
$set_settings['post_grid_5'] = 'yes'; |
| 67 |
} |
| 68 |
if (!isset($addon_data['post_grid_6'])) { |
| 69 |
$set_settings['post_grid_6'] = 'yes'; |
| 70 |
} |
| 71 |
if (!isset($addon_data['post_grid_7'])) { |
| 72 |
$set_settings['post_grid_7'] = 'yes'; |
| 73 |
} |
| 74 |
if (!isset($addon_data['post_list_1'])) { |
| 75 |
$set_settings['post_list_1'] = 'yes'; |
| 76 |
} |
| 77 |
if (!isset($addon_data['post_list_2'])) { |
| 78 |
$set_settings['post_list_2'] = 'yes'; |
| 79 |
} |
| 80 |
if (!isset($addon_data['post_list_3'])) { |
| 81 |
$set_settings['post_list_3'] = 'yes'; |
| 82 |
} |
| 83 |
if (!isset($addon_data['post_list_4'])) { |
| 84 |
$set_settings['post_list_4'] = 'yes'; |
| 85 |
} |
| 86 |
if (!isset($addon_data['post_module_1'])) { |
| 87 |
$set_settings['post_module_1'] = 'yes'; |
| 88 |
} |
| 89 |
if (!isset($addon_data['post_module_2'])) { |
| 90 |
$set_settings['post_module_2'] = 'yes'; |
| 91 |
} |
| 92 |
if (!isset($addon_data['post_slider_1'])) { |
| 93 |
$set_settings['post_slider_1'] = 'yes'; |
| 94 |
} |
| 95 |
if (!isset($addon_data['heading'])) { |
| 96 |
$set_settings['heading'] = 'yes'; |
| 97 |
} |
| 98 |
if (!isset($addon_data['image'])) { |
| 99 |
$set_settings['image'] = 'yes'; |
| 100 |
} |
| 101 |
if (!isset($addon_data['taxonomy'])) { |
| 102 |
$set_settings['taxonomy'] = 'yes'; |
| 103 |
} |
| 104 |
if (!isset($addon_data['wrapper'])) { |
| 105 |
$set_settings['wrapper'] = 'yes'; |
| 106 |
} |
| 107 |
if (!empty($set_settings)) { |
| 108 |
foreach ($set_settings as $key => $value) { |
| 109 |
ultimate_post()->set_setting($key, $value); |
| 110 |
} |
| 111 |
} |
| 112 |
|
| 113 |
// License Check And Active |
| 114 |
if (defined('ULTP_PRO_VER')) { |
| 115 |
$license = get_option( 'edd_ultp_license_key' ); |
| 116 |
$response = wp_remote_post( |
| 117 |
'https://www.wpxpo.com', |
| 118 |
array( |
| 119 |
'timeout' => 15, |
| 120 |
'sslverify' => false, |
| 121 |
'body' => array( |
| 122 |
'edd_action' => 'activate_license', |
| 123 |
'license' => $license, |
| 124 |
'item_id' => 181, |
| 125 |
'url' => home_url() |
| 126 |
) |
| 127 |
) |
| 128 |
); |
| 129 |
if ( !is_wp_error( $response ) && 200 == wp_remote_retrieve_response_code( $response ) ) { |
| 130 |
$license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
| 131 |
update_option( 'edd_ultp_license_status', $license_data->license ); |
| 132 |
} |
| 133 |
} |
| 134 |
} |
| 135 |
} |
| 136 |
} |
| 137 |
} |
| 138 |
} |