Display links to loaded javascripts files and loaded inline script

@return void
13274
public function printScript()
    {
        foreach ($this->scripts as $key => $options) {
            $src = (is_string($options['src'])) ? $options['src'] : $this->getScriptLink($key);
            if ($options['with_version']) {
                $src = call_user_func_array($this->assetInsertMethod, [$src, $this->assetVersion]);
            }
            echo "<script type='text/javascript' src='$src'></script>\n";
        }
        $this->printInlineScript();
    }
125342
public function load() {

        $filter = 'wp_grunticon_enqueue_scripts';

        if ( is_admin() ) {

            $filter = 'wp_grunticon_admin_enqueue_scripts';

        }

        $queue = apply_filters( $filter, array() );

        if ( ! empty( $queue ) ) {

            $noscript = array();

            echo '<script type="text/javascript">';
                echo 'window.grunticon=function(e){if(e&&3===e.length){var t=window,n=!(!t.document.createElementNS||!t.document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect||!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image","1.1")||window.opera&&-1===navigator.userAgent.indexOf("Chrome")),o=function(o){var r=t.document.createElement("link"),a=t.document.getElementsByTagName("script")[0];r.rel="stylesheet",r.href=e[o&&n?0:o?1:2],a.parentNode.insertBefore(r,a)},r=new t.Image;r.onerror=function(){o(!1)},r.onload=function(){o(1===r.width&&1===r.height)},r.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="}};';

                foreach ( $queue as $wp_grunticon_options ) {

                    echo $wp_grunticon_options->generate_javascript_markup();

                    array_push( $noscript, $wp_grunticon_options->generate_noscript_markup() );

                }

            echo '</script>';
            echo '<noscript>';
                echo implode( PHP_EOL, $noscript );
            echo '</noscript>';

        }

    }
857114
public function renderJs(): void
	{
		if ($this->mode === self::MODE_DEFAULT) {
			$el = Html::el('script type="text/javascript" async defer');
			$el->src = self::GOOGLE_PLATFORM_URL;
			$el->addText("{lang: '" . $this->lang . "'}");

			echo $el;

		} elseif ($this->mode === self::MODE_EXPLICIT) {
			$wrapper = Html::el();

			$el = Html::el('script type="text/javascript" async defer');
			$el->src = self::GOOGLE_PLATFORM_URL;
			$el->addText("{lang: '" . $this->lang . "', parsetags: 'explicit'}");
			$wrapper->addHtml($el);

			$el = Html::el('script type="text/javascript"');
			$el->addText('gapi.plusone.go();');
			$wrapper->addHtml($el);

			echo $wrapper;

		} elseif ($this->mode === self::MODE_DYNAMIC) {
			$el = Html::el('script type="text/javascript"');
			$el->addText("window.___gcfg = {lang: '" . $this->lang . "'};");
			$el->addText("(function(){var po=document.createElement('script');po.type='text/javascript';po.async=true;po.src='" . self::GOOGLE_PLATFORM_URL . "';vars=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(po, s);})();");

			echo $el;
		}
	}
1062204
protected function tagScript()
	{
		// Initialize string
		$html = '';

		// Initialize string for .js path
		$path = '';

		// Get .js path if defined in config file
		if ($this->getConfig('assets.paths.js'))
		{
			$path = $this->getConfig('assets.paths.js') . '/';
		}

		foreach ($this->scripts as $file => $options)
		{
			// Initialize starting string for conditional comments
			$start_cond = '';
			// Initialize ending string for conditional comments
			$end_cond = '';
			// Initialize string for load attribute
			$load = '';

			// Check in config file if stylesheet is an external resource
			$cdn = $this->getConfig('assets.cdn.'.$file);

			// Initialize string for file's url
			$src = '';

			// No conditional comment
			if (is_string($options) && ($options == 'defer' || $options == 'async'))
			{
				$load = ' ' . $options;
			}

			// Conditional comments are defined
			elseif(is_array($options))
			{
				// Check if value for conditional comments is not empty
				if (array_key_exists(1, $options) && $options[1])
				{
					// Set starting string for conditional comments
					$start_cond = '<!--[if '.$options[1].']>';
					// Set ending string for conditional comments
					$end_cond = '<![endif]-->';
				}

				// Check if load attribute is defined and is valid
				if (array_key_exists(0, $options) && ($options[0] == 'defer' || $options[0] == 'async'))
				{
					$load = ' ' . $options[0];
				}
			}

			// Script is an external resource
			if ($cdn)
			{
				// Get file's url
				$src = $cdn;
			}

			// Script is a local resource + check if file exists
			elseif(File::exists(public_path($path.$file.'.js')))
			{
				$src = asset($path.$file.'.js');
			}

			// Check if url is not empty
			if ($src)
			{
				// Return tag for each registered script
				$html .= $start_cond.'<script src="'.$src.'"'.$load.'></script>'.$end_cond . "\n\t";
			}
		}

		// Return complete string
		return $html;
	}
946974
public function inlineJs() {
		// Process any actions first
		$this->processBulkActions();
		$this->truncateExports();
		$js = '';

		// Map the export form to equivalents in latest exports table
		$filetypes = \Pressbooks\Modules\Export\filetypes();
		$map = [];
		foreach ( $filetypes as $k => $v ) {
			$map[ "export_formats[{$k}]" ] = $this->getTinyHash( $this->getFormat( $v ) );
		}
		$map = wp_json_encode( $map, JSON_FORCE_OBJECT );
		$js .= "var _pb_export_formats_map = {$map}; ";

		// Pins
		$all_possible_pins = [];
		foreach ( $this->getFiles() as $filepath ) {
			$file = basename( $filepath );
			$key = 'pin[' . $this->getTinyHash( $file ) . ']';
			$all_possible_pins[ $key ] = $this->getTinyHash( $this->getFormat( $file ) );
		}
		$pins = get_transient( self::PIN );
		if ( ! is_array( $pins ) ) {
			$pins = [];
		}
		foreach ( $pins as $k => $v ) {
			if ( ! isset( $all_possible_pins[ $k ] ) ) {
				unset( $pins[ $k ] );
			}
		}
		$pins = wp_json_encode( $pins, JSON_FORCE_OBJECT );
		$js .= "var _pb_export_pins_inventory = {$pins}; ";

		return $js;
	}
386203
protected function _includeComponents(): void
    {
        // for now, we just include all components
        $appComponentFolder = WWW_ROOT . 'js/app/components/';
        $folder = new Folder($appComponentFolder);
        $files = $folder->find('.*\.js');
        if (!empty($files)) {
            foreach ($files as $file) {
                $this->_dependencies[] = 'app/components/' . $file;
            }
        }

        // Add Plugin Components
        foreach (Plugin::loaded() as $pluginName) {
            $pluginJsComponentsFolder = Plugin::path($pluginName) . '/webroot/js/app/components/';
            if (is_dir($pluginJsComponentsFolder)) {
                $folder = new Folder($pluginJsComponentsFolder);
                $files = $folder->find('.*\.js');
                foreach ($files as $file) {
                    $this->_dependencies[] = '/' . Inflector::underscore($pluginName) . '/js/app/components/' . $file;
                }
            }
        }
    }
749555
public function _enqueue_scripts() {
		$relative_path = '/vendor/inc2734/wp-pure-css-gallery/src/assets/js/wp-pure-css-gallery.min.js';
		$src  = get_template_directory_uri() . $relative_path;
		$path = get_template_directory() . $relative_path;

		if ( ! file_exists( $path ) ) {
			return;
		}

		wp_enqueue_script(
			'wp-pure-css-gallery',
			$src,
			[ 'jquery' ],
			filemtime( $path ),
			true
		);
	}
1138629
public function includeDefaultJavaScriptFiles()
    {
        if (ExtensionService::get()->isInDebugMode()) {
            $this->javaScriptFiles[] = 'Formz.Debug.js';
        }

        foreach ($this->javaScriptFiles as $file) {
            $filePath = StringService::get()->getExtensionRelativePath('Resources/Public/JavaScript/' . $file);

            $this->includeJsFile($filePath);
        }

        return $this;
    }
952563
public function display()
    {
        if (!$this->visible) {
            return;
        }

        parent::display();

        $div_tag = new SwatHtmlTag('div');
        $div_tag->id = $this->id;
        $div_tag->class = $this->getCSSClassString();

        $div_tag->open();

        $this->displayBar();
        $this->displayText();

        $div_tag->close();

        Swat::displayInlineJavaScript($this->getInlineJavaScript());
    }
117054
protected function htmlRedirect()
    {
        $headersSent = headers_sent($file, $line);
        $location = $this->getHeader('location');
        $url = Director::absoluteURL($location);
        $urlATT = Convert::raw2htmlatt($url);
        $urlJS = Convert::raw2js($url);
        $title = (Director::isDev() && $headersSent)
            ? "{$urlATT}... (output started on {$file}, line {$line})"
            : "{$urlATT}...";
        echo <<<EOT
<p>Redirecting to <a href="{$urlATT}" title="Click this link if your browser does not redirect you">{$title}</a></p>
<meta http-equiv="refresh" content="1; url={$urlATT}" />
<script type="application/javascript">setTimeout(function(){
	window.location.href = "{$urlJS}";
}, 50);</script>
EOT
        ;
    }
180093
public function inlineScript($name, $source = null, $dependencies = [], $attributes = [], $replaces = [])
    {
        $this->register('inline', $name, $source, $dependencies, $attributes, $replaces);
    }
8488
function loadScripts(scripts, loadedCallback) {
    var srcs = [], property, count, i, src,
        countDown = function () {
          count -= 1;
          if (!count) {
            loadedCallback();
          }
        };

    for (property in scripts) {
      if (!(property in window)) {
        srcs.push(scripts[property]);
      }
    }

    count = srcs.length;
    if (!count) {
      loadedCallback();
    }

    for (i = 0; i < srcs.length; i += 1) {
      src = srcs[i];
      loadScript(src, countDown);
    }
  }
1254905
public function _document_ready($js) {
		if (!is_array($js)) {
			$js=array (
					$js
			);
		}

		foreach ( $js as $script ) {
			$this->jquery_code_for_compile[]=$script;
		}
	}
215264
public function load()
    {
        $files = scandir($this->getPath());

        foreach($files as $file) {
            if(
                $file === "." ||
                $file === ".."
            ) {
                continue;
            }

            if(is_file($this->getPath().$file)) {
                $this->_files[$file] = $file;
            } else if(is_dir($this->getPath().$file)) {
                $this->_directories[$file] = $file;
            }
        }
    }
893807
public function initialize() : void
    {
        foreach (glob("{$this->cssDir}/*.css") as $file) {
            $filename = basename($file);
            $url = "{$this->cssUrl}/$filename";
            $content = file_get_contents($file);
            $comment = strstr($content, "*/", true);
            $comment = preg_replace(["#\/\*!#", "#\*#"], "", $comment);
            $comment = preg_replace("#@#", "<br>@", $comment);
            $first = strpos($comment, ".");
            $short = substr($comment, 0, $first + 1);
            $long = substr($comment, $first + 1);
            $this->styles[$url] = [
                "shortDescription" => $short,
                "longDescription" => $long,
            ];
        }

        foreach ($this->styles as $key => $value) {
            $isMinified = strstr($key, ".min.css", true);
            if ($isMinified) {
                unset($this->styles["$isMinified.css"]);
            }
        }
    }
1224715
protected function listScripts($scripts)
    {
        if (!$scripts) {
            $this->out()->out('No custom scripts.');

            return;
        }

        $this->out()->out('<comment>Available Scripts</comment>')
            ->out('-----------------------------');

        foreach ($scripts as $name => $script) {
            $this->out(sprintf('<info>%s</info>', $name));

            foreach ($script as $cmd) {
                if (!is_array($cmd)) {
                    $cmd = ['cmd' => $cmd, 'in' => null];
                }

                $input = Arr::get($cmd, 'in');
                $cmd   = Arr::get($cmd, 'cmd');

                $this->out('    <comment>$</comment> ' . $cmd, false);

                if ($input !== null) {
                    $this->out(sprintf('  <option>(Input: %s)</option>', preg_replace('/\s+/', ' ', $input)), false);
                }

                $this->out();
            }

            $this->out();
        }
    }
1287650
private static function links()
    {
        $files = ['Link'];
        $folder = static::$root.'Http/Links'.'/';

        self::call($files, $folder);

        $files = ['LinkKeyNotFoundException'];
        $folder = static::$root.'Http/Links/Exceptions'.'/';

        self::call($files, $folder);
    }