File manager - Edit - /home/opticamezl/www/newok/Html.tar
Back
ModulesRenderer.php 0000644 00000004117 15173113306 0010357 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\CMS\Document\Renderer\Html; use Joomla\CMS\Document\DocumentRenderer; use Joomla\CMS\Factory; use Joomla\CMS\Helper\ModuleHelper; use Joomla\CMS\Layout\LayoutHelper; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * HTML document renderer for a module position * * @since 3.5 */ class ModulesRenderer extends DocumentRenderer { /** * Renders multiple modules script and returns the results as a string * * @param string $position The position of the modules to render * @param array $params Associative array of values * @param string $content Module content * * @return string The output of the script * * @since 3.5 */ public function render($position, $params = [], $content = null) { $renderer = $this->_doc->loadRenderer('module'); $buffer = ''; $app = Factory::getApplication(); $user = Factory::getUser(); $frontediting = ($app->isClient('site') && $app->get('frontediting', 1) && !$user->guest); $menusEditing = ($app->get('frontediting', 1) == 2) && $user->authorise('core.edit', 'com_menus'); foreach (ModuleHelper::getModules($position) as $mod) { $moduleHtml = $renderer->render($mod, $params, $content); if ($frontediting && trim($moduleHtml) != '' && $user->authorise('module.edit.frontend', 'com_modules.module.' . $mod->id)) { $displayData = ['moduleHtml' => &$moduleHtml, 'module' => $mod, 'position' => $position, 'menusediting' => $menusEditing]; LayoutHelper::render('joomla.edit.frontediting_modules', $displayData); } $buffer .= $moduleHtml; } $app->triggerEvent('onAfterRenderModules', [&$buffer, &$params]); return $buffer; } } MessageRenderer.php 0000644 00000004704 15173113306 0010335 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\CMS\Document\Renderer\Html; use Joomla\CMS\Document\DocumentRenderer; use Joomla\CMS\Factory; use Joomla\CMS\Layout\LayoutHelper; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * HTML document renderer for the system message queue * * @since 3.5 */ class MessageRenderer extends DocumentRenderer { /** * Renders the error stack and returns the results as a string * * @param string $name Not used. * @param array $params Associative array of values * @param string $content Not used. * * @return string The output of the script * * @since 3.5 */ public function render($name, $params = [], $content = null) { $msgList = $this->getData(); $displayData = [ 'msgList' => $msgList, 'name' => $name, 'params' => $params, 'content' => $content, ]; $app = Factory::getApplication(); $chromePath = JPATH_THEMES . '/' . $app->getTemplate() . '/html/message.php'; if (is_file($chromePath)) { include_once $chromePath; } if (\function_exists('renderMessage')) { @trigger_error( 'renderMessage() is deprecated. Override system message rendering with layouts instead.', E_USER_DEPRECATED ); return renderMessage($msgList); } return LayoutHelper::render('joomla.system.message', $displayData); } /** * Get and prepare system message data for output * * @return array An array contains system message * * @since 3.5 */ private function getData() { // Initialise variables. $lists = []; // Get the message queue $messages = Factory::getApplication()->getMessageQueue(); // Build the sorted message list if (\is_array($messages) && !empty($messages)) { foreach ($messages as $msg) { if (isset($msg['type']) && isset($msg['message'])) { $lists[$msg['type']][] = $msg['message']; } } } return $lists; } } ScriptsRenderer.php 0000644 00000025144 15173113306 0010401 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\CMS\Document\Renderer\Html; use Joomla\CMS\Document\DocumentRenderer; use Joomla\CMS\WebAsset\WebAssetItemInterface; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * JDocument head renderer * * @since 4.0.0 */ class ScriptsRenderer extends DocumentRenderer { /** * List of already rendered src * * @var array * * @since 4.0.0 */ private $renderedSrc = []; /** * Renders the document script tags and returns the results as a string * * @param string $head (unused) * @param array $params Associative array of values * @param string $content The script * * @return string The output of the script * * @since 4.0.0 */ public function render($head, $params = [], $content = null) { // Get line endings $lnEnd = $this->_doc->_getLineEnd(); $tab = $this->_doc->_getTab(); $buffer = ''; $wam = $this->_doc->getWebAssetManager(); $assets = $wam->getAssets('script', true); // Get a list of inline assets and their relation with regular assets $inlineAssets = $wam->filterOutInlineAssets($assets); $inlineRelation = $wam->getInlineRelation($inlineAssets); // Merge with existing scripts, for rendering $assets = array_merge(array_values($assets), $this->_doc->_scripts); // Generate script file links foreach ($assets as $key => $item) { // Check whether we have an Asset instance, or old array with attributes $asset = $item instanceof WebAssetItemInterface ? $item : null; // Add src attribute for non Asset item if (!$asset) { $item['src'] = $key; } // Check for inline content "before" if ($asset && !empty($inlineRelation[$asset->getName()]['before'])) { foreach ($inlineRelation[$asset->getName()]['before'] as $itemBefore) { $buffer .= $this->renderInlineElement($itemBefore); // Remove this item from inline queue unset($inlineAssets[$itemBefore->getName()]); } } $buffer .= $this->renderElement($item); // Check for inline content "after" if ($asset && !empty($inlineRelation[$asset->getName()]['after'])) { foreach ($inlineRelation[$asset->getName()]['after'] as $itemBefore) { $buffer .= $this->renderInlineElement($itemBefore); // Remove this item from inline queue unset($inlineAssets[$itemBefore->getName()]); } } } // Generate script declarations for assets foreach ($inlineAssets as $item) { $buffer .= $this->renderInlineElement($item); } // Generate script declarations for old scripts foreach ($this->_doc->_script as $type => $contents) { // Test for B.C. in case someone still store script declarations as single string if (\is_string($contents)) { $contents = [$contents]; } foreach ($contents as $content) { $buffer .= $this->renderInlineElement( [ 'type' => $type, 'content' => $content, ] ); } } // Output the custom tags - array_unique makes sure that we don't output the same tags twice foreach (array_unique($this->_doc->_custom) as $custom) { $buffer .= $tab . $custom . $lnEnd; } return ltrim($buffer, $tab); } /** * Renders the element * * @param WebAssetItemInterface|array $item The element * * @return string The resulting string * * @since 4.0.0 */ private function renderElement($item): string { $buffer = ''; $asset = $item instanceof WebAssetItemInterface ? $item : null; $src = $asset ? $asset->getUri() : ($item['src'] ?? ''); // Make sure we have a src, and it not already rendered if (!$src || !empty($this->renderedSrc[$src]) || ($asset && $asset->getOption('webcomponent'))) { return ''; } $lnEnd = $this->_doc->_getLineEnd(); $tab = $this->_doc->_getTab(); $mediaVersion = $this->_doc->getMediaVersion(); // Get the attributes and other options if ($asset) { $attribs = $asset->getAttributes(); $version = $asset->getVersion(); $conditional = $asset->getOption('conditional'); // Add an asset info for debugging if (JDEBUG) { $attribs['data-asset-name'] = $asset->getName(); if ($asset->getDependencies()) { $attribs['data-asset-dependencies'] = implode(',', $asset->getDependencies()); } if ($asset->getOption('deprecated')) { @trigger_error( sprintf('Web Asset script [%s] is deprecated. %s', $asset->getName(), $asset->getOption('deprecatedMsg', '')), E_USER_DEPRECATED ); } } } else { $attribs = $item; $version = isset($attribs['options']['version']) ? $attribs['options']['version'] : ''; $conditional = !empty($attribs['options']['conditional']) ? $attribs['options']['conditional'] : null; } // Add "nonce" attribute if exist if ($this->_doc->cspNonce && !is_null($this->_doc->cspNonce)) { $attribs['nonce'] = $this->_doc->cspNonce; } // To prevent double rendering $this->renderedSrc[$src] = true; // Check if script uses media version. if ($version && strpos($src, '?') === false && ($mediaVersion || $version !== 'auto')) { $src .= '?' . ($version === 'auto' ? $mediaVersion : $version); } $buffer .= $tab; // This is for IE conditional statements support. if (!\is_null($conditional)) { $buffer .= '<!--[if ' . $conditional . ']>'; } // Render the element with attributes $buffer .= '<script src="' . htmlspecialchars($src) . '"'; $buffer .= $this->renderAttributes($attribs); $buffer .= '></script>'; // This is for IE conditional statements support. if (!\is_null($conditional)) { $buffer .= '<![endif]-->'; } $buffer .= $lnEnd; return $buffer; } /** * Renders the inline element * * @param WebAssetItemInterface|array $item The element * * @return string The resulting string * * @since 4.0.0 */ private function renderInlineElement($item): string { $buffer = ''; $lnEnd = $this->_doc->_getLineEnd(); $tab = $this->_doc->_getTab(); if ($item instanceof WebAssetItemInterface) { $attribs = $item->getAttributes(); $content = $item->getOption('content'); } else { $attribs = $item; $content = $item['content'] ?? ''; unset($attribs['content']); } // Do not produce empty elements if (!$content) { return ''; } // Add "nonce" attribute if exist if ($this->_doc->cspNonce && !is_null($this->_doc->cspNonce)) { $attribs['nonce'] = $this->_doc->cspNonce; } $buffer .= $tab . '<script'; $buffer .= $this->renderAttributes($attribs); $buffer .= '>'; // This is for full XHTML support. if ($this->_doc->_mime !== 'text/html') { $buffer .= $tab . $tab . '//<![CDATA[' . $lnEnd; } $buffer .= $content; // See above note if ($this->_doc->_mime !== 'text/html') { $buffer .= $tab . $tab . '//]]>' . $lnEnd; } $buffer .= '</script>' . $lnEnd; return $buffer; } /** * Renders the element attributes * * @param array $attributes The element attributes * * @return string The attributes string * * @since 4.0.0 */ private function renderAttributes(array $attributes): string { $buffer = ''; $defaultJsMimes = ['text/javascript', 'application/javascript', 'text/x-javascript', 'application/x-javascript']; $html5NoValueAttributes = ['defer', 'async', 'nomodule']; foreach ($attributes as $attrib => $value) { // Don't add the 'options' attribute. This attribute is for internal use (version, conditional, etc). if ($attrib === 'options' || $attrib === 'src') { continue; } // Don't add type attribute if document is HTML5 and it's a default mime type. 'mime' is for B/C. if (\in_array($attrib, ['type', 'mime']) && $this->_doc->isHtml5() && \in_array($value, $defaultJsMimes)) { continue; } // B/C: If defer and async is false or empty don't render the attribute. Also skip if value is bool:false. if (\in_array($attrib, ['defer', 'async']) && !$value || $value === false) { continue; } // NoValue attribute, if it have bool:true $isNoValueAttrib = $value === true || \in_array($attrib, $html5NoValueAttributes); // Don't add type attribute if document is HTML5 and it's a default mime type. 'mime' is for B/C. if ($attrib === 'mime') { $attrib = 'type'; } elseif ($isNoValueAttrib) { // NoValue attribute in non HTML5 should contain a value, set it equal to attribute name. $value = $attrib; } // Add attribute to script tag output. $buffer .= ' ' . htmlspecialchars($attrib, ENT_COMPAT, 'UTF-8'); if (!($this->_doc->isHtml5() && $isNoValueAttrib)) { // Json encode value if it's an array. $value = !is_scalar($value) ? json_encode($value) : $value; $buffer .= '="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '"'; } } return $buffer; } } ComponentRenderer.php 0000644 00000001774 15173113306 0010717 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\CMS\Document\Renderer\Html; use Joomla\CMS\Document\DocumentRenderer; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * HTML document renderer for the component output * * @since 3.5 */ class ComponentRenderer extends DocumentRenderer { /** * Renders a component script and returns the results as a string * * @param string $component The name of the component to render * @param array $params Associative array of values * @param string $content Content script * * @return string The output of the script * * @since 3.5 */ public function render($component = null, $params = [], $content = null) { return $content; } } StylesRenderer.php 0000644 00000024337 15173113306 0010240 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\CMS\Document\Renderer\Html; use Joomla\CMS\Document\DocumentRenderer; use Joomla\CMS\WebAsset\WebAssetItemInterface; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * JDocument styles renderer * * @since 4.0.0 */ class StylesRenderer extends DocumentRenderer { /** * List of already rendered src * * @var array * * @since 4.0.0 */ private $renderedSrc = []; /** * Renders the document stylesheets and style tags and returns the results as a string * * @param string $head (unused) * @param array $params Associative array of values * @param string $content The script * * @return string The output of the script * * @since 4.0.0 */ public function render($head, $params = [], $content = null) { $tab = $this->_doc->_getTab(); $buffer = ''; $wam = $this->_doc->getWebAssetManager(); $assets = $wam->getAssets('style', true); // Get a list of inline assets and their relation with regular assets $inlineAssets = $wam->filterOutInlineAssets($assets); $inlineRelation = $wam->getInlineRelation($inlineAssets); // Merge with existing styleSheets, for rendering $assets = array_merge(array_values($assets), $this->_doc->_styleSheets); // Generate stylesheet links foreach ($assets as $key => $item) { $asset = $item instanceof WebAssetItemInterface ? $item : null; // Add href attribute for non Asset item if (!$asset) { $item['href'] = $key; } // Check for inline content "before" if ($asset && !empty($inlineRelation[$asset->getName()]['before'])) { foreach ($inlineRelation[$asset->getName()]['before'] as $itemBefore) { $buffer .= $this->renderInlineElement($itemBefore); // Remove this item from inline queue unset($inlineAssets[$itemBefore->getName()]); } } $buffer .= $this->renderElement($item); // Check for inline content "after" if ($asset && !empty($inlineRelation[$asset->getName()]['after'])) { foreach ($inlineRelation[$asset->getName()]['after'] as $itemBefore) { $buffer .= $this->renderInlineElement($itemBefore); // Remove this item from inline queue unset($inlineAssets[$itemBefore->getName()]); } } } // Generate script declarations for assets foreach ($inlineAssets as $item) { $buffer .= $this->renderInlineElement($item); } // Generate stylesheet declarations foreach ($this->_doc->_style as $type => $contents) { // Test for B.C. in case someone still store stylesheet declarations as single string if (\is_string($contents)) { $contents = [$contents]; } foreach ($contents as $content) { $buffer .= $this->renderInlineElement( [ 'type' => $type, 'content' => $content, ] ); } } return ltrim($buffer, $tab); } /** * Renders the element * * @param WebAssetItemInterface|array $item The element * * @return string The resulting string * * @since 4.0.0 */ private function renderElement($item): string { $buffer = ''; $asset = $item instanceof WebAssetItemInterface ? $item : null; $src = $asset ? $asset->getUri() : ($item['href'] ?? ''); // Make sure we have a src, and it not already rendered if (!$src || !empty($this->renderedSrc[$src])) { return ''; } $lnEnd = $this->_doc->_getLineEnd(); $tab = $this->_doc->_getTab(); $mediaVersion = $this->_doc->getMediaVersion(); // Get the attributes and other options if ($asset) { $attribs = $asset->getAttributes(); $version = $asset->getVersion(); $conditional = $asset->getOption('conditional'); // Add an asset info for debugging if (JDEBUG) { $attribs['data-asset-name'] = $asset->getName(); if ($asset->getDependencies()) { $attribs['data-asset-dependencies'] = implode(',', $asset->getDependencies()); } if ($asset->getOption('deprecated')) { @trigger_error( sprintf('Web Asset style [%s] is deprecated. %s', $asset->getName(), $asset->getOption('deprecatedMsg', '')), E_USER_DEPRECATED ); } } } else { $attribs = $item; $version = isset($attribs['options']['version']) ? $attribs['options']['version'] : ''; $conditional = !empty($attribs['options']['conditional']) ? $attribs['options']['conditional'] : null; } // Add "nonce" attribute if exist if ($this->_doc->cspNonce && !is_null($this->_doc->cspNonce)) { $attribs['nonce'] = $this->_doc->cspNonce; } // To prevent double rendering $this->renderedSrc[$src] = true; // Check if script uses media version. if ($version && strpos($src, '?') === false && ($mediaVersion || $version !== 'auto')) { $src .= '?' . ($version === 'auto' ? $mediaVersion : $version); } $buffer .= $tab; // This is for IE conditional statements support. if (!\is_null($conditional)) { $buffer .= '<!--[if ' . $conditional . ']>'; } $relation = isset($attribs['rel']) ? $attribs['rel'] : 'stylesheet'; if (isset($attribs['rel'])) { unset($attribs['rel']); } // Render the element with attributes $buffer .= '<link href="' . htmlspecialchars($src) . '" rel="' . $relation . '"'; $buffer .= $this->renderAttributes($attribs); $buffer .= ' />'; if ($relation === 'lazy-stylesheet') { $buffer .= '<noscript><link href="' . htmlspecialchars($src) . '" rel="stylesheet" /></noscript>'; } // This is for IE conditional statements support. if (!\is_null($conditional)) { $buffer .= '<![endif]-->'; } $buffer .= $lnEnd; return $buffer; } /** * Renders the inline element * * @param WebAssetItemInterface|array $item The element * * @return string The resulting string * * @since 4.0.0 */ private function renderInlineElement($item): string { $buffer = ''; $lnEnd = $this->_doc->_getLineEnd(); $tab = $this->_doc->_getTab(); if ($item instanceof WebAssetItemInterface) { $attribs = $item->getAttributes(); $content = $item->getOption('content'); } else { $attribs = $item; $content = $item['content'] ?? ''; unset($attribs['content']); } // Do not produce empty elements if (!$content) { return ''; } // Add "nonce" attribute if exist if ($this->_doc->cspNonce && !is_null($this->_doc->cspNonce)) { $attribs['nonce'] = $this->_doc->cspNonce; } $buffer .= $tab . '<style'; $buffer .= $this->renderAttributes($attribs); $buffer .= '>'; // This is for full XHTML support. if ($this->_doc->_mime !== 'text/html') { $buffer .= $tab . $tab . '/*<![CDATA[*/' . $lnEnd; } $buffer .= $content; // See above note if ($this->_doc->_mime !== 'text/html') { $buffer .= $tab . $tab . '/*]]>*/' . $lnEnd; } $buffer .= '</style>' . $lnEnd; return $buffer; } /** * Renders the element attributes * * @param array $attributes The element attributes * * @return string The attributes string * * @since 4.0.0 */ private function renderAttributes(array $attributes): string { $buffer = ''; $defaultCssMimes = ['text/css']; foreach ($attributes as $attrib => $value) { // Don't add the 'options' attribute. This attribute is for internal use (version, conditional, etc). if ($attrib === 'options' || $attrib === 'href') { continue; } // Don't add type attribute if document is HTML5 and it's a default mime type. 'mime' is for B/C. if (\in_array($attrib, ['type', 'mime']) && $this->_doc->isHtml5() && \in_array($value, $defaultCssMimes)) { continue; } // Skip the attribute if value is bool:false. if ($value === false) { continue; } // NoValue attribute, if it have bool:true $isNoValueAttrib = $value === true; // Don't add type attribute if document is HTML5 and it's a default mime type. 'mime' is for B/C. if ($attrib === 'mime') { $attrib = 'type'; } elseif ($isNoValueAttrib) { // NoValue attribute in non HTML5 should contain a value, set it equal to attribute name. $value = $attrib; } // Add attribute to script tag output. $buffer .= ' ' . htmlspecialchars($attrib, ENT_COMPAT, 'UTF-8'); if (!($this->_doc->isHtml5() && $isNoValueAttrib)) { // Json encode value if it's an array. $value = !is_scalar($value) ? json_encode($value) : $value; $buffer .= '="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '"'; } } return $buffer; } } HeadRenderer.php 0000644 00000002363 15173113306 0007611 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\CMS\Document\Renderer\Html; use Joomla\CMS\Document\DocumentRenderer; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * HTML document renderer for the document `<head>` element * * @since 3.5 */ class HeadRenderer extends DocumentRenderer { /** * Renders the document head and returns the results as a string * * @param string $head (unused) * @param array $params Associative array of values * @param string $content The script * * @return string The output of the script * * @since 3.5 */ public function render($head, $params = [], $content = null) { $buffer = ''; $buffer .= $this->_doc->loadRenderer('metas')->render($head, $params, $content); $buffer .= $this->_doc->loadRenderer('styles')->render($head, $params, $content); $buffer .= $this->_doc->loadRenderer('scripts')->render($head, $params, $content); return $buffer; } } MetasRenderer.php 0000644 00000015354 15173113306 0010025 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\CMS\Document\Renderer\Html; use Joomla\CMS\Document\DocumentRenderer; use Joomla\CMS\Factory; use Joomla\CMS\Helper\TagsHelper; use Joomla\CMS\Uri\Uri; use Joomla\CMS\WebAsset\WebAssetAttachBehaviorInterface; use Joomla\Utilities\ArrayHelper; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * JDocument metas renderer * * @since 4.0.0 */ class MetasRenderer extends DocumentRenderer { /** * Renders the document metas and returns the results as a string * * @param string $head (unused) * @param array $params Associative array of values * @param string $content The script * * @return string The output of the script * * @since 4.0.0 */ public function render($head, $params = [], $content = null) { // Convert the tagids to titles if (isset($this->_doc->_metaTags['name']['tags'])) { $tagsHelper = new TagsHelper(); $this->_doc->_metaTags['name']['tags'] = implode(', ', $tagsHelper->getTagNames($this->_doc->_metaTags['name']['tags'])); } /** @var \Joomla\CMS\Application\CMSApplication $app */ $app = Factory::getApplication(); $wa = $this->_doc->getWebAssetManager(); // Check for AttachBehavior and web components foreach ($wa->getAssets('script', true) as $asset) { if ($asset instanceof WebAssetAttachBehaviorInterface) { $asset->onAttachCallback($this->_doc); } } // Trigger the onBeforeCompileHead event $app->triggerEvent('onBeforeCompileHead'); // Add Script Options as inline asset $scriptOptions = $this->_doc->getScriptOptions(); if ($scriptOptions) { $prettyPrint = (JDEBUG && \defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : false); $jsonOptions = json_encode($scriptOptions, $prettyPrint); $jsonOptions = $jsonOptions ?: '{}'; $wa->addInlineScript( $jsonOptions, ['name' => 'joomla.script.options', 'position' => 'before'], ['type' => 'application/json', 'class' => 'joomla-script-options new'], ['core'] ); } // Lock the AssetManager $wa->lock(); // Get line endings $lnEnd = $this->_doc->_getLineEnd(); $tab = $this->_doc->_getTab(); $buffer = ''; // Generate charset when using HTML5 (should happen first) if ($this->_doc->isHtml5()) { $buffer .= $tab . '<meta charset="' . $this->_doc->getCharset() . '">' . $lnEnd; } // Generate base tag (need to happen early) $base = $this->_doc->getBase(); if (!empty($base)) { $buffer .= $tab . '<base href="' . $base . '">' . $lnEnd; } $noFavicon = true; $searchFor = 'image/vnd.microsoft.icon'; array_map(function ($value) use (&$noFavicon, $searchFor) { if (isset($value['attribs']['type']) && $value['attribs']['type'] === $searchFor) { $noFavicon = false; } }, array_values((array)$this->_doc->_links)); if ($noFavicon) { $client = $app->isClient('administrator') === true ? 'administrator/' : 'site/'; $template = $app->getTemplate(true); // Try to find a favicon by checking the template and root folder $icon = '/favicon.ico'; $foldersToCheck = [ JPATH_BASE, JPATH_ROOT . '/media/templates/' . $client . $template->template, JPATH_BASE . '/templates/' . $template->template, ]; foreach ($foldersToCheck as $base => $dir) { if ( $template->parent !== '' && $base === 1 && !is_file(JPATH_ROOT . '/media/templates/' . $client . $template->template . $icon) ) { $dir = JPATH_ROOT . '/media/templates/' . $client . $template->parent; } if (is_file($dir . $icon)) { $urlBase = in_array($base, [0, 2]) ? Uri::base(true) : Uri::root(true); $base = in_array($base, [0, 2]) ? JPATH_BASE : JPATH_ROOT; $path = str_replace($base, '', $dir); $path = str_replace('\\', '/', $path); $this->_doc->addFavicon($urlBase . $path . $icon); break; } } } // Generate META tags (needs to happen as early as possible in the head) foreach ($this->_doc->_metaTags as $type => $tag) { foreach ($tag as $name => $contents) { if ($type === 'http-equiv' && !($this->_doc->isHtml5() && $name === 'content-type')) { $buffer .= $tab . '<meta http-equiv="' . $name . '" content="' . htmlspecialchars($contents, ENT_COMPAT, 'UTF-8') . '">' . $lnEnd; } elseif ($type !== 'http-equiv' && !empty($contents)) { $buffer .= $tab . '<meta ' . $type . '="' . $name . '" content="' . htmlspecialchars($contents, ENT_COMPAT, 'UTF-8') . '">' . $lnEnd; } } } // Don't add empty descriptions $documentDescription = $this->_doc->getDescription(); if ($documentDescription) { $buffer .= $tab . '<meta name="description" content="' . htmlspecialchars($documentDescription, ENT_COMPAT, 'UTF-8') . '">' . $lnEnd; } // Don't add empty generators $generator = $this->_doc->getGenerator(); if ($generator) { $buffer .= $tab . '<meta name="generator" content="' . htmlspecialchars($generator, ENT_COMPAT, 'UTF-8') . '">' . $lnEnd; } $buffer .= $tab . '<title>' . htmlspecialchars($this->_doc->getTitle(), ENT_COMPAT, 'UTF-8') . '</title>' . $lnEnd; // Generate link declarations foreach ($this->_doc->_links as $link => $linkAtrr) { $buffer .= $tab . '<link href="' . $link . '" ' . $linkAtrr['relType'] . '="' . $linkAtrr['relation'] . '"'; if (\is_array($linkAtrr['attribs'])) { if ($temp = ArrayHelper::toString($linkAtrr['attribs'])) { $buffer .= ' ' . $temp; } } $buffer .= '>' . $lnEnd; } return ltrim($buffer, $tab); } } ModuleRenderer.php 0000644 00000006631 15173113306 0010177 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\CMS\Document\Renderer\Html; use Joomla\CMS\Document\DocumentRenderer; use Joomla\CMS\Factory; use Joomla\CMS\Helper\ModuleHelper; use Joomla\Registry\Registry; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * HTML document renderer for a single module * * @since 3.5 */ class ModuleRenderer extends DocumentRenderer { /** * Renders a module script and returns the results as a string * * @param string $module The name of the module to render * @param array $attribs Associative array of values * @param string $content If present, module information from the buffer will be used * * @return string The output of the script * * @since 3.5 */ public function render($module, $attribs = [], $content = null) { if (!\is_object($module)) { $title = $attribs['title'] ?? null; $module = ModuleHelper::getModule($module, $title); if (!\is_object($module)) { if (\is_null($content)) { return ''; } /** * If module isn't found in the database but data has been pushed in the buffer * we want to render it */ $tmp = $module; $module = new \stdClass(); $module->params = null; $module->module = $tmp; $module->id = 0; $module->user = 0; } } // Set the module content if (!\is_null($content)) { $module->content = $content; } // Get module parameters $params = new Registry($module->params); // Use parameters from template if (isset($attribs['params'])) { $template_params = new Registry(html_entity_decode($attribs['params'], ENT_COMPAT, 'UTF-8')); $params->merge($template_params); $module = clone $module; $module->params = (string) $params; } // Set cachemode parameter or use JModuleHelper::moduleCache from within the module instead $cachemode = $params->get('cachemode', 'static'); if ($params->get('cache', 0) == 1 && Factory::getApplication()->get('caching') >= 1 && $cachemode !== 'id' && $cachemode !== 'safeuri') { // Default to itemid creating method and workarounds on $cacheparams = new \stdClass(); $cacheparams->cachemode = $cachemode; $cacheparams->class = ModuleHelper::class; $cacheparams->method = 'renderModule'; $cacheparams->methodparams = [$module, $attribs]; $cacheparams->cachesuffix = $attribs['contentOnly'] ?? false; // It need to be done here because the cache controller does not keep reference to the module object $module->content = ModuleHelper::moduleCache($module, $params, $cacheparams); $module->contentRendered = true; return $module->content; } return ModuleHelper::renderModule($module, $attribs); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Generation time: 0 |
proxy
|
phpinfo
|
Settings