Bug fixes

This commit is contained in:
dignajar 2015-09-03 21:46:17 -03:00
parent 83ec140297
commit c10e09c5f9
8 changed files with 67 additions and 57 deletions

View File

@ -2,7 +2,7 @@
<?php makeNavbar('users'); ?> <?php makeNavbar('users'); ?>
<form method="post" action="" class="forms"> <form method="post" action="" class="forms" autocomplete="off">
<label> <label>
<?php $Language->p('Username') ?> <?php $Language->p('Username') ?>
<input type="text" name="username" class="width-50" value="<?php echo (isset($_POST['username'])?$_POST['username']:'') ?>"> <input type="text" name="username" class="width-50" value="<?php echo (isset($_POST['username'])?$_POST['username']:'') ?>">

View File

@ -333,7 +333,9 @@ function install($adminPassword, $email)
PATH_PLUGINS_DATABASES.'simplemde'.DS.'db.php', PATH_PLUGINS_DATABASES.'simplemde'.DS.'db.php',
$dataHead.json_encode( $dataHead.json_encode(
array( array(
'position'=>0 'position'=>0,
'tabSize'=>4,
'toolbar'=>'&quot;bold&quot;, &quot;italic&quot;, &quot;heading&quot;, &quot;|&quot;, &quot;quote&quot;, &quot;unordered-list&quot;, &quot;|&quot;, &quot;link&quot;, &quot;image&quot;, &quot;code&quot;, &quot;horizontal-rule&quot;, &quot;|&quot;, &quot;preview&quot;, &quot;side-by-side&quot;, &quot;fullscreen&quot;, &quot;guide&quot;'
), ),
JSON_PRETTY_PRINT), JSON_PRETTY_PRINT),
LOCK_EX LOCK_EX

View File

@ -67,12 +67,16 @@ class dbTags extends dbJSON
$tagName = trim($tagName); $tagName = trim($tagName);
$tagKey = Text::cleanUrl($tagName); $tagKey = Text::cleanUrl($tagName);
if( isset($tagsIndex[$tagKey]) ) { // If the tag is not empty.
array_push($tagsIndex[$tagKey]['posts'], $postKey); if(Text::isNotEmpty($tagName))
} {
else { if( isset($tagsIndex[$tagKey]) ) {
$tagsIndex[$tagKey]['name'] = $tagName; array_push($tagsIndex[$tagKey]['posts'], $postKey);
$tagsIndex[$tagKey]['posts'] = array($postKey); }
else {
$tagsIndex[$tagKey]['name'] = $tagName;
$tagsIndex[$tagKey]['posts'] = array($postKey);
}
} }
} }
} }

View File

@ -52,29 +52,6 @@ class Text {
return $text; return $text;
} }
/*
public static function cleanUrl($string, $separator='-')
{
// Delete characters
$string = str_replace(array("", "", "!", "*", "&#039;", "&quot;", "(", ")", ";", ":", "@", "&amp", "=", "+", "$", ",", "/", "?", "%", "#", "[", "]", "|"),'',$string);
$string = preg_replace('![^\\pL\d]+!u', $separator, $string);
// Remove spaces
$string = str_replace(' ',$separator, $string);
//remove any additional characters that might appear after translit
//$string = preg_replace('![^-\w]+!', '', $string);
// Replace multiple dashes
$string = preg_replace('/-{2,}/', $separator, $string);
// Make a string lowercase
$string = self::lowercase($string);
return $string;
}
*/
public static function cleanUrl($string, $separator='-') public static function cleanUrl($string, $separator='-')
{ {
if(function_exists('iconv')) { if(function_exists('iconv')) {
@ -181,4 +158,4 @@ class Text {
$string); $string);
} }
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8,5 +8,8 @@
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor", "website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
"version": "0.1", "version": "0.1",
"releaseDate": "2015-08-27" "releaseDate": "2015-08-27"
} },
"toolbar": "Toolbar",
"tab-size": "Tab size"
} }

View File

@ -9,10 +9,33 @@ class pluginsimpleMDE extends Plugin {
'edit-page' 'edit-page'
); );
public function adminHead() public function init()
{
$this->dbFields = array(
'tabSize'=>'2',
'toolbar'=>'"bold", "italic", "heading", "|", "quote", "unordered-list", "|", "link", "image", "code", "horizontal-rule", "|", "preview", "side-by-side", "fullscreen", "guide"'
);
}
public function form()
{ {
global $Language; global $Language;
global $Site;
$html = '<div>';
$html .= '<label>'.$Language->get('Toolbar').'</label>';
$html .= '<input name="toolbar" id="jstoolbar" type="text" value="'.$this->getDbField('toolbar').'">';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$Language->get('Tab size').'</label>';
$html .= '<input name="tabSize" id="jstabSize" type="text" value="'.$this->getDbField('tabSize').'">';
$html .= '</div>';
return $html;
}
public function adminHead()
{
global $layout; global $layout;
$html = ''; $html = '';
@ -20,16 +43,20 @@ class pluginsimpleMDE extends Plugin {
// Load CSS and JS only on Controllers in array. // Load CSS and JS only on Controllers in array.
if(in_array($layout['controller'], $this->loadWhenController)) if(in_array($layout['controller'], $this->loadWhenController))
{ {
$language = $Site->shortLanguage(); // Path plugin.
$pluginPath = $this->htmlPath(); $pluginPath = $this->htmlPath();
// Load CSS
$html .= '<link rel="stylesheet" href="'.$pluginPath.'css/simplemde.min.css">'; $html .= '<link rel="stylesheet" href="'.$pluginPath.'css/simplemde.min.css">';
// Load Javascript
$html .= '<script src="'.$pluginPath.'js/simplemde.min.js"></script>'; $html .= '<script src="'.$pluginPath.'js/simplemde.min.js"></script>';
//$html = '<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css">'; // Hack for Bludit
//$html .= '<link rel="stylesheet" href="//cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">'; $html .= '<style>
//$html .= '<script src="//cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>'; .editor-toolbar::before { margin-bottom: 2px !important }
.editor-toolbar::after { margin-top: 2px !important }
</style>';
} }
@ -38,8 +65,6 @@ class pluginsimpleMDE extends Plugin {
public function adminBodyEnd() public function adminBodyEnd()
{ {
global $Language;
global $Site;
global $layout; global $layout;
$html = ''; $html = '';
@ -47,7 +72,6 @@ class pluginsimpleMDE extends Plugin {
// Load CSS and JS only on Controllers in array. // Load CSS and JS only on Controllers in array.
if(in_array($layout['controller'], $this->loadWhenController)) if(in_array($layout['controller'], $this->loadWhenController))
{ {
$language = $Site->shortLanguage();
$pluginPath = $this->htmlPath(); $pluginPath = $this->htmlPath();
$html = '<script>$(document).ready(function() { '; $html = '<script>$(document).ready(function() { ';
@ -60,12 +84,13 @@ class pluginsimpleMDE extends Plugin {
autofocus: false, autofocus: false,
lineWrapping: false, lineWrapping: false,
indentWithTabs: true, indentWithTabs: true,
tabSize: 4, tabSize: '.$this->getDbField('tabSize').',
spellChecker: false spellChecker: false,
toolbar: ['.Sanitize::htmlDecode($this->getDbField('toolbar')).']
});'; });';
$html .= '}); </script>'; $html .= '}); </script>';
} }
return $html; return $html;
} }
} }