Skip to content

Commit

Permalink
Release v1.3.9 - Fixes issue with params option not applying if que…
Browse files Browse the repository at this point in the history
…ry / GET params not yet set.
  • Loading branch information
reganlawton committed Jun 16, 2021
1 parent 7d5171c commit 8a209f9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# oEmbed Changelog

## 1.3.9 - 2020-06-16

### Updated
- Fixes issue with `params` option not applying if query / GET params not yet set, this resolves issues [#53](https://github.com/wrav/oembed/issues/53).

## 1.3.8 - 2020-06-15

### Updated
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "wrav/oembed",
"description": "A simple plugin to extract media information from websites, like youtube videos, twitter statuses or blog articles.",
"type": "craft-plugin",
"version": "1.3.8",
"version": "1.3.9",
"keywords": [
"craft",
"cms",
Expand Down
5 changes: 5 additions & 0 deletions src/services/OembedService.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ public function __call(string $name , array $arguments )

$src = $this->manageGDPR($src);

// Solved issue with "params" options not applying
if (!preg_match('/\?(.*)$/i', $src)) {
$src .= "?";
}

if(!empty($options['params'])) {
foreach((array)$options['params'] as $key => $value) {
$src = preg_replace('/\?(.*)$/i', '?'.$key.'='. $value .'&${1}', $src);
Expand Down

0 comments on commit 8a209f9

Please sign in to comment.