create a script tag

@param   mixed   script path data - will be passed to the assets interface for processing
@param   array   attributes to be placed on the script tag
@return  string
502374
public function script($src, $attr = array())
    {
        $src = $this->Assets->getScript($src);
        $attr['src'] = $src;
        return $this->tag('script', $attr, '', true);
    }
857334
public function generateScripts(array $attributes = null)
    {
        $init = <<<EOD
           $(document).ready(function(){
                container=$('div.%s');                                     
                form=$('#%s');
                cancelButton=form.find('button.cancel-request');
                submitButton=form.find('button:submit');
                var xhrPool = [];
                $(document).ajaxSend(function (e, jqXHR, options) {
                    xhrPool.push(jqXHR);
                });
                $(document).ajaxComplete(function (e, jqXHR, options) {
                    xhrPool = $.grep(xhrPool, function (x) {
                        return x != jqXHR
                    });
                });
                var abort = function () {
                    $.each(xhrPool, function (idx, jqXHR) {
                        jqXHR.abort();
                    });
                    cancelButton.attr('disabled','disabled').addClass('btn-disabled');
                    submitButton.removeAttr('disabled').removeClass('btn-disabled');
                };
                var processStop = function () {
                    abort();                    
                }
                $.fn.analyzeSpecAjax = function (key) {
                    $.when(
                        $.ajax({                            
                            url: "%s",
                            type: "POST",
                            data: indexes[key],
                            beforeSend: function (element) {
                                $('div.test-response').append('<hr/>'+indexes[key].message);               
                            }
                        })
                    ).then(function (data, textStatus, jqXHR) {                        
                        $('div.test-response').append(data);
                        if(indexes[key+1]!==undefined){
                            $.fn.analyzeSpecAjax(key+1);                            
                        }else{
                            processStop();                            
                        }
                    });
                };
                var indexes={};
                form.on('click', 'button:submit', function (e) {                                        
                    handler=$(this).parents('form:first');
                    
                    $.ajax({
                       url:handler.attr('action'),
                       data:handler.serialize(),
                       type:'POST',
                       dataType:'json',
                       success:function(response,element,status){
                           
                           $('div.test-response').html(''); 
                           indexes=response;       
                           cancelButton.removeAttr('disabled').removeClass('btn-disabled');
                           submitButton.attr('disabled','disabled').addClass('btn-disabled');
                           $.fn.analyzeSpecAjax(0);                           
                       },
                       error:function(eResponse){
                           obj = jQuery.parseJSON(eResponse.responseText);
                           $('div.test-response').html('');                                               
                           for(var i=0;i<obj.length;i++){                                                              
                               $('div.test-response').append(obj[i].error);               
                           }                                                      
                       }
                    });                    
                    return false;
                });
                form.on('click', '.cancel-request', function (e) {                                        
                    processStop();
                    return false;
                });
                form.find('.test-checkboxes').on('ifChecked',function(e){
                    form.find('input:checkbox').iCheck('check');
                    processStop();
                    return true;                    
                });
                
                 form.find('.test-checkboxes').on('ifUnchecked',function(e){
                    form.find('input:checkbox').iCheck('uncheck'); 
                    processStop();
                    return true;                    
                });
                
            });
EOD;
        return sprintf($init, $attributes['response-container'], $attributes['form-container'], handles('antares::tools/tester/run', ['csrf' => true]));
    }
631520
public function script($assets, array $attributes = [])
    {

        $manager = clone $this;

        $collection = (new JavascriptCollection)->setAttributes($attributes);

        $manager->clear()
                ->addCollection($collection)
                ->addArray((array) $assets);

        return $manager;
    }
1312409
protected function _renderTag($attribs = array(), $content = null)
    {
        if($this->getTemplate()->decorator() == 'joomla')
        {
            $link      = isset($attribs['src']) ? $attribs['src'] : false;
            $condition = isset($attribs['condition']) ? $attribs['condition'] : false;

            if(!$link)
            {
                $script = trim($content);
                $hash   = md5($script.serialize($attribs));

                if (!isset($this->_loaded[$hash]))
                {
                    JFactory::getDocument()->addScriptDeclaration($script);
                    $this->_loaded[$hash] = true;
                }
            }
            else
            {
                if($condition)
                {
                    $script = parent::_renderTag($attribs, $content);
                    JFactory::getDocument()->addCustomTag($script);
                }
                else
                {
                    unset($attribs['src']);
                    unset($attribs['condition']);

                    JFactory::getDocument()->addScript($link, 'text/javascript');
                }
            }
        }
        else return parent::_renderTag($attribs, $content);
    }
146571
public static function buildHtmlScript($script, array $attributes = []): string
    {
        $scriptCleaned = trim($script);
        if ($scriptCleaned !== '') {
            return self::buildHtmlElement('script', $attributes, "\n" . $scriptCleaned . "\n");
        }
        return '';
    }
1013910
def scripttag(self, url, path, filename, context):
        
        if msettings['DOCTYPE'] == 'html5':
            markup = """<script src="%s"></script>"""
        else:
            markup = """<script type="text/javascript" charset="utf-8" src="%s"></script>"""
        return markup % self.mkpath(url, path, filename, gzip=self.supports_gzip(context))
1354038
public function decorateHtmlTag($tag, array $attributes)
	{
		if (! $tag instanceof HtmlTag) {
			return null;
		}

		foreach ($attributes as $name => $value) {
			$tag->setAttribute($name, $value);
		}

		return $tag;
	}
354215
public function stylesheetLinkTag($sources = "application", $attributes = [])
    {
        // E.g. stylesheet_link_tag('app', ['media'=>'all']); => app-fa2ce4b45369a106436f229ca9e52bee.css
        $args = func_get_args();
        if (is_array(last($args))) {
            $attributes = array_pop($args);
        } else {
            $attributes = [];
        }
        $sources = is_array($sources) ? $sources : $args;
        if (empty($sources)) {
            $sources = ["application"];
        }

        $assetsOptions = ['host' => array_pull($attributes, 'host', $this->assetsHost)];

        $defaults = ['media' => 'all', 'type' => 'text/css'];
        $attributes = $attributes + $defaults;

        $stylesheet_tags = [];
        foreach ((array) $sources as $source) {
            $sourceName = "$source.css";
            $stylesheet_tags[] = app('html')->style($this->assetPath($sourceName, $assetsOptions), $attributes);
        }

        return implode($stylesheet_tags);
    }
1003836
public static function createAttributeString($attributes)
    {
        $return = '';
        if (is_array($attributes)) {
            foreach ($attributes as $key => $value) {
                $key = self::clearAttributeKey($key);
                $value = self::clearAttributeValue($value);
                if ($key === '') {
                    continue;
                }
                $return .= " {$key}=\"{$value}\"";
            }
        }

        return trim($return);
    }
375568
public function create(string $content, $url, array $attributes = []) : string
    {
        return $this->make(new HrefSettings([
            'content'   => $content,
            'url'       => $url,
            'attributes'=> $attributes,
        ]));
    }
540667
public static function tag($tag, $content = null, array $attributes = array())
    {
        return self::openTag($tag, $attributes) . $content . self::closeTag($tag);
    }
1314697
protected function _renderScript($script, $link, $attribs = array())
    {
        if ($link) {
            $script = pick($this->getService('com:base.template.asset')->getURL($script), $script);
        }

        //if ajax try to get the content of the file
        if (AnRequest::type() == 'AJAX') {
            if ($link) {
                $file = $this->getService('com:base.template.asset')->getFilePath($script);
                if ($file) {
                    $script = file_get_contents($file);
                    $link = false;
                }
            }

            return parent::_renderScript($script, $link, $attribs);
        }

        $document = AnService::get('anahita:document');

        if($link) {
            return $document->addScript($script, 'text/javascript');
        } else {
            return $document->addScriptDeclaration($script);
        }
    }
612628
public static function jsIncTag($path)
    {
        if (strpos($path, 'http') === false and strpos($path, '//') === false) {
            $path = Request::basePath($path);
        }
        return '<script src="' . $path . '" type="text/javascript"></script>' . PHP_EOL;
    }
1230433
public function js($asset = '', $extension = null, $attributes = array())
	{
		$extension = $extension ?: $this->detectExtensionName();

		$attr = array_merge(array(
			'type'  => 'text/javascript',
			'defer' => false,
			'async' => false
		), $attributes);

		$asset = new Javascript($extension, $asset);

		$asset = $this->isSuperGroupAsset($asset);

		if ($asset->exists())
		{
			if ($asset->isDeclaration())
			{
				\App::get('document')->addScriptDeclaration($asset->contents());
			}
			else
			{
				\App::get('document')->addScript($asset->link(), $attr['type'], $attr['defer'], $attr['async']);
			}
		}

		return $this;
	}
85196
public function getHtml(array $attributes = []): string
    {
        return self::buildTag('input', null,
            array_merge(
                [
                    'type'    => 'radio',
                    'name'    => $this->name !== '' ? $this->name : false,
                    'value'   => $this->value,
                    'checked' => $this->isSelected,
                ],
                $attributes
            )
        );
    }
751719
private function createJavaScriptPaths(array $javascripts)
    {
        $files = array();

        foreach ($javascripts as $file) {
            if (!$this->isExternalJavaScriptFile($file)) {

                if (false !== strpos($file, '?')) {
                    $file = strstr($file, '?', true);
                }

                $file = $this->getBasePath() . $file;
            }

            $files[] = $file;
        }

        return $files;
    }
889087
public function js($attributes = null)
	{
		if( ! $this->js)
			return '';

		$assets = ($this->pipeline) ? array($this->jsPipeline()) : $this->js;

		if($attributes instanceof Closure)
			return $attributes->__invoke($assets);

		// Build attributes
		$attributes = (array) $attributes;
		unset($attributes['src']);

		if( ! array_key_exists('type', $attributes))
			$attributes['type'] = 'text/javascript';

		$attributes = $this->buildTagAttributes($attributes);

		// Build tags
		$output = '';
		foreach($assets as $asset)
			$output .= '<script src="' . $asset . '"' . $attributes . "></script>\n";

		return $output;
	}