diff --git a/bl-kernel/abstract/dblist.class.php b/bl-kernel/abstract/dblist.class.php
index 1e45d5ce..1e7110b0 100644
--- a/bl-kernel/abstract/dblist.class.php
+++ b/bl-kernel/abstract/dblist.class.php
@@ -28,6 +28,11 @@ class dbList extends dbJSON
parent::__construct($file);
}
+ public function keys()
+ {
+ return array_keys($this->db);
+ }
+
// Returns the list of keys filter by pageNumber
public function getList($key, $pageNumber, $amountOfItems)
{
diff --git a/bl-kernel/abstract/plugin.class.php b/bl-kernel/abstract/plugin.class.php
index 54332283..fe6e74fb 100644
--- a/bl-kernel/abstract/plugin.class.php
+++ b/bl-kernel/abstract/plugin.class.php
@@ -65,23 +65,6 @@ class Plugin {
}
}
- // DEPRECATED
- // 2017-06-19
- public function setDb($args)
- {
- foreach($this->dbFields as $key=>$value) {
- if( isset($args[$key]) ) {
- $value = Sanitize::html( $args[$key] );
- if($value==='false') { $value = false; }
- elseif($value==='true') { $value = true; }
- settype($value, gettype($this->dbFields[$key]));
- $this->db[$key] = $value;
- }
- }
-
- $this->save();
- }
-
public function save()
{
$tmp = new dbJSON($this->filenameDb);
@@ -152,25 +135,6 @@ class Plugin {
return false;
}
- // DEPRECATED
- // 2017-06-16
- public function getDbField($key, $html=true)
- {
- if(isset($this->db[$key])) {
-
- if($html) {
- // All fields from DBField are sanitized.
- return $this->db[$key];
- }
- else {
- // Decode HTML tags, this action unsanitized the variable.
- return Sanitize::htmlDecode($this->db[$key]);
- }
- }
-
- return '';
- }
-
public function label()
{
return $this->getMetadata('label');
diff --git a/bl-kernel/admin/controllers/edit-category.php b/bl-kernel/admin/controllers/edit-category.php
index 08034eaf..ed1e21ee 100644
--- a/bl-kernel/admin/controllers/edit-category.php
+++ b/bl-kernel/admin/controllers/edit-category.php
@@ -33,12 +33,12 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// ============================================================================
$categoryKey = $layout['parameters'];
-if (!$dbCategories->exists($categoryKey)) {
+if (!$categories->exists($categoryKey)) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the category: '.$categoryKey);
Redirect::page('categories');
}
-$categoryMap = $dbCategories->getMap($categoryKey);
+$categoryMap = $categories->getMap($categoryKey);
// Title of the page
$layout['title'] .= ' - '.$Language->g('Edit Category').' [ '.$categoryMap['name'] . ' ] ';
\ No newline at end of file
diff --git a/bl-kernel/admin/views/categories.php b/bl-kernel/admin/views/categories.php
index 03eee457..c74922ff 100644
--- a/bl-kernel/admin/views/categories.php
+++ b/bl-kernel/admin/views/categories.php
@@ -19,11 +19,11 @@ echo '
';
-$categories = $dbCategories->getKeyNameArray();
-foreach ($categories as $categoryKey=>$category) {
+foreach ($categories->keys() as $key) {
+ $category = new Category($key);
echo '';
- echo ''.$category.' ';
- echo ''.$url->filters('category', false).$categoryKey.' ';
+ echo ''.$category->name().' ';
+ echo ''.$url->filters('category', false).$key.' ';
echo ' ';
}
diff --git a/bl-kernel/admin/views/edit-content.php b/bl-kernel/admin/views/edit-content.php
index 2d943e05..d6309532 100644
--- a/bl-kernel/admin/views/edit-content.php
+++ b/bl-kernel/admin/views/edit-content.php
@@ -296,7 +296,7 @@
'selected'=>$page->categoryKey(),
'class'=>'',
'emptyOption'=>'- Uncategorized -',
- 'options'=>$dbCategories->getKeyNameArray()
+ 'options'=>$categories->getKeyNameArray()
));
?>
diff --git a/bl-kernel/admin/views/new-content.php b/bl-kernel/admin/views/new-content.php
index efe00c80..4ab9c107 100644
--- a/bl-kernel/admin/views/new-content.php
+++ b/bl-kernel/admin/views/new-content.php
@@ -230,7 +230,7 @@
'selected'=>'',
'class'=>'',
'emptyOption'=>'- Uncategorized -',
- 'options'=>$dbCategories->getKeyNameArray()
+ 'options'=>$categories->getKeyNameArray()
));
?>
diff --git a/bl-kernel/boot/init.php b/bl-kernel/boot/init.php
index 6ff93f31..9c5263c4 100644
--- a/bl-kernel/boot/init.php
+++ b/bl-kernel/boot/init.php
@@ -121,9 +121,9 @@ if (file_exists(PATH_KERNEL.'bludit.pro.php')) {
// Objects
$pages = $dbPages = new dbPages(); // DEPRECATED v3.0.0 $dbPages
-$dbUsers = new dbUsers();
-$dbTags = new dbTags();
-$dbCategories = new dbCategories();
+$users = $dbUsers = new dbUsers(); // DEPRECATED v3.0.0 $dbUsers
+$tags = $dbTags = new dbTags(); // DEPRECATED v3.0.0 $dbTags
+$categories = $dbCategories = new dbCategories(); // DEPRECATED v3.0.0 $dbCategories
$site = new dbSite();
$url = new Url();
$security = new Security();
diff --git a/bl-kernel/boot/rules/99.paginator.php b/bl-kernel/boot/rules/99.paginator.php
index 39a3979b..d7665c2f 100644
--- a/bl-kernel/boot/rules/99.paginator.php
+++ b/bl-kernel/boot/rules/99.paginator.php
@@ -11,12 +11,12 @@ if($url->whereAmI()=='admin') {
elseif($url->whereAmI()=='tag') {
$itemsPerPage = $site->itemsPerPage();
$tagKey = $url->slug();
- $amountOfItems = $dbTags->countPagesByTag($tagKey);
+ $amountOfItems = $tags->countPagesByTag($tagKey);
}
elseif($url->whereAmI()=='category') {
$itemsPerPage = $site->itemsPerPage();
$categoryKey = $url->slug();
- $amountOfItems = $dbCategories->countPagesByCategory($categoryKey);
+ $amountOfItems = $categories->countPagesByCategory($categoryKey);
}
else {
$itemsPerPage = $site->itemsPerPage();
diff --git a/bl-kernel/category.class.php b/bl-kernel/category.class.php
index f8c8246d..f60411bc 100644
--- a/bl-kernel/category.class.php
+++ b/bl-kernel/category.class.php
@@ -6,14 +6,14 @@ class Category {
function __construct($key)
{
- global $dbCategories;
- if (isset($dbCategories->db[$key])) {
- $this->vars['name'] = $dbCategories->db[$key]['name'];
- $this->vars['template'] = $dbCategories->db[$key]['template'];
- $this->vars['description'] = $dbCategories->db[$key]['description'];
+ global $categories;
+ if (isset($categories->db[$key])) {
+ $this->vars['name'] = $categories->db[$key]['name'];
+ $this->vars['template'] = $categories->db[$key]['template'];
+ $this->vars['description'] = $categories->db[$key]['description'];
$this->vars['key'] = $key;
$this->vars['permalink'] = DOMAIN_CATEGORIES . $key;
- $this->vars['list'] = $dbCategories->db[$key]['list'];
+ $this->vars['list'] = $categories->db[$key]['list'];
} else {
$errorMessage = 'Category not found in database by key ['.$key.']';
Log::set(__METHOD__.LOG_SEP.$errorMessage);
diff --git a/bl-kernel/functions.php b/bl-kernel/functions.php
index 950d36c2..dd817b0f 100644
--- a/bl-kernel/functions.php
+++ b/bl-kernel/functions.php
@@ -3,15 +3,15 @@
// Re-index database of categories
// If you create/edit/remove a page is necessary regenerate the database of categories
function reindexCategories() {
- global $dbCategories;
- return $dbCategories->reindex();
+ global $categories;
+ return $categories->reindex();
}
// Re-index database of tags
// If you create/edit/remove a page is necessary regenerate the database of tags
function reindexTags() {
- global $dbTags;
- return $dbTags->reindex();
+ global $tags;
+ return $tags->reindex();
}
// Generate the page 404 Not found
@@ -81,8 +81,8 @@ function buildPagesByTag() {
// This function is use for buildPagesForHome(), buildPagesByCategory(), buildPagesByTag()
function buildPagesFor($for, $categoryKey=false, $tagKey=false) {
global $dbPages;
- global $dbCategories;
- global $dbTags;
+ global $categories;
+ global $tags;
global $site;
global $url;
@@ -102,11 +102,11 @@ function buildPagesFor($for, $categoryKey=false, $tagKey=false) {
}
elseif ($for=='category') {
$amountOfItems = $site->itemsPerPage();
- $list = $dbCategories->getList($categoryKey, $pageNumber, $amountOfItems);
+ $list = $categories->getList($categoryKey, $pageNumber, $amountOfItems);
}
elseif ($for=='tag') {
$amountOfItems = $site->itemsPerPage();
- $list = $dbTags->getList($tagKey, $pageNumber, $amountOfItems);
+ $list = $tags->getList($tagKey, $pageNumber, $amountOfItems);
}
// There are not items, invalid tag, invalid category, out of range, etc...
@@ -185,12 +185,6 @@ function getPlugin($pluginClassName) {
return false;
}
-// DEPRACTED
-// Returns TRUE if the plugin is enabled and installed, FALSE otherwise
-function pluginEnabled($pluginClassName) {
- return pluginActivated($pluginClassName);
-}
-
// Returns TRUE if the plugin is activaed / installed, FALSE otherwise
function pluginActivated($pluginClassName) {
global $plugins;
@@ -670,7 +664,7 @@ function checkRole($allowRoles, $redirect=true) {
// Add a new category to the system
// Returns TRUE is successfully added, FALSE otherwise
function createCategory($category) {
- global $dbCategories;
+ global $categories;
global $Language;
global $syslog;
@@ -679,7 +673,7 @@ function createCategory($category) {
return false;
}
- if ($dbCategories->add(array('name'=>$category))) {
+ if ($categories->add(array('name'=>$category))) {
// Add to syslog
$syslog->add(array(
'dictionaryKey'=>'new-category-created',
@@ -697,7 +691,7 @@ function createCategory($category) {
function editCategory($args) {
global $Language;
global $dbPages;
- global $dbCategories;
+ global $categories;
global $syslog;
if (Text::isEmpty($args['name']) || Text::isEmpty($args['newKey']) ) {
@@ -705,7 +699,7 @@ function editCategory($args) {
return false;
}
- $newCategoryKey = $dbCategories->edit($args);
+ $newCategoryKey = $categories->edit($args);
if ($newCategoryKey==false) {
Alert::set($Language->g('The category already exists'));
@@ -727,11 +721,11 @@ function editCategory($args) {
function deleteCategory($args) {
global $Language;
- global $dbCategories;
+ global $categories;
global $syslog;
// Remove the category by key
- $dbCategories->remove($args['oldKey']);
+ $categories->remove($args['oldKey']);
// Remove the category from the pages ? or keep it if the user want to recovery the category ?
@@ -748,10 +742,10 @@ function deleteCategory($args) {
// Returns an array with all the categories
// By default, the database of categories is alphanumeric sorted
function getCategories() {
- global $dbCategories;
+ global $categories;
$list = array();
- foreach ($dbCategories->db as $key=>$fields) {
+ foreach ($categories->keys() as $key) {
$category = new Category($key);
array_push($list, $category);
}
@@ -771,10 +765,10 @@ function getCategory($key) {
// Returns an array with all the tags
// By default, the database of tags is alphanumeric sorted
function getTags() {
- global $dbTags;
+ global $tags;
$list = array();
- foreach ($dbTags->db as $key=>$fields) {
+ foreach ($tags->db as $key=>$fields) {
$tag = new Tag($key);
array_push($list, $tag);
}
diff --git a/bl-kernel/helpers/theme.class.php b/bl-kernel/helpers/theme.class.php
index cc71ea77..60bf1099 100644
--- a/bl-kernel/helpers/theme.class.php
+++ b/bl-kernel/helpers/theme.class.php
@@ -66,8 +66,8 @@ class Theme {
{
global $url;
global $site;
- global $dbTags;
- global $dbCategories;
+ global $tags;
+ global $categories;
global $WHERE_AM_I;
global $page;
@@ -110,6 +110,7 @@ class Theme {
global $site;
global $WHERE_AM_I;
global $page;
+ global $url;
$description = $site->description();
diff --git a/bl-kernel/pagex.class.php b/bl-kernel/pagex.class.php
index 3ffee1fd..8ac78724 100644
--- a/bl-kernel/pagex.class.php
+++ b/bl-kernel/pagex.class.php
@@ -190,9 +190,9 @@ class Page {
// categoryMap = array( 'name'=>'', 'list'=>array() )
public function categoryMap($field)
{
- global $dbCategories;
+ global $categories;
$categoryKey = $this->categoryKey();
- $map = $dbCategories->getMap($categoryKey);
+ $map = $categories->getMap($categoryKey);
if ($field=='key') {
return $this->categoryKey();
diff --git a/bl-kernel/tag.class.php b/bl-kernel/tag.class.php
index 5d9f148d..438818dd 100644
--- a/bl-kernel/tag.class.php
+++ b/bl-kernel/tag.class.php
@@ -6,14 +6,14 @@ class Tag {
function __construct($key)
{
- global $dbTags;
- if (isset($dbTags->db[$key])) {
- $this->vars['name'] = $dbTags->db[$key]['name'];
- $this->vars['template'] = $dbTags->db[$key]['template'];
- $this->vars['description'] = $dbTags->db[$key]['description'];
+ global $tags;
+ if (isset($tags->db[$key])) {
+ $this->vars['name'] = $tags->db[$key]['name'];
+ $this->vars['template'] = $tags->db[$key]['template'];
+ $this->vars['description'] = $tags->db[$key]['description'];
$this->vars['key'] = $key;
$this->vars['permalink'] = DOMAIN_TAGS . $key;
- $this->vars['list'] = $dbTags->db[$key]['list'];
+ $this->vars['list'] = $tags->db[$key]['list'];
} else {
$errorMessage = 'Category not found in database by key ['.$key.']';
Log::set(__METHOD__.LOG_SEP.$errorMessage);
diff --git a/bl-plugins/categories/plugin.php b/bl-plugins/categories/plugin.php
index 828d4e53..333edfe2 100644
--- a/bl-plugins/categories/plugin.php
+++ b/bl-plugins/categories/plugin.php
@@ -41,7 +41,7 @@ class pluginCategories extends Plugin {
public function siteSidebar()
{
global $Language;
- global $dbCategories;
+ global $categories;
// HTML for sidebar
$html = '';
@@ -50,7 +50,7 @@ class pluginCategories extends Plugin {
$html .= '
';
// By default the database of categories are alphanumeric sorted
- foreach ($dbCategories->db as $key=>$fields) {
+ foreach ($categories->db as $key=>$fields) {
$count = count($fields['list']);
if (!$this->getValue('hideCero') || $count>0) {
$html .= '';
diff --git a/bl-plugins/disqus/plugin.php b/bl-plugins/disqus/plugin.php
index fbe20198..7bd93e76 100644
--- a/bl-plugins/disqus/plugin.php
+++ b/bl-plugins/disqus/plugin.php
@@ -54,8 +54,8 @@ class pluginDisqus extends Plugin {
if ( !$url->notFound() &&
( $url->whereAmI()=='page' &&
- (($this->getDbField('enablePosts') && $page->published()) ||
- ($this->getDbField('enablePages') && $page->static()))
+ (($this->getValue('enablePosts') && $page->published()) ||
+ ($this->getValue('enablePages') && $page->static()))
) &&
$page->allowComments() ) {
$html = '';
diff --git a/bl-plugins/maintenance-mode/plugin.php b/bl-plugins/maintenance-mode/plugin.php
index e8414a33..221c2a4d 100644
--- a/bl-plugins/maintenance-mode/plugin.php
+++ b/bl-plugins/maintenance-mode/plugin.php
@@ -28,7 +28,7 @@ class pluginMaintenanceMode extends Plugin {
$html .= '';
$html .= ''.$Language->get('Message').' ';
- $html .= ' ';
+ $html .= ' ';
$html .= '
';
return $html;
@@ -36,8 +36,8 @@ class pluginMaintenanceMode extends Plugin {
public function beforeAll()
{
- if ($this->getDbField('enable')) {
- exit( $this->getDbField('message') );
+ if ($this->getValue('enable')) {
+ exit( $this->getValue('message') );
}
}
}
\ No newline at end of file
diff --git a/bl-plugins/simplemde/plugin.php b/bl-plugins/simplemde/plugin.php
index b101fe1e..a9624bd1 100644
--- a/bl-plugins/simplemde/plugin.php
+++ b/bl-plugins/simplemde/plugin.php
@@ -22,12 +22,12 @@ class pluginsimpleMDE extends Plugin {
$html = '';
$html .= ''.$Language->get('toolbar').' ';
- $html .= ' ';
+ $html .= ' ';
$html .= '
';
$html .= '';
$html .= ''.$Language->get('tab-size').' ';
- $html .= ' ';
+ $html .= ' ';
$html .= '
';
$html .= '';
@@ -62,7 +62,7 @@ class pluginsimpleMDE extends Plugin {
}
// Spell Checker
- $spellCheckerEnable = $this->getDbField('spellChecker')?'true':'false';
+ $spellCheckerEnable = $this->getValue('spellChecker')?'true':'false';
// Include plugin's Javascript files
$html = $this->includeJS('simplemde.min.js');
@@ -100,9 +100,9 @@ class pluginsimpleMDE extends Plugin {
lineWrapping: true,
autoDownloadFontAwesome: false,
indentWithTabs: true,
- tabSize: '.$this->getDbField('tabSize').',
+ tabSize: '.$this->getValue('tabSize').',
spellChecker: '.$spellCheckerEnable.',
- toolbar: ['.Sanitize::htmlDecode($this->getDbField('toolbar')).',
+ toolbar: ['.Sanitize::htmlDecode($this->getValue('toolbar')).',
"|",
{
name: "pageBreak",
diff --git a/bl-plugins/tags/plugin.php b/bl-plugins/tags/plugin.php
index b260d184..b518d1c8 100644
--- a/bl-plugins/tags/plugin.php
+++ b/bl-plugins/tags/plugin.php
@@ -29,18 +29,18 @@ class pluginTags extends Plugin {
public function siteSidebar()
{
global $Language;
- global $dbTags;
+ global $tags;
global $url;
$filter = $url->filters('tag');
$html = '