From 182d1a6c04bf975dff6b7f48a5c79bafc0fc1fc8 Mon Sep 17 00:00:00 2001 From: Diego Date: Thu, 4 May 2017 20:35:05 +0200 Subject: [PATCH] Quill improves, parsedonw updated, rss updated --- bl-kernel/functions.php | 2 +- bl-kernel/parsedown.class.php | 48 +++++++++++++++++++++++---------- bl-plugins/quill/plugin.php | 51 +++++++++-------------------------- bl-plugins/rss/plugin.php | 2 +- 4 files changed, 48 insertions(+), 55 deletions(-) diff --git a/bl-kernel/functions.php b/bl-kernel/functions.php index bfd5c9ff..ef3a1621 100644 --- a/bl-kernel/functions.php +++ b/bl-kernel/functions.php @@ -92,7 +92,7 @@ function buildPost($key) return $Post; } -function buildPostsForPage($pageNumber=0, $amount=POSTS_PER_PAGE_ADMIN, $removeUnpublished=true, $key, $type='tag') +function buildPostsForPage($pageNumber=0, $amount=POSTS_PER_PAGE_ADMIN, $removeUnpublished=true, $key=false, $type='tag') { global $dbPosts; global $dbTags; diff --git a/bl-kernel/parsedown.class.php b/bl-kernel/parsedown.class.php index c8c92a39..e0febbe6 100644 --- a/bl-kernel/parsedown.class.php +++ b/bl-kernel/parsedown.class.php @@ -17,7 +17,7 @@ class Parsedown { # ~ - const version = '1.6.0'; + const version = '1.6.2'; # ~ @@ -115,7 +115,7 @@ class Parsedown # Blocks # - private function lines(array $lines) + protected function lines(array $lines) { $CurrentBlock = null; @@ -175,7 +175,7 @@ class Parsedown } else { - if (method_exists($this, 'block'.$CurrentBlock['type'].'Complete')) + if ($this->isBlockCompletable($CurrentBlock['type'])) { $CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock); } @@ -216,7 +216,7 @@ class Parsedown $Block['identified'] = true; } - if (method_exists($this, 'block'.$blockType.'Continue')) + if ($this->isBlockContinuable($blockType)) { $Block['continuable'] = true; } @@ -245,7 +245,7 @@ class Parsedown # ~ - if (isset($CurrentBlock['continuable']) and method_exists($this, 'block'.$CurrentBlock['type'].'Complete')) + if (isset($CurrentBlock['continuable']) and $this->isBlockCompletable($CurrentBlock['type'])) { $CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock); } @@ -278,6 +278,16 @@ class Parsedown return $markup; } + protected function isBlockContinuable($Type) + { + return method_exists($this, 'block'.$Type.'Continue'); + } + + protected function isBlockCompletable($Type) + { + return method_exists($this, 'block'.$Type.'Complete'); + } + # # Code @@ -438,7 +448,7 @@ class Parsedown return $Block; } - $Block['element']['text']['text'] .= "\n".$Line['body'];; + $Block['element']['text']['text'] .= "\n".$Line['body']; return $Block; } @@ -505,6 +515,16 @@ class Parsedown ), ); + if($name === 'ol') + { + $listStart = stristr($matches[0], '.', true); + + if($listStart !== '1') + { + $Block['element']['attributes'] = array('start' => $listStart); + } + } + $Block['li'] = array( 'name' => 'li', 'handler' => 'li', @@ -1184,7 +1204,7 @@ class Parsedown $remainder = $Excerpt['text']; - if (preg_match('/\[((?:[^][]|(?R))*)\]/', $remainder, $matches)) + if (preg_match('/\[((?:[^][]++|(?R))*+)\]/', $remainder, $matches)) { $Element['text'] = $matches[1]; @@ -1197,7 +1217,7 @@ class Parsedown return; } - if (preg_match('/^[(]((?:[^ ()]|[(][^ )]+[)])+)(?:[ ]+("[^"]*"|\'[^\']*\'))?[)]/', $remainder, $matches)) + if (preg_match('/^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*"|\'[^\']*\'))?\s*[)]/', $remainder, $matches)) { $Element['attributes']['href'] = $matches[1]; @@ -1519,10 +1539,10 @@ class Parsedown 'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing', 'i', 'rp', 'del', 'code', 'strike', 'marquee', 'q', 'rt', 'ins', 'font', 'strong', - 's', 'tt', 'sub', 'mark', - 'u', 'xm', 'sup', 'nobr', - 'var', 'ruby', - 'wbr', 'span', - 'time', + 's', 'tt', 'kbd', 'mark', + 'u', 'xm', 'sub', 'nobr', + 'sup', 'ruby', + 'var', 'span', + 'wbr', 'time', ); -} +} \ No newline at end of file diff --git a/bl-plugins/quill/plugin.php b/bl-plugins/quill/plugin.php index 7a7076de..924bf029 100644 --- a/bl-plugins/quill/plugin.php +++ b/bl-plugins/quill/plugin.php @@ -11,12 +11,7 @@ class pluginQuill extends Plugin { 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"', - 'autosave'=>0, - 'spellChecker'=>0 - ); + return false; } // Returns true if the plugins is loaded on the controller defined @@ -37,35 +32,6 @@ class pluginQuill extends Plugin { return $html; } - public function form() - { - global $Language; - - $html = '
'; - $html .= ''; - $html .= ''; - $html .= '
'; - - $html .= '
'; - $html .= ''; - $html .= ''; - $html .= '
'; - - $html .= '
'; - $html .= ''; - $html .= 'getDbField('autosave')?'checked':'').'>'; - $html .= ''; - $html .= '
'; - - $html .= '
'; - $html .= ''; - $html .= 'getDbField('spellChecker')?'checked':'').'>'; - $html .= ''; - $html .= '
'; - - return $html; - } - public function adminBodyEnd() { global $layout; @@ -74,9 +40,11 @@ class pluginQuill extends Plugin { $html = ''; if( $this->enabled() ) { $html .= ' - + +$(".uk-form").submit(function( event ) { + $("#jscontent").val(quill.root.innerHTML); + return true; +}); + + '; } diff --git a/bl-plugins/rss/plugin.php b/bl-plugins/rss/plugin.php index 0807322b..a892082c 100644 --- a/bl-plugins/rss/plugin.php +++ b/bl-plugins/rss/plugin.php @@ -107,4 +107,4 @@ class pluginRSS extends Plugin { } } -} +} \ No newline at end of file