4 * Description: Disable "Archives" widget on profile page
6 * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
10 use Friendica\Core\Hook;
13 function notimeline_install()
15 Hook::register('addon_settings', 'addon/notimeline/notimeline.php', 'notimeline_settings');
16 Hook::register('addon_settings_post', 'addon/notimeline/notimeline.php', 'notimeline_settings_post');
19 function notimeline_uninstall()
21 Hook::unregister('addon_settings', 'addon/notimeline/notimeline.php', 'notimeline_settings');
22 Hook::unregister('addon_settings_post', 'addon/notimeline/notimeline.php', 'notimeline_settings_post');
25 function notimeline_settings_post($a, $post)
27 if (!local_user() || empty($_POST['notimeline-submit'])) {
31 DI::pConfig()->set(local_user(), 'system', 'no_wall_archive_widget', intval($_POST['notimeline']));
32 info(DI::l10n()->t('No Timeline settings updated.') . EOL);
35 function notimeline_settings(&$a, &$s)
41 /* Add our stylesheet to the page so we can make our settings look nice */
43 DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl()->get() . '/addon/notimeline/notimeline.css' . '" media="all" />' . "\r\n";
45 /* Get the current state of our config variable */
47 $notimeline = DI::pConfig()->get(local_user(), 'system', 'no_wall_archive_widget', false);
49 $notimeline_checked = (($notimeline) ? ' checked="checked" ' : '');
52 /* Add some HTML to the existing form */
54 $s .= '<div class="settings-block">';
55 $s .= '<h3>' . DI::l10n()->t('No Timeline Settings') . '</h3>';
56 $s .= '<div id="notimeline-wrapper">';
57 $s .= '<label id="notimeline-label" for="notimeline-checkbox">' . DI::l10n()->t('Disable Archive selector on profile wall') . '</label>';
58 $s .= '<input id="notimeline-checkbox" type="checkbox" name="notimeline" value="1" ' . $notimeline_checked . '/>';
59 $s .= '</div><div class="clear"></div>';
61 /* provide a submit button */
63 $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="notimeline-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div></div>';