Skip to content

Commit

Permalink
feat: handle iframe, script and acceptance in a new way (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
NiclasNorin authored Oct 19, 2023
1 parent 31cc9ed commit 7b1a63b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
21 changes: 11 additions & 10 deletions source/php/Component/Acceptance/Acceptance.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,28 @@ public function init()
}

if (!empty($this->data['labels'])) {
$json = json_decode($this->data['labels']);
$knownLabels = json_encode($this->data['labels']['knownLabels']);
$unknownLabels = json_encode($this->data['labels']['unknownLabels']);

if (isset($json->infoLabel)) {
$this->data['infoLabel'] = $json->infoLabel;
if (isset($this->data['labels']->infoLabel)) {
$this->data['infoLabel'] = $this->data['labels']->infoLabel;
}

if (!empty($this->data['supplierPolicy'])) {
$json->knownLabels->info = str_replace(
$knownLabels = str_replace(
array('{SUPPLIER_WEBSITE}', '{SUPPLIER_POLICY}'),
array($this->data['supplierName'], $this->data['supplierPolicy']),
$json->knownLabels->info ?? ''
$knownLabels
);

$this->data['labels'] = $json->knownLabels ?? '';
$this->data['labels'] = json_decode($knownLabels);
} else {
$json->unknownLabels->info = str_replace(
$unknownLabels = str_replace(
'{SUPPLIER_WEBSITE}',
$this->data['supplierHost'],
$json->unknownLabels->info ?? ''
$unknownLabels
);
$this->data['labels'] = $json->unknownLabels;
$this->data['labels'] = json_decode($unknownLabels);
}
}

Expand Down Expand Up @@ -249,4 +250,4 @@ public function __construct(
$this->requiresAccept = $requiresAccept;
$this->systemType = $systemType;
}
}
}
2 changes: 1 addition & 1 deletion source/php/Component/Iframe/Iframe.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function init()
}

if (isset($labels)) {
$this->data['labels'] = json_encode($labels);
$this->data['labels'] = $labels;
}

if(!empty($poster)) {
Expand Down

0 comments on commit 7b1a63b

Please sign in to comment.