From beee937102b95878de8d8b1fb6838504888f53dd Mon Sep 17 00:00:00 2001 From: markseu Date: Wed, 10 Apr 2024 10:33:40 +0200 Subject: [PATCH] Updated API --- system/extensions/core.php | 8 ++++---- system/extensions/update-available.ini | 24 ++++++++++++------------ system/extensions/yellow-extension.ini | 20 ++++++++++---------- system/workers/core.php | 15 +++++++++------ system/workers/edit.php | 26 +++++++++++++------------- system/workers/generate.php | 4 ++-- system/workers/install.php | 10 +++++----- system/workers/update.php | 16 ++++++++-------- 8 files changed, 63 insertions(+), 60 deletions(-) diff --git a/system/extensions/core.php b/system/extensions/core.php index f640394..9ae2684 100644 --- a/system/extensions/core.php +++ b/system/extensions/core.php @@ -1,7 +1,7 @@ readFile($fileName); $fileDataNew = str_replace("system/extensions/core.php", "system/workers/core.php", $fileDataNew); - if ($fileData!=$fileDataNew && !$this->createFile($fileName, $fileDataNew)) { + if ($fileData!=$fileDataNew && !$this->writeFile($fileName, $fileDataNew)) { $statusCode = 500; header("HTTP/1.0 500 Server error"); echo "Something went wrong during core update: Can't write file '$fileName'!
\n"; @@ -68,8 +68,8 @@ class YellowCore { return $fileData; } - // Create file - public function createFile($fileName, $fileData, $mkdir = false) { + // Write file + public function writeFile($fileName, $fileData, $mkdir = false) { $ok = false; if ($mkdir) { $path = dirname($fileName); diff --git a/system/extensions/update-available.ini b/system/extensions/update-available.ini index bcb800c..4ac66c6 100644 --- a/system/extensions/update-available.ini +++ b/system/extensions/update-available.ini @@ -74,14 +74,14 @@ Status: available system/workers/breadcrumb.php: breadcrumb.php, create, update Extension: Bundle -Version: 0.9.2 +Version: 0.9.3 Description: Bundle website files. Developer: Anna Svensson Tag: feature DownloadUrl: https://github.com/annaesvensson/yellow-bundle/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-bundle DocumentationLanguage: en, de, sv -Published: 2024-04-09 17:07:13 +Published: 2024-04-10 10:18:17 Status: available system/workers/bundle.php: bundle.php, create, update @@ -148,14 +148,14 @@ system/themes/copenhagen.css: copenhagen.css, create, update, careful system/themes/copenhagen.png: copenhagen.png, create Extension: Core -Version: 0.9.2 +Version: 0.9.3 Description: Core functionality of your website. Developer: Anna Svensson Tag: feature DownloadUrl: https://github.com/annaesvensson/yellow-core/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-core DocumentationLanguage: en, de, sv -Published: 2024-04-09 17:09:52 +Published: 2024-04-10 10:17:55 Status: available system/workers/core.php: core.php, create, update system/extensions/core.php: coreupdate.txt, update @@ -212,14 +212,14 @@ Status: available system/workers/dutch.php: dutch.php, create, update Extension: Edit -Version: 0.9.2 +Version: 0.9.3 Description: Edit your website in a web browser. Developer: Anna Svensson Tag: feature DownloadUrl: https://github.com/annaesvensson/yellow-edit/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-edit DocumentationLanguage: en, de, sv -Published: 2024-04-06 21:49:39 +Published: 2024-04-10 10:25:08 Status: available system/workers/edit.php: edit.php, create, update system/workers/edit.css: edit.css, create, update @@ -304,14 +304,14 @@ system/workers/gallery-default-skin.svg: gallery-default-skin.svg, create, updat system/workers/gallery-preloader.gif: gallery-preloader.gif, create, update Extension: Generate -Version: 0.9.2 +Version: 0.9.3 Description: Generate a static website. Developer: Anna Svensson Tag: feature DownloadUrl: https://github.com/annaesvensson/yellow-generate/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-generate DocumentationLanguage: en, de, sv -Published: 2024-04-09 18:56:19 +Published: 2024-04-10 10:19:17 Status: available system/workers/generate.php: generate.php, create, update @@ -602,14 +602,14 @@ Status: available system/workers/private.php: private.php, create, update Extension: Publish -Version: 0.9.2 +Version: 0.9.3 Description: Make and publish extensions. Developer: Anna Svensson Tag: feature DownloadUrl: https://github.com/annaesvensson/yellow-publish/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-publish DocumentationLanguage: en, de, sv -Published: 2024-04-08 19:23:04 +Published: 2024-04-10 10:20:07 Status: available system/workers/publish.php: publish.php, create, update @@ -777,14 +777,14 @@ Status: available system/workers/turkish.php: turkish.php, create, update Extension: Update -Version: 0.9.2 +Version: 0.9.3 Description: Keep your website up to date. Developer: Anna Svensson Tag: feature DownloadUrl: https://github.com/annaesvensson/yellow-update/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-update DocumentationLanguage: en, de, sv -Published: 2024-04-05 14:41:10 +Published: 2024-04-10 10:20:21 Status: available system/workers/update.php: update.php, create, update system/workers/updatepatch.bin: updatepatch.php, create, additional diff --git a/system/extensions/yellow-extension.ini b/system/extensions/yellow-extension.ini index 4d2461c..d6ba182 100755 --- a/system/extensions/yellow-extension.ini +++ b/system/extensions/yellow-extension.ini @@ -1,14 +1,14 @@ # Datenstrom Yellow extension settings Extension: Core -Version: 0.9.2 +Version: 0.9.3 Description: Core functionality of your website. Developer: Anna Svensson Tag: feature DownloadUrl: https://github.com/annaesvensson/yellow-core/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-core DocumentationLanguage: en, de, sv -Published: 2024-04-09 17:09:52 +Published: 2024-04-10 10:17:55 Status: available system/workers/core.php: core.php, create, update system/extensions/core.php: coreupdate.txt, update @@ -20,14 +20,14 @@ system/layouts/navigation.html: navigation.html, create, update, careful system/layouts/pagination.html: pagination.html, create, update, careful Extension: Edit -Version: 0.9.2 +Version: 0.9.3 Description: Edit your website in a web browser. Developer: Anna Svensson Tag: feature DownloadUrl: https://github.com/annaesvensson/yellow-edit/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-edit DocumentationLanguage: en, de, sv -Published: 2024-04-06 21:49:39 +Published: 2024-04-10 10:25:08 Status: available system/workers/edit.php: edit.php, create, update system/workers/edit.css: edit.css, create, update @@ -36,14 +36,14 @@ system/workers/edit-stack.svg: edit-stack.svg, create, update content/shared/page-new-default.md: page-new-default.md, create, optional Extension: Generate -Version: 0.9.2 +Version: 0.9.3 Description: Generate a static website. Developer: Anna Svensson Tag: feature DownloadUrl: https://github.com/annaesvensson/yellow-generate/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-generate DocumentationLanguage: en, de, sv -Published: 2024-04-09 18:56:19 +Published: 2024-04-10 10:19:17 Status: available system/workers/generate.php: generate.php, create, update @@ -62,13 +62,13 @@ media/images/photo.jpg: photo.jpg, create, optional media/thumbnails/photo-100x40.jpg: photo-100x40.jpg, create, optional Extension: Install -Version: 0.9.1 +Version: 0.9.2 Description: Install a brand new website. Developer: Anna Svensson DownloadUrl: https://github.com/annaesvensson/yellow-install/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-install DocumentationLanguage: en, de, sv -Published: 2024-04-04 14:49:36 +Published: 2024-04-10 10:27:08 Status: unassembled system/workers/install.php: install.php, create system/workers/install-language.bin: install-language.bin, compress @source/yellow-language/, create @@ -129,14 +129,14 @@ system/themes/stockholm-opensans-light.woff: stockholm-opensans-light.woff, crea system/themes/stockholm-opensans-regular.woff: stockholm-opensans-regular.woff, create, update, careful Extension: Update -Version: 0.9.2 +Version: 0.9.3 Description: Keep your website up to date. Developer: Anna Svensson Tag: feature DownloadUrl: https://github.com/annaesvensson/yellow-update/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-update DocumentationLanguage: en, de, sv -Published: 2024-04-05 14:41:10 +Published: 2024-04-10 10:20:21 Status: available system/workers/update.php: update.php, create, update system/workers/updatepatch.bin: updatepatch.php, create, additional diff --git a/system/workers/core.php b/system/workers/core.php index 5666037..954af9a 100755 --- a/system/workers/core.php +++ b/system/workers/core.php @@ -2,7 +2,7 @@ // Core extension, https://github.com/annaesvensson/yellow-core class YellowCore { - const VERSION = "0.9.2"; + const VERSION = "0.9.3"; const RELEASE = "0.9"; public $content; // content files public $media; // media files @@ -659,7 +659,7 @@ class YellowSystem { } $fileData = $this->yellow->toolbox->readFile($fileName); $fileData = $this->yellow->toolbox->setTextSettings($fileData, "", "", $settingsNew); - return $this->yellow->toolbox->createFile($fileName, $fileData); + return $this->yellow->toolbox->writeFile($fileName, $fileData); } // Set default system setting @@ -980,7 +980,7 @@ class YellowUser { } $fileData = $this->yellow->toolbox->readFile($fileName); $fileData = $this->yellow->toolbox->setTextSettings($fileData, "email", $email, $settingsNew); - return $this->yellow->toolbox->createFile($fileName, $fileData); + return $this->yellow->toolbox->writeFile($fileName, $fileData); } // Remove user settings from file @@ -989,7 +989,7 @@ class YellowUser { if (isset($this->settings[$email])) unset($this->settings[$email]); $fileData = $this->yellow->toolbox->readFile($fileName); $fileData = $this->yellow->toolbox->unsetTextSettings($fileData, "email", $email); - return $this->yellow->toolbox->createFile($fileName, $fileData); + return $this->yellow->toolbox->writeFile($fileName, $fileData); } // Set current email @@ -2118,8 +2118,8 @@ class YellowToolbox { return $fileData; } - // Create file - public function createFile($fileName, $fileData, $mkdir = false) { + // Write file + public function writeFile($fileName, $fileData, $mkdir = false) { $ok = false; if ($mkdir) { $path = dirname($fileName); @@ -2139,6 +2139,9 @@ class YellowToolbox { return $ok; } + // TODO: remove later, for backwards compatibility + public function createFile($fileName, $fileData, $mkdir = false) { return $this->writeFile($fileName, $fileData, $mkdir); } + // Append file public function appendFile($fileName, $fileData, $mkdir = false) { $ok = false; diff --git a/system/workers/edit.php b/system/workers/edit.php index 48863d9..ef5943f 100644 --- a/system/workers/edit.php +++ b/system/workers/edit.php @@ -2,7 +2,7 @@ // Edit extension, https://github.com/annaesvensson/yellow-edit class YellowEdit { - const VERSION = "0.9.2"; + const VERSION = "0.9.3"; public $yellow; // access to API public $response; // web response public $merge; // text merge @@ -49,7 +49,7 @@ class YellowEdit { if (!$cleanup) $fileDataNew .= $line; } $fileDataNew = rtrim($fileDataNew)."\n"; - if ($fileData!=$fileDataNew && !$this->yellow->toolbox->createFile($fileNameUser, $fileDataNew)) { + if ($fileData!=$fileDataNew && !$this->yellow->toolbox->writeFile($fileNameUser, $fileDataNew)) { $this->yellow->toolbox->log("error", "Can't write file '$fileNameUser'!"); } } @@ -117,9 +117,9 @@ class YellowEdit { public function onParsePageExtra($page, $name) { $output = null; if ($this->editable && $name=="header") { - $extensionLocation = $this->yellow->system->get("coreServerBase").$this->yellow->system->get("coreExtensionLocation"); - $output = "\n"; - $output .= "\n"; + $assetLocation = $this->yellow->system->get("coreServerBase").$this->yellow->system->get("coreAssetLocation"); + $output = "\n"; + $output .= "\n"; $output .= "