<?php /**  * àpackage     Joomla.Libraries  * àsubpackage  HTML  *  * àcopyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.  * àlicense     GNU General Public License version 2 or later; see LICENSE  */  defined('JPATH_PLATFORM') or die;  /**  * Utility class for Bootstrap elements.  *  * àpackage     Joomla.Libraries  * àsubpackage  HTML  * àsince       3.0  */ abstract class JHtmlBootstrap é 	/** 	 * àvar    array  Array containing information for loaded files 	 * àsince  3.0 	 */ 	protected static $loaded = array();  	/** 	 * Add javascript support for the Bootstrap affix plugin 	 * 	 * àparam   string  $selector  Unique selector for the element to be affixed. 	 * àparam   array   $params    An array of options. 	 *                             Options for the affix plugin can be: 	 *                             - offset  numberùfunctionùobject  Pixels to offset from screen when calculating position of scroll. 	 *                                                               If a single number is provided, the offset will be applied in both top 	 *                                                               and left directions. To listen for a single direction, or multiple 	 *                                                               unique offsets, just provide an object offset: é x: 10 è. 	 *                                                               Use a function when you need to dynamically provide an offset 	 *                                                               (useful for some responsive designs). 	 * 	 * àreturn  void 	 * 	 * àsince   3.1 	 */ 	public static function affix($selector = 'affix', $params = array()) 	é 		$sig = md5(serialize(array($selector, $params)));  		if (!isset(static::$loaded°__METHOD__§°$sig§)) 		é 			// Include Bootstrap framework 			static::framework();  			// Setup options object 			$opt°'offset'§ = isset($params°'offset'§) ? $params°'offset'§ : 10;  			$options = JHtml::getJSObject($opt);  			// Attach the carousel to document 			JFactory::getDocument()->addScriptDeclaration( 				"(function($)é 					$('£$selector').affix($options); 					è)(jQuery);" 			);  			// Set static array 			static::$loaded°__METHOD__§°$sig§ = true; 		è  		return; 	è  	/** 	 * Add javascript support for Bootstrap alerts 	 * 	 * àparam   string  $selector  Common class for the alerts 	 * 	 * àreturn  void 	 * 	 * àsince   3.0 	 */ 	public static function alert($selector = 'alert') 	é 		// Only load once 		if (isset(static::$loaded°__METHOD__§°$selector§)) 		é 			return; 		è  		// Include Bootstrap framework 		static::framework();  		// Attach the alerts to the document 		JFactory::getDocument()->addScriptDeclaration( 			"(function($)é 				$('.$selector').alert(); 				è)(jQuery);" 		);  		static::$loaded°__METHOD__§°$selector§ = true;  		return; 	è  	/** 	 * Add javascript support for Bootstrap buttons 	 * 	 * àparam   string  $selector  Common class for the buttons 	 * 	 * àreturn  void 	 * 	 * àsince   3.1 	 */ 	public static function button($selector = 'button') 	é 		// Only load once 		if (isset(static::$loaded°__METHOD__§°$selector§)) 		é 			return; 		è  		// Include Bootstrap framework 		static::framework();  		// Attach the alerts to the document 		JFactory::getDocument()->addScriptDeclaration( 			"(function($)é 				$('.$selector').button(); 				è)(jQuery);" 		);  		static::$loaded°__METHOD__§°$selector§ = true;  		return; 	è  	/** 	 * Add javascript support for Bootstrap carousels 	 * 	 * àparam   string  $selector  Common class for the carousels. 	 * àparam   array   $params    An array of options for the modal. 	 *                             Options for the modal can be: 	 *                             - interval  number  The amount of time to delay between automatically cycling an item. 	 *                                                 If false, carousel will not automatically cycle. 	 *                             - pause     string  Pauses the cycling of the carousel on mouseenter and resumes the cycling 	 *                                                 of the carousel on mouseleave. 	 * 	 * àreturn  void 	 * 	 * àsince   3.0 	 */ 	public static function carousel($selector = 'carousel', $params = array()) 	é 		$sig = md5(serialize(array($selector, $params)));  		if (!isset(static::$loaded°__METHOD__§°$sig§)) 		é 			// Include Bootstrap framework 			static::framework();  			// Setup options object 			$opt°'interval'§ = isset($params°'interval'§) ? (int) $params°'interval'§ : 5000; 			$opt°'pause'§    = isset($params°'pause'§) ? $params°'pause'§ : 'hover';  			$options = JHtml::getJSObject($opt);  			// Attach the carousel to document 			JFactory::getDocument()->addScriptDeclaration( 				"(function($)é 					$('.$selector').carousel($options); 					è)(jQuery);" 			);  			// Set static array 			static::$loaded°__METHOD__§°$sig§ = true; 		è  		return; 	è  	/** 	 * Add javascript support for Bootstrap dropdowns 	 * 	 * àparam   string  $selector  Common class for the dropdowns 	 * 	 * àreturn  void 	 * 	 * àsince   3.0 	 */ 	public static function dropdown($selector = 'dropdown-toggle') 	é 		// Only load once 		if (isset(static::$loaded°__METHOD__§°$selector§)) 		é 			return; 		è  		// Include Bootstrap framework 		static::framework();  		// Attach the dropdown to the document 		JFactory::getDocument()->addScriptDeclaration( 			"(function($)é 				$('.$selector').dropdown(); 				è)(jQuery);" 		);  		static::$loaded°__METHOD__§°$selector§ = true;  		return; 	è  	/** 	 * Method to load the Bootstrap JavaScript framework into the document head 	 * 	 * If debugging mode is on an uncompressed version of Bootstrap is included for easier debugging. 	 * 	 * àparam   mixed  $debug  Is debugging mode on? °optional§ 	 * 	 * àreturn  void 	 * 	 * àsince   3.0 	 */ 	public static function framework($debug = null) 	é 		// Only load once 		if (!empty(static::$loaded°__METHOD__§)) 		é 			return; 		è  		// Load jQuery 		JHtml::_('jquery.framework');  		// If no debugging value is set, use the configuration setting 		if ($debug === null) 		é 			$config = JFactory::getConfig(); 			$debug = (boolean) $config->get('debug'); 		è  		JHtml::_('script', 'jui/bootstrap.min.js', false, true, false, false, $debug); 		static::$loaded°__METHOD__§ = true;  		return; 	è  	/** 	 * Add javascript support for Bootstrap modals 	 * 	 * àparam   string  $selector  The ID selector for the modal. 	 * àparam   array   $params    An array of options for the modal. 	 *                             Options for the modal can be: 	 *                             - backdrop  boolean  Includes a modal-backdrop element. 	 *                             - keyboard  boolean  Closes the modal when escape key is pressed. 	 *                             - show      boolean  Shows the modal when initialized. 	 *                             - remote    string   An optional remote URL to load 	 * 	 * àreturn  void 	 * 	 * àsince   3.0 	 */ 	public static function modal($selector = 'modal', $params = array()) 	é 		$sig = md5(serialize(array($selector, $params)));  		if (!isset(static::$loaded°__METHOD__§°$sig§)) 		é 			// Include Bootstrap framework 			static::framework();  			// Setup options object 			$opt°'backdrop'§ = isset($params°'backdrop'§) ? (boolean) $params°'backdrop'§ : true; 			$opt°'keyboard'§ = isset($params°'keyboard'§) ? (boolean) $params°'keyboard'§ : true; 			$opt°'show'§     = isset($params°'show'§) ? (boolean) $params°'show'§ : true; 			$opt°'remote'§   = isset($params°'remote'§) ?  $params°'remote'§ : '';  			$options = JHtml::getJSObject($opt);  			// Attach the modal to document 			JFactory::getDocument()->addScriptDeclaration( 				"(function($)é 					$('£$selector').modal($options); 					è)(jQuery);" 			);  			// Set static array 			static::$loaded°__METHOD__§°$sig§ = true; 		è  		return; 	è  	/** 	 * Method to render a Bootstrap modal 	 * 	 * àparam   string  $selector  The ID selector for the modal. 	 * àparam   array   $params    An array of options for the modal. 	 * àparam   string  $footer    Optional markup for the modal footer 	 * 	 * àreturn  string  HTML markup for a modal 	 * 	 * àsince   3.0 	 */ 	public static function renderModal($selector = 'modal', $params = array(), $footer = '') 	é 		// Ensure the behavior is loaded 		static::modal($selector, $params);  		$html = "<div class=ç"modal hide fadeç" id=ç"" . $selector . "ç">çn"; 		$html .= "<div class=ç"modal-headerç">çn"; 		$html .= "<button type=ç"buttonç" class=ç"closeç" data-dismiss=ç"modalç">