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

[RaceDepartmentBridge] added a bridge for racedepartment.com #1681

Merged
merged 5 commits into from
Dec 13, 2020

Conversation

t0stiman
Copy link
Contributor

@t0stiman t0stiman commented Aug 3, 2020

No description provided.

Comment on lines 23 to 27
$pattern = '/src="(.+?)"/i';
if(preg_match($pattern, $found->outertext, $match)) {
$iframeUrl = $match[1];
$found->outertext = '<a href="' . $iframeUrl . '">' . $iframeUrl . '</a>';
}
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to use regex to get src value

            $iframeUrl = $found->getAttribute("src");                                                                                 
            if ($iframeUrl) {                                                                                                         
                $found->outertext = '<a href="' . $iframeUrl . '">' . $iframeUrl . '</a>';                                            
            }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@t0stiman
Copy link
Contributor Author

@em92 Question: should I need to do this iframe replacement at all? (line 21 to 29)
The reason I implemented this was because iframes showed up as text (<iframe (...)>) in the article, instead of actually showing the embedded Youtube video. Is this expected? And do you have a better solution, maybe?

p.s. I have been using this bridge since opening this PR and it's worked fine.

@em92
Copy link
Contributor

em92 commented Dec 13, 2020

The reason I implemented this was because iframes showed up as text (<iframe (...)>) in the article, instead of actually showing the embedded Youtube video. Is this expected?

Yes. This is one of sanitizers.

$html = str_replace('<iframe', '<&zwnj;iframe', $html);

And do you have a better solution, maybe?

Unfortunately no. Your solution is good enough.

@em92 em92 merged commit 0b30826 into RSS-Bridge:master Dec 13, 2020
@em92
Copy link
Contributor

em92 commented Dec 13, 2020

gj @t0stiman !

@t0stiman t0stiman deleted the RaceDepartment branch March 8, 2024 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants