<?php
add_filter( 'ot_override_forced_textarea_simple', '__return_true' );

function youplay_get_sidebars() {
  global $wp_registered_sidebars;
  $sidebars = array();

  foreach($wp_registered_sidebars as $k => $sidebar) {
    $sidebars[] = $k;
  }

  return $sidebars;
}

function getYouplayLayouts() {
  return array(
    array(
      'value'       => 'default',
      'label'       => 'Default',
      'src'         => get_template_directory_uri() . '/admin/images/layouts/default.jpg'
    ),
    array(
      'value'       => 'cont',
      'label'       => 'Content',
      'src'         => get_template_directory_uri() . '/admin/images/layouts/cont.jpg'
    ),
    array(
      'value'       => 'cont-side',
      'label'       => 'Content + Sidebar',
      'src'         => get_template_directory_uri() . '/admin/images/layouts/cont-side.jpg'
    ),
    array(
      'value'       => 'side-cont',
      'label'       => 'Sidebar + Content',
      'src'         => get_template_directory_uri() . '/admin/images/layouts/side-cont.jpg'
    ),
    array(
      'value'       => 'banner-cont',
      'label'       => 'Banner + Content',
      'src'         => get_template_directory_uri() . '/admin/images/layouts/banner-cont.jpg'
    ),
    array(
      'value'       => 'banner-cont-side',
      'label'       => 'Banner + Content + Sidebar',
      'src'         => get_template_directory_uri() . '/admin/images/layouts/banner-cont-side.jpg'
    ),
    array(
      'value'       => 'banner-side-cont',
      'label'       => 'Banner + Sidebar + Content',
      'src'         => get_template_directory_uri() . '/admin/images/layouts/banner-side-cont.jpg'
    )
  );
}


/* Background Image metaboxes for all page types */
function getYouplayBackgroundMetabox() {
  return array(
    array(
      'id'          => 'tab_backgound',
      'label'       => __('Background', 'youplay'),
      'desc'        => '',
      'std'         => '',
      'type'        => 'tab',
      'operator'    => 'and'
    ),
    array(
      'id'          => 'general_background',
      'label'       => __('Enable Background', 'youplay'),
      'desc'        => '',
      'std'         => 'default',
      'type'        => 'select',
      'choices'     => array(
        array(
          'value'       => 'default',
          'label'       => __('Default', 'youplay'),
          'src'         => ''
        ),
        array(
          'value'       => 'on',
          'label'       => __('On', 'youplay'),
          'src'         => ''
        ),
        array(
          'value'       => 'off',
          'label'       => __('Off', 'youplay'),
          'src'         => ''
        )
      )
    ),
    array(
      'id'          => 'general_background_image',
      'label'       => __('Image', 'youplay'),
      'desc'        => '',
      'std'         => yp_opts('general_background_image'),
      'type'        => 'upload',
      'condition'   => 'general_background:not(off)'
    ),
    array(
      'id'          => 'general_background_cover',
      'label'       => __('Cover', 'youplay'),
      'desc'        => 'Cover image if ON. Repeat image of OFF.',
      'std'         => 'default',
      'type'        => 'select',
      'choices'     => array(
        array(
          'value'       => 'default',
          'label'       => __('Default', 'youplay'),
          'src'         => ''
        ),
        array(
          'value'       => 'on',
          'label'       => __('On', 'youplay'),
          'src'         => ''
        ),
        array(
          'value'       => 'off',
          'label'       => __('Off', 'youplay'),
          'src'         => ''
        )
      ),
      'condition'   => 'general_background:not(off)'
    ),
    array(
      'id'          => 'general_background_fixed',
      'label'       => __('Fixed', 'youplay'),
      'desc'        => 'Fixed attachment (not scroll with page)',
      'std'         => 'default',
      'type'        => 'select',
      'choices'     => array(
        array(
          'value'       => 'default',
          'label'       => __('Default', 'youplay'),
          'src'         => ''
        ),
        array(
          'value'       => 'on',
          'label'       => __('On', 'youplay'),
          'src'         => ''
        ),
        array(
          'value'       => 'off',
          'label'       => __('Off', 'youplay'),
          'src'         => ''
        )
      ),
      'condition'   => 'general_background:not(off)'
    ),
    array(
      'id'          => 'general_background_parallax',
      'label'       => __('Parallax', 'youplay'),
      'desc'        => 'Change background position on scroll from top screen to bottom. Set 0 to disable. Set "default" to use value from Options panel.',
      'std'         => 'default',
      'type'        => 'text',
      'condition'   => 'general_background:not(off)'
    ),
    array(
      'id'          => 'general_content_bg_opacity_metabox',
      'label'       => __('Custom Background Opacity', 'youplay'),
      'desc'        => '',
      'std'         => 'off',
      'type'        => 'on-off',
      'condition'   => 'general_background:not(off)'
    ),
    array(
      'id'          => 'general_content_bg_opacity',
      'label'       => __('', 'youplay'),
      'desc'        => '',
      'std'         => '75',
      'type'        => 'numeric-slider',
      'min_max_step'=> '0,100,1',
      'condition'   => 'general_content_bg_opacity_metabox:is(on),general_background:not(off)'
    ),
  );
}



/**
------------------
PAGE METABOXES
------------------
*/
add_action( 'admin_init', 'yp_page_meta_boxes' );

if ( ! function_exists( 'yp_page_meta_boxes' ) ) {
  function yp_page_meta_boxes() {
    //layout
    $meta_box = array(
      'id'        => 'page_custom_options',
      'title'     => 'Youplay Custom Options',
      'desc'      => '',
      'pages'     => array( 'page' ),
      'context'   => 'normal',
      'priority'  => 'high',
      'fields'    => array_merge(array(
        array(
          'id'          => 'tab_page_layout',
          'label'       => __('Layout', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'tab',
          'operator'    => 'and'
        ),
        array(
          'id'          => 'single_page_layout',
          'label'       => __('Layout','youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'radio-image',
          'class'       => '',
          'choices'     => getYouplayLayouts()
        ),
        array(
          'id'          => 'single_page_sidebar',
          'label'       => __('Sidebar', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'sidebar_select'
        ),
        array(
          'id'          => 'single_page_show_title',
          'label'       => __('Show Title', 'youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'select',
          'choices'     => array(
            array(
              'value'       => 'default',
              'label'       => __('Default', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'on',
              'label'       => __('On', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'off',
              'label'       => __('Off', 'youplay'),
              'src'         => ''
            )
          )
        ),
        array(
          'id'          => 'single_page_boxed_cont',
          'label'       => __('Boxed Content', 'youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'select',
          'choices'     => array(
            array(
              'value'       => 'default',
              'label'       => __('Default', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'on',
              'label'       => __('On', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'off',
              'label'       => __('Off', 'youplay'),
              'src'         => ''
            )
          )
        ),
        array(
          'id'          => 'single_page_comments',
          'label'       => __('Show Comments', 'youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'select',
          'choices'     => array(
            array(
              'value'       => 'default',
              'label'       => __('Default', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'on',
              'label'       => __('On', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'off',
              'label'       => __('Off', 'youplay'),
              'src'         => ''
            )
          )
        ),
        array(
          'id'          => 'single_page_nopadding',
          'label'       => __('Remove Content Padding', 'youplay'),
          'desc'        => 'Remove padding from top and bottom of content. May be useful with carousels on top and bottom.',
          'std'         => 'off',
          'type'        => 'on-off',
        ),
        array(
          'id'          => 'single_page_revslider',
          'label'       => __('Use Revolution Slider', 'youplay'),
          'desc'        => 'Title will be hidden',
          'std'         => 'off',
          'type'        => 'on-off',
        ),
        array(
          'id'          => 'single_page_revslider_alias',
          'label'       => __('Slider', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'revslider-select',
        ),

        array(
          'id'          => 'tab_page_banner',
          'label'       => __('Banner', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'tab',
          'operator'    => 'and'
        ),
        array(
          'id'          => 'single_page_banner_image',
          'label'       => __('Image', 'youplay'),
          'desc'        => '',
          'std'         => yp_opts('single_page_banner_image'),
          'type'        => 'upload',
        ),
        array(
          'id'          => 'single_page_banner_image_cover',
          'label'       => __('Image Cover', 'youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'select',
          'choices'     => array(
            array(
              'value'       => 'default',
              'label'       => __('Default', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'on',
              'label'       => __('On', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'off',
              'label'       => __('Off', 'youplay'),
              'src'         => ''
            )
          )
        ),
        array(
          'id'          => 'single_page_banner_size',
          'label'       => __('Banner Size', 'youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'select',
          'choices'     => array(
            array(
              'value'       => 'default',
              'label'       => __('Default', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'full',
              'label'       => __('Full', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'mid',
              'label'       => __('Mid', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'small',
              'label'       => __('Small', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'xsmall',
              'label'       => __('Extra Small', 'youplay'),
              'src'         => ''
            )
          )
        ),
        array(
          'id'          => 'single_page_banner_cont',
          'label'       => __('Banner Text', 'youplay'),
          'desc'        => 'Leave blank if you want to display the name of the page',
          'std'         => '',
          'type'        => 'textarea',
        )
      ), getYouplayBackgroundMetabox())
    );

    if(function_exists('ot_register_meta_box')) {
      ot_register_meta_box( $meta_box );
    }
  }
}


/**
------------------
POST METABOXES
------------------
*/
add_action( 'admin_init', 'yp_post_meta_boxes' );

if ( ! function_exists( 'yp_post_meta_boxes' ) ){
  
  function yp_post_meta_boxes() {
    //layout
    $meta_box = array(
      'id'        => 'post_custom_options',
      'title'     => 'Youplay Custom Options',
      'desc'      => '',
      'pages'     => array( 'post' ),
      'context'   => 'normal',
      'priority'  => 'high',
      'fields'    => array_merge(array(
        array(
          'id'          => 'tab_post_layout',
          'label'       => __('Layout', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'tab',
          'operator'    => 'and'
        ),
        array(
          'id'          => 'single_post_layout',
          'label'       => __('Layout','youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'radio-image',
          'class'       => '',
          'choices'     => getYouplayLayouts()
        ),
        array(
          'id'          => 'single_post_sidebar',
          'label'       => __('Sidebar', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'sidebar_select'
        ),
        array(
          'id'          => 'single_post_boxed_cont',
          'label'       => __('Boxed Content', 'youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'select',
          'choices'     => array(
            array(
              'value'       => 'default',
              'label'       => __('Default', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'on',
              'label'       => __('On', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'off',
              'label'       => __('Off', 'youplay'),
              'src'         => ''
            )
          )
        ),
        array(
          'id'          => 'single_post_comments',
          'label'       => __('Show Comments', 'youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'select',
          'choices'     => array(
            array(
              'value'       => 'default',
              'label'       => __('Default', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'on',
              'label'       => __('On', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'off',
              'label'       => __('Off', 'youplay'),
              'src'         => ''
            )
          )
        ),
        array(
          'id'          => 'single_post_revslider',
          'label'       => __('Use Revolution Slider', 'youplay'),
          'desc'        => 'Title will be hidden',
          'std'         => 'off',
          'type'        => 'on-off',
        ),
        array(
          'id'          => 'single_post_revslider_alias',
          'label'       => __('Slider', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'revslider-select',
        ),

        array(
          'id'          => 'tab_post_banner',
          'label'       => __('Banner', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'tab',
          'operator'    => 'and'
        ),
        array(
          'id'          => 'single_post_banner_image',
          'label'       => __('Image', 'youplay'),
          'desc'        => '',
          'std'         => yp_opts('single_post_banner_image'),
          'type'        => 'upload',
        ),
        array(
          'id'          => 'single_post_banner_image_cover',
          'label'       => __('Image Cover', 'youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'select',
          'choices'     => array(
            array(
              'value'       => 'default',
              'label'       => __('Default', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'on',
              'label'       => __('On', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'off',
              'label'       => __('Off', 'youplay'),
              'src'         => ''
            )
          )
        ),
        array(
          'id'          => 'single_post_banner_size',
          'label'       => __('Banner Size', 'youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'select',
          'choices'     => array(
            array(
              'value'       => 'default',
              'label'       => __('Default', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'full',
              'label'       => __('Full', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'mid',
              'label'       => __('Mid', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'small',
              'label'       => __('Small', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'xsmall',
              'label'       => __('Extra Small', 'youplay'),
              'src'         => ''
            )
          )
        ),
        array(
          'id'          => 'single_post_banner_cont',
          'label'       => __('Banner Text', 'youplay'),
          'desc'        => 'Leave blank if you want to display the name of the post',
          'std'         => '',
          'type'        => 'textarea',
        ),


        array(
          'id'          => 'tab_post_review',
          'label'       => __('Review', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'tab',
          'operator'    => 'and'
        ),
        array(
          'id'          => 'single_post_review',
          'label'       => __('Show Review', 'youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'select',
          'choices'     => array(
            array(
              'value'       => 'default',
              'label'       => __('Default', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'on',
              'label'       => __('On', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'off',
              'label'       => __('Off', 'youplay'),
              'src'         => ''
            )
          )
        ),
        array(
          'id'          => 'single_post_review_rating',
          'label'       => __('Rating', 'youplay'),
          'desc'        => '',
          'std'         => '0',
          'type'        => 'numeric-slider',
          'section'     => 'single_post',
          'rows'        => '',
          'post_type'   => '',
          'taxonomy'    => '',
          'min_max_step'=> '0,' . intval(yp_opts('single_post_review_max_rating')) . ',0.1',
          'class'       => '',
          'condition'   => 'single_post_review:not(off)',
          'operator'    => 'and'
        ),
        array(
          'id'          => 'single_post_review_first_list',
          'label'       => __('First List', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'list-item',
          'section'     => 'single_post',
          'rows'        => '',
          'post_type'   => '',
          'taxonomy'    => '',
          'min_max_step'=> '',
          'class'       => '',
          'settings'    => array( false ),
          'condition'   => 'single_post_review:not(off)',
          'operator'    => 'and'
        ),
        array(
          'id'          => 'single_post_review_second_list',
          'label'       => __('Second List', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'list-item',
          'section'     => 'single_post',
          'rows'        => '',
          'post_type'   => '',
          'taxonomy'    => '',
          'min_max_step'=> '',
          'class'       => '',
          'settings'    => array( false ),
          'condition'   => 'single_post_review:not(off)',
          'operator'    => 'and'
        ),
      ), getYouplayBackgroundMetabox())
    );
    
    if (function_exists('ot_register_meta_box')) {
      ot_register_meta_box( $meta_box );
    }

    /**
     * Filters the required title field's label.
     */
    function filter_list_item_title_label( $label, $id ) {
      if ($id == 'single_post_review_first_list' || $id == 'single_post_review_second_list') {
        $label = __( 'Text', 'theme-domain' );
      }
      return $label;
    }
    add_filter( 'ot_list_item_title_label', 'filter_list_item_title_label', 10, 2 );
  }
}


/**
------------------
MATCH METABOXES
------------------
*/
add_action( 'admin_init', 'yp_match_meta_boxes' );

if ( ! function_exists( 'yp_match_meta_boxes' ) ){
  
  function yp_match_meta_boxes() {
    //layout
    $meta_box = array(
      'id'        => 'match_custom_options',
      'title'     => 'Youplay Custom Options',
      'desc'      => '',
      'pages'     => array( 'match' ),
      'context'   => 'normal',
      'priority'  => 'high',
      'fields'    => array_merge(array(
        array(
          'id'          => 'tab_match_layout',
          'label'       => __('Layout', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'tab',
          'operator'    => 'and'
        ),
        array(
          'id'          => 'single_match_layout',
          'label'       => __('Layout','youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'radio-image',
          'class'       => '',
          'choices'     => getYouplayLayouts()
        ),
        array(
          'id'          => 'single_match_sidebar',
          'label'       => __('Sidebar', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'sidebar_select'
        ),
        array(
          'id'          => 'single_match_boxed_cont',
          'label'       => __('Boxed Content', 'youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'select',
          'choices'     => array(
            array(
              'value'       => 'default',
              'label'       => __('Default', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'on',
              'label'       => __('On', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'off',
              'label'       => __('Off', 'youplay'),
              'src'         => ''
            )
          )
        ),
        array(
          'id'          => 'single_match_comments',
          'label'       => __('Show Comments', 'youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'select',
          'choices'     => array(
            array(
              'value'       => 'default',
              'label'       => __('Default', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'on',
              'label'       => __('On', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'off',
              'label'       => __('Off', 'youplay'),
              'src'         => ''
            )
          )
        ),
        array(
          'id'          => 'single_match_revslider',
          'label'       => __('Use Revolution Slider', 'youplay'),
          'desc'        => 'Title will be hidden',
          'std'         => 'off',
          'type'        => 'on-off',
        ),
        array(
          'id'          => 'single_match_revslider_alias',
          'label'       => __('Slider', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'revslider-select',
        ),

        array(
          'id'          => 'tab_match_banner',
          'label'       => __('Banner', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'tab',
          'operator'    => 'and'
        ),
        array(
          'id'          => 'single_match_banner_image',
          'label'       => __('Image', 'youplay'),
          'desc'        => '',
          'std'         => yp_opts('single_match_banner_image'),
          'type'        => 'upload',
        ),
        array(
          'id'          => 'single_match_banner_image_cover',
          'label'       => __('Image Cover', 'youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'select',
          'choices'     => array(
            array(
              'value'       => 'default',
              'label'       => __('Default', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'on',
              'label'       => __('On', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'off',
              'label'       => __('Off', 'youplay'),
              'src'         => ''
            )
          )
        ),
        array(
          'id'          => 'single_match_banner_size',
          'label'       => __('Banner Size', 'youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'select',
          'choices'     => array(
            array(
              'value'       => 'default',
              'label'       => __('Default', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'full',
              'label'       => __('Full', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'mid',
              'label'       => __('Mid', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'small',
              'label'       => __('Small', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'xsmall',
              'label'       => __('Extra Small', 'youplay'),
              'src'         => ''
            )
          )
        ),
      ), getYouplayBackgroundMetabox())
    );
    
    if (function_exists('ot_register_meta_box')) {
      ot_register_meta_box( $meta_box );
    }
  }
}


/**
------------------
PRODUCT METABOXES
------------------
*/
add_action( 'admin_init', 'yp_product_meta_boxes' );

if ( ! function_exists( 'yp_product_meta_boxes' ) ){
  
  function yp_product_meta_boxes() {
    //layout
    $meta_box = array(
      'id'        => 'product_custom_options',
      'title'     => 'Youplay Custom Options',
      'desc'      => '',
      'pages'     => array( 'product' ),
      'context'   => 'normal',
      'priority'  => 'low',
      'fields'    => array_merge(array(
        array(
          'id'          => 'tab_product_layout',
          'label'       => __('Layout', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'tab',
          'operator'    => 'and'
        ),
        array(
          'id'          => 'single_product_layout',
          'label'       => __('Layout','youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'radio-image',
          'class'       => '',
          'choices'     => getYouplayLayouts()
        ),
        array(
          'id'          => 'single_product_sidebar',
          'label'       => __('Sidebar', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'sidebar_select'
        ),
        array(
          'id'          => 'single_product_boxed_cont',
          'label'       => __('Boxed Content', 'youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'select',
          'choices'     => array(
            array(
              'value'       => 'default',
              'label'       => __('Default', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'on',
              'label'       => __('On', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'off',
              'label'       => __('Off', 'youplay'),
              'src'         => ''
            )
          )
        ),
        array(
          'id'          => 'single_product_revslider',
          'label'       => __('Use Revolution Slider', 'youplay'),
          'desc'        => 'Title will be hidden',
          'std'         => 'off',
          'type'        => 'on-off',
        ),
        array(
          'id'          => 'single_product_revslider_alias',
          'label'       => __('Slider', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'revslider-select',
        ),

        array(
          'id'          => 'tab_product_banner',
          'label'       => __('Banner', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'tab',
          'operator'    => 'and'
        ),
      array(
        'id'          => 'textblock_product_banner',
        'label'       => '',
        'desc'        => __('Used Featured image', 'youplay'),
        'std'         => '',
        'type'        => 'textblock',
      ),
        array(
          'id'          => 'single_product_banner_image_cover',
          'label'       => __('Image Cover', 'youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'select',
          'choices'     => array(
            array(
              'value'       => 'default',
              'label'       => __('Default', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'on',
              'label'       => __('On', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'off',
              'label'       => __('Off', 'youplay'),
              'src'         => ''
            )
          )
        ),
        array(
          'id'          => 'single_product_banner_size',
          'label'       => __('Banner Size', 'youplay'),
          'desc'        => '',
          'std'         => 'default',
          'type'        => 'select',
          'choices'     => array(
            array(
              'value'       => 'default',
              'label'       => __('Default', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'full',
              'label'       => __('Full', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'mid',
              'label'       => __('Mid', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'small',
              'label'       => __('Small', 'youplay'),
              'src'         => ''
            ),
            array(
              'value'       => 'xsmall',
              'label'       => __('Extra Small', 'youplay'),
              'src'         => ''
            )
          )
        ),

        array(
          'id'          => 'tab_product_additional_params',
          'label'       => __('Aditional Parameters', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'tab',
          'operator'    => 'and'
        ),
        array(
          'id'          => 'single_product_additional_params',
          'label'       => __('Show Additional Params', 'youplay'),
          'desc'        => '',
          'std'         => 'off',
          'type'        => 'on-off',
        ),
        array(
          'id'          => 'single_product_additional_params_title',
          'label'       => __('Title', 'youplay'),
          'desc'        => '',
          'std'         => __('System Requirements', 'youplay'),
          'type'        => 'text',
        ),
        array(
          'id'          => 'single_product_additional_params_cont',
          'label'       => __('Content Text', 'youplay'),
          'desc'        => '',
          'std'         => '',
          'type'        => 'textarea',
        )
      ), getYouplayBackgroundMetabox())
    );
    
    if (function_exists('ot_register_meta_box')) {
      ot_register_meta_box( $meta_box );
    }
  }
}





/**
------------------
Custom Sidebars Option Type
------------------
*/
// Add custom sidebar select option
function youplay_add_sidebar_select_type( $array ) {
  $array['sidebar-select'] = 'Sidebar Select';
  return $array;
}
add_filter( 'ot_option_types_array', 'youplay_add_sidebar_select_type' );

// Show custom sidebar select option
function ot_type_sidebar_select( $args = array() ) {
  extract( $args );
  $has_desc = $field_desc ? true : false;
  echo '<div class="format-setting type-sidebar-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
  echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
    echo '<div class="format-setting-inner">';
      echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';

      /* get sidebar array */
      $sidebars = $GLOBALS['wp_registered_sidebars'];

      /* has sides */
      if ( ! empty( $sidebars ) ) {
        echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
        foreach ( $sidebars as $sidebar ) {
          echo '<option value="' . esc_attr( $sidebar['id'] ) . '"' . selected( $field_value, $sidebar['id'], false ) . '>' . esc_attr( $sidebar['name'] ) . '</option>';
        }
      } else {
        echo '<option value="">' . __( 'No Sidebars Found', 'option-tree' ) . '</option>';
      }
      echo '</select>';
    echo '</div>';
  echo '</div>';
}
?>