| 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_builder'])) { |
| 45 |
// $set_settings['ultp_builder'] = 'false'; |
| 46 |
// } |
| 47 |
if (!isset($addon_data['ultp_templates'])) { |
| 48 |
$set_settings['ultp_templates'] = 'true'; |
| 49 |
} |
| 50 |
if (!isset($addon_data['ultp_elementor'])) { |
| 51 |
$set_settings['ultp_elementor'] = 'true'; |
| 52 |
} |
| 53 |
|
| 54 |
if (!empty($set_settings)) { |
| 55 |
foreach ($set_settings as $key => $value) { |
| 56 |
ultimate_post()->set_setting($key, $value); |
| 57 |
} |
| 58 |
} |
| 59 |
} |
| 60 |
} |
| 61 |
} |
| 62 |
} |
| 63 |
} |