<?php
/**
 * Meta options
 * 
 * @author Fox
 * @since 1.0.0
 */
class CMSMetaOptionsBase
{
    public function __construct()
    {
        add_action('add_meta_boxes', array($this, 'cms_add_mtbs'));
        add_action('admin_enqueue_scripts', array($this, 'admin_script_loader'));
    }
    /* add script */
    public function admin_script_loader()
    {
        $enable_script = apply_filters( 'cms_mtb_enable_script', true );
        if (!$enable_script) return;
        global $pagenow;
        if (is_admin() && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
            wp_enqueue_style('metabox', get_template_directory_uri() . '/inc/options/css/metabox.css');
            wp_enqueue_script('easytabs', get_template_directory_uri() . '/inc/options/js/jquery.easytabs.min.js');
            wp_enqueue_script('metabox', get_template_directory_uri() . '/inc/options/js/metabox.js');
        }
    }
    /* add meta boxs */
    public function cms_add_mtbs()
    {
        // $this->cms_add_mtb('template_page_options', __('Setting', 'zk-monaco' ), 'page');
        /*Add Portfolio page option */
        /*$this->add_meta_box('template_page_portfolio', __('Page Extra Option', 'zk-monaco' ), 'page');*/

        /* Add portfolio extra field */
        // $this->cms_add_mtb('portfolio_extra_field', __('Portfolio Extra Field', 'zk-monaco' ), 'portfolio');

        /* Add Team extra field */
        // $this->cms_add_mtb('team_extra_field', __('Team Extra Field', 'zk-monaco' ), 'team');
    }
    
    public function cms_add_mtb($id, $label, $post_type, $context = 'advanced', $priority = 'default')
    {
        add_meta_box('_cms_' . $id, $label, array($this, $id), $post_type, $context, $priority);
    }
    public function cms_add_mtb_no_prefix($id, $label, $post_type, $context = 'advanced', $priority = 'default')
    {
        add_meta_box($id, $label, array($this, $id), $post_type, $context, $priority);
    }
    /* --------------------- PAGE ---------------------- */
    
}

new CMSMetaOptionsBase();