<?php
/**
 *  Plugin Name: DVC Core
 *  Plugin URI: http://clarknikdelpowell.com
 *  Version: 1.4.11
 *  Description: Core functionality for a client site
 *  Author: Glenn Welser, Sam Mello & Josh Nederveld
 *  Author URI: http://clarknikdelpowell.com/agency/people/
 *
 *  Copyright 2014+ Clark/Nikdel/Powell
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License, version 2 (or later),
 *  as published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * @package ClientCore
 */

use CNP\PostTypeTrivia;

/* Global Variables */

use CNP\ListingPostType;

define( 'SITE_LOCAL', ( 'localhost' == $_SERVER['SERVER_NAME'] || '127.0.0.1' == $_SERVER['SERVER_NAME'] ) );
define( 'SITE_PATH', plugin_dir_path( __FILE__ ) );
define( 'SITE_URL', SITE_LOCAL ? plugins_url() . '/Client-Core/' : plugin_dir_url( __FILE__ ) );


/* Classes Required To Function */
require_once SITE_PATH . 'class.ClientCore.php';
require_once SITE_PATH . 'class.CustomFields.php';
require_once SITE_PATH . 'class.ClientPosts.php';
require_once SITE_PATH . 'class.ListingPostType.php';
require_once SITE_PATH . 'class.PostTypeTrivia.php';
require_once SITE_PATH . 'class.QuoteToolSettings.php';

/*
Settings for Client Core:

- options_page 			= 	Whether to generate an options page for CNP settings & ACF
- post_formats 			= 	Extra post formats to add
- custom_image_sizes 	= 	Custom image sizes to create
- add_post_types 		= 	Array of post types to add (public function "register" can also be used to override default settings)
- add_taxonomies        =   Array of taxonomies to add
- remove_post_types 	= 	Array of pages to hide in the admin section
- add CSS               =   Admin-specific CSS to add
- add JS                =   Admin-specific JS to add
- p2p_connections       =   Post 2 Post connections registration - @see https://github.com/scribu/wp-posts-to-posts/wiki/p2p_register_connection_type

Feel free to remove option keys below that you don't need. They are just listed there for example.

*/

$settings = array(
	'options_pages'      => array(
		'cnp_settings'       => array(
			'display'    => true,
			'page_title' => 'CNP Settings',
			'menu_title' => 'CNP Settings',
			'menu_slug'  => 'cnp-settings',
			'capability' => 'activate_plugins',
			'icon_url'   => 'dashicons-wordpress',
			'redirect'   => false,
		),
		'slideshow_settings' => array(
			'display'    => true,
			'page_title' => 'Slideshow Settings',
			'menu_title' => 'Slideshow Settings',
			'menu_slug'  => 'cnp-slideshow-settings',
			'capability' => 'activate_plugins',
			'icon_url'   => 'dashicons-images-alt2',
			'redirect'   => false,
		),
	),
	'post_formats'       => array(/*
		'video'
	,	'gallery'
		*/
	),
	'custom_image_sizes' => array(
		'small'        => array(
			'x' => 120,
			'y' => 120,
		),
		'medium-small' => array(
			'x' => 480,
			'y' => 480,
		),
		'90x90_review' => array(
			'x'    => 90,
			'y'    => 90,
			'crop' => array( 'center', 'center' ),
		),
		'85x85_blog'   => array(
			'x'    => 85,
			'y'    => 85,
			'crop' => array( 'center', 'center' ),
		),
	),
	'add_post_types'     => array(
		array(
			'name'     => 'room',
			'plural'   => 'rooms',
			'icon'     => 'dashicons-admin-network',
			'supports' => array( 'title', 'excerpt' ),
			'labels'   => array(
				'name'          => 'Rooms',
				'singular_name' => 'Room',
			),
			'args'     => array(
				'menu_position' => 7,
				'hierarchical'  => false,
				'has_archive'   => false,
				'public'        => false,
				'show_ui'       => true,
				'rewrite'       => false,
			),
		),
		array(
			'name'     => 'listing',
			'plural'   => 'listings',
			'icon'     => 'dashicons-building',
			'supports' => array( 'title', 'revisions' ),
			'labels'   => array(
				'name'          => 'Listings',
				'singular_name' => 'Listing',
			),
			'args'     => array(
				'menu_position' => 5,
				'hierarchical'  => false,
				'has_archive'   => 'listings',
				'rewrite'       => array(
					'with_front' => false,
					'pages'      => false,
					'slug'       => 'listing',
				),
			),
		),
		array(
			'name'     => 'chart',
			'plural'   => 'charts',
			'icon'     => 'dashicons-chart-bar',
			'supports' => array( 'title' ),
			'labels'   => array(
				'name'          => 'Point Charts',
				'singular_name' => 'Point Chart',
			),
			'args'     => array(
				'menu_position' => 5,
				'hierarchical'  => false,
				'has_archive'   => 'charts',
				'rewrite'       => array(
					'with_front' => false,
					'pages'      => false,
					'slug'       => 'point-chart',
				),
			),
		),
		array(
			'name'     => 'resort',
			'plural'   => 'resorts',
			'icon'     => 'dashicons-palmtree',
			'supports' => array( 'title' ),
			'labels'   => array(
				'name'          => 'Resorts',
				'singular_name' => 'Resort',
			),
			'args'     => array(
				'menu_position' => 6,
				'hierarchical'  => true,
				'has_archive'   => false,
				'rewrite'       => array(
					'with_front' => false,
					'pages'      => false,
					'slug'       => 'listings',
				),
			),
		),
		array(
			'name'     => 'subscriber',
			'plural'   => 'subscribers',
			'icon'     => 'dashicons-groups',
			'supports' => array( 'title' ),
			'labels'   => array(
				'name'          => 'Daily Listing Subscribers',
				'singular_name' => 'Daily Listing Subscriber',
			),
			'args'     => array(
				'menu_position'      => 7,
				'public'             => false,
				'hierarchical'       => false,
				'publicly_queryable' => false,
				'has_archive'        => false,
				'show_ui'            => true,
				'show_in_menu'       => true,
				'show_in_nav_menus'  => false,
			),
		),
		array(
			'name'     => 'newsletter',
			'plural'   => 'newsletter',
			'icon'     => 'dashicons-groups',
			'supports' => array( 'title' ),
			'labels'   => array(
				'name'          => 'Newsletter Subscribers',
				'singular_name' => 'Newsletter Subscriber',
			),
			'args'     => array(
				'menu_position'      => 6,
				'public'             => false,
				'hierarchical'       => false,
				'publicly_queryable' => false,
				'has_archive'        => false,
				'show_ui'            => true,
				'show_in_menu'       => true,
				'show_in_nav_menus'  => false,
			),
		),
		array(
			'name'     => 'review',
			'plural'   => 'reviews',
			'icon'     => 'dashicons-thumbs-up',
			'supports' => array( 'title', 'thumbnail' ),
			'labels'   => array(
				'name'          => 'Reviews',
				'singular_name' => 'Review',
			),
			'args'     => array(
				'menu_position'       => 8,
				'hierarchical'        => false,
				'publicly_queryable'  => true,
				'exclude_from_search' => false,
				'has_archive'         => true,
				'show_in_nav_menus'   => false,
				'rewrite'             => array(
					'with_front' => false,
					'pages'      => true,
					'slug'       => 'about-us/dvc-resale-market-reviews',
				),
			),
		),
		array(
			'name'     => 'agent',
			'plural'   => 'agents',
			'icon'     => 'dashicons-businessman',
			'supports' => array( 'title', 'excerpt', 'editor', 'thumbnail' ),
			'labels'   => array(
				'name'          => 'Team',
				'singular_name' => 'Team',
			),
			'args'     => array(
				'menu_position'       => 9,
				'hierarchical'        => true,
				'publicly_queryable'  => true,
				'exclude_from_search' => false,
				'has_archive'         => true,
				'show_in_nav_menus'   => false,
				'rewrite'             => array(
					'with_front' => false,
					'pages'      => false,
					'slug'       => 'about-us/team',
				),
			),
		),
		array(
			'name'     => 'trivia',
			'icon'     => 'dashicons-editor-help',
			'supports' => array( 'title' ),
			'labels'   => array(
				'name' => 'Trivia',
			),
			'args'     => array(
				'menu_position'       => 9,
				'hierarchical'        => false,
				'publicly_queryable'  => false,
				'exclude_from_search' => true,
				'has_archive'         => false,
				'show_in_nav_menus'   => false,
				'rewrite'             => false,
				'show_ui'             => true,
			),
		),
	),
	'add_taxonomies'     => array(
		'statuses' => array(
			'objects' => array( 'listing' ),
			'args'    => array(
				'public'                => false,
				'show_admin_column'     => false,
				'show_ui'               => true,
				'show_in_menus'         => true,
				'show_tagcloud'         => true,
				'hierarchical'          => false,
				'update_count_callback' => '_update_generic_term_count',
			),
			'labels'  => array(
				'name'                  => 'Statuses',
				'singular_name'         => 'Status',
				'menu_name'             => 'Statuses',
				'all_items'             => 'All Statuses',
				'edit_item'             => 'Edit Status',
				'view_item'             => 'View Status',
				'update_item'           => 'Update Status',
				'add_new_item'          => 'Add Status',
				'new_item_name'         => 'New Status',
				'search_items'          => 'Search Statuses',
				'popular_items'         => 'Popular Statuses',
				'add_or_remove_items'   => 'Add or Remove Status',
				'choose_from_most_used' => 'Most Used Statuses',
				'not_found'             => 'No Statuses Found',
			),
		),
	),
	'remove_post_types'  => array(/*
		'edit.php'
		*/
	),
	'add_sidebars'       => array(
		'buying-sidebar'   => array(
			'name'         => __( 'Buying Sidebar', 'dvc' ),
			'id'           => 'buying-sidebar',
			'before_title' => '<h4 class="widget__title">',
			'after_title'  => '</h4>',
		),
		'listings-sidebar' => array(
			'name'         => __( 'Listings Sidebar', 'dvc' ),
			'id'           => 'listings-sidebar',
			'before_title' => '<h4 class="widget__title">',
			'after_title'  => '</h4>',
		),
		'reviews-sidebar'  => array(
			'name'         => __( 'Reviews Sidebar', 'dvc' ),
			'id'           => 'reviews-sidebar',
			'before_title' => '<h4 class="widget__title">',
			'after_title'  => '</h4>',
		),
	),
	'add_css'            => array(
		// 'name' => 'filename.css'
	),
	'add_js'             => array(
		// 'name' => 'filename.css'
	),
	'p2p_connections'    => array(
		// array(
		// 'name'       => '',
		// 'from'       => '',
		// 'to'         => '',
		// 'reciprocal' => true,
		// 'sortable'   => 'any',
		// 'title'      => array(
		// 'from' => '',
		// 'to'   => '',
		// ),
		// ),
	),
);

/* Core Class Called (parent to all other classes) */
$client_core = new ClientCore( $settings );

// $client_posts = new ClientPosts( $posts_settings );

$cnp_listing_post_type = new ListingPostType();
$cnp_post_type_trivia = new PostTypeTrivia();
