Merge 3737623dd75e0890cba58bd954ad3ad5f5b6ca6e into 1e0e663c23140182ca4202e565e915ae10d316e8
This commit is contained in:
commit
2a00980559
23
bl-kernel/abstract/plugin.class.php
Normal file → Executable file
23
bl-kernel/abstract/plugin.class.php
Normal file → Executable file
@ -22,8 +22,13 @@ class Plugin {
|
||||
// (array) Plugin's information.
|
||||
public $metadata;
|
||||
|
||||
// (dbLanguage) Plugin's localisation.
|
||||
public $language;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
global $Site;
|
||||
|
||||
$this->dbFields = array();
|
||||
|
||||
$reflector = new ReflectionClass(get_class($this));
|
||||
@ -47,6 +52,16 @@ class Plugin {
|
||||
$metadataString = file_get_contents($this->filenameMetadata);
|
||||
$this->metadata = json_decode($metadataString, true);
|
||||
|
||||
// Load localisation
|
||||
$tmp = new dbLanguage($Site->locale(), PATH_PLUGINS.$this->directoryName.DS.'languages'.DS);
|
||||
// Set name and description from the language file.
|
||||
$this->setMetadata('name',$tmp->db['plugin-data']['name']);
|
||||
$this->setMetadata('description',$tmp->db['plugin-data']['description']);
|
||||
|
||||
// Remove name and description
|
||||
unset($tmp->db['plugin-data']);
|
||||
$this->language = $tmp;
|
||||
|
||||
// If the plugin is installed then get the database.
|
||||
if($this->installed())
|
||||
{
|
||||
@ -218,8 +233,12 @@ class Plugin {
|
||||
|
||||
public function init()
|
||||
{
|
||||
// This method is used on childre classes.
|
||||
// The user can define your own dbFields.
|
||||
// This method is used on child classes.
|
||||
// The user can define their own dbFields.
|
||||
}
|
||||
|
||||
public function L($key)
|
||||
{
|
||||
return $this->language->get($key);
|
||||
}
|
||||
}
|
58
bl-kernel/admin/themes/default/index.php
Normal file → Executable file
58
bl-kernel/admin/themes/default/index.php
Normal file → Executable file
@ -30,31 +30,31 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Plugins -->
|
||||
<?php Theme::plugins('adminBodyBegin') ?>
|
||||
<!-- Plugins -->
|
||||
<?php Theme::plugins('adminBodyBegin') ?>
|
||||
|
||||
<!-- Alert -->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
<?php
|
||||
<!-- Alert -->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
<?php
|
||||
if( Alert::defined() ) {
|
||||
echo '$("#alert").slideDown().delay(3500).slideUp();';
|
||||
}
|
||||
?>
|
||||
?>
|
||||
$(window).click(function() {
|
||||
$("#alert").hide();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="alert" class="<?php echo (Alert::status()==ALERT_STATUS_OK)?'alert-ok':'alert-fail'; ?>">
|
||||
<?php Alert::p() ?>
|
||||
</div>
|
||||
<div id="alert" class="<?php echo (Alert::status()==ALERT_STATUS_OK)?'alert-ok':'alert-fail'; ?>">
|
||||
<?php Alert::p() ?>
|
||||
</div>
|
||||
|
||||
<!-- Offcanvas for Mobile -->
|
||||
<a href="#offcanvas" class="uk-navbar-toggle uk-hidden-large" data-uk-offcanvas></a>
|
||||
<div id="offcanvas" class="uk-offcanvas">
|
||||
<div class="uk-offcanvas-bar">
|
||||
<!-- Offcanvas for Mobile -->
|
||||
<a href="#offcanvas" class="uk-navbar-toggle uk-hidden-large" data-uk-offcanvas></a>
|
||||
<div id="offcanvas" class="uk-offcanvas">
|
||||
<div class="uk-offcanvas-bar">
|
||||
<ul class="uk-nav uk-nav-offcanvas">
|
||||
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'dashboard' ?>"><?php $L->p('Dashboard') ?></a></li>
|
||||
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'new-post' ?>"><?php $L->p('New post') ?></a></li>
|
||||
@ -71,21 +71,21 @@ $(document).ready(function() {
|
||||
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'about' ?>"><?php $L->p('About') ?></a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bl-navbar-bg">
|
||||
<nav id="bl-navbar">
|
||||
<div class="bl-navbar-bg">
|
||||
<nav id="bl-navbar">
|
||||
<a href="" class="bl-brand">BLUDIT</a>
|
||||
|
||||
<div class="bl-navbar-right">
|
||||
<?php $L->p('Welcome') ?> <?php echo $Login->username() ?> -
|
||||
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'logout' ?>"><?php $L->p('Logout') ?></a>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div id="bl-container">
|
||||
<div id="bl-container">
|
||||
|
||||
<div class="uk-grid uk-grid-small">
|
||||
|
||||
@ -151,13 +151,15 @@ $(document).ready(function() {
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Javascript -->
|
||||
<?php include(PATH_JS.'functions.php') ?>
|
||||
</div>
|
||||
|
||||
<!-- Plugins -->
|
||||
<?php Theme::plugins('adminBodyEnd') ?>
|
||||
<!-- Javascript -->
|
||||
<?php include(PATH_JS.'functions.php') ?>
|
||||
|
||||
<!-- Plugins -->
|
||||
<?php Theme::plugins('adminBodyEnd') ?>
|
||||
|
||||
</body>
|
||||
</html>
|
23
bl-kernel/boot/rules/60.plugins.php
Normal file → Executable file
23
bl-kernel/boot/rules/60.plugins.php
Normal file → Executable file
@ -75,26 +75,13 @@ function buildPlugins()
|
||||
|
||||
foreach($pluginsDeclaredClasess as $pluginClass)
|
||||
{
|
||||
$Plugin = new $pluginClass;
|
||||
|
||||
// Check if the plugin is translated.
|
||||
$languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'languages'.DS.$Site->locale().'.json';
|
||||
if( !Sanitize::pathFile($languageFilename) ) {
|
||||
$languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'languages'.DS.'en_US.json';
|
||||
// Ignore non-plugin classes
|
||||
if ( !is_subclass_of( $pluginClass, 'Plugin' ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$database = file_get_contents($languageFilename);
|
||||
$database = json_decode($database, true);
|
||||
|
||||
// Set name and description from the language file.
|
||||
$Plugin->setMetadata('name',$database['plugin-data']['name']);
|
||||
$Plugin->setMetadata('description',$database['plugin-data']['description']);
|
||||
|
||||
// Remove name and description, and add new words if there are.
|
||||
unset($database['plugin-data']);
|
||||
if(!empty($database)) {
|
||||
$Language->add($database);
|
||||
}
|
||||
$Plugin = new $pluginClass();
|
||||
|
||||
// Push Plugin to array all plugins installed and not installed.
|
||||
$plugins['all'][$pluginClass] = $Plugin;
|
||||
|
13
bl-kernel/dblanguage.class.php
Normal file → Executable file
13
bl-kernel/dblanguage.class.php
Normal file → Executable file
@ -6,22 +6,24 @@ class dbLanguage extends dbJSON
|
||||
public $db;
|
||||
public $currentLocale;
|
||||
|
||||
function __construct($locale)
|
||||
function __construct( $locale, $path = null )
|
||||
{
|
||||
$path = $path ? $path : PATH_LANGUAGES;
|
||||
|
||||
$this->data = array();
|
||||
$this->db = array();
|
||||
$this->currentLocale = 'en_US';
|
||||
|
||||
// Default language en_US
|
||||
$filename = PATH_LANGUAGES.'en_US.json';
|
||||
$filename = $path.'en_US.json';
|
||||
if( Sanitize::pathFile($filename) )
|
||||
{
|
||||
$Tmp = new dbJSON($filename, false);
|
||||
$this->db = array_merge($this->db, $Tmp->db);
|
||||
$this->db = $Tmp->db;
|
||||
}
|
||||
|
||||
// User language
|
||||
$filename = PATH_LANGUAGES.$locale.'.json';
|
||||
$filename = $path.$locale.'.json';
|
||||
if( Sanitize::pathFile($filename) && ($locale!=="en_US") )
|
||||
{
|
||||
$this->currentLocale = $locale;
|
||||
@ -29,9 +31,12 @@ class dbLanguage extends dbJSON
|
||||
$this->db = array_merge($this->db, $Tmp->db);
|
||||
}
|
||||
|
||||
if ( $this->data )
|
||||
{
|
||||
$this->data = $this->db['language-data'];
|
||||
unset($this->db['language-data']);
|
||||
}
|
||||
}
|
||||
|
||||
public function getCurrentLocale()
|
||||
{
|
||||
|
6
bl-plugins/about/plugin.php
Normal file → Executable file
6
bl-plugins/about/plugin.php
Normal file → Executable file
@ -12,14 +12,12 @@ class pluginAbout extends Plugin {
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $Language;
|
||||
|
||||
$html = '<div>';
|
||||
$html .= '<label>'.$Language->get('Plugin label').'</label>';
|
||||
$html .= '<label>'.$this->L('Plugin label').'</label>';
|
||||
$html .= '<input name="label" id="jslabel" type="text" value="'.$this->getDbField('label').'">';
|
||||
$html .= '</div>';
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$Language->get('About').'</label>';
|
||||
$html .= '<label>'.$this->L('About').'</label>';
|
||||
$html .= '<textarea name="text" id="jstext">'.$this->getDbField('text').'</textarea>';
|
||||
$html .= '</div>';
|
||||
|
||||
|
10
bl-plugins/disqus/plugin.php
Normal file → Executable file
10
bl-plugins/disqus/plugin.php
Normal file → Executable file
@ -36,29 +36,27 @@ class pluginDisqus extends Plugin {
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $Language;
|
||||
|
||||
$html = '<div>';
|
||||
$html .= '<label>'.$Language->get('Disqus shortname').'</label>';
|
||||
$html .= '<label>'.$this->L('Disqus shortname').'</label>';
|
||||
$html .= '<input name="shortname" id="jsshortname" type="text" value="'.$this->getDbField('shortname').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<input type="hidden" name="enablePages" value="0">';
|
||||
$html .= '<input name="enablePages" id="jsenablePages" type="checkbox" value="1" '.($this->getDbField('enablePages')?'checked':'').'>';
|
||||
$html .= '<label class="forCheckbox" for="jsenablePages">'.$Language->get('Enable Disqus on pages').'</label>';
|
||||
$html .= '<label class="forCheckbox" for="jsenablePages">'.$this->L('Enable Disqus on pages').'</label>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<input type="hidden" name="enablePosts" value="0">';
|
||||
$html .= '<input name="enablePosts" id="jsenablePosts" type="checkbox" value="1" '.($this->getDbField('enablePosts')?'checked':'').'>';
|
||||
$html .= '<label class="forCheckbox" for="jsenablePosts">'.$Language->get('Enable Disqus on posts').'</label>';
|
||||
$html .= '<label class="forCheckbox" for="jsenablePosts">'.$this->L('Enable Disqus on posts').'</label>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<input type="hidden" name="enableDefaultHomePage" value="0">';
|
||||
$html .= '<input name="enableDefaultHomePage" id="jsenableDefaultHomePage" type="checkbox" value="1" '.($this->getDbField('enableDefaultHomePage')?'checked':'').'>';
|
||||
$html .= '<label class="forCheckbox" for="jsenableDefaultHomePage">'.$Language->get('Enable Disqus on default home page').'</label>';
|
||||
$html .= '<label class="forCheckbox" for="jsenableDefaultHomePage">'.$this->L('Enable Disqus on default home page').'</label>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
|
10
bl-plugins/googletools/plugin.php
Normal file → Executable file
10
bl-plugins/googletools/plugin.php
Normal file → Executable file
@ -12,18 +12,16 @@ class pluginGoogleTools extends Plugin {
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $Language;
|
||||
|
||||
$html = '<div>';
|
||||
$html .= '<label for="jsgoogle-site-verification">'.$Language->get('Google Webmasters tools').'</label>';
|
||||
$html .= '<label for="jsgoogle-site-verification">'.$this->L('Google Webmasters tools').'</label>';
|
||||
$html .= '<input id="jsgoogle-site-verification" type="text" name="google-site-verification" value="'.$this->getDbField('google-site-verification').'">';
|
||||
$html .= '<div class="tip">'.$Language->get('complete-this-field-with-the-google-site-verification').'</div>';
|
||||
$html .= '<div class="tip">'.$this->L('complete-this-field-with-the-google-site-verification').'</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label for="jstracking-id">'.$Language->get('Google Analytics Tracking ID').'</label>';
|
||||
$html .= '<label for="jstracking-id">'.$this->L('Google Analytics Tracking ID').'</label>';
|
||||
$html .= '<input id="jstracking-id" type="text" name="tracking-id" value="'.$this->getDbField('tracking-id').'">';
|
||||
$html .= '<div class="tip">'.$Language->get('complete-this-field-with-the-tracking-id').'</div>';
|
||||
$html .= '<div class="tip">'.$this->L('complete-this-field-with-the-tracking-id').'</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
|
6
bl-plugins/latest_posts/plugin.php
Normal file → Executable file
6
bl-plugins/latest_posts/plugin.php
Normal file → Executable file
@ -12,15 +12,13 @@ class pluginLatestPosts extends Plugin {
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $Language;
|
||||
|
||||
$html = '<div>';
|
||||
$html .= '<label>'.$Language->get('Plugin label').'</label>';
|
||||
$html .= '<label>'.$this->L('Plugin label').'</label>';
|
||||
$html .= '<input name="label" id="jslabel" type="text" value="'.$this->getDbField('label').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$Language->get('Amount of posts').'</label>';
|
||||
$html .= '<label>'.$this->L('Amount of posts').'</label>';
|
||||
$html .= '<input name="amount" id="jsamount" type="text" value="'.$this->getDbField('amount').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
|
6
bl-plugins/maintenancemode/plugin.php
Normal file → Executable file
6
bl-plugins/maintenancemode/plugin.php
Normal file → Executable file
@ -12,16 +12,14 @@ class pluginMaintenanceMode extends Plugin {
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $Language;
|
||||
|
||||
$html = '<div>';
|
||||
$html .= '<input type="hidden" name="enable" value="0">';
|
||||
$html .= '<input name="enable" id="jsenable" type="checkbox" value="1" '.($this->getDbField('enable')?'checked':'').'>';
|
||||
$html .= '<label class="forCheckbox" for="jsenable">'.$Language->get('Enable maintenance mode').'</label>';
|
||||
$html .= '<label class="forCheckbox" for="jsenable">'.$this->L('Enable maintenance mode').'</label>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$Language->get('Message').'</label>';
|
||||
$html .= '<label>'.$this->L('Message').'</label>';
|
||||
$html .= '<input name="message" id="jsmessage" type="text" value="'.$this->getDbField('message').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
|
9
bl-plugins/pages/plugin.php
Normal file → Executable file
9
bl-plugins/pages/plugin.php
Normal file → Executable file
@ -13,17 +13,15 @@ class pluginPages extends Plugin {
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $Language;
|
||||
|
||||
$html = '<div>';
|
||||
$html .= '<label>'.$Language->get('Plugin label').'</label>';
|
||||
$html .= '<label>'.$this->L('Plugin label').'</label>';
|
||||
$html .= '<input name="label" id="jslabel" type="text" value="'.$this->getDbField('label').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<input type="hidden" name="homeLink" value="0">';
|
||||
$html .= '<input name="homeLink" id="jshomeLink" type="checkbox" value="1" '.($this->getDbField('homeLink')?'checked':'').'>';
|
||||
$html .= '<label class="forCheckbox" for="jshomeLink">'.$Language->get('Show home link').'</label>';
|
||||
$html .= '<label class="forCheckbox" for="jshomeLink">'.$this->L('Show home link').'</label>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
@ -37,7 +35,6 @@ class pluginPages extends Plugin {
|
||||
|
||||
public function siteSidebar()
|
||||
{
|
||||
global $Language;
|
||||
global $pagesParents;
|
||||
global $Site, $Url;
|
||||
|
||||
@ -55,7 +52,7 @@ class pluginPages extends Plugin {
|
||||
// Show home link ?
|
||||
if($this->getDbField('homeLink')) {
|
||||
$html .= '<li>';
|
||||
$html .= '<a class="parent'.( ($Url->whereAmI()=='home')?' active':'').'" href="'.$Site->homeLink().'">'.$Language->get('Home').'</a>';
|
||||
$html .= '<a class="parent'.( ($Url->whereAmI()=='home')?' active':'').'" href="'.$Site->homeLink().'">'.$this->L('Home').'</a>';
|
||||
$html .= '</li>';
|
||||
}
|
||||
|
||||
|
12
bl-plugins/simplemde/plugin.php
Normal file → Executable file
12
bl-plugins/simplemde/plugin.php
Normal file → Executable file
@ -21,22 +21,20 @@ class pluginsimpleMDE extends Plugin {
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $Language;
|
||||
|
||||
$html = '<div>';
|
||||
$html .= '<label>'.$Language->get('Toolbar').'</label>';
|
||||
$html .= '<label>'.$this->L('Toolbar').'</label>';
|
||||
$html .= '<input name="toolbar" id="jstoolbar" type="text" value="'.$this->getDbField('toolbar').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$Language->get('Tab size').'</label>';
|
||||
$html .= '<label>'.$this->L('Tab size').'</label>';
|
||||
$html .= '<input name="tabSize" id="jstabSize" type="text" value="'.$this->getDbField('tabSize').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<input type="hidden" name="autosave" value="0">';
|
||||
$html .= '<input name="autosave" id="jsautosave" type="checkbox" value="1" '.($this->getDbField('autosave')?'checked':'').'>';
|
||||
$html .= '<label class="forCheckbox" for="jsautosave">'.$Language->get('Autosave').'</label>';
|
||||
$html .= '<label class="forCheckbox" for="jsautosave">'.$this->L('Autosave').'</label>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
@ -85,8 +83,6 @@ class pluginsimpleMDE extends Plugin {
|
||||
public function adminBodyEnd()
|
||||
{
|
||||
global $layout;
|
||||
global $Language;
|
||||
|
||||
$html = '';
|
||||
|
||||
// Load CSS and JS only on Controllers in array.
|
||||
@ -119,7 +115,7 @@ class pluginsimpleMDE extends Plugin {
|
||||
|
||||
// This function is necesary on each Editor, it is used by Bludit Images v8.
|
||||
$html .= 'function editorAddImage(filename) {
|
||||
addContentSimpleMDE("");
|
||||
addContentSimpleMDE("");
|
||||
}'.PHP_EOL;
|
||||
|
||||
$html .= '$(document).ready(function() { '.PHP_EOL;
|
||||
|
11
bl-plugins/tags/plugin.php
Normal file → Executable file
11
bl-plugins/tags/plugin.php
Normal file → Executable file
@ -12,23 +12,21 @@ class pluginTags extends Plugin {
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $Language;
|
||||
|
||||
$html = '<div>';
|
||||
$html .= '<label>'.$Language->get('Plugin label').'</label>';
|
||||
$html .= '<label>'.$this->L('Plugin label').'</label>';
|
||||
$html .= '<input name="label" id="jslabel" type="text" value="'.$this->getDbField('label').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= $Language->get('Sort the tag list by').': <select name="sort">';
|
||||
$html .= $this->L('Sort the tag list by').': <select name="sort">';
|
||||
|
||||
foreach(array('alpha' => 'Alphabetical order',
|
||||
'count' => 'Number of times each tag has been used',
|
||||
'date' => 'Date each tag was first used') as $key=>$value) {
|
||||
if ($key == $this->getDbField('sort')) {
|
||||
$html .= '<option value="'.$key.'" selected>'.$Language->get($value).'</option>';
|
||||
$html .= '<option value="'.$key.'" selected>'.$this->L($value).'</option>';
|
||||
} else {
|
||||
$html .= '<option value="'.$key.'">'.$Language->get($value).'</option>';
|
||||
$html .= '<option value="'.$key.'">'.$this->L($value).'</option>';
|
||||
}
|
||||
}
|
||||
$html .= '</select>';
|
||||
@ -39,7 +37,6 @@ class pluginTags extends Plugin {
|
||||
|
||||
public function siteSidebar()
|
||||
{
|
||||
global $Language;
|
||||
global $dbTags;
|
||||
global $Url;
|
||||
|
||||
|
@ -4,6 +4,12 @@
|
||||
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
|
||||
*/
|
||||
|
||||
$( window ).on( 'load', function() {
|
||||
setTimeout( function() {
|
||||
$('body').removeClass('is-loading');
|
||||
})
|
||||
});
|
||||
|
||||
(function($) {
|
||||
|
||||
skel.breakpoints({
|
||||
@ -25,12 +31,6 @@
|
||||
// Disable animations/transitions until the page has loaded.
|
||||
$body.addClass('is-loading');
|
||||
|
||||
$window.on('load', function() {
|
||||
window.setTimeout(function() {
|
||||
$body.removeClass('is-loading');
|
||||
}, 100);
|
||||
});
|
||||
|
||||
// Fix: Placeholder polyfill.
|
||||
$('form').placeholder();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user