<?php
/*
 * Software Name: Eorisis Setup
 * Software URI: https://eorisis.com/shop/software/joomla/setup
 * Author: Eorisis
 * Author URI: https://eorisis.com
 * Copyright: Copyright (C) 2011-2025 EORISIS. All Rights Reserved.
 * License: GNU General Public License version 2; See https://eorisis.com/gpl
 * Terms of Service: https://eorisis.com/tos
 */
namespace eorisis_setup\framework\lib\core\view;
\defined('_JEXEC') or die;

class javascript
{
	public function __construct() {}

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

	public static function script_inline(string $script, bool $jquery_enclose = false) : string
	{
		if (\eorisis_setup\framework\lib\core\cms\document::is_html5())
		{
			$html = '<script>';
		}
		else
		{
			$html = '<script type="text/javascript">';
		}

		if ($jquery_enclose)
		{
			$script = 'jQuery(function($,undefined){'.$script.'});'; // jQuery(document).ready(function($)
		}

		$html .=	$script;
		$html .= '</script>';
		$html .= "\n";
		return $html;
	}
}
