1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-12 16:14:16 +02:00

Merge remote-tracking branch 'origin/dev'

# Conflicts:
#	README.md
This commit is contained in:
Awilum
2018-03-21 02:52:38 +03:00
338 changed files with 70352 additions and 6 deletions

5
.gitignore vendored Executable file
View File

@@ -0,0 +1,5 @@
.idea
.DS_Store
composer.phar
composer.lock
vendor

72
.htaccess Executable file
View File

@@ -0,0 +1,72 @@
##
# @package Flextype
#
# @author Sergey Romanenko <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.
##
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
## Begin - Exploits
# If you experience problems on your site block out the operations listed below
# This attempts to block the most common type of exploit `attempts` to Flextype
#
# Block out any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
#
## End - Exploits
## Begin - Index
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
## End - Index
## Begin - Security
# Block all direct access for these folders
RewriteRule ^(\.git|flextype)/(.*) error [F]
# Block access to specific file types for these system folders
RewriteRule ^(flextype|vendor)/(.*)\.(txt|xml|md|html|yaml|yml|php|pl|py|cgi|sh|bat)$ error [F]
# Block access to specific file types for these user folders
RewriteRule ^(site)/(.*)\.(txt|md|yaml|yml|php|pl|py|cgi|sh|bat)$ error [F]
# Block all direct access to .md files:
RewriteRule \.md$ error [F]
# Block all direct access to files and folders beginning with a dot
RewriteRule (^|/)\.(?!well-known) - [F]
# Block access to specific files in the root folder
RewriteRule ^(LICENSE\.md|composer\.lock|composer\.json|\.htaccess)$ error [F]
## End - Security
## Begin - Rewrite rules for SEO improvements.
# RewriteCond %{HTTP_HOST} ^www.example.org [NC]
# RewriteRule ^(.*)$ http://example.org/$1 [R=301,L]
# Redirect 301 /index http://example.org/
## End - Rewrite rules for SEO improvements.
</IfModule>
## Begin - Prevent Browsing and Set Default Resources
Options -Indexes
DirectoryIndex index.php index.html index.htm
## End - Prevent Browsing and Set Default Resources

2
CHANGELOG.md Executable file
View File

@@ -0,0 +1,2 @@
# Flextype 0.1.0, 2018-03-21
* Initial Release

21
LICENSE.txt Executable file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2018 Flextype Content Management
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.

45
README.md Normal file → Executable file
View File

@@ -1,3 +1,48 @@
<<<<<<< HEAD
<p align="center">
<img src="https://github.com/rawilum/rawilum/blob/dev/rawilum-logo-big.jpg?raw=true" alt="Rawilum" width="40%" height="40%" />
</p>
=======
# Flextype
![version](https://img.shields.io/badge/version-0.1.0-brightgreen.svg?style=flat-square "Version")
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/flextype/flextype/blob/master/LICENSE.txt)
Flextype is next generation of Legendary Monstra Engine it is also Open Source, fast and flexible file-based Content Management System. That's Easy to install, upgrade and use. Flextype provides amazing API's for plugins, themes and core developers! Content in Flextype is just a simple files written with markdown syntax in pages folder. You simply create markdown files in the pages folder and that becomes a page.
## Requirements
PHP 7.1.3 or higher with PHP's [Multibyte String module](http://php.net/mbstring)
Apache with [Mod Rewrite](http://httpd.apache.org/docs/current/mod/mod_rewrite.html)
## Installation
#### Using (S)FTP
[Download the latest version.](http://flextype.org/download)
Unzip the contents to a new folder on your local computer, and upload to your webhost using the (S)FTP client of your choice. After youve done this, be sure to chmod the following directories (with containing files) to 777, so they are readable and writable by Flextype:
* `site/`
#### Using Composer
You can easily install Flextype with Composer.
```
composer create-project flextype/flextype
```
## Contributing
1. Help on the [Forum.](http://forum.flextype.org)
2. Develop a new plugin.
3. Create a new theme.
4. Find and [report issues.](https://github.com/flextype/flextype/issues)
5. Link back to [Flextype](http://flextype.org).
## Links
- [Site](http://flextype.org)
- [Forum](http://forum.flextype.org)
- [Documentation](http://flextype.org/documentation)
- [Github Repository](https://github.com/flextype/flextype)
## License
See [LICENSE](https://github.com/flextype/flextype/blob/master/LICENSE.md)
>>>>>>> origin/dev

43
composer.json Executable file
View File

@@ -0,0 +1,43 @@
{
"name": "flextype/flextype",
"type": "library",
"description": "Flextype is Modern Open Source Flat-File Content Management System",
"keywords": ["Flextype", "php", "cms", "flat-file", "markdown"],
"homepage": "http://flextype.org",
"license": "MIT",
"authors": [
{
"name": "Sergey Romanenko",
"email": "awilum@yandex.ru",
"homepage": "https://github.com/Awilum"
}
],
"support": {
"issues": "https://github.com/flextype/flextype/issues"
},
"require": {
"php": ">=7.1.3",
"erusev/parsedown": "1.7.0",
"erusev/parsedown-extra": "0.7.1",
"doctrine/cache": "1.7.1",
"symfony/yaml": "4.0.4",
"symfony/filesystem": "4.0.4",
"symfony/finder": "4.0.4",
"force/session" : "*",
"force/arr" : "*",
"force/http" : "*",
"force/token" : "*",
"force/errorhandler" : "*",
"force/url" : "*"
},
"autoload": {
"classmap": [
"flextype"
],
"files": [
"flextype/boot/defines.php",
"flextype/boot/shortcodes.php",
"flextype/boot/events.php"
]
}
}

239
flextype/Cache.php Executable file
View File

@@ -0,0 +1,239 @@
<?php namespace Flextype;
/**
* @package Flextype
*
* @author Sergey Romanenko <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.
*/
class Cache
{
/**
* An instance of the Cache class
*
* @var object
*/
protected static $instance = null;
/**
* Unique cache key
*
* @var string Cache key.
*/
protected static $key;
/**
* Lifetime
*
* @var int Lifetime.
*/
protected static $lifetime;
/**
* Current time
*
* @var int Current time.
*/
protected static $now;
/**
* Cache Driver
*
* @var DoctrineCache
*/
protected static $driver;
/**
* Protected clone method to enforce singleton behavior.
*
* @access protected
*/
protected function __clone()
{
// Nothing here.
}
/**
* Constructor.
*
* @access protected
*/
protected function __construct()
{
// Set current time
static::$now = time();
// Cache key allows us to invalidate all cache on configuration changes.
static::$key = (Config::get('site.cache.prefix') ? Config::get('site.cache.prefix') : 'flextype') . '-' . md5(ROOT_DIR);
// Get Cache Driver
static::$driver = static::getCacheDriver();
// Set the cache namespace to our unique key
static::$driver->setNamespace(static::$key);
}
/**
* Get Cache Driver
*
* @access public
* @return object
*/
public static function getCacheDriver()
{
$driver_name = Config::get('site.cache.driver');
if (!$driver_name || $driver_name == 'auto') {
if (extension_loaded('apc')) {
$driver_name = 'apc';
} elseif (extension_loaded('wincache')) {
$driver_name = 'wincache';
} elseif (extension_loaded('xcache')) {
$driver_name = 'xcache';
}
} else {
$driver_name = 'file';
}
switch ($driver_name) {
case 'apc':
$driver = new \Doctrine\Common\Cache\ApcCache();
break;
case 'wincache':
$driver = new \Doctrine\Common\Cache\WinCacheCache();
break;
case 'xcache':
$driver = new \Doctrine\Common\Cache\XcacheCache();
break;
case 'memcache':
$memcache = new \Memcache();
$memcache->connect(Config::get('site.cache.memcache.server', 'localhost'),
Config::get('site.cache.memcache.port', 11211));
$driver = new \Doctrine\Common\Cache\MemcacheCache();
$driver->setMemcache($memcache);
break;
case 'redis':
$redis = new \Redis();
$redis->connect(Config::get('site.cache.redis.server', 'localhost'),
Config::get('site.cache.redis.port', 6379));
$driver = new \Doctrine\Common\Cache\RedisCache();
$driver->setRedis($redis);
break;
default:
// Create doctrine cache directory if its not exists
!Flextype::$filesystem->exists($cache_directory = CACHE_PATH . '/doctrine/') and Flextype::$filesystem->mkdir($cache_directory);
$driver = new \Doctrine\Common\Cache\FilesystemCache($cache_directory);
break;
}
return $driver;
}
/**
* Returns driver variable
*
* @access public
* @return object
*/
public static function driver()
{
return static::$driver;
}
/**
* Get cache key.
*
* @access public
* @return string
*/
public static function getKey()
{
return static::$key;
}
/**
* Fetches an entry from the cache.
*
* @access public
* @param string $id The id of the cache entry to fetch.
* @return mixed The cached data or FALSE, if no cache entry exists for the given id.
*/
public function fetch($id)
{
if (Config::get('site.cache.enabled')) {
return static::$driver->fetch($id);
} else {
return false;
}
}
/**
* Puts data into the cache.
*
* @access public
* @param string $id The cache id.
* @param mixed $data The cache entry/data.
* @param int $lifeTime The lifetime in number of seconds for this cache entry.
* If zero (the default), the entry never expires (although it may be deleted from the cache
* to make place for other entries).
*/
public function save($id, $data, $lifetime = null)
{
if (Config::get('site.cache.enabled')) {
if ($lifetime === null) {
$lifetime = static::getLifetime();
}
static::$driver->save($id, $data, $lifetime);
}
}
/**
* Clear Cache
*/
public static function clear()
{
Flextype::$filesystem->remove(CACHE_PATH . '/doctrine/');
}
/**
* Set the cache lifetime.
*
* @access public
* @param int $future timestamp
*/
public static function setLifetime($future)
{
if (!$future) {
return;
}
$interval = $future - $this->now;
if ($interval > 0 && $interval < static::getLifetime()) {
static::$lifetime = $interval;
}
}
/**
* Retrieve the cache lifetime (in seconds)
*
* @access public
* @return mixed
*/
public static function getLifetime()
{
if (static::$lifetime === null) {
static::$lifetime = Config::get('site.cache.lifetime') ?: 604800;
}
return static::$lifetime;
}
/**
* Initialize Flextype Cache
*
* <code>
* Cache::init();
* </code>
*
* @access public
* @return object
*/
public static function init()
{
return !isset(self::$instance) and self::$instance = new Cache();
}
}

112
flextype/Config.php Executable file
View File

@@ -0,0 +1,112 @@
<?php namespace Flextype;
use Arr;
use Symfony\Component\Yaml\Yaml;
/**
* @package Flextype
*
* @author Sergey Romanenko <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.
*/
class Config
{
/**
* An instance of the Config class
*
* @var object
* @access protected
*/
protected static $instance = null;
/**
* Config
*
* @var array
* @access protected
*/
protected static $config = [];
/**
* Protected clone method to enforce singleton behavior.
*
* @access protected
*/
protected function __clone()
{
// Nothing here.
}
/**
* Constructor.
*
* @access protected
*/
protected function __construct()
{
if (Flextype::$filesystem->exists($site_config = CONFIG_PATH . '/' . 'site.yml')) {
static::$config['site'] = Yaml::parse(file_get_contents($site_config));
} else {
throw new RuntimeException("Flextype site config file does not exist.");
}
}
/**
* Set new or update existing config variable
*
* @access public
* @param string $key Key
* @param mixed $value Value
*/
public static function set($key, $value)
{
Arr::set(static::$config, $key, $value);
}
/**
* Get config variable
*
* @access public
* @param string $key Key
* @param mixed $default Default value
* @return mixed
*/
public static function get($key, $default = null)
{
return Arr::get(static::$config, $key, $default);
}
/**
* Get config array
*
* <code>
* $config = Config::getConfig();
* </code>
*
* @access public
* @return array
*/
public static function getConfig()
{
return static::$config;
}
/**
* Initialize Flextype Config
*
* <code>
* Config::init();
* </code>
*
* @access public
*/
public static function init()
{
return !isset(self::$instance) and self::$instance = new Config();
}
}

101
flextype/Events.php Normal file
View File

@@ -0,0 +1,101 @@
<?php namespace Flextype;
use Arr;
/**
* @package Flextype
*
* @author Sergey Romanenko <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.
*/
class Events
{
/**
* Events
*
* @var array
* @access protected
*/
protected static $events = [];
/**
* Protected constructor since this is a static class.
*
* @access protected
*/
protected function __construct()
{
// Nothing here
}
/**
* Hooks a function on to a specific event.
*
* @access public
* @param string $event_name Event name
* @param mixed $added_function Added function
* @param integer $priority Priority. Default is 10
* @param array $args Arguments
*/
public static function addListener(string $event_name, $added_function, int $priority = 10, array $args = null)
{
// Hooks a function on to a specific event.
static::$events[] = array(
'event_name' => $event_name,
'function' => $added_function,
'priority' => $priority,
'args' => $args
);
}
/**
* Run functions hooked on a specific event.
*
* @access public
* @param string $event_name Event name
* @param array $args Arguments
* @param boolean $return Return data or not. Default is false
* @return mixed
*/
public static function dispatch(string $event_name, array $args = [], bool $return = false)
{
// Redefine arguments
$event_name = $event_name;
$return = $return;
// Run event
if (count(static::$events) > 0) {
// Sort actions by priority
$events = Arr::subvalSort(static::$events, 'priority');
// Loop through $events array
foreach ($events as $action) {
// Execute specific action
if ($action['event_name'] == $event_name) {
// isset arguments ?
if (isset($args)) {
// Return or Render specific action results ?
if ($return) {
return call_user_func_array($action['function'], $args);
} else {
call_user_func_array($action['function'], $args);
}
} else {
if ($return) {
return call_user_func_array($action['function'], $action['args']);
} else {
call_user_func_array($action['function'], $action['args']);
}
}
}
}
}
}
}

125
flextype/Filters.php Executable file
View File

@@ -0,0 +1,125 @@
<?php namespace Flextype;
/**
* @package Flextype
*
* @author Sergey Romanenko <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.
*/
class Filters
{
/**
* @var Flextype
*/
protected $flextype;
/**
* Filters
*
* @var array
* @access protected
*/
protected static $filters = [];
/**
* Protected constructor since this is a static class.
*
* @access protected
*/
protected function __construct()
{
// Nothing here
}
/**
* Dispatch filters
*
* <code>
* Filter::dispatch('content', $content);
* </code>
*
* @access public
* @param string $filter_name The name of the filter hook.
* @param mixed $value The value on which the filters hooked.
* @return mixed
*/
public static function dispatch(string $filter_name, $value)
{
$args = array_slice(func_get_args(), 2);
if (! isset(static::$filters[$filter_name])) {
return $value;
}
foreach (static::$filters[$filter_name] as $priority => $functions) {
if (! is_null($functions)) {
foreach ($functions as $function) {
$all_args = array_merge(array($value), $args);
$function_name = $function['function'];
$accepted_args = $function['accepted_args'];
if ($accepted_args == 1) {
$the_args = array($value);
} elseif ($accepted_args > 1) {
$the_args = array_slice($all_args, 0, $accepted_args);
} elseif ($accepted_args == 0) {
$the_args = null;
} else {
$the_args = $all_args;
}
$value = call_user_func_array($function_name, $the_args);
}
}
}
return $value;
}
/**
* Add filter
*
* <code>
* Filter::add('content', 'replacer');
*
* function replacer($content) {
* return preg_replace(array('/\[b\](.*?)\[\/b\]/ms'), array('<strong>\1</strong>'), $content);
* }
* </code>
*
* @access public
* @param string $filter_name The name of the filter to hook the $function_to_add to.
* @param string $function_to_add The name of the function to be called when the filter is applied.
* @param integer $priority Function to add priority - default is 10.
* @param integer $accepted_args The number of arguments the function accept default is 1.
* @return boolean
*/
public static function addListener($filter_name, $function_to_add, $priority = 10, $accepted_args = 1)
{
// Redefine arguments
$filter_name = (string) $filter_name;
$function_to_add = $function_to_add;
$priority = (int) $priority;
$accepted_args = (int) $accepted_args;
// Check that we don't already have the same filter at the same priority. Thanks to WP :)
if (isset(static::$filters[$filter_name]["$priority"])) {
foreach (static::$filters[$filter_name]["$priority"] as $filter) {
if ($filter['function'] == $function_to_add) {
return true;
}
}
}
static::$filters[$filter_name]["$priority"][] = array('function' => $function_to_add, 'accepted_args' => $accepted_args);
// Sort
ksort(static::$filters[$filter_name]["$priority"]);
return true;
}
}

136
flextype/Flextype.php Executable file
View File

@@ -0,0 +1,136 @@
<?php namespace Flextype;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
use Url;
use Session;
/**
* @package Flextype
*
* @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.
*/
class Flextype
{
/**
* An instance of the Flextype class
*
* @var object
* @access protected
*/
protected static $instance = null;
/**
* Filesystem
*
* @var object
* @access public
*/
public static $filesystem = null;
/**
* Finder
*
* @var object
* @access public
*/
public static $finder = null;
/**
* Protected clone method to enforce singleton behavior.
*
* @access protected
*/
protected function __clone()
{
// Nothing here.
}
/**
* The version of Flextype
*
* @var string
*/
const VERSION = '0.1.0';
/**
* Constructor.
*
* @access protected
*/
protected function __construct()
{
static::$finder = new Finder();
static::$filesystem = new Filesystem();
// Init Config
Config::init();
// Turn on output buffering
ob_start();
// Display Errors
if (Config::get('site.errors.display')) {
define('DEVELOPMENT', true);
error_reporting(-1);
} else {
define('DEVELOPMENT', false);
error_reporting(0);
}
// Set internal encoding
function_exists('mb_language') and mb_language('uni');
function_exists('mb_regex_encoding') and mb_regex_encoding(Config::get('site.charset'));
function_exists('mb_internal_encoding') and mb_internal_encoding(Config::get('site.charset'));
// Set Error handler
set_error_handler('ErrorHandler::error');
register_shutdown_function('ErrorHandler::fatal');
set_exception_handler('ErrorHandler::exception');
// Set default timezone
date_default_timezone_set(Config::get('site.timezone'));
// Start the session
Session::start();
// Init Cache
Cache::init();
// Init I18n
I18n::init();
// Init Themes
Themes::init();
// Init Plugins
Plugins::init();
// Render current page
Pages::init();
// Flush (send) the output buffer and turn off output buffering
ob_end_flush();
}
/**
* Initialize Flextype Application
*
* <code>
* Rawium::init();
* </code>
*
* @access public
* @return object
*/
public static function init()
{
return !isset(self::$instance) and self::$instance = new Flextype();
}
}

145
flextype/I18n.php Normal file
View File

@@ -0,0 +1,145 @@
<?php namespace Flextype;
use Symfony\Component\Yaml\Yaml;
/**
* @package Flextype
*
* @author Sergey Romanenko <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.
*/
class I18n
{
/**
* An instance of the Cache class
*
* @var object
*/
protected static $instance = null;
/**
* Locales array
*
* @var array
*/
public static $locales = [
'ar' => 'العربية',
'bg' => 'Български',
'ca' => 'Català',
'cs' => 'Česky',
'da' => 'Dansk',
'de' => 'Deutsch',
'el' => 'Ελληνικά',
'en' => 'English',
'es' => 'Español',
'fa' => 'Farsi',
'fi' => 'Suomi',
'fr' => 'Français',
'gl' => 'Galego',
'ka-ge' => 'Georgian',
'hu' => 'Magyar',
'it' => 'Italiano',
'id' => 'Bahasa Indonesia',
'ja' => '日本語',
'lt' => 'Lietuvių',
'nl' => 'Nederlands',
'no' => 'Norsk',
'pl' => 'Polski',
'pt' => 'Português',
'pt-br' => 'Português do Brasil',
'ru' => 'Русский',
'sk' => 'Slovenčina',
'sl' => 'Slovenščina',
'sv' => 'Svenska',
'sr' => 'Srpski',
'tr' => 'Türkçe',
'uk' => 'Українська',
'zh-cn' => '简体中文',
];
/**
* Dictionary
*
* @var array
*/
public static $dictionary = [];
/**
* Protected clone method to enforce singleton behavior.
*
* @access protected
*/
protected function __clone()
{
// Nothing here.
}
/**
* Construct
*/
protected function __construct()
{
// Get Plugins and Site Locales list
(array) $plugins_list = Config::get('site.plugins');
(array) $locales = Config::get('site.locales');
(array) $dictionary = [];
// Create dictionary
if (is_array($plugins_list) && count($plugins_list) > 0) {
foreach ($locales as $locale) {
foreach ($plugins_list as $plugin) {
$language_file = PLUGINS_PATH . '/' . $plugin . '/languages/' . $locale . '.yml';
if (file_exists($language_file)) {
$dictionary[$plugin][$locale] = Yaml::parse(file_get_contents($language_file));
}
}
}
}
// Save dictionary
static::$dictionary = $dictionary;
}
/**
* Returns translation of a string. If no translation exists, the original
* string will be returned. No parameters are replaced.
*
* @param string $string Text to translate
* @param string $namespace Namespace
* @param string $locale Locale
* @return string
*/
public static function find(string $string, string $namespace, string $locale, array $values = []) : string
{
// Search current string to translate in the Dictionary
if (isset(static::$dictionary[$namespace][$locale][$string])) {
$string = static::$dictionary[$namespace][$locale][$string];
$string = empty($values) ? $string : strtr($string, $values);
} else {
$string = $string;
}
// Return translation of a string
return $string;
}
/**
* Initialize Flextype I18n
*
* <code>
* I18n::init();
* </code>
*
* @access public
* @return object
*/
public static function init()
{
return !isset(self::$instance) and self::$instance = new I18n();
}
}

42
flextype/Markdown.php Normal file
View File

@@ -0,0 +1,42 @@
<?php namespace Flextype;
use ParsedownExtra;
/**
* @package Flextype
*
* @author Sergey Romanenko <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.
*/
class Markdown
{
/**
* Parsedown Extra Object
*
* @var object
* @access protected
*/
protected static $markdown;
/**
* Markdown parser
*
* <code>
* $content = Markdown::parse($content);
* </code>
*
* @access public
* @param string $content Content to parse
* @return string Formatted content
*/
public static function parse(string $content) : string
{
!static::$markdown and static::$markdown = new ParsedownExtra();
return static::$markdown->text($content);
}
}

210
flextype/Pages.php Executable file
View File

@@ -0,0 +1,210 @@
<?php namespace Flextype;
use Arr;
use Url;
use Response;
use Shortcode;
use Symfony\Component\Yaml\Yaml;
/**
* @package Flextype
*
* @author Sergey Romanenko <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.
*/
class Pages
{
/**
* An instance of the Cache class
*
* @var object
*/
protected static $instance = null;
/**
* Page
*
* @var Page
*/
public static $page;
/**
* Constructor
*
* @param Flextype $flextype
*/
protected function __construct()
{
// The page is not processed and not sent to the display.
Events::dispatch('onPageBeforeRender');
// Get current page
static::$page = static::getPage(Url::getUriString());
// Display page for current requested url
static::renderPage(static::$page);
// The page has been fully processed and sent to the display.
Events::dispatch('onPageAfterRender');
}
/**
* Page finder
*/
public static function finder($url = '', $url_abs = false)
{
// If url is empty that its a homepage
if ($url_abs) {
if ($url) {
$file = $url;
} else {
$file = PAGES_PATH . '/' . Config::get('site.pages.main') . '/' . 'index.md';
}
} else {
if ($url) {
$file = PAGES_PATH . '/' . $url . '/index.md';
} else {
$file = PAGES_PATH . '/' . Config::get('site.pages.main') . '/' . 'index.md';
}
}
// Get 404 page if file not exists
if (Flextype::$filesystem->exists($file)) {
$file = $file;
} else {
$file = PAGES_PATH . '/404/index.md';
Response::status(404);
}
return $file;
}
/**
* Render page
*/
public static function renderPage($page)
{
$template_ext = '.php';
$template_name = empty($page['template']) ? 'index' : $page['template'];
$site_theme = Config::get('site.theme');
$template_path = THEMES_PATH . '/' . $site_theme . '/' . $template_name . $template_ext;
if (Flextype::$filesystem->exists($template_path)) {
include $template_path;
} else {
throw new RuntimeException("Template {$template_name} does not exist.");
}
}
/**
* Page page file
*/
public static function parseFile($file)
{
$page = trim(file_get_contents($file));
$page = explode('---', $page, 3);
$frontmatter = Shortcodes::parse($page[1]);
$result_page = Yaml::parse($frontmatter);
// Get page url
$url = str_replace(PAGES_PATH, Url::getBase(), $file);
$url = str_replace('index.md', '', $url);
$url = str_replace('.md', '', $url);
$url = str_replace('\\', '/', $url);
$url = rtrim($url, '/');
$result_page['url'] = $url;
// Get page slug
$url = str_replace(Url::getBase(), '', $url);
$url = ltrim($url, '/');
$url = rtrim($url, '/');
$result_page['slug'] = str_replace(Url::getBase(), '', $url);
$result_page['content'] = $page[2];
return $result_page;
}
/**
* Get page
*/
public static function getPage(string $url = '', bool $raw = false, bool $url_abs = false)
{
$file = static::finder($url, $url_abs);
if ($raw) {
$page = trim(file_get_contents($file));
static::$page = $page;
Events::dispatch('onPageContentRawAfter');
} else {
$page = static::parseFile($file);
static::$page = $page;
static::$page['content'] = Filters::dispatch('content', static::parseContent(static::$page['content']));
Events::dispatch('onPageContentAfter');
}
return static::$page;
}
/**
* Parse Cntent
*/
public static function parseContent(string $content) : string
{
$content = Shortcodes::parse($content);
$content = Markdown::parse($content);
return $content;
}
/**
* Get Pages
*/
public static function getPages($url = '', $raw = false, $order_by = 'title', $order_type = 'DESC', $limit = null)
{
// Get pages list for current $url
$pages_list = Flextype::$finder->files()->name('*.md')->in(PAGES_PATH . '/' . $url);
// Go trough pages list
foreach ($pages_list as $key => $page) {
if (strpos($page->getPathname(), $url.'/index.md') !== false) {
} else {
$pages[$key] = static::getPage($page->getPathname(), $raw, true);
}
}
// Sort and Slice pages if !$raw
if (!$raw) {
$pages = Arr::subvalSort($pages, $order_by, $order_type);
if ($limit != null) {
$pages = array_slice($_pages, null, $limit);
}
}
return $pages;
}
/**
* Initialize Flextype Pages
*
* <code>
* Pages::init();
* </code>
*
* @access public
* @return object
*/
public static function init()
{
return !isset(self::$instance) and self::$instance = new Pages();
}
}

104
flextype/Plugins.php Executable file
View File

@@ -0,0 +1,104 @@
<?php namespace Flextype;
use Symfony\Component\Yaml\Yaml;
/**
* @package Flextype
*
* @author Sergey Romanenko <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.
*/
class Plugins
{
/**
* An instance of the Cache class
*
* @var object
*/
protected static $instance = null;
/**
* Init Plugins
*
* @access public
* @return mixed
*/
protected function __construct()
{
// Plugin manifest
$plugin_manifest = [];
// Plugin cache id
$plugins_cache_id = '';
// Get Plugins List
$plugins_list = Config::get('site.plugins');
// If Plugins List isnt empty then create plugin cache ID
if (is_array($plugins_list) && count($plugins_list) > 0) {
// Go through...
foreach ($plugins_list as $plugin) {
if (Flextype::$filesystem->exists($_plugin = PLUGINS_PATH . '/' . $plugin . '/' . $plugin . '.yml')) {
$plugins_cache_id .= filemtime($_plugin);
}
}
// Create Unique Cache ID for Plugins
$plugins_cache_id = md5('plugins' . PLUGINS_PATH . $plugins_cache_id);
}
// Get plugins list from cache or scan plugins folder and create new plugins cache item
if (Cache::driver()->contains($plugins_cache_id)) {
Config::set('plugins', Cache::driver()->fetch($plugins_cache_id));
} else {
// If Plugins List isnt empty
if (is_array($plugins_list) && count($plugins_list) > 0) {
// Go through...
foreach ($plugins_list as $plugin) {
if (Flextype::$filesystem->exists($_plugin_manifest = PLUGINS_PATH . '/' . $plugin . '/' . $plugin . '.yml')) {
$plugin_manifest = Yaml::parseFile($_plugin_manifest);
}
$_plugins_config[basename($_plugin_manifest, '.yml')] = $plugin_manifest;
}
Config::set('plugins', $_plugins_config);
Cache::driver()->save($plugins_cache_id, $_plugins_config);
}
}
// Include enabled plugins
if (is_array(Config::get('plugins')) && count(Config::get('plugins')) > 0) {
foreach (Config::get('plugins') as $plugin_name => $plugin) {
if (Config::get('plugins.'.$plugin_name.'.enabled')) {
include_once PLUGINS_PATH .'/'. $plugin_name .'/'. $plugin_name . '.php';
}
}
}
Events::dispatch('onPluginsInitialized');
}
/**
* Initialize Flextype Plugins
*
* <code>
* Plugins::init();
* </code>
*
* @access public
* @return object
*/
public static function init()
{
return !isset(self::$instance) and self::$instance = new Plugins();
}
}

131
flextype/Shortcodes.php Normal file
View File

@@ -0,0 +1,131 @@
<?php namespace Flextype;
/**
* @package Flextype
*
* @author Sergey Romanenko <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.
*/
class Shortcodes
{
/**
* Shortcode tags array
*
* @var shortcode_tags
*/
protected static $shortcode_tags = [];
/**
* Protected constructor since this is a static class.
*
* @access protected
*/
protected function __construct()
{
// Nothing here
}
/**
* Add new shortcode
*
* @param string $shortcode Shortcode tag to be searched in content.
* @param string $callback_function The callback function to replace the shortcode with.
*/
public static function add(string $shortcode, $callback_function)
{
// Add new shortcode
if (is_callable($callback_function)) {
static::$shortcode_tags[$shortcode] = $callback_function;
}
}
/**
* Remove a specific registered shortcode.
*
* @param string $shortcode Shortcode tag.
*/
public static function delete(string $shortcode)
{
// Delete shortcode
if (static::exists($shortcode)) {
unset(static::$shortcode_tags[$shortcode]);
}
}
/**
* Remove all registered shortcodes.
*
* <code>
* Shortcode::clear();
* </code>
*
*/
public static function clear()
{
static::$shortcode_tags = array();
}
/**
* Check if a shortcode has been registered.
*
* @param string $shortcode Shortcode tag.
*/
public static function exists(string $shortcode)
{
// Check shortcode
return array_key_exists($shortcode, static::$shortcode_tags);
}
/**
* Parse a string, and replace any registered shortcodes within it with the result of the mapped callback.
*
* @param string $content Content
* @return string
*/
public static function parse(string $content)
{
if (! static::$shortcode_tags) {
return $content;
}
$shortcodes = implode('|', array_map('preg_quote', array_keys(static::$shortcode_tags)));
$pattern = "/(.?)\{([$shortcodes]+)(.*?)(\/)?\}(?(4)|(?:(.+?)\{\/\s*\\2\s*\}))?(.?)/s";
return preg_replace_callback($pattern, 'static::_handle', $content);
}
/**
* _handle()
*/
protected static function _handle($matches)
{
$prefix = $matches[1];
$suffix = $matches[6];
$shortcode = $matches[2];
// Allow for escaping shortcodes by enclosing them in {{shortcode}}
if ($prefix == '{' && $suffix == '}') {
return substr($matches[0], 1, -1);
}
$attributes = array(); // Parse attributes into into this array.
if (preg_match_all('/(\w+) *= *(?:([\'"])(.*?)\\2|([^ "\'>]+))/', $matches[3], $match, PREG_SET_ORDER)) {
foreach ($match as $attribute) {
if (! empty($attribute[4])) {
$attributes[strtolower($attribute[1])] = $attribute[4];
} elseif (! empty($attribute[3])) {
$attributes[strtolower($attribute[1])] = $attribute[3];
}
}
}
// Check if this shortcode realy exists then call user function else return empty string
return (isset(static::$shortcode_tags[$shortcode])) ? $prefix . call_user_func(static::$shortcode_tags[$shortcode], $attributes, $matches[5], $shortcode) . $suffix : '';
}
}

47
flextype/Templates.php Normal file
View File

@@ -0,0 +1,47 @@
<?php namespace Flextype;
/**
* @package Flextype
*
* @author Sergey Romanenko <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.
*/
class Templates
{
/**
* Protected constructor since this is a static class.
*
* @access protected
*/
protected function __construct()
{
// Nothing here
}
/**
* Get Themes template
*
* @access public
* @param string $template_name Template name
* @return mixed
*/
public static function display(string $template_name)
{
$template_ext = '.php';
$page = Pages::$page;
$template_path = THEMES_PATH . '/' . Config::get('site.theme') . '/' . $template_name . $template_ext;
if (Flextype::$filesystem->exists($template_path)) {
include $template_path;
} else {
throw new RuntimeException("Template {$template_name} does not exist.");
}
}
}

58
flextype/Themes.php Normal file
View File

@@ -0,0 +1,58 @@
<?php namespace Flextype;
use Symfony\Component\Yaml\Yaml;
/**
* @package Flextype
*
* @author Sergey Romanenko <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.
*/
class Themes
{
/**
* An instance of the Themes class
*
* @var object
*/
protected static $instance = null;
/**
* Init Themes
*
* @access public
* @return mixed
*/
protected function __construct()
{
// Theme Manifest
$theme_manifest = [];
// Get current theme
$theme = Config::get('site.theme');
if (Flextype::$filesystem->exists($theme_manifest_file = THEMES_PATH . '/' . $theme . '/' . $theme . '.yml')) {
$theme_manifest = Yaml::parseFile($theme_manifest_file);
Config::set('themes.'.Config::get('site.theme'), $theme_manifest);
}
}
/**
* Initialize Flextype Themes
*
* <code>
* Themes::init();
* </code>
*
* @access public
* @return object
*/
public static function init()
{
return !isset(self::$instance) and self::$instance = new Themes();
}
}

35
flextype/boot/defines.php Executable file
View File

@@ -0,0 +1,35 @@
<?php namespace Flextype;
/**
* @package Flextype
*
* @author Sergey Romanenko <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.
*/
// Define the path to the root directory (without trailing slash).
define('ROOT_DIR', str_replace(DIRECTORY_SEPARATOR, '/', getcwd()));
// Define the path to the site directory (without trailing slash).
define('SITE_PATH', ROOT_DIR . '/site');
// Define the path to the pages directory (without trailing slash).
define('PAGES_PATH', SITE_PATH . '/pages');
// Define the path to the themes directory (without trailing slash).
define('THEMES_PATH', SITE_PATH . '/themes');
// Define the path to the plugins directory (without trailing slash).
define('PLUGINS_PATH', SITE_PATH . '/plugins');
// Define the path to the config directory (without trailing slash).
define('CONFIG_PATH', SITE_PATH . '/config');
// Define the path to the cache directory (without trailing slash).
define('CACHE_PATH', SITE_PATH . '/cache');
// Define the path to the logs directory (without trailing slash).
define('LOGS_PATH', SITE_PATH . '/logs');

16
flextype/boot/events.php Normal file
View File

@@ -0,0 +1,16 @@
<?php namespace Flextype;
/**
* @package Flextype
*
* @author Sergey Romanenko <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.
*/
// Set Flextype Meta Generator
Events::addListener('onThemeMeta', function () {
echo('<meta name="generator" content="Powered by Flextype" />');
});

View File

@@ -0,0 +1,18 @@
<?php namespace Flextype;
use Url;
/**
* @package Flextype
*
* @author Sergey Romanenko <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.
*/
// Add {site_url} shortcode
Shortcodes::add('site_url', function () {
return Url::getBase();
});

26
index.php Executable file
View File

@@ -0,0 +1,26 @@
<?php namespace Flextype;
/**
* @package Flextype
*
* @author Sergey Romanenko <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.
*/
// Define the application minimum supported PHP version.
define('FLEXTYPE_MINIMUM_PHP', '7.1.3');
// Check PHP Version
version_compare($ver = PHP_VERSION, $req = FLEXTYPE_MINIMUM_PHP, '<') and exit(sprintf('You are running PHP %s, but Flextype needs at least <strong>PHP %s</strong> to run.', $ver, $req));
// Ensure vendor libraries exist and Register The Auto Loader
!is_file($autoload = __DIR__ . '/vendor/autoload.php') and exit("Please run: <i>composer install</i>");
// Register the auto-loader.
$loader = require_once $autoload;
// Initialize Flextype Application
Flextype::init();

4
robots.txt Executable file
View File

@@ -0,0 +1,4 @@
User-agent: *
Disallow: /flextype/
Disallow: /site/
Disallow: /vendor/

0
site/cache/.gitkeep vendored Executable file
View File

View File

@@ -0,0 +1,2 @@
0
a:1:{s:9:"highlight";a:9:{s:4:"name";s:9:"Highlight";s:7:"version";s:5:"1.0.0";s:11:"description";s:95:"Highlight plugin for Flextype adds a powerful code highlighting functionality with Highlight.js";s:6:"author";a:3:{s:4:"name";s:16:"Sergey Romanenko";s:5:"email";s:17:"awilum@yandex.com";s:3:"url";s:19:"http://flextype.org";}s:8:"homepage";s:45:"https://github.com/flextype-plugins/highlight";s:4:"bugs";s:52:"https://github.com/flextype-plugins/highlight/issues";s:7:"license";s:3:"MIT";s:7:"enabled";b:1;s:5:"theme";s:7:"monokai";}}

View File

@@ -0,0 +1,2 @@
0
a:1:{s:9:"highlight";a:9:{s:4:"name";s:9:"Highlight";s:7:"version";s:5:"1.0.0";s:11:"description";s:94:"Highlight plugin for Flextype adds a powerful code highlighting functionality with Highlight.js";s:6:"author";a:3:{s:4:"name";s:16:"Sergey Romanenko";s:5:"email";s:17:"awilum@yandex.com";s:3:"url";s:18:"http://flextype.org";}s:8:"homepage";s:44:"https://github.com/flextype-plugins/highlight";s:4:"bugs";s:51:"https://github.com/flextype-plugins/highlight/issues";s:7:"license";s:3:"MIT";s:7:"enabled";b:1;s:5:"theme";s:7:"monokai";}}

View File

@@ -0,0 +1,2 @@
0
a:1:{s:9:"highlight";a:9:{s:4:"name";s:9:"Highlight";s:7:"version";s:5:"1.0.0";s:11:"description";s:94:"Highlight plugin for Flextype adds a powerful code highlighting functionality with Highlight.js";s:6:"author";a:3:{s:4:"name";s:16:"Sergey Romanenko";s:5:"email";s:17:"awilum@yandex.com";s:3:"url";s:18:"http://flextype.org";}s:8:"homepage";s:44:"https://github.com/flextype-plugins/highlight";s:4:"bugs";s:51:"https://github.com/flextype-plugins/highlight/issues";s:7:"license";s:3:"MIT";s:7:"enabled";b:1;s:5:"theme";s:7:"monokai";}}

31
site/config/site.yml Executable file
View File

@@ -0,0 +1,31 @@
#
# Site configuration
#
title: "Flextype"
description: "Modern Open Source Flat-File Content Management System"
author:
email: ""
timezone: UTC
charset: UTF-8
theme: default
plugins:
locale: "en"
locales: [en]
pages:
flush_cache: false
main: home
errors:
display: true
cache:
enabled: false
prefix: Flextype
driver: auto
lifetime: 604800

0
site/data/.gitkeep Executable file
View File

0
site/logs/.gitkeep Executable file
View File

5
site/logs/2018_03_14.log Normal file
View File

@@ -0,0 +1,5 @@
[14-Mar-2018 17:16:37] Error: Class 'Theme' not found in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 1
[14-Mar-2018 18:23:31] Error: Class 'Flextype\RuntimeException' not found in /Applications/MAMP/htdocs/flextype/Flextype/Pages.php at line 98
[14-Mar-2018 18:36:27] Error: Call to a member function get() on null in /Applications/MAMP/htdocs/flextype/site/themes/default/partials/navigation.php at line 3
[14-Mar-2018 18:36:27] Error: Call to a member function get() on null in /Applications/MAMP/htdocs/flextype/site/themes/default/partials/navigation.php at line 3
[14-Mar-2018 18:36:27] Error: Call to a member function get() on null in /Applications/MAMP/htdocs/flextype/site/themes/default/partials/navigation.php at line 3

84
site/logs/2018_03_16.log Normal file
View File

@@ -0,0 +1,84 @@
[16-Mar-2018 09:50:07] ParseError: syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ',' or ';' in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 3
[16-Mar-2018 09:50:29] Error: Call to a member function process() on null in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 3
[16-Mar-2018 09:51:35] Error: Call to a member function process() on null in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 3
[16-Mar-2018 09:51:49] Pimple\Exception\UnknownIdentifierException: Identifier "ProtectEmail" is not defined. in /Applications/MAMP/htdocs/flextype/vendor/pimple/pimple/src/Pimple/Container.php at line 101
[16-Mar-2018 11:16:30] Error: Class 'Flextype\Session' not found in /Applications/MAMP/htdocs/flextype/Flextype/Flextype.php at line 219
[16-Mar-2018 11:19:40] Error: Call to undefined method Flextype\Cache::init() in /Applications/MAMP/htdocs/flextype/Flextype/Flextype.php at line 223
[16-Mar-2018 11:20:16] Error: Call to undefined method Flextype\Cache::init() in /Applications/MAMP/htdocs/flextype/Flextype/Flextype.php at line 223
[16-Mar-2018 11:20:28] Error: Call to undefined method Flextype\Cache::init() in /Applications/MAMP/htdocs/flextype/Flextype/Flextype.php at line 223
[16-Mar-2018 11:23:55] Error: Class 'Flextype\Fansoro' not found in /Applications/MAMP/htdocs/flextype/Flextype/Cache.php at line 64
[16-Mar-2018 11:25:14] Error: Class 'Flextype\Fansoro' not found in /Applications/MAMP/htdocs/flextype/Flextype/Cache.php at line 64
[16-Mar-2018 11:25:42] Error: Class 'Flextype\Dir' not found in /Applications/MAMP/htdocs/flextype/Flextype/Cache.php at line 116
[16-Mar-2018 11:27:54] ErrorException: Unknown Error: Non-static method Flextype\I18n::init() should not be called statically in /Applications/MAMP/htdocs/flextype/Flextype/Flextype.php at line 226
[16-Mar-2018 11:35:20] ErrorException: Unknown Error: Non-static method Flextype\Plugins::init() should not be called statically in /Applications/MAMP/htdocs/flextype/Flextype/Flextype.php at line 229
[16-Mar-2018 11:54:49] ErrorException: Notice: Undefined property: Flextype\Plugins::$flextype in /Applications/MAMP/htdocs/flextype/Flextype/Plugins.php at line 51
[16-Mar-2018 11:55:29] ErrorException: Unknown Error: Non-static method Flextype\Pages::getPage() should not be called statically in /Applications/MAMP/htdocs/flextype/Flextype/Flextype.php at line 232
[16-Mar-2018 12:16:11] ErrorException: Unknown Error: Non-static method Flextype\Events::dispatch() should not be called statically in /Applications/MAMP/htdocs/flextype/Flextype/Pages.php at line 41
[16-Mar-2018 12:18:43] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/Flextype/Events.php at line 72
[16-Mar-2018 12:18:55] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/Flextype/Pages.php at line 131
[16-Mar-2018 12:19:51] ErrorException: Notice: Undefined variable: finder in /Applications/MAMP/htdocs/flextype/Flextype/Pages.php at line 131
[16-Mar-2018 12:20:29] Error: Call to undefined method Symfony\Component\Finder\Finder::finder() in /Applications/MAMP/htdocs/flextype/Flextype/Pages.php at line 131
[16-Mar-2018 12:20:41] Error: Call to undefined method Symfony\Component\Finder\Finder::find() in /Applications/MAMP/htdocs/flextype/Flextype/Pages.php at line 131
[16-Mar-2018 12:21:23] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/Flextype/Pages.php at line 77
[16-Mar-2018 12:23:40] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/Flextype/Pages.php at line 82
[16-Mar-2018 12:23:53] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/Flextype/Pages.php at line 138
[16-Mar-2018 12:24:34] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/Flextype/Pages.php at line 138
[16-Mar-2018 12:25:20] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/Flextype/Pages.php at line 138
[16-Mar-2018 12:26:02] ErrorException: Notice: Undefined variable: frontmatter in /Applications/MAMP/htdocs/flextype/Flextype/Pages.php at line 119
[16-Mar-2018 12:36:35] ErrorException: Notice: Undefined variable: frontmatter in /Applications/MAMP/htdocs/flextype/flextype/Pages.php at line 119
[16-Mar-2018 12:36:57] ErrorException: Unknown Error: Non-static method Flextype\Shortcodes::parse() should not be called statically in /Applications/MAMP/htdocs/flextype/flextype/Pages.php at line 118
[16-Mar-2018 12:36:58] ErrorException: Unknown Error: Non-static method Flextype\Shortcodes::parse() should not be called statically in /Applications/MAMP/htdocs/flextype/flextype/Pages.php at line 118
[16-Mar-2018 12:47:09] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/flextype/Pages.php at line 139
[16-Mar-2018 12:50:59] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/flextype/Pages.php at line 139
[16-Mar-2018 12:52:10] ErrorException: Unknown Error: Non-static method Flextype\Filters::dispatch() should not be called statically in /Applications/MAMP/htdocs/flextype/flextype/Pages.php at line 140
[16-Mar-2018 12:52:30] Error: Class 'Flextype\Shorcodes' not found in /Applications/MAMP/htdocs/flextype/flextype/Pages.php at line 149
[16-Mar-2018 12:52:49] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/flextype/Pages.php at line 144
[16-Mar-2018 12:53:01] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/flextype/Pages.php at line 100
[16-Mar-2018 12:53:26] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 1
[16-Mar-2018 13:21:09] Error: Class 'Templates' not found in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 1
[16-Mar-2018 13:24:27] Error: Class 'Templates' not found in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 1
[16-Mar-2018 13:24:29] Error: Class 'Templates' not found in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 1
[16-Mar-2018 13:24:32] Error: Class 'Templates' not found in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 1
[16-Mar-2018 13:24:56] Error: Class 'Templates' not found in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 1
[16-Mar-2018 13:25:34] Error: Class 'Templates' not found in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 1
[16-Mar-2018 13:25:44] Error: Class 'Templates' not found in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 1
[16-Mar-2018 13:26:05] Error: Class 'Templates' not found in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 1
[16-Mar-2018 13:27:09] Error: Class 'Shortcodes' not found in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 1
[16-Mar-2018 13:28:07] Error: Class 'Pages' not found in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 1
[16-Mar-2018 13:28:47] Error: Class 'Flextype' not found in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 2
[16-Mar-2018 13:28:53] Error: Class 'Flextype' not found in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 2
[16-Mar-2018 13:28:58] ParseError: syntax error, unexpected '/', expecting end of file in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 2
[16-Mar-2018 13:31:21] Error: Class 'Flextype\Shortcode' not found in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 3
[16-Mar-2018 13:31:54] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/site/themes/default/partials/head.php at line 9
[16-Mar-2018 13:32:45] Error: Class 'Templates' not found in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 2
[16-Mar-2018 13:32:50] ErrorException: Notice: Use of undefined constant Flextype - assumed 'Flextype' in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 2
[16-Mar-2018 13:32:58] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/site/themes/default/partials/head.php at line 9
[16-Mar-2018 13:34:24] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/site/themes/default/partials/head.php at line 13
[16-Mar-2018 13:35:06] ErrorException: Notice: Undefined variable: page in /Applications/MAMP/htdocs/flextype/site/themes/default/partials/head.php at line 13
[16-Mar-2018 13:35:40] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/site/themes/default/partials/head.php at line 18
[16-Mar-2018 13:36:32] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/site/themes/default/partials/head.php at line 25
[16-Mar-2018 13:36:53] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/site/themes/default/partials/navigation.php at line 3
[16-Mar-2018 13:38:02] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/site/themes/default/partials/footer.php at line 2
[16-Mar-2018 13:38:28] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/site/themes/default/partials/tail.php at line 1
[16-Mar-2018 13:46:16] ErrorException: Warning: include_once(/Applications/MAMP/htdocs/flextype/site/plugins/protect-email/protect-email.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/flextype/flextype/Plugins.php at line 54
[16-Mar-2018 13:49:48] ErrorException: Notice: Undefined variable: plugin_name in /Applications/MAMP/htdocs/flextype/flextype/Plugins.php at line 43
[16-Mar-2018 13:49:57] ErrorException: Warning: include_once(/Applications/MAMP/htdocs/flextype/site/plugins/protect-email/protect-email.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/flextype/flextype/Plugins.php at line 53
[16-Mar-2018 13:55:52] Error: Class 'ProtectEmail' not found in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 3
[16-Mar-2018 14:05:23] Error: Class 'Flextype\ProtectEmail' not found in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 3
[16-Mar-2018 14:05:53] Error: Call to undefined function redirect() in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 3
[16-Mar-2018 14:07:52] Error: Class 'Flextype\Arr' not found in /Applications/MAMP/htdocs/flextype/site/plugins/redirect/Redirect.php at line 15
[16-Mar-2018 14:07:59] ErrorException: Notice: Undefined variable: page in /Applications/MAMP/htdocs/flextype/site/plugins/redirect/Redirect.php at line 17
[16-Mar-2018 14:08:11] Error: Class 'Flextype\Request' not found in /Applications/MAMP/htdocs/flextype/site/plugins/redirect/Redirect.php at line 18
[16-Mar-2018 14:08:19] Error: Class 'Flextype\Request' not found in /Applications/MAMP/htdocs/flextype/site/plugins/redirect/Redirect.php at line 18
[16-Mar-2018 14:08:30] Error: Call to undefined function Flextype\redirect() in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 3
[16-Mar-2018 14:09:53] ErrorException: Notice: Undefined property: Flextype\Plugins::$flextype in /Applications/MAMP/htdocs/flextype/site/plugins/redirect/Redirect.php at line 24
[16-Mar-2018 14:32:51] ErrorException: Notice: Undefined variable: flextype in /Applications/MAMP/htdocs/flextype/site/plugins/summary/summary.php at line 37
[16-Mar-2018 14:34:56] ParseError: syntax error, unexpected end of file in /Applications/MAMP/htdocs/flextype/site/plugins/summary/summary.php at line 27
[16-Mar-2018 14:35:00] ErrorException: Notice: Undefined property: Flextype\Plugins::$flextype in /Applications/MAMP/htdocs/flextype/site/plugins/summary/summary.php at line 19
[16-Mar-2018 14:36:09] ErrorException: Notice: Undefined property: Flextype\Plugins::$flextype in /Applications/MAMP/htdocs/flextype/site/plugins/summary/summary.php at line 22
[16-Mar-2018 14:36:35] ErrorException: Notice: Undefined index: summary in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 2
[16-Mar-2018 14:36:47] ErrorException: Notice: Undefined index: summary in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 2
[16-Mar-2018 14:36:48] ErrorException: Notice: Undefined index: summary in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 2
[16-Mar-2018 15:01:08] ErrorException: Notice: Undefined index: summary in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 2
[16-Mar-2018 15:06:21] Error: Call to undefined function readingTime() in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 3
[16-Mar-2018 15:07:41] ErrorException: Notice: Use of undefined constant content - assumed 'content' in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 3

20
site/logs/2018_03_17.log Normal file
View File

@@ -0,0 +1,20 @@
[17-Mar-2018 08:31:35] Error: Call to undefined method Flextype\Events::addListner() in /Applications/MAMP/htdocs/flextype/site/plugins/highlight/highlight.php at line 17
[17-Mar-2018 08:31:49] Error: Call to undefined method Flextype\Events::addListner() in /Applications/MAMP/htdocs/flextype/site/plugins/highlight/highlight.php at line 17
[17-Mar-2018 08:32:07] Error: Call to undefined method Flextype\Events::addListner() in /Applications/MAMP/htdocs/flextype/site/plugins/highlight/highlight.php at line 17
[17-Mar-2018 08:32:21] Error: Call to undefined function Flextype\readingTime() in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 2
[17-Mar-2018 08:35:48] ErrorException: Notice: Use of undefined constant plugins - assumed 'plugins' in /Applications/MAMP/htdocs/flextype/flextype/Plugins.php at line 52
[17-Mar-2018 08:36:46] ErrorException: Notice: Array to string conversion in /Applications/MAMP/htdocs/flextype/site/plugins/highlight/highlight.php at line 13
[17-Mar-2018 08:38:44] ErrorException: Notice: Array to string conversion in /Applications/MAMP/htdocs/flextype/site/plugins/highlight/highlight.php at line 13
[17-Mar-2018 08:38:50] ErrorException: Notice: Array to string conversion in /Applications/MAMP/htdocs/flextype/site/plugins/highlight/highlight.php at line 13
[17-Mar-2018 08:38:51] ErrorException: Notice: Array to string conversion in /Applications/MAMP/htdocs/flextype/site/plugins/highlight/highlight.php at line 13
[17-Mar-2018 08:38:51] ErrorException: Notice: Array to string conversion in /Applications/MAMP/htdocs/flextype/site/plugins/highlight/highlight.php at line 13
[17-Mar-2018 08:39:02] Error: Cannot access protected property Flextype\Config::$config in /Applications/MAMP/htdocs/flextype/site/plugins/highlight/highlight.php at line 13
[17-Mar-2018 08:39:06] ErrorException: Notice: Array to string conversion in /Applications/MAMP/htdocs/flextype/site/plugins/highlight/highlight.php at line 13
[17-Mar-2018 08:39:15] ErrorException: Notice: Array to string conversion in /Applications/MAMP/htdocs/flextype/site/plugins/highlight/highlight.php at line 13
[17-Mar-2018 08:40:04] ParseError: syntax error, unexpected 'Events' (T_STRING), expecting ',' or ';' in /Applications/MAMP/htdocs/flextype/site/plugins/highlight/highlight.php at line 19
[17-Mar-2018 09:22:35] ErrorException: Notice: Undefined variable: plugins_cache_id in /Applications/MAMP/htdocs/flextype/flextype/Plugins.php at line 44
[17-Mar-2018 09:25:08] ParseError: syntax error, unexpected 'if' (T_IF), expecting ',' or ';' in /Applications/MAMP/htdocs/flextype/flextype/Plugins.php at line 81
[17-Mar-2018 11:07:45] Error: Class 'Config' not found in /Applications/MAMP/htdocs/flextype/site/themes/default/index.php at line 3
[17-Mar-2018 11:46:16] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/flextype/Shortcodes.php at line 99
[17-Mar-2018 11:49:33] Error: Using $this when not in object context in /Applications/MAMP/htdocs/flextype/flextype/Shortcodes.php at line 99
[17-Mar-2018 11:51:21] Error: Class 'Flextype\Url' not found in /Applications/MAMP/htdocs/flextype/flextype/boot/shortcodes.php at line 15

7
site/pages/404/index.md Executable file
View File

@@ -0,0 +1,7 @@
---
title: Error 404
robots: noindex,nofollow
---
## Error 404
We're sorry but the page you are looking for doesn't appear to exist!

29
site/pages/home/index.md Executable file
View File

@@ -0,0 +1,29 @@
---
title: Welcome
description: Flextype is a simple and light-weighted Content Management System
template: index
---
## Flextype is succesfully installed!
You can start editing the content and customising your site.
### Edit this Page
To edit this page, simply go to the folder you installed Flextype, and then browse to the `/site/pages/home/` folder and open the `index.md` file in your editor.
### Create a New page
Creating a new page is very simple in Flextype.
1. Launch your text editor and paste this sample text:
```
---
title: My New Page
---
# My New Page!
This is the body of **My New Page**
```
2. Save this file in the `/site/pages/my-new-page/` folder as `index.md` and its will be available by this url: {site_url}/my-new-page
That is it!

0
site/plugins/.gitkeep Executable file
View File

View File

@@ -0,0 +1,2 @@
# v1.0.0, 2018-03-17
* Initial release

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2018 Flextype Content Management
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.

View File

@@ -0,0 +1,81 @@
# Highlight Plugin for [Flextype](http://flextype.org/)
![version](https://img.shields.io/badge/version-1.0.0-brightgreen.svg?style=flat-square "Version")
![Flextype](https://img.shields.io/badge/Flextype-0.x-green.svg?style=flat-square "Flextype Version")
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/flextype-plugins/highlight/blob/master/LICENSE.txt)
![Highlight](screenshot.jpg)
Highlight plugin for [Flextype](https://github.com/flextype/flextype) adds a powerful code highlighting functionality with [Highlight.js](https://highlightjs.org/)
* 176 languages and 79 styles [(live demo)](https://highlightjs.org/static/demo/)
* automatic language detection
* multi-language code highlighting
* available for node.js
* works with any markup
* compatible with any js framework
## Installation
1. Unzip plugin to the folder `/site/plugins/`
2. Go to `/site/config/site.yml` and add plugin name to plugins section.
3. Save your changes.
Example:
```
...
plugins:
- highlight
```
## Usage in the pages
```php
function foo($attributes) {
// Extract attributes
extract($attributes);
// text
if (isset($text)) $text = $text; else $text = '';
// return
return $text;
}
```
## Settings
```yaml
enabled: true # or `false` to disable the plugin
theme: monokai # or other from the list below
```
### Themes
Check out a [live demo](https://highlightjs.org/static/demo/) of these themes!
| | | |
| :--------------------- | :-------------------- | ----------------------- |
| arta | ascetic | atelier-dune.dark |
| atelier-dune.light | atelier-forest.dark | atelier-forest.light |
| atelier-heath.dark | atelier-heath.light | atelier-lakeside.dark |
| atelier-lakeside.light | atelier-seaside.dark | atelier-seaside.light |
| brown_paper | codepen-embed | color-brewer |
| dark | default | docco |
| far | foundation | github |
| googlecode | hybrid | idea |
| ir_black | kimbie.dark | kimbie.light |
| learn | magula | mono-blue |
| monokai_sublime | monokai | obsidian |
| paraiso.dark | paraiso.light | pojoaque |
| railscasts | rainbow | school_book |
| solarized_dark | solarized_light | sunburst |
| tomorrow-night-blue | tomorrow-night-bright | tomorrow-night-eighties |
| tomorrow-night | tomorrow | vs |
| xcode | zenburn | |
| agate | androidstudio | atelier-cave.dark |
| atelier-cave.light | atelier-estuary.dark | atelier-estuary.light |
| atelier-plateau.dark | atelier-plateau.light | atelier-savanna.dark |
| atelier-savanna.light | atelier-sulphurpool.dark | atelier-sulphurpool.light |
| darkula | github-gist | pojoaque |
| school_bank | | |
## License
See [LICENSE](https://github.com/flextype-plugins/highlight/blob/master/LICENSE)

View File

@@ -0,0 +1,27 @@
<?php namespace Flextype;
/**
*
* Highlight Plugin for Flextype
*
* @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.
*/
//
// Add listner for onThemeHeader event
//
Events::addListener('onThemeHeader', function () {
echo('<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/'.Config::get('plugins.highlight.theme').'.min.css">');
});
//
// Add listner for onThemeFooter event
//
Events::addListener('onThemeFooter', function () {
echo('<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>');
});

View File

@@ -0,0 +1,14 @@
name: Highlight
version: 1.0.0
description: "Highlight plugin for Flextype adds a powerful code highlighting functionality with Highlight.js"
author:
name: Sergey Romanenko
email: awilum@yandex.com
url: http://flextype.org
homepage: https://github.com/flextype-plugins/highlight
bugs: https://github.com/flextype-plugins/highlight/issues
license: MIT
# Plugin settings
enabled: true
theme: monokai

View File

@@ -0,0 +1,2 @@
summary: "Highlight"
summary_description: "Highlight plugin for Flextype adds a powerful code highlighting functionality with Highlight.js"

View File

@@ -0,0 +1,2 @@
highlight: "Highlight"
highlight_description: "Highlight плагин для Flextype"

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

View File

@@ -0,0 +1,2 @@
# v1.0.0, 2018-03-16
* Initial Release

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2018 Flextype Content Management
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.

View File

@@ -0,0 +1,62 @@
# Reading Time Plugin for [Flextype](http://flextype.org/)
![version](https://img.shields.io/badge/version-1.0.0-brightgreen.svg?style=flat-square "Version")
![Flextype](https://img.shields.io/badge/Flextype-0.x-green.svg?style=flat-square "Flextype Version")
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/flextype-plugins/redirect/blob/master/LICENSE.txt)
Estimated reading time plugin for Flextype
## Installation
1. Unzip plugin to the folder `/site/plugins/`
2. Go to `/site/config/site.yml` and add plugin name to plugins section.
3. Save your changes.
Example:
```
...
plugins:
- reading-time
```
## Usage
Simple usage
```
<?php echo readingTime($page['content']); ?>
```
Localization
```
<?php echo readingTime($page['content'], [
'minute' => 'Minute',
'minutes' => 'Minutes',
'second' => 'Second',
'seconds' => 'Seconds']);
?>
```
Set custom format of the result
```
<?php echo readingTime($page['content'], [
'minute' => 'Minute',
'minutes' => 'Minutes',
'second' => 'Second',
'seconds' => 'Seconds',
'format' => '{minutes_count} {minutes_label} {seconds_count} {seconds_label}']);
?>
```
Enable alternative format that hides the minute label.
```
<?php echo readingTime($page['content'], [
'format' => '{minutes_count} {minutes_label}, {seconds_count} {seconds_label}',
'format.alt' => '{seconds_count} {seconds_label}',
'format.alt.enable' => true]);
?>
```
## License
See [LICENSE](https://github.com/fansoro/fansoro-plugin-reading-time/blob/master/LICENSE)

View File

@@ -0,0 +1,2 @@
readingtime: "Reading Time"
readingtime_description: "Estimated reading time plugin for Flextype"

View File

@@ -0,0 +1,2 @@
readingtime: "Reading Time"
readingtime_description: "Плагин для подсчета времени прочтения статьи."

View File

@@ -0,0 +1,51 @@
<?php namespace Flextype;
/**
*
* Reading Time Plugin for Flextype
*
* @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.
*/
function readingTime(string $content, array $params = [])
{
$defaults = [
'minute' => 'minute',
'minutes' => 'minutes',
'second' => 'second',
'seconds' => 'seconds',
'format' => '{minutes_count} {minutes_label}, {seconds_count} {seconds_label}',
'format.alt' => '{seconds_count} {seconds_label}',
'format.alt.enable' => false
];
$options = array_merge($defaults, $params);
$words = str_word_count(strip_tags($content));
$minutesCount = floor($words / 200);
$secondsCount = floor($words % 200 / (200 / 60));
$minutesLabel = ($minutesCount <= 1) ? $options['minute'] : $options['minutes'];
$secondsLabel = ($secondsCount <= 1) ? $options['second'] : $options['seconds'];
$replace = [
'minutes_count' => $minutesCount,
'minutes_label' => $minutesLabel,
'seconds_count' => $secondsCount,
'seconds_label' => $secondsLabel,
];
if ($minutesCount < 1 and $options['format.alt.enable'] === true) {
$result = $options['format.alt'];
} else {
$result = $options['format'];
}
foreach ($replace as $key => $value) {
$result = str_replace('{' . $key . '}', $value, $result);
}
return $result;
}

View File

@@ -0,0 +1,13 @@
name: Reading Time
version: 1.0.0
description: "Estimated reading time plugin for Flextype"
author:
name: Sergey Romanenko
email: awilum@yandex.ru
url: http://flextype.org
homepage: https://github.com/flextype-plugins/reading-time
bugs: https://github.com/flextype-plugins/reading-time/issues
license: MIT
# Plugin settings
enabled: true

View File

@@ -0,0 +1,5 @@
# v1.0.1, 2018-03-16
* Typo Updates
# v1.0.0, 2018-03-13
* Initial Release

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2018 Flextype Content Management
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.

View File

@@ -0,0 +1,35 @@
# Redirect Plugin for [Flextype](http://flextype.org/)
![version](https://img.shields.io/badge/version-1.0.1-brightgreen.svg?style=flat-square "Version")
![Flextype](https://img.shields.io/badge/Flextype-0.x-green.svg?style=flat-square "Flextype Version")
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/flextype-plugins/redirect/blob/master/LICENSE.txt)
Simple redirect plugin for Flextype. It allows you to create a simple redirects for your pages.
## Installation
1. Unzip plugin to the folder `/site/plugins/`
2. Go to `/site/config/site.yml` and add plugin name to plugins section.
3. Save your changes.
Example:
```
...
plugins:
- redirect
```
## Usage in the pages
You can simple add new redirect in the frontmatter of your page
```
redirect: new-page
```
## Create several redirects
This plugins allows you to setup several redirects, just go to the `/site/config/site.yml` and create section with your redirects.
```
redirects:
old-page: new-page
another-old-page: https://www.google.com
```
## License
[MIT](https://github.com/flextype-plugins/redirect/blob/master/LICENSE.txt)

View File

@@ -0,0 +1,2 @@
redirect: "Redirect"
redirect_description: "Simple redirect plugin for Flextype. It allows you to create a redirects from your pages."

View File

@@ -0,0 +1,2 @@
redirect: "Redirect"
redirect_description: "Простой плагин редиректа, которой позволяет делать редирект на страницах."

View File

@@ -0,0 +1,41 @@
<?php namespace Flextype;
/**
*
* Redirect Plugin for Flextype
*
* @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.
*/
use Arr;
use Request;
//
// Add listner for onPageContentAfter event
//
Events::addListener('onPageContentAfter', function () {
//
// Search in frontmatter of the curent page element 'redirect'
//
if (Arr::keyExists(Pages::$page, 'redirect')) {
Request::redirect(Arr::get(Pages::$page, 'redirect'));
}
//
// Redirect to the custom urls on specific pages
//
$redirects = Config::get('site.redirects');
if (is_array($redirects) && count($redirects) > 0) {
foreach ($redirects as $old_url => $new_url) {
if (Url::getUriString() == $old_url) {
Request::redirect($new_url);
}
}
}
});

View File

@@ -0,0 +1,13 @@
name: Redirect
version: 1.0.1
description: "Simple redirect plugin for Flextype. It allows you to create a redirects from your pages."
author:
name: Sergey Romanenko
email: awilum@yandex.ru
url: http://flextype.org
homepage: https://github.com/flextype-plugins/redirect
bugs: https://github.com/flextype-plugins/redirect/issues
license: MIT
# Plugin settings
enabled: true

View File

@@ -0,0 +1,5 @@
# v1.0.1, 2018-03-16
* Typo Updates
# v1.0.0, 2018-03-13
* Initial Release

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2018 Flextype Content Management
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.

View File

@@ -0,0 +1,35 @@
# Summary Plugin for [Flextype](http://flextype.org/)
![version](https://img.shields.io/badge/version-1.0.1-brightgreen.svg?style=flat-square "Version")
![Flextype](https://img.shields.io/badge/Flextype-0.x-green.svg?style=flat-square "Flextype Version")
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/flextype-plugins/summary/blob/master/LICENSE.txt)
Summary plugin will search tag: <!--more--> in the page content and will create summary text.
## Installation
1. Unzip plugin to the folder `/site/plugins/`
2. Go to `/site/config/site.yml` and add plugin name to plugins section.
3. Save your changes.
Example:
```
...
plugins:
- summary
```
## Usage in the pages
```
---
title: Blog Post
---
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
<!--more-->
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
```
## License
[MIT](https://github.com/flextype-plugins/summary/blob/master/LICENSE.txt)

View File

@@ -0,0 +1,2 @@
summary: "Summary"
summary_description: "Summary plugin will search tag: <!--more--> in the page content and will create summary text."

View File

@@ -0,0 +1,2 @@
summary: "Summary"
summary_description: "Summary плагин будет искать в тексте тег <!--more--> и создаст summary текст"

View File

@@ -0,0 +1,26 @@
<?php namespace Flextype;
/**
*
* Summary Plugin for Flextype
*
* @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.
*/
//
// Add listner for onPageContentAfter event
//
Events::addListener('onPageContentAfter', function () {
if (($pos = strpos(Pages::$page['content'], "<!--more-->")) === false) {
} else {
$page_content = explode("<!--more-->", Pages::$page['content']);
Pages::$page['summary'] = Filters::dispatch('content', Pages::parseContent($page_content[0]));
Pages::$page['content'] = Filters::dispatch('content', Pages::parseContent($page_content[0].$page_content[1]));
}
});

View File

@@ -0,0 +1,13 @@
name: Summary
version: 1.0.1
description: "Summary plugin will search tag: <!--more--> in the page content and will create summary text."
author:
name: Sergey Romanenko
email: awilum@yandex.com
url: http://flextype.org
homepage: https://github.com/flextype-plugins/summary
bugs: https://github.com/flextype-plugins/summary/issues
license: MIT
# Plugin settings
enabled: true

View File

@@ -0,0 +1,46 @@
html,
body {
font-family: 'Source Sans Pro', sans-serif;
font-size: 16px;
height: 100%;
color: black;
background: white;
}
body,
button,
input,
select,
textarea,
p {
font-family: 'Source Sans Pro', sans-serif;
font-weight: 400;
color: black;
}
body,
p {
line-height: 26px;
}
pre {
background: #f0f0f0;
padding-left: 10px;
}
.content {
padding-top: 40px;
}
.navbar-brand {
letter-spacing: 3px;
text-transform: uppercase;
}
.powered {
padding-top: 30px;
}

13
site/themes/default/default.yml Executable file
View File

@@ -0,0 +1,13 @@
name: Default
version: 1.0.0
description: Default Flextype theme
author:
name: Sergey Romanenko
email: awilum@yandex.ru
url: https://github.com/Awilum
homepage: https://github.com/flextype/flextype
bugs: https://github.com/flextype/flextype/issues
license: MIT
# Theme settings
enabled: true

3
site/themes/default/index.php Executable file
View File

@@ -0,0 +1,3 @@
<?php Flextype\Templates::display('partials/head'); ?>
<?php echo $page['content']; ?>
<?php Flextype\Templates::display('partials/footer'); ?>

View File

@@ -1,6 +1,7 @@
MIT License
The MIT License (MIT)
Copyright (c) 2018 RAWILUM CONTENT MANAGEMENT SYSTEM
Copyright (c) 2011-2018 Twitter, Inc.
Copyright (c) 2011-2018 The Bootstrap Authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -9,13 +10,13 @@ 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 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.
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

167
site/themes/default/node_modules/bootstrap/README.md generated vendored Normal file
View File

@@ -0,0 +1,167 @@
<p align="center">
<a href="https://getbootstrap.com/">
<img src="https://getbootstrap.com/assets/brand/bootstrap-solid.svg" alt="" width=72 height=72>
</a>
<h3 align="center">Bootstrap</h3>
<p align="center">
Sleek, intuitive, and powerful front-end framework for faster and easier web development.
<br>
<a href="https://getbootstrap.com/docs/4.0/"><strong>Explore Bootstrap docs »</strong></a>
<br>
<br>
<a href="https://themes.getbootstrap.com/">Bootstrap Themes</a>
·
<a href="https://jobs.getbootstrap.com/">Job Board</a>
·
<a href="https://blog.getbootstrap.com/">Blog</a>
</p>
</p>
<br>
## Table of contents
- [Quick start](#quick-start)
- [Status](#status)
- [What's included](#whats-included)
- [Bugs and feature requests](#bugs-and-feature-requests)
- [Documentation](#documentation)
- [Contributing](#contributing)
- [Community](#community)
- [Versioning](#versioning)
- [Creators](#creators)
- [Copyright and license](#copyright-and-license)
## Quick start
Several quick start options are available:
- [Download the latest release.](https://github.com/twbs/bootstrap/archive/v4.0.0.zip)
- Clone the repo: `git clone https://github.com/twbs/bootstrap.git`
- Install with [npm](https://www.npmjs.com/): `npm install bootstrap`
- Install with [yarn](https://yarnpkg.com/): `yarn add bootstrap@4.0.0`
- Install with [Composer](https://getcomposer.org/): `composer require twbs/bootstrap:4.0.0`
- Install with [NuGet](https://www.nuget.org/): CSS: `Install-Package bootstrap -Pre` Sass: `Install-Package bootstrap.sass -Pre` (`-Pre` is only required until Bootstrap v4 has a stable release).
Read the [Getting started page](https://getbootstrap.com/docs/4.0/getting-started/introduction/) for information on the framework contents, templates and examples, and more.
## Status
[![Slack](https://bootstrap-slack.herokuapp.com/badge.svg)](https://bootstrap-slack.herokuapp.com/)
[![Build Status](https://img.shields.io/travis/twbs/bootstrap/v4-dev.svg)](https://travis-ci.org/twbs/bootstrap)
[![npm version](https://img.shields.io/npm/v/bootstrap.svg)](https://www.npmjs.com/package/bootstrap)
[![Gem version](https://img.shields.io/gem/v/bootstrap.svg)](https://rubygems.org/gems/bootstrap)
[![Meteor Atmosphere](https://img.shields.io/badge/meteor-twbs%3Abootstrap-blue.svg)](https://atmospherejs.com/twbs/bootstrap)
[![Packagist Prerelease](https://img.shields.io/packagist/vpre/twbs/bootstrap.svg)](https://packagist.org/packages/twbs/bootstrap)
[![NuGet](https://img.shields.io/nuget/vpre/bootstrap.svg)](https://www.nuget.org/packages/bootstrap/absoluteLatest)
[![peerDependencies Status](https://img.shields.io/david/peer/twbs/bootstrap.svg)](https://david-dm.org/twbs/bootstrap?type=peer)
[![devDependency Status](https://img.shields.io/david/dev/twbs/bootstrap.svg)](https://david-dm.org/twbs/bootstrap?type=dev)
[![CSS gzip size](http://img.badgesize.io/twbs/bootstrap/v4-dev/dist/css/bootstrap.min.css?compression=gzip&label=CSS+gzip+size)](https://github.com/twbs/bootstrap/tree/v4-dev/dist/css/bootstrap.min.css)
[![JS gzip size](http://img.badgesize.io/twbs/bootstrap/v4-dev/dist/js/bootstrap.min.js?compression=gzip&label=JS+gzip+size)](https://github.com/twbs/bootstrap/tree/v4-dev/dist/js/bootstrap.min.js)
[![Sauce Labs Test Status](https://saucelabs.com/browser-matrix/bootstrap.svg)](https://saucelabs.com/u/bootstrap)
## What's included
Within the download you'll find the following directories and files, logically grouping common assets and providing both compiled and minified variations. You'll see something like this:
```
bootstrap/
├── css/
│ ├── bootstrap.css
│ ├── bootstrap.css.map
│ ├── bootstrap.min.css
│ ├── bootstrap.min.css.map
│ ├── bootstrap-grid.css
│ ├── bootstrap-grid.css.map
│ ├── bootstrap-grid.min.css
│ ├── bootstrap-grid.min.css.map
│ ├── bootstrap-reboot.css
│ ├── bootstrap-reboot.css.map
│ ├── bootstrap-reboot.min.css
│ └── bootstrap-reboot.min.css.map
└── js/
├── bootstrap.bundle.js
├── bootstrap.bundle.min.js
├── bootstrap.js
└── bootstrap.min.js
```
We provide compiled CSS and JS (`bootstrap.*`), as well as compiled and minified CSS and JS (`bootstrap.min.*`). CSS [source maps](https://developers.google.com/web/tools/chrome-devtools/debug/readability/source-maps) (`bootstrap.*.map`) are available for use with certain browsers' developer tools. Bundled JS files (`bootstrap.bundle.js` and minified `bootstrap.bundle.min.js`) include [Popper](https://popper.js.org/), but not [jQuery](https://jquery.com/).
## Bugs and feature requests
Have a bug or a feature request? Please first read the [issue guidelines](https://github.com/twbs/bootstrap/blob/master/CONTRIBUTING.md#using-the-issue-tracker) and search for existing and closed issues. If your problem or idea is not addressed yet, [please open a new issue](https://github.com/twbs/bootstrap/issues/new).
## Documentation
Bootstrap's documentation, included in this repo in the root directory, is built with [Jekyll](https://jekyllrb.com/) and publicly hosted on GitHub Pages at <https://getbootstrap.com/>. The docs may also be run locally.
Documentation search is powered by [Algolia's DocSearch](https://community.algolia.com/docsearch/). Working on our search? Be sure to set `debug: true` in the `_scripts.html` include.
### Running documentation locally
1. Run through the [tooling setup](https://getbootstrap.com/docs/4.0/getting-started/build-tools/#tooling-setup) to install Jekyll (the site builder) and other Ruby dependencies with `bundle install`.
2. Run `npm install` to install Node.js dependencies.
3. Run `npm run test` (or a specific NPM script) to rebuild distributed CSS and JavaScript files, as well as our docs assets.
4. From the root `/bootstrap` directory, run `npm run docs-serve` in the command line.
5. Open `http://localhost:9001` in your browser, and voilà.
Learn more about using Jekyll by reading its [documentation](https://jekyllrb.com/docs/home/).
### Documentation for previous releases
- For v2.3.2: <https://getbootstrap.com/2.3.2/>
- For v3.3.x: <https://getbootstrap.com/docs/3.3/>
[Previous releases](https://github.com/twbs/bootstrap/releases) and their documentation are also available for download.
## Contributing
Please read through our [contributing guidelines](https://github.com/twbs/bootstrap/blob/master/CONTRIBUTING.md). Included are directions for opening issues, coding standards, and notes on development.
Moreover, if your pull request contains JavaScript patches or features, you must include [relevant unit tests](https://github.com/twbs/bootstrap/tree/master/js/tests). All HTML and CSS should conform to the [Code Guide](https://github.com/mdo/code-guide), maintained by [Mark Otto](https://github.com/mdo).
Editor preferences are available in the [editor config](https://github.com/twbs/bootstrap/blob/master/.editorconfig) for easy use in common text editors. Read more and download plugins at <http://editorconfig.org/>.
## Community
Get updates on Bootstrap's development and chat with the project maintainers and community members.
- Follow [@getbootstrap on Twitter](https://twitter.com/getbootstrap).
- Read and subscribe to [The Official Bootstrap Blog](https://blog.getbootstrap.com/).
- Join [the official Slack room](https://bootstrap-slack.herokuapp.com/).
- Chat with fellow Bootstrappers in IRC. On the `irc.freenode.net` server, in the `##bootstrap` channel.
- Implementation help may be found at Stack Overflow (tagged [`bootstrap-4`](https://stackoverflow.com/questions/tagged/bootstrap-4)).
- Developers should use the keyword `bootstrap` on packages which modify or add to the functionality of Bootstrap when distributing through [npm](https://www.npmjs.com/browse/keyword/bootstrap) or similar delivery mechanisms for maximum discoverability.
## Versioning
For transparency into our release cycle and in striving to maintain backward compatibility, Bootstrap is maintained under [the Semantic Versioning guidelines](http://semver.org/). Sometimes we screw up, but we'll adhere to those rules whenever possible.
See [the Releases section of our GitHub project](https://github.com/twbs/bootstrap/releases) for changelogs for each release version of Bootstrap. Release announcement posts on [the official Bootstrap blog](https://blog.getbootstrap.com/) contain summaries of the most noteworthy changes made in each release.
## Creators
**Mark Otto**
- <https://twitter.com/mdo>
- <https://github.com/mdo>
**Jacob Thornton**
- <https://twitter.com/fat>
- <https://github.com/fat>
## Copyright and license
Code and documentation copyright 2011-2018 the [Bootstrap Authors](https://github.com/twbs/bootstrap/graphs/contributors) and [Twitter, Inc.](https://twitter.com) Code released under the [MIT License](https://github.com/twbs/bootstrap/blob/master/LICENSE). Docs released under [Creative Commons](https://github.com/twbs/bootstrap/blob/master/docs/LICENSE).

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,330 @@
/*!
* Bootstrap Reboot v4.0.0 (https://getbootstrap.com)
* Copyright 2011-2018 The Bootstrap Authors
* Copyright 2011-2018 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
html {
font-family: sans-serif;
line-height: 1.15;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
-ms-overflow-style: scrollbar;
-webkit-tap-highlight-color: transparent;
}
@-ms-viewport {
width: device-width;
}
article, aside, dialog, figcaption, figure, footer, header, hgroup, main, nav, section {
display: block;
}
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #212529;
text-align: left;
background-color: #fff;
}
[tabindex="-1"]:focus {
outline: 0 !important;
}
hr {
box-sizing: content-box;
height: 0;
overflow: visible;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 0;
margin-bottom: 0.5rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-original-title] {
text-decoration: underline;
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
border-bottom: 0;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: .5rem;
margin-left: 0;
}
blockquote {
margin: 0 0 1rem;
}
dfn {
font-style: italic;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 80%;
}
sub,
sup {
position: relative;
font-size: 75%;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -.25em;
}
sup {
top: -.5em;
}
a {
color: #007bff;
text-decoration: none;
background-color: transparent;
-webkit-text-decoration-skip: objects;
}
a:hover {
color: #0056b3;
text-decoration: underline;
}
a:not([href]):not([tabindex]) {
color: inherit;
text-decoration: none;
}
a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus {
color: inherit;
text-decoration: none;
}
a:not([href]):not([tabindex]):focus {
outline: 0;
}
pre,
code,
kbd,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
pre {
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
-ms-overflow-style: scrollbar;
}
figure {
margin: 0 0 1rem;
}
img {
vertical-align: middle;
border-style: none;
}
svg:not(:root) {
overflow: hidden;
}
table {
border-collapse: collapse;
}
caption {
padding-top: 0.75rem;
padding-bottom: 0.75rem;
color: #6c757d;
text-align: left;
caption-side: bottom;
}
th {
text-align: inherit;
}
label {
display: inline-block;
margin-bottom: .5rem;
}
button {
border-radius: 0;
}
button:focus {
outline: 1px dotted;
outline: 5px auto -webkit-focus-ring-color;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
input {
overflow: visible;
}
button,
select {
text-transform: none;
}
button,
html [type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
padding: 0;
border-style: none;
}
input[type="radio"],
input[type="checkbox"] {
box-sizing: border-box;
padding: 0;
}
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"] {
-webkit-appearance: listbox;
}
textarea {
overflow: auto;
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
display: block;
width: 100%;
max-width: 100%;
padding: 0;
margin-bottom: .5rem;
font-size: 1.5rem;
line-height: inherit;
color: inherit;
white-space: normal;
}
progress {
vertical-align: baseline;
}
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
[type="search"] {
outline-offset: -2px;
-webkit-appearance: none;
}
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
summary {
display: list-item;
cursor: pointer;
}
template {
display: none;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.css.map */

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
/*!
* Bootstrap Reboot v4.0.0 (https://getbootstrap.com)
* Copyright 2011-2018 The Bootstrap Authors
* Copyright 2011-2018 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:transparent}@-ms-viewport{width:device-width}article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}dfn{font-style:italic}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent;-webkit-text-decoration-skip:objects}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg:not(:root){overflow:hidden}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important}
/*# sourceMappingURL=bootstrap-reboot.min.css.map */

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,176 @@
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Alert = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'alert';
var VERSION = '4.0.0';
var DATA_KEY = 'bs.alert';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var TRANSITION_DURATION = 150;
var Selector = {
DISMISS: '[data-dismiss="alert"]'
};
var Event = {
CLOSE: "close" + EVENT_KEY,
CLOSED: "closed" + EVENT_KEY,
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
};
var ClassName = {
ALERT: 'alert',
FADE: 'fade',
SHOW: 'show'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Alert =
/*#__PURE__*/
function () {
function Alert(element) {
this._element = element;
} // Getters
var _proto = Alert.prototype;
// Public
_proto.close = function close(element) {
element = element || this._element;
var rootElement = this._getRootElement(element);
var customEvent = this._triggerCloseEvent(rootElement);
if (customEvent.isDefaultPrevented()) {
return;
}
this._removeElement(rootElement);
};
_proto.dispose = function dispose() {
$.removeData(this._element, DATA_KEY);
this._element = null;
}; // Private
_proto._getRootElement = function _getRootElement(element) {
var selector = Util.getSelectorFromElement(element);
var parent = false;
if (selector) {
parent = $(selector)[0];
}
if (!parent) {
parent = $(element).closest("." + ClassName.ALERT)[0];
}
return parent;
};
_proto._triggerCloseEvent = function _triggerCloseEvent(element) {
var closeEvent = $.Event(Event.CLOSE);
$(element).trigger(closeEvent);
return closeEvent;
};
_proto._removeElement = function _removeElement(element) {
var _this = this;
$(element).removeClass(ClassName.SHOW);
if (!Util.supportsTransitionEnd() || !$(element).hasClass(ClassName.FADE)) {
this._destroyElement(element);
return;
}
$(element).one(Util.TRANSITION_END, function (event) {
return _this._destroyElement(element, event);
}).emulateTransitionEnd(TRANSITION_DURATION);
};
_proto._destroyElement = function _destroyElement(element) {
$(element).detach().trigger(Event.CLOSED).remove();
}; // Static
Alert._jQueryInterface = function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new Alert(this);
$element.data(DATA_KEY, data);
}
if (config === 'close') {
data[config](this);
}
});
};
Alert._handleDismiss = function _handleDismiss(alertInstance) {
return function (event) {
if (event) {
event.preventDefault();
}
alertInstance.close(this);
};
};
_createClass(Alert, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}]);
return Alert;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Alert._jQueryInterface;
$.fn[NAME].Constructor = Alert;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Alert._jQueryInterface;
};
return Alert;
}($);
//# sourceMappingURL=alert.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,167 @@
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Button = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'button';
var VERSION = '4.0.0';
var DATA_KEY = 'bs.button';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var ClassName = {
ACTIVE: 'active',
BUTTON: 'btn',
FOCUS: 'focus'
};
var Selector = {
DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
DATA_TOGGLE: '[data-toggle="buttons"]',
INPUT: 'input',
ACTIVE: '.active',
BUTTON: '.btn'
};
var Event = {
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY,
FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY + DATA_API_KEY + " " + ("blur" + EVENT_KEY + DATA_API_KEY)
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Button =
/*#__PURE__*/
function () {
function Button(element) {
this._element = element;
} // Getters
var _proto = Button.prototype;
// Public
_proto.toggle = function toggle() {
var triggerChangeEvent = true;
var addAriaPressed = true;
var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0];
if (rootElement) {
var input = $(this._element).find(Selector.INPUT)[0];
if (input) {
if (input.type === 'radio') {
if (input.checked && $(this._element).hasClass(ClassName.ACTIVE)) {
triggerChangeEvent = false;
} else {
var activeElement = $(rootElement).find(Selector.ACTIVE)[0];
if (activeElement) {
$(activeElement).removeClass(ClassName.ACTIVE);
}
}
}
if (triggerChangeEvent) {
if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
return;
}
input.checked = !$(this._element).hasClass(ClassName.ACTIVE);
$(input).trigger('change');
}
input.focus();
addAriaPressed = false;
}
}
if (addAriaPressed) {
this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE));
}
if (triggerChangeEvent) {
$(this._element).toggleClass(ClassName.ACTIVE);
}
};
_proto.dispose = function dispose() {
$.removeData(this._element, DATA_KEY);
this._element = null;
}; // Static
Button._jQueryInterface = function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
if (!data) {
data = new Button(this);
$(this).data(DATA_KEY, data);
}
if (config === 'toggle') {
data[config]();
}
});
};
_createClass(Button, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}]);
return Button;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
event.preventDefault();
var button = event.target;
if (!$(button).hasClass(ClassName.BUTTON)) {
button = $(button).closest(Selector.BUTTON);
}
Button._jQueryInterface.call($(button), 'toggle');
}).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
var button = $(event.target).closest(Selector.BUTTON)[0];
$(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Button._jQueryInterface;
$.fn[NAME].Constructor = Button;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Button._jQueryInterface;
};
return Button;
}($);
//# sourceMappingURL=button.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,506 @@
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Carousel = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'carousel';
var VERSION = '4.0.0';
var DATA_KEY = 'bs.carousel';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var TRANSITION_DURATION = 600;
var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
var Default = {
interval: 5000,
keyboard: true,
slide: false,
pause: 'hover',
wrap: true
};
var DefaultType = {
interval: '(number|boolean)',
keyboard: 'boolean',
slide: '(boolean|string)',
pause: '(string|boolean)',
wrap: 'boolean'
};
var Direction = {
NEXT: 'next',
PREV: 'prev',
LEFT: 'left',
RIGHT: 'right'
};
var Event = {
SLIDE: "slide" + EVENT_KEY,
SLID: "slid" + EVENT_KEY,
KEYDOWN: "keydown" + EVENT_KEY,
MOUSEENTER: "mouseenter" + EVENT_KEY,
MOUSELEAVE: "mouseleave" + EVENT_KEY,
TOUCHEND: "touchend" + EVENT_KEY,
LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY,
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
};
var ClassName = {
CAROUSEL: 'carousel',
ACTIVE: 'active',
SLIDE: 'slide',
RIGHT: 'carousel-item-right',
LEFT: 'carousel-item-left',
NEXT: 'carousel-item-next',
PREV: 'carousel-item-prev',
ITEM: 'carousel-item'
};
var Selector = {
ACTIVE: '.active',
ACTIVE_ITEM: '.active.carousel-item',
ITEM: '.carousel-item',
NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
INDICATORS: '.carousel-indicators',
DATA_SLIDE: '[data-slide], [data-slide-to]',
DATA_RIDE: '[data-ride="carousel"]'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Carousel =
/*#__PURE__*/
function () {
function Carousel(element, config) {
this._items = null;
this._interval = null;
this._activeElement = null;
this._isPaused = false;
this._isSliding = false;
this.touchTimeout = null;
this._config = this._getConfig(config);
this._element = $(element)[0];
this._indicatorsElement = $(this._element).find(Selector.INDICATORS)[0];
this._addEventListeners();
} // Getters
var _proto = Carousel.prototype;
// Public
_proto.next = function next() {
if (!this._isSliding) {
this._slide(Direction.NEXT);
}
};
_proto.nextWhenVisible = function nextWhenVisible() {
// Don't call next when the page isn't visible
// or the carousel or its parent isn't visible
if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
this.next();
}
};
_proto.prev = function prev() {
if (!this._isSliding) {
this._slide(Direction.PREV);
}
};
_proto.pause = function pause(event) {
if (!event) {
this._isPaused = true;
}
if ($(this._element).find(Selector.NEXT_PREV)[0] && Util.supportsTransitionEnd()) {
Util.triggerTransitionEnd(this._element);
this.cycle(true);
}
clearInterval(this._interval);
this._interval = null;
};
_proto.cycle = function cycle(event) {
if (!event) {
this._isPaused = false;
}
if (this._interval) {
clearInterval(this._interval);
this._interval = null;
}
if (this._config.interval && !this._isPaused) {
this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
}
};
_proto.to = function to(index) {
var _this = this;
this._activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0];
var activeIndex = this._getItemIndex(this._activeElement);
if (index > this._items.length - 1 || index < 0) {
return;
}
if (this._isSliding) {
$(this._element).one(Event.SLID, function () {
return _this.to(index);
});
return;
}
if (activeIndex === index) {
this.pause();
this.cycle();
return;
}
var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
this._slide(direction, this._items[index]);
};
_proto.dispose = function dispose() {
$(this._element).off(EVENT_KEY);
$.removeData(this._element, DATA_KEY);
this._items = null;
this._config = null;
this._element = null;
this._interval = null;
this._isPaused = null;
this._isSliding = null;
this._activeElement = null;
this._indicatorsElement = null;
}; // Private
_proto._getConfig = function _getConfig(config) {
config = _extends({}, Default, config);
Util.typeCheckConfig(NAME, config, DefaultType);
return config;
};
_proto._addEventListeners = function _addEventListeners() {
var _this2 = this;
if (this._config.keyboard) {
$(this._element).on(Event.KEYDOWN, function (event) {
return _this2._keydown(event);
});
}
if (this._config.pause === 'hover') {
$(this._element).on(Event.MOUSEENTER, function (event) {
return _this2.pause(event);
}).on(Event.MOUSELEAVE, function (event) {
return _this2.cycle(event);
});
if ('ontouchstart' in document.documentElement) {
// If it's a touch-enabled device, mouseenter/leave are fired as
// part of the mouse compatibility events on first tap - the carousel
// would stop cycling until user tapped out of it;
// here, we listen for touchend, explicitly pause the carousel
// (as if it's the second time we tap on it, mouseenter compat event
// is NOT fired) and after a timeout (to allow for mouse compatibility
// events to fire) we explicitly restart cycling
$(this._element).on(Event.TOUCHEND, function () {
_this2.pause();
if (_this2.touchTimeout) {
clearTimeout(_this2.touchTimeout);
}
_this2.touchTimeout = setTimeout(function (event) {
return _this2.cycle(event);
}, TOUCHEVENT_COMPAT_WAIT + _this2._config.interval);
});
}
}
};
_proto._keydown = function _keydown(event) {
if (/input|textarea/i.test(event.target.tagName)) {
return;
}
switch (event.which) {
case ARROW_LEFT_KEYCODE:
event.preventDefault();
this.prev();
break;
case ARROW_RIGHT_KEYCODE:
event.preventDefault();
this.next();
break;
default:
}
};
_proto._getItemIndex = function _getItemIndex(element) {
this._items = $.makeArray($(element).parent().find(Selector.ITEM));
return this._items.indexOf(element);
};
_proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
var isNextDirection = direction === Direction.NEXT;
var isPrevDirection = direction === Direction.PREV;
var activeIndex = this._getItemIndex(activeElement);
var lastItemIndex = this._items.length - 1;
var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
if (isGoingToWrap && !this._config.wrap) {
return activeElement;
}
var delta = direction === Direction.PREV ? -1 : 1;
var itemIndex = (activeIndex + delta) % this._items.length;
return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
};
_proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
var targetIndex = this._getItemIndex(relatedTarget);
var fromIndex = this._getItemIndex($(this._element).find(Selector.ACTIVE_ITEM)[0]);
var slideEvent = $.Event(Event.SLIDE, {
relatedTarget: relatedTarget,
direction: eventDirectionName,
from: fromIndex,
to: targetIndex
});
$(this._element).trigger(slideEvent);
return slideEvent;
};
_proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
if (this._indicatorsElement) {
$(this._indicatorsElement).find(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
if (nextIndicator) {
$(nextIndicator).addClass(ClassName.ACTIVE);
}
}
};
_proto._slide = function _slide(direction, element) {
var _this3 = this;
var activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0];
var activeElementIndex = this._getItemIndex(activeElement);
var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
var nextElementIndex = this._getItemIndex(nextElement);
var isCycling = Boolean(this._interval);
var directionalClassName;
var orderClassName;
var eventDirectionName;
if (direction === Direction.NEXT) {
directionalClassName = ClassName.LEFT;
orderClassName = ClassName.NEXT;
eventDirectionName = Direction.LEFT;
} else {
directionalClassName = ClassName.RIGHT;
orderClassName = ClassName.PREV;
eventDirectionName = Direction.RIGHT;
}
if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) {
this._isSliding = false;
return;
}
var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
if (slideEvent.isDefaultPrevented()) {
return;
}
if (!activeElement || !nextElement) {
// Some weirdness is happening, so we bail
return;
}
this._isSliding = true;
if (isCycling) {
this.pause();
}
this._setActiveIndicatorElement(nextElement);
var slidEvent = $.Event(Event.SLID, {
relatedTarget: nextElement,
direction: eventDirectionName,
from: activeElementIndex,
to: nextElementIndex
});
if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.SLIDE)) {
$(nextElement).addClass(orderClassName);
Util.reflow(nextElement);
$(activeElement).addClass(directionalClassName);
$(nextElement).addClass(directionalClassName);
$(activeElement).one(Util.TRANSITION_END, function () {
$(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName.ACTIVE);
$(activeElement).removeClass(ClassName.ACTIVE + " " + orderClassName + " " + directionalClassName);
_this3._isSliding = false;
setTimeout(function () {
return $(_this3._element).trigger(slidEvent);
}, 0);
}).emulateTransitionEnd(TRANSITION_DURATION);
} else {
$(activeElement).removeClass(ClassName.ACTIVE);
$(nextElement).addClass(ClassName.ACTIVE);
this._isSliding = false;
$(this._element).trigger(slidEvent);
}
if (isCycling) {
this.cycle();
}
}; // Static
Carousel._jQueryInterface = function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = _extends({}, Default, $(this).data());
if (typeof config === 'object') {
_config = _extends({}, _config, config);
}
var action = typeof config === 'string' ? config : _config.slide;
if (!data) {
data = new Carousel(this, _config);
$(this).data(DATA_KEY, data);
}
if (typeof config === 'number') {
data.to(config);
} else if (typeof action === 'string') {
if (typeof data[action] === 'undefined') {
throw new TypeError("No method named \"" + action + "\"");
}
data[action]();
} else if (_config.interval) {
data.pause();
data.cycle();
}
});
};
Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
var selector = Util.getSelectorFromElement(this);
if (!selector) {
return;
}
var target = $(selector)[0];
if (!target || !$(target).hasClass(ClassName.CAROUSEL)) {
return;
}
var config = _extends({}, $(target).data(), $(this).data());
var slideIndex = this.getAttribute('data-slide-to');
if (slideIndex) {
config.interval = false;
}
Carousel._jQueryInterface.call($(target), config);
if (slideIndex) {
$(target).data(DATA_KEY).to(slideIndex);
}
event.preventDefault();
};
_createClass(Carousel, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default",
get: function get() {
return Default;
}
}]);
return Carousel;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
$(window).on(Event.LOAD_DATA_API, function () {
$(Selector.DATA_RIDE).each(function () {
var $carousel = $(this);
Carousel._jQueryInterface.call($carousel, $carousel.data());
});
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Carousel._jQueryInterface;
$.fn[NAME].Constructor = Carousel;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Carousel._jQueryInterface;
};
return Carousel;
}($);
//# sourceMappingURL=carousel.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,375 @@
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Collapse = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'collapse';
var VERSION = '4.0.0';
var DATA_KEY = 'bs.collapse';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var TRANSITION_DURATION = 600;
var Default = {
toggle: true,
parent: ''
};
var DefaultType = {
toggle: 'boolean',
parent: '(string|element)'
};
var Event = {
SHOW: "show" + EVENT_KEY,
SHOWN: "shown" + EVENT_KEY,
HIDE: "hide" + EVENT_KEY,
HIDDEN: "hidden" + EVENT_KEY,
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
};
var ClassName = {
SHOW: 'show',
COLLAPSE: 'collapse',
COLLAPSING: 'collapsing',
COLLAPSED: 'collapsed'
};
var Dimension = {
WIDTH: 'width',
HEIGHT: 'height'
};
var Selector = {
ACTIVES: '.show, .collapsing',
DATA_TOGGLE: '[data-toggle="collapse"]'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Collapse =
/*#__PURE__*/
function () {
function Collapse(element, config) {
this._isTransitioning = false;
this._element = element;
this._config = this._getConfig(config);
this._triggerArray = $.makeArray($("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
var tabToggles = $(Selector.DATA_TOGGLE);
for (var i = 0; i < tabToggles.length; i++) {
var elem = tabToggles[i];
var selector = Util.getSelectorFromElement(elem);
if (selector !== null && $(selector).filter(element).length > 0) {
this._selector = selector;
this._triggerArray.push(elem);
}
}
this._parent = this._config.parent ? this._getParent() : null;
if (!this._config.parent) {
this._addAriaAndCollapsedClass(this._element, this._triggerArray);
}
if (this._config.toggle) {
this.toggle();
}
} // Getters
var _proto = Collapse.prototype;
// Public
_proto.toggle = function toggle() {
if ($(this._element).hasClass(ClassName.SHOW)) {
this.hide();
} else {
this.show();
}
};
_proto.show = function show() {
var _this = this;
if (this._isTransitioning || $(this._element).hasClass(ClassName.SHOW)) {
return;
}
var actives;
var activesData;
if (this._parent) {
actives = $.makeArray($(this._parent).find(Selector.ACTIVES).filter("[data-parent=\"" + this._config.parent + "\"]"));
if (actives.length === 0) {
actives = null;
}
}
if (actives) {
activesData = $(actives).not(this._selector).data(DATA_KEY);
if (activesData && activesData._isTransitioning) {
return;
}
}
var startEvent = $.Event(Event.SHOW);
$(this._element).trigger(startEvent);
if (startEvent.isDefaultPrevented()) {
return;
}
if (actives) {
Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
if (!activesData) {
$(actives).data(DATA_KEY, null);
}
}
var dimension = this._getDimension();
$(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
this._element.style[dimension] = 0;
if (this._triggerArray.length > 0) {
$(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
}
this.setTransitioning(true);
var complete = function complete() {
$(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW);
_this._element.style[dimension] = '';
_this.setTransitioning(false);
$(_this._element).trigger(Event.SHOWN);
};
if (!Util.supportsTransitionEnd()) {
complete();
return;
}
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
var scrollSize = "scroll" + capitalizedDimension;
$(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
this._element.style[dimension] = this._element[scrollSize] + "px";
};
_proto.hide = function hide() {
var _this2 = this;
if (this._isTransitioning || !$(this._element).hasClass(ClassName.SHOW)) {
return;
}
var startEvent = $.Event(Event.HIDE);
$(this._element).trigger(startEvent);
if (startEvent.isDefaultPrevented()) {
return;
}
var dimension = this._getDimension();
this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
Util.reflow(this._element);
$(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW);
if (this._triggerArray.length > 0) {
for (var i = 0; i < this._triggerArray.length; i++) {
var trigger = this._triggerArray[i];
var selector = Util.getSelectorFromElement(trigger);
if (selector !== null) {
var $elem = $(selector);
if (!$elem.hasClass(ClassName.SHOW)) {
$(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
}
}
}
}
this.setTransitioning(true);
var complete = function complete() {
_this2.setTransitioning(false);
$(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN);
};
this._element.style[dimension] = '';
if (!Util.supportsTransitionEnd()) {
complete();
return;
}
$(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
};
_proto.setTransitioning = function setTransitioning(isTransitioning) {
this._isTransitioning = isTransitioning;
};
_proto.dispose = function dispose() {
$.removeData(this._element, DATA_KEY);
this._config = null;
this._parent = null;
this._element = null;
this._triggerArray = null;
this._isTransitioning = null;
}; // Private
_proto._getConfig = function _getConfig(config) {
config = _extends({}, Default, config);
config.toggle = Boolean(config.toggle); // Coerce string values
Util.typeCheckConfig(NAME, config, DefaultType);
return config;
};
_proto._getDimension = function _getDimension() {
var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
};
_proto._getParent = function _getParent() {
var _this3 = this;
var parent = null;
if (Util.isElement(this._config.parent)) {
parent = this._config.parent; // It's a jQuery object
if (typeof this._config.parent.jquery !== 'undefined') {
parent = this._config.parent[0];
}
} else {
parent = $(this._config.parent)[0];
}
var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
$(parent).find(selector).each(function (i, element) {
_this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
});
return parent;
};
_proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
if (element) {
var isOpen = $(element).hasClass(ClassName.SHOW);
if (triggerArray.length > 0) {
$(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
}
}
}; // Static
Collapse._getTargetFromElement = function _getTargetFromElement(element) {
var selector = Util.getSelectorFromElement(element);
return selector ? $(selector)[0] : null;
};
Collapse._jQueryInterface = function _jQueryInterface(config) {
return this.each(function () {
var $this = $(this);
var data = $this.data(DATA_KEY);
var _config = _extends({}, Default, $this.data(), typeof config === 'object' && config);
if (!data && _config.toggle && /show|hide/.test(config)) {
_config.toggle = false;
}
if (!data) {
data = new Collapse(this, _config);
$this.data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError("No method named \"" + config + "\"");
}
data[config]();
}
});
};
_createClass(Collapse, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default",
get: function get() {
return Default;
}
}]);
return Collapse;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
if (event.currentTarget.tagName === 'A') {
event.preventDefault();
}
var $trigger = $(this);
var selector = Util.getSelectorFromElement(this);
$(selector).each(function () {
var $target = $(this);
var data = $target.data(DATA_KEY);
var config = data ? 'toggle' : $trigger.data();
Collapse._jQueryInterface.call($target, config);
});
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Collapse._jQueryInterface;
$.fn[NAME].Constructor = Collapse;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Collapse._jQueryInterface;
};
return Collapse;
}($);
//# sourceMappingURL=collapse.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,471 @@
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Dropdown = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'dropdown';
var VERSION = '4.0.0';
var DATA_KEY = 'bs.dropdown';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
var Event = {
HIDE: "hide" + EVENT_KEY,
HIDDEN: "hidden" + EVENT_KEY,
SHOW: "show" + EVENT_KEY,
SHOWN: "shown" + EVENT_KEY,
CLICK: "click" + EVENT_KEY,
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY,
KEYDOWN_DATA_API: "keydown" + EVENT_KEY + DATA_API_KEY,
KEYUP_DATA_API: "keyup" + EVENT_KEY + DATA_API_KEY
};
var ClassName = {
DISABLED: 'disabled',
SHOW: 'show',
DROPUP: 'dropup',
DROPRIGHT: 'dropright',
DROPLEFT: 'dropleft',
MENURIGHT: 'dropdown-menu-right',
MENULEFT: 'dropdown-menu-left',
POSITION_STATIC: 'position-static'
};
var Selector = {
DATA_TOGGLE: '[data-toggle="dropdown"]',
FORM_CHILD: '.dropdown form',
MENU: '.dropdown-menu',
NAVBAR_NAV: '.navbar-nav',
VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled)'
};
var AttachmentMap = {
TOP: 'top-start',
TOPEND: 'top-end',
BOTTOM: 'bottom-start',
BOTTOMEND: 'bottom-end',
RIGHT: 'right-start',
RIGHTEND: 'right-end',
LEFT: 'left-start',
LEFTEND: 'left-end'
};
var Default = {
offset: 0,
flip: true,
boundary: 'scrollParent'
};
var DefaultType = {
offset: '(number|string|function)',
flip: 'boolean',
boundary: '(string|element)'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Dropdown =
/*#__PURE__*/
function () {
function Dropdown(element, config) {
this._element = element;
this._popper = null;
this._config = this._getConfig(config);
this._menu = this._getMenuElement();
this._inNavbar = this._detectNavbar();
this._addEventListeners();
} // Getters
var _proto = Dropdown.prototype;
// Public
_proto.toggle = function toggle() {
if (this._element.disabled || $(this._element).hasClass(ClassName.DISABLED)) {
return;
}
var parent = Dropdown._getParentFromElement(this._element);
var isActive = $(this._menu).hasClass(ClassName.SHOW);
Dropdown._clearMenus();
if (isActive) {
return;
}
var relatedTarget = {
relatedTarget: this._element
};
var showEvent = $.Event(Event.SHOW, relatedTarget);
$(parent).trigger(showEvent);
if (showEvent.isDefaultPrevented()) {
return;
} // Disable totally Popper.js for Dropdown in Navbar
if (!this._inNavbar) {
/**
* Check for Popper dependency
* Popper - https://popper.js.org
*/
if (typeof Popper === 'undefined') {
throw new TypeError('Bootstrap dropdown require Popper.js (https://popper.js.org)');
}
var element = this._element; // For dropup with alignment we use the parent as popper container
if ($(parent).hasClass(ClassName.DROPUP)) {
if ($(this._menu).hasClass(ClassName.MENULEFT) || $(this._menu).hasClass(ClassName.MENURIGHT)) {
element = parent;
}
} // If boundary is not `scrollParent`, then set position to `static`
// to allow the menu to "escape" the scroll parent's boundaries
// https://github.com/twbs/bootstrap/issues/24251
if (this._config.boundary !== 'scrollParent') {
$(parent).addClass(ClassName.POSITION_STATIC);
}
this._popper = new Popper(element, this._menu, this._getPopperConfig());
} // If this is a touch-enabled device we add extra
// empty mouseover listeners to the body's immediate children;
// only needed because of broken event delegation on iOS
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
if ('ontouchstart' in document.documentElement && $(parent).closest(Selector.NAVBAR_NAV).length === 0) {
$('body').children().on('mouseover', null, $.noop);
}
this._element.focus();
this._element.setAttribute('aria-expanded', true);
$(this._menu).toggleClass(ClassName.SHOW);
$(parent).toggleClass(ClassName.SHOW).trigger($.Event(Event.SHOWN, relatedTarget));
};
_proto.dispose = function dispose() {
$.removeData(this._element, DATA_KEY);
$(this._element).off(EVENT_KEY);
this._element = null;
this._menu = null;
if (this._popper !== null) {
this._popper.destroy();
this._popper = null;
}
};
_proto.update = function update() {
this._inNavbar = this._detectNavbar();
if (this._popper !== null) {
this._popper.scheduleUpdate();
}
}; // Private
_proto._addEventListeners = function _addEventListeners() {
var _this = this;
$(this._element).on(Event.CLICK, function (event) {
event.preventDefault();
event.stopPropagation();
_this.toggle();
});
};
_proto._getConfig = function _getConfig(config) {
config = _extends({}, this.constructor.Default, $(this._element).data(), config);
Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
return config;
};
_proto._getMenuElement = function _getMenuElement() {
if (!this._menu) {
var parent = Dropdown._getParentFromElement(this._element);
this._menu = $(parent).find(Selector.MENU)[0];
}
return this._menu;
};
_proto._getPlacement = function _getPlacement() {
var $parentDropdown = $(this._element).parent();
var placement = AttachmentMap.BOTTOM; // Handle dropup
if ($parentDropdown.hasClass(ClassName.DROPUP)) {
placement = AttachmentMap.TOP;
if ($(this._menu).hasClass(ClassName.MENURIGHT)) {
placement = AttachmentMap.TOPEND;
}
} else if ($parentDropdown.hasClass(ClassName.DROPRIGHT)) {
placement = AttachmentMap.RIGHT;
} else if ($parentDropdown.hasClass(ClassName.DROPLEFT)) {
placement = AttachmentMap.LEFT;
} else if ($(this._menu).hasClass(ClassName.MENURIGHT)) {
placement = AttachmentMap.BOTTOMEND;
}
return placement;
};
_proto._detectNavbar = function _detectNavbar() {
return $(this._element).closest('.navbar').length > 0;
};
_proto._getPopperConfig = function _getPopperConfig() {
var _this2 = this;
var offsetConf = {};
if (typeof this._config.offset === 'function') {
offsetConf.fn = function (data) {
data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets) || {});
return data;
};
} else {
offsetConf.offset = this._config.offset;
}
var popperConfig = {
placement: this._getPlacement(),
modifiers: {
offset: offsetConf,
flip: {
enabled: this._config.flip
},
preventOverflow: {
boundariesElement: this._config.boundary
}
}
};
return popperConfig;
}; // Static
Dropdown._jQueryInterface = function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = typeof config === 'object' ? config : null;
if (!data) {
data = new Dropdown(this, _config);
$(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError("No method named \"" + config + "\"");
}
data[config]();
}
});
};
Dropdown._clearMenus = function _clearMenus(event) {
if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
return;
}
var toggles = $.makeArray($(Selector.DATA_TOGGLE));
for (var i = 0; i < toggles.length; i++) {
var parent = Dropdown._getParentFromElement(toggles[i]);
var context = $(toggles[i]).data(DATA_KEY);
var relatedTarget = {
relatedTarget: toggles[i]
};
if (!context) {
continue;
}
var dropdownMenu = context._menu;
if (!$(parent).hasClass(ClassName.SHOW)) {
continue;
}
if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
continue;
}
var hideEvent = $.Event(Event.HIDE, relatedTarget);
$(parent).trigger(hideEvent);
if (hideEvent.isDefaultPrevented()) {
continue;
} // If this is a touch-enabled device we remove the extra
// empty mouseover listeners we added for iOS support
if ('ontouchstart' in document.documentElement) {
$('body').children().off('mouseover', null, $.noop);
}
toggles[i].setAttribute('aria-expanded', 'false');
$(dropdownMenu).removeClass(ClassName.SHOW);
$(parent).removeClass(ClassName.SHOW).trigger($.Event(Event.HIDDEN, relatedTarget));
}
};
Dropdown._getParentFromElement = function _getParentFromElement(element) {
var parent;
var selector = Util.getSelectorFromElement(element);
if (selector) {
parent = $(selector)[0];
}
return parent || element.parentNode;
}; // eslint-disable-next-line complexity
Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
// If not input/textarea:
// - And not a key in REGEXP_KEYDOWN => not a dropdown command
// If input/textarea:
// - If space key => not a dropdown command
// - If key is other than escape
// - If key is not up or down => not a dropdown command
// - If trigger inside the menu => not a dropdown command
if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
return;
}
event.preventDefault();
event.stopPropagation();
if (this.disabled || $(this).hasClass(ClassName.DISABLED)) {
return;
}
var parent = Dropdown._getParentFromElement(this);
var isActive = $(parent).hasClass(ClassName.SHOW);
if (!isActive && (event.which !== ESCAPE_KEYCODE || event.which !== SPACE_KEYCODE) || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
if (event.which === ESCAPE_KEYCODE) {
var toggle = $(parent).find(Selector.DATA_TOGGLE)[0];
$(toggle).trigger('focus');
}
$(this).trigger('click');
return;
}
var items = $(parent).find(Selector.VISIBLE_ITEMS).get();
if (items.length === 0) {
return;
}
var index = items.indexOf(event.target);
if (event.which === ARROW_UP_KEYCODE && index > 0) {
// Up
index--;
}
if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
// Down
index++;
}
if (index < 0) {
index = 0;
}
items[index].focus();
};
_createClass(Dropdown, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default",
get: function get() {
return Default;
}
}, {
key: "DefaultType",
get: function get() {
return DefaultType;
}
}]);
return Dropdown;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.MENU, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA_API + " " + Event.KEYUP_DATA_API, Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
event.preventDefault();
event.stopPropagation();
Dropdown._jQueryInterface.call($(this), 'toggle');
}).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) {
e.stopPropagation();
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Dropdown._jQueryInterface;
$.fn[NAME].Constructor = Dropdown;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Dropdown._jQueryInterface;
};
return Dropdown;
}($, Popper);
//# sourceMappingURL=dropdown.js.map

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More