# ultimate-post/2.3.1/classes/Compatibility.php

Post Grid Gutenberg Blocks – PostX, version 2.3.1. 55 lines.

- Page: https://pluginprobe.com/plugins/ultimate-post/2.3.1/code/classes/Compatibility.php
- Raw: https://pluginprobe.com/plugins/ultimate-post/2.3.1/raw/classes/Compatibility.php
- Modified: 2021-06-01T09:33:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ultimate-post/2.3.1/code/classes/Compatibility.php#L10-L20`.

```php
<?php
/**
 * Compatibility Action.
 * 
 * @package ULTP\Notice
 * @since v.1.1.0
 */

namespace ULTP;

defined('ABSPATH') || exit;

/**
 * Compatibility class.
 */
class Compatibility{

    /**
	 * Setup class.
	 *
	 * @since v.1.1.0
	 */
    public function __construct(){
        add_action( 'upgrader_process_complete', array($this, 'plugin_upgrade_completed'), 10, 2 );
    }


    /**
	 * Compatibility Class Run after Plugin Upgrade
	 *
	 * @since v.1.1.0
	 */
    public function plugin_upgrade_completed( $upgrader_object, $options ) {
        if( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ){
            foreach( $options['plugins'] as $plugin ) {
                if( $plugin == ULTP_BASE ) {
                    $set_settings = array(
                        'ultp_templates' => 'true',
                        'ultp_elementor' => 'true',
                    );
                    
                    // Pro Addons Data Init
                    $addon_data = get_option('ultp_addons_option', array());
                    if (isset($addon_data['ultp_category'])) {
                        $set_settings['ultp_category'] = $addon_data['ultp_category'];
                    }

                    foreach ($set_settings as $key => $value) {
                        ultimate_post()->set_setting($key, $value);
                    }
                }
            }
        }
    }
}
```
