<?php

/**
 * Initialize the custom Meta Boxes. 
 */
add_action('admin_init', 'xs_pricing_meta_boxes');
add_action('admin_init', 'xs_pricing_p_meta_boxes');

/**
 * Meta Boxes demo code.
 *
 * You can find all the available option types in theme-options.php.
 *
 * @return    void
 * @since     2.3.0
 */
function xs_pricing_meta_boxes() {

    /**
     * Create a custom meta boxes array that we pass to 
     * the OptionTree Meta Box API Class.
     */
    $pricing_meta_box = array(
        'id' => 'xs_pricing_meta_box',
        'title' => __('Table Details', 'option-tree-theme'),
        'desc' => '',
        'pages' => array('xs_pricing_table'),
        'context' => 'normal',
        'priority' => 'high',
        'fields' => array(
            array(
                'label' => __('Buy button text', 'option-tree-theme'),
                'id' => 'xs_pricing_button_text',
                'type' => 'text',
                'desc' => '',
                'std' => 'Buy Now'
            ),
            array(
                'label' => 'Buy button link (Don\'t forget to use http://).<br /><small><i>(If you had selected custom link for register button, this link will be used for this pricing table.)</i></small>',
                'id' => 'xs_pricing_button_link',
                'type' => 'text',
                'desc' => '',
                'std' => 'http://#'
            ),
            array('id' => 'xs_pricing_feature',
                'label' => __('Pricing features', 'xs'),
                'desc' => __('Add pring features here.', 'xs'),
                'std' => array(
                    array(
                        'title' => 'Entry fee lorem'
                    ),
                    array(
                        'title' => 'Breakfast Ipsum'
                    ),
                    array(
                        'title' => 'Lunch with guest'
                    ),
                    array(
                        'title' => 'Tea and Snacks'
                    ),
                    array(
                        'title' => 'Drinks'
                    ),
                ),
                'type' => 'list-item',
                'section' => 'general',
                'rows' => '',
                'post_type' => '',
                'taxonomy' => '',
                'min_max_step' => '',
                'class' => '',
                'condition' => '',
                'operator' => 'and',
                'settings' => array(
                    array('id' => 'desc',
                        'label' => __('', 'xs'),
                        'desc' => '',
                        'std' => '',
                        'type' => 'hidden',
                        'rows' => '',
                        'post_type' => '',
                        'taxonomy' => '',
                        'min_max_step' => '',
                        'class' => '',
                        'condition' => '',
                        'operator' => 'and'
                    )
                )
            )
        )
    );

    /**
     * Register our meta boxes using the 
     * ot_register_meta_box() function.
     */
    if (function_exists('ot_register_meta_box')) {
        ot_register_meta_box($pricing_meta_box);
    }
}

function xs_pricing_p_meta_boxes() {

    /**
     * Create a custom meta boxes array that we pass to 
     * the OptionTree Meta Box API Class.
     */
    $pricing_p_meta_box = array(
        'id' => 'xs_p_pricing_meta_box',
        'title' => __('Set Price', 'option-tree-theme'),
        'desc' => '',
        'pages' => array('xs_pricing_table'),
        'context' => 'side',
        'priority' => 'high',
        'fields' => array(
            array(
                'label' => 'Price <br /><small><i>(Leave blank to make this package FREE.)</i></small>',
                'id' => 'xs_pricing_price',
                'type' => 'text',
                'desc' => '',
                'std' => ''
            ),
            array(
                'label' => __('Currency', 'option-tree-theme'),
                'id' => 'xs_pricing_cur',
                'type' => 'text',
                'desc' => '',
                'std' => 'USD'
            )
        )
    );

    /**
     * Register our meta boxes using the 
     * ot_register_meta_box() function.
     */
    if (function_exists('ot_register_meta_box')) {
        ot_register_meta_box($pricing_p_meta_box);
    }
}
