Cleaning code

This commit is contained in:
Diego Najar 2017-09-15 21:26:06 +02:00
parent 1389b74493
commit d64c44520d
8 changed files with 22 additions and 111 deletions

View File

@ -11,7 +11,7 @@ $layout = array(
// Get the view, controller, and the parameters from the URL. // Get the view, controller, and the parameters from the URL.
$explodeSlug = $Url->explodeSlug(); $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]); unset($explodeSlug[0]);
$layout['parameters'] = implode('/', $explodeSlug); $layout['parameters'] = implode('/', $explodeSlug);

View File

@ -3,8 +3,8 @@
// Bludit version // Bludit version
define('BLUDIT_VERSION', '2.0'); define('BLUDIT_VERSION', '2.0');
define('BLUDIT_CODENAME', ''); define('BLUDIT_CODENAME', '');
define('BLUDIT_RELEASE_DATE', '2017-09-11'); define('BLUDIT_RELEASE_DATE', '2017-09-15');
define('BLUDIT_BUILD', '20170911'); define('BLUDIT_BUILD', '20170915');
// Debug mode // Debug mode
// Change to FALSE, for prevent warning or errors on browser // Change to FALSE, for prevent warning or errors on browser

View File

@ -32,10 +32,12 @@ class dbLanguage extends dbJSON
unset($this->db['language-data']); unset($this->db['language-data']);
} }
/*
public function exists($key) public function exists($key)
{ {
return isset( $this->db[$key] ); return isset( $this->db[$key] );
} }
*/
public function locale() public function locale()
{ {
@ -92,6 +94,7 @@ class dbLanguage extends dbJSON
$this->db = array_merge($array, $this->db); $this->db = array_merge($array, $this->db);
} }
/*
// Returns the item from language-data // Returns the item from language-data
public function getData($key) public function getData($key)
{ {
@ -101,6 +104,7 @@ class dbLanguage extends dbJSON
return false; return false;
} }
*/
// Returns an array with all dictionaries // Returns an array with all dictionaries
public function getLanguageList() public function getLanguageList()

View File

@ -244,12 +244,12 @@ class dbPages extends dbJSON
return false; return false;
} }
/* DEPRECATED
public function setStatus($key, $value) public function setStatus($key, $value)
{ {
return $this->setField($key, 'status', $value); return $this->setField($key, 'status', $value);
} }
*/
// Returns a database with published pages // Returns a database with published pages
public function getPublishedDB() public function getPublishedDB()
{ {
@ -606,29 +606,33 @@ class dbPages extends dbJSON
return Text::firstCharUp($field).': '.$value; return Text::firstCharUp($field).': '.$value;
} }
/* DEPRECATED
public function getDBFields() public function getDBFields()
{ {
return $this->dbFields; return $this->dbFields;
} }
*/
// ----- OLD /* DEPRECATED
public function parentKeyList() public function parentKeyList()
{ {
return $this->parentKeyList; return $this->parentKeyList;
} }
*/
/* DEPRECATED
public function parentKeyExists($key) public function parentKeyExists($key)
{ {
return isset( $this->parentKeyList[$key] ); return isset( $this->parentKeyList[$key] );
} }
*/
/* DEPRECATED
public function addParentKey($key) public function addParentKey($key)
{ {
$this->parentKeyList[$key] = $key; $this->parentKeyList[$key] = $key;
} }
*/
// Returns the database // Returns the database
public function getDB() public function getDB()

View File

@ -77,30 +77,6 @@ class dbSite extends dbJSON
return $filters[$filter]; 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 // Returns the URL of the rss.xml file
// You need to have enabled the plugin RSS // You need to have enabled the plugin RSS
public function rss() public function rss()
@ -145,21 +121,6 @@ class dbSite extends dbJSON
return $this->getField('orderBy'); 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 // Returns the site title
public function title() public function title()
{ {
@ -242,12 +203,13 @@ class dbSite extends dbJSON
return $parse['scheme'].'://'.$domain; return $parse['scheme'].'://'.$domain;
} }
/* DEPRECATED
// Returns the relative home link // Returns the relative home link
public function homeLink() public function homeLink()
{ {
return HTML_PATH_ROOT; return HTML_PATH_ROOT;
} }
*/
// Returns the timezone. // Returns the timezone.
public function timezone() public function timezone()
{ {
@ -278,7 +240,8 @@ class dbSite extends dbJSON
return $this->getField('locale'); return $this->getField('locale');
} }
// Returns the current language in short format. /* DEPRECATED
// Returns the current language in short format
public function shortLanguage() public function shortLanguage()
{ {
$locale = $this->locale(); $locale = $this->locale();
@ -287,7 +250,7 @@ class dbSite extends dbJSON
return $short; return $short;
} }
*/
// Returns the current homepage, FALSE if not defined homepage // Returns the current homepage, FALSE if not defined homepage
public function homepage() public function homepage()
{ {

View File

@ -63,6 +63,4 @@ class dbSyslog extends dbJSON
// Save // Save
return $this->save(); return $this->save();
} }
} }

View File

@ -1,18 +0,0 @@
<?php
$string = file_get_contents("bl-languages/en.json");
$english = json_decode($string, true);
$string = file_get_contents("bl-languages/zh_TW.json");
$spanish = json_decode($string, true);
$tmp = array();
foreach($english as $key=>$value) {
if (isset($spanish[$key])) {
$tmp[$key] = $spanish[$key];
} else {
$tmp[$key] = $value;
}
}
echo json_encode($tmp, JSON_UNESCAPED_UNICODE);

View File

@ -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