<?php
/*
* Variable usages:
*
* BREEK_LITE_ABSPATH: template folder, includes files inside the theme
* BREEK_LITE_THEMEPATH: includes relative file by http prottocol (url)
* BREEK_LITE_THEMEPREFIX:  Used for metaboxes and theme options panel. Must be equal to text domain.
* BREEK_LITE_FRAMEWORK_VAR: Used to storage information into wp database global variable, eg: $breek_lite_theme['carousel_category'].
*
*/

if( !defined('BREEK_LITE_ABSPATH') ) define('BREEK_LITE_ABSPATH', get_template_directory() );
if( !defined('BREEK_LITE_THEMEPATH') ) define('BREEK_LITE_THEMEPATH', get_template_directory_uri() );
if( !defined('BREEK_LITE_THEMEPREFIX') ) define('BREEK_LITE_THEMEPREFIX', 'breek-lite'); // Do not change
if( !defined('BREEK_LITE_FRAMEWORK_VAR') ) define('BREEK_LITE_FRAMEWORK_VAR', 'breek_lite_theme'); // Do not change
if( !defined('BREEK_LITE_THEMENAME') ) define('BREEK_LITE_THEMENAME', 'Breek' );
if( !defined('BREEK_LITE_THEMESLUG') ) define('BREEK_LITE_THEMESLUG', 'breek-lite' ); // Do not change

if( !isset($content_width) ) $content_width = 720; // oembed width


/* Main class function for all Estudio Patagon themes, avoids plugins errors with a unique name  */

if( !class_exists('BREEK_LITE_Theme_Setup') ) {

	class BREEK_LITE_Theme_Setup {

		public function __construct() {

			/* Theme Includes */

			add_action('after_setup_theme', array( $this, 'includes' ), 4 );

			/* Main Theme Options */

            add_action('after_setup_theme', array( $this, 'theme_support') );

		}

		public function includes(){

			/* Main Includes */

            require_once(BREEK_LITE_ABSPATH.'/functions/enqueue-scripts.php');
			require_once(BREEK_LITE_ABSPATH.'/functions/custom-styles.php');
            require_once( get_theme_file_path('functions/theme-functions.php') ); // Specific functions for this particular theme
            require_once(BREEK_LITE_ABSPATH.'/functions/core.php'); // Common functions for all EP themes 
            require_once(BREEK_LITE_ABSPATH.'/functions/tgmpa/recommended-plugins.php'); // Recommended plugins

            /* WordPress.org Features */

            require_once( get_theme_file_path('functions/social-buttons.php') ); 
            require_once( BREEK_LITE_ABSPATH.'/functions/customizer/init.php' );

        }

		public function theme_support(){

			/* Languages */

			load_theme_textdomain('breek-lite', BREEK_LITE_ABSPATH.'/languages');

			/* Thumbs */

			if( function_exists('add_theme_support') ){
				add_theme_support('post-thumbnails');
				add_theme_support('automatic-feed-links');
				add_theme_support('html5', array( 'style', 'script' ) );
                add_theme_support('title-tag');
                add_theme_support('responsive-embeds');

				$prefix = BREEK_LITE_THEMEPREFIX.'_';

                add_image_size($prefix.'loop_grid', 550, 350, true);

			}

			/* Menus */

			register_nav_menus(array(
				'breek_lite_header' => esc_html__('Header', 'breek-lite')
			));

			/* Register Sidebars */

            require_once( get_theme_file_path('functions/sidebars.php') );

        }       

	}

	new BREEK_LITE_Theme_Setup();
}