⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 behavior.php

📁 没什么功能
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php/*** @version		$Id: behavior.php 10470 2008-06-29 13:47:36Z willebil $* @package		Joomla.Framework* @subpackage	HTML* @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.* @license		GNU/GPL, see LICENSE.php* Joomla! is free software. This version may have been modified pursuant* to the GNU General Public License, and as distributed it includes or* is derivative of works licensed under the GNU General Public License or* other free or open source software licenses.* See COPYRIGHT.php for copyright notices and details.*//** * Utility class for javascript behaviors * * @static * @package 	Joomla.Framework * @subpackage	HTML * @version		1.5 */class JHTMLBehavior{	/**	 * Method to load the mootools framework into the document head	 *	 * - If debugging mode is on an uncompressed version of mootools is included for easier debugging.	 *	 * @static	 * @param	boolean	$debug	Is debugging mode on? [optional]	 * @return	void	 * @since	1.5	 */	function mootools($debug = null)	{		static $loaded;		// Only load once		if ($loaded) {			return;		}		// If no debugging value is set, use the configuration setting		if ($debug === null) {			$config = &JFactory::getConfig();			$debug = $config->getValue('config.debug');		}		// TODO NOTE: Here we are checking for Konqueror - If they fix thier issue with compressed, we will need to update this		$konkcheck = strpos (strtolower($_SERVER['HTTP_USER_AGENT']), "konqueror");		if ($debug || $konkcheck) {			JHTML::script('mootools-uncompressed.js', 'media/system/js/', false);		} else {			JHTML::script('mootools.js', 'media/system/js/', false);		}		$loaded = true;		return;	}		function caption() {		JHTML::script('caption.js');	}	function formvalidation() {		JHTML::script('validate.js' );	}	function switcher() {		JHTML::script('switcher.js' );	}	function combobox() {		JHTML::script('combobox.js' );	}	function tooltip($selector='.hasTip', $params = array())	{		static $tips;		if (!isset($tips)) {			$tips = array();		}		// Include mootools framework		JHTMLBehavior::mootools();		$sig = md5(serialize(array($selector,$params)));		if (isset($tips[$sig]) && ($tips[$sig])) {			return;		}		// Setup options object		$opt['maxTitleChars']	= (isset($params['maxTitleChars']) && ($params['maxTitleChars'])) ? (int)$params['maxTitleChars'] : 50 ;		$opt['offsets']			= (isset($params['offsets'])) ? (int)$params['offsets'] : null;		$opt['showDelay']		= (isset($params['showDelay'])) ? (int)$params['showDelay'] : null;		$opt['hideDelay']		= (isset($params['hideDelay'])) ? (int)$params['hideDelay'] : null;		$opt['className']		= (isset($params['className'])) ? $params['className'] : null;		$opt['fixed']			= (isset($params['fixed']) && ($params['fixed'])) ? '\\true' : '\\false';		$opt['onShow']			= (isset($params['onShow'])) ? '\\'.$params['onShow'] : null;		$opt['onHide']			= (isset($params['onHide'])) ? '\\'.$params['onHide'] : null;		$options = JHTMLBehavior::_getJSObject($opt);		// Attach tooltips to document		$document =& JFactory::getDocument();		$tooltipInit = '		window.addEvent(\'domready\', function(){ var JTooltips = new Tips($$(\''.$selector.'\'), '.$options.'); });';		$document->addScriptDeclaration($tooltipInit);		// Set static array		$tips[$sig] = true;		return;	}	function modal($selector='a.modal', $params = array())	{		static $modals;		static $included;		$document =& JFactory::getDocument();		// Load the necessary files if they haven't yet been loaded		if (!isset($included)) {			// Load the javascript and css			JHTML::script('modal.js');			JHTML::stylesheet('modal.css');			$included = true;		}		if (!isset($modals)) {			$modals = array();		}		$sig = md5(serialize(array($selector,$params)));		if (isset($modals[$sig]) && ($modals[$sig])) {			return;		}		// Setup options object		$opt['ajaxOptions']	= (isset($params['ajaxOptions']) && (is_array($params['ajaxOptions']))) ? $params['ajaxOptions'] : null;		$opt['size']		= (isset($params['size']) && (is_array($params['size']))) ? $params['size'] : null;		$opt['onOpen']		= (isset($params['onOpen'])) ? $params['onOpen'] : null;		$opt['onClose']		= (isset($params['onClose'])) ? $params['onClose'] : null;		$opt['onUpdate']	= (isset($params['onUpdate'])) ? $params['onUpdate'] : null;		$opt['onResize']	= (isset($params['onResize'])) ? $params['onResize'] : null;		$opt['onMove']		= (isset($params['onMove'])) ? $params['onMove'] : null;		$opt['onShow']		= (isset($params['onShow'])) ? $params['onShow'] : null;		$opt['onHide']		= (isset($params['onHide'])) ? $params['onHide'] : null;		$options = JHTMLBehavior::_getJSObject($opt);		// Attach modal behavior to document		$document->addScriptDeclaration("		window.addEvent('domready', function() {			SqueezeBox.initialize(".$options.");			$$('".$selector."').each(function(el) {				el.addEvent('click', function(e) {					new Event(e).stop();					SqueezeBox.fromElement(el);				});			});		});");		// Set static array		$modals[$sig] = true;		return;	}	function uploader($id='file-upload', $params = array())	{		JHTML::script('swf.js' );		JHTML::script('uploader.js' );		static $uploaders;		if (!isset($uploaders)) {			$uploaders = array();		}		if (isset($uploaders[$id]) && ($uploaders[$id])) {			return;		}		// Setup options object		$opt['url']					= (isset($params['targetURL'])) ? $params['targetURL'] : null ;		$opt['swf']					= (isset($params['swf'])) ? $params['swf'] : JURI::root(true).'/media/system/swf/uploader.swf';		$opt['multiple']			= (isset($params['multiple']) && !($params['multiple'])) ? '\\false' : '\\true';		$opt['queued']				= (isset($params['queued']) && !($params['queued'])) ? '\\false' : '\\true';		$opt['queueList']			= (isset($params['queueList'])) ? $params['queueList'] : 'upload-queue';		$opt['instantStart']		= (isset($params['instantStart']) && ($params['instantStart'])) ? '\\true' : '\\false';		$opt['allowDuplicates']		= (isset($params['allowDuplicates']) && !($params['allowDuplicates'])) ? '\\false' : '\\true';		$opt['limitSize']			= (isset($params['limitSize']) && ($params['limitSize'])) ? (int)$params['limitSize'] : null;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -