<?php
/**
 * Main Settings
 *
 * @package     Wow_Plugin
 * @copyright   Copyright (c) 2018, Dmytro Lobov
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since       1.0
 */


$tax_args   = array(
	'public'   => true,
	'_builtin' => false
);
$output     = 'names';
$operator   = 'and';
$taxonomies = get_taxonomies( $tax_args, $output, $operator );

$show_option = array(
	'all'        => esc_attr__( 'All posts and pages', 'side-menu' ),
	'onlypost'   => esc_attr__( 'All posts', 'side-menu' ),
	'onlypage'   => esc_attr__( 'All pages', 'side-menu' ),
	'posts'      => esc_attr__( 'Posts with certain IDs', 'side-menu' ),
	'pages'      => esc_attr__( 'Pages with certain IDs', 'side-menu' ),
	'postsincat' => esc_attr__( 'Posts in Categorys with IDs', 'side-menu' ),
	'expost'     => esc_attr__( 'All posts. except...', 'side-menu' ),
	'expage'     => esc_attr__( 'All pages, except...', 'side-menu' ),
	'shortecode' => esc_attr__( 'Where shortcode is inserted', 'side-menu' ),
);
if ( $taxonomies ) {
	$show_option['taxonomy'] = esc_attr__( 'Taxonomy', 'side-menu' );
}

$show = array(
	'id'     => 'show',
	'name'   => 'param[show]',
	'type'   => 'select',
	'val'    => isset( $param['show'] ) ? $param['show'] : 'all',
	'option' => $show_option,
	'func'   => 'showchange(this);',
	'sep'    => 'p',
);

$show_help = array(
	'text' => esc_attr__( 'Choose a condition to target to specific content.', 'side-menu' ),
);

// Taxonomy
$taxonomy_option = array();
if ( $taxonomies ) {
	foreach ( $taxonomies as $taxonomy ) {
		$taxonomy_option[ $taxonomy ] = $taxonomy;
	}
}

$taxonomy = array(
	'id'     => 'taxonomy',
	'name'   => 'param[taxonomy]',
	'type'   => 'select',
	'val'    => isset( $param['taxonomy'] ) ? $param['taxonomy'] : '',
	'option' => $taxonomy_option,
	'sep'    => 'p',
);

// Content ID'sa
$id_post = array(
	'id'     => 'id_post',
	'name'   => 'param[id_post]',
	'type'   => 'text',
	'val'    => isset( $param['id_post'] ) ? $param['id_post'] : '',
	'option' => array(
		'placeholder' => esc_attr__( 'Enter IDs, separated by comma.', 'side-menu' ),
	),
	'sep'    => 'p',
);