[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Plugin 5 * @subpackage Privacy.contact 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 use Joomla\Database\ParameterType; 17 18 // phpcs:disable PSR1.Files.SideEffects 19 \defined('_JEXEC') or die; 20 // phpcs:enable PSR1.Files.SideEffects 21 22 /** 23 * Privacy plugin managing Joomla user contact data 24 * 25 * @since 3.9.0 26 */ 27 class PlgPrivacyContact extends PrivacyPlugin 28 { 29 /** 30 * Processes an export request for Joomla core user contact data 31 * 32 * This event will collect data for the contact core tables: 33 * 34 * - Contact custom fields 35 * 36 * @param RequestTable $request The request record being processed 37 * @param User $user The user account associated with this request if available 38 * 39 * @return \Joomla\Component\Privacy\Administrator\Export\Domain[] 40 * 41 * @since 3.9.0 42 */ 43 public function onPrivacyExportRequest(RequestTable $request, User $user = null) 44 { 45 if (!$user && !$request->email) { 46 return array(); 47 } 48 49 $domains = array(); 50 $domain = $this->createDomain('user_contact', 'joomla_user_contact_data'); 51 $domains[] = $domain; 52 53 $query = $this->db->getQuery(true) 54 ->select('*') 55 ->from($this->db->quoteName('#__contact_details')) 56 ->order($this->db->quoteName('ordering') . ' ASC'); 57 58 if ($user) { 59 $query->where($this->db->quoteName('user_id') . ' = :id') 60 ->bind(':id', $user->id, ParameterType::INTEGER); 61 } else { 62 $query->where($this->db->quoteName('email_to') . ' = :email') 63 ->bind(':email', $request->email); 64 } 65 66 $items = $this->db->setQuery($query)->loadObjectList(); 67 68 foreach ($items as $item) { 69 $domain->addItem($this->createItemFromArray((array) $item)); 70 } 71 72 $domains[] = $this->createCustomFieldsDomain('com_contact.contact', $items); 73 74 return $domains; 75 } 76 }
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 |