Skip to content
Snippets Groups Projects
Commit 622e9e42 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Anchorelemente werden nun korrekt unterstützt

parent 2685409d
No related branches found
No related tags found
No related merge requests found
...@@ -46,13 +46,22 @@ class HtmlDocument extends Document ...@@ -46,13 +46,22 @@ class HtmlDocument extends Document
# First things first. Let's change all a Tags that can define a target Attribute # First things first. Let's change all a Tags that can define a target Attribute
foreach ($dom->getElementsByTagName('a') as $link) { foreach ($dom->getElementsByTagName('a') as $link) {
# All Links within a "a" Tag need to target the top level because they change the site on click if ($link->hasAttribute("href")) {
$this->convertTargetAttribute($link, "_top"); if (stripos($link->getAttribute("href"), "#") === 0) {
# Convert all relative Links to absolute Ones continue;
$link->setAttribute("href", $this->convertRelativeToAbsoluteLink($link->getAttribute("href"))); } elseif (stripos($link->getAttribute("href"), "javascript:") === 0) {
# Convert all Links to the proxified Version $link->setAttribute("href", "");
# All of this Links should target to the top Level } else {
$link->setAttribute("href", $this->proxifyUrl($link->getAttribute("href"), true)); # All Links within a "a" Tag need to target the top level because they change the site on click
$this->convertTargetAttribute($link, "_top");
# Convert all relative Links to absolute Ones
$link->setAttribute("href", $this->convertRelativeToAbsoluteLink($link->getAttribute("href")));
# Convert all Links to the proxified Version
# All of this Links should target to the top Level
$link->setAttribute("href", $this->proxifyUrl($link->getAttribute("href"), true));
}
}
} }
# All Buttons # All Buttons
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment