Kaynağa Gözat

Updated core, terminal detection

markseu 3 yıl önce
ebeveyn
işleme
667248687b

+ 23 - 1
system/extensions/core.php

@@ -2,7 +2,7 @@
 // Core extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/core
 // Core extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/core
 
 
 class YellowCore {
 class YellowCore {
-    const VERSION = "0.8.83";
+    const VERSION = "0.8.84";
     const RELEASE = "0.8.20";
     const RELEASE = "0.8.20";
     public $page;           // current page
     public $page;           // current page
     public $content;        // content files
     public $content;        // content files
@@ -3297,6 +3297,28 @@ class YellowToolbox {
         return $languageFound;
         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
     // Detect image width, height, orientation and type for GIF/JPG/PNG/SVG
     public function detectImageInformation($fileName, $fileType = "") {
     public function detectImageInformation($fileName, $fileType = "") {
         $width = $height = $orientation = 0;
         $width = $height = $orientation = 0;

+ 2 - 2
system/extensions/update-current.ini

@@ -21,11 +21,11 @@ Tag: feature
 system/extensions/command.php: command.php, create, update
 system/extensions/command.php: command.php, create, update
 
 
 Extension: Core
 Extension: Core
-Version: 0.8.83
+Version: 0.8.84
 Description: Core functionality of the website.
 Description: Core functionality of the website.
 DocumentationUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/core
 DocumentationUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/core
 DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/core.zip
 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
 Developer: Datenstrom
 Tag: feature
 Tag: feature
 system/extensions/core.php: core.php, create, update
 system/extensions/core.php: core.php, create, update