[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage com_content 6 * 7 * @copyright (C) 2009 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\Administrator\Controller; 12 13 use Joomla\CMS\Language\Text; 14 15 // phpcs:disable PSR1.Files.SideEffects 16 \defined('_JEXEC') or die; 17 // phpcs:enable PSR1.Files.SideEffects 18 19 /** 20 * Featured content controller class. 21 * 22 * @since 1.6 23 */ 24 class FeaturedController extends ArticlesController 25 { 26 /** 27 * Removes an item. 28 * 29 * @return void 30 * 31 * @since 1.6 32 */ 33 public function delete() 34 { 35 // Check for request forgeries 36 $this->checkToken(); 37 38 $user = $this->app->getIdentity(); 39 $ids = (array) $this->input->get('cid', array(), 'int'); 40 41 // Access checks. 42 foreach ($ids as $i => $id) { 43 // Remove zero value resulting from input filter 44 if ($id === 0) { 45 unset($ids[$i]); 46 47 continue; 48 } 49 50 if (!$user->authorise('core.delete', 'com_content.article.' . (int) $id)) { 51 // Prune items that you can't delete. 52 unset($ids[$i]); 53 $this->app->enqueueMessage(Text::_('JERROR_CORE_DELETE_NOT_PERMITTED'), 'notice'); 54 } 55 } 56 57 if (empty($ids)) { 58 $this->app->enqueueMessage(Text::_('JERROR_NO_ITEMS_SELECTED'), 'error'); 59 } else { 60 /** @var \Joomla\Component\Content\Administrator\Model\FeatureModel $model */ 61 $model = $this->getModel(); 62 63 // Remove the items. 64 if (!$model->featured($ids, 0)) { 65 $this->app->enqueueMessage($model->getError(), 'error'); 66 } 67 } 68 69 $this->setRedirect('index.php?option=com_content&view=featured'); 70 } 71 72 /** 73 * Method to publish a list of articles. 74 * 75 * @return void 76 * 77 * @since 1.0 78 */ 79 public function publish() 80 { 81 parent::publish(); 82 83 $this->setRedirect('index.php?option=com_content&view=featured'); 84 } 85 86 /** 87 * Method to get a model object, loading it if required. 88 * 89 * @param string $name The model name. Optional. 90 * @param string $prefix The class prefix. Optional. 91 * @param array $config Configuration array for model. Optional. 92 * 93 * @return \Joomla\CMS\MVC\Model\BaseDatabaseModel The model. 94 * 95 * @since 1.6 96 */ 97 public function getModel($name = 'Feature', $prefix = 'Administrator', $config = array('ignore_request' => true)) 98 { 99 return parent::getModel($name, $prefix, $config); 100 } 101 }
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 |