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