<?php if ( ! defined( 'ABSPATH' )  ) { die; }

//自动缩略图样式
if( class_exists( 'CSF' ) ) {
$prefix_post_opts = 'ceo_post_thumb_opts';
    CSF::createMetabox($prefix_post_opts, array(
        'title'     => '<span class="ceotheme_com"><i class="fa fa-laptop"></i> CeoMax主题 - 缩略图美化</span>',
        'post_type' => 'post',
        'data_type' => 'unserialize',
        'priority'  => 'high',
    ));
    
    CSF::createSection($prefix_post_opts, array(
        'fields' => array(
            array(
                'id'      => 'cut_thumb_style',
                'type'    => 'radio',
                'inline'  => true,
                'title'   => '选择缩略图美化样式',
                'options' => array(
                    '0' => '不启用',
                    '1' => '样式1',
                    '2' => '样式2',
                ),
                'default'     => '0',
                'desc'=>'样式1：主题目录下static/ceo-img-1文件夹里面的随机图片边框<br> 样式2：主题目录下static/ceo-img-2文件夹里面的随机图片边框'
            ),
        ),
    ));
}

//特色标签模块
if( class_exists( 'CSF' ) ) {
$prefix_tese = 'ceo_post_tese';
	CSF::createMetabox( $prefix_tese, array(
		'title'     => '<span class="ceotheme_com"><i class="fa fa-laptop"></i> CeoMax主题 - 文章特色标签</span>',
		'post_type' => 'post',
		'data_type' => 'serialize',
		'show_restore' => true,

	) );
	CSF::createSection($prefix_tese, array(
        'fields' => array(
            //特色标签
            array(
                'id'      => 'ceo-tese-tag',
                'type'    => 'radio',
                'title'   => '文章特色标签',
                'inline'  => true,
                'options' => array(
                    'buxuanze'  => '不选择',
                    'remen'  => '热门',
                    'dujia' => '独家',
					'zuixin' => '最新',
					'tuijian' => '推荐',
					'jingpin' => '精品',
                ),
                'default'     => 'buxuanze',
                'desc'    => '文章标题前显示特色标签（选择对应标签后会显示在文章列表和文章内页标题前）',
            ),
            //自定义标签
            array(
                'id'         => 'ceo-tese-tag-custom',
                'type'       => 'text',
                'title'      => '文章自定义标签',
                'label'   => '为空则不显示',
                'desc'    => '文章标题前显示特色标签（选择对应标签后会显示在文章列表和文章内页标题前）',
            ),
            //商图标
            array(
                'id'      => 'ceo-shang-tag',
                'type'    => 'radio',
                'title'   => '【商】图标',
                'inline'  => true,
                'options' => array(
                    'no_shang'  => '不显示',
                    'yes_shang'  => '显示',
                ),
                'default'     => 'no_shang',
                'desc'    => '文章标题前显示“商”图标（选择对应标签后会显示在文章列表和文章内页标题前）',
            ),
            //VIP图标
            array(
                'id'      => 'ceo-vip-tag',
                'type'    => 'radio',
                'title'   => '【VIP】图标',
                'inline'  => true,
                'options' => array(
                    'no_vip'  => '不显示',
                    'yes_vip'  => '显示',
                ),
                'default'     => 'no_vip',
                'desc'    => '文章标题前显示“VIP”图标（选择对应标签后会显示在文章列表和文章内页标题前）',
            ),

        )

	) );
}

//资源信息模块
if( class_exists( 'CSF' ) ) {
	$prefix_post_opts = 'ceo_post_opts';
	CSF::createMetabox($prefix_post_opts, array(
        'title'     => '<span class="ceotheme_com"><i class="fa fa-laptop"></i> CeoMax主题 - 资源信息设置</span>',
        'post_type' => 'post',
        'data_type' => 'unserialize',
        'priority'  => 'high',
    ));

    CSF::createSection($prefix_post_opts, array(
        'fields' => array(
            //演示地址
            array(
                'id'         => 'down_demourl',
                'type'       => 'text',
                'title'      => '演示地址',
                'label'   => '为空则不显示',
                'desc'    => '填写地址后内页会显示演示地址按钮，为空则不显示按钮（请以http://或https://开头）',
            ),
            //信息属性
            array(
                'id'         => 'down_info',
                'type'       => 'repeater',
                'title'      => '资源信息属性',
                'desc'       => '总裁主题温馨提示：标题填写：评分，描述内容填写：1-5数字，即可显示★星星评分图标',
                'fields'     => array(
                    array(
                        'id'      => 'title',
                        'type'    => 'text',
                        'title'   => '标题',
                        'default' => '标题',
                    ),
                    array(
                        'id'      => 'desc',
                        'type'    => 'text',
                        'title'   => '描述内容',
                        'default' => '这里是描述内容',
                    ),
                ),
                /*'default' => array(
                    array(
                        'title' => '模板类型',
                        'desc'  => '',
                    ),
                ),*/
            )
        ),
    ));
}

//视频模块
if( class_exists( 'CSF' ) ) {
    $prefix_video = 'my_post_video_options';

    CSF::createMetabox( $prefix_video, array(
        'title'     => '<span class="ceotheme_com"><i class="fa fa-laptop"></i> CeoMax主题 - 视频模块</span>',
        'post_type' => 'post',
        'data_type' => 'serialize',
        'show_restore' => true,

    ) );
    CSF::createSection( $prefix_video, array(
        'fields' => array(

            array(
                'id'    => 'video_type',
                'type'  => 'checkbox',
                'title' => '嵌入视频',
                'label'    => '（指爱奇艺、腾讯视频等视频分享地址，仅需填写分享代码里src的值，不是填整串代码）',
            ),
            array(
                'id'    => 'video_erphpdown',
                'type'  => 'checkbox',
                'title' => '视频收费',
                'label'    => '（基于Erphpdown属性里设置的收费信息）',
            ),
            array(
                'id'    => 'video_url',
                'type'  => 'text',
                'title' => '视频地址',
                'label'    => 'MP4等格式的视频文件地址',
            ),

            //信息属性
            array(
                'id'         => 'list_video',
                'type'       => 'repeater',
                'title'      => '插入视频列表',
                'fields'     => array(
                    array(
                        'id'      => 'title',
                        'type'    => 'text',
                        'title'   => '标题',
                        'default' => '这里是文章标题',
                    ),
                    array(
                        'id'      => 'link',
                        'type'    => 'text',
                        'title'   => '链接',
                        'default' => '这里是文章链接',
                    ),array(
                        'id'      => 'video_link',
                        'type'    => 'text',
                        'title'   => '视频地址',
                        'default' => '视频地址',
                    ),
                ),
            )
        )
    ) );
}

//音频模块
if( class_exists( 'CSF' ) ) {
    $prefix_post_opts_audio = 'audio-postmeta-box';
    CSF::createMetabox($prefix_post_opts_audio, array(
        'title'     => '<span class="ceotheme_com"><i class="fa fa-laptop"></i> CeoMax主题 - 音频模块</span>',
        'post_type' => 'post',
        'data_type' => 'unserialize',
    ));
    CSF::createSection($prefix_post_opts_audio, array(
        'fields' => array(
            array(
                'id'    => 'enable_audio',
                'type'  => 'switcher',
                'title' => '启用音频模块',
                'label' => '',
            ),
            array(
                'id'         => 'audio_url',
                'type'       => 'upload',
                'title'      => '音频播放地址',
                'dependency' => array('enable_audio', '==', 'true'),
            ),

        ),
    ) );
}

//免费资源下载
if( class_exists( 'CSF' ) ) {
    $prefix = 'ceo_post_options';
    
    CSF::createMetabox( $prefix, array(
    	'title'     => '<span class="ceotheme_com"><i class="fa fa-laptop"></i> CeoMax主题 - 免费资源下载</span>',
    	'post_type' => 'post',
    	'data_type' => 'serialize',
    	'show_restore' => true,
    
    ) );
    CSF::createSection( $prefix, array(
    	'fields' => array(
    
    		array(
    			'id'    => 'down_show',
    			'type'  => 'switcher',
    			'title' => '开启免费资源下载',
                'label'    => '开启付费资源下载时请勿再开启免费资源下载（这是独立的下载模块，在文章底部展示下载按钮）',
    		),
    		array(
    			'id'          => 'down_login',
    			'type'        => 'select',
    			'dependency' => array('down_show', '==', true),
    			'title'       => '选择登录状态',
    			'placeholder' => '选择登录状态',
    			'options'     => array(
    				'1'  => '免登录下载',
    				'2'  => '登录后下载',
    			),
    			'default'     => '1'
    		),
    		array(
    			'id'    => 'down_title',
    			'type'  => 'text',
    			'dependency' => array('down_show', '==', true),
    			'title' => '资源标题',
    			'desc'=> '选填'
    		),
    		array(
    			'id'    => 'down_des',
    			'type'  => 'text',
    			'dependency' => array('down_show', '==', true),
    			'title' => '资源简介',
    			'desc'=> '选填'
    		),
    		array(
    			'id'    => 'down_code',
    			'type'  => 'text',
    			'dependency' => array('down_show', '==', true),
    			'title' => '解压码/提取码/其他信息',
    		),
    		array(
    			'id'    => 'down_url',
    			'type'  => 'text',
    			'dependency' => array('down_show', '==', true),
    			'title' => '下载链接',
    		),
    	)
    ) );
}

//文章自定义SEO模块
if( class_exists( 'CSF' ) ) {
$ceo_post_customseo = 'ceo_post_customseo';
	CSF::createMetabox( $ceo_post_customseo, array(
		'title'     => '<span class="ceotheme_com"><i class="fa fa-laptop"></i> CeoMax主题 - 文章自定义SEO</span>',
		'post_type' => 'post',
		'data_type' => 'unserialize',
		'show_restore' => true,

	) );
	CSF::createSection($ceo_post_customseo, array(
        'fields' => array(
            array(
                'id'      => 'ceo-seo-title',
                'type'    => 'text',
                'title'   => '自定义SEO标题',
                'desc'    => '填写自定义SEO标题，未填写则调用默认文章标题',
            ),
            array(
                'id'      => 'ceo-seo-keywords',
                'type'    => 'text',
                'title'   => '自定义SEO关键词',
                'desc'    => '填写自定义SEO关键词，未填写则调用默认文章标签',
            ),
            array(
                'id'      => 'ceo-seo-description',
                'type'    => 'textarea',
                'title'   => '自定义SEO描述',
                'desc'    => '填写自定义SEO描述，未填写则调用默认文章内容前段',
            ),

        )

	) );
}

//页面自定义SEO模块
if( class_exists( 'CSF' ) ) {
$ceo_page_customseo = 'ceo_page_customseo';
    CSF::createMetabox( $ceo_page_customseo, array(
        'title'     => '<span class="ceotheme_com"><i class="fa fa-laptop"></i> CeoMax主题 - 页面自定义SEO</span>',
        'post_type' => 'page',
        'data_type' => 'unserialize',
        'show_restore' => true,
    
    ) );
    CSF::createSection($ceo_page_customseo, array(
        'fields' => array(
            array(
                'id'      => 'ceo-seo-title',
                'type'    => 'text',
                'title'   => '自定义SEO标题',
                'desc'    => '填写自定义SEO标题，未填写则调用默认文章标题',
            ),
            array(
                'id'      => 'ceo-seo-keywords',
                'type'    => 'text',
                'title'   => '自定义SEO关键词',
                'desc'    => '填写自定义SEO关键词，未填写则调用网站关键词',
            ),
            array(
                'id'      => 'ceo-seo-description',
                'type'    => 'textarea',
                'title'   => '自定义SEO描述',
                'desc'    => '填写自定义SEO关键词，未填写则默认无',
            ),
    
        )
    
    ) );
}