diff --git a/modules/Blog/Article/Config/config.php b/modules/Blog/Article/Config/config.php deleted file mode 100644 index fb19fdc4..00000000 --- a/modules/Blog/Article/Config/config.php +++ /dev/null @@ -1,12 +0,0 @@ - 'Articles', - 'translatedName' => 'article::module.name', - 'translatedDescription' => 'article::module.description', - 'alias' => 'article', - 'handler' => \Modules\Blog\Article\Handlers\Article::class, - 'providers' => [\Modules\Blog\Article\Providers\ArticleServiceProvider::class], - 'files' => ['start.php'], - 'order' => 0, -]; \ No newline at end of file diff --git a/modules/Blog/Article/Entities/Article.php b/modules/Blog/Article/Entities/Article.php deleted file mode 100644 index 1222a7bb..00000000 --- a/modules/Blog/Article/Entities/Article.php +++ /dev/null @@ -1,15 +0,0 @@ -hasMany(Comment::class, 'content_id') - ->where('approved', true); - } -} \ No newline at end of file diff --git a/modules/Blog/Article/Entities/Comment.php b/modules/Blog/Article/Entities/Comment.php deleted file mode 100644 index 25a5e4f8..00000000 --- a/modules/Blog/Article/Entities/Comment.php +++ /dev/null @@ -1,27 +0,0 @@ -belongsTo(User::class, 'user_id'); - } - - public function article() - { - return $this->belongsTo(Content::class, 'content_id'); - } -} \ No newline at end of file diff --git a/modules/Blog/Article/Events/ApprovedComment.php b/modules/Blog/Article/Events/ApprovedComment.php deleted file mode 100644 index 3fab72bc..00000000 --- a/modules/Blog/Article/Events/ApprovedComment.php +++ /dev/null @@ -1,20 +0,0 @@ -comment = $comment; - } -} \ No newline at end of file diff --git a/modules/Blog/Article/Events/CreatedComment.php b/modules/Blog/Article/Events/CreatedComment.php deleted file mode 100644 index d21f685b..00000000 --- a/modules/Blog/Article/Events/CreatedComment.php +++ /dev/null @@ -1,20 +0,0 @@ -comment = $comment; - } -} \ No newline at end of file diff --git a/modules/Blog/Article/Events/DeletedComment.php b/modules/Blog/Article/Events/DeletedComment.php deleted file mode 100644 index 048341ab..00000000 --- a/modules/Blog/Article/Events/DeletedComment.php +++ /dev/null @@ -1,20 +0,0 @@ -comment = $comment; - } -} \ No newline at end of file diff --git a/modules/Blog/Article/Handlers/Article.php b/modules/Blog/Article/Handlers/Article.php deleted file mode 100644 index f09ee57d..00000000 --- a/modules/Blog/Article/Handlers/Article.php +++ /dev/null @@ -1,153 +0,0 @@ -whereTitle(trans('article::module.blog')); - if (!$blogSubmenu) { - $blogSubmenu = $menu->dropdown(trans('article::module.blog'), function ($sub) { - }, 20, ['icon' => 'fa fa-fw fa-book']); - } - - $blogSubmenu->dropdown(trans('article::module.name'), function ($sub) { - $sub->route('content.new', trans('article::article.new'), ['id' => config('article.alias')], 10, ['icon' => 'fa fa-fw fa-pencil']); - $sub->route('content.overview', trans('article::article.overview'), ['id' => config('article.alias')], 30, ['icon' => 'fa fa-fw fa-book']); - }, 10, ['icon' => 'fa fa-fw fa-book']); - - $blogSubmenu->route('comments.overview', trans('article::module.commentsOverview'), [], 20, ['icon' => 'fa fa-fw fa-commenting-o']); - } - - /** - * Install module - */ - public static function install() - { - $types = [ - [ - 'string_id' => 'commentCreated', - 'name' => 'article::comments.events.names.commentCreated', - 'value' => 'article::comments.events.descriptions.commentCreated', - ], - [ - 'string_id' => 'commentDeleted', - 'name' => 'article::comments.events.names.commentDeleted', - 'value' => 'article::comments.events.descriptions.commentDeleted', - ], - [ - 'string_id' => 'commentApproved', - 'name' => 'article::comments.events.names.commentApproved', - 'value' => 'article::comments.events.descriptions.commentApproved', - ], - - ]; - foreach ($types as $type) { - ActionLogType::create($type); - } - } - - /** - * Uninstalls module - * - * @param Module $module - * - * @return mixed|void - */ - public static function uninstall(Module $module) - { - ActionLogType::whereIn('string_id', ['commentCreated', 'commentDeleted', 'commentApproved']) - ->delete(); - } - - /** - * Get translated title for pages overview of given type. - * - * This value is used for rendering list of all content pages of given type in administration. - * - * @return string - */ - public static function getOverviewTitle() - { - return trans('article::module.allArticles'); - } - - /** - * Title displayed above for for creating new content page - * - * @return string - */ - public static function getCreateNewTitle() - { - return trans('article::module.newArticle'); - } - - /** - * Title for form displayed for editin content page - * - * @param Content $content - * - * @return mixed - */ - public static function getEditTitle(Content $content) - { - return trans('article::module.editArticle'); - } - - /** - * Method called right after content page is marked as deleted - * - * This method is supposed to clean after "deleted" page. - * - * @param Content $content - * - * @return mixed - */ - public static function delete(Content $content) - { - } - - /** - * Does this module support categories? - * - * @return boolean - */ - public static function supportCategories() - { - return true; - } -} \ No newline at end of file diff --git a/modules/Blog/Article/Http/Controllers/Admin/CommentsOverview.php b/modules/Blog/Article/Http/Controllers/Admin/CommentsOverview.php deleted file mode 100644 index 239bc6d6..00000000 --- a/modules/Blog/Article/Http/Controllers/Admin/CommentsOverview.php +++ /dev/null @@ -1,19 +0,0 @@ -with('author') - ->orderBy('approved') - ->orderBy('created_at', 'DESC') - ->paginate(25); - - return view('article::admin/comments.overview', ['comments' => $comments]); - } -} \ No newline at end of file diff --git a/modules/Blog/Article/Http/Controllers/Admin/EditComment.php b/modules/Blog/Article/Http/Controllers/Admin/EditComment.php deleted file mode 100644 index bf6f6994..00000000 --- a/modules/Blog/Article/Http/Controllers/Admin/EditComment.php +++ /dev/null @@ -1,37 +0,0 @@ -approved = 1; - $comment->save(); - - Event::fire(new ApprovedComment($comment)); - - return redirect() - ->back() - ->with('success', trans('article::comments.approved')); - } - - public function delete($id) - { - $comment = Comment::findOrFail($id); - - Event::fire(new DeletedComment($comment)); - - $comment->delete(); - - return redirect() - ->back() - ->with('success', trans('article::comments.deleted')); - } -} \ No newline at end of file diff --git a/modules/Blog/Article/Http/Controllers/Visitor/CreateNewComment.php b/modules/Blog/Article/Http/Controllers/Visitor/CreateNewComment.php deleted file mode 100644 index 88ac5c9e..00000000 --- a/modules/Blog/Article/Http/Controllers/Visitor/CreateNewComment.php +++ /dev/null @@ -1,49 +0,0 @@ -moduleSettings['allowComments']) || !$article->moduleSettings['allowComments']) { - return redirect() - ->route('page.content', ['url' => $article->url]) - ->with('error', trans('article::comments.disabledComments')); - } - - $content = $request->message; - $user = Auth::user(); - if ($user) { - $name = is_null($user->name) ? $user->email : $user->name; - $email = $user->email; - } else { - $name = $request->name; - $email = $request->email; - } - - $comment = Comment::create([ - 'user_id' => $user ? $user->id : null, - 'content_id' => $article->id, - 'name' => $name, - 'email' => $email, - 'content' => $content, - 'approved' => !is_null($user) - ]); - - // fire event about new comment - Event::fire(new CreatedComment($comment)); - - return redirect() - ->route('page.content', ['url' => $article->url]) - ->with('success', trans('article::comments.saved')); - } -} \ No newline at end of file diff --git a/modules/Blog/Article/Http/Requests/CreateNewComment.php b/modules/Blog/Article/Http/Requests/CreateNewComment.php deleted file mode 100644 index 18044f43..00000000 --- a/modules/Blog/Article/Http/Requests/CreateNewComment.php +++ /dev/null @@ -1,28 +0,0 @@ - 'required']; - - if (!$user) { - $required['name'] = 'required'; - $required['email'] = 'required|email'; - } - - return $required; - } -} diff --git a/modules/Blog/Article/Http/routes.php b/modules/Blog/Article/Http/routes.php deleted file mode 100644 index 145c30ba..00000000 --- a/modules/Blog/Article/Http/routes.php +++ /dev/null @@ -1,28 +0,0 @@ - LaravelLocalization::setLocale(), - 'namespace' => 'Modules\Blog\Article\Http\Controllers' - ], function () { - Route::group([ - 'middleware' => ['admin'], - 'prefix' => 'admin/comments', - 'namespace' => 'Admin' - ], function () { - - Route::get('/', 'CommentsOverview@getOverview') - ->name('comments.overview'); - - Route::get('/delete/{id}', 'EditComment@delete') - ->name('comments.delete'); - - Route::get('/approve/{id}', 'EditComment@approve') - ->name('comments.approve'); - }); - - // public routes - Route::group(['middleware' => ['web'], 'namespace' => 'Visitor'], function () { - - Route::post('comments/new/{article}', 'CreateNewComment@store') - ->name('comments.new'); - }); -}); \ No newline at end of file diff --git a/modules/Blog/Article/Listeners/LogCommentApproval.php b/modules/Blog/Article/Listeners/LogCommentApproval.php deleted file mode 100644 index 2ff4f14b..00000000 --- a/modules/Blog/Article/Listeners/LogCommentApproval.php +++ /dev/null @@ -1,35 +0,0 @@ - $event->comment->name, - 'email' => $event->comment->email, - 'content' => $event->comment->content - ]; - - $this->saveLog($parameters); - } - - /** - * Getter for action name. Used only internally - * - * @return mixed - */ - protected function getName() - { - return 'commentApproved'; - } -} \ No newline at end of file diff --git a/modules/Blog/Article/Listeners/LogDeletedComment.php b/modules/Blog/Article/Listeners/LogDeletedComment.php deleted file mode 100644 index 0a016e0c..00000000 --- a/modules/Blog/Article/Listeners/LogDeletedComment.php +++ /dev/null @@ -1,35 +0,0 @@ - $event->comment->name, - 'email' => $event->comment->email, - 'content' => $event->comment->content - ]; - - $this->saveLog($parameters); - } - - /** - * Getter for action name. Used only internally - * - * @return mixed - */ - protected function getName() - { - return 'commentDeleted'; - } -} \ No newline at end of file diff --git a/modules/Blog/Article/Listeners/LogNewComment.php b/modules/Blog/Article/Listeners/LogNewComment.php deleted file mode 100644 index d2e6e313..00000000 --- a/modules/Blog/Article/Listeners/LogNewComment.php +++ /dev/null @@ -1,40 +0,0 @@ -comment->user_id) { - return; - } - - $parameters = [ - 'author' => $event->comment->name, - 'email' => $event->comment->email, - 'content' => $event->comment->content - ]; - - $this->saveLog($parameters); - } - - /** - * Getter for action name. Used only internally - * - * @return mixed - */ - protected function getName() - { - return 'commentCreated'; - } -} \ No newline at end of file diff --git a/modules/Blog/Article/Modificators/PerexCreator.php b/modules/Blog/Article/Modificators/PerexCreator.php deleted file mode 100644 index ad76b0be..00000000 --- a/modules/Blog/Article/Modificators/PerexCreator.php +++ /dev/null @@ -1,60 +0,0 @@ -DOMDocument = new \DOMDocument('1.0', 'UTF-8'); - $this->maxLength = 300; - $this->maxImages = 2; - $this->perex = ''; - } - - private function addHtml($node) - { - $this->perex .= strip_tags($this->DOMDocument->saveHTML($node), '
');
- }
-
- public function create($html)
- {
- if (empty($html)) {
- return null;
- }
-
- $html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
- $this->DOMDocument->loadHTML($html);
-
- $texts = $this->DOMDocument->getElementsByTagName('p');
- $images = $this->DOMDocument->getElementsByTagName('img');
- $iframes = $this->DOMDocument->getElementsByTagName('iframe');
-
- $textId = 0;
- $imgId = 0;
- if ($texts->length > 1) {
- $this->addHtml($texts[$textId++]);
- }
-
- if (mb_strlen($this->perex) < $this->maxLength) {
- if ($iframes->length > 0) {
- $this->perex .= $this->DOMDocument->saveHTML($iframes[0]);
- } elseif ($images->length > 0) {
- while ($imgId < $images->length && $imgId < $this->maxImages) {
- $this->perex .= $this->DOMDocument->saveHTML($images[$imgId++]);
- }
- } else {
- while (mb_strlen($this->perex) < $this->maxLength && $textId < $texts->length) {
- $this->addHtml($texts[$textId++]);
- }
- }
- }
-
- return $this->perex;
- }
-}
\ No newline at end of file
diff --git a/modules/Blog/Article/Pipeline/DisplayContent/LoadCommentsForBlogpost.php b/modules/Blog/Article/Pipeline/DisplayContent/LoadCommentsForBlogpost.php
deleted file mode 100644
index 575f9249..00000000
--- a/modules/Blog/Article/Pipeline/DisplayContent/LoadCommentsForBlogpost.php
+++ /dev/null
@@ -1,33 +0,0 @@
-moduleHandler != Article::class)
- return;
-
- $content->comments = new Collection();
- if (isset($content->moduleSettings['allowComments']) && $content->moduleSettings['allowComments']) {
- $content->comments = Comment::where('content_id', $content->id)
- ->with('author')
- ->where('approved', 1)
- ->orderBy('created_at')
- ->get();
- }
- }
-}
\ No newline at end of file
diff --git a/modules/Blog/Article/Pipeline/SaveContent/TurnCommentsOnOrOff.php b/modules/Blog/Article/Pipeline/SaveContent/TurnCommentsOnOrOff.php
deleted file mode 100644
index f52e4bc1..00000000
--- a/modules/Blog/Article/Pipeline/SaveContent/TurnCommentsOnOrOff.php
+++ /dev/null
@@ -1,29 +0,0 @@
-moduleHandler, '\\') !== Article::class) {
- return;
- }
-
- $settings = $content->moduleSettings;
- $settings['allowComments'] = isset($input['allowComments']) ? (int)$input['allowComments'] : 0;
- $content->moduleSettings = $settings;
- $content->save();
- }
-}
\ No newline at end of file
diff --git a/modules/Blog/Article/Providers/ArticleEventServiceProvider.php b/modules/Blog/Article/Providers/ArticleEventServiceProvider.php
deleted file mode 100644
index 08287d0e..00000000
--- a/modules/Blog/Article/Providers/ArticleEventServiceProvider.php
+++ /dev/null
@@ -1,26 +0,0 @@
- [LogCommentApproval::class],
- DeletedComment::class => [LogDeletedComment::class],
- CreatedComment::class => [LogNewComment::class],
- ];
-}
\ No newline at end of file
diff --git a/modules/Blog/Article/Providers/ArticleServiceProvider.php b/modules/Blog/Article/Providers/ArticleServiceProvider.php
deleted file mode 100644
index 5967f16e..00000000
--- a/modules/Blog/Article/Providers/ArticleServiceProvider.php
+++ /dev/null
@@ -1,34 +0,0 @@
-app->register(ArticleEventServiceProvider::class);
-
- // load comments for blogpost
- app('displayPipeline')->add(LoadCommentsForBlogpost::class);
-
- app('saveContentPipeline')->add(TurnCommentsOnOrOff::class);
- }
-
- protected function setModuleAlias()
- {
- $this->alias = 'article';
- }
-
- protected function setModulePath()
- {
- $this->path = __DIR__;
- }
-}
diff --git a/modules/Blog/Article/Resources/lang/cs/article.php b/modules/Blog/Article/Resources/lang/cs/article.php
deleted file mode 100644
index fd1c65c6..00000000
--- a/modules/Blog/Article/Resources/lang/cs/article.php
+++ /dev/null
@@ -1,6 +0,0 @@
- "Povolit komentáře?",
-"new" => "Napsat",
-"overview" => "Všechny články",
-];
diff --git a/modules/Blog/Article/Resources/lang/cs/comments.php b/modules/Blog/Article/Resources/lang/cs/comments.php
deleted file mode 100644
index fa9aca67..00000000
--- a/modules/Blog/Article/Resources/lang/cs/comments.php
+++ /dev/null
@@ -1,22 +0,0 @@
- "Schválit komentář a zobrazovat ho u článku",
- "approved" => "Komentář úspěšně schválen",
- "commentedArticle" => "Komentovaný článek",
- "createdAt" => "Vloženo :date",
- "deleted" => "Komentář smazán",
- "events" => [
- "descriptions" => [
- "commentApproved" => "Schválen komentář od autora :authro (:email) s následujícím obsahem: :content",
- "commentCreated" => "Přidán komentář od autora :author (e-mail :e-mail) s následujícím obsahem: :content",
- "commentDeleted" => "Smazán komentář od autora :author (:email) s následujícím obsahem: :content",
- ],
- "names" => [
- "commentApproved" => "Komentář schválen",
- "commentCreated" => "Komentář úspěšně přidán.",
- "commentDeleted" => "Smazán komentář",
- ],
- ],
- "noComments" => "Nejsou dostupné žádné komentáře",
- "unknownArticle" => "Neznámý článek",
-];
diff --git a/modules/Blog/Article/Resources/lang/cs/module.php b/modules/Blog/Article/Resources/lang/cs/module.php
deleted file mode 100644
index 22653cac..00000000
--- a/modules/Blog/Article/Resources/lang/cs/module.php
+++ /dev/null
@@ -1,12 +0,0 @@
- "Všechny články",
- "blog" => "Blog",
- "comments" => "Komentáře",
- "commentsOverview" => "Všechny komentáře",
- "description" => "Základní submodul pro blog. Tento modul umožňuje psát články.",
- "editArticle" => "Upravuji článek",
- "name" => "Články",
- "newArticle" => "Napsat nový článek",
- "templatePath" => "Články",
-];
diff --git a/modules/Blog/Article/Resources/lang/en/article.php b/modules/Blog/Article/Resources/lang/en/article.php
deleted file mode 100644
index 2d1e8b44..00000000
--- a/modules/Blog/Article/Resources/lang/en/article.php
+++ /dev/null
@@ -1,6 +0,0 @@
- 'Allow comments?',
- 'new' => 'Write new',
- 'overview' => 'All articles'
-];
\ No newline at end of file
diff --git a/modules/Blog/Article/Resources/lang/en/comments.php b/modules/Blog/Article/Resources/lang/en/comments.php
deleted file mode 100644
index de5e7301..00000000
--- a/modules/Blog/Article/Resources/lang/en/comments.php
+++ /dev/null
@@ -1,22 +0,0 @@
- 'Created at :date',
- 'commentedArticle' => 'Article',
- 'approve' => 'Approve comment',
- 'approved' => 'Comment successfully approved',
- 'deleted' => 'Comment deleted',
- 'unknownArticle' => 'Unknown article',
- 'noComments' => 'No comments available',
- 'events' => [
- 'names' => [
- 'commentCreated' => 'Added comment',
- 'commentApproved' => 'Approved comment',
- 'commentDeleted' => 'Deleted comment',
- ],
- 'descriptions' => [
- 'commentCreated' => 'Added comment from author :author with e-mail :email and following content: :content',
- 'commentApproved' => 'Approved comment from author :author with e-mail :email and following content: :content',
- 'commentDeleted' => 'Deleted comment from author :author with e-mail :email and following content: :content',
- ],
- ]
-];
\ No newline at end of file
diff --git a/modules/Blog/Article/Resources/lang/en/module.php b/modules/Blog/Article/Resources/lang/en/module.php
deleted file mode 100644
index 1e272945..00000000
--- a/modules/Blog/Article/Resources/lang/en/module.php
+++ /dev/null
@@ -1,12 +0,0 @@
- 'Articles',
- 'description' => 'Base submodule for blog',
- 'comments' => 'Comments',
- 'commentsOverview' => 'All comments',
- 'blog' => 'Blog',
- 'allArticles' => 'All articles',
- 'newArticle' => 'Write new article',
- 'editArticle' => 'Editing article',
- 'templatePath' => 'Articles',
-];
\ No newline at end of file
diff --git a/modules/Blog/Article/Resources/lang/sk/article.php b/modules/Blog/Article/Resources/lang/sk/article.php
deleted file mode 100644
index 2a3ce3a6..00000000
--- a/modules/Blog/Article/Resources/lang/sk/article.php
+++ /dev/null
@@ -1,6 +0,0 @@
- "Povoliť komentáre?",
- "new" => " Napísať nový",
- "overview" => "Všetky články",
-];
diff --git a/modules/Blog/Article/Resources/lang/sk/comments.php b/modules/Blog/Article/Resources/lang/sk/comments.php
deleted file mode 100644
index 5bde58a3..00000000
--- a/modules/Blog/Article/Resources/lang/sk/comments.php
+++ /dev/null
@@ -1,8 +0,0 @@
- "Schváliť komentár",
- "approved" => "Komentár úspešne schválený.",
- "commentedArticle" => "Článok",
- "createdAt" => "Vytvorené: :date",
- "deleted" => "Komentár zmazaný.",
-];
diff --git a/modules/Blog/Article/Resources/lang/sk/module.php b/modules/Blog/Article/Resources/lang/sk/module.php
deleted file mode 100644
index 04b574c0..00000000
--- a/modules/Blog/Article/Resources/lang/sk/module.php
+++ /dev/null
@@ -1,9 +0,0 @@
- "Všetky články",
- "blog" => "Blog",
- "comments" => "Komentáre",
- "commentsOverview" => "Všetky komentáre",
- "description" => "Základný submodul pre blog",
- "name" => "Články",
-];
diff --git a/modules/Blog/Article/Resources/views/admin/comments/overview.blade.php b/modules/Blog/Article/Resources/views/admin/comments/overview.blade.php
deleted file mode 100644
index adccff8f..00000000
--- a/modules/Blog/Article/Resources/views/admin/comments/overview.blade.php
+++ /dev/null
@@ -1,56 +0,0 @@
-@extends('admin.layoutWithNavigation')
-
-@section('pageHeading', trans('article::module.comments'))
-
-@section('content')
- @if (count($comments))
- @foreach($comments as $comment)
-
-
-
- {{$comment->name}} ({{$comment->email}})
-
-- {{$comment->content}} -
-