]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/Temporal.php
Unescape admin warning text
[friendica.git] / src / Util / Temporal.php
index 696721e458c2d906f978f33fecda176fbe6d7938..d121d59770657dc8e3b59a1efceef22567921a3b 100644 (file)
@@ -11,9 +11,8 @@ use DateTimeZone;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
-
-require_once 'boot.php';
-require_once 'include/text.php';
+use Friendica\Core\Renderer;
+use Friendica\Database\DBA;
 
 /**
  * @brief Temporal class
@@ -113,8 +112,8 @@ class Temporal
                $options = str_replace('<select id="timezone_select" name="timezone">', '', $options);
                $options = str_replace('</select>', '', $options);
 
-               $tpl = get_markup_template('field_select_raw.tpl');
-               return replace_macros($tpl, [
+               $tpl = Renderer::getMarkupTemplate('field_select_raw.tpl');
+               return Renderer::replaceMacros($tpl, [
                        '$field' => [$name, $label, $current, $help, $options],
                ]);
        }
@@ -139,8 +138,8 @@ class Temporal
 
                $age = (intval($value) ? self::getAgeByTimezone($value, $a->user["timezone"], $a->user["timezone"]) : "");
 
-               $tpl = get_markup_template("field_input.tpl");
-               $o = replace_macros($tpl,
+               $tpl = Renderer::getMarkupTemplate("field_input.tpl");
+               $o = Renderer::replaceMacros($tpl,
                        [
                        '$field' => [
                                'dob',
@@ -217,13 +216,13 @@ class Temporal
                // First day of the week (0 = Sunday)
                $firstDay = PConfig::get(local_user(), 'system', 'first_day_of_week', 0);
 
-               $lang = substr(L10n::getBrowserLanguage(), 0, 2);
+               $lang = substr(L10n::getCurrentLang(), 0, 2);
 
                // Check if the detected language is supported by the picker
                if (!in_array($lang,
                                ["ar", "ro", "id", "bg", "fa", "ru", "uk", "en", "el", "de", "nl", "tr", "fr", "es", "th", "pl", "pt", "ch", "se", "kr",
                                "it", "da", "no", "ja", "vi", "sl", "cs", "hu"])) {
-                       $lang = Config::get('system', 'language', 'en');
+                       $lang = 'en';
                }
 
                $o = '';
@@ -245,8 +244,8 @@ class Temporal
 
                $readable_format = str_replace(['Y', 'm', 'd', 'H', 'i'], ['yyyy', 'mm', 'dd', 'HH', 'MM'], $dateformat);
 
-               $tpl = get_markup_template('field_datetime.tpl');
-               $o .= replace_macros($tpl, [
+               $tpl = Renderer::getMarkupTemplate('field_datetime.tpl');
+               $o .= Renderer::replaceMacros($tpl, [
                        '$field' => [
                                $id,
                                $label,
@@ -290,7 +289,7 @@ class Temporal
 
                $abs = strtotime($localtime);
 
-               if (is_null($posted_date) || $posted_date <= NULL_DATE || $abs === false) {
+               if (is_null($posted_date) || $posted_date <= DBA::NULL_DATETIME || $abs === false) {
                        return L10n::t('never');
                }
 
@@ -461,11 +460,11 @@ class Temporal
                        $tddate = intval(DateTimeFormat::localNow('j'));
                }
 
-               $str_month = day_translate($mtab[$m]);
+               $str_month = L10n::getDay($mtab[$m]);
                $o = '<table class="calendar' . $class . '">';
                $o .= "<caption>$str_month $y</caption><tr>";
                for ($a = 0; $a < 7; $a ++) {
-                       $o .= '<th>' . mb_substr(day_translate($dn[$a]), 0, 3, 'UTF-8') . '</th>';
+                       $o .= '<th>' . mb_substr(L10n::getDay($dn[$a]), 0, 3, 'UTF-8') . '</th>';
                }
 
                $o .= '</tr><tr>';
@@ -479,7 +478,7 @@ class Temporal
                        $o .= "<td $today>";
                        $day = str_replace(' ', '&nbsp;', sprintf('%2.2d', $d));
                        if ($started) {
-                               if (x($links, $d) !== false) {
+                               if (isset($links[$d])) {
                                        $o .= "<a href=\"{$links[$d]}\">$day</a>";
                                } else {
                                        $o .= $day;