Skip to content

Commit

Permalink
Use default settings extender (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland authored Jul 1, 2022
1 parent 32dcf58 commit be4e74b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions extend.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@

(new Extend\ApiSerializer(BasicPostSerializer::class))
->attributes(ModifyContentHtml::class),

(new Extend\Settings())
->default('fof-secure-https.proxy', false),
];
2 changes: 1 addition & 1 deletion src/FormatImages.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(SettingsRepositoryInterface $settings, UrlGenerator
*/
public function __invoke(Renderer $renderer, $context, string $xml)
{
if ((bool) $this->settings->get('fof-secure-https.proxy', false)) {
if ((bool) $this->settings->get('fof-secure-https.proxy')) {
$xml = Utils::replaceAttributes($xml, 'IMG', function ($attributes) {
$attributes['src'] = $this->url->to('api')->route('fof.secure-https.imgurl').'?imgurl='.urlencode($attributes['src']);

Expand Down
2 changes: 1 addition & 1 deletion src/ModifyContentHtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct(SettingsRepositoryInterface $settings)

public function __invoke(BasicPostSerializer $serializer, Post $post, array $attributes): array
{
if (!(bool) $this->settings->get('fof-secure-https.proxy', false) && isset($attributes['contentHtml'])) {
if (!(bool) $this->settings->get('fof-secure-https.proxy') && isset($attributes['contentHtml'])) {
$attributes['contentHtml'] = preg_replace($this->regex, $this->subst, $attributes['contentHtml']);
}

Expand Down

0 comments on commit be4e74b

Please sign in to comment.