PluginProbe
Post Grid Gutenberg Blocks – PostX / 2.9.4
Post Grid Gutenberg Blocks – PostX v2.9.4
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
ultimate-post / classes / Compatibility.php

Compatibility.php in Post Grid Gutenberg Blocks – PostX 2.9.4, at classes/Compatibility.php

172 lines 7.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 if (class_exists('KTP_Requirements_Check')) {
26 $this->handle_kadence_element();
27 }
28 }
29
30
31
32 /**
33 * Compatibility to handle kadence element
34 *
35 * @since v.2.8.3
36 */
37 public function handle_kadence_element() {
38 $hook_lists = array(
39 'replace_header' => 'kadence_header',
40 'replace_footer' => 'kadence_footer',
41 'replace_hero_header' => 'kadence_hero_header',
42 'replace_404' => 'kadence_404_content',
43 'replace_single_content' => 'kadence_single_content',
44 'replace_loop_content' => 'kadence_loop_entry',
45 'woocommerce_before_single_product_image' => 'woocommerce_before_single_product_summary',
46 'woocommerce_after_single_product_image' => 'woocommerce_before_single_product_summary',
47 'replace_login_modal' => 'kadence_account_login_form',
48 'fixed_above_trans_header' => 'kadence_before_wrapper',
49 'fixed_above_header' => 'kadence_before_header',
50 'fixed_on_header' => 'kadence_after_wrapper',
51 'fixed_below_footer' => 'kadence_after_footer',
52 'fixed_on_footer' => 'kadence_after_wrapper',
53 'fixed_on_footer_scroll' => 'kadence_after_wrapper',
54 'fixed_on_footer_scroll_space' => 'kadence_after_wrapper',
55 );
56 $args = array(
57 'post_type' => 'kadence_element',
58 'no_found_rows' => true,
59 'update_post_term_cache' => false,
60 'post_status' => 'publish',
61 'numberposts' => 333,
62 'order' => 'ASC',
63 'orderby' => 'menu_order',
64 'suppress_filters' => false,
65 );
66
67 $posts = get_posts( $args );
68 foreach( $posts as $post) {
69 $post_id = $post->ID;
70 $post_hook_meta = get_post_meta($post_id , ( get_post_meta($post_id , '_kad_element_hook', true) == 'custom' ? '_kad_element_hook_custom' : '_kad_element_hook' ), true);
71 if ( $post_hook_meta ) {
72 $selected_hook = isset($hook_lists[$post_hook_meta]) ? $hook_lists[$post_hook_meta] : $post_hook_meta;
73 add_action($selected_hook , function() use (&$post_id) {
74 ultimate_post()->register_scripts_common();
75 ultimate_post()->set_css_style($post_id);
76 });
77 }
78 }
79 }
80
81 /**
82 * Compatibility Class Run after Plugin Upgrade
83 *
84 * @since v.1.1.0
85 */
86 public function plugin_upgrade_completed( $upgrader_object, $options ) {
87 if ($options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] )) {
88 foreach( $options['plugins'] as $plugin ) {
89 if ($plugin == ULTP_BASE ) {
90 $set_settings = array(
91 'disable_view_cookies' => '',
92 'disable_google_font' => '',
93 'ultp_category' => 'false',
94 'ultp_templates' => 'true',
95 'ultp_elementor' => 'true',
96 'ultp_table_of_content' => 'true',
97 'ultp_builder' => 'true',
98 'ultp_custom_font' => 'true',
99 'post_grid_1' => 'yes',
100 'post_grid_2' => 'yes',
101 'post_grid_3' => 'yes',
102 'post_grid_4' => 'yes',
103 'post_grid_5' => 'yes',
104 'post_grid_6' => 'yes',
105 'post_grid_7' => 'yes',
106 'post_list_1' => 'yes',
107 'post_list_2' => 'yes',
108 'post_list_3' => 'yes',
109 'post_list_4' => 'yes',
110 'post_module_1' => 'yes',
111 'post_module_2' => 'yes',
112 'post_slider_1' => 'yes',
113 'post_slider_2' => 'yes',
114 'heading' => 'yes',
115 'image' => 'yes',
116 'taxonomy' => 'yes',
117 'wrapper' => 'yes',
118 'news_ticker' => 'yes',
119 'builder_advance_post_meta' => 'yes',
120 'builder_archive_title' => 'yes',
121 'builder_author_box' => 'yes',
122 'builder_post_next_previous'=> 'yes',
123 'builder_post_author_meta' => 'yes',
124 'builder_post_breadcrumb' => 'yes',
125 'builder_post_category' => 'yes',
126 'builder_post_comment_count'=> 'yes',
127 'builder_post_comments' => 'yes',
128 'builder_post_content' => 'yes',
129 'builder_post_date_meta' => 'yes',
130 'builder_post_excerpt' => 'yes',
131 'builder_post_featured_image'=> 'yes',
132 'builder_post_reading_time' => 'yes',
133 'builder_post_social_share' => 'yes',
134 'builder_post_tag' => 'yes',
135 'builder_post_title' => 'yes',
136 'builder_post_view_count' => 'yes',
137 'save_version' => rand(1, 1000)
138 );
139 $addon_data = ultimate_post()->get_setting();
140 foreach ($set_settings as $key => $value) {
141 if (!isset($addon_data[$key])) {
142 ultimate_post()->set_setting($key, $value);
143 }
144 }
145
146
147 // License Check And Active
148 if (defined('ULTP_PRO_VER')) {
149 $license = get_option( 'edd_ultp_license_key' );
150 $response = wp_remote_post(
151 'https://www.wpxpo.com',
152 array(
153 'timeout' => 15,
154 'sslverify' => false,
155 'body' => array(
156 'edd_action' => 'activate_license',
157 'license' => $license,
158 'item_id' => 181,
159 'url' => home_url()
160 )
161 )
162 );
163 if (!is_wp_error( $response ) && 200 == wp_remote_retrieve_response_code( $response ) ) {
164 $license_data = json_decode( wp_remote_retrieve_body( $response ) );
165 update_option( 'edd_ultp_license_status', $license_data->license );
166 }
167 }
168 }
169 }
170 }
171 }
172 }