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