From 300a7069f55559ba5addd7fd15d9781f6dd960cc Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Mon, 22 Apr 2019 12:31:18 +0200 Subject: [PATCH] Move mod/localtime to src/Module/Localtime --- mod/localtime.php | 59 ---------------------------------------- src/Module/Localtime.php | 49 +++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 59 deletions(-) delete mode 100644 mod/localtime.php create mode 100644 src/Module/Localtime.php diff --git a/mod/localtime.php b/mod/localtime.php deleted file mode 100644 index f68c3fba50..0000000000 --- a/mod/localtime.php +++ /dev/null @@ -1,59 +0,0 @@ -data['mod-localtime'] = DateTimeFormat::convert($t, $_POST['timezone'], 'UTC', $bd_format); - } -} - -function localtime_content(App $a) -{ - $t = $_REQUEST['time']; - if (! $t) { - $t = 'now'; - } - - $o = '

' . L10n::t('Time Conversion') . '

'; - - $o .= '

' . L10n::t('Friendica provides this service for sharing events with other networks and friends in unknown timezones.') . '

'; - - - - $o .= '

' . L10n::t('UTC time: %s', $t) . '

'; - - if ($_REQUEST['timezone']) { - $o .= '

' . L10n::t('Current timezone: %s', $_REQUEST['timezone']) . '

'; - } - - if (!empty($a->data['mod-localtime'])) { - $o .= '

' . L10n::t('Converted localtime: %s', $a->data['mod-localtime']) . '

'; - } - - - $o .= '
'; - - $o .= '

' . L10n::t('Please select your timezone:') . '

'; - - $o .= Temporal::getTimezoneSelect(($_REQUEST['timezone']) ? $_REQUEST['timezone'] : 'America/Los_Angeles'); - - $o .= '
'; - - return $o; -} diff --git a/src/Module/Localtime.php b/src/Module/Localtime.php new file mode 100644 index 0000000000..d0b540879b --- /dev/null +++ b/src/Module/Localtime.php @@ -0,0 +1,49 @@ +data['mod-localtime'] = DateTimeFormat::convert($time, $_POST['timezone'], 'UTC', $bd_format); + } + } + + public static function content() + { + $app = self::getApp(); + + $time = defaults($_REQUEST, 'time', 'now'); + + $output = '

' . L10n::t('Time Conversion') . '

'; + $output .= '

' . L10n::t('Friendica provides this service for sharing events with other networks and friends in unknown timezones.') . '

'; + $output .= '

' . L10n::t('UTC time: %s', $time) . '

'; + + if (!empty($_REQUEST['timezone'])) { + $output .= '

' . L10n::t('Current timezone: %s', $_REQUEST['timezone']) . '

'; + } + + if (!empty($app->data['mod-localtime'])) { + $output .= '

' . L10n::t('Converted localtime: %s', $app->data['mod-localtime']) . '

'; + } + + $output .= '
'; + $output .= '

' . L10n::t('Please select your timezone:') . '

'; + $output .= Temporal::getTimezoneSelect(defaults($_REQUEST, 'timezone', Installer::DEFAULT_TZ)); + $output .= '
'; + + return $output; + } +}