* Maintainer: ivan zlax <@zlax@ussr.win> */ use Zotlabs\Lib\Apps; use Zotlabs\Extend\Hook; use Zotlabs\Extend\Route; function link_load() { Route::register('addon/link/Mod_Link.php','link'); if (get_config('link','linkonhub')) register_hook('page_end', 'addon/link/link.php', 'link_active'); set_config('link','linkenabled',1); } function link_unload() { Route::unregister('addon/link/Mod_Link.php','link'); unregister_hook('page_end', 'addon/link/link.php', 'link_active'); del_config('link','linkenabled'); } function link_plugin_admin(&$a,&$o) { $t = get_markup_template( "admin.tpl", "addon/link/" ); $o = replace_macros($t, array( '$submit' => t('Submit'), '$linkonhub' => array('linkonhub', t('Show "Link on Hub" button'), get_config('link', 'linkonhub'), t('Currently used temporarily javascript code for the integrating with wall-item-menu (will be fixed later)')), )); } function link_plugin_admin_post(&$a) { set_config('link','linkonhub',trim($_POST['linkonhub'])); info( t('Settings updated.') . EOL); if (get_config('link','linkonhub')) register_hook('page_end', 'addon/link/link.php', 'link_active'); else unregister_hook('page_end', 'addon/link/link.php', 'link_active'); } function link_active(&$a,&$b) { // Javascript code for "Link on Hub" button insert - it is not good, it is temporarily, works not good $b .= "\n\n"; }