commit 667248687bb31b63f011a0da49a282cf48d7673d
parent 9f574ee93e2c429d63613e7d45a18f7b86c2d7eb
Author: markseu <mark2011@mayberg.se>
Date: Fri, 3 Jun 2022 16:01:40 +0200
Updated core, terminal detection
Diffstat:
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/system/extensions/core.php b/system/extensions/core.php
@@ -2,7 +2,7 @@
// Core extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/core
class YellowCore {
- const VERSION = "0.8.83";
+ const VERSION = "0.8.84";
const RELEASE = "0.8.20";
public $page; // current page
public $content; // content files
@@ -3297,6 +3297,28 @@ class YellowToolbox {
return $languageFound;
}
+ // Detect terminal width and height
+ public function detectTerminalInformation() {
+ $width = $height = 0;
+ if (strtoupperu(substru(PHP_OS, 0, 3))=="WIN") {
+ exec("powershell $Host.UI.RawUI.WindowSize.Width", $outputLines, $returnStatus);
+ if ($returnStatus==0 && !empty($outputLines)) {
+ $width = intval(end($outputLines));
+ }
+ exec("powershell $Host.UI.RawUI.WindowSize.Height", $outputLines, $returnStatus);
+ if ($returnStatus==0 && !empty($outputLines)) {
+ $height = intval(end($outputLines));
+ }
+ } else {
+ exec("stty size", $outputLines, $returnStatus);
+ if ($returnStatus==0 && preg_match("/^(\d+)\s+(\d+)/", implode("\n", $outputLines), $matches)) {
+ $width = intval($matches[2]);
+ $height = intval($matches[1]);
+ }
+ }
+ return array($width, $height);
+ }
+
// Detect image width, height, orientation and type for GIF/JPG/PNG/SVG
public function detectImageInformation($fileName, $fileType = "") {
$width = $height = $orientation = 0;
diff --git a/system/extensions/update-current.ini b/system/extensions/update-current.ini
@@ -21,11 +21,11 @@ Tag: feature
system/extensions/command.php: command.php, create, update
Extension: Core
-Version: 0.8.83
+Version: 0.8.84
Description: Core functionality of the website.
DocumentationUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/core
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/core.zip
-Published: 2022-05-26 21:04:47
+Published: 2022-06-03 15:57:48
Developer: Datenstrom
Tag: feature
system/extensions/core.php: core.php, create, update