Updated core, terminal detection

This commit is contained in:
markseu 2022-06-03 16:01:40 +02:00
parent 9f574ee93e
commit 667248687b
2 changed files with 25 additions and 3 deletions

View file

@ -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;

View file

@ -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