PluginProbe
Post Grid Gutenberg Blocks – PostX / 2.5.6
Post Grid Gutenberg Blocks – PostX v2.5.6
5.0.39 5.0.38 5.0.37 5.0.36 5.0.35 5.0.34 5.0.33 5.0.32 5.0.31 5.0.30 5.0.29 5.0.28 5.0.27 5.0.26 5.0.25 5.0.23 5.0.24 5.0.22 5.0.21 5.0.20 5.0.19 5.0.18 5.0.17 2.1.1 2.1.2 All 237 releases
← All changes | classes/Compatibility.php +74 -74 5.0.382.5.6 View file →
@@ -1,95 +1,95 @@
1 1 <?php
2 2 /**
3 3 * Compatibility Action.
4 - *
5 - * @package ULTP\Compatibility
4 + *
5 + * @package ULTP\Notice
6 6 * @since v.1.1.0
7 7 */
8 8
9 9 namespace ULTP;
10 10
11 -defined( 'ABSPATH' ) || exit;
11 +defined('ABSPATH') || exit;
12 12
13 13 /**
14 14 * Compatibility class.
15 - *
16 - * Handles compatibility with other plugins and themes for Ultimate Post.
17 - *
18 - * @package ULTP\Compatibility
19 - * @since 4.0.0
20 15 */
21 -class Compatibility {
16 +class Compatibility{
22 17
23 - /**
18 + /**
24 19 * Setup class.
25 20 *
26 21 * @since v.1.1.0
27 22 */
28 - public function __construct() {
29 - add_action( 'admin_init', array( $this, 'handle_front_page_builder' ) );
23 + public function __construct(){
24 + add_action( 'upgrader_process_complete', array($this, 'plugin_upgrade_completed'), 10, 2 );
25 + }
30 26
31 - // PublishPress Revisions Plugin Compatibility Add
32 - add_action( 'revisionary_copy_postmeta', array( $this, 'ultp_revisionary_copy_postmeta_callback' ), 10, 3 );
33 - }
34 27
35 - /**
36 - * Compatibility for Front Page Builder
28 + /**
29 + * Compatibility Class Run after Plugin Upgrade
37 30 *
38 - * @since 4.1.12
31 + * @since v.1.1.0
39 32 */
40 - public function handle_front_page_builder() {
41 -
42 - if ( get_option( 'ultp_frontpage_builder_comp' ) != 'yes' ) {
43 - $builder_condition = get_option( 'ultp_builder_conditions', array() );
44 - if ( ! empty( $builder_condition ) &&
45 - ! empty( $builder_condition['singular'] )
46 - ) {
47 - $f_pages = array();
48 - foreach ( $builder_condition['singular'] as $id => $paths ) {
49 - if ( in_array( 'include/singular/front_page', $paths ) ) {
50 - $f_pages[ $id ] = array( 'include/front_page' ); // Add the ID to the list
51 - update_post_meta( $id, '__ultp_builder_type', 'front_page' );
52 - unset( $builder_condition['singular'][ $id ] );
53 - }
54 - }
55 - if ( empty( $builder_condition['front_page'] ) ) {
56 - $builder_condition['front_page'] = $f_pages;
57 - } else {
58 - $builder_condition['front_page'] = $builder_condition['front_page'] + $f_pages;
59 - }
60 - update_option( 'ultp_frontpage_builder_comp', 'yes' );
61 - update_option( 'ultp_builder_conditions', $builder_condition );
62 - }
63 - }
64 - }
65 -
66 - /**
67 - * Compatibility for PublishPress Revisions Plugin
68 - *
69 - * @url https://wordpress.org/plugins/revisionary/
70 - *
71 - * @since v.2.9.8
72 - *
73 - * @param MIXED $from_post The source post object or ID.
74 - * @param INT $to_post_id The destination post ID.
75 - * @param ARRAY $args Additional arguments.
76 - */
77 - public function ultp_revisionary_copy_postmeta_callback( $from_post, $to_post_id, $args ) {
78 - global $wp_filesystem;
79 - if ( ! $wp_filesystem ) {
80 - require_once ABSPATH . 'wp-admin/includes/file.php';
81 - WP_Filesystem();
82 - }
83 - $css_meta = get_post_meta( $to_post_id, '_ultp_css', true );
84 - $upload_dir_url = wp_get_upload_dir();
85 - $upload_css_dir_url = trailingslashit( $upload_dir_url['basedir'] );
86 - $css_dir_path = $upload_css_dir_url . "ultimate-post/ultp-css-{$to_post_id}.css";
87 -
88 - if ( file_exists( $css_dir_path ) ) {
89 - $css = $wp_filesystem->get_contents( $css_dir_path );
90 - if ( $css_meta != $css ) {
91 - $wp_filesystem->put_contents( $css_dir_path, $css_meta );
92 - }
93 - }
94 - }
95 -}
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 + 'ultp_category' => 'false',
39 + 'ultp_templates' => 'true',
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'
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 + }
68 +
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 + }
90 + }
91 + }
92 + }
93 + }
94 + }
95 +}