PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 2.2.0
Kubio AI Page Builder v2.2.0
2.9.1 2.9.0 2.8.6 2.8.5 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 / admin-pages / pages.php
kubio / lib / admin-pages Last commit date
main-page 2 years ago kubio-get-started.php 2 years ago pages.php 2 years ago
pages.php
217 lines
1 <?php
2
3 use IlluminateAgnostic\Arr\Support\Arr;
4 use Kubio\Core\StyleManager\Utils;
5 use Kubio\Core\Utils as CoreUtils;
6
7 function kubio_print_admin_page_header( $subtitle = null, $tabs = array(), $options = array() ) {
8
9 global $_wp_admin_css_colors;
10 $color_scheme = get_user_option( 'admin_color', get_current_user_id() );
11
12 $colors = Arr::get( $_wp_admin_css_colors, "{$color_scheme}", array() );
13
14 $action_params = Arr::get( $options, 'action_params', array() );
15
16 $current_tab = sanitize_key( Arr::get( $_REQUEST, 'tab', 'get-started' ) );
17
18 if ( ! isset( $tabs[ $current_tab ] ) && count( $tabs ) > 0 ) {
19 $current_tab = array_keys( $tabs )[0];
20 }
21
22 $base_url = add_query_arg( 'page', 'kubio-get-started', admin_url( 'admin.php' ) );
23
24 ?>
25
26 <style>
27 :root{
28 <?php foreach ( Arr::get( (array) $colors, 'colors', array() ) as $index => $color ) : ?>
29 --kubio-admin-page-color-<?php echo esc_html( $index + 1 ); ?>:<?php echo esc_html( Utils::hex2rgba( $color, false, true ) ); ?>;
30 <?php endforeach; ?>
31 }
32 </style>
33 <div class="kubio-admin-page-header">
34 <div class="limited-width">
35
36 <div class="kubio-admin-row">
37 <div class="kubio-admin-col-1 no-gap">
38
39 <h1 class="kubio-admin-page-header-title">
40 <?php echo wp_kses_post( file_get_contents( kubio_admin_assets_path() . '/kubio-logo.svg' ) ); ?>
41 </h1>
42
43 <div class="kubio-admin-row kubio-admin-row-items-end">
44 <?php if ( $subtitle ) : ?>
45 <div class="kubio-admin-page-header-subtitle">
46 <?php echo wp_kses_post( $subtitle ); ?>
47 </div>
48 <?php endif; ?>
49 </div>
50
51 </div>
52
53 <div class="kubio-admin-col justify-content-end">
54 <div class="kubio-admin-page-header-start-editing">
55 <?php if ( CoreUtils::isTryOnlineEnabled() ) : ?>
56 <a target="_blank" href="<?php echo esc_url( Arr::get( kubio_get_site_urls(), 'theme_try_online' ) ); ?>"
57 class="button button-hero button-try-online">
58 <?php esc_html_e( 'Try PRO Online', 'kubio' ); ?>
59 </a>
60 <?php endif; ?>
61 <a href="<?php echo esc_url( add_query_arg( 'page', 'kubio', admin_url( 'admin.php' ) ) ); ?>"
62 class="button button-hero button-primary">
63 <?php esc_html_e( 'Start editing', 'kubio' ); ?>
64 </a>
65 </div>
66 </div>
67
68 </div>
69
70
71 </div>
72 </div>
73 <?php if ( $tabs ) : ?>
74 <div class="kubio-admin-page-tabs">
75
76 <div class="kubio-admin-row limited-width">
77 <ul class="">
78 <?php
79 foreach ( $tabs as $tab_slug => $tab_data ) :
80
81 if ( $tab_data['type'] === 'hidden' ) {
82 continue;
83 }
84
85 $class_add = ( $current_tab === $tab_slug ? 'active' : '' );
86 if ( isset( $tab_data['class'] ) ) {
87 if ( ! is_array( $tab_data['class'] ) ) {
88 $tab_data['class'] = array( $tab_data['class'] );
89 }
90
91 $classes = array_merge( array( $class_add ), $tab_data['class'] );
92 $class_add = implode( ' ', $classes );
93 }
94 ?>
95 <li class="<?php echo esc_attr( $class_add ); ?>">
96 <?php if ( in_array( $tab_data['type'], array( 'page', 'core_page' ), true ) ) : ?>
97 <a href="<?php echo esc_url( add_query_arg( 'tab', $tab_slug, $base_url ) ); ?>">
98 <?php echo esc_html( $tab_data['label'] ); ?>
99 </a>
100 <?php elseif ( $tab_data['type'] === 'link' ) : ?>
101
102 <a href="<?php echo esc_url( $tab_data['href'] ); ?>" class="link-tab">
103 <?php echo esc_html( $tab_data['label'] ); ?>
104 </a>
105
106 <?php endif; ?>
107
108 </li>
109 <?php endforeach; ?>
110 </ul>
111 </div>
112
113 </div>
114 <?php endif; ?>
115
116
117 <?php do_action( 'kubio/welcome-page/after-header', $action_params ); ?>
118 <?php
119 }
120
121 function kubio_print_admin_page_start() {
122 ?>
123 <div class="wrap">
124 <div id="kubio-admin-page">
125 <?php
126
127 }
128
129 function kubio_print_admin_page_end() {
130 ?>
131 </div>
132 </div>
133 <?php
134
135 }
136
137 function kubio_admin_assets_path() {
138 return KUBIO_ROOT_DIR . '/static/admin-pages/';
139
140 }
141
142
143 function kubio_admin_page_class( $page_name, $extra_classes = array(), $echo = true ) {
144 $classes = array_merge(
145 array( "kubio-admin-page--{$page_name}" ),
146 $extra_classes
147 );
148
149 $classes = implode( ' ', $classes );
150
151 if ( $echo ) {
152 echo esc_attr( $classes );
153 } else {
154 return $classes;
155 }
156
157 }
158
159 function kubio_admin_page_component_class( $component, $extra_classes = array(), $echo = true ) {
160 $classes = array_merge(
161 array( "kubio-admin-page-component--{$component}" ),
162 $extra_classes
163 );
164
165 $classes = implode( ' ', $classes );
166
167 if ( $echo ) {
168 echo esc_attr( $classes );
169 } else {
170 return $classes;
171 }
172
173 }
174
175 function kubio_print_continous_loading_bar( $hidden = false ) {
176 ?>
177 <div class="kubio-progress-bar <?php echo( $hidden ? 'hidden' : '' ); ?>">
178 <div class="kubio-progress-bar-value"></div>
179 </div>
180 <?php
181 }
182
183
184 add_action(
185 'admin_enqueue_scripts',
186 function () {
187 $screen = get_current_screen();
188 global $post;
189 $action = $screen->action ? $screen->action : Arr::get( $_REQUEST, 'action', '' );
190 $is_block_editor = $screen->is_block_editor || ( ! empty( $action ) && $post && use_block_editor_for_post( $post ) );
191 $is_block_editor = $is_block_editor || did_filter( 'block_editor_settings_all' );
192
193 if ( $is_block_editor ) {
194 return;
195 }
196
197 wp_enqueue_style( 'kubio-admin-area' );
198 wp_enqueue_script( 'kubio-admin-area' );
199
200 add_action(
201 'admin_head',
202 function () {
203 ?>
204 <style>
205 :root {
206 --kubio-admin-pages-assets-root-url: <?php echo esc_url( kubio_url( '/static/admin-pages' ) ); ?>;
207 }
208 </style>
209 <?php
210 }
211 );
212 },
213 PHP_INT_MAX
214 );
215
216 require __DIR__ . '/kubio-get-started.php';
217