PluginProbe
Post Grid Gutenberg Blocks – PostX / 5.1.1
Post Grid Gutenberg Blocks – PostX v5.1.1
5.1.1 5.1.0 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 All 240 releases
ultimate-post / classes / Initialization.php

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

628 lines 20.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Initialization Action.
5 *
6 * @package ULTP\ULTP_Initialization
7 * @since v.1.1.0
8 */
9
10 namespace ULTP;
11
12 defined( 'ABSPATH' ) || exit;
13
14 use ULTP\Includes\Durbin\Xpo;
15 use ULTP\Includes\Notice\Notice;
16
17 /**
18 * Initialization class.
19 *
20 * Handles plugin initialization for Ultimate Post.
21 *
22 * @package ULTP\Initialization
23 * @since 4.0.0
24 */
25 class ULTP_Initialization {
26
27 /**
28 * Setup class.
29 *
30 * @since 4.0.0
31 * @return void No return value.
32 */
33 public function __construct() {
34
35 $this->compatibility_check();
36 $this->requires();
37 $this->include_addons();
38
39 add_filter( 'admin_body_class', array( $this, 'add_admin_body_class' ) ); // add body class in editor.
40 add_filter( 'body_class', array( $this, 'add_body_class' ) ); // add body class in front end.
41
42 add_action( 'wp', array( $this, 'popular_posts_tracker_callback' ) );
43 add_action( 'after_setup_theme', array( $this, 'add_image_size' ) );
44 add_filter( 'block_categories_all', array( $this, 'register_category_callback' ), 999999999, 2 ); // Block Category Register.
45
46 add_filter( 'safe_style_css', array( $this, 'ultp_handle_safe_style_css' ) ); // support for css used in svg icon.
47 add_filter( 'wp_kses_allowed_html', array( $this, 'ultp_handle_allowed_html' ), 99, 2 ); // support for svg icon used in list, row, icon block.
48
49 add_action( 'enqueue_block_editor_assets', array( $this, 'register_block_scripts_editor_area' ) ); // Only editor.
50 add_action( 'admin_enqueue_scripts', array( $this, 'register_option_panel_scripts_callback' ) ); // Option Panel.
51 register_activation_hook( ULTP_PATH . 'ultimate-post.php', array( $this, 'plugin_activation_hook' ) );
52 add_action( 'activated_plugin', array( $this, 'ultp_plugin_activation' ) ); // Plugin Activation Call.
53 // new Notice();
54 }
55
56 /**
57 * Check plugin compatibility.
58 *
59 * @since v.1.0.0
60 * @return void
61 */
62 public function compatibility_check() {
63 require_once ULTP_PATH . 'classes/Compatibility.php';
64 new \ULTP\Compatibility();
65 }
66
67 /**
68 * Load all required classes.
69 *
70 * @since v.1.0.0
71 * @return void No return value.
72 */
73 public function requires() {
74 require_once ULTP_PATH . 'classes/Styles.php';
75 require_once ULTP_PATH . 'classes/Options.php';
76 require_once ULTP_PATH . 'classes/REST_API.php';
77 require_once ULTP_PATH . 'classes/Caches.php';
78 require_once ULTP_PATH . 'classes/Importer.php';
79 require_once ULTP_PATH . 'classes/Dashboard.php';
80 require_once ULTP_PATH . 'classes/Blocks.php';
81 new \ULTP\REST_API();
82 new \ULTP\Options();
83 new \ULTP\Caches();
84 new \ULTP\Styles();
85 new \ULTP\Importer();
86 new \ULTP\Dashboard();
87 new \ULTP\Blocks();
88
89 require_once ULTP_PATH . 'includes/durbin/class-durbin-client.php';
90 require_once ULTP_PATH . 'includes/durbin/class-xpo.php';
91 require_once ULTP_PATH . 'includes/deactive/class-deactive.php';
92 require_once ULTP_PATH . 'includes/notice/class-notice.php';
93 require_once ULTP_PATH . 'includes/durbin/class-our-plugins.php';
94 new \ULTP\Includes\Deactive\Deactive();
95 new \ULTP\Includes\notice\Notice();
96 new \ULTP\Includes\Durbin\OurPlugins();
97 }
98
99 /**
100 * Include all addons from the addons directory.
101 *
102 * @since v.1.0.0
103 * @return void
104 */
105 public function include_addons() {
106 $addons_dir = array_filter( glob( ULTP_PATH . 'addons/*' ), 'is_dir' );
107 if ( count( $addons_dir ) > 0 ) {
108 foreach ( $addons_dir as $key => $value ) {
109 $addon_dir_name = str_replace( dirname( $value ) . '/', '', $value );
110 $file_name = ULTP_PATH . 'addons/' . $addon_dir_name . '/init.php';
111 if ( file_exists( $file_name ) ) {
112 include_once $file_name;
113 }
114 }
115 }
116 }
117
118
119 /**
120 * Add admin body class in editor.
121 *
122 * @since v.3.1.6
123 * @param STRING $classes The existing admin body classes.
124 * @return STRING Modified admin body classes.
125 */
126 public function add_admin_body_class( $classes ) {
127 $classes .= ' postx-admin-page ';
128 return $classes;
129 }
130
131 /**
132 * Add body class in front end.
133 *
134 * @since v.3.1.6
135 * @param ARRAY $classes The existing body classes.
136 * @return ARRAY Modified body classes.
137 */
138 public function add_body_class( $classes ) {
139 $classes[] = 'postx-page';
140 return $classes;
141 }
142
143 /**
144 * Post view counter for every post.
145 *
146 * @since v.1.0.0
147 * @param INT $post_id The post ID.
148 * @return NULL No return value.
149 */
150 public function popular_posts_tracker_callback( $post_id ) {
151 if ( ! is_single() ) {
152 return;
153 }
154 global $post;
155 $post_id = isset( $post->ID ) ? $post->ID : '';
156 $isEnable = apply_filters( 'ultp_view_cookies', true );
157 // add_filter( 'ultp_view_cookies', '__return_false' );
158 $cookies_disable = ultimate_post()->get_setting( 'disable_view_cookies' );
159 if ( $post_id && $isEnable && $cookies_disable != 'yes' ) {
160 $has_cookie = isset( $_COOKIE[ 'ultp_view_' . $post_id ] ) ? sanitize_text_field( wp_unslash( $_COOKIE[ 'ultp_view_' . $post_id ] ) ) : false;
161 if ( ! $has_cookie ) {
162 $count = (int) get_post_meta( $post_id, '__post_views_count', true );
163 update_post_meta( $post_id, '__post_views_count', $count ? (int) $count + 1 : 1 );
164 setcookie( 'ultp_view_' . $post_id, 1, time() + 86400, COOKIEPATH ); // 1 days cookies
165 }
166 }
167 }
168
169 /**
170 * Set image sizes for the plugin.
171 *
172 * @since v.1.0.0
173 * @return void No return value.
174 */
175 public function add_image_size() {
176 $size_disable = ultimate_post()->get_setting( 'disable_image_size' );
177 if ( $size_disable != 'yes' ) {
178 add_image_size( 'ultp_layout_landscape_large', 1200, 800, true );
179 add_image_size( 'ultp_layout_landscape', 870, 570, true );
180 add_image_size( 'ultp_layout_portrait', 600, 900, true );
181 add_image_size( 'ultp_layout_square', 600, 600, true );
182 }
183 }
184
185 /**
186 * Block categories initialization.
187 *
188 * @since v.1.0.0
189 * @param ARRAY $categories The block categories.
190 * @param ARRAY $post The post object.
191 * @return ARRAY Modified block categories.
192 */
193 public function register_category_callback( $categories, $post ) {
194 $attr = array(
195 array(
196 'slug' => 'ultimate-post',
197 'title' => __( 'PostX - Gutenberg Post Blocks', 'ultimate-post' ),
198 ),
199 array(
200 'slug' => 'postx-site-builder',
201 'title' => __( 'PostX Site Builder', 'ultimate-post' ),
202 ),
203 );
204 return array_merge( $attr, $categories );
205 }
206
207 /**
208 * Add support for CSS to use SVG.
209 *
210 * @since 4.0.0
211 * @param ARRAY $styles The allowed CSS styles.
212 * @return ARRAY Modified allowed CSS styles.
213 */
214 public function ultp_handle_safe_style_css( $styles ) {
215 if ( ! is_multisite() && ! current_user_can( 'edit_posts' ) ) {
216 return $styles;
217 }
218 return array_merge(
219 $styles,
220 array(
221 'opacity',
222 // for SVG gradients.
223 // 'stop-opacity',
224 // 'stop-color',
225 )
226 );
227 }
228
229 /**
230 * Add support for HTML tags to use SVG.
231 *
232 * @since 4.0.0
233 * @param ARRAY $tags The allowed HTML tags.
234 * @param STRING $context The context for allowed HTML.
235 * @return ARRAY Modified allowed HTML tags.
236 */
237 public function ultp_handle_allowed_html( $tags, $context ) {
238 if ( 'post' !== $context && ! is_multisite() && ! current_user_can( 'edit_posts' ) ) {
239 return $tags;
240 }
241 if ( ! isset( $tags['svg'] ) ) {
242 $tags['svg'] = array_merge(
243 array(
244 'xmlns' => true,
245 // 'xmlns:xlink' => true,
246 // 'xlink:href' => true,
247 // 'xml:id' => true,
248 // 'xlink:title' => true,
249 // 'xml:space' => true,
250 'viewbox' => true,
251 'enable-background' => true,
252 'version' => true,
253 'preserveaspectratio' => true,
254 'fill' => true,
255 )
256 );
257 }
258 if ( ! isset( $tags['path'] ) || ! is_array( $tags['path'] ) ) {
259 $tags['path'] = array();
260 }
261
262 $tags['path'] = array_merge(
263 $tags['path'],
264 array(
265 'd' => true,
266 'stroke' => true,
267 'stroke-miterlimit' => true,
268 'data-original' => true,
269 'class' => true,
270 'transform' => true,
271 'style' => true,
272 'opacity' => true,
273 'fill' => true,
274 'stroke-width' => true,
275 'stroke-linecap' => true,
276 'stroke-linejoin' => true,
277 )
278 );
279
280 if ( ! isset( $tags['g'] ) ) {
281 $tags['g'] = array(
282 'transform' => true,
283 'clip-path' => true,
284 );
285 }
286 if ( ! isset( $tags['clippath'] ) ) {
287 $tags['clippath'] = array();
288 }
289 if ( ! isset( $tags['defs'] ) ) {
290 $tags['defs'] = array();
291 }
292 if ( ! isset( $tags['rect'] ) ) {
293 $tags['rect'] = array(
294 'rx' => true,
295 'height' => true,
296 'width' => true,
297 'transform' => true,
298 'x' => true,
299 'fill' => true,
300 );
301 }
302 if ( ! isset( $tags['circle'] ) ) {
303 $tags['circle'] = array(
304 'cx' => true,
305 'cy' => true,
306 'transform' => true,
307 'r' => true,
308 );
309 }
310 if ( ! isset( $tags['polygon'] ) ) {
311 $tags['polygon'] = array(
312 'points' => true,
313 );
314 }
315 if ( ! isset( $tags['lineargradient'] ) ) {
316 $tags['lineargradient'] = array(
317 'gradienttransform' => true,
318 'id' => true,
319 );
320 }
321 if ( ! isset( $tags['stop'] ) ) {
322 $tags['stop'] = array(
323 'offset' => true,
324 'stop-color' => true,
325 'style' => true,
326 'stop-opacity' => true,
327 );
328 }
329 return $tags;
330 }
331
332 /**
333 * Plugin activation callback.
334 *
335 * @since v.1.1.0
336 * @param STRING $plugin The plugin file path.
337 * @return NULL No return value.
338 */
339 public function ultp_plugin_activation( $plugin ) {
340 if ( wp_doing_ajax() ) {
341 return;
342 }
343 if ( $plugin == 'ultimate-post/ultimate-post.php' ) {
344 if ( wp_doing_ajax() || is_network_admin() || isset( $_GET['activate-multi'] ) || isset( $_POST['action'] ) && 'activate-selected' == $_POST['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.NonceVerification.Missing -- Read-only check for bulk/multi activation.
345 return;
346 }
347 if ( ultimate_post()->get_setting( 'init_setup' ) != 'yes' ) {
348 ultimate_post()->set_setting( 'init_setup', 'yes' );
349 exit(wp_safe_redirect(admin_url('admin.php?page=ultp-setup-wizard'))); //phpcs:ignore
350 } else {
351 exit(wp_safe_redirect(admin_url('admin.php?page=ultp-settings#home'))); //phpcs:ignore
352 }
353 }
354 }
355
356 /**
357 * Enqueue option panel CSS and JS scripts.
358 *
359 * @since v.1.0.0
360 * @return void No return value.
361 */
362 public function register_option_panel_scripts_callback() {
363 $is_active = ultimate_post()->is_lc_active();
364 $is_expired = Xpo::is_lc_expired();
365
366 $license_key = Xpo::get_lc_key();
367 $_page = isset($_GET['page']) ? sanitize_text_field($_GET['page']) : ''; // @codingStandardsIgnoreLine
368 $post_type = get_post_type();
369 $is_woocommerce_active = class_exists( 'WooCommerce' ) ? true : false;
370
371 wp_enqueue_style( 'wp-color-picker' );
372 wp_enqueue_script( 'wp-color-picker' );
373
374 wp_enqueue_script( 'ultp-option-script', ULTP_URL . 'assets/js/ultp-option.js', array( 'jquery' ), ULTP_VER, true );
375 wp_enqueue_style( 'ultp-option-style', ULTP_URL . 'assets/css/ultp-option.css', array(), ULTP_VER );
376 wp_localize_script(
377 'ultp-option-script',
378 'ultp_option_panel',
379 array(
380 'url' => ULTP_URL,
381 'version' => ULTP_VER,
382 'active' => $is_active,
383 'expierd' => $is_expired,
384 'security' => wp_create_nonce( 'ultp-admin-nonce' ),
385 'ajax' => admin_url( 'admin-ajax.php' ),
386 'settings' => ultimate_post()->get_client_settings(),
387 'post_type' => $post_type,
388 'saved_template_url' => admin_url( 'admin.php?page=ultp-settings#saved-templates' ),
389 'woocommerce' => $is_woocommerce_active,
390 )
391 );
392
393 if ( $post_type == 'ultp_custom_font' ) {
394 $font_settings = ultimate_post()->get_setting( 'ultp_custom_font' );
395 if ( $font_settings == 'true' ) {
396 // Pass the font post so uploads send its ID; Custom_Font allows SVG only for that post.
397 wp_enqueue_media( array( 'post' => get_the_ID() ) );
398 }
399 }
400
401 /* === Installation Wizard === */
402 if ( $_page == 'ultp-setup-wizard' ) {
403 wp_enqueue_script( 'ultp-initial-setup-script', ULTP_URL . 'assets/js/ultp_initial_setup_min.js', array( 'wp-i18n', 'wp-api-fetch', 'wp-api-request' ), ULTP_VER, true );
404 wp_set_script_translations( 'ultp-initial-setup-script', 'ultimate-post', ULTP_PATH . 'languages/' );
405 }
406
407 /* === Builder And Setting Pannel === */
408 if ( get_post_type( get_the_ID() ) == 'ultp_builder' ) {
409 wp_enqueue_script( 'ultp-conditions-script', ULTP_URL . 'addons/builder/assets/js/conditions.js', array( 'wp-i18n', 'wp-api-fetch', 'wp-components', 'wp-i18n', 'wp-blocks' ), ULTP_VER, true );
410 wp_localize_script(
411 'ultp-conditions-script',
412 'ultp_condition',
413 array(
414 'url' => ULTP_URL,
415 'active' => $is_active,
416 'builder_url' => admin_url( 'admin.php?page=ultp-settings#builder' ),
417 )
418 );
419 wp_set_script_translations( 'ultp-conditions-script', 'ultimate-post', ULTP_PATH . 'languages/' );
420 }
421
422 /* === Dashboard === */
423 if ( $_page == 'ultp-settings' ) {
424 wp_enqueue_script( 'ultp-dashboard-script', ULTP_URL . 'assets/js/ultp_dashboard_min.js', array( 'wp-i18n', 'wp-api-fetch', 'wp-api-request', 'wp-components', 'wp-blocks' ), ULTP_VER, true );
425 $user_info = get_userdata( get_current_user_id() );
426 wp_localize_script(
427 'ultp-dashboard-script',
428 'ultp_dashboard_pannel',
429 array_merge(
430 array(
431 'ajax' => admin_url( 'admin-ajax.php' ),
432 'security' => wp_create_nonce( 'ultp-admin-nonce' ),
433 'url' => ULTP_URL,
434 'active' => $is_active,
435 'expierd' => $is_expired,
436 'license' => $license_key,
437 // The settings form needs the saved OpenAI key; the menu capability is filterable, so check.
438 'settings' => current_user_can( 'manage_options' ) ? ultimate_post()->get_setting() : ultimate_post()->get_client_settings(),
439 'addons_settings' => apply_filters( 'ultp_settings', array() ),
440 'builder_url' => admin_url( 'admin.php?page=ultp-settings#builder' ),
441 'version' => ULTP_VER,
442 'setup_wizard_link' => admin_url( 'admin.php?page=ultp-setup-wizard' ),
443 'is_free' => ! $is_active,
444 'user_email' => wp_get_current_user()->user_email,
445 'home_url' => home_url(),
446 'generalDiscount' => get_transient( 'ultp_generalDiscount' ),
447 'helloBar' => Notice::get_hellobar_config(),
448 'userInfo' => array(
449 'name' => $user_info->first_name ? $user_info->first_name . ( $user_info->last_name ? ' ' . $user_info->last_name : '' ) : $user_info->user_login,
450 'email' => $user_info->user_email,
451 ),
452 ),
453 Xpo::get_wow_products_details()
454 )
455 );
456 wp_set_script_translations( 'ultp-dashboard-script', 'ultimate-post', ULTP_PATH . 'languages/' );
457 }
458 }
459
460 /**
461 * Enqueue backend CSS and JS scripts for the block editor.
462 *
463 * @since v.1.0.0
464 * @return void No return value.
465 */
466 public function register_block_scripts_editor_area() {
467 ultimate_post()->register_scripts_common();
468 $is_expired = Xpo::is_lc_expired();
469 global $pagenow;
470 $depends = 'wp-editor';
471 if ( $pagenow === 'widgets.php' ) {
472 $depends = 'wp-edit-widgets';
473 }
474 wp_enqueue_script( 'ultp-blocks-editor-script', ULTP_URL . 'assets/js/editor.blocks.js', array( 'wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', $depends ), ULTP_VER, true );
475 wp_enqueue_style( 'ultp-blocks-editor-css', ULTP_URL . 'assets/css/blocks.editor.css', array(), ULTP_VER );
476 if ( is_rtl() ) {
477 wp_enqueue_style( 'ultp-blocks-editor-rtl-css', ULTP_URL . 'assets/css/rtl.css', array(), ULTP_VER );
478 }
479 $is_active = ultimate_post()->is_lc_active();
480 $post_type = get_post_type();
481
482 // Custom Font Support Added
483 $font_settings = ultimate_post()->get_setting( 'ultp_custom_font' );
484 $custom_fonts = array();
485 if ( $font_settings == 'true' ) {
486 $args = array(
487 'post_type' => 'ultp_custom_font',
488 'post_status' => 'publish',
489 'numberposts' => -1,
490 'order' => 'ASC',
491 );
492 $posts = get_posts( $args );
493 if ( $posts ) {
494 foreach ( $posts as $post ) {
495 setup_postdata( $post );
496 $font = get_post_meta( $post->ID, '__font_settings', true );
497
498 if ( $font ) {
499 array_push(
500 $custom_fonts,
501 array(
502 'title' => $post->post_title,
503 'font' => $font,
504 )
505 );
506 }
507 }
508 wp_reset_postdata();
509 }
510 }
511
512 wp_localize_script(
513 'ultp-blocks-editor-script',
514 'ultp_data',
515 array(
516 'url' => ULTP_URL,
517 'ajax' => admin_url( 'admin-ajax.php' ),
518 'security' => wp_create_nonce( 'ultp-admin-nonce' ),
519 'hide_import_btn' => ultimate_post()->get_setting( 'hide_import_btn' ),
520 'premium_link' => Xpo::generate_utm_link(),
521 'license' => $is_active ? Xpo::get_lc_key() : '',
522 'active' => $is_active,
523 'archive' => ultimate_post()->is_archive_builder(),
524 'settings' => ultimate_post()->get_client_settings(),
525 'post_type' => $post_type == 'premade' ? 'ultp_builder' : $post_type, // premade used for ultp.wpxpo.com
526 'date_format' => get_option( 'date_format' ),
527 'time_format' => get_option( 'time_format' ),
528 'blog' => get_current_blog_id(),
529 'affiliate_id' => apply_filters( 'ultp_affiliate_id', false ),
530 'category_url' => admin_url( 'edit-tags.php?taxonomy=category' ),
531 'disable_image_size' => ultimate_post()->get_setting( 'disable_image_size' ),
532 'dark_logo' => get_option( 'ultp_site_dark_logo' ) ? get_option( 'ultp_site_dark_logo' ) : false,
533 'builder_url' => admin_url( 'admin.php?page=ultp-settings#builder' ),
534 'custom_fonts' => $custom_fonts,
535 'expierd' => $is_expired,
536 )
537 );
538 wp_set_script_translations( 'ultp-blocks-editor-script', 'ultimate-post', ULTP_PATH . 'languages/' );
539 }
540
541
542 /**
543 * Fire when plugin is first installed.
544 *
545 * @since v.1.0.0
546 * @return void No return value.
547 */
548 public function plugin_activation_hook() {
549 $data = get_option( 'ultp_options', array() );
550 $currentDate = new \DateTime();
551 $currentDate->setTime( 0, 0, 0, 0 );
552 $init_data = array(
553 'preloader_style' => 'style1',
554 'preloader_color' => '#037fff',
555 'container_width' => '1140',
556 'hide_import_btn' => '',
557 'disable_image_size' => '',
558 'disable_view_cookies' => '',
559 'disable_google_font' => '',
560 'ultp_templates' => 'true',
561 'ultp_elementor' => 'true',
562 'ultp_table_of_content' => 'true',
563 'ultp_builder' => 'true',
564 'ultp_dynamic_content' => 'true',
565 'ultp_custom_font' => 'true',
566 'ultp_chatgpt' => 'true',
567 'post_grid_1' => 'yes',
568 'post_grid_2' => 'yes',
569 'post_grid_3' => 'yes',
570 'post_grid_4' => 'yes',
571 'post_grid_5' => 'yes',
572 'post_grid_6' => 'yes',
573 'post_grid_7' => 'yes',
574 'post_list_1' => 'yes',
575 'post_list_2' => 'yes',
576 'post_list_3' => 'yes',
577 'post_list_4' => 'yes',
578 'post_module_1' => 'yes',
579 'post_module_2' => 'yes',
580 'post_slider_1' => 'yes',
581 'post_slider_2' => 'yes',
582 'heading' => 'yes',
583 'image' => 'yes',
584 'taxonomy' => 'yes',
585 'wrapper' => 'yes',
586 'news_ticker' => 'yes',
587 'accordion' => 'yes',
588 'star_rating' => 'yes',
589 'youtube_gallery' => 'yes',
590 'builder_advance_post_meta' => 'yes',
591 'builder_archive_title' => 'yes',
592 'builder_author_box' => 'yes',
593 'builder_post_next_previous' => 'yes',
594 'builder_post_author_meta' => 'yes',
595 'builder_post_breadcrumb' => 'yes',
596 'builder_post_category' => 'yes',
597 'builder_post_comment_count' => 'yes',
598 'builder_post_comments' => 'yes',
599 'builder_post_content' => 'yes',
600 'builder_post_date_meta' => 'yes',
601 'builder_post_excerpt' => 'yes',
602 'builder_post_featured_image' => 'yes',
603 'builder_post_reading_time' => 'yes',
604 'builder_post_social_share' => 'yes',
605 'builder_post_tag' => 'yes',
606 'builder_post_title' => 'yes',
607 'builder_post_view_count' => 'yes',
608 'save_version' => wp_rand( 1, 1000 ),
609 'activated_date' => $currentDate->getTimestamp(),
610 );
611 if ( empty( $data ) ) {
612 update_option( 'ultp_options', $init_data );
613 $GLOBALS['ultp_settings'] = $init_data;
614 } else {
615 foreach ( $init_data as $key => $single ) {
616 if ( ! isset( $data[ $key ] ) ) {
617 $data[ $key ] = $single;
618 }
619 }
620 update_option( 'ultp_options', $data );
621 $GLOBALS['ultp_settings'] = $data;
622 }
623 if ( ! get_transient( 'wpxpo_installation_date' ) ) {
624 set_transient( 'wpxpo_installation_date', 'yes', 5 * DAY_IN_SECONDS ); // 5 Days Notice
625 }
626 }
627 }
628