[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/plugins/privacy/content/ -> content.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Plugin
   5   * @subpackage  Privacy.content
   6   *
   7   * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9  
  10   * @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
  11   */
  12  
  13  use Joomla\CMS\User\User;
  14  use Joomla\Component\Privacy\Administrator\Plugin\PrivacyPlugin;
  15  use Joomla\Component\Privacy\Administrator\Table\RequestTable;
  16  
  17  // phpcs:disable PSR1.Files.SideEffects
  18  \defined('_JEXEC') or die;
  19  // phpcs:enable PSR1.Files.SideEffects
  20  
  21  /**
  22   * Privacy plugin managing Joomla user content data
  23   *
  24   * @since  3.9.0
  25   */
  26  class PlgPrivacyContent extends PrivacyPlugin
  27  {
  28      /**
  29       * Processes an export request for Joomla core user content data
  30       *
  31       * This event will collect data for the content core table
  32       *
  33       * - Content custom fields
  34       *
  35       * @param   RequestTable  $request  The request record being processed
  36       * @param   User          $user     The user account associated with this request if available
  37       *
  38       * @return  \Joomla\Component\Privacy\Administrator\Export\Domain[]
  39       *
  40       * @since   3.9.0
  41       */
  42      public function onPrivacyExportRequest(RequestTable $request, User $user = null)
  43      {
  44          if (!$user) {
  45              return array();
  46          }
  47  
  48          $domains   = array();
  49          $domain    = $this->createDomain('user_content', 'joomla_user_content_data');
  50          $domains[] = $domain;
  51  
  52          $query = $this->db->getQuery(true)
  53              ->select('*')
  54              ->from($this->db->quoteName('#__content'))
  55              ->where($this->db->quoteName('created_by') . ' = ' . (int) $user->id)
  56              ->order($this->db->quoteName('ordering') . ' ASC');
  57  
  58          $items = $this->db->setQuery($query)->loadObjectList();
  59  
  60          foreach ($items as $item) {
  61              $domain->addItem($this->createItemFromArray((array) $item));
  62          }
  63  
  64          $domains[] = $this->createCustomFieldsDomain('com_content.article', $items);
  65  
  66          return $domains;
  67      }
  68  }


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