PluginProbe
Post Grid Gutenberg Blocks – PostX / 2.9.14
Post Grid Gutenberg Blocks – PostX v2.9.14
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.14, at classes/Compatibility.php

199 lines 8.5 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 // PublishPress Revisions Plugin Compatibility Add
29 add_action('revisionary_copy_postmeta', array($this, 'ultp_revisionary_copy_postmeta_callback'), 10, 3);
30 }
31
32
33 /**
34 * Compatibility for PublishPress Revisions Plugin
35 * @url https://wordpress.org/plugins/revisionary/
36 *
37 * @since v.2.9.8
38 */
39 public function ultp_revisionary_copy_postmeta_callback($from_post, $to_post_id, $args) {
40 $css_meta = get_post_meta( $to_post_id, '_ultp_css', true );
41 $upload_dir_url = wp_get_upload_dir();
42 $upload_css_dir_url = trailingslashit( $upload_dir_url['basedir'] );
43 $css_dir_path = $upload_css_dir_url."ultimate-post/ultp-css-{$to_post_id}.css";
44 if (file_exists( $css_dir_path )) {
45 $css = file_get_contents($css_dir_path);
46 if ($css_meta != $css) {
47 global $wp_filesystem;
48 if (! $wp_filesystem ) {
49 require_once( ABSPATH . 'wp-admin/includes/file.php' );
50 WP_Filesystem();
51 }
52 $wp_filesystem->put_contents( $css_dir_path, $css_meta );
53 }
54 }
55 }
56
57
58 /**
59 * Compatibility to handle kadence element
60 *
61 * @since v.2.8.3
62 */
63 public function handle_kadence_element() {
64 $hook_lists = array(
65 'replace_header' => 'kadence_header',
66 'replace_footer' => 'kadence_footer',
67 'replace_hero_header' => 'kadence_hero_header',
68 'replace_404' => 'kadence_404_content',
69 'replace_single_content' => 'kadence_single_content',
70 'replace_loop_content' => 'kadence_loop_entry',
71 'woocommerce_before_single_product_image' => 'woocommerce_before_single_product_summary',
72 'woocommerce_after_single_product_image' => 'woocommerce_before_single_product_summary',
73 'replace_login_modal' => 'kadence_account_login_form',
74 'fixed_above_trans_header' => 'kadence_before_wrapper',
75 'fixed_above_header' => 'kadence_before_header',
76 'fixed_on_header' => 'kadence_after_wrapper',
77 'fixed_below_footer' => 'kadence_after_footer',
78 'fixed_on_footer' => 'kadence_after_wrapper',
79 'fixed_on_footer_scroll' => 'kadence_after_wrapper',
80 'fixed_on_footer_scroll_space' => 'kadence_after_wrapper',
81 );
82 $args = array(
83 'post_type' => 'kadence_element',
84 'no_found_rows' => true,
85 'update_post_term_cache' => false,
86 'post_status' => 'publish',
87 'numberposts' => 333,
88 'order' => 'ASC',
89 'orderby' => 'menu_order',
90 'suppress_filters' => false,
91 );
92
93 $posts = get_posts( $args );
94 foreach( $posts as $post) {
95 $post_id = $post->ID;
96 $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);
97 if ( $post_hook_meta ) {
98 $selected_hook = isset($hook_lists[$post_hook_meta]) ? $hook_lists[$post_hook_meta] : $post_hook_meta;
99 add_action($selected_hook , function() use (&$post_id) {
100 ultimate_post()->register_scripts_common();
101 ultimate_post()->set_css_style($post_id);
102 });
103 }
104 }
105 }
106
107 /**
108 * Compatibility Class Run after Plugin Upgrade
109 *
110 * @since v.1.1.0
111 */
112 public function plugin_upgrade_completed( $upgrader_object, $options ) {
113 if ($options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] )) {
114 foreach( $options['plugins'] as $plugin ) {
115 if ($plugin == ULTP_BASE ) {
116 $set_settings = array(
117 'disable_view_cookies' => '',
118 'disable_google_font' => '',
119 'ultp_category' => 'false',
120 'ultp_templates' => 'true',
121 'ultp_elementor' => 'true',
122 'ultp_table_of_content' => 'true',
123 'ultp_builder' => 'true',
124 'ultp_custom_font' => 'true',
125 'ultp_chatgpt' => 'true',
126 'post_grid_1' => 'yes',
127 'post_grid_2' => 'yes',
128 'post_grid_3' => 'yes',
129 'post_grid_4' => 'yes',
130 'post_grid_5' => 'yes',
131 'post_grid_6' => 'yes',
132 'post_grid_7' => 'yes',
133 'post_list_1' => 'yes',
134 'post_list_2' => 'yes',
135 'post_list_3' => 'yes',
136 'post_list_4' => 'yes',
137 'post_module_1' => 'yes',
138 'post_module_2' => 'yes',
139 'post_slider_1' => 'yes',
140 'post_slider_2' => 'yes',
141 'heading' => 'yes',
142 'image' => 'yes',
143 'taxonomy' => 'yes',
144 'wrapper' => 'yes',
145 'news_ticker' => 'yes',
146 'builder_advance_post_meta' => 'yes',
147 'builder_archive_title' => 'yes',
148 'builder_author_box' => 'yes',
149 'builder_post_next_previous'=> 'yes',
150 'builder_post_author_meta' => 'yes',
151 'builder_post_breadcrumb' => 'yes',
152 'builder_post_category' => 'yes',
153 'builder_post_comment_count'=> 'yes',
154 'builder_post_comments' => 'yes',
155 'builder_post_content' => 'yes',
156 'builder_post_date_meta' => 'yes',
157 'builder_post_excerpt' => 'yes',
158 'builder_post_featured_image'=> 'yes',
159 'builder_post_reading_time' => 'yes',
160 'builder_post_social_share' => 'yes',
161 'builder_post_tag' => 'yes',
162 'builder_post_title' => 'yes',
163 'builder_post_view_count' => 'yes',
164 'save_version' => rand(1, 1000)
165 );
166 $addon_data = ultimate_post()->get_setting();
167 foreach ($set_settings as $key => $value) {
168 if (!isset($addon_data[$key])) {
169 ultimate_post()->set_setting($key, $value);
170 }
171 }
172
173
174 // License Check And Active
175 if (defined('ULTP_PRO_VER')) {
176 $license = get_option( 'edd_ultp_license_key' );
177 $response = wp_remote_post(
178 'https://www.wpxpo.com',
179 array(
180 'timeout' => 15,
181 'sslverify' => false,
182 'body' => array(
183 'edd_action' => 'activate_license',
184 'license' => $license,
185 'item_id' => 181,
186 'url' => home_url()
187 )
188 )
189 );
190 if (!is_wp_error( $response ) && 200 == wp_remote_retrieve_response_code( $response ) ) {
191 $license_data = json_decode( wp_remote_retrieve_body( $response ) );
192 update_option( 'edd_ultp_license_status', $license_data->license );
193 }
194 }
195 }
196 }
197 }
198 }
199 }