1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-17 18:36:39 +02:00

Slim Framework integration #118 #117

- Admin plugin refactoring
This commit is contained in:
Awilum
2019-06-01 23:13:49 +03:00
parent f79184c652
commit e992e28e00
18 changed files with 2 additions and 819 deletions

View File

@@ -66,3 +66,5 @@ $app->get('/admin/registration', 'UsersController:registration')->setName('admin
$app->post('/admin/registration', 'UsersController:registrationProcess')->setName('admin.users.registrationProcess');
$app->get('/admin/login', 'UsersController:login')->setName('admin.users.login');
$app->post('/admin/login', 'UsersController:loginProcess')->setName('admin.users.loginProcess');
$app->get('/admin/profile', 'UsersController:profile')->setName('admin.users.profile');
$app->post('/admin/logout', 'UsersController:logoutProcess')->setName('admin.users.logoutProcess');

View File

@@ -1,4 +0,0 @@
</div> <!-- .col-md-12 -->
</div> <!-- .row -->
</div> <!-- .container-fluid -->
</div> <!-- .content -->

View File

@@ -1,10 +0,0 @@
<?php
namespace Flextype;
use Flextype\Component\Http\Http;
use Flextype\Component\Arr\Arr;
use Flextype\Component\Registry\Registry;
?>
<div class="content <?php if (in_array(Registry::get('sidebar_menu_item'), ['entries', 'templates', 'snippets', 'fieldsets', 'menus'])): ?> entry-editor <?php endif ?>">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">

View File

@@ -1,8 +0,0 @@
<?php namespace Flextype ?>
</div> <!-- .main-panel -->
</div> <!-- .wrapper -->
<?php Themes::view('admin/views/partials/tail')->display() ?>
</body>
</html>

View File

@@ -1,59 +0,0 @@
<?php
namespace Flextype;
use Flextype\Component\Http\Http;
use Flextype\Component\Registry\Registry;
use Flextype\Component\Event\Event;
use Flextype\Component\Assets\Assets;
use function Flextype\Component\I18n\__;
?>
<!doctype html>
<html lang="<?= Registry::get('settings.locale') ?>">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<?php Event::dispatch('onAdminThemeMeta') ?>
<title>FLEXTYPE</title>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<?php Assets::add('css', Http::getBaseUrl() . '/site/plugins/admin/assets/dist/css/admin-build.min.css', 'admin', 8); ?>
<?php if (Registry::get('settings.admin_panel.theme') == 'light'): ?>
<?php Assets::add('css', Http::getBaseUrl() . '/site/plugins/admin/assets/dist/css/elegant.css', 'admin', 9) ?>
<?php Assets::add('css', Http::getBaseUrl() . '/site/plugins/admin/assets/dist/css/admin-light.min.css', 'admin', 10) ?>
<?php elseif (Registry::get('settings.admin_panel.theme') == 'dark'): ?>
<?php Assets::add('css', Http::getBaseUrl() . '/site/plugins/admin/assets/dist/css/monokai.css', 'admin', 9) ?>
<?php endif ?>
<?php foreach (Assets::get('css', 'admin') as $assets_by_priorities): ?>
<?php foreach ($assets_by_priorities as $assets): ?>
<link href="<?= $assets['asset'] ?>" rel="stylesheet">
<?php endforeach ?>
<?php endforeach ?>
<style media="screen">
.content-full-size .main-panel .navbar-fixed+.content {
padding-top: 61px;
}
.content-full-size .main-panel .content {
padding: 0;
}
.content-full-size .container-fluid {
padding: 0;
}
</style>
<?php Event::dispatch('onAdminThemeHeader') ?>
</head>
<body <?php if (Http::get('preview') && Http::get('preview') == 'true'): ?> class="content-full-size" <?php endif ?>>
<div class="wrapper">
<?php UsersManager::isLoggedIn() and Themes::view('admin/views/partials/sidebar')->display() ?>
<div class="main-panel <?php if (isset($main_panel_class)) { echo $main_panel_class; }?>">

View File

@@ -1,51 +0,0 @@
<?php
namespace Flextype;
use Flextype\Component\{Http\Http, Html\Html, Registry\Registry, Token\Token, Arr\Arr};
use function Flextype\Component\I18n\__;
?>
<?php if (isset($links) || isset($buttons)): ?>
<nav class="navbar navbar-expand-lg navbar-fixed">
<div class="container-fluid">
<?php if (isset($links)): ?>
<div class="navbar-wrapper">
<?php foreach ($links as $link): ?>
<?= Html::anchor($link['title'], $link['link'], $link['attributes']) ?>
<?php endforeach ?>
</div>
<?php endif ?>
<?php if (isset($buttons)): ?>
<div class="navbar-buttons">
<?php foreach ($buttons as $button): ?>
<?= Html::anchor($button['title'], $button['link'], $button['attributes']) ?>
<?php endforeach ?>
</div>
<?php endif ?>
</div>
</nav>
<?php endif ?>
<?php if (Registry::get('sidebar_menu_item') == 'entries'): ?>
<div class="entry-editor-heading">
<?php $parts = explode("/", Http::get('entry')) ?>
<?php $i = count($parts) ?>
<?php foreach ($parts as $part): ?>
<?php $i-- ?>
<?php if ($part == Arr::last($parts)): ?>
/ <?= $part ?>
<?php else: ?>
<a href="<?= Http::getBaseUrl() ?>/admin/entries/?entry=<?= implode(array_slice($parts, 0, -$i), '/') ?>"> / <?= $part ?></a>
<?php endif ?>
<?php endforeach ?>
</div>
<?php endif ?>
<?php if (in_array(Registry::get('sidebar_menu_item'), ['templates', 'snippets', 'fieldsets', 'menus'])): ?>
<div class="entry-editor-heading">
/
<?= Http::get('template') ?? Http::get('template') ?>
<?= Http::get('fieldset') ?? Http::get('fieldset') ?>
<?= Http::get('snippet') ?? Http::get('snippet') ?>
<?= Http::get('menu') ?? Http::get('menu') ?>
</div>
<?php endif ?>

View File

@@ -1,54 +0,0 @@
<?php
namespace Flextype;
use Flextype\Component\{Http\Http, Html\Html, Registry\Registry, Arr\Arr, Event\Event, Token\Token, Session\Session};
use function Flextype\Component\I18n\__;
use Flextype\Navigation;
?>
<div class="sidebar">
<div class="sidebar-wrapper">
<div class="flextype-logo">
<a href="<?= Http::getBaseUrl() ?>/admin">
FLEXTYPE
</a>
<a href="<?= Http::getBaseUrl() ?>" class="view-site-link" target="_blank">
<i class="fas fa-external-link-alt"></i>
</a>
</div>
<ul class="nav">
<?php $active_menu_item = Registry::exists('sidebar_menu_item') ? Registry::get('sidebar_menu_item') : ''; ?>
<?php foreach (NavigationManager::getItems('content') as $item): ?>
<li class="nav-item <?= ($item['item'] == $active_menu_item) ? 'active' : '' ?>">
<?= Html::anchor($item['title'], $item['link'], $item['attributes']) ?>
</li>
<?php endforeach ?>
<?php foreach (NavigationManager::getItems('extends') as $item): ?>
<li class="nav-item <?= ($item['item'] == $active_menu_item) ? 'active' : '' ?>">
<?= Html::anchor($item['title'], $item['link'], $item['attributes']) ?>
</li>
<?php endforeach ?>
<?php foreach (NavigationManager::getItems('settings') as $item): ?>
<li class="nav-item <?= ($item['item'] == $active_menu_item) ? 'active' : '' ?>">
<?= Html::anchor($item['title'], $item['link'], $item['attributes']) ?>
</li>
<?php endforeach ?>
<?php foreach (NavigationManager::getItems('help') as $item): ?>
<li class="nav-item <?= ($item['item'] == $active_menu_item) ? 'active' : '' ?>">
<?= Html::anchor($item['title'], $item['link'], $item['attributes']) ?>
</li>
<?php endforeach ?>
</ul>
<div class="flextype-user">
<ul class="nav">
<li class="nav-item <?= ('profile' == $active_menu_item) ? 'active' : '' ?>">
<a class="nav-link" href="<?= Http::getBaseUrl() ?>/admin/profile">
<i class="fas fa-user-circle"></i>
<p>
<?= Session::get('username') ?>
</p>
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="sidebar-off-canvas"></div>

View File

@@ -1,192 +0,0 @@
<?php
namespace Flextype;
use Flextype\Component\{Http\Http, Event\Event, Registry\Registry, Assets\Assets, Notification\Notification};
?>
<?php if (Registry::get("settings.locale") == 'en_US'): ?>
<?php $locale_lower = 'en' ?>
<?php else: ?>
<?php $locale_lower = strtolower(Registry::get("settings.locale")) ?>
<?php endif ?>
<?php Assets::add('js', Http::getBaseUrl() . '/site/plugins/admin/assets/dist/js/admin-build.min.js', 'admin', 1) ?>
<?php if (Registry::get("settings.locale") != 'en'): ?>
<?php Assets::add('js', Http::getBaseUrl() . '/site/plugins/admin/assets/dist/langs/trumbowyg/langs/' . Registry::get("settings.locale") . '.min.js', 'admin', 10) ?>
<?php endif ?>
<?php foreach (Assets::get('js', 'admin') as $assets_by_priorities): ?>
<?php foreach ($assets_by_priorities as $assets): ?>
<script type="text/javascript" src="<?php echo $assets['asset']; ?>"></script>
<?php endforeach ?>
<?php endforeach ?>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.3.26/jquery.form-validator.min.js"></script>
<script>
new ClipboardJS('.js-clipboard-btn');
bsCustomFileInput.init();
Messenger.options = {
extraClasses: 'messenger-fixed messenger-on-bottom messenger-on-right',
theme: 'flat'
}
<?php if (Notification::get('success')): ?> Messenger().post({ type: "success", message : "<?= Notification::get('success') ?>", hideAfter: '3' }); <?php endif ?>
<?php if (Notification::get('warning')): ?> Messenger().post({ type: "warning", message : "<?= Notification::get('warning') ?>", hideAfter: '3' }); <?php endif ?>
<?php if (Notification::get('error')): ?> Messenger().post({ type: "error", message : "<?= Notification::get('error') ?>", hideAfter: '3' }); <?php endif ?>
if (typeof $.flextype == 'undefined') $.flextype = {};
$.flextype.plugins = {
init: function() {
this.changeStatusProcess();
},
changeStatus: function(plugin, status, token) {
$.ajax({
type: "post",
data: "plugin_change_status=1&plugin="+plugin+"&status="+status+"&token="+token,
url: $('form input[name="url"]').val()
});
},
changeStatusProcess: function() {
$(".js-switch").click(function() {
if ($(this).is(':checked')) {
$.flextype.plugins.changeStatus($(this).data("plugin"), "true", $(this).data("token"));
} else {
$.flextype.plugins.changeStatus($(this).data("plugin"), "false", $(this).data("token"));
}
});
}
};
$(document).ready(function() {
$.trumbowyg.svgPath = '<?php echo Http::getBaseUrl(); ?>/site/plugins/admin/assets/dist/fonts/trumbowyg/icons.svg';
$('.js-html-editor').trumbowyg({
btnsDef: {
// Customizables dropdowns
image: {
dropdown: ['insertImage', 'noembed'],
ico: 'insertImage'
}
},
btns: [
['undo', 'redo'], // Only supported in Blink browsers
['formatting'],
['strong', 'em', 'del'],
['link'],
['image'],
['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
['unorderedList', 'orderedList'],
['table'],
['removeformat'],
['fullscreen']
],
lang: '<?= $locale_lower ?>',
autogrow: false,
removeformatPasted: true
});
$.flextype.plugins.init();
$('.js-save-form-submit').click(function() {
$("#form" ).submit();
});
$('.navbar-toggler').click(function () {
$('.sidebar').addClass('show-sidebar');
$('.sidebar-off-canvas').addClass('show-sidebar-off-canvas');
});
$('.sidebar-off-canvas').click(function () {
$('.sidebar').removeClass('show-sidebar');
$('.sidebar-off-canvas').removeClass('show-sidebar-off-canvas');
});
$('.js-plugins-info').click(function () {
$('#pluginInfoModal').modal();
$('.js-plugin-name-placeholder').html($(this).attr('data-name'));
$('.js-plugin-version-placeholder').html($(this).attr('data-version'));
$('.js-plugin-description-placeholder').html($(this).attr('data-description'));
$('.js-plugin-author-name-placeholder').html($(this).attr('data-author-name'));
$('.js-plugin-author-email-placeholder').html($(this).attr('data-author-email'));
$('.js-plugin-author-url-placeholder').html($(this).attr('data-author-url'));
$('.js-plugin-homepage-placeholder').html($(this).attr('data-homepage'));
$('.js-plugin-bugs-placeholder').html($(this).attr('data-bugs'));
$('.js-plugin-license-placeholder').html($(this).attr('data-license'));
});
$('.js-snippets-info').click(function () {
$('#snippetsInfoModal').modal();
$('.js-snippets-snippet-placeholder').html($(this).attr('data-name'));
$('.js-snippets-php-placeholder').html($(this).attr('data-name'));
});
$('.js-entries-image-preview').click(function () {
$('#entriesImagePreview').modal();
$('.js-entry-image-preview-placeholder').css('background-image', 'url(' + $(this).attr('data-image-url') + ')');
$('.js-entry-image-url-placeholder').val($(this).attr('data-image-url'));
$('.js-entry-image-delete-url-placeholder').attr('href', $(this).attr('data-image-delete-url'));
});
$('.js-settings-entry-modal').click(function () {
$('#settingsEntryModal').modal();
});
$.validate({});
<?php if (Http::get('fieldset') || Http::get('menu') || Http::get('snippet') || Http::get('source') || Http::get('template')): ?>
var editor = CodeMirror.fromTextArea(document.getElementById("codeMirrorEditor"), {
lineNumbers: true,
<?php if (Http::get('fieldset') || Http::get('menu')): ?>
indentUnit: 2,
tabSize: 2,
<?php else: ?>
tabSize: 4,
indentUnit: 4,
<?php endif ?>
<?php if (Http::get('fieldset') || Http::get('menu')): ?>
mode: "yaml",
<?php else: ?>
mode: "application/x-httpd-php",
<?php endif ?>
indentWithTabs: false,
<?php if (Registry::get('settings.admin_panel.theme') == 'light'): ?>
theme: "elegant",
<?php elseif (Registry::get('settings.admin_panel.theme') == 'dark'): ?>
theme: "monokai",
<?php endif ?>
styleActiveLine: true,
});
editor.addKeyMap({
"Tab": function (cm) {
if (cm.somethingSelected()) {
var sel = editor.getSelection("\n");
// Indent only if there are multiple lines selected, or if the selection spans a full line
if (sel.length > 0 && (sel.indexOf("\n") > -1 || sel.length === cm.getLine(cm.getCursor().line).length)) {
cm.indentSelection("add");
return;
}
}
if (cm.options.indentWithTabs)
cm.execCommand("insertTab");
else
cm.execCommand("insertSoftTab");
},
"Shift-Tab": function (cm) {
cm.indentSelection("subtract");
}
});
<?php endif ?>
});
</script>
<?php Event::dispatch('onAdminThemeFooter') ?>

View File

@@ -1,50 +0,0 @@
<?php
namespace Flextype;
use Flextype\Component\Registry\Registry;
use Flextype\Component\Html\Html;
use Flextype\Component\Form\Form;
use Flextype\Component\Http\Http;
use Flextype\Component\Token\Token;
use function Flextype\Component\I18n\__;
Themes::view('admin/views/partials/head')->display();
Themes::view('admin/views/partials/navbar')
->assign('links', [
'edit_entry' => [
'link' => Http::getBaseUrl() . '/admin/entries/edit?entry=' . $entry_name,
'title' => __('admin_content'),
'attributes' => ['class' => 'navbar-item active']
],
'edit_entry_media' => [
'link' => Http::getBaseUrl() . '/admin/entries/edit?entry=' . $entry_name . '&media=true',
'title' => __('admin_media'),
'attributes' => ['class' => 'navbar-item']
],
'edit_entry_source' => [
'link' => Http::getBaseUrl() . '/admin/entries/edit?entry=' . $entry_name . '&source=true',
'title' => __('admin_source'),
'attributes' => ['class' => 'navbar-item']
]
])
->assign('buttons', [
'save_entry' => [
'link' => 'javascript:;',
'title' => __('admin_save'),
'attributes' => ['class' => 'js-save-form-submit float-right btn']
],
'view_entry' => [
'link' => Http::getBaseUrl() . '/' . $entry_name,
'title' => __('admin_preview'),
'attributes' => ['class' => 'float-right btn', 'target' => '_blank']
]
])
->assign('entry', $entry)
->display();
Themes::view('admin/views/partials/content-start')->display();
?>
<?= FieldsetsManager::fetchForm($fieldset, $entry) ?>
<?php Themes::view('admin/views/partials/content-end')->display() ?>
<?php Themes::view('admin/views/partials/footer')->display() ?>

View File

@@ -1,94 +0,0 @@
<?php
namespace Flextype;
use Flextype\Component\{Registry\Registry, Html\Html, Form\Form, Http\Http, Token\Token};
use function Flextype\Component\I18n\__;
?>
<?php
Themes::view('admin/views/partials/head')->display();
Themes::view('admin/views/partials/navbar')
->assign('links', [
'edit_entry' => [
'link' => Http::getBaseUrl() . '/admin/entries/edit?entry=' . $entry_name,
'title' => __('admin_content'),
'attributes' => ['class' => 'navbar-item']
],
'edit_entry_media' => [
'link' => Http::getBaseUrl() . '/admin/entries/edit?entry=' . $entry_name . '&media=true',
'title' => __('admin_media'),
'attributes' => ['class' => 'navbar-item active']
],
'edit_entry_source' => [
'link' => Http::getBaseUrl() . '/admin/entries/edit?entry=' . $entry_name . '&source=true',
'title' => __('admin_source'),
'attributes' => ['class' => 'navbar-item']
]
])
->assign('entry', $entry)
->display();
Themes::view('admin/views/partials/content-start')->display();
?>
<?= Form::open(null, ['enctype' => 'multipart/form-data', 'class' => 'form-inline form-upload']) ?>
<?= Form::hidden('token', Token::generate()) ?>
<div class="input-group">
<div class="custom-file">
<input id="file" name="file" type="file" class="custom-file-input" id="inputGroupFile04" aria-describedby="inputGroupFileAddon">
<label class="custom-file-label" data-browse="<?= __('admin_browse_files') ?>" for="inputGroupFileAddon"></label>
</div>
<div class="input-group-append">
<?= Form::submit('upload_file', __('admin_upload'), ['class' => 'btn btn-outline-secondary']) ?>
</div>
</div>
<?= Form::close() ?>
<br>
<div class="media-manager">
<div class="row">
<?php foreach ($files as $file): ?>
<div class="col-sm-2">
<div class="item">
<a href="javascript:;"
<?php $file_ext = substr(strrchr($file, '.'), 1) ?>
<?php if (in_array($file_ext, ['jpeg', 'png', 'gif', 'jpg'])): ?>
style="background-image: url('<?= Images::getImageUrl(Http::get('entry') . '/' . basename($file), ['w'=>'200']) ?>')"
<?php else: ?>
style="background: #000;"
<?php endif ?>
class="img-item js-entries-image-preview"
data-image-delete-url="<?= Http::getBaseUrl() ?>/admin/entries/edit?entry=<?= Http::get('entry') ?>&delete_file=<?= basename($file) ?>&media=true&token=<?= Token::generate() ?>"
data-image-url="<?= Http::getBaseUrl() . '/site/entries/' . Http::get('entry') . '/' . basename($file) ?>">
<i class="fas fa-eye"></i>
<?php if (!in_array($file_ext, ['jpeg', 'png', 'gif', 'jpg'])): ?>
<span class="file-ext"><?= $file_ext ?></span>
<?php endif ?>
</a>
</div>
</div>
<?php endforeach ?>
</div>
</div>
<div class="modal animated fadeIn faster image-preview-modal" id="entriesImagePreview" tabindex="-1" role="dialog" aria-labelledby="entriesImagePreviewLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="entriesImagePreviewLabel"><?= __('admin_preview') ?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body js-entry-image-preview-placeholder image-preview">
</div>
<div class="modal-footer">
<input type="text" name="" class="form-control js-entry-image-url-placeholder" value="">
<a href="#" class="js-entry-image-delete-url-placeholder btn btn-primary"><?= __('admin_delete') ?></a>
</div>
</div>
</div>
</div>
<?php Themes::view('admin/views/partials/content-end')->display() ?>
<?php Themes::view('admin/views/partials/footer')->display() ?>

View File

@@ -1,58 +0,0 @@
<?php
namespace Flextype;
use Flextype\Component\{Registry\Registry, Html\Html, Form\Form, Http\Http, Token\Token};
use function Flextype\Component\I18n\__;
?>
<?php
Themes::view('admin/views/partials/head')->display();
Themes::view('admin/views/partials/navbar')
->assign('links', [
'edit_entry' => [
'link' => Http::getBaseUrl() . '/admin/entries/edit?entry=' . $entry_name,
'title' => __('admin_content'),
'attributes' => ['class' => 'navbar-item']
],
'edit_entry_media' => [
'link' => Http::getBaseUrl() . '/admin/entries/edit?entry=' . $entry_name . '&media=true',
'title' => __('admin_media'),
'attributes' => ['class' => 'navbar-item']
],
'edit_entry_source' => [
'link' => Http::getBaseUrl() . '/admin/entries/edit?entry=' . $entry_name . '&source=true',
'title' => __('admin_source'),
'attributes' => ['class' => 'navbar-item active']
]
])
->assign('buttons', [
'save_entry' => [
'link' => 'javascript:;',
'title' => __('admin_save'),
'attributes' => ['class' => 'js-save-form-submit float-right btn']
],
'view_entry' => [
'link' => Http::getBaseUrl() . '/' . $entry_name,
'title' => __('admin_preview'),
'attributes' => ['class' => 'float-right btn', 'target' => '_blank']
]
])
->assign('entry', $entry)
->display();
Themes::view('admin/views/partials/content-start')->display();
?>
<?= Form::open(null, ['id' => 'form']) ?>
<?= Form::hidden('token', Token::generate()) ?>
<?= Form::hidden('action', 'save-form') ?>
<?= Form::hidden('entry_name', $entry_name) ?>
<div class="row">
<div class="col-12">
<div class="form-group">
<?= Form::textarea('entry_content', $entry_content, ['class' => 'form-control', 'style' => 'min-height:500px;', 'id' => 'codeMirrorEditor']) ?>
</div>
</div>
</div>
<?= Form::close() ?>
<?php Themes::view('admin/views/partials/content-end')->display() ?>
<?php Themes::view('admin/views/partials/footer')->display() ?>

View File

@@ -1,43 +0,0 @@
<?php
namespace Flextype;
use Flextype\Component\Registry\Registry;
use Flextype\Component\Http\Http;
use Flextype\Component\Form\Form;
use Flextype\Component\Html\Html;
use Flextype\Component\Token\Token;
use function Flextype\Component\I18n\__;
Themes::view('admin/views/partials/head')->display();
Themes::view('admin/views/partials/navbar')
->assign('links', [
'snippets' => [
'link' => Http::getBaseUrl() . '/admin/snippets',
'title' => __('admin_snippets'),
'attributes' => ['class' => 'navbar-item']
],
'snippets_add' => [
'link' => Http::getBaseUrl() . '/admin/snippets/add',
'title' => __('admin_create_new_snippet'),
'attributes' => ['class' => 'navbar-item active']
]
])
->display();
Themes::view('admin/views/partials/content-start')->display();
?>
<div class="row">
<div class="col-md-6">
<?= Form::open(); ?>
<?= Form::hidden('token', Token::generate()); ?>
<div class="form-group">
<?= Form::label('name', __('admin_name'), ['for' => 'snippetName']) ?>
<?= Form::input('name', '', ['class' => 'form-control', 'id' => 'snippetName', 'required', 'data-validation' => 'length required', 'data-validation-allowing' => '-_', 'data-validation-length' => 'min1', 'data-validation-error-msg' => __('admin_error_name_empty_input')]) ?>
</div>
</div>
</div>
<?= Form::submit('create_snippet', __('admin_create'), ['class' => 'btn btn-black']) ?>
<?= Form::close() ?>
<?php Themes::view('admin/views/partials/content-end')->display() ?>
<?php Themes::view('admin/views/partials/footer')->display() ?>

View File

@@ -1,49 +0,0 @@
<?php
namespace Flextype;
use Flextype\Component\Registry\Registry;
use Flextype\Component\Http\Http;
use Flextype\Component\Form\Form;
use Flextype\Component\Html\Html;
use Flextype\Component\Token\Token;
use function Flextype\Component\I18n\__;
Themes::view('admin/views/partials/head')->display();
Themes::view('admin/views/partials/navbar')
->assign('links', [
'snippet' => [
'link' => Http::getBaseUrl() . '/admin/snippets/edit?snippet=' . Http::get('snippet'),
'title' => __('admin_snippet'),
'attributes' => ['class' => 'navbar-item active']
]
])
->assign('buttons', [
'save_entry' => [
'link' => 'javascript:;',
'title' => __('admin_save'),
'attributes' => ['class' => 'js-save-form-submit float-right btn']
]
])
->display();
Themes::view('admin/views/partials/content-start')->display();
?>
<div class="row">
<div class="col-12">
<?= Form::open(null, ['id' => 'form']) ?>
<?= Form::hidden('token', Token::generate()) ?>
<?= Form::hidden('action', 'save-form') ?>
<?= Form::hidden('name', Http::get('snippet')) ?>
<div class="row">
<div class="col-12">
<div class="form-group">
<?= Form::textarea('snippet', $snippet, ['class' => 'form-control', 'style' => 'min-height:500px;', 'id' => 'codeMirrorEditor']) ?>
</div>
</div>
</div>
<?= Form::close() ?>
</div>
</div>
<?php Themes::view('admin/views/partials/content-end')->display() ?>
<?php Themes::view('admin/views/partials/footer')->display() ?>

View File

@@ -1,93 +0,0 @@
<?php namespace Flextype ?>
<?php use Flextype\Component\{Http\Http, Registry\Registry, Filesystem\Filesystem, Token\Token, Text\Text, Form\Form} ?>
<?php use function Flextype\Component\I18n\__; ?>
<?php Themes::view('admin/views/partials/head')->display() ?>
<?php Themes::view('admin/views/partials/navbar')
->assign('links', [
'snippets' => [
'link' => Http::getBaseUrl() . '/admin/snippets',
'title' => __('admin_snippets'),
'attributes' => ['class' => 'navbar-item active']
]
])
->assign('buttons', [
'entries' => [
'link' => Http::getBaseUrl() . '/admin/snippets/add',
'title' => __('admin_create_new_snippet'),
'attributes' => ['class' => 'float-right btn']
]
])
->display()
?>
<?php Themes::view('admin/views/partials/content-start')->display() ?>
<?php if (count($snippets_list) > 0): ?>
<table class="table no-margin">
<thead>
<tr>
<th><?= __('admin_name') ?></th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($snippets_list as $snippet): ?>
<tr>
<td>
<a href="<?= Http::getBaseUrl() ?>/admin/snippets/edit?snippet=<?= basename($snippet, '.php') ?>"><?= basename($snippet, '.php') ?></a>
</td>
<td class="text-right">
<div class="btn-group">
<a class="btn btn-default" href="<?= Http::getBaseUrl() ?>/admin/snippets/edit?snippet=<?= basename($snippet, '.php') ?>"><?= __('admin_edit') ?></a>
<button type="button" class="btn btn-default dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="<?= Http::getBaseUrl() ?>/admin/snippets/rename?snippet=<?= basename($snippet, '.php') ?>"><?= __('admin_rename') ?></a>
<a class="dropdown-item" href="<?= Http::getBaseUrl() ?>/admin/snippets/duplicate?snippet=<?= basename($snippet, '.php') ?>&token=<?= Token::generate() ?>"><?= __('admin_duplicate') ?></a>
<a class="dropdown-item js-snippets-info" href="javascript:;" data-toggle="modal" data-target="#snippetsInfoModal" data-name="<?= basename($snippet, '.php') ?>"><?= __('admin_embeded_code') ?></a>
</div>
</div>
<a class="btn btn-default" href="<?= Http::getBaseUrl() ?>/admin/snippets/delete?snippet=<?= basename($snippet, '.php') ?>&token=<?= Token::generate() ?>"><?= __('admin_delete') ?></a>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php else: ?>
<?php endif ?>
<!-- Modal -->
<div class="modal fade" id="snippetsInfoModal" tabindex="-1" role="dialog" aria-labelledby="snippetsInfoModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="snippetsInfoModalLabel"><?= __('admin_embeded_code') ?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<?= Form::label('shortcode', __('admin_shortcode'), ['for' => 'shortcode']) ?>
<div class="alert alert-dark clipboard" role="alert">
<span id="snippet">[snippets fetch="<span class="js-snippets-snippet-placeholder"></span>"]</span>
<button class="js-clipboard-btn btn" data-clipboard-target="#snippet">
<?= __('admin_copy') ?>
</button>
</div>
<br>
<?= Form::label('php_code', __('admin_php_code'), ['for' => 'php_code']) ?>
<div id="php" class="alert alert-dark clipboard" role="alert">
<span id="php">&lt;?= Snippets::fetch("<span class="js-snippets-php-placeholder"></span>") ?&gt;</span>
<button class="js-clipboard-btn btn" data-clipboard-target="#php">
<?= __('admin_copy') ?>
</button>
</div>
</div>
</div>
</div>
</div>
<?php Themes::view('admin/views/partials/content-end')->display() ?>
<?php Themes::view('admin/views/partials/footer')->display() ?>

View File

@@ -1,44 +0,0 @@
<?php
namespace Flextype;
use Flextype\Component\Registry\Registry;
use Flextype\Component\Http\Http;
use Flextype\Component\Form\Form;
use Flextype\Component\Html\Html;
use Flextype\Component\Token\Token;
use function Flextype\Component\I18n\__;
Themes::view('admin/views/partials/head')->display();
Themes::view('admin/views/partials/navbar')
->assign('links', [
'snippets' => [
'link' => Http::getBaseUrl() . '/admin/snippets',
'title' => __('admin_snippets'),
'attributes' => ['class' => 'navbar-item']
],
'snippets_add' => [
'link' => Http::getBaseUrl() . '/admin/snippets/rename?snippet=' . $name_current,
'title' => __('admin_rename'),
'attributes' => ['class' => 'navbar-item active']
]
])
->display();
Themes::view('admin/views/partials/content-start')->display();
?>
<div class="row">
<div class="col-md-6">
<?= Form::open() ?>
<?= Form::hidden('token', Token::generate()) ?>
<?= Form::hidden('name_current', $name_current) ?>
<div class="form-group">
<?= Form::label('name', __('admin_name'), ['for' => 'snippetName']) ?>
<?= Form::input('name', $name_current, ['class' => 'form-control', 'id' => 'snippetName', 'required', 'data-validation' => 'length required', 'data-validation-allowing' => '-_', 'data-validation-length' => 'min1', 'data-validation-error-msg' => __('admin_error_title_empty_input')]) ?>
</div>
<?= Form::submit('rename_snippet', __('admin_save'), ['class' => 'btn btn-black btn-fill btn-wd']) ?>
<?= Form::close() ?>
</div>
</div>
<?php Themes::view('admin/views/partials/content-end')->display() ?>
<?php Themes::view('admin/views/partials/footer')->display() ?>

View File

@@ -58,16 +58,6 @@
{% else %}
<tr><td>Apache Mod Rewrite</td><td>{{ tr('admin_not_installed') }}</td></tr>
{% endif %}
{% if password_verify %}
<tr><td>password_verify()</td><td>{{ tr('admin_installed') }}</td></tr>
{% else %}
<tr><td>password_verify()</td><td>{{ tr('admin_not_installed') }}</td></tr>
{% endif %}
{% if password_hash %}
<tr><td>password_hash()</td><td>{{ tr('admin_installed') }}</td></tr>
{% else %}
<tr><td>password_hash()</td><td>{{ tr('admin_not_installed') }}</td></tr>
{% endif %}
</tbody>
</table>
{% endblock %}