PluginProbe
Post Grid Gutenberg Blocks – PostX / 2.2.5
Post Grid Gutenberg Blocks – PostX v2.2.5
5.0.41 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 All 238 releases
← All changes | classes/Initialization.php +61 -28 2.1.12.2.5 View file →
@@ -2,9 +2,9 @@
2 2 namespace ULTP;
3 3
4 4 defined('ABSPATH') || exit;
5 5
6 -class Initialization{
6 +class ULTP_Initialization{
7 7
8 8 private $all_blocks;
9 9
10 10 public function __construct(){
@@ -29,10 +29,50 @@
29 29 add_action('wp_ajax_nopriv_ultp_filter', array($this, 'ultp_filter_callback')); // Next Previous AJAX Call Logout User
30 30 add_action('wp_ajax_ultp_pagination', array($this, 'ultp_pagination_callback')); // Page Number AJAX Call
31 31 add_action('wp_ajax_nopriv_ultp_pagination',array($this, 'ultp_pagination_callback')); // Page Number AJAX Call Logout User
32 32 add_action('wp_ajax_ultp_addon', array($this, 'ultp_addon_callback')); // Next Previous AJAX Call
33 +
34 + add_action('admin_init', array($this, 'check_theme_compatibility') );
35 + add_action( 'after_switch_theme', array( $this, 'wpxpo_swithch_thememe' ) );
33 36 }
34 37
38 + public function wpxpo_swithch_thememe () {
39 + $this->check_theme_compatibility();
40 + }
41 +
42 + public function check_theme_compatibility() {
43 + $licence = apply_filters( 'ultp_theme_integration' , FALSE);
44 + $theme = get_transient( 'ulpt_theme_enable' );
45 +
46 + if( $licence ) {
47 + if( $theme != 'integration' ) {
48 + $themes = wp_get_theme();
49 + $api_params = array(
50 + 'wpxpo_theme_action' => 'theme_license',
51 + 'slug' => $themes->get('TextDomain'),
52 + 'author' => $themes->get('Author'),
53 + 'item_id' => 181,
54 + 'url' => home_url()
55 + );
56 +
57 + $response = wp_remote_post( 'https://www.wpxpo.com', array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
58 +
59 + if ( !is_wp_error( $response ) || 200 === wp_remote_retrieve_response_code( $response ) ) {
60 + $license_data = json_decode( wp_remote_retrieve_body( $response ) );
61 + if(isset($license_data->license)) {
62 + if ( $license_data->license == 'valid' ) {
63 + set_transient( 'ulpt_theme_enable', 'integration', 2592000 ); // 30 days time
64 + }
65 + }
66 + }
67 + }
68 + } else {
69 + if ( $theme == 'integration' ) {
70 + delete_transient('ulpt_theme_enable');
71 + }
72 + }
73 + }
74 +
35 75 public function compatibility_check(){
36 76 require_once ULTP_PATH.'classes/Compatibility.php';
37 77 new \ULTP\Compatibility();
38 78 }
@@ -41,9 +81,9 @@
41 81 wp_enqueue_style('wp-color-picker');
42 82 wp_enqueue_script('wp-color-picker');
43 83 wp_enqueue_script('ultp-option-script', ULTP_URL.'assets/js/ultp-option.js', array('jquery'), ULTP_VER, true);
44 84 wp_enqueue_style('ultp-option-style', ULTP_URL.'assets/css/ultp-option.css', array(), ULTP_VER);
45 - wp_localize_script('ultp-option-script', 'ultp_option', array(
85 + wp_localize_script('ultp-option-script', 'ultp_option_panel', array(
46 86 'width' => ultimate_post()->get_setting('editor_container'),
47 87 'security' => wp_create_nonce('ultp-nonce'),
48 88 'ajax' => admin_url('admin-ajax.php')
49 89 ));
@@ -49,17 +89,11 @@
49 89 ));
50 90 }
51 91
52 92 public function register_scripts_common(){
53 - wp_enqueue_style('dashicons');
54 - wp_enqueue_style('ultp-slick-style', ULTP_URL.'assets/css/slick.css', array(), ULTP_VER);
55 - wp_enqueue_style('ultp-slick-theme-style', ULTP_URL.'assets/css/slick-theme.css', array(), ULTP_VER);
56 - wp_enqueue_style('ultp-style', ULTP_URL.'assets/css/blocks.style.css', array(), ULTP_VER );
57 - if(is_rtl()){ wp_enqueue_style('ultp-blocks-rtl-css', ULTP_URL.'assets/css/rtl.css', array(), ULTP_VER); }
58 - wp_enqueue_script('ultp-flexmenu-script', ULTP_URL.'assets/js/flexmenu.js', array('jquery'), ULTP_VER, true);
59 - wp_enqueue_script('ultp-slick-script', ULTP_URL.'assets/js/slick.min.js', array('jquery'), ULTP_VER, true);
60 - wp_enqueue_script('ultp-script', ULTP_URL.'assets/js/ultp.js', array('jquery','ultp-flexmenu-script'), ULTP_VER, true);
61 - wp_localize_script('ultp-script', 'ultp_data', array(
93 + wp_enqueue_style('ultp-style', ULTP_URL.'assets/css/style.min.css', array(), ULTP_VER );
94 + wp_enqueue_script('ultp-script', ULTP_URL.'assets/js/ultp.min.js', array('jquery'), ULTP_VER, true);
95 + wp_localize_script('ultp-script', 'ultp_data_frontend', array(
62 96 'url' => ULTP_URL,
63 97 'ajax' => admin_url('admin-ajax.php'),
64 98 'security' => wp_create_nonce('ultp-nonce')
65 99 ));
@@ -80,16 +114,11 @@
80 114 if(is_rtl()){
81 115 wp_enqueue_style('ultp-blocks-editor-rtl-css', ULTP_URL.'assets/css/rtl.css', array(), ULTP_VER);
82 116 }
83 117
84 - $import = '';
85 - $options = ultimate_post()->get_setting();
118 + $import = ultimate_post()->get_setting('hide_import_btn');
86 119
87 - if (isset($options['hide_import_btn'])) {
88 - if ($options['hide_import_btn']=='yes') {
89 - $import = 'yes';
90 - }
91 - }
120 + $is_active = get_option('edd_ultp_license_status') == 'valid' ? true : ( get_transient( 'ulpt_theme_enable' ) == 'integration' ? true : false );
92 121
93 122 wp_localize_script('ultp-blocks-editor-script', 'ultp_data', array(
94 123 'url' => ULTP_URL,
95 124 'ajax' => admin_url('admin-ajax.php'),
@@ -95,9 +124,11 @@
95 124 'ajax' => admin_url('admin-ajax.php'),
96 125 'security' => wp_create_nonce('ultp-nonce'),
97 126 'hide_import_btn' => $import,
98 127 'upload' => wp_upload_dir()['basedir'] . '/ultp',
99 - 'license' => get_option('edd_ultp_license_key')
128 + 'premium_link' => ultimate_post()->get_premium_link(),
129 + 'license' => get_option('edd_ultp_license_key'),
130 + 'active' => $is_active,
100 131 ));
101 132 }
102 133
103 134 // Fire When Plugin First Install
@@ -159,8 +190,11 @@
159 190 new \ULTP\Caches();
160 191 new \ULTP\Options();
161 192 new \ULTP\Styles();
162 193 new \ULTP\Notice();
194 +
195 + require_once ULTP_PATH.'classes/Deactive.php';
196 + new \ULTP\Deactive();
163 197 }
164 198
165 199 // Block Categories
166 200 public function register_category_callback( $categories, $post ) {
@@ -184,12 +218,15 @@
184 218 }
185 219
186 220 // Set Image Size
187 221 public function add_image_size() {
188 - add_image_size('ultp_layout_landscape_large', 1200, 800, true);
189 - add_image_size('ultp_layout_landscape', 870, 570, true);
190 - add_image_size('ultp_layout_portrait', 600, 900, true);
191 - add_image_size('ultp_layout_square', 600, 600, true);
222 + $size_disable = ultimate_post()->get_setting('disable_image_size');
223 + if ($size_disable != 'yes') {
224 + add_image_size('ultp_layout_landscape_large', 1200, 800, true);
225 + add_image_size('ultp_layout_landscape', 870, 570, true);
226 + add_image_size('ultp_layout_portrait', 600, 900, true);
227 + add_image_size('ultp_layout_square', 600, 600, true);
228 + }
192 229 }
193 230
194 231 // Include Addons directory
195 232 public function include_addons() {
@@ -245,13 +282,9 @@
245 282 if($blockName == $value['blockName']) {
246 283 if($value['attrs']['blockId'] == $blockId) {
247 284 $attr = $this->all_blocks[$blockRaw]->get_attributes(true);
248 285 if($taxonomy) {
249 - if($taxtype == 'category'){
250 - $value['attrs']['queryCat'] = json_encode(array($taxonomy));
251 - }elseif($taxtype == 'post_tag'){
252 - $value['attrs']['queryTag'] = json_encode(array($taxonomy));
253 - }
286 + $value['attrs']['queryTaxValue'] = json_encode(array($taxonomy));
254 287 $value['attrs']['queryTax'] = $taxtype;
255 288 }
256 289 if(isset($value['attrs']['queryNumber'])){
257 290 $value['attrs']['queryNumber'] = $value['attrs']['queryNumber'];