X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=randplace%2Frandplace.php;h=ca4d3d797d0783d24a5becefb3f1aabc448a3dcc;hb=39dd3dffe07efd69fa1ac6d0bd243c7fc0e3a66f;hp=96e549a67470af2831313d147dbd9884eac6d8d8;hpb=c6e5bc3429c9c610895ba826d841cddd8c0f378b;p=friendica-addons.git diff --git a/randplace/randplace.php b/randplace/randplace.php index 96e549a6..ca4d3d79 100644 --- a/randplace/randplace.php +++ b/randplace/randplace.php @@ -4,9 +4,9 @@ * Description: Sample Friendica addon. Set a random place when posting. * Version: 1.0 * Author: Mike Macgirvin - * - * - * + * + * + * * * Addons are registered with the system through the admin * panel. @@ -14,11 +14,12 @@ * When registration is detected, the system calls the addon * name_install() function, located in 'addon/name/name.php', * where 'name' is the name of the addon. - * If the addon is removed from the configuration list, the + * If the addon is removed from the configuration list, the * system will call the name_uninstall() function. * */ use Friendica\Core\Addon; +use Friendica\Core\L10n; use Friendica\Core\PConfig; function randplace_install() { @@ -91,7 +92,7 @@ function randplace_post_hook($a, &$item) { /* Retrieve our personal config setting */ - $active = PConfig::get(local_user(), 'randplace', 'enable'); + $active = get_pconfig(local_user(), 'randplace', 'enable'); if(! $active) return; @@ -105,7 +106,7 @@ function randplace_post_hook($a, &$item) { * */ - $cities = []; + $cities = array(); $zones = timezone_identifiers_list(); foreach($zones as $zone) { if((strpos($zone,'/')) && (! stristr($zone,'US/')) && (! stristr($zone,'Etc/'))) @@ -136,7 +137,7 @@ function randplace_settings_post($a,$post) { if(! local_user()) return; if($_POST['randplace-submit']) - PConfig::set(local_user(),'randplace','enable',intval($_POST['randplace'])); + set_pconfig(local_user(),'randplace','enable',intval($_POST['randplace'])); } @@ -160,21 +161,21 @@ function randplace_settings(&$a,&$s) { /* Get the current state of our config variable */ - $enabled = PConfig::get(local_user(),'randplace','enable'); + $enabled = get_pconfig(local_user(),'randplace','enable'); $checked = (($enabled) ? ' checked="checked" ' : ''); /* Add some HTML to the existing form */ $s .= '
'; - $s .= '

' . t('Randplace Settings') . '

'; + $s .= '

' . L10n::t('Randplace Settings') . '

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