english/libraries/joomla/html/html/behavior.php
/**
	 * Internal method to get a JavaScript object notation string from an array
	 *
	 * @param   array  $array	The array to convert to JavaScript object notation
	 *
	 * @return  string  JavaScript object notation representation of the array
	 * @since   11.1
	 */
Internal method to get a JavaScript object notation string from an array
@param   array  $array       The array to convert to JavaScript object notation

@return  string  JavaScript object notation representation of the array
@since   11.1
Internal method to get a JavaScript object notation string from an array @param array $array The array to convert to JavaScript object notation @return string JavaScript object notation representation of the array @since 11 . 1
protected static function _getJSObject($array=array())
	{
		$object = '{';
		foreach ((array)$array as $k => $v)
		{
			if (is_null($v)) {
				continue;
			}
			if (is_bool($v)) {
				if ($k === 'fullScreen') {
					$object .= 'size: { ';
					$object .= 'x: ';
					$object .= 'window.getSize().x-80';
					$object .= ',';
					$object .= 'y: ';
					$object .= 'window.getSize().y-80';
					$object .= ' }';
					$object .= ',';
				}
				else {
					$object .= ' '.$k.': ';
					$object .= ($v) ? 'true' : 'false';
					$object .= ',';
				}
			}
			else if (!is_array($v) && !is_object($v)) {
				$object .= ' '.$k.': ';
				$object .= (is_numeric($v) || strpos($v, '\\') === 0) ? (is_numeric($v)) ? $v : substr($v, 1) : "'".$v."'";
				$object .= ',';
			}
			else {
				$object .= ' '.$k.': '.JHtmlBehavior::_getJSObject($v).',';
			}
		}
		if (substr($object, -1) == ',') {
			$object = substr($object, 0, -1);
		}
		$object .= '}';
		return $object;
	}
protected static function _getJSObject ( $ array = array ( ) ) { $ object = '{' ; foreach ( ( array ) $ array as $ k => $ v ) { if ( is_null ( $ v ) ) { continue ; } if ( is_bool ( $ v ) ) { if ( $ k === 'fullScreen' ) { $ object .= 'size: { ' ; $ object .= 'x: ' ; $ object .= 'window.getSize().x-80' ; $ object .= ',' ; $ object .= 'y: ' ; $ object .= 'window.getSize().y-80' ; $ object .= ' }' ; $ object .= ',' ; } else { $ object .= ' ' . $ k . ': ' ; $ object .= ( $ v ) ? 'true' : 'false' ; $ object .= ',' ; } } else if ( ! is_array ( $ v ) && ! is_object ( $ v ) ) { $ object .= ' ' . $ k . ': ' ; $ object .= ( is_numeric ( $ v ) || strpos ( $ v , '\\' ) === 0 ) ? ( is_numeric ( $ v ) ) ? $ v : substr ( $ v , 1 ) : " ' " . $ v . " ' " ; $ object .= ',' ; } else { $ object .= ' ' . $ k . ': ' . JHtmlBehavior :: _getJSObject ( $ v ) . ',' ; } } if ( substr ( $ object , - 1 ) == ',' ) { $ object = substr ( $ object , 0 , - 1 ) ; } $ object .= '}' ; return $ object ; }
Internal method to get a JavaScript object notation string from an array
 @param   array  $array       The array to convert to JavaScript object notation
Internal method to get a JavaScript object notation string from an array @param array $array The array to convert to JavaScript object notation
// Initialise variables. // Iterate over array to build objects