mirror of
https://github.com/flextype/flextype.git
synced 2025-08-13 00:24:15 +02:00
Admin plugin #3 General Updates
This commit is contained in:
2
site/plugins/admin/CHANGELOG.md
Executable file
2
site/plugins/admin/CHANGELOG.md
Executable file
@@ -0,0 +1,2 @@
|
||||
# v0.0.0, 2018-XX-XX
|
||||
* Initial release
|
21
site/plugins/admin/LICENSE.txt
Executable file
21
site/plugins/admin/LICENSE.txt
Executable file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Flextype
|
||||
|
||||
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.
|
1
site/plugins/admin/README.md
Executable file
1
site/plugins/admin/README.md
Executable file
@@ -0,0 +1 @@
|
||||
# Admin Plugin for [Flextype](http://flextype.org/)
|
88
site/plugins/admin/admin.php
Executable file
88
site/plugins/admin/admin.php
Executable file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* Flextype Admin Plugin
|
||||
*
|
||||
* @author Romanenko Sergey / Awilum <awilum@yandex.ru>
|
||||
* @link http://flextype.org
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
use Url;
|
||||
use Arr;
|
||||
use Response;
|
||||
use Request;
|
||||
|
||||
//
|
||||
// Add listner for onPageBeforeRender event
|
||||
//
|
||||
if (Url::getUriSegment(0) == 'admin') {
|
||||
Events::addListener('onPageBeforeRender', function () {
|
||||
Admin::instance();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
class Admin {
|
||||
|
||||
/**
|
||||
* An instance of the Admin class
|
||||
*
|
||||
* @var object
|
||||
* @access protected
|
||||
*/
|
||||
protected static $instance = null;
|
||||
|
||||
/**
|
||||
* Protected clone method to enforce singleton behavior.
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function __clone()
|
||||
{
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
/**
|
||||
* Protected constructor since this is a static class.
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
static::init();
|
||||
}
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
if (static::isLoggedIn()) {
|
||||
echo 'ADMIN AREA';
|
||||
} else {
|
||||
echo 'LOGIN AREA';
|
||||
}
|
||||
|
||||
Request::shutdown();
|
||||
}
|
||||
|
||||
protected static function isLoggedIn() : bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Admin instance.
|
||||
* Create it if it's not already created.
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public static function instance()
|
||||
{
|
||||
return !isset(self::$instance) and self::$instance = new Admin();
|
||||
}
|
||||
}
|
13
site/plugins/admin/admin.yml
Executable file
13
site/plugins/admin/admin.yml
Executable file
@@ -0,0 +1,13 @@
|
||||
name: Admin
|
||||
version: 0.0.0
|
||||
description: "Admin plugin for Flextype"
|
||||
author:
|
||||
name: Sergey Romanenko
|
||||
email: awilum@yandex.ru
|
||||
url: http://flextype.org
|
||||
homepage: https://github.com/flextype/flextype
|
||||
bugs: https://github.com/flextype/flextype/issues
|
||||
license: MIT
|
||||
|
||||
# Plugin settings
|
||||
enabled: true
|
2
site/plugins/admin/languages/en.yml
Executable file
2
site/plugins/admin/languages/en.yml
Executable file
@@ -0,0 +1,2 @@
|
||||
sitemap: "Sitemap"
|
||||
sitemap_description: "Sitemap plugin provide automatically generated XML sitemap for Flextype."
|
2
site/plugins/admin/languages/ru.yml
Executable file
2
site/plugins/admin/languages/ru.yml
Executable file
@@ -0,0 +1,2 @@
|
||||
sitemap: "Sitemap"
|
||||
sitemap_description: "Sitemap plugin provide automatically generated XML sitemap for Flextype."
|
Reference in New Issue
Block a user