PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / trunk
Kubio AI Page Builder vtrunk
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 / frontend.php
kubio / lib Last commit date
AI 9 months ago admin-pages 1 year ago api 2 months ago blog 1 year ago customizer 1 year ago filters 1 month ago full-site-editing 1 month ago importer 1 year ago integrations 1 month ago menu 1 year ago polyfills 1 year ago preview 7 months ago recommendations 1 month ago shapes 2 years ago shortcodes 1 year ago src 1 month ago add-edit-in-kubio.php 11 months ago editor-assets.php 1 month ago filters.php 1 year ago frontend.php 1 year ago global-data.php 1 year ago init.php 1 year ago kubio-block-library.php 1 month ago kubio-editor.php 1 month ago load.php 1 month ago
frontend.php
70 lines
1 <?php
2
3 use IlluminateAgnostic\Arr\Support\Arr;
4
5 function kubio_enqueue_frontend_assets() {
6
7 if ( kubio_is_hybdrid_theme_iframe_preview() ) {
8 return;
9 }
10
11 kubio_enqueue_frontend_scripts();
12 wp_enqueue_style( 'kubio-block-library' );
13
14 $style = array();
15
16 //when we are inside the editor and render the content inside a post or a woo product. We don't want to add a new instance
17 //of global colors or aditional css. Because it will overwrite the css from the editor
18 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
19 if ( ! Arr::has( $_REQUEST, '__kubio-rendered-styles' ) ) {
20 $style = array(
21 // shapes
22 kubio_get_shapes_css(),
23 // colors
24 kubio_render_global_colors(),
25 // global
26 kubio_get_global_data( 'additional_css' ),
27 );
28 }
29 //page css
30 $style[] = kubio_get_page_css();
31
32 wp_add_inline_style( 'kubio-block-library', implode( "\n\n", $style ) );
33 }
34
35 add_action( 'wp_enqueue_scripts', 'kubio_enqueue_frontend_assets' );
36
37 function kubio_get_page_css() {
38 return Kubio\Core\StyleManager\StyleManager::getInstance()->render();
39 }
40
41 function kubio_render_page_css() {
42
43 if ( wp_doing_ajax() || defined( 'REST_REQUEST' ) ) {
44 return;
45 }
46
47 $content = '<style type="text/css" data-name="kubio-style">' . kubio_get_page_css() . '</style>';
48
49 return $content;
50 }
51
52 add_filter(
53 'style_loader_tag',
54 function ( $tag, $handle ) {
55 $asynced_styles = array( 'kubio-google-fonts' );
56
57 if ( in_array( $handle, $asynced_styles, true ) ) {
58 if ( strpos( $tag, ' async' ) === false ) {
59 $tag = str_replace( '<link', '<link async', $tag );
60 }
61 }
62
63 return $tag;
64 },
65 PHP_INT_MAX,
66 4
67 );
68
69 require_once __DIR__ . '/polyfills/polyfills.php';
70