[ 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_redirect 6 * 7 * @copyright (C) 2017 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\Redirect\Administrator\Controller; 12 13 use Joomla\CMS\HTML\HTMLHelper; 14 use Joomla\CMS\Language\Text; 15 use Joomla\CMS\MVC\Controller\BaseController; 16 use Joomla\CMS\Plugin\PluginHelper; 17 use Joomla\CMS\Router\Route; 18 use Joomla\Component\Redirect\Administrator\Helper\RedirectHelper; 19 20 // phpcs:disable PSR1.Files.SideEffects 21 \defined('_JEXEC') or die; 22 // phpcs:enable PSR1.Files.SideEffects 23 24 /** 25 * Redirect master display controller. 26 * 27 * @since 1.6 28 */ 29 class DisplayController extends BaseController 30 { 31 /** 32 * @var string The default view. 33 * @since 1.6 34 */ 35 protected $default_view = 'links'; 36 37 /** 38 * Method to display a view. 39 * 40 * @param boolean $cachable If true, the view output will be cached. 41 * @param mixed $urlparams An array of safe URL parameters and their variable types, for valid values see {@link \JFilterInput::clean()}. 42 * 43 * @return static|boolean This object to support chaining or false on failure. 44 * 45 * @since 1.5 46 */ 47 public function display($cachable = false, $urlparams = false) 48 { 49 $view = $this->input->get('view', 'links'); 50 $layout = $this->input->get('layout', 'default'); 51 $id = $this->input->getInt('id'); 52 53 if ($view === 'links') { 54 $pluginEnabled = PluginHelper::isEnabled('system', 'redirect'); 55 $collectUrlsEnabled = RedirectHelper::collectUrlsEnabled(); 56 57 // Show messages about the enabled plugin and if the plugin should collect URLs 58 if ($pluginEnabled && $collectUrlsEnabled) { 59 $this->app->enqueueMessage(Text::sprintf('COM_REDIRECT_COLLECT_URLS_ENABLED', Text::_('COM_REDIRECT_PLUGIN_ENABLED')), 'notice'); 60 } else { 61 $redirectPluginId = RedirectHelper::getRedirectPluginId(); 62 $link = HTMLHelper::_( 63 'link', 64 '#plugin' . $redirectPluginId . 'Modal', 65 Text::_('COM_REDIRECT_SYSTEM_PLUGIN'), 66 'class="alert-link" data-bs-toggle="modal" id="title-' . $redirectPluginId . '"' 67 ); 68 69 if ($pluginEnabled && !$collectUrlsEnabled) { 70 $this->app->enqueueMessage( 71 Text::sprintf('COM_REDIRECT_COLLECT_MODAL_URLS_DISABLED', Text::_('COM_REDIRECT_PLUGIN_ENABLED'), $link), 72 'notice' 73 ); 74 } else { 75 $this->app->enqueueMessage(Text::sprintf('COM_REDIRECT_PLUGIN_MODAL_DISABLED', $link), 'error'); 76 } 77 } 78 } 79 80 // Check for edit form. 81 if ($view == 'link' && $layout == 'edit' && !$this->checkEditId('com_redirect.edit.link', $id)) { 82 // Somehow the person just went to the form - we don't allow that. 83 if (!\count($this->app->getMessageQueue())) { 84 $this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 'error'); 85 } 86 87 $this->setRedirect(Route::_('index.php?option=com_redirect&view=links', false)); 88 89 return false; 90 } 91 92 return parent::display(); 93 } 94 }
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 |