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