[ 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_content 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\Content\Site\Controller; 12 13 use Joomla\CMS\Application\CMSApplication; 14 use Joomla\CMS\Component\ComponentHelper; 15 use Joomla\CMS\Factory; 16 use Joomla\CMS\Language\Text; 17 use Joomla\CMS\MVC\Factory\MVCFactoryInterface; 18 19 // phpcs:disable PSR1.Files.SideEffects 20 \defined('_JEXEC') or die; 21 // phpcs:enable PSR1.Files.SideEffects 22 23 /** 24 * Content Component Controller 25 * 26 * @since 1.5 27 */ 28 class DisplayController extends \Joomla\CMS\MVC\Controller\BaseController 29 { 30 /** 31 * @param array $config An optional associative array of configuration settings. 32 * Recognized key values include 'name', 'default_task', 'model_path', and 33 * 'view_path' (this list is not meant to be comprehensive). 34 * @param MVCFactoryInterface|null $factory The factory. 35 * @param CMSApplication|null $app The Application for the dispatcher 36 * @param \Joomla\CMS\Input\Input|null $input The Input object for the request 37 * 38 * @since 3.0.1 39 */ 40 public function __construct($config = array(), MVCFactoryInterface $factory = null, $app = null, $input = null) 41 { 42 $this->input = Factory::getApplication()->input; 43 44 // Article frontpage Editor pagebreak proxying: 45 if ($this->input->get('view') === 'article' && $this->input->get('layout') === 'pagebreak') { 46 $config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR; 47 } elseif ($this->input->get('view') === 'articles' && $this->input->get('layout') === 'modal') { 48 // Article frontpage Editor article proxying: 49 $config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR; 50 } 51 52 parent::__construct($config, $factory, $app, $input); 53 } 54 55 /** 56 * Method to display a view. 57 * 58 * @param boolean $cachable If true, the view output will be cached. 59 * @param boolean $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}. 60 * 61 * @return DisplayController This object to support chaining. 62 * 63 * @since 1.5 64 */ 65 public function display($cachable = false, $urlparams = false) 66 { 67 $cachable = true; 68 69 /** 70 * Set the default view name and format from the Request. 71 * Note we are using a_id to avoid collisions with the router and the return page. 72 * Frontend is a bit messier than the backend. 73 */ 74 $id = $this->input->getInt('a_id'); 75 $vName = $this->input->getCmd('view', 'categories'); 76 $this->input->set('view', $vName); 77 78 $user = $this->app->getIdentity(); 79 80 if ( 81 $user->get('id') 82 || ($this->input->getMethod() === 'POST' 83 && (($vName === 'category' && $this->input->get('layout') !== 'blog') || $vName === 'archive' )) 84 ) { 85 $cachable = false; 86 } 87 88 $safeurlparams = array( 89 'catid' => 'INT', 90 'id' => 'INT', 91 'cid' => 'ARRAY', 92 'year' => 'INT', 93 'month' => 'INT', 94 'limit' => 'UINT', 95 'limitstart' => 'UINT', 96 'showall' => 'INT', 97 'return' => 'BASE64', 98 'filter' => 'STRING', 99 'filter_order' => 'CMD', 100 'filter_order_Dir' => 'CMD', 101 'filter-search' => 'STRING', 102 'print' => 'BOOLEAN', 103 'lang' => 'CMD', 104 'Itemid' => 'INT'); 105 106 // Check for edit form. 107 if ($vName === 'form' && !$this->checkEditId('com_content.edit.article', $id)) { 108 // Somehow the person just went to the form - we don't allow that. 109 throw new \Exception(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 403); 110 } 111 112 if ($vName === 'article') { 113 // Get/Create the model 114 if ($model = $this->getModel($vName)) { 115 if (ComponentHelper::getParams('com_content')->get('record_hits', 1) == 1) { 116 $model->hit(); 117 } 118 } 119 } 120 121 parent::display($cachable, $safeurlparams); 122 123 return $this; 124 } 125 }
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 |