[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/components/com_contact/src/Controller/ -> DisplayController.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  com_contact
   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\Contact\Site\Controller;
  12  
  13  use Joomla\CMS\Application\CMSApplication;
  14  use Joomla\CMS\Factory;
  15  use Joomla\CMS\MVC\Controller\BaseController;
  16  use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
  17  
  18  // phpcs:disable PSR1.Files.SideEffects
  19  \defined('_JEXEC') or die;
  20  // phpcs:enable PSR1.Files.SideEffects
  21  
  22  /**
  23   * Contact Component Controller
  24   *
  25   * @since  1.5
  26   */
  27  class DisplayController extends BaseController
  28  {
  29      /**
  30       * @param   array                         $config   An optional associative array of configuration settings.
  31       *                                                  Recognized key values include 'name', 'default_task', 'model_path', and
  32       *                                                  'view_path' (this list is not meant to be comprehensive).
  33       * @param   MVCFactoryInterface|null      $factory  The factory.
  34       * @param   CMSApplication|null           $app      The Application for the dispatcher
  35       * @param   \Joomla\CMS\Input\Input|null  $input    The Input object for the request
  36       *
  37       * @since   3.0
  38       */
  39      public function __construct($config = array(), MVCFactoryInterface $factory = null, $app = null, $input = null)
  40      {
  41          // Contact frontpage Editor contacts proxying.
  42          $input = Factory::getApplication()->input;
  43  
  44          if ($input->get('view') === 'contacts' && $input->get('layout') === 'modal') {
  45              $config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
  46          }
  47  
  48          parent::__construct($config, $factory, $app, $input);
  49      }
  50  
  51      /**
  52       * Method to display a view.
  53       *
  54       * @param   boolean  $cachable   If true, the view output will be cached
  55       * @param   array    $urlparams  An array of safe URL parameters and their variable types, for valid values see {@link \JFilterInput::clean()}.
  56       *
  57       * @return  DisplayController  This object to support chaining.
  58       *
  59       * @since   1.5
  60       */
  61      public function display($cachable = false, $urlparams = array())
  62      {
  63          if ($this->app->getUserState('com_contact.contact.data') === null) {
  64              $cachable = true;
  65          }
  66  
  67          // Set the default view name and format from the Request.
  68          $vName = $this->input->get('view', 'categories');
  69          $this->input->set('view', $vName);
  70  
  71          if ($this->app->getIdentity()->get('id')) {
  72              $cachable = false;
  73          }
  74  
  75          $safeurlparams = array('catid' => 'INT', 'id' => 'INT', 'cid' => 'ARRAY', 'year' => 'INT', 'month' => 'INT',
  76              'limit' => 'UINT', 'limitstart' => 'UINT', 'showall' => 'INT', 'return' => 'BASE64', 'filter' => 'STRING',
  77              'filter_order' => 'CMD', 'filter_order_Dir' => 'CMD', 'filter-search' => 'STRING', 'print' => 'BOOLEAN',
  78              'lang' => 'CMD');
  79  
  80          parent::display($cachable, $safeurlparams);
  81  
  82          return $this;
  83      }
  84  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer