Updated API, new way of loading translations

This commit is contained in:
markseu 2022-10-30 02:08:16 +01:00
parent a886530521
commit 7c9b1ed3cc
7 changed files with 35 additions and 34 deletions

View file

@ -2,7 +2,7 @@
// Command extension, https://github.com/annaesvensson/yellow-command
class YellowCommand {
const VERSION = "0.8.42";
const VERSION = "0.8.43";
public $yellow; // access to API
public $files; // number of files
public $links; // number of links
@ -36,10 +36,7 @@ class YellowCommand {
// Handle command help
public function onCommandHelp() {
$help = "build [directory location]\n";
$help .= "check [directory location]\n";
$help .= "clean [directory location]\n";
return $help;
return array("build [directory location]", "check [directory location]", "clean [directory location]");
}
// Process command to build static website

View file

@ -2,7 +2,7 @@
// Core extension, https://github.com/annaesvensson/yellow-core
class YellowCore {
const VERSION = "0.8.96";
const VERSION = "0.8.97";
const RELEASE = "0.8.21";
public $page; // current page
public $content; // content files
@ -368,7 +368,9 @@ class YellowCore {
$data = array();
foreach ($this->extension->data as $key=>$value) {
if (method_exists($value["object"], "onCommandHelp")) {
foreach (preg_split("/[\r\n]+/", $value["object"]->onCommandHelp()) as $line) {
$output = $value["object"]->onCommandHelp();
$lines = is_array($output) ? $output : array($output);
foreach ($lines as $line) {
list($command, $dummy) = $this->toolbox->getTextList($line, " ", 2);
if (!empty($command) && !isset($data[$command])) $data[$command] = $line;
}
@ -1700,12 +1702,19 @@ class YellowLanguage {
// Set default language settings
public function setDefault($text) {
$settings = $this->yellow->toolbox->getTextSettings($text, "language");
foreach ($settings as $language=>$block) {
if (!isset($this->settings[$language])) $this->settings[$language] = new YellowArray();
foreach ($block as $key=>$value) {
$this->settings[$language][$key] = $value;
$this->settingsDefaults[$key] = true;
$language = "";
$lines = is_array($text) ? $text : array($text);
foreach ($lines as $line) {
if (preg_match("/^\#/", $line)) continue;
if (preg_match("/^\s*(.*?)\s*:\s*(.*?)\s*$/", $line, $matches)) {
if (lcfirst($matches[1])=="language" && !strempty($matches[2])) {
$language = $matches[2];
if (!isset($this->settings[$language])) $this->settings[$language] = new YellowArray();
}
if (!empty($language) && !empty($matches[1]) && !strempty($matches[2])) {
$this->settings[$language][$matches[1]] = $matches[2];
$this->settingsDefaults[$matches[1]] = true;
}
}
}
}
@ -2796,7 +2805,6 @@ class YellowToolbox {
if (preg_match("/^\s*(.*?)\s*:\s*(.*?)\s*$/", $line, $matches)) {
if (!empty($matches[1]) && !strempty($matches[2])) {
$settings[$matches[1]] = $matches[2];
}
}
}

View file

@ -2,7 +2,7 @@
// Edit extension, https://github.com/annaesvensson/yellow-edit
class YellowEdit {
const VERSION = "0.8.65";
const VERSION = "0.8.66";
public $yellow; // access to API
public $response; // web response
public $merge; // text merge
@ -81,7 +81,7 @@ class YellowEdit {
// Handle command help
public function onCommandHelp() {
return "user [option email password]\n";
return "user [option email password]";
}
// Handle page content of shortcut

View file

@ -2,7 +2,7 @@
// Serve extension, https://github.com/annaesvensson/yellow-serve
class YellowServe {
const VERSION = "0.8.20";
const VERSION = "0.8.21";
public $yellow; // access to API
// Handle initialisation
@ -21,7 +21,7 @@ class YellowServe {
// Handle command help
public function onCommandHelp() {
return "serve [url]\n";
return "serve [url]";
}
// Process command to start built-in web server

View file

@ -1,21 +1,21 @@
# Datenstrom Yellow update settings
Extension: Command
Version: 0.8.42
Version: 0.8.43
Description: Command line of the website.
DocumentationUrl: https://github.com/annaesvensson/yellow-command
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/main/downloads/command.zip
Published: 2022-09-22 10:13:59
Published: 2022-10-30 00:30:52
Developer: Anna Svensson
Tag: feature
system/extensions/command.php: command.php, create, update
Extension: Core
Version: 0.8.96
Version: 0.8.97
Description: Core functionality of the website.
DocumentationUrl: https://github.com/annaesvensson/yellow-core
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/main/downloads/core.zip
Published: 2022-10-25 11:12:07
Published: 2022-10-30 00:27:11
Developer: Mark Seuffert, David Fehrmann
Tag: feature
system/extensions/core.php: core.php, create, update
@ -27,11 +27,11 @@ system/layouts/navigation.html: navigation.html, create, update, careful
system/layouts/pagination.html: pagination.html, create, update, careful
Extension: Edit
Version: 0.8.65
Version: 0.8.66
Description: Edit your website in a web browser.
DocumentationUrl: https://github.com/annaesvensson/yellow-edit
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/main/downloads/edit.zip
Published: 2022-10-20 20:50:00
Published: 2022-10-30 01:47:46
Developer: Anna Svensson
Tag: feature
system/extensions/edit.php: edit.php, create, update
@ -96,11 +96,11 @@ Tag: feature
system/extensions/meta.php: meta.php, create, update
Extension: Serve
Version: 0.8.20
Version: 0.8.21
Description: Built-in web server.
DocumentationUrl: https://github.com/annaesvensson/yellow-serve
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/main/downloads/serve.zip
Published: 2022-04-17 11:12:47
Published: 2022-10-30 00:34:51
Developer: Anna Svensson
Tag: feature
system/extensions/serve.php: serve.php, create, update
@ -121,11 +121,11 @@ 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.8.85
Version: 0.8.87
Description: Keep your website up to date.
DocumentationUrl: https://github.com/annaesvensson/yellow-update
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/main/downloads/update.zip
Published: 2022-10-23 21:06:48
Published: 2022-10-30 00:32:55
Developer: Anna Svensson
Tag: feature
system/extensions/update.php: update.php, create, update

View file

@ -2,7 +2,7 @@
// Update extension, https://github.com/annaesvensson/yellow-update
class YellowUpdate {
const VERSION = "0.8.85";
const VERSION = "0.8.87";
const PRIORITY = "2";
public $yellow; // access to API
public $extensions; // number of extensions
@ -65,11 +65,7 @@ class YellowUpdate {
// Handle command help
public function onCommandHelp() {
$help = "about [extension]\n";
$help .= "install [extension]\n";
$help .= "uninstall [extension]\n";
$help .= "update [extension]\n";
return $help;
return array("about [extension]", "install [extension]", "uninstall [extension]", "update [extension]");
}
// Parse page content shortcut