X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=blackout%2Fblackout.php;h=4fb824efaddc5e36fe9833b2e026b28919d1d374;hb=c3e93f1ed9a487f823bcc75ddd43024334c25bfc;hp=834956114e4db95385b98e22603847d785ca645b;hpb=f77cb8f890c1bd28b6b6855a1676c2de409b3ed6;p=friendica-addons.git diff --git a/blackout/blackout.php b/blackout/blackout.php index 83495611..4fb824ef 100644 --- a/blackout/blackout.php +++ b/blackout/blackout.php @@ -4,7 +4,7 @@ * Description: Blackout your ~friendica node during a given period, requires PHP >= 5.3 * License: MIT * Version: 1.0 - * Author: Tobias Diekershoff + * Author: Tobias Diekershoff * * About * ===== @@ -49,6 +49,7 @@ * THE SOFTWARE. */ +use Friendica\Core\Config; function blackout_install() { register_hook('page_header', 'addon/blackout/blackout.php', 'blackout_redirect'); @@ -67,9 +68,9 @@ function blackout_redirect ($a, $b) { return true; // else... - $mystart = get_config('blackout','begindate'); - $myend = get_config('blackout','enddate'); - $myurl = get_config('blackout','url'); + $mystart = Config::get('blackout','begindate'); + $myend = Config::get('blackout','enddate'); + $myurl = Config::get('blackout','url'); $now = time(); $date1 = DateTime::createFromFormat('Y-m-d G:i', $mystart); $date2 = DateTime::createFromFormat('Y-m-d G:i', $myend); @@ -87,16 +88,16 @@ function blackout_redirect ($a, $b) { } function blackout_plugin_admin(&$a, &$o) { - $mystart = get_config('blackout','begindate'); + $mystart = Config::get('blackout','begindate'); if (! is_string($mystart)) { $mystart = "YYYY-MM-DD:hhmm"; } - $myend = get_config('blackout','enddate'); + $myend = Config::get('blackout','enddate'); if (! is_string($myend)) { $myend = "YYYY-MM-DD:hhmm"; } - $myurl = get_config('blackout','url'); + $myurl = Config::get('blackout','url'); if (! is_string($myurl)) { $myurl = "http://www.example.com"; } $t = get_markup_template( "admin.tpl", "addon/blackout/" ); $o = replace_macros($t, array( - '$submit' => t('Submit'), + '$submit' => t('Save Settings'), '$rurl' => array("rurl", "Redirect URL", $myurl, "all your visitors from the web will be redirected to this URL"), '$startdate' => array("startdate", "Begin of the Blackout
(YYYY-MM-DD hh:mm)", $mystart, "format is YYYY year, MM month, DD day, hh hour and mm minute"), '$enddate' => array("enddate", "End of the Blackout
(YYYY-MM-DD hh:mm)", $myend, ""), @@ -114,7 +115,7 @@ function blackout_plugin_admin_post (&$a) { $begindate = trim($_POST['startdate']); $enddate = trim($_POST['enddate']); $url = trim($_POST['rurl']); - set_config('blackout','begindate',$begindate); - set_config('blackout','enddate',$enddate); - set_config('blackout','url',$url); + Config::set('blackout','begindate',$begindate); + Config::set('blackout','enddate',$enddate); + Config::set('blackout','url',$url); }