From 63d11a755b3b3f42d9636abef81d662acd181031 Mon Sep 17 00:00:00 2001 From: dignajar Date: Sat, 29 Aug 2015 02:02:09 -0300 Subject: [PATCH] Improvements on tags --- admin/controllers/dashboard.php | 2 +- admin/controllers/edit-page.php | 2 + admin/controllers/edit-post.php | 8 +++ admin/controllers/new-page.php | 2 + admin/controllers/new-post.php | 4 ++ admin/views/edit-page.php | 4 +- admin/views/edit-post.php | 4 +- admin/views/new-page.php | 4 +- admin/views/new-post.php | 4 +- install.php | 30 +++++++++-- kernel/boot/init.php | 2 + kernel/dbtags.class.php | 67 +++++++++++++++++++++++++ plugins/simplemde/css/editor.css | 7 --- plugins/simplemde/css/simplemde.min.css | 7 +++ plugins/simplemde/js/simplemde.min.js | 14 ++++++ plugins/simplemde/plugin.php | 14 ++++-- plugins/tags/language/en_US.json | 12 +++++ plugins/tags/plugin.php | 51 +++++++++++++++++++ 18 files changed, 213 insertions(+), 25 deletions(-) create mode 100644 kernel/dbtags.class.php delete mode 100644 plugins/simplemde/css/editor.css create mode 100644 plugins/simplemde/css/simplemde.min.css create mode 100644 plugins/simplemde/js/simplemde.min.js create mode 100755 plugins/tags/language/en_US.json create mode 100755 plugins/tags/plugin.php diff --git a/admin/controllers/dashboard.php b/admin/controllers/dashboard.php index 63322461..602e33e0 100644 --- a/admin/controllers/dashboard.php +++ b/admin/controllers/dashboard.php @@ -33,4 +33,4 @@ foreach($pages as $Page) if(!$Page->published()) { array_push($_draftPages, $Page); } -} \ No newline at end of file +} diff --git a/admin/controllers/edit-page.php b/admin/controllers/edit-page.php index 29fa99ec..e591d578 100644 --- a/admin/controllers/edit-page.php +++ b/admin/controllers/edit-page.php @@ -26,6 +26,8 @@ function editPage($args) { $dbPages->regenerate(); + //$dbTags->reindexPages( $dbPages->db ); + Alert::set($Language->g('The changes have been saved')); Redirect::page('admin', 'edit-page/'.$args['key']); } diff --git a/admin/controllers/edit-post.php b/admin/controllers/edit-post.php index 659b6485..a52ee912 100644 --- a/admin/controllers/edit-post.php +++ b/admin/controllers/edit-post.php @@ -7,6 +7,7 @@ function editPost($args) { global $dbPosts; + global $dbTags; global $Language; // Post status, published or draft. @@ -20,6 +21,9 @@ function editPost($args) // Edit the post. if( $dbPosts->edit($args) ) { + // Regenerate the database tags + $dbTags->reindexPosts( $dbPosts->db ); + Alert::set($Language->g('The changes have been saved')); Redirect::page('admin', 'edit-post/'.$args['key']); } @@ -32,10 +36,14 @@ function editPost($args) function deletePost($key) { global $dbPosts; + global $dbTags; global $Language; if( $dbPosts->delete($key) ) { + // Regenerate the database tags + $dbTags->reindexPosts( $dbPosts->db ); + Alert::set($Language->g('The post has been deleted successfully')); Redirect::page('admin', 'manage-posts'); } diff --git a/admin/controllers/new-page.php b/admin/controllers/new-page.php index 0dd12df7..0b54d994 100644 --- a/admin/controllers/new-page.php +++ b/admin/controllers/new-page.php @@ -24,6 +24,8 @@ function addPage($args) // Add the page. if( $dbPages->add($args) ) { + //$dbTags->reindexPages( $dbPages->db ); + Alert::set($Language->g('Page added successfully')); Redirect::page('admin', 'manage-pages'); } diff --git a/admin/controllers/new-post.php b/admin/controllers/new-post.php index f13cba22..92131b52 100644 --- a/admin/controllers/new-post.php +++ b/admin/controllers/new-post.php @@ -11,6 +11,7 @@ function addPost($args) { global $dbPosts; + global $dbTags; global $Language; // Page status, published or draft. @@ -24,6 +25,9 @@ function addPost($args) // Add the page. if( $dbPosts->add($args) ) { + // Regenerate the database tags + $dbTags->reindexPosts( $dbPosts->db ); + Alert::set($Language->g('Post added successfully')); Redirect::page('admin', 'manage-posts'); } diff --git a/admin/views/edit-page.php b/admin/views/edit-page.php index 7dccff93..3f733924 100644 --- a/admin/views/edit-page.php +++ b/admin/views/edit-page.php @@ -6,10 +6,10 @@ -