diff --git a/elements/HTMLCodeDemoElement.php b/elements/HTMLCodeDemoElement.php
index e1b4f77..b85a61b 100644
--- a/elements/HTMLCodeDemoElement.php
+++ b/elements/HTMLCodeDemoElement.php
@@ -19,7 +19,7 @@
if (is_dir(VV::root($this->dir))) {
// Strip "." and ".."
- $this->files = array_filter(scandir(VV::root($this->dir)), function (string $item) {
+ $this->files = array_filter(scandir(VV::root($this->dir), SCANDIR_SORT_DESCENDING), function (string $item) {
return substr($item, 0, 1) !== ".";
});
@@ -28,6 +28,14 @@
}
}
+ public static function name(string $file): string {
+ return substr($file, 0, strlen($file) - 4);
+ }
+
+ public static function language(string $file): string {
+ return explode(".", $file, 3)[1];
+ }
+
public function file_path(string $file): string {
return $this->dir . $file;
}
@@ -37,8 +45,8 @@