Generates style tags to be embedded in the page.

@return string html script and style tags
765900
public function renderLegacyJs()
    {
        $jsFiles = [];
        $jsCodeLines = [];

        foreach ($this->legacyHelper->get('js_files', []) as $jsItem) {
            // List of items can contain empty elements, path to files or code
            if (!empty($jsItem)) {
                if (isset($jsItem[4]) && $this->isFile($jsItem, '.js')) {
                    $jsFiles[] = $jsItem;
                } else {
                    $jsCodeLines[] = $jsItem;
                }
            }
        }

        return $this->environment->render(
            $this->jsTemplate,
            [
                'js_files' => $jsFiles,
                'js_code_lines' => $jsCodeLines,
            ]
        );
    }
1199966
protected function getInsensitiveTag()
    {
        $tag = new SwatHtmlTag('span');

        $tag->id = $this->id;
        $tag->class = $this->getCSSClassString();

        if ($this->tooltip !== null) {
            $tag->title = $this->tooltip;
        }

        return $tag;
    }
861174
public function getCreateScript() {
        static::$includeScripts = true;

        $text = '<script>';
        $text .= 'editors = ( typeof editors != "undefined" && editors instanceof Array ) ? editors : [];';
        $text .= 'editors.push({';
        $text .= 'name: "' . $this->name . '",';
        $text .= 'stylesheets: ' . json_encode($this->stylesheets) . ',';

        foreach($this->options as $key => $value) {
            $text .= $key . ': "' . $value . '",';
        }

        $text .= '});</script>';

        return $text;
    }
920104
protected function getSensitiveTag()
    {
        $tag = new SwatHtmlTag('a');

        $tag->id = $this->id;
        $tag->class = $this->getCSSClassString();

        if ($this->target !== null) {
            $tag->target = $this->target;
        }

        if ($this->value === null) {
            $tag->href = $this->link;
        } elseif (is_array($this->value)) {
            $tag->href = vsprintf($this->link, $this->value);
        } else {
            $tag->href = sprintf($this->link, $this->value);
        }

        if ($this->tooltip !== null) {
            $tag->title = $this->tooltip;
        }

        $tag->accesskey = $this->access_key;

        return $tag;
    }
726575
private function _style() {
        // we need to compress?
        if($this->compress && $this->_config['compress']['css']) {
            // get cache
            $cache = $this->filename('css');
            if(!$cache)
                return false;

            // get paths
            $web_path = $this->_config['paths']['css'] . '/' . $cache;
            $system_path = $this->css['full'] . DS . $cache;

            // no cache file? write it
            if(!file_exists($system_path)) {
                // process compression
                $output = $this->process('css');

                // write to file
                file_put_contents($system_path, $output);
            }

            // output with the HTML helper
            return $this->Html->css($web_path);

        // no need to compress? output separately with the HTML helper
        } else return $this->Html->css($this->css['extern']);
    }
849777
public static function tags()
    {
        $args = func_get_args();
        $ret = NULL;
        foreach($args as $a)
        {
            $class = "";
            $id = "";
            $type = "";
            $text = "";
            
            if(isset($a['class']))
                $class = $a['class'];
            if(isset($a['id']))
                $id    = $a['id'];
            if(isset($a['type']))
                $type  = $a['type'];
            if(isset($a['text']))
                $text = $a['text'];
            
            unset($a['class'],$a['id'], $a['type'],$a['text']);
            
            $ret .= self::tag($type, $text, $class, $id, $a) . PHP_EOL;
            
        }
        
        return $ret;
    }
519884
public function getStyleAttributeArray(): array
    {
        $value = $this->getAttribute('style')['value'];

        if ($value === null) {
            return [];
        }

        $value = explode(';', substr(trim($value), 0, -1));
        $result = [];
        foreach ($value as $attr) {
            $attr = explode(':', $attr);
            $result[$attr[0]] = $attr[1];
        }

        return $result;
    }
736322
public function generateScripts()
    {
        $result = '';

        $rawScript     = [];
        $this->scripts = array_unique($this->scripts, SORT_REGULAR);
        foreach ($this->scripts as $scriptInfo) {
            if (!$scriptInfo[2]) {
                $result.= '<script src="'.$scriptInfo[0].'" type="'.$scriptInfo[1].'"></script>';
            } else {
                $rawScript[$scriptInfo[1]] = isset($rawScript[$scriptInfo[1]]) ? $rawScript[$scriptInfo[1]] .= $scriptInfo[0]
                        : $scriptInfo[0];
            }
        }
        foreach ($rawScript as $type => $script) {
            $result.= '<script type="'.$type.'">'.$script.'</script>';
        }

        return $result;
    }
879680
public function styles()
    {
        // Obtain Arguments:
        
        $args = func_get_args();
        
        // Array Argument Passed?
        
        if (is_array($args[0])) {
            
            // Obtain Styles:
            
            $styles = $this->grid()->getStyles($args[0]);
            
            // Answer as Array or String? (2nd param is true)
            
            return (isset($args[1]) && $args[1]) ? ViewTools::singleton()->array2att($styles) : $styles;
            
        }
        
        // Answer Styles Array:
        
        return $this->grid()->getStyles($args);
    }
332911
public function getStylesheets()
    {
        $parse_stylesheets = function ($params, $stylesheets) {
            foreach ($params as $css) {
                if (is_string($css)) {
                    $css = array(
                        'path' => $css,
                        'media' => 'all',
                    );
                }

                $stylesheets[] = $css;
            }

            return $stylesheets;
        };

        // From config.yml
        $stylesheets = $parse_stylesheets(
            $this->getGenerator()->getFromBundleConfig('stylesheets', array()), array()
        );

        // From generator.yml
        $stylesheets = $parse_stylesheets(
            $this->getVariable('stylesheets', array()), $stylesheets
        );

        return $stylesheets;
    }
124099
public function run(): string
    {
        $styles = $this->styles();
        $scripts = $this->scripts();
        $modules = $this->container->get("TheCMSThread\\Modules\\Modules");
        foreach ($modules->plugins() as $plugin) {
            foreach ($plugin->styles() as $name => $style) {
                $styles[$name] = $style;
            }
            foreach ($plugin->scripts() as $name => $script) {
                $scripts[$name] = $script;
            }
        }
        $page_details = $this->core->view()->setLink(null)->get()->details;
        $this->templates->addData([
            'site' => $this->core->site(),
            'page' => $page_details,
            'styles' => $styles,
            'scripts' => $scripts,
            'navigations' => $this->core->api('Navigation/all/flatten', 'GET')->run()["response"]
        ]);
        if ($this->core->view()->get()->details === false) {
            $page_details = new \stdClass;
            $page_details->id = -1;
            $page_details->title = "Page not found";
            $page_details->byline = "Please check the URL and try again";
            $page_details->content = "";
            $page_details->featured = null;
            $page_details->tags = [];
            $page_details->class = [];
            $page_details->template = 'error';
            $page_details->link = $_SERVER['REQUEST_URI'];
            $page_details->status = 1;
            $page_details->status = 0;
            $page_details->page_id = null;
            $page_details->user_id = 1;
            $breadcrumbs = [
                [
                    'name' => $page_details->title,
                    'href' => $page_details->link
                ]
            ];
            $this->templates->addData([
                'breadcrumbs' => $breadcrumbs,
                'page' => $page_details
            ]);
        } else {
            $breadcrumb_page = $page_details;
            while($breadcrumb_page !== null) {
                $breadcrumbs[] = [
                    'name' => $breadcrumb_page->title,
                    'href' => $breadcrumb_page->link
                ];
                $breadcrumb_page = $breadcrumb_page->page;
            }
            $this->templates->addData(['breadcrumbs' => array_reverse($breadcrumbs)]);
        }
        return $this->templates->render('Page');
    }
206863
public function generate()
    {
        return sprintf(
            '<input type="hidden" id="ctrl_%s" name="%s" value="%s" /><span>%s</span>',
            $this->strId,
            $this->strName,
            StringUtil::specialchars($this->varValue),
            $this->label
        );
    }
981415
public function generateCode() {
        $content = "";
        foreach ($this->arrTemplates as $template) {
            if (!file_exists($template)) {
                //Template not found
                continue;
            }
            $content .= file_get_contents($template);
        }
        
        foreach ($this->attributes as $key => $val) {
            $content = str_replace($this->placeHolderStart.$key.$this->placeHolderEnd, $val, $content);
        }
        return $content;
    }
495438
public function getStylesheets()
    {
        $parse_stylesheets = function ($params, $stylesheets) {
            foreach ($params as $css) {
                if (is_string($css)) {
                    $css = array(
                        'path'  => $css,
                        'media' => 'all',
                    );
                }

                $stylesheets[] = $css;
            }

            return $stylesheets;
        };

        // From config.yml
        $stylesheets = $parse_stylesheets(
            $this->getGenerator()->getContainer()
                 ->getParameter('admingenerator.stylesheets', array()), array()
        );

        // From generator.yml
        $stylesheets = $parse_stylesheets(
            $this->getVariable('stylesheets', array()), $stylesheets
        );

        return $stylesheets;
    }
736607
protected function tagLink()
	{
		// Initialize string
		$html = '';

		// Add favicon link tags
		$this->addFavicon();

		// Add stylesheets link tags
		$this->addStyleSheets();

		foreach ($this->link as $link)
		{
			if (array_key_exists(1, $link) && $link[1] && array_key_exists(0, $link) && $link[0])
			{
				// Initialize starting string for conditional comments
				$start_cond = '';
				// Initialize ending string for conditional comments
				$end_cond = '';
				// Initialize string for type attribute
				$type = '';
				// Initialize string for other attributes
				$attr = '';

				// Check for conditional comments
				if (array_key_exists(4, $link) && $link[4])
				{
					// Set starting string for conditional comments
					$start_cond = '<!--[if '.$link[4].']>';
					// Set ending string for conditional comments
					$end_cond = '<![endif]-->';
				}

				// Check for attributes
				if (array_key_exists(3, $link) && is_array($link[3]))
				{
					foreach ($link[3] as $name => $content)
					{
						// Check if values are not empty
						if ($name && $content)
						{
							// Set strings for each attribute
							$attr .= ' '.$name.'="'.$content.'"';
						}
					}
				}

				// Check for type attribute
				if (array_key_exists(2, $link) && $link[2])
				{
					// Set string for type attribute
					$type = ' type="'.$link[2].'"';
				}

				// Return tag for each registered link
				$html .= $start_cond.'<link rel="'.$link[0].'" href="'.$link[1].'"'.$type.$attr.'>'.$end_cond . "\n\t";
			}
		}

		// Return complete string
		return $html;
	}
749050
public function htmlAttributes()
    {
        if ($this->direction() === 'rtl' || $this->direction() !== $this->script()->direction()) {
            return 'lang="' . $this->languageTag() . '" dir="' . $this->direction() . '"';
        } else {
            return 'lang="' . $this->languageTag() . '"';
        }
    }
619088
public function generate()
	{
		$this->loadWebmasterTags();

		$title       = $this->getTitle();
		$description = $this->getDescription();
		$keywords    = $this->getKeywords();
		$metatags    = $this->metatags;

		$html = array();

		$html[] = "<title>$title</title>";
		$html[] = sprintf('<meta name="description" itemprop="description" content="%s" />%s', $description, PHP_EOL);

		if (!empty($keywords)) {
			$html[] = sprintf('<meta name="keywords" content="%s" />%s', $keywords, PHP_EOL);
		}

		foreach ($metatags as $key => $value):
			$name    = $value[0];
			$content = $value[1];
			$html[] = sprintf('<meta %s="%s" content="%s" />%s', $name, $key, $content, PHP_EOL);
		endforeach;

		return implode(PHP_EOL, $html);
	}