Plugin Directory

Changeset 3410340


Ignore:
Timestamp:
12/04/2025 03:23:12 AM (3 months ago)
Author:
sifency
Message:

ASSET LOADER FIXING

Location:
sifency-addons
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • sifency-addons/tags/1.0.4/includes/elementor/assets/css/menu.css

    r3409752 r3410340  
    257257    .sifency-bp-1024 .sifency-nav-container { display: block; }
    258258    .sifency-bp-1024 { --is-mobile: 1; }
    259     .sifency-bp-1024 .sifency-nav-menu { display: none; }
     259    .sifency-bp-1024 .sifency-nav-menu { display: none; } /* Initially hide until toggled or fixed */
    260260    .sifency-bp-1024.sifency-nav-wrapper { display: block; }
    261261}
  • sifency-addons/tags/1.0.4/theme-builder/builder-item/subheader.php

    r3409752 r3410340  
    88    public function __construct() {
    99        if ( is_admin() ) return;
     10
     11        add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_subheader_assets' ], 10 );
     12        add_action( 'admin_bar_menu', [ $this, 'add_admin_bar_link' ], 200 );
    1013        add_action( 'template_redirect', [ $this, 'init_hooks' ] );
     14    }
     15
     16    public function enqueue_subheader_assets() {
     17        if ( self::$rendered ) return;
     18
     19        $template_id = Sifency_Frontend_Helper::find_matching_template( 'subheader' );
     20
     21        if ( ! $template_id || ! class_exists( '\Elementor\Plugin' ) ) {
     22            return;
     23        }
     24
     25        if ( class_exists( '\Elementor\Frontend' ) ) {
     26            \Elementor\Plugin::instance()->frontend->enqueue_styles();
     27            \Elementor\Plugin::instance()->frontend->enqueue_scripts();
     28        }
     29
     30        $css_file = null;
     31        if ( class_exists( '\Elementor\Core\Files\CSS\Post' ) ) {
     32            $css_file = new \Elementor\Core\Files\CSS\Post( $template_id );
     33        } elseif ( class_exists( '\Elementor\Post_CSS_File' ) ) {
     34            $css_file = new \Elementor\Post_CSS_File( $template_id );
     35        }
     36
     37        if ( $css_file ) {
     38            $css_file->enqueue();
     39        }
     40        if ( class_exists( '\Elementor\Plugin' ) ) {
     41            ob_start();
     42            \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $template_id, true );
     43            ob_end_clean();
     44        }
     45    }
     46
     47    public function add_admin_bar_link( \WP_Admin_Bar $admin_bar ) {
     48        if ( ! current_user_can( 'edit_posts' ) || ! is_admin_bar_showing() ) {
     49            return;
     50        }
     51
     52        $template_id = Sifency_Frontend_Helper::find_matching_template( 'subheader' );
     53
     54        if ( $template_id && class_exists( '\Elementor\Plugin' ) ) {
     55            $admin_bar->add_node( [
     56                'id'     => 'sifency-subheader-edit',
     57                'parent' => 'elementor_edit_page',
     58                'title'  => __( 'Edit Subheader', 'sifency-addons' ),
     59                'href'   => admin_url( 'post.php?post=' . $template_id . '&action=elementor' ),
     60            ] );
     61        }
    1162    }
    1263
     
    1667        $template_id = Sifency_Frontend_Helper::find_matching_template( 'subheader' );
    1768        if ( ! $template_id ) return;
    18 
    1969        add_action( 'get_header', [ $this, 'start_buffer' ], 15 );
    2070        add_action( 'wp_footer', [ $this, 'end_buffer' ], 9999 );
     
    2878        if ( ob_get_length() ) {
    2979            $content = ob_get_clean();
     80
    3081            if ( strpos( $content, 'sifency-elementor-below-header' ) !== false ) {
    3182                echo $content;
     
    4798                <!-- Sifency Elementor Below Header Start -->
    4899                <div class="sifency-elementor-below-header">
    49                     <?php Sifency_Frontend_Helper::render_elementor_content( $template_id, true ); ?>
     100                    <?php
     101                    echo \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $template_id, true );
     102                    ?>
    50103                </div>
    51104                <!-- Sifency Elementor Below Header End -->
    52105                <?php
    53106                $subheader_html = ob_get_clean();
    54 
    55107                $pattern_custom = '/(<header[^>]*id="sifency-custom-header"[^>]*>.*?)(<\/header>)/is';
    56108                $pattern_general = '/(<\/header>)/i';
  • sifency-addons/tags/1.0.4/theme-builder/footer/class-footer-render.php

    r3409752 r3410340  
    55
    66    public function __construct() {
     7        add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_footer_assets' ], 10 );
     8        add_action( 'admin_bar_menu', [ $this, 'add_admin_bar_link' ], 200 );
    79        add_action( 'get_footer', [ $this, 'start_buffer' ], 1 );
    810        add_action( 'wp_footer', [ $this, 'end_buffer' ], 9999 );
     11    }
     12
     13    public function enqueue_footer_assets() {
     14        $footer_id = Sifency_Frontend_Helper::find_matching_template( 'footer' );
     15
     16        if ( ! $footer_id || ! class_exists( '\Elementor\Plugin' ) ) {
     17            return;
     18        }
     19
     20        if ( class_exists( '\Elementor\Frontend' ) ) {
     21            \Elementor\Plugin::instance()->frontend->enqueue_styles();
     22            \Elementor\Plugin::instance()->frontend->enqueue_scripts();
     23        }
     24
     25        $css_file = null;
     26        if ( class_exists( '\Elementor\Core\Files\CSS\Post' ) ) {
     27            $css_file = new \Elementor\Core\Files\CSS\Post( $footer_id );
     28        } elseif ( class_exists( '\Elementor\Post_CSS_File' ) ) {
     29            $css_file = new \Elementor\Post_CSS_File( $footer_id );
     30        }
     31
     32        if ( $css_file ) {
     33            $css_file->enqueue();
     34        }
     35
     36        if ( class_exists( '\Elementor\Plugin' ) ) {
     37            ob_start();
     38            \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $footer_id, true );
     39            ob_end_clean();
     40        }
     41    }
     42
     43    public function add_admin_bar_link( \WP_Admin_Bar $admin_bar ) {
     44        if ( ! current_user_can( 'edit_posts' ) || ! is_admin_bar_showing() ) {
     45            return;
     46        }
     47
     48        $footer_id = Sifency_Frontend_Helper::find_matching_template( 'footer' );
     49
     50        if ( $footer_id && class_exists( '\Elementor\Plugin' ) ) {
     51            $admin_bar->add_node( [
     52                'id'     => 'sifency-footer-edit',
     53                'parent' => 'elementor_edit_page',
     54                'title'  => __( 'Edit Footer', 'sifency-addons' ),
     55                'href'   => admin_url( 'post.php?post=' . $footer_id . '&action=elementor' ),
     56            ] );
     57        }
    958    }
    1059
     
    2473                <!-- Sifency Custom Footer Start -->
    2574                <footer id="sifency-custom-footer" class="sifency-footer" itemscope itemtype="https://schema.org/WPFooter">
    26                     <?php Sifency_Frontend_Helper::render_elementor_content( $template_id ); ?>
     75                    <?php
     76                    echo \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $template_id, true );
     77                    ?>
    2778                </footer>
    2879                <!-- Sifency Custom Footer End -->
    2980                <?php
    3081                $custom_html = ob_get_clean();
     82
    3183                $pattern = '/<footer\b[^>]*>.*?<\/footer>/is';
    3284
  • sifency-addons/tags/1.0.4/theme-builder/header/class-header-render.php

    r3409752 r3410340  
    55
    66    public function __construct() {
     7        add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_header_assets' ], 10 );
    78        add_action( 'template_redirect', [ $this, 'sifency_addons_replace_header' ] );
     9        add_action( 'admin_bar_menu', [ $this, 'add_admin_bar_link' ], 200 );
     10    }
     11
     12    public function enqueue_header_assets() {
     13        $header_id = Sifency_Frontend_Helper::find_matching_template( 'header' );
     14
     15        if ( ! $header_id || ! class_exists( '\Elementor\Plugin' ) ) {
     16            return;
     17        }
     18
     19        if ( class_exists( '\Elementor\Frontend' ) ) {
     20            \Elementor\Plugin::instance()->frontend->enqueue_styles();
     21            \Elementor\Plugin::instance()->frontend->enqueue_scripts();
     22        }
     23
     24        $css_file = null;
     25        if ( class_exists( '\Elementor\Core\Files\CSS\Post' ) ) {
     26            $css_file = new \Elementor\Core\Files\CSS\Post( $header_id );
     27        } elseif ( class_exists( '\Elementor\Post_CSS_File' ) ) {
     28            $css_file = new \Elementor\Post_CSS_File( $header_id );
     29        }
     30
     31        if ( $css_file ) {
     32            $css_file->enqueue();
     33        }
     34
     35        if ( class_exists( '\Elementor\Plugin' ) ) {
     36            ob_start();
     37            \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $header_id, true );
     38            ob_end_clean();
     39        }
     40    }
     41
     42    public function add_admin_bar_link( \WP_Admin_Bar $admin_bar ) {
     43        if ( ! current_user_can( 'edit_posts' ) || ! is_admin_bar_showing() ) {
     44            return;
     45        }
     46
     47        $header_id = Sifency_Frontend_Helper::find_matching_template( 'header' );
     48
     49        if ( $header_id && class_exists( '\Elementor\Plugin' ) ) {
     50            $admin_bar->add_node( [
     51                'id'     => 'sifency-header-edit',
     52                'parent' => 'elementor_edit_page',
     53                'title'  => __( 'Edit Header', 'sifency-addons' ),
     54                'href'   => admin_url( 'post.php?post=' . $header_id . '&action=elementor' ),
     55            ] );
     56        }
    857    }
    958
    1059    public function sifency_addons_replace_header() {
    1160        $header_id = Sifency_Frontend_Helper::find_matching_template( 'header' );
     61        if ( ! $header_id ) return;
    1262
    13         if ( ! $header_id ) {
    14             return;
    15         }
    1663        add_action( 'get_header', [ $this, 'start_buffer' ] );
    1764        add_action( 'wp_footer', [ $this, 'end_buffer' ], 9999 );
     
    3279                ?>
    3380                <header id="sifency-custom-header" class="sifency-header" itemscope itemtype="https://schema.org/WPHeader">
    34                     <?php Sifency_Frontend_Helper::render_elementor_content( $header_id ); ?>
     81                    <?php
     82                    echo \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $header_id, true );
     83                    ?>
    3584                </header>
    3685                <?php
    3786                $custom_header_html = ob_get_clean();
     87
    3888                $pattern = '/<header[^>]*>.*?<\/header>/is';
    39                
    4089                if ( preg_match( $pattern, $content ) ) {
    4190                    $content = preg_replace( $pattern, $custom_header_html, $content, 1 );
     
    4493                }
    4594            }
    46 
    47             echo $content; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     95            echo $content;
    4896        }
    4997    }
  • sifency-addons/trunk/includes/elementor/assets/css/menu.css

    r3409752 r3410340  
    257257    .sifency-bp-1024 .sifency-nav-container { display: block; }
    258258    .sifency-bp-1024 { --is-mobile: 1; }
    259     .sifency-bp-1024 .sifency-nav-menu { display: none; }
     259    .sifency-bp-1024 .sifency-nav-menu { display: none; } /* Initially hide until toggled or fixed */
    260260    .sifency-bp-1024.sifency-nav-wrapper { display: block; }
    261261}
  • sifency-addons/trunk/theme-builder/builder-item/subheader.php

    r3409752 r3410340  
    88    public function __construct() {
    99        if ( is_admin() ) return;
     10
     11        add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_subheader_assets' ], 10 );
     12        add_action( 'admin_bar_menu', [ $this, 'add_admin_bar_link' ], 200 );
    1013        add_action( 'template_redirect', [ $this, 'init_hooks' ] );
     14    }
     15
     16    public function enqueue_subheader_assets() {
     17        if ( self::$rendered ) return;
     18
     19        $template_id = Sifency_Frontend_Helper::find_matching_template( 'subheader' );
     20
     21        if ( ! $template_id || ! class_exists( '\Elementor\Plugin' ) ) {
     22            return;
     23        }
     24
     25        if ( class_exists( '\Elementor\Frontend' ) ) {
     26            \Elementor\Plugin::instance()->frontend->enqueue_styles();
     27            \Elementor\Plugin::instance()->frontend->enqueue_scripts();
     28        }
     29
     30        $css_file = null;
     31        if ( class_exists( '\Elementor\Core\Files\CSS\Post' ) ) {
     32            $css_file = new \Elementor\Core\Files\CSS\Post( $template_id );
     33        } elseif ( class_exists( '\Elementor\Post_CSS_File' ) ) {
     34            $css_file = new \Elementor\Post_CSS_File( $template_id );
     35        }
     36
     37        if ( $css_file ) {
     38            $css_file->enqueue();
     39        }
     40        if ( class_exists( '\Elementor\Plugin' ) ) {
     41            ob_start();
     42            \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $template_id, true );
     43            ob_end_clean();
     44        }
     45    }
     46
     47    public function add_admin_bar_link( \WP_Admin_Bar $admin_bar ) {
     48        if ( ! current_user_can( 'edit_posts' ) || ! is_admin_bar_showing() ) {
     49            return;
     50        }
     51
     52        $template_id = Sifency_Frontend_Helper::find_matching_template( 'subheader' );
     53
     54        if ( $template_id && class_exists( '\Elementor\Plugin' ) ) {
     55            $admin_bar->add_node( [
     56                'id'     => 'sifency-subheader-edit',
     57                'parent' => 'elementor_edit_page',
     58                'title'  => __( 'Edit Subheader', 'sifency-addons' ),
     59                'href'   => admin_url( 'post.php?post=' . $template_id . '&action=elementor' ),
     60            ] );
     61        }
    1162    }
    1263
     
    1667        $template_id = Sifency_Frontend_Helper::find_matching_template( 'subheader' );
    1768        if ( ! $template_id ) return;
    18 
    1969        add_action( 'get_header', [ $this, 'start_buffer' ], 15 );
    2070        add_action( 'wp_footer', [ $this, 'end_buffer' ], 9999 );
     
    2878        if ( ob_get_length() ) {
    2979            $content = ob_get_clean();
     80
    3081            if ( strpos( $content, 'sifency-elementor-below-header' ) !== false ) {
    3182                echo $content;
     
    4798                <!-- Sifency Elementor Below Header Start -->
    4899                <div class="sifency-elementor-below-header">
    49                     <?php Sifency_Frontend_Helper::render_elementor_content( $template_id, true ); ?>
     100                    <?php
     101                    echo \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $template_id, true );
     102                    ?>
    50103                </div>
    51104                <!-- Sifency Elementor Below Header End -->
    52105                <?php
    53106                $subheader_html = ob_get_clean();
    54 
    55107                $pattern_custom = '/(<header[^>]*id="sifency-custom-header"[^>]*>.*?)(<\/header>)/is';
    56108                $pattern_general = '/(<\/header>)/i';
  • sifency-addons/trunk/theme-builder/footer/class-footer-render.php

    r3409752 r3410340  
    55
    66    public function __construct() {
     7        add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_footer_assets' ], 10 );
     8        add_action( 'admin_bar_menu', [ $this, 'add_admin_bar_link' ], 200 );
    79        add_action( 'get_footer', [ $this, 'start_buffer' ], 1 );
    810        add_action( 'wp_footer', [ $this, 'end_buffer' ], 9999 );
     11    }
     12
     13    public function enqueue_footer_assets() {
     14        $footer_id = Sifency_Frontend_Helper::find_matching_template( 'footer' );
     15
     16        if ( ! $footer_id || ! class_exists( '\Elementor\Plugin' ) ) {
     17            return;
     18        }
     19
     20        if ( class_exists( '\Elementor\Frontend' ) ) {
     21            \Elementor\Plugin::instance()->frontend->enqueue_styles();
     22            \Elementor\Plugin::instance()->frontend->enqueue_scripts();
     23        }
     24
     25        $css_file = null;
     26        if ( class_exists( '\Elementor\Core\Files\CSS\Post' ) ) {
     27            $css_file = new \Elementor\Core\Files\CSS\Post( $footer_id );
     28        } elseif ( class_exists( '\Elementor\Post_CSS_File' ) ) {
     29            $css_file = new \Elementor\Post_CSS_File( $footer_id );
     30        }
     31
     32        if ( $css_file ) {
     33            $css_file->enqueue();
     34        }
     35
     36        if ( class_exists( '\Elementor\Plugin' ) ) {
     37            ob_start();
     38            \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $footer_id, true );
     39            ob_end_clean();
     40        }
     41    }
     42
     43    public function add_admin_bar_link( \WP_Admin_Bar $admin_bar ) {
     44        if ( ! current_user_can( 'edit_posts' ) || ! is_admin_bar_showing() ) {
     45            return;
     46        }
     47
     48        $footer_id = Sifency_Frontend_Helper::find_matching_template( 'footer' );
     49
     50        if ( $footer_id && class_exists( '\Elementor\Plugin' ) ) {
     51            $admin_bar->add_node( [
     52                'id'     => 'sifency-footer-edit',
     53                'parent' => 'elementor_edit_page',
     54                'title'  => __( 'Edit Footer', 'sifency-addons' ),
     55                'href'   => admin_url( 'post.php?post=' . $footer_id . '&action=elementor' ),
     56            ] );
     57        }
    958    }
    1059
     
    2473                <!-- Sifency Custom Footer Start -->
    2574                <footer id="sifency-custom-footer" class="sifency-footer" itemscope itemtype="https://schema.org/WPFooter">
    26                     <?php Sifency_Frontend_Helper::render_elementor_content( $template_id ); ?>
     75                    <?php
     76                    echo \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $template_id, true );
     77                    ?>
    2778                </footer>
    2879                <!-- Sifency Custom Footer End -->
    2980                <?php
    3081                $custom_html = ob_get_clean();
     82
    3183                $pattern = '/<footer\b[^>]*>.*?<\/footer>/is';
    3284
  • sifency-addons/trunk/theme-builder/header/class-header-render.php

    r3409752 r3410340  
    55
    66    public function __construct() {
     7        add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_header_assets' ], 10 );
    78        add_action( 'template_redirect', [ $this, 'sifency_addons_replace_header' ] );
     9        add_action( 'admin_bar_menu', [ $this, 'add_admin_bar_link' ], 200 );
     10    }
     11
     12    public function enqueue_header_assets() {
     13        $header_id = Sifency_Frontend_Helper::find_matching_template( 'header' );
     14
     15        if ( ! $header_id || ! class_exists( '\Elementor\Plugin' ) ) {
     16            return;
     17        }
     18
     19        if ( class_exists( '\Elementor\Frontend' ) ) {
     20            \Elementor\Plugin::instance()->frontend->enqueue_styles();
     21            \Elementor\Plugin::instance()->frontend->enqueue_scripts();
     22        }
     23
     24        $css_file = null;
     25        if ( class_exists( '\Elementor\Core\Files\CSS\Post' ) ) {
     26            $css_file = new \Elementor\Core\Files\CSS\Post( $header_id );
     27        } elseif ( class_exists( '\Elementor\Post_CSS_File' ) ) {
     28            $css_file = new \Elementor\Post_CSS_File( $header_id );
     29        }
     30
     31        if ( $css_file ) {
     32            $css_file->enqueue();
     33        }
     34
     35        if ( class_exists( '\Elementor\Plugin' ) ) {
     36            ob_start();
     37            \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $header_id, true );
     38            ob_end_clean();
     39        }
     40    }
     41
     42    public function add_admin_bar_link( \WP_Admin_Bar $admin_bar ) {
     43        if ( ! current_user_can( 'edit_posts' ) || ! is_admin_bar_showing() ) {
     44            return;
     45        }
     46
     47        $header_id = Sifency_Frontend_Helper::find_matching_template( 'header' );
     48
     49        if ( $header_id && class_exists( '\Elementor\Plugin' ) ) {
     50            $admin_bar->add_node( [
     51                'id'     => 'sifency-header-edit',
     52                'parent' => 'elementor_edit_page',
     53                'title'  => __( 'Edit Header', 'sifency-addons' ),
     54                'href'   => admin_url( 'post.php?post=' . $header_id . '&action=elementor' ),
     55            ] );
     56        }
    857    }
    958
    1059    public function sifency_addons_replace_header() {
    1160        $header_id = Sifency_Frontend_Helper::find_matching_template( 'header' );
     61        if ( ! $header_id ) return;
    1262
    13         if ( ! $header_id ) {
    14             return;
    15         }
    1663        add_action( 'get_header', [ $this, 'start_buffer' ] );
    1764        add_action( 'wp_footer', [ $this, 'end_buffer' ], 9999 );
     
    3279                ?>
    3380                <header id="sifency-custom-header" class="sifency-header" itemscope itemtype="https://schema.org/WPHeader">
    34                     <?php Sifency_Frontend_Helper::render_elementor_content( $header_id ); ?>
     81                    <?php
     82                    echo \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $header_id, true );
     83                    ?>
    3584                </header>
    3685                <?php
    3786                $custom_header_html = ob_get_clean();
     87
    3888                $pattern = '/<header[^>]*>.*?<\/header>/is';
    39                
    4089                if ( preg_match( $pattern, $content ) ) {
    4190                    $content = preg_replace( $pattern, $custom_header_html, $content, 1 );
     
    4493                }
    4594            }
    46 
    47             echo $content; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     95            echo $content;
    4896        }
    4997    }
Note: See TracChangeset for help on using the changeset viewer.