[ 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_privacy 6 * 7 * @copyright (C) 2018 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\Privacy\Site\View\Request; 12 13 use Joomla\CMS\Factory; 14 use Joomla\CMS\Form\Form; 15 use Joomla\CMS\Language\Text; 16 use Joomla\CMS\MVC\View\GenericDataException; 17 use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; 18 use Joomla\CMS\Object\CMSObject; 19 use Joomla\Registry\Registry; 20 21 // phpcs:disable PSR1.Files.SideEffects 22 \defined('_JEXEC') or die; 23 // phpcs:enable PSR1.Files.SideEffects 24 25 /** 26 * Request view class 27 * 28 * @since 3.9.0 29 */ 30 class HtmlView extends BaseHtmlView 31 { 32 /** 33 * The form object 34 * 35 * @var Form 36 * @since 3.9.0 37 */ 38 protected $form; 39 40 /** 41 * The CSS class suffix to append to the view container 42 * 43 * @var string 44 * @since 3.9.0 45 */ 46 protected $pageclass_sfx; 47 48 /** 49 * The view parameters 50 * 51 * @var Registry 52 * @since 3.9.0 53 */ 54 protected $params; 55 56 /** 57 * Flag indicating the site supports sending email 58 * 59 * @var boolean 60 * @since 3.9.0 61 */ 62 protected $sendMailEnabled; 63 64 /** 65 * The state information 66 * 67 * @var CMSObject 68 * @since 3.9.0 69 */ 70 protected $state; 71 72 /** 73 * Execute and display a template script. 74 * 75 * @param string $tpl The name of the template file to parse; automatically searches through the template paths. 76 * 77 * @return void 78 * 79 * @see BaseHtmlView::loadTemplate() 80 * @since 3.9.0 81 * @throws \Exception 82 */ 83 public function display($tpl = null) 84 { 85 // Initialise variables. 86 $this->form = $this->get('Form'); 87 $this->state = $this->get('State'); 88 $this->params = $this->state->params; 89 $this->sendMailEnabled = (bool) Factory::getApplication()->get('mailonline', 1); 90 91 // Check for errors. 92 if (count($errors = $this->get('Errors'))) { 93 throw new GenericDataException(implode("\n", $errors), 500); 94 } 95 96 // Escape strings for HTML output 97 $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx', ''), ENT_COMPAT, 'UTF-8'); 98 99 $this->prepareDocument(); 100 101 parent::display($tpl); 102 } 103 104 /** 105 * Prepares the document. 106 * 107 * @return void 108 * 109 * @since 3.9.0 110 */ 111 protected function prepareDocument() 112 { 113 // Because the application sets a default page title, 114 // we need to get it from the menu item itself 115 $menu = Factory::getApplication()->getMenu()->getActive(); 116 117 if ($menu) { 118 $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); 119 } else { 120 $this->params->def('page_heading', Text::_('COM_PRIVACY_VIEW_REQUEST_PAGE_TITLE')); 121 } 122 123 $this->setDocumentTitle($this->params->get('page_title', '')); 124 125 if ($this->params->get('menu-meta_description')) { 126 $this->document->setDescription($this->params->get('menu-meta_description')); 127 } 128 129 if ($this->params->get('robots')) { 130 $this->document->setMetaData('robots', $this->params->get('robots')); 131 } 132 } 133 }
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 |