Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e38a870e71 | |||
| 36b48d14d1 | |||
| 1261738c3d | |||
| 9718bec887 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,3 @@
|
|||||||
!.gitignore
|
!.gitignore
|
||||||
composer.phar
|
composer.phar
|
||||||
composer.lock
|
|
||||||
vendor
|
vendor
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ namespace ${REPO_OWNER}\${REPO_NAME}\controllers;
|
|||||||
|
|
||||||
// Files of the project
|
// Files of the project
|
||||||
use ${REPO_OWNER}\${REPO_NAME}\views\templater,
|
use ${REPO_OWNER}\${REPO_NAME}\views\templater,
|
||||||
${REPO_OWNER}\${REPO_NAME}\models\core as models,
|
${REPO_OWNER}\${REPO_NAME}\models\core as models;
|
||||||
${REPO_OWNER}\${REPO_NAME}\models\enumerations\language;
|
|
||||||
|
// Library for languages support
|
||||||
|
use mirzaev\languages\language;
|
||||||
|
|
||||||
// Framework for PHP
|
// Framework for PHP
|
||||||
use mirzaev\minimal\core as minimal,
|
use mirzaev\minimal\core as minimal,
|
||||||
@@ -28,7 +30,6 @@ use mirzaev\minimal\core as minimal,
|
|||||||
*
|
*
|
||||||
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
||||||
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||||
* @author ${REPO_OWNER} <mail@domain.zone>
|
|
||||||
*/
|
*/
|
||||||
class core extends controller
|
class core extends controller
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ use mirzaev\minimal\http\enumerations\content,
|
|||||||
*
|
*
|
||||||
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
||||||
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||||
* @author ${REPO_OWNER} <mail@domain.zone>
|
|
||||||
*/
|
*/
|
||||||
final class index extends core
|
final class index extends core
|
||||||
{
|
{
|
||||||
@@ -42,8 +41,8 @@ final class index extends core
|
|||||||
*/
|
*/
|
||||||
public function index(): null
|
public function index(): null
|
||||||
{
|
{
|
||||||
if (str_contains($$this->request->headers['accept'], content::any->value)) {
|
if (str_contains($$this->request->headers['accept'] ?? '', content::html->value)) {
|
||||||
// Request for any response
|
// Request for HTML response
|
||||||
|
|
||||||
// Render page
|
// Render page
|
||||||
$$page = $$this->view->render('index.html');
|
$$page = $$this->view->render('index.html');
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ use exception;
|
|||||||
*
|
*
|
||||||
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
||||||
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||||
* @author ${REPO_OWNER} <mail@domain.zone>
|
|
||||||
*/
|
*/
|
||||||
class core extends model
|
class core extends model
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,62 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace ${REPO_OWNER}\${REPO_NAME}\models\enumerations;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Language
|
|
||||||
*
|
|
||||||
* Types of languages by ISO 639-1 standart
|
|
||||||
*
|
|
||||||
* @package ${REPO_OWNER}\${REPO_NAME}\models\enumerations
|
|
||||||
*
|
|
||||||
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
|
||||||
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
|
||||||
* @author ${REPO_OWNER} <mail@domain.zone>
|
|
||||||
*/
|
|
||||||
enum language
|
|
||||||
{
|
|
||||||
case en;
|
|
||||||
case ru;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Label
|
|
||||||
*
|
|
||||||
* Initialize label of the language
|
|
||||||
*
|
|
||||||
* @param language|null $language Language into which to translate
|
|
||||||
*
|
|
||||||
* @return string Translated label of the language
|
|
||||||
*/
|
|
||||||
public function label(?language $$language = language::en): string
|
|
||||||
{
|
|
||||||
// Exit (success)
|
|
||||||
return match ($$this) {
|
|
||||||
language::en => match ($$language) {
|
|
||||||
language::en => 'English',
|
|
||||||
language::ru => 'Английский'
|
|
||||||
},
|
|
||||||
language::ru => match ($$language) {
|
|
||||||
language::en => 'Russian',
|
|
||||||
language::ru => 'Русский'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Flag
|
|
||||||
*
|
|
||||||
* Initialize the flag emoji of the language
|
|
||||||
*
|
|
||||||
* @return string The flag emoji of the language
|
|
||||||
*/
|
|
||||||
public function flag(): string
|
|
||||||
{
|
|
||||||
// Exit (success)
|
|
||||||
return match ($$this) {
|
|
||||||
language::en => '🇺🇸',
|
|
||||||
language::ru => '🇷🇺'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace ${REPO_OWNER}\${REPO_NAME}\models\traits;
|
|
||||||
|
|
||||||
// Built-in libraries
|
|
||||||
use exception;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Files
|
|
||||||
*
|
|
||||||
* Trait with files handlers
|
|
||||||
*
|
|
||||||
* @method static void delete(string $$directory, array &$$errors)
|
|
||||||
*
|
|
||||||
* @package ${REPO_OWNER}\${REPO_NAME}\models\traits
|
|
||||||
*
|
|
||||||
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
|
||||||
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
|
||||||
* @author ${REPO_OWNER} <mail@domain.zone>
|
|
||||||
*/
|
|
||||||
trait files
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Delete
|
|
||||||
*
|
|
||||||
* Delete files recursively
|
|
||||||
*
|
|
||||||
* @param string $$directory Directory
|
|
||||||
* @param array &$$errors Registry of errors
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
private static function delete(string $$directory, array &$$errors = []): void
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
if (file_exists($$directory)) {
|
|
||||||
// Directory exists
|
|
||||||
|
|
||||||
// Deleting descendant files and directories (enter to the recursion)
|
|
||||||
foreach (scandir($$directory) as $$file) {
|
|
||||||
if ($$file === '.' || $$file === '..') continue;
|
|
||||||
else if (is_dir("$$directory/$$file")) static::delete("$$directory/$$file", $$errors);
|
|
||||||
else unlink("$$directory/$$file");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deleting the directory
|
|
||||||
rmdir($$directory);
|
|
||||||
|
|
||||||
// Exit (success)
|
|
||||||
return;
|
|
||||||
} else throw new exception('Directory does not exist');
|
|
||||||
} catch (exception $$e) {
|
|
||||||
// Writing to the registry of errors
|
|
||||||
$$errors[] = [
|
|
||||||
'text' => $$e->getMessage(),
|
|
||||||
'file' => $$e->getFile(),
|
|
||||||
'line' => $$e->getLine(),
|
|
||||||
'stack' => $$e->getTrace()
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Exit (fail)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,8 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace ${REPO_OWNER}\${REPO_NAME}\views;
|
namespace ${REPO_OWNER}\${REPO_NAME}\views;
|
||||||
|
|
||||||
// Files of the project
|
// Library for languages support
|
||||||
use ${REPO_OWNER}\${REPO_NAME}\models\enumerations\language;
|
use mirzaev\languages\language;
|
||||||
|
|
||||||
// Framework for PHP
|
// Framework for PHP
|
||||||
use mirzaev\minimal\controller;
|
use mirzaev\minimal\controller;
|
||||||
@@ -34,7 +34,6 @@ use ArrayAccess as array_access,
|
|||||||
*
|
*
|
||||||
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
||||||
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||||
* @author ${REPO_OWNER} <mail@domain.zone>
|
|
||||||
*/
|
*/
|
||||||
final class templater extends controller implements array_access
|
final class templater extends controller implements array_access
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,10 +25,16 @@
|
|||||||
"php": "^8.4",
|
"php": "^8.4",
|
||||||
"mirzaev/minimal": "^3.7",
|
"mirzaev/minimal": "^3.7",
|
||||||
"mirzaev/baza": "^3.3",
|
"mirzaev/baza": "^3.3",
|
||||||
|
"mirzaev/languages": "^1",
|
||||||
"twig/twig": "^3.2",
|
"twig/twig": "^3.2",
|
||||||
"twig/extra-bundle": "^3.7",
|
"twig/extra-bundle": "^3.7",
|
||||||
"twig/intl-extra": "^3.10"
|
"twig/intl-extra": "^3.10"
|
||||||
},
|
},
|
||||||
|
"suggest": {
|
||||||
|
"mirzaev/files": "Easy working with files",
|
||||||
|
"mirzaev/currencies": "Easy currencies integration"
|
||||||
|
|
||||||
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"${REPO_OWNER}\\${REPO_NAME}\\": "${REPO_OWNER}/${REPO_NAME}/system"
|
"${REPO_OWNER}\\${REPO_NAME}\\": "${REPO_OWNER}/${REPO_NAME}/system"
|
||||||
|
|||||||
Reference in New Issue
Block a user