commit 9636fd115e52b78528393656d1df03cd86c8fef9
parent 28527e0b92685d727a9168bc17375444b539a701
Author: markseu <mark2011@mayberg.se>
Date: Thu, 26 Apr 2018 18:15:48 +0200
Updated core and language files, API
Diffstat:
6 files changed, 61 insertions(+), 37 deletions(-)
diff --git a/system/config/config.ini b/system/config/config.ini
@@ -36,7 +36,6 @@ ContentDefaultFile: page.txt
ContentExtension: .txt
ConfigExtension: .ini
DownloadExtension: .download
-UploadExtension: .upload
TextFile: text.ini
LanguageFile: language-(.*).txt
ErrorFile: page-error-(.*).txt
diff --git a/system/plugins/core.php b/system/plugins/core.php
@@ -62,7 +62,6 @@ class YellowCore
$this->config->setDefault("contentExtension", ".txt");
$this->config->setDefault("configExtension", ".ini");
$this->config->setDefault("downloadExtension", ".download");
- $this->config->setDefault("uploadExtension", ".upload");
$this->config->setDefault("configFile", "config.ini");
$this->config->setDefault("textFile", "text.ini");
$this->config->setDefault("languageFile", "language-(.*).txt");
@@ -740,6 +739,24 @@ class YellowPage
return htmlspecialchars($this->getDate($key, $format));
}
+ // Return page meta data as language specific date and relative to today
+ function getDateRelative($key, $format = "", $daysLimit = 0)
+ {
+ if(!empty($format))
+ {
+ $format = $this->yellow->text->get($format);
+ } else {
+ $format = $this->yellow->text->get("dateFormatMedium");
+ }
+ return $this->yellow->text->getDateRelative(strtotime($this->get($key)), $format, $daysLimit);
+ }
+
+ // Return page meta data as language specific date and relative to today, HTML encoded
+ function getDateRelativeHtml($key, $format = "", $daysLimit = 0)
+ {
+ return htmlspecialchars($this->getDateRelative($key, $format, $daysLimit));
+ }
+
// Return page meta data as custom date
function getDateFormatted($key, $format)
{
@@ -1682,11 +1699,6 @@ class YellowPlugins
// Load plugins
function load($path = "")
{
- if(count($this->yellow->config->config)==0) //TODO: remove later, backwards compability for old version
- {
- $this->yellow->load();
- return;
- }
$path = empty($path) ? $this->yellow->config->get("pluginDir") : $path;
foreach($this->yellow->toolbox->getDirectoryEntries($path, "/^.*\.php$/", true, false) as $entry)
{
@@ -2081,6 +2093,36 @@ class YellowText
return date($format, $timestamp);
}
+ // Return human readable date, relative to today
+ function getDateRelative($timestamp, $format, $daysLimit)
+ {
+ $timeDifference = time() - $timestamp;
+ $days = abs(intval($timeDifference / 86400));
+ if($days<=$daysLimit || $daysLimit==0)
+ {
+ $tokens = preg_split("/\s*,\s*/", $this->get($timeDifference>=0 ? "datePast" : "dateFuture"));
+ if($days==0)
+ {
+ $output = $tokens[0];
+ } else if($days==1) {
+ $output = $tokens[1];
+ } else if($days>=2 && $days<=6) {
+ $output = preg_replace("/@x/i", $days, $tokens[2]);
+ } else if($days>=7 && $days<=13) {
+ $output = $tokens[3];
+ } else if($days>=14 && $days<=364) {
+ $output = preg_replace("/@x/i", intval($days/30), $tokens[4]);
+ } else if($days>=365 && $days<=729) {
+ $output = $tokens[5];
+ } else {
+ $output = preg_replace("/@x/i", intval($days/365.25), $tokens[6]);
+ }
+ } else {
+ $output = $this->getDateFormatted($timestamp, $format);
+ }
+ return $output;
+ }
+
// Return languages
function getLanguages()
{
@@ -3060,32 +3102,6 @@ class YellowToolbox
return @rename($fileNameSource, $fileNameDestination);
}
- // Merge file
- function mergeFile($fileNameSource, $fileNameDestination)
- {
- $ok = false;
- clearstatcache();
- $fileHandleSource = @fopen($fileNameSource, "rb");
- if($fileHandleSource)
- {
- $fileHandleDestination = @fopen($fileNameDestination, "ab");
- if($fileHandleDestination)
- {
- while(true)
- {
- $dataBufferChunk = fread($fileHandleSource, 1024*64);
- fwrite($fileHandleDestination, $dataBufferChunk);
- if(feof($fileHandleSource) || $dataBufferChunk===false) break;
- }
- fclose($fileHandleDestination);
- $ok = true;
- }
- fclose($fileHandleSource);
- if($ok) @unlink($fileNameSource);
- }
- return $ok;
- }
-
// Delete file
function deleteFile($fileName, $pathTrash = "")
{
diff --git a/system/plugins/language-de.txt b/system/plugins/language-de.txt
@@ -3,7 +3,7 @@
Language: de
LanguageDescription: Deutsch
LanguageTranslator: David Fehrmann
-LanguageVersion: 0.7.5
+LanguageVersion: 0.7.6
BlogBy: von
BlogFilter: Blog:
@@ -18,6 +18,8 @@ ContactStatusIncomplete: Bitte alle Felder ausfüllen.
ContactStatusInvalid: Bitte eine gültige E-Mail angeben.
ContactStatusDone: Nachricht wurde versandt. Vielen Dank!
ContactStatusError: Nachricht konnte nicht versandt werden, versuche es später erneut!
+DatePast: heute, gestern, vor @x Tagen, vor 1 Monat, vor @x Monaten, vor 1 Jahr, vor @x Jahren
+DateFuture: bald, morgen, in @x Tagen, in 1 Monat, in @x Monaten, in 1 Jahr, in @x Jahren
DateMonths: Januar, Februar, März, April, Mai, Juni, Juli, August, September, Oktober, November, Dezember
DateWeekdays: Montag, Dienstag, Mittwoch, Donnerstag, Freitag, Samstag, Sonntag
DateWeekstart: Montag
@@ -93,6 +95,7 @@ EditVersionStatusUpdates: Aktualisierung verfügbar, bitte an den Webmaster wend
EditVersionUpdateNormal: Aktualisierung verfügbar, jetzt aktualisieren.
EditVersionUpdateForce: Aktualisierung erzwingen
EditVersionUpdateModified: @software wurde modifiziert
+EditUploadProgress: [Datei hochladen…]
EditOkButton: Ok
EditCancelButton: Abbruch
EditCreateButton: Erzeugen
diff --git a/system/plugins/language-en.txt b/system/plugins/language-en.txt
@@ -3,7 +3,7 @@
Language: en
LanguageDescription: English
LanguageTranslator: Mark Seuffert
-LanguageVersion: 0.7.5
+LanguageVersion: 0.7.6
BlogBy: by
BlogFilter: Blog:
@@ -18,6 +18,8 @@ ContactStatusIncomplete: Please fill out all fields.
ContactStatusInvalid: Please enter a valid email.
ContactStatusDone: You have sent an email. Thank you!
ContactStatusError: Email could not be sent, please try again later!
+DatePast: today, yesterday, @x days ago, 1 month ago, @x months ago, 1 year ago, @x years ago
+DateFuture: soon, tomorrow, in @x days, in 1 month, in @x months, in 1 year, in @x years
DateMonths: January, February, March, April, May, June, July, August, September, October, November, December
DateWeekdays: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
DateWeekstart: Monday
@@ -93,6 +95,7 @@ EditVersionStatusUpdates: Updates available, please contact the webmaster.
EditVersionUpdateNormal: Updates available, update now.
EditVersionUpdateForce: Force update
EditVersionUpdateModified: @software has been modified
+EditUploadProgress: [Uploading file…]
EditOkButton: Ok
EditCancelButton: Cancel
EditCreateButton: Create
diff --git a/system/plugins/language-fr.txt b/system/plugins/language-fr.txt
@@ -3,7 +3,7 @@
Language: fr
LanguageDescription: Français
LanguageTranslator: Juh Nibreh
-LanguageVersion: 0.7.5
+LanguageVersion: 0.7.6
BlogBy: par
BlogFilter: Blog:
@@ -18,6 +18,8 @@ ContactStatusIncomplete: S'il vous plaît, veuillez remplir tous les champs.
ContactStatusInvalid: S'il vous plaît, veuillez entrer une adresse email valide.
ContactStatusDone: Votre message a bien été envoyé. Merci!
ContactStatusError: Votre message n'a pas pu être envoyé, réessayez plus tard s'il vous plaît!
+DatePast: aujourd'hui, hier, il y a @x jours, il ya 1 mois, il y a @x mois, il y a 1 an, il y a @x ans
+DateFuture: bientôt, demain, dans @x jours, en 1 mois, dans @x mois, en 1 an, dans @x ans
DateMonths: janvier, février, mars, avril, mai, juin, juillet, août, septembre, octobre, novembre, décembre
DateWeekdays: lundi, mardi, mercredi, jeudi, vendredi, samedi, dimanche
DateWeekstart: lundi
@@ -93,6 +95,7 @@ EditVersionStatusUpdates: Mises à jour disponibles, s'il vous plaît contacter
EditVersionUpdateNormal: Mises à jour disponibles, mettre à jour maintenant.
EditVersionUpdateForce: Forcer mise à jour
EditVersionUpdateModified: @software a été modifié
+EditUploadProgress: [Téléchargement du fichier…]
EditOkButton: Ok
EditCancelButton: Annuler
EditCreateButton: Créer
diff --git a/system/plugins/language.php b/system/plugins/language.php
@@ -5,7 +5,7 @@
class YellowLanguage
{
- const VERSION = "0.7.5";
+ const VERSION = "0.7.6";
}
$yellow->plugins->register("language", "YellowLanguage", YellowLanguage::VERSION);