diff --git a/bl-kernel/admin/views/pages.php b/bl-kernel/admin/views/pages.php index 27f926a7..bdd603ad 100644 --- a/bl-kernel/admin/views/pages.php +++ b/bl-kernel/admin/views/pages.php @@ -24,6 +24,8 @@ echo ' function table($status, $icon='arrow-circle-o-down') { global $pages; global $Url; + global $Language; + $showLegend = true; foreach ($pages as $key=>$page) { if ($page->status()==$status) { diff --git a/bl-kernel/dbpages.class.php b/bl-kernel/dbpages.class.php index 73c04db4..a91f07c1 100644 --- a/bl-kernel/dbpages.class.php +++ b/bl-kernel/dbpages.class.php @@ -31,20 +31,12 @@ class dbPages extends dbJSON { $dataForDb = array(); // This data will be saved in the database $dataForFile = array(); // This data will be saved in the file - - // Generate title if empty - if( empty($args['title']) ) { - $args['title'] = Text::truncate($args['content'], 60); - - // Assign the new title to the slug as well. - $args['slug'] = $args['title']; + + // Generate slug from content if the title is empty + if (empty($args['title'])) { + $args['slug'] = Text::truncate($args['content'], 60, ''); } - - // Generate description if empty - if( empty($args['description']) ) { - $args['description'] = Text::truncate($args['content'], 100); - } - + // Generate key $key = $this->generateKey($args['slug'], $args['parent']); diff --git a/bl-kernel/helpers/text.class.php b/bl-kernel/helpers/text.class.php index 6fba3855..8454a4e6 100644 --- a/bl-kernel/helpers/text.class.php +++ b/bl-kernel/helpers/text.class.php @@ -134,7 +134,7 @@ class Text { $string = str_replace(array_keys(self::$specialChars), self::$specialChars, $string); if(function_exists('iconv')) { - $string = iconv('UTF-8', 'ASCII//TRANSLIT', $string); + $string = iconv(CHARSET, 'ASCII//TRANSLIT', $string); } $string = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $string); @@ -152,26 +152,26 @@ class Text { } // String to lowercase - public static function lowercase($string, $encoding='UTF-8') + public static function lowercase($string) { - return mb_strtolower($string, $encoding); + return mb_strtolower($string, CHARSET); } // Make a string's first character uppercase - public static function firstCharUp($string, $encoding='UTF-8') + public static function firstCharUp($string) { // Thanks http://stackoverflow.com/questions/2517947/ucfirst-function-for-multibyte-character-encodings - $strlen = mb_strlen($string, $encoding); - $firstChar = mb_substr($string, 0, 1, $encoding); - $then = mb_substr($string, 1, $strlen - 1, $encoding); + $strlen = mb_strlen($string, CHARSET); + $firstChar = mb_substr($string, 0, 1, CHARSET); + $then = mb_substr($string, 1, $strlen - 1, CHARSET); - return mb_strtoupper($firstChar, $encoding).$then; + return mb_strtoupper($firstChar, CHARSET).$then; } // Find position of first occurrence of substring in a string otherwise returns FALSE. public static function stringPosition($string, $substring) { - return mb_strpos($string, $substring, 0, 'UTF-8'); + return mb_strpos($string, $substring, 0, CHARSET); } public static function stringContains($string, $substring) @@ -182,7 +182,7 @@ class Text { // Returns the portion of string specified by the start and length parameters. public static function cut($string, $start, $length) { - $cut = mb_substr($string, $start, $length, 'UTF-8'); + $cut = mb_substr($string, $start, $length, CHARSET); if(empty($cut)) { return ''; @@ -194,7 +194,7 @@ class Text { // Return string length public static function length($string) { - return mb_strlen($string, 'UTF-8'); + return mb_strlen($string, CHARSET); } public static function isEmpty($string) @@ -227,26 +227,26 @@ class Text { create_function('$input', 'return "
".htmlentities($input[2])."
";'),
$string);
}
-
+
// Truncates the string under the limit specified by the limit parameter.
public static function truncate($string, $limit, $end = '...')
{
// Check if over $limit
if(mb_strlen($string) > $limit) {
-
+
// Check if string is only one word
if(preg_match('/\s/', $string)) {
-
+
// Append the string specified by the end parameter to the end of the string as it is over the limit.
- $truncate = trim(mb_substr($string, 0, mb_strpos($string, ' ', $limit, 'UTF-8'), 'UTF-8'));
+ $truncate = trim(mb_substr($string, 0, mb_strpos($string, ' ', $limit, CHARSET), CHARSET));
} else {
- $truncate = trim(mb_substr($string, 0, $limit, 'UTF-8'));
+ $truncate = trim(mb_substr($string, 0, $limit, CHARSET));
}
$truncate = $truncate.$end;
} else {
$truncate = $string;
}
-
+
if(empty($truncate)) {
return '';
}
diff --git a/bl-plugins/simplemde/plugin.php b/bl-plugins/simplemde/plugin.php
index 6bcea7f6..8b8d29fd 100644
--- a/bl-plugins/simplemde/plugin.php
+++ b/bl-plugins/simplemde/plugin.php
@@ -61,9 +61,6 @@ class pluginsimpleMDE extends Plugin {
// SimpleMDE css
$html .= '';
- // Font-awesome is a dependency of SimpleMDE
- $html .= '';
-
// SimpleMDE js
$html .= '';
diff --git a/bl-plugins/version/plugin.php b/bl-plugins/version/plugin.php
index 107102f8..d80cd1e6 100644
--- a/bl-plugins/version/plugin.php
+++ b/bl-plugins/version/plugin.php
@@ -54,7 +54,7 @@ class pluginVersion extends Plugin {
$output = TCP::http($url);
$json = json_decode($output, true);
- if(empty($json)) {
+ if (empty($json)) {
return false;
}