Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TwitterBridge] Fully decode item #926

Merged
merged 4 commits into from
Nov 15, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions bridges/TwitterBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't make sense.
$item['fullname'] and $item['username'] may still contain special chars, so they should be decoded beforehand.

// get avatar link
$item['avatar'] = $tweet->find('img', 0)->src;
// get TweetID
Expand All @@ -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($tweet->find('p.js-tweet-text', 0), '<a>'));
$item['title'] = htmlspecialchars_decode(
strip_tags($this->fixAnchorSpacing($tweet->find('p.js-tweet-text', 0), '<a>')), ENT_QUOTES);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

htmlspecialchars_decode should directly be called on $tweet->find('p.js-tweet-text', 0) (before calling $this->fixAnchorSpacing(...) and strip_tags(...)


switch($this->queriedContext) {
case 'By list':
Expand Down Expand Up @@ -268,6 +269,7 @@ public function collectData(){
</div>
EOD;
}
$item['content'] = htmlspecialchars_decode($item['content'], ENT_QUOTES);

// put out
$this->items[] = $item;
Expand Down