[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Site 5 * @subpackage com_wrapper 6 * 7 * @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Component\Wrapper\Site\View\Wrapper; 12 13 use Joomla\CMS\Factory; 14 use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; 15 use Joomla\CMS\Uri\Uri; 16 17 // phpcs:disable PSR1.Files.SideEffects 18 \defined('_JEXEC') or die; 19 // phpcs:enable PSR1.Files.SideEffects 20 21 /** 22 * Wrapper view class. 23 * 24 * @since 1.5 25 */ 26 class HtmlView extends BaseHtmlView 27 { 28 /** 29 * The page class suffix 30 * 31 * @var string 32 * @since 4.0.0 33 */ 34 protected $pageclass_sfx = ''; 35 36 /** 37 * The page parameters 38 * 39 * @var \Joomla\Registry\Registry|null 40 * @since 4.0.0 41 */ 42 protected $params = null; 43 44 /** 45 * The page parameters 46 * 47 * @var \stdClass 48 * @since 4.0.0 49 */ 50 protected $wrapper = null; 51 52 /** 53 * Execute and display a template script. 54 * 55 * @param string $tpl The name of the template file to parse; automatically searches through the template paths. 56 * 57 * @return void 58 * 59 * @since 1.5 60 */ 61 public function display($tpl = null) 62 { 63 $params = Factory::getApplication()->getParams(); 64 65 // Because the application sets a default page title, we need to get it 66 // right from the menu item itself 67 68 $this->setDocumentTitle($params->get('page_title', '')); 69 70 if ($params->get('menu-meta_description')) { 71 $this->document->setDescription($params->get('menu-meta_description')); 72 } 73 74 if ($params->get('robots')) { 75 $this->document->setMetaData('robots', $params->get('robots')); 76 } 77 78 $wrapper = new \stdClass(); 79 80 // Auto height control 81 if ($params->def('height_auto')) { 82 $wrapper->load = 'onload="iFrameHeight(this)"'; 83 } else { 84 $wrapper->load = ''; 85 } 86 87 $url = $params->def('url', ''); 88 89 if ($params->def('add_scheme', 1)) { 90 // Adds 'http://' or 'https://' if none is set 91 if (strpos($url, '//') === 0) { 92 // URL without scheme in component. Prepend current scheme. 93 $wrapper->url = Uri::getInstance()->toString(array('scheme')) . substr($url, 2); 94 } elseif (strpos($url, '/') === 0) { 95 // Relative URL in component. Use scheme + host + port. 96 $wrapper->url = Uri::getInstance()->toString(array('scheme', 'host', 'port')) . $url; 97 } elseif (strpos($url, 'http://') !== 0 && strpos($url, 'https://') !== 0) { 98 // URL doesn't start with either 'http://' or 'https://'. Add current scheme. 99 $wrapper->url = Uri::getInstance()->toString(array('scheme')) . $url; 100 } else { 101 // URL starts with either 'http://' or 'https://'. Do not change it. 102 $wrapper->url = $url; 103 } 104 } else { 105 $wrapper->url = $url; 106 } 107 108 // Escape strings for HTML output 109 $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx', '')); 110 $this->params = &$params; 111 $this->wrapper = &$wrapper; 112 113 parent::display($tpl); 114 } 115 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |