From d64c44520d15fdc96262cefbf9ff504c93b8d9da Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Fri, 15 Sep 2017 21:26:06 +0200 Subject: [PATCH] Cleaning code --- bl-kernel/boot/admin.php | 2 +- bl-kernel/boot/init.php | 4 +-- bl-kernel/dblanguage.class.php | 4 +++ bl-kernel/dbpages.class.php | 16 +++++++----- bl-kernel/dbsite.class.php | 47 ++++------------------------------ bl-kernel/dbsyslog.class.php | 2 -- lang.php | 18 ------------- search.sh | 40 ----------------------------- 8 files changed, 22 insertions(+), 111 deletions(-) delete mode 100644 lang.php delete mode 100755 search.sh diff --git a/bl-kernel/boot/admin.php b/bl-kernel/boot/admin.php index ee574961..2bab68fb 100644 --- a/bl-kernel/boot/admin.php +++ b/bl-kernel/boot/admin.php @@ -11,7 +11,7 @@ $layout = array( // Get the view, controller, and the parameters from the URL. $explodeSlug = $Url->explodeSlug(); -$layout['controller'] = $layout['view'] = $layout['slug'] = $explodeSlug[0]; +$layout['controller'] = $layout['view'] = $layout['slug'] = empty($explodeSlug[0])?'dashboard':$explodeSlug[0]; unset($explodeSlug[0]); $layout['parameters'] = implode('/', $explodeSlug); diff --git a/bl-kernel/boot/init.php b/bl-kernel/boot/init.php index a90fde60..2100e535 100644 --- a/bl-kernel/boot/init.php +++ b/bl-kernel/boot/init.php @@ -3,8 +3,8 @@ // Bludit version define('BLUDIT_VERSION', '2.0'); define('BLUDIT_CODENAME', ''); -define('BLUDIT_RELEASE_DATE', '2017-09-11'); -define('BLUDIT_BUILD', '20170911'); +define('BLUDIT_RELEASE_DATE', '2017-09-15'); +define('BLUDIT_BUILD', '20170915'); // Debug mode // Change to FALSE, for prevent warning or errors on browser diff --git a/bl-kernel/dblanguage.class.php b/bl-kernel/dblanguage.class.php index e73c32fb..206f443a 100644 --- a/bl-kernel/dblanguage.class.php +++ b/bl-kernel/dblanguage.class.php @@ -32,10 +32,12 @@ class dbLanguage extends dbJSON unset($this->db['language-data']); } + /* public function exists($key) { return isset( $this->db[$key] ); } + */ public function locale() { @@ -92,6 +94,7 @@ class dbLanguage extends dbJSON $this->db = array_merge($array, $this->db); } + /* // Returns the item from language-data public function getData($key) { @@ -101,6 +104,7 @@ class dbLanguage extends dbJSON return false; } + */ // Returns an array with all dictionaries public function getLanguageList() diff --git a/bl-kernel/dbpages.class.php b/bl-kernel/dbpages.class.php index 5ad11019..075c7730 100644 --- a/bl-kernel/dbpages.class.php +++ b/bl-kernel/dbpages.class.php @@ -244,12 +244,12 @@ class dbPages extends dbJSON return false; } - +/* DEPRECATED public function setStatus($key, $value) { return $this->setField($key, 'status', $value); } - +*/ // Returns a database with published pages public function getPublishedDB() { @@ -606,29 +606,33 @@ class dbPages extends dbJSON return Text::firstCharUp($field).': '.$value; } +/* DEPRECATED public function getDBFields() { return $this->dbFields; } +*/ -// ----- OLD - +/* DEPRECATED public function parentKeyList() { return $this->parentKeyList; } +*/ +/* DEPRECATED public function parentKeyExists($key) { return isset( $this->parentKeyList[$key] ); } +*/ +/* DEPRECATED public function addParentKey($key) { $this->parentKeyList[$key] = $key; } - - +*/ // Returns the database public function getDB() diff --git a/bl-kernel/dbsite.class.php b/bl-kernel/dbsite.class.php index f6078e24..af0818b4 100644 --- a/bl-kernel/dbsite.class.php +++ b/bl-kernel/dbsite.class.php @@ -77,30 +77,6 @@ class dbSite extends dbJSON return $filters[$filter]; } - public function urlPage() - { - $filter = $this->getField('uriPage'); - return $this->url().ltrim($filter, '/'); - } - - public function urlTag() - { - $filter = $this->getField('uriTag'); - return $this->url().ltrim($filter, '/'); - } - - public function urlCategory() - { - $filter = $this->getField('uriCategory'); - return $this->url().ltrim($filter, '/'); - } - - public function urlBlog() - { - $filter = $this->getField('uriBlog'); - return $this->url().ltrim($filter, '/'); - } - // Returns the URL of the rss.xml file // You need to have enabled the plugin RSS public function rss() @@ -145,21 +121,6 @@ class dbSite extends dbJSON return $this->getField('orderBy'); } - public function pageError() - { - return $this->getField('pageError'); - } - - public function pageAbout() - { - return $this->getField('pageAbout'); - } - - public function pageContact() - { - return $this->getField('pageContact'); - } - // Returns the site title public function title() { @@ -242,12 +203,13 @@ class dbSite extends dbJSON return $parse['scheme'].'://'.$domain; } +/* DEPRECATED // Returns the relative home link public function homeLink() { return HTML_PATH_ROOT; } - +*/ // Returns the timezone. public function timezone() { @@ -278,7 +240,8 @@ class dbSite extends dbJSON return $this->getField('locale'); } - // Returns the current language in short format. +/* DEPRECATED + // Returns the current language in short format public function shortLanguage() { $locale = $this->locale(); @@ -287,7 +250,7 @@ class dbSite extends dbJSON return $short; } - +*/ // Returns the current homepage, FALSE if not defined homepage public function homepage() { diff --git a/bl-kernel/dbsyslog.class.php b/bl-kernel/dbsyslog.class.php index 7d9fc99c..bb486139 100644 --- a/bl-kernel/dbsyslog.class.php +++ b/bl-kernel/dbsyslog.class.php @@ -63,6 +63,4 @@ class dbSyslog extends dbJSON // Save return $this->save(); } - - } \ No newline at end of file diff --git a/lang.php b/lang.php deleted file mode 100644 index 1b5a9ae9..00000000 --- a/lang.php +++ /dev/null @@ -1,18 +0,0 @@ -$value) { - if (isset($spanish[$key])) { - $tmp[$key] = $spanish[$key]; - } else { - $tmp[$key] = $value; - } -} - -echo json_encode($tmp, JSON_UNESCAPED_UNICODE); \ No newline at end of file diff --git a/search.sh b/search.sh deleted file mode 100755 index 1c08ee18..00000000 --- a/search.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# Execute this script in the root directory of the project -# Ex: /search.sh bl-kernel/dbpages.class.php - -CLASS_FILENAME=$1 - -echo "Class name" -CLASS_NAME=`grep "class " $CLASS_FILENAME | awk '{print $2}' | xargs` - -echo "Search Object" -OBJECT_NAME=`find -name "*.php" -exec grep "new $CLASS_NAME" {} \; | awk '{print $1}' | xargs` - -echo "List of methods" -grep "public function" $CLASS_FILENAME | awk '{print $3}' | tr "(" " " | awk '{print $1}' > /tmp/methods.list - -while read -r METHOD -do - echo "" - echo "-------------------------------------" - echo "Searching for $CLASS_NAME->$METHOD(" - echo "-------------------------------------" - - grep -r -w "$CLASS_NAME->$METHOD(" * - let STATUS=$? - if [ $STATUS -eq 1 ] - then - echo "Searching for this->$METHOD( inside $CLASS_FILENAME" - echo "-------------------------------------" - - grep -r -w "this->$METHOD(" $CLASS_FILENAME - let STATUS=$? - if [ $STATUS -eq 1 ] - then - echo "Not found" - fi - fi - - echo "-------------------------------------" - -done < /tmp/methods.list \ No newline at end of file