HEX
Server: nginx/1.28.1
System: Linux iZgw8b5bpgd4jyptfmmmxgZ 6.6.102-5.2.alnx4.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Nov 27 23:11:10 CST 2025 x86_64
User: www (1000)
PHP: 8.2.28
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/www.scdc-marine.com/wp-content/themes/heku-cms/HekuClass/View/ViewLoader.php
<?php

namespace Heku\HekuClass\View;

/**
 * @package     Heku\Modules\View
 * @subpackage  Classes/ViewLoader
 * @author      Heku Daleconan <http://www.daleconan.com>
 * @copyright   Copyright (c) 2022-2023, Heku Daleconan
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
 */

class ViewLoader {

    /** 
     * 类实现单例模式,类的独生子女
     */
    private static $instance;

    /**
     * 依赖注入的接口 Instance 方法
     * 目标是 保证 init() 初始化方法 只执行一次
     *
     * @return self  唯一实例化的本类
     */
    public static function instance() {
        if ( ! isset( self::$instance ) ) {
            self::$instance = new self;
            self::$instance->init();
        }
        return self::$instance;
    }

    private function init() {

        // 自定义初始化 init-templates 动作钩子,Wordpress 主结构已经实例化完毕
        add_action('init-templates', array( $this, 'load_templates' ) );

    }

     /**
     * 加载前台的各个模块
     *
     * @return void
     * @author Li Ruchun <lemolee@163.com>
     * @version 1.0.0
     * @since 2018
     */
    public function load_templates(){


        // 加载 head 头部 js css 样式 动作
        Header::instance();                     // 挂载钩子:heku_head_css
        SEO::instance();                        // 挂载 SEO 钩子:seo_head_meta 
        Footer::instance();                     // 挂载钩子:heku_footer_js

        //加载顶部模块
        MenuBanner::instance();                  //  加载页面顶部的 menu 和 banner  挂载钩子 :heku_menu_banner

        //加载首页必须加载的动作
        if( is_home() ){
            FullDisplay::instance();            // 首页 全屏展示模块 挂载钩子:heku_index_module
        }
        // var_dump(is_home());
        // var_dump(is_single());

        //文章内页方法
        if( is_single() ){
            Single::instance();                     // 单页 挂载钩子:single_bar_line
        }

        if( is_post_type_archive('post') ){
            Product::instance();                    // 产品单页,挂载钩子:product_img_line  
        }

    }
}