1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
consentpreview.php
См. документацию.
1<?php
2
4
11
13{
23
24 public function loadDataAction(JsonPayload $payload)
25 {
26 $request = $payload->getData();
27 $request = is_array($request) ? $request : [];
28
29 $agreement = $this->getAgreement((int)$request['id']);
30
31 if (!$agreement)
32 {
33 return false;
34 }
35
36 $contentBody = Security\Sanitizer::fixReplacedStyles($agreement->getHtml());
37 $contentBody = Security\Sanitizer::sanitizeHtml($contentBody, $agreement->getText());
38 return [
39 'consentBody' => $contentBody,
40 'approveBtnText' => Consent::getApproveBtnText($agreement),
41 'rejectBtnText' => Consent::getRejectnBtnText(),
42 ];
43 }
44
45 private function getAgreement(int $agreementId): ?Main\UserConsent\Agreement
46 {
47 $agreement = new Main\UserConsent\Agreement($agreementId, ['fields' => []]);
48 if (!$agreement->isActive() || !$agreement->isExist())
49 {
50 return null;
51 }
52
53 return $agreement;
54 }
55}
static sanitizeHtml($html, $previousHtml='', User $user=null)
Определения sanitizer.php:27
static fixReplacedStyles($html)
Определения sanitizer.php:76
Определения access.php:3