english/libraries/joomla/html/html/behavior.php
/**
	 * Keep session alive, for example, while editing or creating an article.
	 *
	 * @return  void
	 * @since   11.1
	 */
Keep session alive, for example, while editing or creating an article.
Keep session alive for example while editing or creating an article .
public static function keepalive()
	{
		static $loaded = false;
		if ($loaded) {
			return;
		}
		self::framework();
		$config		= JFactory::getConfig();
		$lifetime	= ($config->get('lifetime') * 60000);
		$refreshTime =  ($lifetime <= 60000) ? 30000 : $lifetime - 60000;
		if ($refreshTime > 3600000 || $refreshTime <= 0) {
			$refreshTime = 3600000;
		}
		$document = JFactory::getDocument();
		$script  = '';
		$script .= 'function keepAlive() {';
		$script .=  '	var myAjax = new Request({method: "get", url: "index.php"}).send();';
		$script .=  '}';
		$script .=	' window.addEvent("domready", function()';
		$script .=	'{ keepAlive.periodical('.$refreshTime.'); }';
		$script .=  ');';
		$document->addScriptDeclaration($script);
		$loaded = true;
		return;
	}
public static function keepalive ( ) { static $ loaded = false ; if ( $ loaded ) { return ; } self :: framework ( ) ; $ config = JFactory :: getConfig ( ) ; $ lifetime = ( $ config -> get ( 'lifetime' ) * 60000 ) ; $ refreshTime = ( $ lifetime <= 60000 ) ? 30000 : $ lifetime - 60000 ; if ( $ refreshTime > 3600000 || $ refreshTime <= 0 ) { $ refreshTime = 3600000 ; } $ document = JFactory :: getDocument ( ) ; $ script = '' ; $ script .= 'function keepAlive() {' ; $ script .= '	var myAjax = new Request({method: "get", url: "index.php"}).send();' ; $ script .= '}' ; $ script .= ' window.addEvent("domready", function()' ; $ script .= '{ keepAlive.periodical(' . $ refreshTime . '); }' ; $ script .= ');' ; $ document -> addScriptDeclaration ( $ script ) ; $ loaded = true ; return ; }
Keep session alive, for example, while editing or creating an article.
Keep session alive for example while editing or creating an article .
// Only load once // Include MooTools framework // Refresh time is 1 minute less than the liftime assined in the configuration.php file. // the longest refresh period is one hour to prevent integer overflow.