advancedcontentfilter: Add language values to filter fields (#10052, #10136)
[friendica-addons.git/.git] / notimeline / notimeline.php
1 <?php
2 /**
3  * Name: Notimeline
4  * Description: Disable "Archives" widget on profile page
5  * Version: 1.0
6  * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
7  * Status: Unsupported
8  *
9  */
10 use Friendica\Core\Hook;
11 use Friendica\DI;
12
13 function notimeline_install()
14 {
15         Hook::register('addon_settings', 'addon/notimeline/notimeline.php', 'notimeline_settings');
16         Hook::register('addon_settings_post', 'addon/notimeline/notimeline.php', 'notimeline_settings_post');
17 }
18
19 function notimeline_settings_post($a, $post)
20 {
21         if (!local_user() || empty($_POST['notimeline-submit'])) {
22                 return;
23         }
24
25         DI::pConfig()->set(local_user(), 'system', 'no_wall_archive_widget', intval($_POST['notimeline']));
26 }
27
28 function notimeline_settings(&$a, &$s)
29 {
30         if (! local_user()) {
31                 return;
32         }
33
34         /* Add our stylesheet to the page so we can make our settings look nice */
35
36         DI::page()['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/notimeline/notimeline.css' . '" media="all" />' . "\r\n";
37
38         /* Get the current state of our config variable */
39
40         $notimeline = DI::pConfig()->get(local_user(), 'system', 'no_wall_archive_widget', false);
41
42         $notimeline_checked = (($notimeline) ? ' checked="checked" ' : '');
43
44         
45         /* Add some HTML to the existing form */
46
47         $s .= '<div class="settings-block">';
48         $s .= '<h3>' . DI::l10n()->t('No Timeline Settings') . '</h3>';
49         $s .= '<div id="notimeline-wrapper">';
50         $s .= '<label id="notimeline-label" for="notimeline-checkbox">' . DI::l10n()->t('Disable Archive selector on profile wall') . '</label>';
51         $s .= '<input id="notimeline-checkbox" type="checkbox" name="notimeline" value="1" ' . $notimeline_checked . '/>';
52         $s .= '</div><div class="clear"></div>';
53
54         /* provide a submit button */
55
56         $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="notimeline-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div></div>';
57 }