DEV: + HLEB v1.5.61
Незначительное изменение шаблонов + оптимизация
This commit is contained in:
parent
c6d3fda6be
commit
648a974701
19 changed files with 97 additions and 116 deletions
|
@ -148,6 +148,11 @@ class AnswerController extends \MainController
|
|||
|
||||
Base::Meta(lang('Edit answer'), lang('Edit answer'), $other = false);
|
||||
|
||||
Request::getResources()->addBottomStyles('/assets/js/editor/css/medium-editor.min.css');
|
||||
Request::getResources()->addBottomStyles('/assets/js/editor/css/themes/default.css');
|
||||
Request::getResources()->addBottomScript('/assets/js/editor/js/medium-editor.min.js');
|
||||
Request::getResources()->addBottomScript('/assets/js/editor.js');
|
||||
|
||||
return view(PR_VIEW_DIR . '/answer/answ-edit-form', ['data' => $data, 'uid' => $uid, 'post' => $post]);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,9 @@ class FlowController extends \MainController
|
|||
|
||||
Base::Meta(lang('Flow'), lang('Flow'), $other = false);
|
||||
|
||||
Request::getResources()->addBottomStyles('/assets/css/flow.css');
|
||||
Request::getResources()->addBottomScript('/assets/js/flow.js');
|
||||
|
||||
$uid = Base::getUid();
|
||||
$data = [
|
||||
'h1' => lang('Flow'),
|
||||
|
|
|
@ -172,6 +172,11 @@ class PostController extends \MainController
|
|||
$meta_desc = substr(strip_tags($post['post_content']), 0, 160);
|
||||
Base::Meta($post['post_title'], $meta_desc, $other);
|
||||
|
||||
Request::getResources()->addBottomStyles('/assets/js/editor/css/medium-editor.min.css');
|
||||
Request::getResources()->addBottomStyles('/assets/js/editor/css/themes/default.css');
|
||||
Request::getResources()->addBottomScript('/assets/js/editor/js/medium-editor.min.js');
|
||||
Request::getResources()->addBottomScript('/assets/js/editor.js');
|
||||
|
||||
$data = [
|
||||
'h1' => '',
|
||||
'canonical' => '/post/' . $post['post_id'] . '/' . $post['post_slug'],
|
||||
|
@ -235,6 +240,10 @@ class PostController extends \MainController
|
|||
|
||||
// title, description
|
||||
Base::Meta(lang('Add post'), lang('Add post'), $other = false);
|
||||
Request::getResources()->addBottomStyles('/assets/js/editor/css/medium-editor.min.css');
|
||||
Request::getResources()->addBottomStyles('/assets/js/editor/css/themes/default.css');
|
||||
Request::getResources()->addBottomScript('/assets/js/editor/js/medium-editor.min.js');
|
||||
Request::getResources()->addBottomScript('/assets/js/editor.js');
|
||||
|
||||
return view(PR_VIEW_DIR . '/post/post-add', ['data' => $data, 'uid' => $uid, 'space' => $space]);
|
||||
}
|
||||
|
@ -437,6 +446,11 @@ class PostController extends \MainController
|
|||
'h1' => lang('Edit post')
|
||||
];
|
||||
|
||||
Request::getResources()->addBottomStyles('/assets/js/editor/css/medium-editor.min.css');
|
||||
Request::getResources()->addBottomStyles('/assets/js/editor/css/themes/default.css');
|
||||
Request::getResources()->addBottomScript('/assets/js/editor/js/medium-editor.min.js');
|
||||
Request::getResources()->addBottomScript('/assets/js/editor.js');
|
||||
|
||||
// title, description
|
||||
Base::Meta(lang('Edit post'), lang('Edit post'), $other = false);
|
||||
|
||||
|
|
|
@ -5,9 +5,8 @@
|
|||
|
||||
// All calls are sent to this file.
|
||||
// Все вызовы направляются в этот файл.
|
||||
|
||||
define('HLEB_START', microtime(true));
|
||||
define('HLEB_FRAME_VERSION', "1.5.60");
|
||||
define('HLEB_FRAME_VERSION', "1.5.61");
|
||||
define('HLEB_PUBLIC_DIR', __DIR__);
|
||||
|
||||
// General headers.
|
||||
|
|
|
@ -12,12 +12,7 @@
|
|||
<?php if($uid['id']) { ?>
|
||||
<script src="/assets/js/jquery.min.js"></script>
|
||||
<script src="/assets/js/app.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="/assets/js/editor/css/medium-editor.min.css">
|
||||
<link rel="stylesheet" href="/assets/js/editor/css/themes/default.css">
|
||||
<?php } ?>
|
||||
<?php if($uid['uri'] == '/flow') { ?>
|
||||
<script src="/assets/js/flow.js"></script>
|
||||
<link rel="stylesheet" href="/assets/css/flow.css">
|
||||
<?php } ?>
|
||||
<?php print getRequestResources()->getBottomStyles(); ?>
|
||||
<?php print getRequestResources()->getBottomScripts(); ?>
|
||||
</html>
|
|
@ -54,6 +54,4 @@
|
|||
<br>
|
||||
</div>
|
||||
</main>
|
||||
<script src="/assets/js/editor/js/medium-editor.min.js"></script>
|
||||
<script src="/assets/js/editor.js"></script>
|
||||
<?php include TEMPLATE_DIR . '/footer.php'; ?>
|
|
@ -70,6 +70,4 @@
|
|||
<br>
|
||||
</div>
|
||||
</main>
|
||||
<script src="/assets/js/editor/js/medium-editor.js"></script>
|
||||
<script src="/assets/js/editor.js"></script>
|
||||
<?php include TEMPLATE_DIR . '/footer.php'; ?>
|
|
@ -12,7 +12,7 @@
|
|||
<div class="score"><?= $counter; ?>.</div>
|
||||
</div>
|
||||
<div class="post-telo">
|
||||
<a class="u-url" href="/post/<?= $fav['post_slug']; ?>">
|
||||
<a class="u-url" href="/post/<?= $fav['post_id']; ?>/<?= $fav['post_slug']; ?>">
|
||||
<h3 class="titl"><?= $fav['post_title']; ?></h3>
|
||||
</a>
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
|||
<?php if($fav['post_answers'] !=0) { ?>
|
||||
<span class="otst"> | </span>
|
||||
|
||||
<a href="/post/<?= $fav['post_slug']; ?>">
|
||||
<a href="/post/<?= $fav['post_id']; ?>/<?= $fav['post_slug']; ?>">
|
||||
комментариев (<?= $fav['post_answers'] ?>)
|
||||
</a>
|
||||
<?php } ?>
|
||||
|
@ -50,7 +50,7 @@
|
|||
<div class="score"><?= $counter; ?>.</div>
|
||||
</div>
|
||||
<div class="post-telo fav-answ">
|
||||
<a class="u-url" href="/post/<?= $fav['post']['post_slug']; ?>#answ_<?= $fav['answer_id']; ?>">
|
||||
<a class="u-url" href="/post/<?= $fav['post']['post_id']; ?>/<?= $fav['post']['post_slug']; ?>#answ_<?= $fav['answer_id']; ?>">
|
||||
<h3 class="titl"><?= $fav['post']['post_title']; ?></h3>
|
||||
</a>
|
||||
<div class="space-color space_<?= $fav['post']['space_color'] ?>"></div>
|
||||
|
|
|
@ -67,7 +67,7 @@ class CacheRoutes
|
|||
// Output and compile the route map.
|
||||
// Вывод и компиляция карты роутов.
|
||||
private function createRoutes() {
|
||||
hl_print_fulfillment_inspector(HLEB_LOAD_ROUTES_DIRECTORY, '/main.php');
|
||||
hleb_require(HLEB_LOAD_ROUTES_DIRECTORY . '/main.php');
|
||||
|
||||
// Reserved file name is used /routes/.../main.php
|
||||
// Используется зарезервированное название файла /routes/.../main.php
|
||||
|
|
|
@ -15,13 +15,13 @@ final class URLHandler
|
|||
// Parse the array with routes.
|
||||
// Разбор массива с маршрутами.
|
||||
public function page(array $blocks) {
|
||||
$searchDomains = $blocks['domains'] ?? false;
|
||||
// Clearing global data.
|
||||
// Очистка глобальных данных.
|
||||
if (isset($blocks['update'])) unset($blocks['update']);
|
||||
if (isset($blocks['render'])) unset($blocks['render']);
|
||||
if (isset($blocks['addresses'])) unset($blocks['addresses']);
|
||||
$searchDomains = $blocks['domains'] ?? false;
|
||||
if (isset($blocks['domains'])) unset($blocks['domains']);
|
||||
unset($blocks['domains']);
|
||||
unset($blocks['update']);
|
||||
unset($blocks['render']);
|
||||
unset($blocks['addresses']);
|
||||
|
||||
$url = Request::getMainClearUrl();
|
||||
$blocks = $searchDomains ? $this->matchSubdomains($blocks) : $blocks;
|
||||
|
|
21
vendor/phphleb/framework/LICENSE
vendored
21
vendor/phphleb/framework/LICENSE
vendored
|
@ -1,21 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2019 Foma Tuturov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
24
vendor/phphleb/framework/Main/MainAutoloader.php
vendored
24
vendor/phphleb/framework/Main/MainAutoloader.php
vendored
|
@ -9,12 +9,16 @@ use Hleb\Scheme\Home\Main\Connector;
|
|||
|
||||
final class MainAutoloader
|
||||
{
|
||||
private static $homeList = null;
|
||||
private static $mainList = null;
|
||||
|
||||
public static function get(string $class) {
|
||||
if (class_exists($class, false) || interface_exists($class, false)) return;
|
||||
if (self::search_and_include($class, new HomeConnector())) {
|
||||
self::createData();
|
||||
|
||||
if (self::searchAndInclude($class, self::$homeList)) {
|
||||
/* Checking inner classes. */
|
||||
/* Проверка внутренних классов. */
|
||||
} else if (self::search_and_include($class, new MainConnector())) {
|
||||
} else if (self::searchAndInclude($class, self::$mainList)) {
|
||||
/* Checking custom classes. */
|
||||
/* Проверка пользовательских классов. */
|
||||
} else {
|
||||
|
@ -58,7 +62,10 @@ final class MainAutoloader
|
|||
}
|
||||
|
||||
public static function search_and_include(string $class, Connector $connector): bool {
|
||||
$responding = $connector->add();
|
||||
return self::searchAndInclude($class, $connector->add());
|
||||
}
|
||||
|
||||
private static function searchAndInclude(string $class, array $responding): bool {
|
||||
/* If a class with a direct link is found. */
|
||||
/* Если найден класс с прямой ссылкой. */
|
||||
if (isset($responding[$class])) {
|
||||
|
@ -99,5 +106,14 @@ final class MainAutoloader
|
|||
if ($test && is_readable($path) === false) return;
|
||||
include_once "$path";
|
||||
}
|
||||
|
||||
private static function createData() {
|
||||
if(is_null(self::$homeList)) {
|
||||
self::$homeList = (new HomeConnector())->add();
|
||||
}
|
||||
if(is_null(self::$mainList)) {
|
||||
self::$mainList = (new MainConnector())->add();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
4
vendor/phphleb/framework/Main/MainDB.php
vendored
4
vendor/phphleb/framework/Main/MainDB.php
vendored
|
@ -23,9 +23,9 @@ final class MainDB
|
|||
HLEB_GLOBAL_DIRECTORY . '/database';
|
||||
|
||||
if (file_exists($configSearchDir . "/dbase.config.php")) {
|
||||
hl_print_fulfillment_inspector($configSearchDir, "/dbase.config.php");
|
||||
hleb_require($configSearchDir . "/dbase.config.php");
|
||||
} else {
|
||||
hl_print_fulfillment_inspector($configSearchDir, "/default.dbase.config.php");
|
||||
hleb_require($configSearchDir . "/default.dbase.config.php");
|
||||
}
|
||||
}
|
||||
$config = self::setConfigKey($config_key);
|
||||
|
|
|
@ -37,8 +37,10 @@ final class ProjectLoader extends BaseSingleton
|
|||
Route::instance()->delete();
|
||||
|
||||
if ($block) {
|
||||
if(HLEB_DEFAULT_SESSION_INIT || $_SERVER['REQUEST_METHOD'] !== 'GET') {
|
||||
if (!isset($_SESSION)) @session_start();
|
||||
if (!isset($_SESSION)) ErrorOutput::get("HL050-ERROR: SESSION not initialized !");
|
||||
}
|
||||
ProtectedCSRF::testPage($block);
|
||||
new Workspace($block, $render_map);
|
||||
print PageFinisher::getContent();
|
||||
|
|
34
vendor/phphleb/framework/bootstrap.php
vendored
34
vendor/phphleb/framework/bootstrap.php
vendored
|
@ -73,29 +73,12 @@ if (!defined('HLEB_GLOBAL_DIRECTORY')) {
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Monitors the execution of unnecessary output
|
||||
function hl_print_fulfillment_inspector(string $firstPartOfPath, string $secondPartOfPath) {
|
||||
$log = defined('HLEB_PROJECT_LOG_ON') && HLEB_PROJECT_LOG_ON;
|
||||
$debug = defined('HLEB_PROJECT_DEBUG') && HLEB_PROJECT_DEBUG;
|
||||
$fullPath = realpath($firstPartOfPath . $secondPartOfPath);
|
||||
$error = " ERROR! The file " . (!$debug && $log ? $fullPath : $secondPartOfPath);
|
||||
if (!file_exists($fullPath)) {
|
||||
$error .= " not found. " . PHP_EOL;
|
||||
// End of script execution before starting the framework.
|
||||
hl_preliminary_exit(!$debug && $log ? error_log($error) : $error);
|
||||
}
|
||||
ob_start();
|
||||
require_once "$fullPath";
|
||||
$content = ob_get_contents();
|
||||
ob_end_flush();
|
||||
if ($content !== '') {
|
||||
$error .= " is not intended to display content. " . PHP_EOL;
|
||||
// End of script execution before starting the framework.
|
||||
hl_preliminary_exit(!$debug && $log ? error_log($error) : $error);
|
||||
}
|
||||
function hleb_require(string $path) {
|
||||
require_once "$path";
|
||||
}
|
||||
|
||||
$pathToStartFileDir = rtrim(defined('HLEB_SEARCH_START_CONFIG_FILE') ? HLEB_SEARCH_START_CONFIG_FILE : HLEB_GLOBAL_DIRECTORY, '\\/ ');
|
||||
hl_print_fulfillment_inspector( $pathToStartFileDir, '/' . (file_exists($pathToStartFileDir . '/start.hleb.php') ? '' : 'default.') . 'start.hleb.php');
|
||||
hleb_require( $pathToStartFileDir . '/' . (file_exists($pathToStartFileDir . '/start.hleb.php') ? '' : 'default.') . 'start.hleb.php');
|
||||
|
||||
if (!defined('HLEB_PROJECT_DEBUG') || !is_bool(HLEB_PROJECT_DEBUG)) {
|
||||
// End of script execution before starting the framework.
|
||||
|
@ -134,6 +117,11 @@ if (!defined('HLEB_PROJECT_GLUE_WITH_WWW')) {
|
|||
define('HLEB_PROJECT_GLUE_WITH_WWW', 0);
|
||||
}
|
||||
|
||||
// Allows to set/unset session_start when loading the framework. For GET request method only.
|
||||
if (!defined('HLEB_DEFAULT_SESSION_INIT')) {
|
||||
define('HLEB_DEFAULT_SESSION_INIT', true);
|
||||
}
|
||||
|
||||
if (isset($_GET["_token"])) {
|
||||
header("Referrer-Policy: origin-when-cross-origin");
|
||||
}
|
||||
|
@ -273,9 +261,9 @@ if(empty($radjaxIsActive)) {
|
|||
require HLEB_VENDOR_DIRECTORY . '/phphleb/framework/init.php';
|
||||
|
||||
if (file_exists(HLEB_GLOBAL_DIRECTORY . '/app/Optional/aliases.php')) {
|
||||
hl_print_fulfillment_inspector(HLEB_GLOBAL_DIRECTORY, '/app/Optional/aliases.php');
|
||||
hleb_require(HLEB_GLOBAL_DIRECTORY . '/app/Optional/aliases.php');
|
||||
}
|
||||
hl_print_fulfillment_inspector(HLEB_GLOBAL_DIRECTORY, '/app/Optional/shell.php');
|
||||
hleb_require(HLEB_GLOBAL_DIRECTORY . '/app/Optional/shell.php');
|
||||
|
||||
\Hleb\Main\ProjectLoader::start();
|
||||
|
||||
|
|
28
vendor/phphleb/framework/composer.json
vendored
28
vendor/phphleb/framework/composer.json
vendored
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
"name": "phphleb/framework",
|
||||
"description": "Engine for Micro-Framework HLEB",
|
||||
"type": "library",
|
||||
"homepage": "https://phphleb.ru",
|
||||
"keywords": [
|
||||
"framework",
|
||||
"hleb",
|
||||
"phphleb",
|
||||
"microframework",
|
||||
"micro-framework",
|
||||
"php framework",
|
||||
"php"
|
||||
],
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Foma Tuturov",
|
||||
"email": "fomiash@yandex.ru"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.0.0",
|
||||
"ext-json": "*"
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
|
||||
}
|
4
vendor/phphleb/framework/console.php
vendored
4
vendor/phphleb/framework/console.php
vendored
|
@ -38,8 +38,8 @@ if (!defined('HLEB_PROJECT_CLASSES_AUTOLOAD')) {
|
|||
define('HLEB_PROJECT_CLASSES_AUTOLOAD', true);
|
||||
}
|
||||
|
||||
function hl_print_fulfillment_inspector(string $firstPartOfPath, string $secondPartOfPath) {
|
||||
require_once $firstPartOfPath . $secondPartOfPath;
|
||||
function hleb_require(string $path) {
|
||||
require_once "$path";
|
||||
}
|
||||
|
||||
define('HLEB_CONSOLE_USER_NAME', @exec('whoami'));
|
||||
|
|
25
vendor/phphleb/framework/init.php
vendored
25
vendor/phphleb/framework/init.php
vendored
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
define('HLEB_PROJECT_FULL_VERSION', '1.5.60');
|
||||
define('HLEB_PROJECT_FULL_VERSION', '1.5.61');
|
||||
|
||||
require HLEB_PROJECT_DIRECTORY . '/Scheme/App/Controllers/MainController.php';
|
||||
|
||||
|
@ -114,10 +114,31 @@ function hleb_to0me1cd6vo7gd_data() {
|
|||
function hleb_v10s20hdp8nm7c_render($render, $data = null) {
|
||||
|
||||
if (is_string($render)) {
|
||||
|
||||
$render = [$render];
|
||||
}
|
||||
|
||||
/*
|
||||
* Replacement by string key in a named array (first element).
|
||||
*
|
||||
* Замена по строковому ключу в именованном массиве (первый элемент).
|
||||
*
|
||||
* $map = ['header' => 'headerMap', 'content' => 'origin', 'footer' => 'footerMap'];
|
||||
* render([$map, 'content' => 'replace']);
|
||||
*/
|
||||
if (count($render) >= 2 && is_array($render[0])) {
|
||||
$list = [];
|
||||
$replace = $render;
|
||||
$origin = array_shift($replace);
|
||||
foreach ($origin as $key => $value) {
|
||||
if (!is_string($key)) {
|
||||
$list = [];
|
||||
break;
|
||||
}
|
||||
$list[] = isset($replace[$key]) ? $replace[$key] : $origin[$key];
|
||||
}
|
||||
$render = $list;
|
||||
}
|
||||
|
||||
return hleb_gop0m3f4hpe10d_all($render, $data, 'render');
|
||||
}
|
||||
|
||||
|
|
9
vendor/phphleb/framework/readme.md
vendored
9
vendor/phphleb/framework/readme.md
vendored
|
@ -1,9 +0,0 @@
|
|||
Engine for PHP Micro-Framework HLEB
|
||||
=====================
|
||||
|
||||
### ! This library is only for updates.
|
||||
|
||||
If you need to install the framework, use the link: [github.com/phphleb/hleb](https://github.com/phphleb/hleb)
|
||||
|
||||
A distinctive feature of the micro-framework HLEB is the minimalism of the code and the speed of work. The choice of this framework allows you to launch a full-fledged product with minimal time costs and appeals to documentation; it is easy, simple and fast.
|
||||
At the same time, it solves typical tasks, such as routing, shifting actions to controllers, model support, so, the basic MVC implementation. This is the very minimum you need to quickly launch an application.
|
Loading…
Reference in a new issue