]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Debug/Localtime.php
Rework Feed::import parameters
[friendica.git] / src / Module / Debug / Localtime.php
index 7af9cb8dad2d56970cc96cd0990b433b4c72f9d1..d9e2489790d77751cd9750d18078494af11c2f58 100644 (file)
@@ -5,27 +5,28 @@ namespace Friendica\Module\Debug;
 use Friendica\BaseModule;
 use Friendica\Core\Installer;
 use Friendica\Core\L10n;
+use Friendica\DI;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Temporal;
 
 class Localtime extends BaseModule
 {
-       public static function post()
+       public static function post(array $parameters = [])
        {
-               $time = defaults($_REQUEST, 'time', 'now');
+               $time = ($_REQUEST['time'] ?? '') ?: 'now';
 
                $bd_format = L10n::t('l F d, Y \@ g:i A');
 
                if (!empty($_POST['timezone'])) {
-                       self::getApp()->data['mod-localtime'] = DateTimeFormat::convert($time, $_POST['timezone'], 'UTC', $bd_format);
+                       DI::app()->data['mod-localtime'] = DateTimeFormat::convert($time, $_POST['timezone'], 'UTC', $bd_format);
                }
        }
 
-       public static function content()
+       public static function content(array $parameters = [])
        {
-               $app = self::getApp();
+               $app = DI::app();
 
-               $time = defaults($_REQUEST, 'time', 'now');
+               $time = ($_REQUEST['time'] ?? '') ?: 'now';
 
                $output  = '<h3>' . L10n::t('Time Conversion') . '</h3>';
                $output .= '<p>' . L10n::t('Friendica provides this service for sharing events with other networks and friends in unknown timezones.') . '</p>';
@@ -39,9 +40,9 @@ class Localtime extends BaseModule
                        $output .= '<p>' . L10n::t('Converted localtime: %s', $app->data['mod-localtime']) . '</p>';
                }
 
-               $output .= '<form action ="' . $app->getBaseURL() . '/localtime?time=' . $time . '" method="post" >';
+               $output .= '<form action ="' . DI::baseUrl()->get() . '/localtime?time=' . $time . '" method="post" >';
                $output .= '<p>' . L10n::t('Please select your timezone:') . '</p>';
-               $output .= Temporal::getTimezoneSelect(defaults($_REQUEST, 'timezone', Installer::DEFAULT_TZ));
+               $output .= Temporal::getTimezoneSelect(($_REQUEST['timezone'] ?? '') ?: Installer::DEFAULT_TZ);
                $output .= '<input type="submit" name="submit" value="' . L10n::t('Submit') . '" /></form>';
 
                return $output;