Plugins and themes compatibility

This commit is contained in:
dignajar 2016-06-19 21:45:09 -03:00
parent b5d2d44769
commit 6dacbdbd54
5 changed files with 38 additions and 16 deletions

View File

@ -170,6 +170,13 @@ class Plugin {
return $this->className;
}
public function isCompatible()
{
$explode = explode(',', $this->getMetadata('compatible'));
return in_array(BLUDIT_VERSION, $explode);
}
public function directoryName()
{
return $this->directoryName;

View File

@ -282,14 +282,14 @@ table.statistics tr:last-child td {
/* ----------- ALERT ----------- */
#alert {
bottom: 0;
color: #ffffff;
display: none;
padding: 10px;
display: none;
position: fixed;
text-align: center;
top: 0;
width: 100%;
z-index: 100;
right: 0;
}
.alert-ok {

View File

@ -1,7 +1,7 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// Bludit version
define('BLUDIT_VERSION', 'Github-Version');
define('BLUDIT_VERSION', '1.3');
define('BLUDIT_CODENAME', '');
define('BLUDIT_RELEASE_DATE', '');
define('BLUDIT_BUILD', '');
@ -115,7 +115,7 @@ define('TOKEN_EMAIL_TTL', '+15 minutes');
define('CHARSET', 'UTF-8');
// EXTREME FRIENDLY URL, TRUE for dissmiss internet standard
define('EXTREME_FRIENDLY_URL', true);
define('EXTREME_FRIENDLY_URL', false);
// Directory permissions
define('DIR_PERMISSIONS', 0755);

View File

@ -96,16 +96,20 @@ function buildPlugins()
$Language->add($database);
}
// Push Plugin to array all plugins installed and not installed.
$plugins['all'][$pluginClass] = $Plugin;
// If the plugin is compatible with the Bludit version, add to arrays
if($Plugin->isCompatible()) {
// If the plugin is installed, order by hooks.
if($Plugin->installed())
{
foreach($pluginsEvents as $event=>$value)
{
if(method_exists($Plugin, $event)) {
array_push($plugins[$event], $Plugin);
// Push Plugin to array all plugins installed and not installed.
$plugins['all'][$pluginClass] = $Plugin;
// If the plugin is installed, order by hooks.
if($Plugin->installed()) {
foreach($pluginsEvents as $event=>$value) {
if(method_exists($Plugin, $event)) {
array_push($plugins[$event], $Plugin);
}
}
}
}

View File

@ -48,9 +48,20 @@ function buildThemes()
break;
}
$database = $database + $metadata;
// Check if the theme is compatible
if(empty($metadata['compatible'])) {
Log::set('99.themes.php'.LOG_SEP.'Metadata error, field compatible invalid '.$themePath);
break;
}
$explode = explode(',', $metadata['compatible']);
if(!in_array(BLUDIT_VERSION, $explode)) {
Log::set('99.themes.php'.LOG_SEP.'Theme incompatible '.$themePath);
break;
}
// Theme data
$database = $database + $metadata;
array_push($themes, $database);
}
}
@ -81,4 +92,4 @@ if( Sanitize::pathFile($languageFilename) )
if(!empty($database)) {
$Language->add($database);
}
}
}