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/scdc-marine/HekuClass/Admin/Template.php
<?php

namespace Heku\HekuClass\Admin;

/**
 * @package     Heku\HekuClass\Admin
 * @subpackage  Classes/Template
 * @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 Template {

    /** 
     * 类实现单例模式,类的独生子女
     */
    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() {

        add_action('cmb2_admin_init',array($this,'main_options_page'),101,5);

    }

    //默认设置项
    public static $default_settings = array(
        'wrapper_width'=>'1100',
        'default_video_poster'=>'',
        'default_video_logo'=>'',
    );

    /**
     * 创建 Menu 设置 页面
     */
    public function main_options_page(){

        //  全局 参数设置 Menu
        $this->menu_global_options();

        // 首页 图文设置 Menu
        $this->menu_index_options();

    }

    /**
     *  全局 参数 设置
     */
    public function menu_global_options(){

        $global_options = new_cmb2_box(array(
            'id'	        =>	'heku_options_page',                        // 列表的ID
            'icon_url'	    =>	'dashicons-admin-generic',
            'option_key'    =>  'heku_main_options',
            'position'      => 26,
            'show_on'	    =>	array(
                'options-page'  => 'heku_main_options',
                ),
            'object_types'  =>  array( 'options-page' ),
            'menu_title'    =>  __('主题设置','heku'),
            'tab_group'     => 'heku_template_options',
            'tab_title'     =>  __('全局设置','heku'),
        ));


        // 联系我们 模块 '<div class="links-module cmb-row"> <h2 style="padding-left: 10px;">联系我们</h2>',
            $global_options->add_field(array(
                'before_row'=>'<div class="links-module cmb-row"> <h2 style="padding-left: 10px;">联系我们</h2>',
                'name'=>__('公司名称','b2'),
                'id'=>'link_cat',
                'type'    => 'text',
                'default' => heku_get_option( 'main_options', 'link_show_children' ),
                'show_on_cb' => 'cmb_only_show_for_us2',
                'display_cb' => array( $this, 'yourprefix_display_wiki_text' ),
                'desc'=>__('请直接填写%s的分类ID,查看:%s链接分类%s','b2'),'<a target="_blank" href="'.admin_url('/edit-tags.php?taxonomy=link_cat&post_type=links').'">','</a>')
            );

            $global_options->add_field(array(
                'name'=>__('公司地址','b2'),
                'id'=>'link_show_children',
                'type'    => 'select',
                'options'=>array(
                    1=>__('显示','b2'),
                    0=>__('不显示','b2')
                ),
                'default' => 0,
                'desc'=>__('如果此%s分类中有子%s分类,您可以选择是否显示子%s分类中的链接,注意,如果子%s分类特别多(大于20个)可能会有性能问题。','b2')
            ));

            $global_options->add_field(array(
                'name'=>__('点击跳转方式','b2'),
                'id'=>'link_junp',
                'type'      => 'select',
                'options'   =>array(
                    'self'=>__('跳转到本站内页','b2'),
                    'target'=>__('跳转到目标站点','b2')
                ),
                'default' => 'self'
            ));

            $global_options->add_field(array(
                'name'=>__('每行显示几个','b2'),
                'id'=>'link_count',
                'type'    => 'text',
                'default' => '5'
            ));

            $global_options->add_field(array(
                'name'=>__('一共显示几个','b2'),
                'id'=>'link_count_total',
                'type'    => 'text',
                'default' => '15',
            ));

            $global_options->add_field(array(
                'name'=>__('排序方法','b2'),
                'id'=>'link_order',
                'type'    => 'select',
                'options'=>array(
                    'DESC'=>__('最新添加的排在前面','b2'),
                    'ASC'=>__('最后添加的排在前面','b2'),
                    'link_rating'=>__('点赞最高的排在前面','b2')
                ),
                'default' => 'link_rating'
            ));

            $global_options->add_field(array(
                'name'=>__('显示哪些小部件','b2'),
                'id'=>'link_meta',
                'type'    => 'multicheck_inline',
                'options' => array(
                    'title'=>__('模块标题','b2'),
                    'children' => __( '子%s分类', 'b2' ),
                    'more' => __( '更多按钮', 'b2' ),
                    'icon'=>__( '图标', 'b2' ),
                    'desc'=>__( '描述', 'b2' ),
                    'user' => __( '站长', 'b2' ),
                    'like' => __( '喜欢数量', 'b2' )
                ),
                'default' => array(),
                //array('title','children','more','icon','desc','user','like'),
                'after_row'=>'</div>'
            ));
        // 设置 模块 结束 'after_row'=>'</div>'

    }

    /**
     *  首页 图文 设置
     */
    public function menu_index_options(){

        $heku_index = new_cmb2_box( array(
            'id'            => 'heku_template_options_page',
            'object_types'  => array( 'options-page' ),
            'option_key'    => 'heku_template_main',
            'menu_title'    =>  __('首页图文设置','heku'),
            'parent_slug'   => 'heku_main_options',
            'tab_group'     => 'heku_template_options',
            'tab_title'     => __('首页图文','b2'),
           
        ));
    }

    /**
     *  首页 图文 设置
     */
    public function menu_footer_options(){

        $heku_footer = new_cmb2_box( array(
            'id'            => 'heku_footer_menu_options',
            'object_types'  => array( 'options-page' ),
            'option_key'    => 'heku_footer_menu',
            'menu_title'    =>  __('底部图文设置','heku'),
            'parent_slug'   => 'heku_main_options',
            'tab_group'     => 'heku_template_options',
            'tab_title'     => __('底部图文','b2'),
           
        ));
    }

}