Dodaje na koniec stosu treść skryptu
@param string $script zawartość skryptu
@param string $type typ
@param array $params dodatkowe parametry
@param string $conditional warunek np. ie6
@return \Mmi\Mvc\ViewHelper\HeadScript
775352
public function appendScript($script, $type = 'text/javascript', array $params = [], $conditional = '')
    {
        return $this->setScript($script, $type, $params, false, $conditional);
    }
504672
function script($script, $scriptId = null) {
        if (!isset($scriptId) || !isset($this->_scriptIds[$scriptId])) {
            $this->_scripts[] = $script;
            if (isset($scriptId)) $this->_scriptIds[$scriptId] = true;
        }
    }
1223431
public function scripts($script = null, array $attributes = ['type' => 'text/javascript'])
    {
        if ($this->disabledScripts) {
            return false;
        }
        $container = app('antares.asset')->container('antares/foundation::scripts');

//        $container
//                ->add('context_menu', '/packages/core/js/contextMenu.js');
        //->add('context_menu', '/packages/core/js/filters_mdl.js');

        app('antares.asset')->container('antares/foundation::application')->add('filters', '/_dist/js/filters.js', ['webpack_gridstack', 'app_cache']);

        $script = $script ?: $this->generateScripts();

        if ($this->orderable) {
            app('antares.asset')->container('antares/foundation::application')->add('dataTables-rowreorder', 'https://cdn.datatables.net/rowreorder/1.2.0/js/dataTables.rowReorder.min.js', ['webpack_forms_basic']);
        }
        if (app('request')->ajax()) {
            return '<script' . $this->html->attributes($attributes) . '>' . $script . '</script>' . PHP_EOL;
        } else {
            return $container->inlineScript($this->tableAttributes['id'], $script);
        }
    }
1163235
public function makeEngine($type, array $script_config = [])
    {
        if (!empty($disable = config('df.scripting.disable'))) {
            switch (strtolower($disable)) {
                case 'all':
                    throw new ServiceUnavailableException("All scripting is disabled for this instance.");
                    break;
                default:
                    if (!empty($type) && (false !== stripos($disable, $type))) {
                        throw new ServiceUnavailableException("Scripting with $type is disabled for this instance.");
                    }
                    break;
            }
        }

        $config = $this->getConfig($type);

        // Next we will check to see if a type extension has been registered for a engine type
        // and will call the factory Closure if so, which allows us to have a more generic
        // resolver for the engine types themselves which applies to all scripting.
        if (isset($this->types[$type])) {
            return $this->types[$type]->make(array_merge($config, $script_config));
        }

        throw new InvalidArgumentException("Unsupported script engine type '$type'.");
    }
321895
public function setJs($script, array $options = array())
    {
        $options['type'] = 'js';
        $options['asset'] = $script;

        return $this->asset->set($options);
    }
116052
public static GeneratedScript script(final String script, final String[] args, final String fileExtension) {
        return new GeneratedScriptBuilder(script, args, fileExtension);
    }
462097
public function typeShorthand($type, $params = [])
		{
			$options = [];
			$content = NULL;
			$count = count($params);

			if ($count < 1) {
				# no params passed, set last notification type
				$this->updateLastNotification(['type' => $type]);
			} elseif ($count == 1) {
				if (is_array($params[0])) {
					# assume its an options array
					$options = $params[0];
				} else {
					# assume the one param is content
					$content = $params[0];
				}
			} elseif ($count == 2) {
				if (is_array($params[1])) {
					# assume second param is options array, first param is content
					$content = $params[0];
					$options = $params[1];
				} else {
					$content = $params[0];
					$options = ['title' => $params[1]];
				}
			} elseif ($count == 3) {
				if (is_array($params[2])) {
					$content = $params[0];
					$options = array_merge($params[2], ['title' => $params[1]]);
				} else {
					throw new Exception("When 3 parameters given, third parameter must be an Array");
				}
			}

			return $this->add($content, array_merge($options, ['type' => $type]));
		}
266198
public static function script($script = '')
    {
        if (!empty($script)) {
            self::$script = array_merge(self::$script, (array) $script);

            return;
        }

        return view('merchant::partials.script', ['script' => array_unique(self::$script)]);
    }
529608
public static SanitizedContent fromSafeScriptProto(SafeScriptProto script) {
    return SanitizedContent.create(
        SafeScripts.fromProto(script).getSafeScriptString(), ContentKind.JS);
  }
270893
private function _basicCompression($script)
    {
        $parser = new ParseMaster();
        // make safe
        $parser->escapeChar = '\\';
        // protect strings
        $parser->add('/\'[^\'\\n\\r]*\'/', self::IGNORE);
        $parser->add('/"[^"\\n\\r]*"/', self::IGNORE);
        // remove comments
        $parser->add('/\\/\\/[^\\n\\r]*[\\n\\r]/', ' ');
        $parser->add('/\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\//', ' ');
        // protect regular expressions
        $parser->add('/\\s+(\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/g?i?)/', '$2'); // IGNORE
        $parser->add('/[^\\w\\x24\\/\'"*)\\?:]\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/g?i?/', self::IGNORE);
        // remove: ;;; doSomething();
        if ($this->_specialChars) $parser->add('/;;;[^\\n\\r]+[\\n\\r]/');
        // remove redundant semi-colons
        $parser->add('/\\(;;\\)/', self::IGNORE); // protect for (;;) loops
        $parser->add('/;+\\s*([};])/', '$2');
        // apply the above
        $script = $parser->exec($script);

        // remove white-space
        $parser->add('/(\\b|\\x24)\\s+(\\b|\\x24)/', '$2 $3');
        $parser->add('/([+\\-])\\s+([+\\-])/', '$2 $3');
        $parser->add('/\\s+/', '');
        // done
        return $parser->exec($script);
    }
422385
protected function addFindPkComplex(&$script)
    {
        $table = $this->getTable();
        $pks = $table->getPrimaryKey();
        $class = $this->getStubObjectBuilder()->getClassname();
        $this->declareClasses('PropelPDO');
        $script .= "
    /**
     * Find object by primary key.
     *
     * @param     mixed \$key Primary key to use for the query
     * @param     PropelPDO \$con A connection object
     *
     * @return " . $class . "|{$class}[]|mixed the result, formatted by the current formatter
     */
    protected function findPkComplex(\$key, \$con)
    {
        // As the query uses a PK condition, no limit(1) is necessary.
        \$criteria = \$this->isKeepQuery() ? clone \$this : \$this;
        \$stmt = \$criteria
            ->filterByPrimaryKey(\$key)
            ->doSelect(\$con);

        return \$criteria->getFormatter()->init(\$criteria)->formatOne(\$stmt);
    }
";
    }
793154
protected function combineScriptFiles($type = self::POS_HEAD)
	{
		// Check the need for combination
		if (!isset($this->scriptFiles[$type]) || count($this->scriptFiles[$type]) < 2)
			return;

		$scriptFiles = array();
		$toBeCombined = array();
		foreach ($this->scriptFiles[$type] as $url)
		{
			$file = $this->getLocalPath($url);

			if ($file === false)
				$scriptFiles[$url] = $url;
			else
				$toBeCombined[$url] = $file;
		}

		if (count($toBeCombined) === 1)
		{
			$url = key($toBeCombined);
			$scriptFiles[$url] = $url;
		}
		else if (count($toBeCombined) > 1)
		{
			// get unique combined filename
			$fname = $this->getCombinedFileName($this->scriptFileName, array_values($toBeCombined), $type);
			$fpath = Yii::app()->assetManager->getBasePath() . DIRECTORY_SEPARATOR . $fname;

			// check exists file
			if ($valid = file_exists($fpath))
			{
				//$cache = Yii::app()->cache->get('combineCss' . md5($fpath) . md5($fname));
				//if ($cache === false)
				//	$valid = false;

				$mtime = filemtime($fpath);
				foreach ($toBeCombined as $file)
				{
					if ($mtime < filemtime($file))
					{
						$valid = false;
						break;
					}
				}
			}

			// re-generate the file
			if (!$valid)
			{
				$fileBuffer = '';
				foreach ($toBeCombined as $url => $file)
				{
					$contents = file_get_contents($file) . ';';
					if ($contents)
					{
						if ($this->optimizeScriptFiles && strpos($file, '.min.') === false && strpos($file, '.pack.') === false)
						{
							$contents = $this->optimizeScriptCode($contents);
						}
						$fileBuffer .= (($this->optimizeScriptFiles == true) ? preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $contents) : $contents);
					}
				}
				file_put_contents($fpath, $fileBuffer);
				//Yii::app()->cache->set('combineCss' . md5($fpath) . md5($fname), true);
			}
			// add the combined file into scriptFiles
			$url = Yii::app()->assetManager->getBaseRelUrl() . '/' . $fname;
			$scriptFiles[$url] = $url;
		}
		// use new scriptFiles list replace old ones
		$this->scriptFiles[$type] = $scriptFiles;
	}
1141823
public static function createFromUri(
        $uri,
        $script = null,
        array $server = [],
        array $query = [],
        array $parsedBody = null,
        array $cookies = [],
        array $files = []
    ) {
        $server = $server ?: $_SERVER;

        if ($script) {
            $server['SCRIPT_NAME'] = $script;
        }

        $server['SCRIPT_NAME'] = '/' . ltrim($server['SCRIPT_NAME'], '/');

        $request = static::createFromGlobals($server, $query, $parsedBody, $cookies, $files);

        return $request->withUri(new PsrUri($uri));
    }
806452
function setScriptName($script, $multicall = false)
    {
        if (!is_string($script)) {
            throw new InvalidArgumentException('script = ' . print_r($script, true));
        }
        $script = $this->secureUtf8($script);

        return $this->execute(ucfirst(__FUNCTION__), array($script), $multicall);
    }
800833
public ExecuteSQLQueryBuilder validateScript(String script, String type) {
        ScriptValidationContext scriptValidationContext = new ScriptValidationContext(type);
        scriptValidationContext.setValidationScript(script);
        action.setScriptValidationContext(scriptValidationContext);
        return this;
    }
922328
public static function js(array $array, $params = array(
        'attributes' => array(),
        'secure' => null
    ))
    {
        Arr::mergeWithDefaultParams($params);

        if (!$params['secure']) {
            try {
                $params['secure'] = Utils::isHTTPS();
            } catch (Exception $e) {

            }
        }

        $out = "\n";

        foreach($array as $key => $item){
            if(is_array($item)){
                $out .= Html::script($item[0], $item[1], $item[2])."\n";
            } else {
                $out .= Html::script($item, $params['attributes'] ?: [], $params['secure'])."\n";
            }
        }


        return $out;
    }
670551
public function getEncrypting($type)
    {
        if (!isset($this->encryptings[$type])) {
            throw new \RuntimeException('Encrypting not configured: ' . $type);
        }
        return $this->encryptings[$type];
    }