redux-framework配置文件汉化

<?php
 /*汉化 @ 九刺鱼 , visit: http://www.jiuciyu.com/redux/ */

    if ( ! class_exists( 'Redux' ) ) {
        return;
    }
     //加载语言包
    load_theme_textdomain('salong', get_template_directory() . '/admin/ReduxCore/languages');
    // 在这里自定义框架全局函数名,请尽量特殊不与其他框架或默认函数重复。调用的时候首先加载全局函数   用这个调用选项值
    //$opt_name = "主题设置";
    // This is your option name where all the Redux data is stored.
    $opt_name = "jcy";

    // This line is only for altering the demo. Can be easily removed.
    $opt_name = apply_filters( 'redux_demo/opt_name', $opt_name );

    /**
     * ---> SET ARGUMENTS
     * All the possible arguments for Redux.
     * For full documentation on arguments, please refer to: https://github.com/ReduxFramework/ReduxFramework/wiki/Arguments
     * */

    $theme = wp_get_theme(); // For use with some settings. Not necessary.

    $args = array(
        'opt_name'             => $opt_name, // 这个字段保存在你的数据库里,主题设置项opt_name 可以在数据库里面找到,也是你的全局变量名
       
        'display_name'         => $theme->get( 'Name' ),  // 在面板上方显示主题名称
       
        'display_version'      => $theme->get( 'Version' ), // 在面板上方显示主题版本
      
        'menu_type'            => 'menu', // 在admin菜单上显示,参数:menu 或 submenu(只在开启时显示)

        'allow_sub_menu'       => true, // 是否在admin上显示主题设置子菜单

        'menu_title'           => '主题设置', // 设置左侧栏主题设置菜单名
        'page_title'           => '九刺鱼主题设置', // 设置浏览器和admin工具条上的菜单名

        // Please visit: https://developers.google.com/fonts/docs/developer_api#Auth
        'google_api_key'       => '', // 谷歌api key - 用于谷歌字体升级,可以不理会

        'google_update_weekly' => false, // 是否使用谷歌字体,最好保持false

        'async_typography'     => true, // 异步排版

        //'disable_google_fonts_link' => true,                    // Disable this in case you want to create your own google fonts loader
        'admin_bar'            => true, // 是否在admin工具条上显示主题设置菜单名

        'admin_bar_icon'       => 'dashicons-portfolio', // admin工具条图标

        'admin_bar_priority'   => 80, // 优先级,也就是显示位置

        'global_variable'      => 'jcy',  // 设置主题设置的全局变量 参照本例:命名空间_主题名称
       
        'dev_mode'             => false, // 开发者模式

        'update_notice'        => false, // 升级通告

        'customizer'           => false, // 个人定制
        // Enable basic customizer support
        //'open_expanded'     => true,                    // Allow you to start the panel in an expanded way initially.
        //'disable_save_warn' => true,                    // Disable the save warning when a user changes a field

        // OPTIONAL -> Give you extra features
        'page_priority'        => 30, // null页面优先级,选择主题设置菜单在左侧显示的位置

        'page_parent'          => 'themes.php', // 参考 http://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters

        'page_permissions'     => 'manage_options', // 设置权限

        'menu_icon'            => '', // 图标链接设置

        'last_tab'             => '1', // 强制面板总是打开一个 li(审查元素,找到li标签对应的id数值,比如id="1_section_group_li",就是1)

        'page_icon'            => 'icon-themes', // 设置菜单名左侧的图标

        'page_slug'            => '', // 主题设置页面的别名

        'save_defaults'        => true, // 更新设之前是否先保存一遍默认设置

        'default_show'         => false, // 若为true,那么不启用设置字段的默认值

        'default_mark'         => '', // 设置项标题后面的标记,可以使用*号

        'show_import_export'   => true, // 显示导入导出设置


        // CAREFUL -> These options are for advanced use only
        'transient_time'       => 60 * MINUTE_IN_SECONDS,
        'output'               => false, 
        // Global shut-off for dynamic CSS output by the framework. Will also disable google fonts output
        'output_tag'           => true,
        // Allows dynamic CSS to be generated for customizer and google fonts, but stops the dynamic CSS from going to the head
        // 'footer_credit'     => '',                   // Disable the footer credit of Redux. Please leave if you can help it.

        // FUTURE -> Not in use yet, but reserved or partially implemented. Use at your own risk.
        'database'             => '', // 可以为: options, theme_mods, theme_mods_expanded

        'use_cdn'              => true, // 是否使用cdn
        
         // 提示框的参数
        'hints'                => array(
            'icon'          => 'el el-question-sign',
            'icon_position' => 'right',
            'icon_color'    => 'lightgray',
            'icon_size'     => 'normal',
            'tip_style'     => array(
                'color'   => '#333',
                'shadow'  => true,
                'rounded' => false,
                'style'   => '',
            ),
            'tip_position'  => array(
                'my' => 'top left',
                'at' => 'bottom right',
            ),
            'tip_effect'    => array(
                'show' => array(
                    'effect'   => 'slide',
                    'duration' => '500',
                    'event'    => 'mouseover',
                ),
                'hide' => array(
                    'effect'   => 'slide',
                    'duration' => '500',
                    'event'    => 'click mouseleave',
                ),
            ),
        )
    );
    
//选项表格上显示的面板状态文本。
    if ( ! isset( $args['global_variable'] ) || $args['global_variable'] !== false ) {
        if ( ! empty( $args['global_variable'] ) ) {
            $v = $args['global_variable'];
        } else {
            $v = str_replace( '-', '_', $args['opt_name'] );
        }
        $args['intro_text'] = sprintf( '<p><a href="http://www.jiuciyu.com" target="_blank">九刺鱼</a>提示:此框架设置了一个全局变量: <strong>$%1$s</stron>使用前请先引入全局变量一次,可以放在header.php,你可以通过调用<strong> $%1$s[\'设置项id\'] </strong>来调用设置保存值,同时可以通过配置文件来修改这个变量名!</p>', $v ) ;
    } else {
        $args['intro_text'] = '<p>这个信息将显示于面板底部,不是必需的,但可以提供更多提示。允许使用html标签。</p>';
    }

    // 选项表格下显示的面板状态文本。
    $args['footer_text'] = '<p>这个信息将显示于面板底部,不是必需的,但可以提供更多提示。允许使用html标签。</p>';

    Redux::setArgs( $opt_name, $args );
    /*
     * ---> END ARGUMENTS
     */

   /*
     * ---> START HELP TABS
     */

    $tabs = array(
        array(
            'id'      => 'redux-help-tab-1',
            'title'   => __( 'Theme Information 1', 'redux-framework-demo' ),
            'content' => __( '<p>这是TAB内容,支持html标签</p>', 'redux-framework-demo' )
        ),
        array(
            'id'      => 'redux-help-tab-2',
            'title'   => __( 'Theme Information 2', 'redux-framework-demo' ),
            'content' => __( '<p>这是TAB内容,支持html标签</p>', 'redux-framework-demo' )
        )
    );
    Redux::setHelpTab( $opt_name, $tabs );

    // Set the help sidebar
    $content = __( '<p>这是侧边栏内容,支持html标签</p>', 'redux-framework-demo' );
    Redux::setHelpSidebar( $opt_name, $content );


    /*
     * <--- END HELP TABS
     */

// 引入参考设置section项
    /*
     *
     * ---> START SECTIONS
     *
     */

    /*

        As of Redux 3.5+, there is an extensive API. This API can be used in a mix/match mode allowing for


     */

    // -> START 基础字段
    
    Redux::setSection( $opt_name, array(
        'title' => '基础设置',
        'id'               => 'basic',
        'desc'             => '这些都是很基本的选项',
        'customizer_width' => '400px',
        'icon'             => 'el el-home'
    ) );
    
    Redux::setSection( $opt_name, array(
        'title' => '开关',
        'id'         => 'jcy_op_optimizer',
         'desc'       => '文档支持请参考:  ' . '<a href=//docs.reduxframework.com/core/fields/switch/" target="_blank">docs.reduxframework.com/core/fields/switch/</a>',
        'subsection' => true,
        'fields'     => array(

            array(
                'id'       => 'jcy-vents-News',
                'type'     => 'switch',
                'title' => '移除事件和新闻',
                'subtitle' => '默认移除,',
                'default'  => true,
            ),
            array(
                'id'       => 'jcy-disable-events-and-news-dashboard-widget',
                'type'     => 'switch',
                'title' => '禁用后台首页事件和新闻',
                'subtitle' => '默认为打开状态',
                //'options' => array('on', 'off'),
                'default'  => false,
            ),
            array(
                'id'       => 'switch-parent',
                'type'     => 'switch',
                'title' => '开关联动子项目-打开即显示子项目',
                'subtitle' => '默认关闭,隐藏子项目',
                'default'  => 0,
                'on'       => 'Enabled',
                'off'      => 'Disabled',
            ),
            array(
                'id'       => 'switch-child1',
                'type'     => 'switch',
                'required' => array( 'switch-parent', '=', '1' ),// 设置折叠锚点id ,switch-parent 表示由id为switch-parent 的开关控制此项的折叠
                'title' => '子项-1(再无子项)',
                'subtitle' => '注意与开关id锚点挂钩',
                'desc'     => '设置为此ID的折叠的项目将隐藏,除非将其设置为适当的值。',
                'default'  => false,
            ),
            array(
                'id'       => 'switch-child2',
                'type'     => 'switch',
                'required' => array( 'switch-parent', '=', '1' ),
                'title' => '子项-2(还有子项)',
                'subtitle' => '注意与开关id锚点挂钩',
                'desc'     => '设置为此ID的折叠的项目将隐藏,除非将其设置为适当的值。',
                'default'  => false,
            ),
        )
    ) );

    Redux::setSection( $opt_name, array(
        'title' => '复选框',
        'id'               => 'basic-checkbox',
        'subsection'       => true,
        'customizer_width' => '450px',
         'desc'       => '文档支持请参考:  ' . '<a href=//docs.reduxframework.com/core/fields/checkbox/" target="_blank">docs.reduxframework.com/core/fields/checkbox/</a>',
        'fields'           => array(
            array(
                'id'       => 'opt-checkbox',
                'type'     => 'checkbox',
                'title' => '通用复选框设置',
                'subtitle' => '本设置子标题',
                'desc'     => '本设置项描述',
                'default'  => '1'// 1 = on | 0 = off
            ),
            array(
                'id'       => 'opt-multi-check',
                'type'     => 'checkbox',
                'title' => '多项复选设置',
                'subtitle' => '本设置子标题',
                'desc'     => '本设置项描述',
                //必须以这种形式赋值 key => value pairs for multi checkbox options
                'options'  => array(
                    '1' => 'Opt 1',
                    '2' => 'Opt 2',
                    '3' => 'Opt 3'
                ),
                //看怎样设置默认值? you also don't need to specify opts that are 0.
                'default'  => array(
                    '1' => '1',
                    '2' => '0',
                    '3' => '0'
                )
            ),
            array(
                'id'       => 'opt-checkbox-data',
                'type'     => 'checkbox',
                'title' => '多项复选设置 (包含菜单信息)',
                'subtitle' => '本设置子标题',
                'desc'     => '本设置项描述',
                'data'     => 'menu'
            ),
            array(
                'id'       => 'opt-checkbox-sidebar',
                'type'     => 'checkbox',
                'title' => '多项复选设置 (包含侧边栏信息)',
                'subtitle' => '本设置子标题',
                'desc'     => '本设置项描述',
                'data'     => 'sidebars'
            ),
        )
    ) );
    Redux::setSection( $opt_name, array(
        'title' => '单选',
        'id'               => 'basic-Radio',
        'subsection'       => true,
        'customizer_width' => '500px',
         'desc'       => '文档支持请参考:  ' . '<a href=//docs.reduxframework.com/core/fields/radio/" target="_blank">docs.reduxframework.com/core/fields/radio/</a>',
        'fields'           => array(
            array(
                'id'       => 'jcy-theme',
                'type'     => 'radio',
                'title' => '主题模式',
                'subtitle' => '设置主题模板',
                'desc'     => '在此更改主题的模式,可选。',
                //必须以这种形式赋值 key => value pairs for radio options
                'options'  => array(
                    '1' => 'CMS',
                    '2' => '博客',
                    '3' => '杂志'
                ),
                'default'  => '2'
            ),
            array(
                'id'       => 'opt-radio-data',
                'type'     => 'radio',
                'title' => '单选 (包含菜单信息)',
                'subtitle' => '本设置子标题',
                'desc'     => '本设置项描述',
                'data'     => 'menu'
            ),
        )
    ) );
    Redux::setSection( $opt_name, array(
        'title' => '可分类',
        'id'         => 'basic-Sortable',
        'subsection' => true,
         'desc'       => '文档支持请参考:  ' . '<a href=//docs.reduxframework.com/core/fields/sortable/" target="_blank">docs.reduxframework.com/core/fields/sortable/</a>',
        'fields'     => array(
            array(
                'id'       => 'opt-sortable',
                'type'     => 'sortable',
                'title' => '排序设置',
                'subtitle' => '以您想要的方式重新定义和排序',
                'desc'     => '本设置项描述',
                'label'    => true,
                'options'  => array(
                    'Text One'   => 'Item 1',
                    'Text Two'   => 'Item 2',
                    'Text Three' => 'Item 3',
                )
            ),
            array(
                'id'       => 'opt-check-sortable',
                'type'     => 'sortable',
                'mode'     => 'checkbox', // checkbox or text
                'title' => '排序设置',
                'subtitle' => '以您想要的方式重新定义和排序',
                'desc'     => '本设置项描述',
                'options'  => array(
                    'cb1' => 'Checkbox One',
                    'cb2' => 'Checkbox Two',
                    'cb3' => 'Checkbox Three',
                ),
                'default'  => array(
                    'cb1' => false,
                    'cb2' => true,
                    'cb3' => false,
                )
            ),
        )
    ) );


    Redux::setSection( $opt_name, array(
        'title' => '常规设置',
         'desc'       => '文档支持请参考:  ' . '<a href=//docs.reduxframework.com/core/fields/text/" target="_blank">docs.reduxframework.com/core/fields/text/</a>',
        'id'               => 'basic-Text',
        'subsection'       => true,
        'customizer_width' => '700px',
        'fields'           => array(
            array(
                'id'       => 'jcy-beian',
                'type'     => 'text',
                'title' => '备案号',
                'subtitle' => '备案号',
                'desc'     => '请填写自己的备案号',
                'default'  => '默认文字',
            ),
            array(
                'id'        => 'text-example-hint',
                'type'      => 'text',
                'title' => '带提示的文本框',
                'subtitle'  => '子标题',
                'desc'      => '描述',
                'default'   => '默认文字',
                'text_hint' => array(
                    'title' => '提示标题',
                    'content' => '关于这个字段的提示!'
                )
            ),
            array(
                'id'          => 'text-placeholder',
                'type'        => 'text',
                'title' => '带占位文字的文本框',
                'subtitle'    => '子标题',
                'desc'        => '描述',
                'placeholder' => '占位符',
            ),
            array(
	'id'       => 'baidu_push_api',
	'type'     => 'text',
	'title'    => __( '百度推送接口', 'redux-framework-demo' ),
	'subtitle' => __( '子标题', 'redux-framework-demo' ),
	'desc'     => __( '描述', 'redux-framework-demo' ),
	'default'  => '默认文字',
)

        )
    ) );

    Redux::setSection( $opt_name, array(
        'title' => '多项文本框',
        'id'         => 'basic-Multi Text',
         'desc'       => '文档支持请参考:  ' . '<a href=//docs.reduxframework.com/core/fields/multi-text/" target="_blank">docs.reduxframework.com/core/fields/multi-text/</a>',
        'subsection' => true,
        'fields'     => array(
            array(
                'id'       => 'opt-multitext',
                'type'     => 'multi_text',
                'title' => '多项文本框设置',
                'subtitle' => '子标题',
                'desc'     => '描述',
            ),
        )
    ) );
    
    Redux::setSection( $opt_name, array(
        'title' => '文本域',
        'id'         => 'basic-Textarea',
         'desc'       => '文档支持请参考:  ' . '<a href=//docs.reduxframework.com/core/fields/textarea/" target="_blank">docs.reduxframework.com/core/fields/textarea/</a>',
        'subsection' => true,
        'fields'     => array(
            array(
                'id'       => 'jcy_op_umeng',
                'type'     => 'textarea',
                'title' => '统计代码-支持html标签',
                'subtitle' => '子标题',
                'desc'     => '本设置项描述',
                'default'  => '统计代码',
            ),
			array(
                'id'       => 'jcy_op_umeng',
                'type'     => 'textarea',
                'title' => '统计代码-支持html标签',
                'subtitle' => '子标题',
                'desc'     => '本设置项描述',
                'default'  => '统计代码',
            )
        )
    ) );
	Redux::setSection( $opt_name, array(
        'title' => '关于我们',
        'id'         => 'jcy_op_about',
         'desc'       => '文档支持请参考:  ' . '<a href=//docs.reduxframework.com/core/fields/textarea/" target="_blank">docs.reduxframework.com/core/fields/textarea/</a>',
        'subsection' => true,
        'fields'     => array(
            array(
                'id'       => 'jcy_op_about',
                'type'     => 'textarea',
                'title' => '统计代码-支持html标签',
                'subtitle' => '子标题',
                'desc'     => '本设置项描述',
                'default'  => '我们是一个网站',
            )
        )
    ) );
    Redux::setSection( $opt_name, array(
        'icon'            => 'el el-list-alt',
        'title' => '仅仅定制',
        'desc' => '<p class="description">This Section should be visible only in Customizer</p>',
        'customizer_only' => true,
        'fields'          => array(
            array(
                'id'              => 'opt-customizer-only',
                'type'            => 'select',
                'title' => 'Customizer Only Option',
                'subtitle' =>  'The subtitle is NOT visible in customizer',
                'desc' => 'The field desc is NOT visible in customizer.',
                'customizer_only' => true,
                //必须以这种形式赋值 key => value pairs for select options
                'options'         => array(
                    '1' => 'Opt 1',
                    '2' => 'Opt 2',
                    '3' => 'Opt 3'
                ),
                'default'         => '2'
            ),
        )
    ) );
    
    if ( file_exists( dirname( __FILE__ ) . '/./core/section.md' ) ) {
        $section = array(
            'icon'   => 'el el-list-alt',
            'title' => '已集成插件',
            'fields' => array(
                array(
                    'id'       => '16',
                    'type'     => 'raw',
                    'markdown' => true,
                    'content_path' => dirname( __FILE__ ) . '/./core/section.md', // FULL PATH, not relative please
                    //'content' => 'Raw content here',
                ),
            ),
        );
        Redux::setSection( $opt_name, $section );
    }

    if ( file_exists( dirname( __FILE__ ) . '/./core/readme.md' ) ) {
        $section = array(
            'icon'   => 'el el-list-alt',
            'title' => '说明文档',
            'fields' => array(
                array(
                    'id'       => '17',
                    'type'     => 'raw',
                    'markdown' => true,
                    'content_path' => dirname( __FILE__ ) . '/./core/readme.md', // FULL PATH, not relative please
                    //'content' => 'Raw content here',
                ),
            ),
        );
        Redux::setSection( $opt_name, $section );
    }
    
    if ( file_exists( dirname( __FILE__ ) . '/./core/config.md' ) ) {
        $section = array(
            'icon'   => 'el el-list-alt',
            'title' => '框架配置',
            'fields' => array(
                array(
                    'id'       => '18',
                    'type'     => 'raw',
                    'markdown' => true,
                    'content_path' => dirname( __FILE__ ) . '/./core/config.md', // FULL PATH, not relative please
                    //'content' => 'Raw content here',
                ),
            ),
        );
        Redux::setSection( $opt_name, $section );
    }
    
    if ( file_exists( dirname( __FILE__ ) . '/./core/section.md' ) ) {
        $section = array(
            'icon'   => 'el el-list-alt',
            'title' => '配置注释',
            'fields' => array(
                array(
                    'id'       => '19',
                    'type'     => 'raw',
                    'markdown' => true,
                    'content_path' => dirname( __FILE__ ) . '/./core/section.md', // FULL PATH, not relative please
                    //'content' => 'Raw content here',
                ),
            ),
        );
        Redux::setSection( $opt_name, $section );
    }
    
    if ( file_exists( dirname( __FILE__ ) . '/./core/defined.md' ) ) {
        $section = array(
            'icon'   => 'el el-list-alt',
            'title' => '预置参数',
            'fields' => array(
                array(
                    'id'       => '20',
                    'type'     => 'raw',
                    'markdown' => true,
                    'content_path' => dirname( __FILE__ ) . '/./core/defined.md', // FULL PATH, not relative please
                    //'content' => 'Raw content here',
                ),
            ),
        );
        Redux::setSection( $opt_name, $section );
    }
    
    if ( file_exists( dirname( __FILE__ ) . '/./core/CHANGELOG.md' ) ) {
        $section = array(
            'icon'   => 'el el-list-alt',
            'title' => '修订历史',
            'fields' => array(
                array(
                    'id'       => '21',
                    'type'     => 'raw',
                    'markdown' => true,
                    'content_path' => dirname( __FILE__ ) . '/./core/CHANGELOG.md', // FULL PATH, not relative please
                    //'content' => 'Raw content here',
                ),
            ),
        );
        Redux::setSection( $opt_name, $section );
    }
    /*
     * <--- END SECTIONS
     */

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值