X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=addon%2Frandplace%2Frandplace.php;h=d7ea65c9d23e0b2083b2c38bf50f25d6afdf301c;hb=5c5ff0b87a22ca9c11b9a267321d67f53afe42ba;hp=30474549327bac28e593cb51adc4dedc82137545;hpb=cbb724e1c026ae13df92dfdfbdbe59dcfb017b75;p=friendica.git diff --git a/addon/randplace/randplace.php b/addon/randplace/randplace.php index 3047454932..d7ea65c9d2 100644 --- a/addon/randplace/randplace.php +++ b/addon/randplace/randplace.php @@ -36,14 +36,14 @@ function randplace_install() { /** * - * Then we'll attach into the settings page, on both the - * form and post hooks so that we can create and update + * Then we'll attach into the plugin settings page, and also the + * settings post hook so that we can create and update * user preferences. * */ - register_hook('settings_form', 'addon/randplace/randplace.php', 'randplace_settings'); - register_hook('settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post'); + register_hook('plugin_settings', 'addon/randplace/randplace.php', 'randplace_settings'); + register_hook('plugin_settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post'); logger("installed randplace"); } @@ -60,8 +60,8 @@ function randplace_uninstall() { */ unregister_hook('post_local', 'addon/randplace/randplace.php', 'randplace_post_hook'); - unregister_hook('settings_form', 'addon/randplace/randplace.php', 'randplace_settings'); - unregister_hook('settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post'); + unregister_hook('plugin_settings', 'addon/randplace/randplace.php', 'randplace_settings'); + unregister_hook('plugin_settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post'); logger("removed randplace"); @@ -110,7 +110,7 @@ function randplace_post_hook($a, &$item) { $cities = array(); $zones = timezone_identifiers_list(); foreach($zones as $zone) { - if(strpos($zone,'/')) + if((strpos($zone,'/')) && (! stristr($zone,'US/')) && (! stristr($zone,'Etc/'))) $cities[] = str_replace('_', ' ',substr($zone,strpos($zone,'/') + 1)); } @@ -141,8 +141,9 @@ function randplace_settings_post($a,$post) { } -/* - * Called from the end of the settings form. +/** + * + * Called from the Plugin Setting form. * Add our own settings info to the page. * */ @@ -154,19 +155,25 @@ function randplace_settings(&$a,&$s) { if(! local_user()) return; + /* Add our stylesheet to the page so we can make our settings look nice */ + $a->page['htmlhead'] .= '' . "\r\n"; + /* Get the current state of our config variable */ + $enabled = get_pconfig(local_user(),'randplace','enable'); $checked = (($enabled) ? ' checked="checked" ' : ''); + /* Add some HTML to the existing form */ + $s .= '

' . t('Randplace Settings') . '

'; $s .= '
'; - $s .= ''; + $s .= ''; $s .= ''; $s .= '
'; - // provide another submit button + /* provide a submit button */ $s .= '
';