Skip to content

Commit

Permalink
Don't double-encode textfilter content
Browse files Browse the repository at this point in the history
  • Loading branch information
Bloke committed Jul 13, 2020
1 parent 22f32ec commit 45e07ca
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.textile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
h1. Changelog

h2. 0.6.1 - 2020-07-13

* Don't double-encode textfilter content.

h2. 0.6.0 - 2020-07-13

* Add support for textfilters
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "smd_meta_image",
"description": "A Textpattern CMS plugin for importing images using IPTC metadata to populate content",
"version": "0.6.0",
"version": "0.6.1",
"type": 4,
"author": "Stef Dawson",
"author_uri": "https://stefdawson.com/",
Expand Down
15 changes: 3 additions & 12 deletions smd_meta_image.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// 1 = Plugin help is in raw HTML. Not recommended.
# $plugin['allow_html_help'] = 1;

$plugin['version'] = '0.6.0';
$plugin['version'] = '0.6.1';
$plugin['author'] = 'Stef Dawson';
$plugin['author_uri'] = 'https://stefdawson.com/';
$plugin['description'] = 'A Textpattern CMS plugin for importing images using IPTC metadata to populate content.';
Expand Down Expand Up @@ -336,7 +336,7 @@ public function update_image($evt, $stp, $id)

if ($safeVal) {
$artmatch = "Title = '$safeVal'";
$filtered = doSlash($this->applyFilter($safeKey, $safeVal));
$filtered = doSlash($this->applyFilter($safeKey, $val));
$safeKeyHtml = $safeKey .'_html';

$artpayload[] = "url_title = '" . stripSpace(trim($safeVal), 1) . "'";
Expand Down Expand Up @@ -368,7 +368,7 @@ public function update_image($evt, $stp, $id)
if ($imgVal && ($val = $this->replaceIptc($imgVal, $iptc))) {
if ($val) {
$safeVal = doSlash($val);
$filtered = doSlash($this->applyFilter($safeKey, $safeVal));
$filtered = doSlash($this->applyFilter($safeKey, $val));

$safeKeyHtml = $safeKey .'_html';
$artpayload[] = "$safeKey = '$safeVal'";
Expand Down Expand Up @@ -604,15 +604,6 @@ protected function applyFilter($key, $val)
}

if (in_array($key, $fields)) {
// Normalize line endings. Note 'real' newlines split the code onto the next line.
// @todo Is there a preg_replace() that could do this in one? \R is supposed to
// represent all newline sequences.
$val = str_replace('\r\n', '
', $val);
$val = str_replace('\r', '
', $val);
$val = str_replace('\n', '
', $val);
// Filter.
$out = $textfilter->filter(
$filterInUse,
Expand Down

0 comments on commit 45e07ca

Please sign in to comment.