Source for file controller.php

Documentation is available at controller.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_cache
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. /**
  13.  * Cache Controller
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_cache
  17.  * @since       1.6
  18.  */
  19. {
  20.     /**
  21.      * @param   boolean            If true, the view output will be cached
  22.      * @param   array  An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  23.      *
  24.      * @return  JController        This object to support chaining.
  25.      * @since   1.5
  26.      */
  27.     public function display($cachable false$urlparams false)
  28.     {
  29.         require_once JPATH_COMPONENT.'/helpers/cache.php';
  30.  
  31.         // Get the document object.
  32.         $document JFactory::getDocument();
  33.  
  34.         // Set the default view name and format from the Request.
  35.         $vName   $this->input->get('view''cache');
  36.         $vFormat $document->getType();
  37.         $lName   $this->input->get('layout''default');
  38.  
  39.         // Get and render the view.
  40.         if ($view $this->getView($vName$vFormat))
  41.         {
  42.             switch ($vName)
  43.             {
  44.                 case 'purge':
  45.                     break;
  46.                 case 'cache':
  47.                 default:
  48.                     $model $this->getModel($vName);
  49.                     $view->setModel($modeltrue);
  50.                     break;
  51.             }
  52.  
  53.             $view->setLayout($lName);
  54.  
  55.             // Push document object into the view.
  56.             $view->document $document;
  57.  
  58.             // Load the submenu.
  59.             CacheHelper::addSubmenu($this->input->get('view''cache'));
  60.  
  61.             $view->display();
  62.         }
  63.     }
  64.  
  65.     public function delete()
  66.     {
  67.         // Check for request forgeries
  68.         JSession::checkToken(or jexit(JText::_('JInvalid_Token'));
  69.  
  70.         $cid $this->input->post->get('cid'array()'array');
  71.  
  72.         $model $this->getModel('cache');
  73.  
  74.         if (empty($cid))
  75.         {
  76.             JError::raiseWarning(500JText::_('JERROR_NO_ITEMS_SELECTED'));
  77.         }
  78.         else
  79.         {
  80.             $model->cleanlist($cid);
  81.         }
  82.  
  83.         $this->setRedirect('index.php?option=com_cache&client='.$model->getClient()->id);
  84.     }
  85.  
  86.     public function purge()
  87.     {
  88.         // Check for request forgeries
  89.         JSession::checkToken(or jexit(JText::_('JInvalid_Token'));
  90.  
  91.         $model $this->getModel('cache');
  92.         $ret $model->purge();
  93.  
  94.         $msg JText::_('COM_CACHE_EXPIRED_ITEMS_HAVE_BEEN_PURGED');
  95.         $msgType 'message';
  96.  
  97.         if ($ret === false)
  98.         {
  99.             $msg JText::_('COM_CACHE_EXPIRED_ITEMS_PURGING_ERROR');
  100.             $msgType 'error';
  101.         }
  102.  
  103.         $this->setRedirect('index.php?option=com_cache&view=purge'$msg$msgType);
  104.     }
  105. }

Documentation generated on Tue, 19 Nov 2013 14:57:06 +0100 by phpDocumentor 1.4.3