X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=widgets%2Fwidgets.php;h=a232d9e6c381cf2baab0f7c5c8c42ba73649eece;hb=6e6f64a5374772aca891464ebb08e70aac53c12c;hp=226a34c060f88c519469c832f1a1f209172e44e0;hpb=a3eb7268aeafbc12e081f94c41c4e08b6e3b7ccc;p=friendica-addons.git diff --git a/widgets/widgets.php b/widgets/widgets.php index 226a34c0..a232d9e6 100644 --- a/widgets/widgets.php +++ b/widgets/widgets.php @@ -1,12 +1,13 @@ */ - - + +use Friendica\Core\PConfig; + function widgets_install() { register_hook('plugin_settings', 'addon/widgets/widgets.php', 'widgets_settings'); register_hook('plugin_settings_post', 'addon/widgets/widgets.php', 'widgets_settings_post'); @@ -19,9 +20,10 @@ function widgets_uninstall() { function widgets_settings_post(){ - + if(! local_user()) + return; if (isset($_POST['widgets-submit'])){ - del_pconfig(local_user(), 'widgets', 'key'); + PConfig::delete(local_user(), 'widgets', 'key'); } } @@ -31,8 +33,8 @@ function widgets_settings(&$a,&$o) { return; - $key = get_pconfig(local_user(), 'widgets', 'key' ); - if ($key=='') { $key = mt_rand(); set_pconfig(local_user(), 'widgets', 'key', $key); } + $key = PConfig::get(local_user(), 'widgets', 'key' ); + if ($key=='') { $key = mt_rand(); PConfig::set(local_user(), 'widgets', 'key', $key); } $widgets = array(); $d = dir(dirname(__file__)); @@ -50,7 +52,8 @@ function widgets_settings(&$a,&$o) { - $t = file_get_contents( dirname(__file__). "/settings.tpl" ); +# $t = file_get_contents( dirname(__file__). "/settings.tpl" ); + $t = get_markup_template("settings.tpl", "addon/widgets/"); $o .= replace_macros($t, array( '$submit' => t('Generate new key'), '$baseurl' => $a->get_baseurl(),