PluginProbe
Post Grid Gutenberg Blocks – PostX / 2.6.3
Post Grid Gutenberg Blocks – PostX v2.6.3
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 / Initialization.php

Initialization.php in Post Grid Gutenberg Blocks – PostX 2.6.3, at classes/Initialization.php

630 lines 23.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Initialization Action.
4 *
5 * @package ULTP\Notice
6 * @since v.1.1.0
7 */
8 namespace ULTP;
9
10 defined('ABSPATH') || exit;
11
12 /**
13 * Initialization class.
14 */
15 class ULTP_Initialization{
16
17 private $all_blocks;
18
19 /**
20 * Setup class.
21 *
22 * @since v.1.1.0
23 */
24 public function __construct(){
25 $this->compatibility_check();
26 $this->requires(); // Include Necessary Files
27 $this->blocks(); // Include Blocks
28 $this->include_addons(); // Include Addons
29
30 add_action('wp', array($this, 'popular_posts_tracker_callback'));
31 add_filter('block_categories_all', array($this, 'register_category_callback'), 10, 2); // Block Category Register
32 add_action('after_setup_theme', array($this, 'add_image_size'));
33
34 add_action('enqueue_block_editor_assets', array($this, 'register_scripts_back_callback')); // Only editor
35 add_action('admin_enqueue_scripts', array($this, 'register_scripts_option_panel_callback')); // Option Panel
36 add_action('wp_enqueue_scripts', array($this, 'register_scripts_front_callback')); // Both frontend
37 register_activation_hook(ULTP_PATH.'ultimate-post.php', array($this, 'install_hook'));
38 add_action( 'activated_plugin', array($this, 'activation_redirect'));
39
40 add_action('wp_ajax_ultp_next_prev', array($this, 'ultp_next_prev_callback')); // Next Previous AJAX Call
41 add_action('wp_ajax_nopriv_ultp_next_prev', array($this, 'ultp_next_prev_callback')); // Next Previous AJAX Call Logout User
42 add_action('wp_ajax_ultp_filter', array($this, 'ultp_filter_callback')); // Next Previous AJAX Call
43 add_action('wp_ajax_nopriv_ultp_filter', array($this, 'ultp_filter_callback')); // Next Previous AJAX Call Logout User
44 add_action('wp_ajax_ultp_pagination', array($this, 'ultp_pagination_callback')); // Page Number AJAX Call
45 add_action('wp_ajax_nopriv_ultp_pagination',array($this, 'ultp_pagination_callback')); // Page Number AJAX Call Logout User
46 add_action('wp_ajax_ultp_addon', array($this, 'ultp_addon_callback')); // Next Previous AJAX Call
47
48 add_action('admin_init', array($this, 'check_theme_compatibility'));
49 add_action( 'after_switch_theme', array($this, 'wpxpo_swithch_thememe'));
50
51 add_action( 'wp_ajax_plugin_settings', array( $this, 'save_plugin_settings_data' ) );
52
53 add_filter( 'allowed_block_types_all', array($this, 'wpcc_allowed_block_types'));
54 }
55
56
57 public function wpcc_allowed_block_types() {
58 $block_types = array_keys(\WP_Block_Type_Registry::get_instance()->get_all_registered());
59 $arr = array();
60 $preset = array('post_grid_1','post_grid_2','post_grid_3','post_grid_4','post_grid_5','post_grid_6','post_grid_7','post_list_1','post_list_2','post_list_3','post_list_4','post_module_1','post_module_2','post_slider_1','heading','image','taxonomy','wrapper','news_ticker','archive_title');
61 foreach ($preset as $val) {
62 if ('' == ultimate_post()->get_setting($val)) {
63 $arr[] = 'ultimate-post/'.str_replace('_', '-', $val);
64 }
65 }
66 $block_types = array_diff($block_types, $arr);
67 return array_values($block_types);
68 }
69
70
71 /**
72 * Theme Switch Callback
73 *
74 * @since v.1.1.0
75 * @return NULL
76 */
77 public function wpxpo_swithch_thememe () {
78 $this->check_theme_compatibility();
79 }
80
81
82 /**
83 * Theme Compatibility Action
84 *
85 * @since v.1.1.0
86 * @return NULL
87 */
88 public function check_theme_compatibility() {
89 $licence = apply_filters( 'ultp_theme_integration' , FALSE);
90 $theme = get_transient( 'ulpt_theme_enable' );
91
92 if( $licence ) {
93 if( $theme != 'integration' ) {
94 $themes = wp_get_theme();
95 $api_params = array(
96 'wpxpo_theme_action' => 'theme_license',
97 'slug' => $themes->get('TextDomain'),
98 'author' => $themes->get('Author'),
99 'item_id' => 181,
100 'url' => home_url()
101 );
102
103 $response = wp_remote_post( 'https://www.wpxpo.com', array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
104
105 if ( !is_wp_error( $response ) || 200 === wp_remote_retrieve_response_code( $response ) ) {
106 $license_data = json_decode( wp_remote_retrieve_body( $response ) );
107 if(isset($license_data->license)) {
108 if ( $license_data->license == 'valid' ) {
109 set_transient( 'ulpt_theme_enable', 'integration', 2592000 ); // 30 days time
110 }
111 }
112 }
113 }
114 } else {
115 if ( $theme == 'integration' ) {
116 delete_transient('ulpt_theme_enable');
117 }
118 }
119 }
120
121
122 /**
123 * Check Compatibility
124 *
125 * @since v.1.0.0
126 * @return NULL
127 */
128 public function compatibility_check(){
129 require_once ULTP_PATH.'classes/Compatibility.php';
130 new \ULTP\Compatibility();
131 }
132
133
134 /**
135 * Option Panel CSS and JS Scripts
136 *
137 * @since v.1.0.0
138 * @return NULL
139 */
140 public function register_scripts_option_panel_callback(){
141 wp_enqueue_style('wp-color-picker');
142 wp_enqueue_script('wp-color-picker');
143 wp_enqueue_script('ultp-option-script', ULTP_URL.'assets/js/ultp-option.js', array('jquery'), ULTP_VER, true);
144 wp_enqueue_style('ultp-option-style', ULTP_URL.'assets/css/ultp-option.css', array(), ULTP_VER);
145 wp_localize_script('ultp-option-script', 'ultp_option_panel', array(
146 'security' => wp_create_nonce('ultp-nonce'),
147 'ajax' => admin_url('admin-ajax.php')
148 ));
149 }
150
151
152 /**
153 * Common Frontend and Backend CSS and JS Scripts
154 *
155 * @since v.1.0.0
156 * @return NULL
157 */
158 public function register_scripts_common(){
159 wp_enqueue_style('ultp-style', ULTP_URL.'assets/css/style.min.css', array(), ULTP_VER );
160 wp_enqueue_script('ultp-script', ULTP_URL.'assets/js/ultp.min.js', array('jquery'), ULTP_VER, true);
161 wp_localize_script('ultp-script', 'ultp_data_frontend', array(
162 'url' => ULTP_URL,
163 'ajax' => admin_url('admin-ajax.php'),
164 'security' => wp_create_nonce('ultp-nonce')
165 ));
166
167 }
168
169
170 /**
171 * Only Frontend CSS and JS Scripts
172 *
173 * @since v.1.0.0
174 * @return NULL
175 */
176 public function register_scripts_front_callback() {
177 $call_common = false;
178 if (isset($_GET['preview_id']) && isset($_GET['preview_nonce'])) {
179 $call_common = true;
180 $this->register_scripts_common();
181 } else if ('yes' == get_post_meta(ultimate_post()->get_ID(), '_ultp_active', true)) {
182 $call_common = true;
183 $this->register_scripts_common();
184 } else if (ultimate_post()->is_builder()) {
185 $call_common = true;
186 $this->register_scripts_common();
187 } else if (apply_filters ('postx_common_script', false)) {
188 $call_common = true;
189 $this->register_scripts_common();
190 }
191
192 // For WidgetWidget
193 $has_block = false;
194 $widget_blocks = array();
195 global $wp_registered_sidebars, $sidebars_widgets;
196 foreach ($wp_registered_sidebars as $key => $value) {
197 if (is_active_sidebar($key)) {
198 foreach ($sidebars_widgets[$key] as $val) {
199 if (strpos($val, 'block-') !== false) {
200 if (empty($widget_blocks)) {
201 $widget_blocks = get_option( 'widget_block' );
202 }
203 foreach ( (array) $widget_blocks as $block ) {
204 if ( isset( $block['content'] ) && strpos($block['content'], 'wp:ultimate-post') !== false ) {
205 $has_block = true;
206 break;
207 }
208 }
209 if ($has_block) {
210 break;
211 }
212 }
213 }
214 }
215 }
216 if ($has_block) {
217 if (!$call_common) {
218 $this->register_scripts_common();
219 }
220 $css = get_option('ultp-widget', true);
221 if ($css) {
222 wp_register_style('ultp-post-widget', false );
223 wp_enqueue_style('ultp-post-widget' );
224 wp_add_inline_style('ultp-post-widget', $css);
225 }
226 }
227 }
228
229
230 /**
231 * Only Backend CSS and JS Scripts
232 *
233 * @since v.1.0.0
234 * @return NULL
235 */
236 public function register_scripts_back_callback() {
237 $this->register_scripts_common();
238 global $pagenow;
239 $depends = 'wp-editor';
240 if ( $pagenow === 'widgets.php' ) {
241 $depends = 'wp-edit-widgets';
242 }
243 wp_enqueue_script('ultp-blocks-editor-script', ULTP_URL.'assets/js/editor.blocks.min.js', array('wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', $depends ), ULTP_VER, true);
244 wp_enqueue_style('ultp-blocks-editor-css', ULTP_URL.'assets/css/blocks.editor.css', array(), ULTP_VER);
245 if(is_rtl()){
246 wp_enqueue_style('ultp-blocks-editor-rtl-css', ULTP_URL.'assets/css/rtl.css', array(), ULTP_VER);
247 }
248 $is_active = ultimate_post()->is_lc_active();
249 wp_localize_script('ultp-blocks-editor-script', 'ultp_data', array(
250 'url' => ULTP_URL,
251 'ajax' => admin_url('admin-ajax.php'),
252 'security' => wp_create_nonce('ultp-nonce'),
253 'hide_import_btn' => ultimate_post()->get_setting('hide_import_btn'),
254 'upload' => wp_upload_dir()['basedir'] . '/ultp',
255 'premium_link' => ultimate_post()->get_premium_link(),
256 'license' => $is_active ? get_option('edd_ultp_license_key') : '',
257 'active' => $is_active,
258 'archive' => $is_active ? ultimate_post()->is_archive_builder() : '',
259 'settings' => ultimate_post()->get_setting(),
260 'post_type' => get_post_type()
261 ));
262
263 wp_set_script_translations( 'ultp-blocks-editor-script', 'ultimate-post', ULTP_PATH . 'languages/' );
264 }
265
266
267 /**
268 * Fire When Plugin First Install
269 *
270 * @since v.1.0.0
271 * @return NULL
272 */
273 public function install_hook() {
274 if (!get_option('ultp_options')) {
275 ultimate_post()->init_set_data();
276 }
277 }
278
279
280 /**
281 * Redirect After Active Plugin
282 *
283 * @since v.1.0.0
284 * @param STRING | Plugin Path
285 * @return NULL
286 */
287 public function activation_redirect($plugin) {
288 if( $plugin == 'ultimate-post/ultimate-post.php' ) {
289 exit(wp_redirect(admin_url('admin.php?page=ultp-settings')));
290 }
291 }
292
293
294 /**
295 * Require Blocks
296 *
297 * @since v.1.0.0
298 * @return NULL
299 */
300 public function blocks() {
301 global $unique_ID;
302 $setting = ultimate_post()->get_setting();
303 require_once ULTP_PATH.'blocks/Post_List_1.php';
304 require_once ULTP_PATH.'blocks/Post_List_2.php';
305 require_once ULTP_PATH.'blocks/Post_List_3.php';
306 require_once ULTP_PATH.'blocks/Post_List_4.php';
307 require_once ULTP_PATH.'blocks/Post_Grid_1.php';
308 require_once ULTP_PATH.'blocks/Post_Grid_2.php';
309 require_once ULTP_PATH.'blocks/Post_Grid_3.php';
310 require_once ULTP_PATH.'blocks/Post_Grid_4.php';
311 require_once ULTP_PATH.'blocks/Post_Grid_5.php';
312 require_once ULTP_PATH.'blocks/Post_Grid_6.php';
313 require_once ULTP_PATH.'blocks/Post_Grid_7.php';
314 require_once ULTP_PATH.'blocks/Post_Slider_1.php';
315 require_once ULTP_PATH.'blocks/Post_Module_1.php';
316 require_once ULTP_PATH.'blocks/Post_Module_2.php';
317 require_once ULTP_PATH.'blocks/Heading.php';
318 require_once ULTP_PATH.'blocks/Image.php';
319 require_once ULTP_PATH.'blocks/Taxonomy.php';
320 require_once ULTP_PATH.'blocks/News_Ticker.php';
321 require_once ULTP_PATH.'blocks/Archive_Title.php';
322 $this->all_blocks['ultimate-post_post-list-1'] = new \ULTP\blocks\Post_List_1();
323 $this->all_blocks['ultimate-post_post-list-2'] = new \ULTP\blocks\Post_List_2();
324 $this->all_blocks['ultimate-post_post-list-3'] = new \ULTP\blocks\Post_List_3();
325 $this->all_blocks['ultimate-post_post-list-4'] = new \ULTP\blocks\Post_List_4();
326 $this->all_blocks['ultimate-post_post-grid-1'] = new \ULTP\blocks\Post_Grid_1();
327 $this->all_blocks['ultimate-post_post-grid-2'] = new \ULTP\blocks\Post_Grid_2();
328 $this->all_blocks['ultimate-post_post-grid-3'] = new \ULTP\blocks\Post_Grid_3();
329 $this->all_blocks['ultimate-post_post-grid-4'] = new \ULTP\blocks\Post_Grid_4();
330 $this->all_blocks['ultimate-post_post-grid-5'] = new \ULTP\blocks\Post_Grid_5();
331 $this->all_blocks['ultimate-post_post-grid-6'] = new \ULTP\blocks\Post_Grid_6();
332 $this->all_blocks['ultimate-post_post-grid-7'] = new \ULTP\blocks\Post_Grid_7();
333 $this->all_blocks['ultimate-post_post-slider-1'] = new \ULTP\blocks\Post_Slider_1();
334 $this->all_blocks['ultimate-post_post-module-1'] = new \ULTP\blocks\Post_Module_1();
335 $this->all_blocks['ultimate-post_post-module-2'] = new \ULTP\blocks\Post_Module_2();
336 $this->all_blocks['ultimate-post_heading'] = new \ULTP\blocks\Heading();
337 $this->all_blocks['ultimate-post_image'] = new \ULTP\blocks\Image();
338 $this->all_blocks['ultimate-post_ultp-taxonomy'] = new \ULTP\blocks\Taxonomy();
339 $this->all_blocks['ultimate-post_news-ticker'] = new \ULTP\blocks\News_Ticker();
340 $this->all_blocks['ultimate-post_archive-title'] = new \ULTP\blocks\Archive_Title();
341 }
342
343
344 /**
345 * Necessary Requires Class
346 *
347 * @since v.1.0.0
348 * @return NULL
349 */
350 public function requires() {
351 require_once ULTP_PATH.'classes/Notice.php';
352 require_once ULTP_PATH.'classes/Styles.php';
353 require_once ULTP_PATH.'classes/Options.php';
354 require_once ULTP_PATH.'classes/REST_API.php';
355 require_once ULTP_PATH.'classes/Caches.php';
356 new \ULTP\REST_API();
357 new \ULTP\Caches();
358 new \ULTP\Options();
359 new \ULTP\Styles();
360 new \ULTP\Notice();
361
362 require_once ULTP_PATH.'classes/Deactive.php';
363 new \ULTP\Deactive();
364 }
365
366
367 /**
368 * Block Categories Initialization
369 *
370 * @since v.1.0.0
371 * @param $categories(ARRAY) | $post (ARRAY)
372 * @return NULL
373 */
374 public function register_category_callback( $categories, $post ) {
375 return array_merge(
376 array(
377 array(
378 'slug' => 'ultimate-post',
379 'title' => __( 'PostX - Gutenberg Post Blocks', 'ultimate-post' )
380 )
381 ), $categories
382 );
383 }
384
385
386 /**
387 * Post View Counter for Every Post
388 *
389 * @since v.1.0.0
390 * @param NUMBER | Post ID
391 * @return NULL
392 */
393 public function popular_posts_tracker_callback($post_id) {
394 if (!is_single()){ return; }
395 global $post;
396 $post_id = $post->ID;
397 $isEnable = apply_filters('ultp_view_cookies', true);
398 // add_filter( 'ultp_view_cookies', '__return_false' );
399 $cookies_disable = ultimate_post()->get_setting('disable_view_cookies');
400 if ($post_id && $isEnable && $cookies_disable != 'yes') {
401 $has_cookie = isset( $_COOKIE['ultp_view_'.$post_id] ) ? $_COOKIE['ultp_view_'.$post_id] : false;
402 if (!$has_cookie) {
403 $count = (int)get_post_meta( $post_id, '__post_views_count', true );
404 update_post_meta($post_id, '__post_views_count', $count ? (int)$count + 1 : 1 );
405 setcookie( 'ultp_view_'.$post_id, 1, time() + 86400, COOKIEPATH ); // 1 days cookies
406 }
407 }
408 }
409
410
411 /**
412 * Set Image Size
413 *
414 * @since v.1.0.0
415 * @return NULL
416 */
417 public function add_image_size() {
418 $size_disable = ultimate_post()->get_setting('disable_image_size');
419 if ($size_disable != 'yes') {
420 add_image_size('ultp_layout_landscape_large', 1200, 800, true);
421 add_image_size('ultp_layout_landscape', 870, 570, true);
422 add_image_size('ultp_layout_portrait', 600, 900, true);
423 add_image_size('ultp_layout_square', 600, 600, true);
424 }
425 }
426
427
428 /**
429 * Include Addons Directory
430 *
431 * @since v.1.0.0
432 * @return NULL
433 */
434 public function include_addons() {
435 $addons_dir = array_filter(glob(ULTP_PATH.'addons/*'), 'is_dir');
436 if (count($addons_dir) > 0) {
437 foreach( $addons_dir as $key => $value ) {
438 $addon_dir_name = str_replace(dirname($value).'/', '', $value);
439 $file_name = ULTP_PATH . 'addons/'.$addon_dir_name.'/init.php';
440 if ( file_exists($file_name) ) {
441 include_once $file_name;
442 }
443 }
444 }
445 }
446
447
448 /**
449 * Addon Callback
450 *
451 * @since v.1.0.0
452 * @return STRING
453 */
454 public function ultp_addon_callback() {
455 if (!wp_verify_nonce(wp_unslash($_REQUEST['wpnonce']), 'ultp-nonce') && $local){
456 return ;
457 }
458 $addon_name = sanitize_text_field($_POST['addon']);
459 $addon_value = sanitize_text_field($_POST['value']);
460 if ($addon_name && current_user_can('administrator')) {
461 $addon_data = ultimate_post()->get_setting();
462 $addon_data[$addon_name] = $addon_value;
463 $GLOBALS['ultp_settings'][$addon_name] = $addon_value;
464 update_option('ultp_options', $addon_data);
465 }
466 }
467
468
469 /**
470 * Next Preview Callback of the Blocks
471 *
472 * @since v.1.0.0
473 * @return STRING
474 */
475 public function ultp_next_prev_callback() {
476 if (!wp_verify_nonce(wp_unslash($_REQUEST['wpnonce']), 'ultp-nonce') && $local){
477 return ;
478 }
479
480 $paged = sanitize_text_field($_POST['paged']);
481 $blockId = sanitize_text_field($_POST['blockId']);
482 $postId = sanitize_text_field($_POST['postId']);
483 $blockRaw = sanitize_text_field($_POST['blockName']);
484 $builder = isset($_POST['builder']) ? sanitize_text_field($_POST['builder']) : '';
485
486 $blockName = str_replace('_','/', $blockRaw);
487
488 if( $paged && $blockId && $postId && $blockName ) {
489 $post = get_post($postId);
490 if (has_blocks($post->post_content)) {
491 $blocks = parse_blocks($post->post_content);
492 $this->block_return($blocks, $paged, $blockId, $blockRaw, $blockName, $builder, $postId);
493 }
494 }
495 }
496
497
498 /**
499 * Filter Callback of the Blocks
500 *
501 * @since v.1.0.0
502 * @return STRING
503 */
504 public function filter_block_return($blocks, $blockId, $blockRaw, $blockName, $taxtype, $taxonomy) {
505 foreach ($blocks as $key => $value) {
506 if($blockName == $value['blockName']) {
507 if($value['attrs']['blockId'] == $blockId) {
508 $attr = $this->all_blocks[$blockRaw]->get_attributes(true);
509 if($taxonomy) {
510 $value['attrs']['queryTaxValue'] = json_encode(array($taxonomy));
511 $value['attrs']['queryTax'] = $taxtype;
512 }
513 if(isset($value['attrs']['queryNumber'])){
514 $value['attrs']['queryNumber'] = $value['attrs']['queryNumber'];
515 }
516 $attr = array_merge($attr, $value['attrs']);
517 echo $this->all_blocks[$blockRaw]->content($attr, true);
518 die();
519 }
520 }
521 if(!empty($value['innerBlocks'])){
522 $this->filter_block_return($value['innerBlocks'], $blockId, $blockRaw, $blockName, $taxtype, $taxonomy);
523 }
524 }
525 }
526
527
528 /**
529 * Filter Callback of the Blocks
530 *
531 * @since v.1.0.0
532 * @return STRING
533 */
534 public function ultp_filter_callback() {
535 if (!wp_verify_nonce(wp_unslash($_REQUEST['wpnonce']), 'ultp-nonce') && $local){
536 return ;
537 }
538
539 $taxtype = sanitize_text_field($_POST['taxtype']);
540 if( $taxtype ) {
541 $blockId = sanitize_text_field($_POST['blockId']);
542 $postId = sanitize_text_field($_POST['postId']);
543 $taxonomy = sanitize_text_field($_POST['taxonomy']);
544 $blockRaw = sanitize_text_field($_POST['blockName']);
545 $blockName = str_replace('_','/', $blockRaw);
546 $post = get_post($postId);
547 if (has_blocks($post->post_content)) {
548 $blocks = parse_blocks($post->post_content);
549 $this->filter_block_return($blocks, $blockId, $blockRaw, $blockName, $taxtype, $taxonomy);
550 }
551 }
552 }
553
554
555 /**
556 * Pagination of the Blocks
557 *
558 * @since v.1.0.0
559 * @return STRING
560 */
561 public function ultp_pagination_callback() {
562 if (!wp_verify_nonce(wp_unslash($_REQUEST['wpnonce']), 'ultp-nonce') && $local) {
563 return ;
564 }
565
566 $paged = sanitize_text_field($_POST['paged']);
567 if($paged) {
568 $blockId = sanitize_text_field($_POST['blockId']);
569 $postId = sanitize_text_field($_POST['postId']);
570 $blockRaw = sanitize_text_field($_POST['blockName']);
571 $builder = isset($_POST['builder']) ? sanitize_text_field($_POST['builder']) : '';
572 $blockName = str_replace('_','/', $blockRaw);
573 $post = get_post($postId);
574 if (has_blocks($post->post_content)) {
575 $blocks = parse_blocks($post->post_content);
576 $this->block_return($blocks, $paged, $blockId, $blockRaw, $blockName, $builder, $postId);
577 }
578 }
579 }
580
581
582 /**
583 * Blocks Content Start
584 *
585 * @since v.1.0.0
586 * @return STRING
587 */
588 public function block_return($blocks, $paged, $blockId, $blockRaw, $blockName, $builder, $postId) {
589 foreach ($blocks as $key => $value) {
590 if($blockName == $value['blockName']) {
591 if($value['attrs']['blockId'] == $blockId) {
592 $attr = $this->all_blocks[$blockRaw]->get_attributes(true);
593 $value['attrs']['paged'] = $paged;
594 if ($builder) {
595 $value['attrs']['builder'] = $builder;
596 }
597 if ($postId) {
598 $attr['current_post'] = $postId;
599 }
600 $attr = array_merge($attr, $value['attrs']);
601 echo $this->all_blocks[$blockRaw]->content($attr, true);
602 die();
603 }
604 }
605 if(!empty($value['innerBlocks'])){
606 $this->block_return($value['innerBlocks'], $paged, $blockId, $blockRaw, $blockName, $builder, $postId);
607 }
608 }
609 }
610
611 /**
612 * Save Settings of Option Panel
613 *
614 * @since v.2.6.0
615 * @return NULL
616 */
617 public function save_plugin_settings_data() {
618 if (!wp_verify_nonce(wp_unslash($_REQUEST['wpnonce']), 'ultp-nonce') && $local){
619 return ;
620 }
621 $data = ultimate_post()->recursive_sanitize_text_field($_POST['data']);
622 if (count($data) > 0) {
623 foreach ($data as $key => $val) {
624 ultimate_post()->set_setting($key, $val);
625 }
626 }
627 wp_send_json_success(__('Settings Data Saved...', 'ultimate-post'));
628 }
629
630 }