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;
14 function notimeline_install()
16 Hook::register('addon_settings', 'addon/notimeline/notimeline.php', 'notimeline_settings');
17 Hook::register('addon_settings_post', 'addon/notimeline/notimeline.php', 'notimeline_settings_post');
20 function notimeline_uninstall()
22 Hook::unregister('addon_settings', 'addon/notimeline/notimeline.php', 'notimeline_settings');
23 Hook::unregister('addon_settings_post', 'addon/notimeline/notimeline.php', 'notimeline_settings_post');
26 function notimeline_settings_post($a, $post)
28 if (!local_user() || empty($_POST['notimeline-submit'])) {
32 PConfig::set(local_user(), 'system', 'no_wall_archive_widget', intval($_POST['notimeline']));
33 info(L10n::t('No Timeline settings updated.') . EOL);
36 function notimeline_settings(&$a, &$s)
42 /* Add our stylesheet to the page so we can make our settings look nice */
44 $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->getBaseURL() . '/addon/notimeline/notimeline.css' . '" media="all" />' . "\r\n";
46 /* Get the current state of our config variable */
48 $notimeline = PConfig::get(local_user(), 'system', 'no_wall_archive_widget', false);
50 $notimeline_checked = (($notimeline) ? ' checked="checked" ' : '');
53 /* Add some HTML to the existing form */
55 $s .= '<div class="settings-block">';
56 $s .= '<h3>' . L10n::t('No Timeline Settings') . '</h3>';
57 $s .= '<div id="notimeline-wrapper">';
58 $s .= '<label id="notimeline-label" for="notimeline-checkbox">' . L10n::t('Disable Archive selector on profile wall') . '</label>';
59 $s .= '<input id="notimeline-checkbox" type="checkbox" name="notimeline" value="1" ' . $notimeline_checked . '/>';
60 $s .= '</div><div class="clear"></div>';
62 /* provide a submit button */
64 $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="notimeline-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';