<?php
/**
 *
 *                              66666666           66666666
 *                             6::::::6           6::::::6
 *                            6::::::6           6::::::6
 *                           6::::::6           6::::::6
 *        ooooooooooo       6::::::6           6::::::6
 *      oo:::::::::::oo    6::::::6           6::::::6
 *     o:::::::::::::::o  6::::::6           6::::::6
 *     o:::::ooooo:::::o 6::::::::66666     6::::::::66666
 *     o::::o     o::::o6::::::::::::::66  6::::::::::::::66
 *     o::::o     o::::o6::::::66666:::::6 6::::::66666:::::6
 *     o::::o     o::::o6:::::6     6:::::66:::::6     6:::::6
 *     o::::o     o::::o6:::::6     6:::::66:::::6     6:::::6
 *     o:::::ooooo:::::o6::::::66666::::::66::::::66666::::::6
 *     o:::::::::::::::o 66:::::::::::::66  66:::::::::::::66
 *      oo:::::::::::oo    66:::::::::66      66:::::::::66
 *
 */
//     Did you ever hear the Tragedy of Darth Plagueis the Wise?
//TODO refactoring html functions, make a "addToTheme" function that add a string to render if not empty, and do better
// varifications with html5 function/view class. We dont want empty html at all, never, never. NEVER.

function throw_o66_error ($error_string) {
	echo '<div style="">'.$error_string.'</div>';
	exit;
}

require_once  get_stylesheet_directory().'/init/site-settings.php';

//first loads constants and enumerators like classes, applications index
include('o66coreImageSizes.php');
require_once get_stylesheet_directory().'/o66-core/classes/abstractEnums.php';
require_once get_stylesheet_directory().'/applications/index.php';

//then classes, order is important, huh!

require_once get_stylesheet_directory().'/o66-core/classes/OneModelClass.php';
require_once get_stylesheet_directory().'/o66-core/classes/o66TheModelClass.php';
require_once get_stylesheet_directory().'/o66-core/classes/o66TheViewClass.php';
require_once get_stylesheet_directory().'/o66-core/functions/model-functions.php';
require_once get_stylesheet_directory().'/o66-core/functions/view-functions.php';

//include('system/systemCpt.php');
//include('system/systemFunc.php');
//include('o66coreCpt.php'); post type mario

//CORE POST TYPES, LABEL
require_once('o66coreAcf.php');


//ACF GOOGLE MAPS API

//TODO REFACTORING IN site settings
function acf_google_api_key() {
// API per marcocavallaro.net
	acf_update_setting('google_api_key', 'AIzaSyB9cpdtTdzk1-uPb_ieD3Y5ZBd-SsElU9Y');
}

add_action('acf/init', 'acf_google_api_key');

// Add info page
//add_action( 'admin_menu', 'o66systemInfoAction' );

//include ('o66systemClass.php');
//include ('o66mediaClass.php');
//include ('o66pageClass.php');

//include ('o66appsInit.php');

//function o66systemInfoAction() {
//    add_options_page( 'O66 - System', 'O66 - System', 'manage_options', 'o66/system.php', 'o66systemInfo', 'dashicons-list-view',30);
//    // add_submenu_page( 'myplugin/myplugin-admin-page.php', 'My Sub Level Menu Example', 'Sub Level Menu', 'manage_options', 'myplugin/myplugin-admin-sub-page.php', 'myplguin_admin_sub_page' );
//}
//include('admin/o66systemInfo.php');
//include('o66cf7Init.php');

//TODO CHE è? PERCHè?
function acfRepStart($contentm, $repeater_id, $postIdwp)
{
	if( have_rows('repeater_field_name') )
	{
		echo $contentm;
	}

}

require_once ('o66fs-wp-acf-options-pages.php');
//TODO REFACTORARE IN VISTA DI ELEMENTS E VIEWS
require_once( 'functions/o66fs-wp-template-tags.php' );
require_once get_stylesheet_directory().'/applications/contact_form/contact_form.php';

////include('o66wpMenuWalker.php');
//function renderMenu(  )
////function renderMenu($theme_location,$container_id,$conatiner_class  )
//{wp_nav_menu( array(
//    'theme_location'    => 'navigation_menu_primary',
//    'container'     => 'nav',
//    'container_id'      => 'top-navigation-primary',
//    'conatiner_class'   => 'top-navigation',
//    'menu_class'        => 'menu main-menu menu-depth-0 menu-even',
//    'echo'          => true,
//    'items_wrap'        => '<ul id="%1$s" class="%2$s o66RenderMenu">%3$s</ul>',
//    'depth'         => 10,
//    'walker'        => new o66_walker_nav_menu()
//) );}