PluginProbe
Jupiter X Core / trunk
Jupiter X Core vtrunk
4.60.0 4.50.0 trunk 1.10.0 1.10.1 1.11.0 1.12.0 1.15.0 1.16.0 1.16.2 1.6.1 1.7.0 1.8.0 1.9.0 2.0.9 2.1.0 2.5.0 4 4.10.1 4.11.0 4.14.2 4.15.0 4.6.5 4.6.6 4.6.9 All 36 releases
jupiterx-core / jupiterx-core.php

jupiterx-core.php in Jupiter X Core trunk, at jupiterx-core.php

971 lines 20.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Plugin Name: Jupiter X Core
5 * Plugin URI: https://jupiterx.com
6 * Description: Adds core functionality to the Jupiter X theme.
7 * Version: 4.60.0
8 * Author: Artbees
9 * Author URI: https://artbees.net
10 * Text Domain: jupiterx-core
11 * License: GPL2
12 *
13 * @package JupiterX_Core
14 */
15
16 use Elementor\Plugin;
17
18 defined('ABSPATH') || die();
19
20 /**
21 * Jupiter Core class.
22 *
23 * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
24 * @SuppressWarnings(PHPMD.TooManyMethods)
25 */
26 if (! class_exists('JupiterX_Core')) {
27
28 /**
29 * Jupiter Core class.
30 *
31 * @since 1.0.0
32 */
33 class JupiterX_Core
34 {
35
36 /**
37 * Jupiter Core instance.
38 *
39 * @since 1.0.0
40 *
41 * @access private
42 * @var JupiterX_Core
43 */
44 private static $instance;
45
46 /**
47 * The plugin version number.
48 *
49 * @since 1.0.0
50 *
51 * @access private
52 * @var string
53 */
54 private static $version;
55
56 /**
57 * The plugin basename.
58 *
59 * @since 1.0.0
60 *
61 * @access private
62 * @var string
63 */
64 private static $plugin_basename;
65
66 /**
67 * The plugin name.
68 *
69 * @since 1.0.0
70 *
71 * @access private
72 * @var string
73 */
74 private static $plugin_name;
75
76 /**
77 * The plugin directory.
78 *
79 * @since 1.0.0
80 *
81 * @access private
82 * @var string
83 */
84 private static $plugin_dir;
85
86 /**
87 * The plugin URL.
88 *
89 * @since 1.0.0
90 *
91 * @access private
92 * @var string
93 */
94 private static $plugin_url;
95
96 /**
97 * The plugin assets URL.
98 *
99 * @since 1.2.0
100 * @access public
101 *
102 * @var string
103 */
104 public static $plugin_assets_url;
105
106 /**
107 * Returns JupiterX_Core instance.
108 *
109 * @since 1.0.0
110 *
111 * @return JupiterX_Core
112 */
113 public static function get_instance()
114 {
115 if (is_null(self::$instance)) {
116 self::$instance = new self();
117 }
118 return self::$instance;
119 }
120
121 /**
122 * Constructor.
123 *
124 * @since 1.0.0
125 */
126 public function __construct()
127 {
128 $this->define_constants();
129 $this->load();
130 $this->activation_hook();
131 }
132
133 /**
134 * Defines constants used by the plugin.
135 *
136 * @since 1.0.0
137 */
138 protected function define_constants()
139 {
140 $plugin_data = get_file_data(__FILE__, array('Plugin Name', 'Version'), 'jupiterx-core');
141
142 self::$plugin_basename = plugin_basename(__FILE__);
143 self::$plugin_name = array_shift($plugin_data);
144 self::$version = array_shift($plugin_data);
145 self::$plugin_dir = trailingslashit(plugin_dir_path(__FILE__));
146 self::$plugin_url = trailingslashit(plugin_dir_url(__FILE__));
147 self::$plugin_assets_url = trailingslashit(self::$plugin_url . 'assets');
148 }
149
150 /**
151 * Loads the plugin.
152 *
153 * @since 1.0.0
154 * @access protected
155 */
156 protected function load()
157 {
158 $this->load_files([
159 'utilities/general',
160 'utilities/options',
161 'admin/class-auto-updates',
162 'extensions/class',
163 'admin/class-notices',
164 'svg-sanitizer/functions',
165 'admin/license/class-api-license',
166 'admin/license/class-event-license',
167 ]);
168
169 add_action('jupiterx_init', [$this, 'init'], 4);
170 }
171
172 /**
173 * Activation hook.
174 *
175 * @since 4.10.1
176 */
177 protected function activation_hook()
178 {
179 register_activation_hook(__FILE__, [$this, 'licensing_schedules']);
180
181 add_action('admin_init', [$this, 'check_event_transient']);
182
183 register_deactivation_hook(__FILE__, [$this, 'clear_licensing_schedules']);
184 }
185
186 /**
187 * Ensures the license cron exists once on the correct blog (main site when network-active).
188 *
189 * @since 4.10.1
190 */
191 public function check_event_transient()
192 {
193 if ($this->license_checks_should_use_main_site_cron() && ! $this->is_current_blog_main_site()) {
194 if (wp_next_scheduled('jupiterx_license_checks')) {
195 wp_clear_scheduled_hook('jupiterx_license_checks');
196 }
197
198 return;
199 }
200
201 $this->ensure_license_check_cron_scheduled();
202 }
203
204 /**
205 * Initializes the plugin.
206 *
207 * @since 1.0.0
208 * @SuppressWarnings(PHPMD.NPathComplexity)
209 */
210 public function init()
211 {
212 add_action('admin_bar_menu', [$this, 'extend_admin_bar_menu'], 100);
213 add_action('init', [$this, 'redirect_page']);
214 add_action('admin_head', [$this, 'inline_css']);
215 add_action('admin_print_footer_scripts', [$this, 'inline_js']);
216
217 // Hubspot affiliate code for jupiterx.
218 add_filter('leadin_impact_code', [$this, 'jupiterx_get_hubspot_affiliate_code']);
219
220 if (version_compare(JUPITERX_VERSION, '1.2.0', '>')) {
221 $this->load_files([
222 'compiler/functions',
223 'compiler/class-compiler',
224 ]);
225 }
226
227 if (version_compare(JUPITERX_VERSION, '1.4.1', '>')) {
228 $this->load_files([
229 'google-tag/functions',
230 ]);
231 }
232
233 if (version_compare(JUPITERX_VERSION, '1.6.0', '>=')) {
234 $this->load_files([
235 'widgets/class',
236 'widgets/functions',
237 'admin/options',
238 ]);
239 }
240
241 $this->check_theme_version();
242
243 // Load files.
244 $this->load_files([
245 'parse-css/functions',
246 'post-type/class',
247 'post-type/custom-snippets',
248 'post-type/custom-fonts',
249 'fonts',
250 'post-type/custom-icons',
251 'icons',
252 'custom-fields/title-bar',
253 'updater/functions',
254 'widget-area/functions',
255 'templates/class',
256 'woocommerce/woocommerce-load-more',
257 'woocommerce/functions',
258 'woocommerce/product-gallery-video',
259 'utilities/load',
260 'condition/class-condition-manager',
261 ]);
262
263 if (! $this->check_default_settings()) {
264 $this->load_files([
265 'customizer/functions',
266 ]);
267 }
268
269 if (class_exists('Elementor\Plugin')) {
270 $this->load_files([
271 'popups/class',
272 'popups/class-conditions-manager',
273 'popups/class-triggers-manager',
274 'control-panel-2/includes/class-elementor-library-preview-canvas',
275 ]);
276 }
277
278 if (is_admin()) {
279 if (! defined('JUPITERX_OLD_CONTROL_PANEL')) {
280 $this->load_files([
281 'admin/site-health/site-health',
282 'admin/tgmpa/tgmpa-plugin-list',
283 'control-panel-2/class',
284 ]);
285 }
286
287 if (! class_exists('JupiterX_Update_Plugins')) {
288 $this->load_files([
289 'admin/update-plugins/class-update-plugins',
290 ]);
291 }
292
293 $this->load_files([
294 'admin/attachment-media/class',
295 ]);
296 }
297
298 $this->disable_admin_bar();
299
300 // Enable Grid Container and Editor Top Bar by default.
301 if (class_exists('Elementor\Plugin') && get_option('jupiterx_fresh_install', false)) {
302 update_option('elementor_experiment-container_grid', 'active');
303 update_option('elementor_experiment-editor_v2', 'active');
304 }
305
306 /**
307 * Fires after all files have been loaded.
308 *
309 * @since 1.0.0
310 *
311 * @param JupiterX_Core
312 */
313 do_action('jupiterx_core_init', $this);
314 }
315
316 /**
317 * Add useful pages to admin toolbar.
318 *
319 * @since 1.16.0
320 *
321 * @param array $admin_bar The WordPress admin toolbar array.
322 *
323 * @return void
324 */
325 public function extend_admin_bar_menu($admin_bar)
326 {
327 $this->maintenance_mode_admin_bar_alert($admin_bar);
328 }
329
330 /**
331 * Add maintenance admin-bar Alert.
332 *
333 * @since 1.20.0
334 *
335 * @param array $admin_bar The WordPress admin toolbar array.
336 *
337 * @return void
338 */
339 private function maintenance_mode_admin_bar_alert($admin_bar)
340 {
341 $maintenance_mode = get_theme_mod('jupiterx_maintenance', false);
342
343 if (! $maintenance_mode) {
344 return;
345 }
346
347 $maintenance_template = get_theme_mod('jupiterx_maintenance_template');
348
349 $admin_bar->add_node([
350 'id' => 'jupiterx-maintenance-mode-on',
351 'title' => __('Maintenance Mode On', 'jupiterx-core'),
352 ]);
353
354 if (! class_exists('Elementor\Plugin')) {
355 return;
356 }
357
358 $document = Plugin::$instance->documents->get($maintenance_template);
359
360 $admin_bar->add_node([
361 'id' => 'jupiterx-maintanance-mode-edit',
362 'parent' => 'jupiterx-maintenance-mode-on',
363 'title' => __('Edit Template', 'jupiterx-core'),
364 'href' => $document ? $document->get_edit_url() : '',
365 ]);
366 }
367
368 /**
369 * Inline styles for admin pages.
370 *
371 * @since 1.1.0
372 *
373 * @return void
374 *
375 * @todo Move to common admin CSS file.
376 */
377 public function inline_css()
378 {
379 ob_start();
380 ?>
381 <style type="text/css">
382 ul#adminmenu a[href*='admin.php?page=jupiterx_upgrade'],
383 ul#adminmenu a.jupiterx_upgrade_submenu_link {
384 color: #e24a95;
385 }
386
387 ul#adminmenu a[href*='admin.php?page=jupiterx_upgrade'] i.jupiterx-icon-pro,
388 ul#adminmenu a.jupiterx_upgrade_submenu_link i.jupiterx-icon-pro {
389 position: relative;
390 top: 2px;
391 display: inline-block;
392 width: 15px;
393 height: 15px;
394 margin-right: 5px;
395 font-size: 15px;
396 }
397
398 ul#adminmenu a[href*='admin.php?page=jupiterx_upgrade'] i.jupiterx-icon-pro:before,
399 ul#adminmenu a.jupiterx_upgrade_submenu_link i.jupiterx-icon-pro:before {
400 font-weight: bold;
401 }
402
403 .dashicons-jx-dashboard {
404 background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' width='20px' height='30px' viewBox='0 0 500 500' style='enable-background:new 0 0 500 500;' xml:space='preserve'%3e%3cstyle type='text/css'%3e .st0%7bfill:%239CA1A8;%7d %3c/style%3e%3cpath class='st0' d='M485,3.6H362.5L249.7,163.3l61.2,86.7l-61.2,86.7l-61.2-86.7L14.4,496.3h122.5l112.8-159.7l112.8,159.7H485 L310.9,249.9L485,3.6z M136.9,3.6H14.4l174.1,246.4l61.2-86.7L136.9,3.6z'/%3e%3c/svg%3e ");
405 background-repeat: no-repeat;
406 background-position: center;
407 background-size: 20px auto;
408 }
409
410 .wp-admin.post-type-jupiterx-popups #wpbody-content .wrap a.page-title-action,
411 .wp-admin.post-type-jupiterx-popups #wpbody-content .wrap .wp-heading-inline {
412 visibility: hidden !important;
413 }
414 </style>
415 <?php
416 echo ob_get_clean(); // phpcs:ignore
417 }
418
419 /**
420 * Add hubspot affiliate code for Jupiterx.
421 *
422 * @since 3.2.0
423 * @return string
424 */
425 public function jupiterx_get_hubspot_affiliate_code()
426 {
427 return '9WvmE0';
428 }
429
430 /**
431 * Inline scripts for admin pages.
432 *
433 * @since 1.1.0
434 *
435 * @return void
436 *
437 * @todo Move to common admin JS file.
438 */
439 public function inline_js()
440 {
441 ob_start();
442 ?>
443 <script type="text/javascript">
444 jQuery(document).ready(function($) {
445 $("ul#adminmenu a[href*='admin.php?page=jupiterx_help']").attr('target', '_blank');
446 $("ul#adminmenu a[href*='admin.php?page=jupiterx_upgrade']")
447 .addClass('jupiterx_upgrade_submenu_link')
448 .attr('target', '_blank')
449 .attr('href', 'https://themeforest.net/item/jupiter-multipurpose-responsive-theme/5177775?ref=artbees&utm_source=AdminSideBarUpgradeLink&utm_medium=AdminUpgradePopup&utm_campaign=FreeJupiterXAdminUpgradeCampaign');
450 });
451 </script>
452 <?php
453 echo ob_get_clean(); // phpcs:ignore
454 }
455
456 /**
457 * Returns the version number of the plugin.
458 *
459 * @since 1.0.0
460 *
461 * @return string
462 */
463 public function version()
464 {
465 return self::$version;
466 }
467
468 /**
469 * Returns the plugin basename.
470 *
471 * @since 1.0.0
472 *
473 * @return string
474 */
475 public function plugin_basename()
476 {
477 return self::$plugin_basename;
478 }
479
480 /**
481 * Returns the plugin name.
482 *
483 * @since 1.0.0
484 *
485 * @return string
486 */
487 public function plugin_name()
488 {
489 return self::$plugin_name;
490 }
491
492 /**
493 * Returns the plugin directory.
494 *
495 * @since 1.0.0
496 *
497 * @return string
498 */
499 public function plugin_dir()
500 {
501 return self::$plugin_dir;
502 }
503
504 /**
505 * Returns the plugin URL.
506 *
507 * @since 1.0.0
508 *
509 * @return string
510 */
511 public function plugin_url()
512 {
513 return self::$plugin_url;
514 }
515
516 /**
517 * Returns the plugin assets URL.
518 *
519 * @since 1.18.0
520 *
521 * @return string
522 */
523 public function plugin_assets_url()
524 {
525 return self::$plugin_assets_url;
526 }
527
528 /**
529 * Loads all PHP files in a given directory.
530 *
531 * @since 1.0.0
532 *
533 * @param string $directory_name The directory name to load the files.
534 */
535 public function load_directory($directory_name)
536 {
537 $path = trailingslashit($this->plugin_dir() . 'includes/' . $directory_name);
538 $file_names = glob($path . '*.php');
539 foreach ($file_names as $filename) {
540 if (file_exists($filename)) {
541 require_once $filename;
542 }
543 }
544 }
545
546 /**
547 * Loads specified PHP files from the plugin includes directory.
548 *
549 * @since 1.0.0
550 *
551 * @param array $file_names The names of the files to be loaded in the includes directory.
552 */
553 public function load_files($file_names = array())
554 {
555 foreach ($file_names as $file_name) {
556 $path = $this->plugin_dir() . 'includes/' . $file_name . '.php';
557
558 if (file_exists($path)) {
559 require_once $path;
560 }
561 }
562 }
563
564 /**
565 * Redirect an admin page.
566 *
567 * @since 1.0.0
568 */
569 public function redirect_page()
570 {
571 // phpcs:disable
572 if (! isset($_GET['page'])) {
573 return;
574 }
575
576 if ('customize_theme' === $_GET['page']) {
577 wp_redirect(admin_url('customize.php'));
578 exit;
579 }
580
581 if ('jupiterx_upgrade' === $_GET['page']) {
582 wp_redirect(admin_url());
583 exit;
584 }
585
586 if ('jupiterx_help' === $_GET['page']) {
587 wp_redirect('https://help.jupiterx.com/');
588 exit;
589 }
590 // phpcs:enable
591 }
592
593 /**
594 * Registers license schedules for various periodic checks.
595 *
596 * @since 4.10.1
597 *
598 * @return void
599 */
600 public function licensing_schedules()
601 {
602 $this->ensure_license_check_cron_scheduled();
603 }
604
605 /**
606 * Whether Jupiter X Core is active for the entire multisite network.
607 *
608 * @since 4.15.1
609 *
610 * @return bool
611 */
612 public static function is_active_for_network()
613 {
614 return is_multisite()
615 && function_exists('is_plugin_active_for_network')
616 && is_plugin_active_for_network(self::$plugin_basename);
617 }
618
619 /**
620 * License validation / cron should run on this blog only (main site when network-active).
621 *
622 * @since 4.15.1
623 *
624 * @return bool
625 */
626 public static function should_run_license_validation_on_this_blog()
627 {
628 if (! is_multisite()) {
629 return true;
630 }
631
632 if (! self::is_active_for_network()) {
633 return true;
634 }
635
636 $main_id = function_exists('get_main_site_id')
637 ? (int) get_main_site_id()
638 : 1;
639
640 return (int) get_current_blog_id() === $main_id;
641 }
642
643 /**
644 * True when license cron must be stored on the network main site (single recurring job).
645 *
646 * @since 4.15.1
647 *
648 * @return bool
649 */
650 private function license_checks_should_use_main_site_cron()
651 {
652 return self::is_active_for_network();
653 }
654
655 /**
656 * Whether the current blog is the network main site.
657 *
658 * @since 4.15.1
659 *
660 * @return bool
661 */
662 private function is_current_blog_main_site()
663 {
664 if (function_exists('is_main_site')) {
665 return is_main_site();
666 }
667
668 $main_id = function_exists('get_main_site_id')
669 ? (int) get_main_site_id()
670 : 1;
671
672 return (int) get_current_blog_id() === $main_id;
673 }
674
675 /**
676 * Count scheduled `jupiterx_license_checks` events for the current blog.
677 *
678 * @since 4.15.1
679 *
680 * @return int
681 */
682 private function count_scheduled_license_check_events()
683 {
684 $cron_array = get_option('cron', []);
685
686 if (! is_array($cron_array)) {
687 return 0;
688 }
689
690 if (empty($cron_array)) {
691 return 0;
692 }
693
694 $count = 0;
695
696 foreach ($cron_array as $events) {
697 if (! is_array($events)) {
698 continue;
699 }
700
701 if (empty($events['jupiterx_license_checks'])) {
702 continue;
703 }
704
705 $count += count($events['jupiterx_license_checks']);
706 }
707
708 return $count;
709 }
710
711 /**
712 * Guarantee at most one weekly license cron on the appropriate blog.
713 *
714 * @since 4.15.1
715 *
716 * @return void
717 */
718 private function ensure_license_check_cron_scheduled()
719 {
720 $switched = false;
721
722 if ($this->license_checks_should_use_main_site_cron()) {
723 $main_id = function_exists('get_main_site_id')
724 ? (int) get_main_site_id()
725 : 1;
726
727 if ((int) get_current_blog_id() !== $main_id) {
728 switch_to_blog($main_id);
729 $switched = true;
730 }
731 }
732
733 $count = $this->count_scheduled_license_check_events();
734
735 if ($count > 1) {
736 wp_clear_scheduled_hook('jupiterx_license_checks');
737 wp_schedule_event(time(), 'weekly', 'jupiterx_license_checks');
738 } elseif (0 === $count) {
739 wp_schedule_event(time(), 'weekly', 'jupiterx_license_checks');
740 }
741
742 if ($switched) {
743 restore_current_blog();
744 }
745 }
746
747 /**
748 * Clears future schedules after plugin deactivations.
749 *
750 * @since 4.10.1
751 *
752 * @return void
753 */
754 public function clear_licensing_schedules()
755 {
756 if (is_multisite()) {
757 $sites = get_sites();
758
759 foreach ($sites as $site) {
760 switch_to_blog($site->blog_id);
761
762 wp_clear_scheduled_hook('jupiterx_license_checks');
763 delete_transient('jupiterx_event_transient');
764
765 restore_current_blog();
766 }
767 }
768
769 wp_clear_scheduled_hook('jupiterx_license_checks');
770 delete_transient('jupiterx_event_transient');
771 }
772
773 /**
774 * Check setup wizard is enabled.
775 *
776 * @since 4.0.0
777 * @return boolean.
778 */
779 public function jupiterx_check_setup_wizard()
780 {
781 if (get_option('jupiterx_setup_wizard_skipped', false)) {
782 return false;
783 }
784
785 if (get_option('jupiterx_setup_wizard_done', false)) {
786 return false;
787 }
788
789 if (
790 ! empty(get_option('jupiterx_setup_wizard_hide', false)) &&
791 get_option('jupiterx_setup_wizard_hide', false) > time()
792 ) {
793 return true;
794 }
795
796 $fresh_install = get_option('jupiterx_fresh_install', false);
797
798 if ($fresh_install) {
799 update_option('jupiterx_setup_wizard_hide', strtotime('+14 days', time()));
800
801 return true;
802 }
803
804 return false;
805 }
806
807 /**
808 * Disable admin bar in Elementor preview.
809 *
810 * Admin bar causes spacing issues. Elementor added the same codes but it's not working correctly.
811 * When it's fixed, the codes will be removed.
812 *
813 * @since 1.0.0
814 */
815 private function disable_admin_bar()
816 {
817 if (! empty($_GET['elementor-preview'])) { // phpcs:ignore
818 add_filter('show_admin_bar', '__return_false');
819 }
820 }
821
822 /**
823 * Handle theme update modal.
824 *
825 * @since 4.0.0
826 */
827 private function check_theme_version()
828 {
829 if ('dismiss' === get_option('jupiterx_theme_update_modal', '')) {
830 return;
831 }
832
833 $version = wp_get_theme()->get('Version');
834
835 if (is_a(wp_get_theme()->parent(), '\WP_Theme')) {
836 $version = wp_get_theme()->parent()->get('Version');
837 }
838
839 if (version_compare($this->version(), $version, '<=')) {
840 update_option('jupiterx_theme_update_modal', 'dismiss');
841 return;
842 }
843
844 update_option('jupiterx_theme_update_modal', 'show');
845 }
846
847 /**
848 * Check default settings are enabled.
849 *
850 * @since 3.8.0
851 */
852 public function check_default_settings()
853 {
854 $version = wp_get_theme()->get('Version');
855
856 if (is_a(wp_get_theme()->parent(), '\WP_Theme')) {
857 $version = wp_get_theme()->parent()->get('Version');
858 }
859
860 if (version_compare($version, '3.8.0', '<')) {
861 return false;
862 }
863
864 $jx_settings = get_option('jupiterx', []);
865
866 $fresh_install = get_option('jupiterx_first_installation', false);
867
868 if (! empty($fresh_install)) {
869 if (! isset($jx_settings['disable_theme_default_settings'])) {
870 $jx_settings['disable_theme_default_settings'] = true;
871
872 update_option('jupiterx', $jx_settings);
873 }
874
875 delete_option('jupiterx_first_installation');
876 }
877
878 if (! isset($jx_settings['disable_theme_default_settings'])) {
879 return false;
880 }
881
882 $default_settings = ! empty($jx_settings['disable_theme_default_settings']) ? $jx_settings['disable_theme_default_settings'] : '';
883
884 if (empty($default_settings)) {
885 return false;
886 }
887
888 return true;
889 }
890
891 /**
892 * Disable page title bar.
893 *
894 * @since 4.4.0
895 */
896 public function disable_page_title_bar()
897 {
898 $transient_key = 'elementor_library_page_title_bar';
899
900 if (! $this->check_default_settings()) {
901 delete_transient($transient_key);
902
903 jupiterx_update_option('has_page_title_bar', true);
904 return false;
905 }
906
907 if (! jupiterx_get_option('has_page_title_bar', true)) {
908 return true;
909 }
910
911 global $wpdb;
912
913 $post_type = 'elementor_library';
914 $meta_key = '_elementor_template_type';
915 $meta_value = 'page-title-bar';
916 $cached_post = get_transient($transient_key);
917
918 if (! empty($cached_post)) {
919 jupiterx_update_option('has_page_title_bar', true);
920 return false;
921 }
922
923 $query = $wpdb->prepare(
924 "SELECT p.* FROM {$wpdb->posts} AS p
925 INNER JOIN {$wpdb->postmeta} AS pm ON p.ID = pm.post_id
926 WHERE p.post_type = %s
927 AND p.post_status = 'publish'
928 AND pm.meta_key = %s
929 AND pm.meta_value = %s
930 LIMIT 1",
931 $post_type,
932 $meta_key,
933 $meta_value
934 );
935
936 $page_title_bar = $wpdb->get_results($query); // phpcs:ignore
937
938 if (! empty($page_title_bar)) {
939 set_transient($transient_key, $page_title_bar);
940
941 jupiterx_update_option('has_page_title_bar', true);
942 return false;
943 }
944
945 delete_transient($transient_key);
946
947 jupiterx_update_option('has_page_title_bar', false);
948 return true;
949 }
950 }
951 }
952
953 /**
954 * Returns the Jupiter Core application instance.
955 *
956 * @since 1.0.0
957 *
958 * @return JupiterX_Core
959 */
960 function jupiterx_core()
961 {
962 return JupiterX_Core::get_instance();
963 }
964
965 /**
966 * Initializes the Jupiter Core application.
967 *
968 * @since 1.0.0
969 */
970 jupiterx_core();
971