<?php 
defined('_JEXEC') or die();

/**
 * @package		Joomla Bamboo Zen Grid Framework
 * @Type        Core Framework Files
 * @version		v1.1
 * @author		Joomlabamboo http://www.joomlabamboo.com
 * @copyright 	Copyright (C) 2007 - 2010 Joomla Bamboo
 * @license		http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
 */

$doc = JFactory::getDocument();



/**
 * Array and logic for dealing with Google fonts and sending the values to the google font code at the bottom of the index.php file
 *
 * Zen Grid Framework v1.1
 *  
 */

	$googleFonts = array(
		"Bevan" => "Bevan",
		"Cantarell" => "Cantarell",
		"CrimsonText" => "Crimson Text",
		"Cardo" => "Cardo",
		"IMFellGreatPrimer" => "IM Fell Great Primer",
		"Inconsolata" => "Inconsolata",
		"Josefin" => "Josefin Sans",
		"JosefinSlab" => "Josefin Slab",
		"Lobster" => "Lobster",
		"Molengo" => "Molengo",
		"Nobile" => "Nobile",
		"OFLSorts" => "OFL Sorts Mill Goudy TT",
		"DroidSans" => "Droid Sans",
		"DroidSansMono" => "Droid Sans Mono",
		"OldStandard" => "Old Standard TT",
		"ReenieBeanie" => "Reenie Beanie",
		"Tangerine" => "Tangerine",
		"Vollkorn" => "Vollkorn",
		"Yanone" => "Yanone Kaffeesatz",
		'Arvo' => 'Arvo', 
		'Neucha' => 'Neucha',
		'Cuprum' => 'Cuprum',
		'Neuton' => 'Neuton',
		'Philosopher' => 'Philosopher',
		'Tinos' => 'Tinos',
		'Arimo' => 'Arimo',
		'Cousine' => 'Cousine',
		'Allerta' => 'Allerta',
		'Geo' => 'Geo',
		'AllertaStencil' => 'Allerta Stencil',
		'Puritan' => 'Puritan',
		'Bentham' => 'Bentham',
		'CherryCreamSoda' => 'Cherry Cream Soda',
		'PermanentMarker' => 'Permanent Marker',
		'Slackey' => 'Slackey',
		'FontdinerSwanky' => 'Fontdiner Swanky',
		'Sunshiney' => 'Sunshiney',
		'IrishGrowler' => 'Irish Growler',
		'Schoolbell' => 'Schoolbell',
		'Chewy' => 'Chewy',
		'HomemadeApple' => 'Homemade Apple',
		'Kranky' => 'Kranky',
		'Crushed' => 'Crushed',
		'CraftyGirls' => 'Crafty Girls',
		'Calligraffitti' => 'Calligraffitti',
		'Orbitron' => 'Orbitron',
		'RockSalt' => 'Rock Salt',
		'Lekton' => 'Lekton',
		'Lato' => 'Lato',
		'Gruppo' => 'Gruppo',
		'Vibur' => 'Vibur',
		'Syncopate' => 'Syncopate',
		'Raleway' => 'Raleway:100',
		'JustMeAgainDownHere' => 'Just Me Again Down Here',
		'Sniglet' => 'Sniglet:800',
		'MountainsOfChristmas' => 'Mountains+of+Christmas',
		'LuckiestGuy' => 'Luckiest Guy',
		'Corben' => 'Corben:bold',
		'Cabin' => 'Cabin:bold',
		"DroidSerif" => "Droid Serif",
		"EBGaramond" => "EB Garamond",
		"GoudyBookletter " => "Giudy Bookletter",
		"Kreon" => "Kreon",
		"MaidenOrange" => "Maiden Orange",
		"Merriweather" => "Merriweather",
		"PTSerif" => "PT Serif",
		"Quattrocento" => "Quattrocentro",
		"Radley" => "Radley",
		"Allerta" => "Allerta",
		"AnonymousPro" => "Anonymous Pro",
		"Anton" => "Anton",
		"Buda" => "Buda:light",
		"Candal" => "Candal",
		"Coda" => "Coda:800",
		"Kenia" => "Kenia",
		"Michroma" => "Michroma",
		"Oswald" => "Oswald",
		"PTSans" => "PT Sans",
		'Pacifico' => 'Pacifico',
		"Puritan" => "Puritan",
		"QuattrocentoSans" => "Quattrocento Sans",
		"SixCaps" => "Six Caps",	
		"Syncopate" => "Syncopate",
		"TerminalDosisLight" => "Terminal Dosis Light",
		"Ubuntu" => "Ubuntu",
		"AnnieUseYourTelescope" => "Annie Use Your Telescope",
		"ArchitectsDaughter" => "Architects Daughter",
		"ComingSoon" => "Coming Soon",
		"CoveredByYourGrace" => "Covered By Your Grace",
		"DancingScript" => "Dancing Script",
		"DawningofaNewDay" => "Dawning of a New Day",
		"IndieFlower" => "Indie Flower",
		"JustAnotherHand" => "Just Another Hand",
		"Kristi" => "Kristi",
		"Meddon" => "Meddon",
		"Slackey" => "Slackey",
		"SueEllenFrancisco" => "Sue Ellen Francisco",
		"TheGirlNextDoor" => "The Girl Next Door",
		"WaitingfortheSunrise" => "Waiting for the Sunrise",
		"WalterTurncoat" => "Walter Turncoat",
		"Allan" => "Allan:bold",
		"Astloch" => "Astloch",
		"Bangers" => "Bangers",
		"CabinSketch" => "Cabin Sketch:bold",
		"Copse" => "Copse",
		"ExpletusSans" => "Expletus Sans",
		"LeagueScript" => "League Script",	
		"Lobster" => "Lobster",
		"LuckiestGuy" => "Luckiest Guy",
		"MedievalSharp" => "MedievalSharp",
		"Miltonian" => "Miltonian",
		"MountainsOfChristmas" => "Mountains of Christmas",
		"Nova" => "Nova Round",
		"Smythe" => "Smythe",
		"SpecialElite" => "Special Elite",
		"UnifrakturCook" => "UnifrakturCook:bold",
		"UnifrakturMaguntia" => "UnifrakturMaguntia",
		"Unkempt" => "Unkempt",
		"VT323"	 => "VT323",
		"SwankyandMooMoo" => "Swanky and Moo Moo",
		"OvertheRainbow" => "Over the Rainbow",
		"Wallpoet" => "Wallpoet",
		"Damion" => "Damion",
		"Aclonica" => "Aclonica",
		"NewsCycle" => "News Cycle",
		"CedarvilleCursive" => "Cedarville Cursive",
		"Zeyada" => "Zeyada",
		"Kameron" => "Kameron",
		"ShadowsIntoLight" => "Shadows Into Light",
		"LaBelleAurore" => "La Belle Aurore",
		"Lora" => "Lora",
		"Artifika" => "Artifika",
		"WireOne" => "Wire One",
		"Muli" => "Muli",
		"TenorSans" => "Tenor Sans",
		"MavenPro" => "Maven Pro",
		"Limelight" => "limelight",
		"Nunito" => "Nunito",
		"PlayfairDisplay" => "Playfair Display"
	);
	
	
	// Swaps out the correct values to render the correct files from the google api.
	$fontreplaceBody = array_key_exists($fontStackBody,$googleFonts) ? $googleFonts[$fontStackBody] : '';
	$fontreplaceNav = array_key_exists($fontStackNav,$googleFonts) ? $googleFonts[$fontStackNav] : '';
	$fontreplaceHeading = array_key_exists($fontStackHeading,$googleFonts) ? $googleFonts[$fontStackHeading] : '';

	if ($logoType =="text") {
		$fontreplaceLogo = array_key_exists($fontStackLogo,$googleFonts) ? $googleFonts[$fontStackLogo] : '';
	}
	elseif ($logoType =="image") {
		$fontreplaceLogo ="";	
	}



/**
 * Array for creating the font.css file
 *
 * Zen Grid Framework v1.1
 *  
 */
		$fontCss = array(
			"courier" => "Courier new, Courier, Andale Mono",
			"helvetica" => "Helvetica Neue, Helvetica, Arial, sans-serif",
			"baskerville" => "Baskerville, Palatino, Palatino Linotype, Georgia, Serif",
			"geneva" => "Geneva, Lucida Sans, Lucida Grande, Lucida Sans Unicode, Verdana, sans-serif",
			"gillsans" => "GillSans, Calibri, Trebuchet, arial sans-serif",
			"cambria" => "Cambria, Georgia, Times, Times New Roman, serif",
			"lucida" => "Lucida Grande, Geneva, Helvetica, sans-serif",
			"caslon" => "Adobe Caslon Pro, Georgia, Garamond, Times, serif",
			"tahoma" => "Tahoma, Verdana, Geneva",
			"trebuchet" => "trebuchet ms, Tahoma, Arial, sans-serif",
			"palatino" => "Palatino, Palatino Linotype, Hoefler Text, Times, Times New Roman, serif",
			"georgia" => "Georgia, Times, Times New Roman, serif",
			"garamond" => "Garamond, Hoefler Text, Times New Roman, Times, serif",
				"Bevan" => "Bevan",
				"Cantarell" => "Cantarell",
				"CrimsonText" => "Crimson Text",
				"Cardo" => "Cardo",
				"IMFellGreatPrimer" => "IM Fell Great Primer",
				"Inconsolata" => "Inconsolata",
				"Josefin" => "Josefin Sans",
				"JosefinSlab" => "Josefin Slab",
				"Lobster" => "Lobster",
				"Molengo" => "Molengo",
				"Nobile" => "Nobile",
				"OFLSorts" => "OFL Sorts Mill Goudy TT",
				"DroidSans" => "Droid Sans",
				"DroidSansMono" => "Droid Sans Mono",
				"OldStandard" => "Old Standard TT",
				"ReenieBeanie" => "Reenie Beanie",
				"Tangerine" => "Tangerine",
				"Vollkorn" => "Vollkorn",
				"Yanone" => "Yanone Kaffeesatz",
				'Arvo' => 'Arvo', 
				'Neucha' => 'Neucha',
				'Cuprum' => 'Cuprum',
				'Neuton' => 'Neuton',
				'Philosopher' => 'Philosopher',
				'Tinos' => 'Tinos',
				'Arimo' => 'Arimo',
				'Cousine' => 'Cousine',
				'Allerta' => 'Allerta',
				'Geo' => 'Geo',
				'AllertaStencil' => 'Allerta Stencil',
				'Puritan' => 'Puritan',
				'Bentham' => 'Bentham',
				'CherryCreamSoda' => 'Cherry Cream Soda',
				'PermanentMarker' => 'Permanent Marker',
				'Slackey' => 'Slackey',
				'FontdinerSwanky' => 'Fontdiner Swanky',
				'Sunshiney' => 'Sunshiney',
				'IrishGrowler' => 'Irish Growler',
				'Schoolbell' => 'Schoolbell',
				'Chewy' => 'Chewy',
				'HomemadeApple' => 'Homemade Apple',
				'Kranky' => 'Kranky',
				'Crushed' => 'Crushed',
				'CraftyGirls' => 'Crafty Girls',
				'Calligraffitti' => 'Calligraffitti',
				'Orbitron' => 'Orbitron',
				'Pacifico' => 'Pacifico',
				'RockSalt' => 'Rock Salt',
				'Lekton' => 'Lekton',
				'Lato' => 'Lato',
				'Gruppo' => 'Gruppo',
				'Vibur' => 'Vibur',
				'Syncopate' => 'Syncopate',
				'Raleway' => 'Raleway',
				'JustMeAgainDownHere' => 'Just Me Again Down Here',
				'Sniglet' => 'Sniglet',
				'MountainsOfChristmas' => 'Mountains+of+Christmas',
				'LuckiestGuy' => 'Luckiest Guy',
				'Corben' => 'Corben',
				'Cabin' => 'Cabin',
				"DroidSerif" => "Droid Serif",
				"EBGaramond" => "EB Garamond",
				"GoudyBookletter1911" => "Giudy Bookletter",
				"Kreon" => "Kreon",
				"MaidenOrange" => "Maiden Orange",
				"Merriweather" => "Merriweather",
				"PTSerif" => "PT Serif",
				"Quattrocento" => "Quattrocentro",
				"Radley" => "Radley",
				"Allerta" => "Allerta",
				"AnonymousPro" => "Anonymous Pro",
				"Anton" => "Anton",
				"Buda" => "Buda",
				"Candal" => "Candal",
				"Coda" => "Coda",
				"Kenia" => "Kenia",
				"Michroma" => "Michroma",
				"Oswald" => "Oswald",
				"PTSans" => "PT Sans",
				"Puritan" => "Puritan",
				"QuattrocentoSans" => "Quattrocento Sans",
				"SixCaps" => "Six Caps",	
				"Syncopate" => "Syncopate",
				"TerminalDosisLight" => "Terminal Dosis Light",
				"Ubuntu" => "Ubuntu",
				"AnnieUseYourTelescope" => "Annie Use Your Telescope",
				"ArchitectsDaughter" => "Architects Daughter",
				"ComingSoon" => "Coming Soon",
				"CoveredByYourGrace" => "Covered By Your Grace",
				"DancingScript" => "Dancing Script",
				"DawningofaNewDay" => "Dawning of a New Day",
				"IndieFlower" => "Indie Flower",
				"JustAnotherHand" => "Just Another Hand",
				"Kristi" => "Kristi",
				"Meddon" => "Meddon",
				"Slackey" => "Slackey",
				"SueEllenFrancisco" => "Sue Ellen Francisco",
				"TheGirlNextDoor" => "The Girl Next Door",
				"WaitingfortheSunrise" => "Waiting for the Sunrise",
				"WalterTurncoat" => "Walter Turncoat",
				"Allan" => "Allan",
				"Astloch" => "Astloch",
				"Bangers" => "Bangers",
				"CabinSketch" => "Cabin Sketch",
				"Copse" => "Copse",
				"ExpletusSans" => "Expletus Sans",
				"LeagueScript" => "League Script",	
				"Lobster" => "Lobster",
				"LuckiestGuy" => "Luckiest Guy",
				"MedievalSharp" => "MedievalSharp",
				"Miltonian" => "Miltonian",
				"MountainsOfChristmas" => "Mountains of Christmas",
				"Nova" => "Nova Round",
				"Smythe" => "Smythe",
				"SpecialElite" => "Special Elite",
				"UnifrakturCook" => "UnifrakturCook",
				"UnifrakturMaguntia" => "UnifrakturMaguntia",
				"Unkempt" => "Unkempt",
				"VT323"	 => "VT323",
				"SwankyandMooMoo" => "Swanky and Moo Moo",
				"OvertheRainbow" => "Over the Rainbow",
				"Wallpoet" => "Wallpoet",
				"Damion" => "Damion",
				"Aclonica" => "Aclonica",
				"NewsCycle" => "News Cycle",
				"CedarvilleCursive" => "Cedarville Cursive",
				"Zeyada" => "Zeyada",
				"Kameron" => "Kameron",
				"ShadowsIntoLight" => "Shadows Into Light",
				"LaBelleAurore" => "La Belle Aurore",
				"Lora" => "Lora",
				"Artifika" => "Artifika",
				"WireOne" => "Wire One",
				"Muli" => "Muli",
				"TenorSans" => "Tenor Sans",
				"MavenPro" => "Maven Pro",
				"Limelight" => "limelight",
				"Nunito" => "Nunito",
				"PlayfairDisplay" => "Playfair Display"
		);
		
		
		// Swaps out the correct values to render the correct font-family names for the stylesheet 
		$fontCssreplaceBody = array_key_exists($fontStackBody,$fontCss) ? $fontCss[$fontStackBody] : '';
		$fontCssreplaceNav = array_key_exists($fontStackNav,$fontCss) ? $fontCss[$fontStackNav] : '';
		$fontCssreplaceHeading = array_key_exists($fontStackHeading,$fontCss) ? $fontCss[$fontStackHeading] : '';
		
		
		if ($logoType =="text") {
		$fontCssreplaceLogo = array_key_exists($fontStackLogo,$fontCss) ? $fontCss[$fontStackLogo] : '';
		}
		elseif ($logoType =="image") {
		$fontCssreplaceLogo ="";	
		}
		


// ------------------------------------------------------------------------  

/**
 * The css rules based on logic above
 *
 * Zen Grid Framework v1.1
 *  
 */
				
	$fontOutput ="";
	$fontOutput .= "body,span.$fontStackBody {font-family: $fontCssreplaceBody}";
	$fontOutput .=  "h1,h2,h3,h4, h5,h6,.blockquote, .componentheading, .contentheading {font-family:  $fontCssreplaceHeading}";
	$fontOutput .= "#nav, .moduletable-superfish,.moduletable-menu  {font-family: $fontCssreplaceNav}";

	if ($logoType =="text") {
	$fontOutput .= "#logo $logoClass a.$fontStackLogo,#logo $logoClass a span.$fontStackLogo  {font-family: $fontCssreplaceLogo;font-size: $logoFontSize}";
	}
	


// ------------------------------------------------------------------------  

/**
 * Creates the font.css file
 *
 * Zen Grid Framework v1.1
 *  
 */


 JFile::write(JPATH_ROOT.'/templates/zengridframework/css/fonts.css', $fontOutput);
?>