PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 1.6.4
Kubio AI Page Builder v1.6.4
2.8.4 2.8.3 2.8.2 2.8.1 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.9.0 2.0.0 2.1.1 2.1.2 2.1.3 2.2.0 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.5 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 2.6.5 2.6.6 2.6.7 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0
kubio / lib / customizer / index.php
kubio / lib / customizer Last commit date
index.php 3 years ago
index.php
94 lines
1 <?php
2
3
4 function kubio_get_editor_url() {
5 return add_query_arg(
6 array( 'page' => 'kubio' ),
7 admin_url( 'admin.php' )
8 );
9
10 }
11
12 function kubio_set_admin_bar_menu_customize_to_kubio_editor( WP_Admin_Bar &$admin_bar ) {
13
14 if ( ! is_user_logged_in() || ! kubio_theme_has_kubio_block_support() ) {
15 return;
16 }
17
18 $url = kubio_fronend_get_editor_url();
19 $appearanceNode = $admin_bar->get_node( 'customize' );
20 if ( ! $appearanceNode ) {
21 return;
22 }
23 $appearanceNode->href = $url;
24 $admin_bar->add_node( $appearanceNode );
25 }
26
27 function kubio_set_admin_bar_customize_to_kubio_editor() {
28 if ( ! kubio_theme_has_kubio_block_support() ) {
29 return;
30 }
31 global $submenu;
32 if ( ! isset( $submenu['themes.php'] ) ) {
33 return;
34 }
35
36 foreach ( $submenu['themes.php'] as $key => $theme_submenu ) {
37 $slug = $theme_submenu[1];
38 if ( $slug !== 'customize' ) {
39 continue;
40 }
41 $submenu['themes.php'][ $key ][2] = 'admin.php?page=kubio';
42 }
43
44 }
45
46 function kubio_update_theme_page_customize_url( $prepared_themes ) {
47 if ( ! kubio_theme_has_kubio_block_support() ) {
48 return $prepared_themes;
49 }
50 foreach ( $prepared_themes as $key => $theme ) {
51 if ( $theme['active'] === true ) {
52 $prepared_themes[ $key ]['actions']['customize'] = kubio_get_editor_url();
53 }
54 }
55
56 return $prepared_themes;
57 }
58
59 function kubio_update_dashboard_customizer_url() {
60 if ( ! kubio_theme_has_kubio_block_support() ) {
61 return;
62 }
63 $request_uri = $_SERVER['REQUEST_URI'];
64 $is_dashboard_admin = str_contains( $request_uri, 'wp-admin/index.php' );
65 if ( ! $is_dashboard_admin ) {
66 return;
67 }
68
69 $kubio_url = kubio_get_editor_url();
70 ob_start();
71 ?>
72 <script>
73 (function($) {
74 $(document).ready(function(){
75 var customizeLink = document.querySelector('a.load-customize');
76 if(!customizeLink) {
77 return
78 }
79 customizeLink.setAttribute('href', "<?php echo $kubio_url ?>")
80 })
81 })(jQuery)
82 </script>
83 <?php
84 $script = strip_tags( ob_get_clean() );
85 wp_add_inline_script( 'jquery', $script );
86 return;
87 }
88
89 add_filter( 'admin_init', 'kubio_update_dashboard_customizer_url' );
90 add_action( 'wp_prepare_themes_for_js', 'kubio_update_theme_page_customize_url', 1000 );
91 add_action( 'admin_bar_menu', 'kubio_set_admin_bar_menu_customize_to_kubio_editor', 1000 );
92 add_action( 'admin_menu', 'kubio_set_admin_bar_customize_to_kubio_editor', 1000 );
93
94