[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/components/com_tags/src/Controller/ -> TagsController.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  com_tags
   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\Tags\Site\Controller;
  12  
  13  use Joomla\CMS\Helper\TagsHelper;
  14  use Joomla\CMS\MVC\Controller\BaseController;
  15  
  16  // phpcs:disable PSR1.Files.SideEffects
  17  \defined('_JEXEC') or die;
  18  // phpcs:enable PSR1.Files.SideEffects
  19  
  20  /**
  21   * The Tags List Controller
  22   *
  23   * @since  3.1
  24   */
  25  class TagsController extends BaseController
  26  {
  27      /**
  28       * Method to search tags with AJAX
  29       *
  30       * @return  void
  31       */
  32      public function searchAjax()
  33      {
  34          $user = $this->app->getIdentity();
  35  
  36          // Receive request data
  37          $filters = array(
  38              'like'      => trim($this->input->get('like', null, 'string')),
  39              'title'     => trim($this->input->get('title', null, 'string')),
  40              'flanguage' => $this->input->get('flanguage', null, 'word'),
  41              'published' => $this->input->get('published', 1, 'int'),
  42              'parent_id' => $this->input->get('parent_id', 0, 'int'),
  43              'access'    => $user->getAuthorisedViewLevels(),
  44          );
  45  
  46          if ((!$user->authorise('core.edit.state', 'com_tags')) && (!$user->authorise('core.edit', 'com_tags'))) {
  47              // Filter on published for those who do not have edit or edit.state rights.
  48              $filters['published'] = 1;
  49          }
  50  
  51          $results = TagsHelper::searchTags($filters);
  52  
  53          if ($results) {
  54              // Output a JSON object
  55              echo json_encode($results);
  56          }
  57  
  58          $this->app->close();
  59      }
  60  }


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