| 1 |
<?php |
| 2 |
namespace ULTP; |
| 3 |
|
| 4 |
defined('ABSPATH') || exit; |
| 5 |
|
| 6 |
class Compatibility{ |
| 7 |
|
| 8 |
public function __construct(){ |
| 9 |
add_action( 'upgrader_process_complete', array($this, 'plugin_upgrade_completed'), 10, 2 ); |
| 10 |
} |
| 11 |
|
| 12 |
public function plugin_upgrade_completed( $upgrader_object, $options ) { |
| 13 |
if( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ){ |
| 14 |
foreach( $options['plugins'] as $plugin ) { |
| 15 |
if( $plugin == ULTP_BASE ) { |
| 16 |
$set_settings = array( |
| 17 |
'ultp_templates' => 'true', |
| 18 |
'ultp_elementor' => 'true', |
| 19 |
); |
| 20 |
|
| 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']; |
| 25 |
} |
| 26 |
|
| 27 |
foreach ($set_settings as $key => $value) { |
| 28 |
ultimate_post()->set_setting($key, $value); |
| 29 |
} |
| 30 |
} |
| 31 |
} |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
} |