"Settings" aren't called "Settings" anymore #185

Merged
annando merged 5 commits from master into master 2014-03-23 08:30:26 +01:00
Showing only changes of commit 0568a5d8bb - Show all commits

View file

@ -10,12 +10,22 @@
function convpath_install() {
register_hook('page_end', 'addon/convpath/convpath.php', 'convpath_page_end');
register_hook('page_header', 'addon/convpath/convpath.php', 'convpath_page_header');
register_hook('ping_xmlize', 'addon/convpath/convpath.php', 'convpath_ping_xmlize_hook');
register_hook('prepare_body', 'addon/convpath/convpath.php', 'convpath_prepare_body_hook');
register_hook('display_item', 'addon/convpath/convpath.php', 'convpath_display_item_hook');
}
function convpath_uninstall() {
unregister_hook('page_end', 'addon/convpath/convpath.php', 'convpath_page_end');
unregister_hook('page_header', 'addon/convpath/convpath.php', 'convpath_page_header');
unregister_hook('ping_xmlize', 'addon/convpath/convpath.php', 'convpath_ping_xmlize_hook');
unregister_hook('prepare_body', 'addon/convpath/convpath.php', 'convpath_prepare_body_hook');
unregister_hook('display_item', 'addon/convpath/convpath.php', 'convpath_display_item_hook');
}
function convpath_ping_xmlize_hook(&$a, &$o) {
$o["photo"] = convpath_url($a, $o["photo"]);
}
function convpath_page_header(&$a, &$o){
@ -27,6 +37,42 @@ function convpath_page_end(&$a, &$o){
$a->page['aside'] = convpath_convert($a->page['aside']);
}
function convpath_prepare_body_hook(&$a, &$o) {
$o["html"] = convpath_convert($o["html"]);
}
function convpath_display_item_hook(&$a, &$o) {
if (isset($o["output"])) {
if (isset($o["output"]["thumb"]))
$o["output"]["thumb"] = convpath_url($a, $o["output"]["thumb"]);
if (isset($o["output"]["author-avatar"]))
$o["output"]["author-avatar"] = convpath_url($a, $o["output"]["author-avatar"]);
if (isset($o["output"]["owner-avatar"]))
$o["output"]["owner-avatar"] = convpath_url($a, $o["output"]["owner-avatar"]);
if (isset($o["output"]["owner_photo"]))
$o["output"]["owner_photo"] = convpath_url($a, $o["output"]["owner_photo"]);
}
}
function convpath_url($a, $path) {
if ($path == "")
return("");
$ssl = (substr($a->get_baseurl(), 0, 8) == "https://");
if ($ssl) {
$search = "http://".$a->get_hostname();
$replace = "https://".$a->get_hostname();
} else {
$search = "https://".$a->get_hostname();
$replace = "http://".$a->get_hostname();
}
$path = str_replace($search, $replace, $path);
return($path);
}
/*
Converts a given path according to the current scheme
*/