Add existencial comics and smbc
This commit is contained in:
parent
1e63ef2b59
commit
c5be376878
2 changed files with 66 additions and 0 deletions
33
jp_existencial/init.php
Normal file
33
jp_existencial/init.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
class Jp_Existencial extends Plugin {
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
"Adds https to existentialcomics.com images",
|
||||
"Jeena");
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
|
||||
}
|
||||
|
||||
function hook_article_filter($article) {
|
||||
|
||||
if (strpos($article["guid"], "existentialcomics") !== FALSE) {
|
||||
if (strpos($article["plugin_data"], "existentialcomics,$owner_uid:") === FALSE) {
|
||||
$article["content"] = str_replace('src="//static', 'src="https://static', $article["content"]);
|
||||
$article["plugin_data"] = "existentialcomics,$owner_uid:" . $article["plugin_data"];
|
||||
} else if (isset($article["stored"]["content"])) {
|
||||
$article["content"] = $article["stored"]["content"];
|
||||
}
|
||||
}
|
||||
|
||||
return $article;
|
||||
}
|
||||
|
||||
function api_version() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
}
|
33
jp_smbc/init.php
Normal file
33
jp_smbc/init.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
class Jp_SMBC extends Plugin {
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
"Put image in paragraph in SMBC",
|
||||
"Jeena");
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
|
||||
}
|
||||
|
||||
function hook_article_filter($article) {
|
||||
|
||||
if (strpos($article["guid"], "www.smbc-comics.com") !== FALSE) {
|
||||
if (strpos($article["plugin_data"], "smbc,$owner_uid:") === FALSE) {
|
||||
$article["content"] = "<p>" + $article["content"];
|
||||
$article["plugin_data"] = "smbc,$owner_uid:" . $article["plugin_data"];
|
||||
} else if (isset($article["stored"]["content"])) {
|
||||
$article["content"] = $article["stored"]["content"];
|
||||
}
|
||||
}
|
||||
|
||||
return $article;
|
||||
}
|
||||
|
||||
function api_version() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue