Fix for two bugs in Doghouse Diaries rss: spaces in img src and quotes in alt/title text
This commit is contained in:
parent
51a08380a9
commit
48790c2294
1 changed files with 16 additions and 2 deletions
18
init.php
18
init.php
|
|
@ -148,6 +148,17 @@ class gdorn_comics extends Plugin {
|
||||||
$xpath = $this->get_xpath_dealie($article['link']);
|
$xpath = $this->get_xpath_dealie($article['link']);
|
||||||
$article['content'] = $this->get_img_tags($xpath, "//div[@class='img-comic-container']//img", $article);
|
$article['content'] = $this->get_img_tags($xpath, "//div[@class='img-comic-container']//img", $article);
|
||||||
}
|
}
|
||||||
|
// Doghouse Diaries, which has broken alt tags in feedburner (if there are quotes)
|
||||||
|
elseif (strpos($article['content'], 'thedoghousediaries.com/dhdcomics/') !== FALSE){
|
||||||
|
$xpath = $this->get_xpath_dealie($article['link']);
|
||||||
|
$article['content'] = $this->get_img_tags($xpath, "//div[@id='imgdiv']//img", $article);
|
||||||
|
//also get blog
|
||||||
|
$entries = $xpath->query("//div[@id='signoff-wrapper']");
|
||||||
|
foreach ($entries as $entry) {
|
||||||
|
$article['content'] .= "<p><i>" . $entry->textContent . "</i></p>";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
// Scenes From A Multiverse (to get alt tags)
|
// Scenes From A Multiverse (to get alt tags)
|
||||||
elseif (strpos($article['link'], 'amultiverse.com/comic/') !== FALSE) {
|
elseif (strpos($article['link'], 'amultiverse.com/comic/') !== FALSE) {
|
||||||
$xpath = $this->get_xpath_dealie($article['link']);
|
$xpath = $this->get_xpath_dealie($article['link']);
|
||||||
|
|
@ -206,8 +217,9 @@ class gdorn_comics extends Plugin {
|
||||||
$img = preg_replace("@height=\"\d+\"@", "", $img);
|
$img = preg_replace("@height=\"\d+\"@", "", $img);
|
||||||
$article['content'] = $img;
|
$article['content'] = $img;
|
||||||
}
|
}
|
||||||
} //Sites that provide images and just need alt tags textified.
|
}
|
||||||
elseif (strpos($article['content'], 'www.asofterworld.com/index.php?id') !== FALSE || strpos($article['content'], 'thedoghousediaries.com/dhdcomics/') !== FALSE) {
|
//Sites that provide images and just need alt tags textified.
|
||||||
|
elseif (strpos($article['content'], 'www.asofterworld.com/index.php?id') !== FALSE) {
|
||||||
//no-op
|
//no-op
|
||||||
}
|
}
|
||||||
//No matches
|
//No matches
|
||||||
|
|
@ -279,6 +291,7 @@ class gdorn_comics extends Plugin {
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
$orig_src = $entry->getAttribute('src');
|
$orig_src = $entry->getAttribute('src');
|
||||||
$new_src = $this->rel2abs($orig_src, $article['link']);
|
$new_src = $this->rel2abs($orig_src, $article['link']);
|
||||||
|
$article['debugging'][] = "rel2abs turned ($orig_src) into ($new_src)";
|
||||||
$entry->setAttribute('src', $new_src);
|
$entry->setAttribute('src', $new_src);
|
||||||
$result_html .= $entry->ownerDocument->saveXML($entry);
|
$result_html .= $entry->ownerDocument->saveXML($entry);
|
||||||
}
|
}
|
||||||
|
|
@ -308,6 +321,7 @@ class gdorn_comics extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
function rel2abs($rel, $base) {
|
function rel2abs($rel, $base) {
|
||||||
|
$rel = trim($rel);
|
||||||
if (parse_url($rel, PHP_URL_SCHEME) != '' || substr($rel, 0, 2) == '//') {
|
if (parse_url($rel, PHP_URL_SCHEME) != '' || substr($rel, 0, 2) == '//') {
|
||||||
return $rel;
|
return $rel;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue