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/addon/bookmarker/bookmarker.php

45 lines
1.3 KiB
PHP
Raw Normal View History

<?php
/**
* Name: bookmarker
2016-03-20 08:06:33 +01:00
* Description: Replace #^ with a bookmark icon. Font awesome is used for Redbasic and derived themes. A neutral dark grey PNG file is used for other themes.
* Version: 1.1
* Author: Mike Macgirvin <mike@zothub.com>
* Maintainer: Mike Macgirvin <mike@macgirvin.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;
2016-04-17 16:29:18 +02:00
if(function_exists('redbasic_init') || App::$theme_info['extends'] == 'redbasic')
$bookmarkicon = '<i class="fa fa-bookmark"></i>';
2016-03-20 08:06:33 +01:00
else
$bookmarkicon = '<img src="addon/bookmarker/bookmarker.png" width="19px" height="20px" alt="#^" />';
$id = $b['item']['id'];
if(local_channel())
2016-03-20 08:06:33 +01:00
$link = '<a class="fakelink" onclick="itemBookmark(' . $id . '); return false;" title="' . t('Save Bookmarks') . '" href="#">'. $bookmarkicon . '</a> ';
else
2016-03-20 08:06:33 +01:00
$link = $bookmarkicon . '</a> ';
$b['html'] = str_replace('<span class="bookmark-identifier">#^</span>',$link,$b['html']);
}