<?php
/*
Plugin Name: Wyde Core
Plugin URI: http://www.wydethemes.com
Description: Core Plugin for Wyde Themes
Version: 2.5.8
Author: Wyde
Author URI: http://www.wydethemes.com
*/

// Don't load directly
if ( ! defined( 'ABSPATH' ) ) {
	die( '-1' );
}

/**
 * Current Wyde Core plugin version
 */
if ( ! defined( 'WYDE_VERSION' ) ) {
	/**
	 *
	 */
	define( 'WYDE_VERSION', '2.5.8' );
}

if( !class_exists( 'Wyde_Core' ) ) {
	
	class Wyde_Core {

	    /**
	     * Unique identifier for your plugin.
	     *
	     * Use this value (not the variable name) as the text domain when internationalizing strings of text. It should
	     * match the Text Domain file header in the main plugin file.
	     *
	     * @since    1.0.0
	     *
	     * @var      string
	     */
	    protected $plugin_slug = 'wyde-core';

	    /**
	     * Instance of this class.
	     *
	     * @since    1.0.0
	     *
	     * @var      object
	     */
	    protected static $instance = null;
		
		/**
		 * This method adds other methods to specific hooks within WordPress.
		 *
		 * @since     1.0.0
		 */
		public function __construct() {
			$this->constants();
			$this->init();
		}

		/**
		 * Defines plugin constants
		 *
		 * @since     2.0.0
		 */
		function constants() {        	
        	define('WYDE_PLUGIN_DIR', plugin_dir_path(__FILE__));
        	define('WYDE_PLUGIN_URI', plugin_dir_url(__FILE__));
		}

		/**
		 * Initialize the plugin by setting localization and loading public scripts
		 *
		 * @since     1.0.0
		 */
		function init() {

        	add_action( 'init', array($this, 'register_post_types') );

        	add_action( 'plugins_loaded', array($this, 'load_wyde_core_text_domain'));

        	/** Redux Framework **/
			if (file_exists(WYDE_PLUGIN_DIR.'/inc/redux-framework/framework.php')) {
			    require_once( WYDE_PLUGIN_DIR.'/inc/redux-framework/framework.php' );
			}

			/** Metaboxes **/
			include_once WYDE_PLUGIN_DIR. '/inc/metaboxes/init.php';

			if( is_admin() ){
				/** Wyde Importer **/
				include_once WYDE_PLUGIN_DIR. '/inc/importer/class-wyde-importer.php';		
			}

			/** Mega Menu **/
			include_once WYDE_PLUGIN_DIR. '/inc/megamenu/class-wyde-mega-menu.php';
			
		}

	    /**
	     * Return an instance of this class.
	     *
	     * @since     1.0.0
	     *
	     * @return    object    A single instance of this class.
	     */
	    public static function get_instance() {

		    // If the single instance hasn't been set, set it now.
		    if ( null == self::$instance ) {
			    self::$instance = new self;
		    }

		    return self::$instance;
	    }

	    function load_wyde_core_text_domain() {
			load_plugin_textdomain( 'wyde-core', false, WYDE_PLUGIN_DIR . 'languages' );
		}

	    /**
		 * Register custom post types
		 *
		 * @since     1.0.0
		 */
		function register_post_types(){

		    $portfolio_slug = apply_filters('wyde_portfolio_slug', 'portfolio-item');

		    //Portfolio post type
		    register_post_type('wyde_portfolio',
				array(
					'labels' => array(
					    'name' 			=> __( 'Portfolios', 'wyde-core' ),
					    'singular_name' => __( 'Portfolio', 'wyde-core' ),
	                    'add_new' => __('Add New', 'wyde-core' ),
	                    'add_new_item' => __('Add New Portfolio', 'wyde-core'),
	                    'edit_item' => __('Edit Portfolio', 'wyde-core'),
	                    'new_item' => __('New Portfolio', 'wyde-core'),
	                    'view_item' => __('View Portfolios', 'wyde-core'),
	                    'menu_name' => __('Portfolios', 'wyde-core')
					),
					'public' => true,
					'has_archive' => false,
					'rewrite' => array(
					    'slug' => sanitize_title( $portfolio_slug ),
					    'with_front' => false,
					),
					'supports' => array( 'title', 'editor', 'thumbnail'),
					'can_export' => true,
		            'menu_icon' => 'dashicons-portfolio',
				)
			);

		    //Portfolio Category    
		    register_taxonomy('portfolio_category', 'wyde_portfolio', 
		        array(
		            'hierarchical' => true, 
		            'labels' => array(
	                    'name' => __('Portfolio Categories', 'wyde-core'),
	                    'singular_name' => __('Category', 'wyde-core'),
	                    'all_items' => __('All Categories', 'wyde-core' ),
	                    'edit_item' => __('Edit Category', 'wyde-core' ),
	                    'update_item' => __('Update Category', 'wyde-core' ),
	                    'add_new_item' => __('Add New Category', 'wyde-core' ),
	                    'new_item_name' => __('New Category', 'wyde-core' ),
		            ), 
		            'query_var' => true, 
		            'rewrite' => array(
					    'slug' => 'portfolio-category',
					    'with_front' => false,
				    ),
				    'show_admin_column' => true,
				    'sort' => true
		        )
		    );

		    //Portfolio Skill   
			register_taxonomy('portfolio_skill', 'wyde_portfolio', 
		        array(
		            'hierarchical' => true, 
		            'labels' => array(
	                    'name' =>  __('Portfolio Skills', 'wyde-core'),
	                    'singular_name' => __('Skill', 'wyde-core'),
	                    'all_items' => __('All Skills', 'wyde-core'),
	                    'edit_item' => __('Edit Skill', 'wyde-core'),
	                    'update_item' =>  __('Update Skill', 'wyde-core'),
	                    'add_new_item' => __('Add New Skill', 'wyde-core'),
	                    'new_item_name' => __('New Skill', 'wyde-core'),
		            ), 
		            'query_var' => true, 
		            'rewrite' => array(
					    'slug' => 'portfolio-skill',
					    'with_front' => false,
				    )
		        )
		    );
		            
		    //Portfolio Tags   
			register_taxonomy('portfolio_tag', 'wyde_portfolio', 
		        array(
		            'hierarchical' => false, 
		            'labels' => array(
		                'name' => __('Portfolio Tags', 'wyde-core'),
		                'singular_name' => __('Tag', 'wyde-core'),
		                'all_items' => __('All Tags', 'wyde-core'),
		                'edit_item' => __('Edit Tag', 'wyde-core'),
		                'update_item' => __('Update Tag', 'wyde-core'),
		                'add_new_item' => __('Add New Tag', 'wyde-core'),
		                'new_item_name' =>  __('New Tag', 'wyde-core'),
		            ), 
		            'query_var' => true, 
		            'rewrite' => array(
						'slug' => 'portfolio-tag',
						'with_front' => false,
				    )
		        )
		    );

			
		    //Testimonial 	
		    register_post_type('wyde_testimonial',
				array(
					'labels' => array(
						    'name' 			=> __( 'Testimonials', 'wyde-core' ),
						    'singular_name' => __( 'Testimonial', 'wyde-core' ),
		                    'add_new' => __('Add New', 'wyde-core' ),
		                    'add_new_item' => __('Add New Testimonial', 'wyde-core'),
		                    'edit_item' => __('Edit Testimonial', 'wyde-core'),
		                    'new_item' => __('New Testimonial', 'wyde-core'),
		                    'view_item' => __('View Testimonial', 'wyde-core'),
		                    'menu_name' => __('Testimonials', 'wyde-core')
					),
					'public' => true,
					'has_archive' => false,
					'rewrite' => array(
						    'slug' => 'testimonial-item'
					),
					'supports' => array( 'title'),
					'can_export' => true,
		            'exclude_from_search' => true,
		            'menu_icon' => 'dashicons-testimonial'
				)
			);
		            
		    //Testimonial Category
		    register_taxonomy('testimonial_category', 'wyde_testimonial', 
		        array(
		            'hierarchical' => true, 
		            'labels' => array(
		                    'name' => __('Testimonial Categories', 'wyde-core'),
		                    'singular_name' => __('Category', 'wyde-core'),
		                    'all_items' => __('All Categories', 'wyde-core' ),
		                    'edit_item' => __('Edit Category', 'wyde-core' ),
		                    'update_item' => __('Update Category', 'wyde-core' ),
		                    'add_new_item' => __('Add New Category', 'wyde-core' ),
		                    'new_item_name' => __('New Category', 'wyde-core' ),
		                ),
		            'query_var' => true, 
		            'rewrite' => true
		        )
		    );

		    //Team Member
		    register_post_type('wyde_team_member', 
		        array(
					'labels' => array(
					        'name' 					=> __('Team Members', 'wyde-core' ),
					        'singular_name' 		=> __('Team Member', 'wyde-core' ),
					        'add_new' 				=> __('Add New', 'wyde-core' ),
					        'add_new_item' 			=> __('Add New Team Member', 'wyde-core' ),
					        'edit_item' 			=> __('Edit Team Member', 'wyde-core' ),
					        'new_item' 				=> __('New Team Member', 'wyde-core' ),
					        'all_items' 			=> __('All Team Members', 'wyde-core' ),
					        'view_item' 			=> __('View Team Members', 'wyde-core' ),
					        'search_items' 			=> __('Search Team Members', 'wyde-core' ),
					        'parent_item_colon' 	=> '',
					        'menu_name' 			=> __( 'Team Members', 'wyde-core' )
		            ),
					'public'    => true,
					'has_archive'   => false,
					'supports'  => array('title'),
		            'exclude_from_search'   => true,
					'menu_icon' => 'dashicons-groups',
		            'rewrite'   => array(
						    'slug' => 'team-member'
					),
				)
		    );


		    //Team Member Category
		    register_taxonomy('team_member_category', 'wyde_team_member', 
		        array(
		            'hierarchical' => true, 
		            'labels' => array(
		                    'name' => __('Testimonial Categories', 'wyde-core'),
		                    'singular_name' => __('Category', 'wyde-core'),
		                    'all_items' => __('All Categories', 'wyde-core' ),
		                    'edit_item' => __('Edit Category', 'wyde-core' ),
		                    'update_item' => __('Update Category', 'wyde-core' ),
		                    'add_new_item' => __('Add New Category', 'wyde-core' ),
		                    'new_item_name' => __('New Category', 'wyde-core' ),
		                ),
		            'query_var' => true, 
		            'rewrite' => true
		        )
		    );
		        
		}

	

	}

// Instantiate the class
$wyde_core = new Wyde_Core();

}