1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hubzilla_ynh.git synced 2024-09-03 19:26:21 +02:00
hubzilla_ynh/sources/addons/bookmarker/bookmarker.php

42 lines
997 B
PHP
Raw Normal View History

<?php
/**
* Name: bookmarker
* Description: replace #^ with bookmark icon
* Version: 1.0
* Author: Mike Macgirvin <mike@zothub.com>
*
*/
function bookmarker_install() {
register_hook('prepare_body', 'addon/bookmarker/bookmarker.php', 'bookmarker_prepare_body', 10);
}
function bookmarker_uninstall() {
unregister_hook('prepare_body', 'addon/bookmarker/bookmarker.php', 'bookmarker_prepare_body');
}
function bookmarker_prepare_body(&$a,&$b) {
if(get_pconfig(local_channel(),'bookmarker','disable'))
return;
if(! strpos($b['html'],'bookmark-identifier'))
return;
if(! function_exists('redbasic_init'))
return;
$id = $b['item']['id'];
if(local_channel())
$link = '<a class="fakelink" onclick="itemBookmark(' . $id . '); return false;" title="' . t('Save Bookmarks') . '" href="#"><i class="icon-bookmark"></i></a> ';
else
$link = '<i class="icon-bookmark"></i></a> ';
$b['html'] = str_replace('<span class="bookmark-identifier">#^</span>',$link,$b['html']);
}