From e7ce47c9bd4b7b5f91b418c0133232255cb433b7 Mon Sep 17 00:00:00 2001
From: triatic <42704418+triatic@users.noreply.github.com>
Date: Thu, 15 Nov 2018 00:30:06 +0000
Subject: [PATCH 1/4] [TwitterBridge] Fully decode item
Fully decode item. Some incidences of " in the RSS output.
---
bridges/TwitterBridge.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/bridges/TwitterBridge.php b/bridges/TwitterBridge.php
index 47bc30d25fd..efbf6c259f9 100644
--- a/bridges/TwitterBridge.php
+++ b/bridges/TwitterBridge.php
@@ -148,7 +148,7 @@ public function collectData(){
// extract fullname (pseudonym)
$item['fullname'] = $tweet->getAttribute('data-name');
// get author
- $item['author'] = $item['fullname'] . ' (@' . $item['username'] . ')';
+ $item['author'] = htmlspecialchars_decode($item['fullname'] . ' (@' . $item['username'] . ')', ENT_QUOTES);
// get avatar link
$item['avatar'] = $tweet->find('img', 0)->src;
// get TweetID
@@ -158,7 +158,7 @@ public function collectData(){
// extract tweet timestamp
$item['timestamp'] = $tweet->find('span.js-short-timestamp', 0)->getAttribute('data-time');
// generate the title
- $item['title'] = strip_tags($this->fixAnchorSpacing($tweet->find('p.js-tweet-text', 0), ''));
+ $item['title'] = htmlspecialchars_decode(strip_tags($this->fixAnchorSpacing($tweet->find('p.js-tweet-text', 0), '')), ENT_QUOTES);
switch($this->queriedContext) {
case 'By list':
@@ -268,6 +268,7 @@ public function collectData(){
EOD;
}
+ $item['content'] = htmlspecialchars_decode($item['content'], ENT_QUOTES);
// put out
$this->items[] = $item;
From f43f853021ab15601ddace375de1e2c7439d4429 Mon Sep 17 00:00:00 2001
From: triatic <42704418+triatic@users.noreply.github.com>
Date: Thu, 15 Nov 2018 00:38:24 +0000
Subject: [PATCH 2/4] Update TwitterBridge.php
Fix line length
---
bridges/TwitterBridge.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/bridges/TwitterBridge.php b/bridges/TwitterBridge.php
index efbf6c259f9..c43cf49c70b 100644
--- a/bridges/TwitterBridge.php
+++ b/bridges/TwitterBridge.php
@@ -158,7 +158,8 @@ public function collectData(){
// extract tweet timestamp
$item['timestamp'] = $tweet->find('span.js-short-timestamp', 0)->getAttribute('data-time');
// generate the title
- $item['title'] = htmlspecialchars_decode(strip_tags($this->fixAnchorSpacing($tweet->find('p.js-tweet-text', 0), '')), ENT_QUOTES);
+ $item['title'] = htmlspecialchars_decode(
+ strip_tags($this->fixAnchorSpacing($tweet->find('p.js-tweet-text', 0), '')), ENT_QUOTES);
switch($this->queriedContext) {
case 'By list':
From 01e4416d84af7462a54c504bc0799c85029c2981 Mon Sep 17 00:00:00 2001
From: triatic <42704418+triatic@users.noreply.github.com>
Date: Thu, 15 Nov 2018 20:41:37 +0000
Subject: [PATCH 3/4] Changes made as requested
---
bridges/TwitterBridge.php | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/bridges/TwitterBridge.php b/bridges/TwitterBridge.php
index c43cf49c70b..5d2f3351209 100644
--- a/bridges/TwitterBridge.php
+++ b/bridges/TwitterBridge.php
@@ -144,11 +144,11 @@ public function collectData(){
$item = array();
// extract username and sanitize
- $item['username'] = $tweet->getAttribute('data-screen-name');
+ $item['username'] = htmlspecialchars_decode($tweet->getAttribute('data-screen-name'), ENT_QUOTES);
// extract fullname (pseudonym)
- $item['fullname'] = $tweet->getAttribute('data-name');
+ $item['fullname'] = htmlspecialchars_decode($tweet->getAttribute('data-name'), ENT_QUOTES);
// get author
- $item['author'] = htmlspecialchars_decode($item['fullname'] . ' (@' . $item['username'] . ')', ENT_QUOTES);
+ $item['author'] = $item['fullname'] . ' (@' . $item['username'] . ')';
// get avatar link
$item['avatar'] = $tweet->find('img', 0)->src;
// get TweetID
@@ -158,8 +158,7 @@ public function collectData(){
// extract tweet timestamp
$item['timestamp'] = $tweet->find('span.js-short-timestamp', 0)->getAttribute('data-time');
// generate the title
- $item['title'] = htmlspecialchars_decode(
- strip_tags($this->fixAnchorSpacing($tweet->find('p.js-tweet-text', 0), '')), ENT_QUOTES);
+ $item['title'] = strip_tags($this->fixAnchorSpacing(htmlspecialchars_decode($tweet->find('p.js-tweet-text', 0), ENT_QUOTES), ''));
switch($this->queriedContext) {
case 'By list':
From cb7a9464f10f0b7a5c339e66ff043ad20e1a1bba Mon Sep 17 00:00:00 2001
From: triatic <42704418+triatic@users.noreply.github.com>
Date: Thu, 15 Nov 2018 20:50:25 +0000
Subject: [PATCH 4/4] Line length
---
bridges/TwitterBridge.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/bridges/TwitterBridge.php b/bridges/TwitterBridge.php
index 5d2f3351209..fc7b78bdcca 100644
--- a/bridges/TwitterBridge.php
+++ b/bridges/TwitterBridge.php
@@ -158,7 +158,8 @@ public function collectData(){
// extract tweet timestamp
$item['timestamp'] = $tweet->find('span.js-short-timestamp', 0)->getAttribute('data-time');
// generate the title
- $item['title'] = strip_tags($this->fixAnchorSpacing(htmlspecialchars_decode($tweet->find('p.js-tweet-text', 0), ENT_QUOTES), ''));
+ $item['title'] = strip_tags($this->fixAnchorSpacing(htmlspecialchars_decode(
+ $tweet->find('p.js-tweet-text', 0), ENT_QUOTES), ''));
switch($this->queriedContext) {
case 'By list':