admin theme manager
This commit is contained in:
20
kernel/helpers/Debug.php
Normal file
20
kernel/helpers/Debug.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\helpers;
|
||||
|
||||
class Debug
|
||||
{
|
||||
public static function prn($content)
|
||||
{
|
||||
echo '<pre style="background: lightgray; border: 1px solid black; padding: 2px">';
|
||||
print_r($content);
|
||||
echo '</pre>';
|
||||
}
|
||||
public static function dd($content)
|
||||
{
|
||||
echo '<pre style="background: lightgray; border: 1px solid black; padding: 2px">';
|
||||
print_r($content);
|
||||
echo '</pre>';
|
||||
die();
|
||||
}
|
||||
}
|
44
kernel/helpers/Files.php
Normal file
44
kernel/helpers/Files.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\helpers;
|
||||
|
||||
use FilesystemIterator;
|
||||
|
||||
class Files
|
||||
{
|
||||
public function copy_folder($d1, $d2): void
|
||||
{
|
||||
if (is_dir($d1)) {
|
||||
if (!file_exists($d2)){
|
||||
$_d2 = mkdir($d2, permissions: 0755, recursive: true);
|
||||
if (!$_d2) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$d = dir($d1);
|
||||
while (false !== ($entry = $d->read())) {
|
||||
if ($entry != '.' && $entry != '..') {
|
||||
$this->copy_folder("$d1/$entry", "$d2/$entry");
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
} else {
|
||||
copy($d1, $d2);
|
||||
}
|
||||
}
|
||||
|
||||
public function recursiveRemoveDir($dir): void
|
||||
{
|
||||
$includes = new FilesystemIterator($dir);
|
||||
foreach ($includes as $include) {
|
||||
if(is_dir($include) && !is_link($include)) {
|
||||
$this->recursiveRemoveDir($include);
|
||||
}
|
||||
else {
|
||||
unlink($include);
|
||||
}
|
||||
}
|
||||
rmdir($dir);
|
||||
}
|
||||
}
|
20
kernel/helpers/Manifest.php
Normal file
20
kernel/helpers/Manifest.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\helpers;
|
||||
|
||||
class Manifest
|
||||
{
|
||||
|
||||
public static function getWithVars(string $manifestJson): array
|
||||
{
|
||||
$manifest = json_decode($manifestJson, true);
|
||||
$keys = ["{slug}" => $manifest['slug']];
|
||||
foreach($keys as $key => $value)
|
||||
{
|
||||
$manifestJson = str_replace($key, $value, $manifestJson);
|
||||
}
|
||||
|
||||
return json_decode($manifestJson, true);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user