-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use event scripts instead of a custom plugin class
- Loading branch information
Showing
8 changed files
with
75 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 0 additions & 78 deletions
78
plugins/extend/gallerycomments/class/GalleryCommentsPlugin.php
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
plugins/extend/gallerycomments/event/admin_mod_content_delete_after.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
use Sunlight\Database\Database as DB; | ||
use Sunlight\Page\Page; | ||
use Sunlight\Post\Post; | ||
|
||
return function (array $args) { | ||
global $id, $continue, $query; | ||
if ($continue && $query['type'] == Page::GALLERY) { | ||
DB::delete('post', 'home=' . $query['id'] . ' AND type=' . Post::PLUGIN . ' AND flag=' . $this->getOptions()['extra']['gallery_comments_flag']); | ||
} | ||
}; |
9 changes: 9 additions & 0 deletions
9
plugins/extend/gallerycomments/event/mod_editpost_backlink.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
use Sunlight\Router; | ||
|
||
return function (array $args) { | ||
if ($args['post']['flag'] == $this->getOptions()['extra']['gallery_comments_flag']) { | ||
$args['backlink'] = Router::page($args['post']['id']) . '#posts'; | ||
} | ||
}; |
20 changes: 20 additions & 0 deletions
20
plugins/extend/gallerycomments/event/page_gallery_after.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
use Sunlight\Post\PostService; | ||
use Sunlight\Settings; | ||
|
||
return function (array $args) { | ||
$args['output'] .= PostService::renderList( | ||
PostService::RENDER_PLUGIN_POSTS, | ||
$args['page']['id'], | ||
[ | ||
Settings::get('commentsperpage'), // comments per page | ||
true, // can post | ||
false, // locked | ||
$this->getOptions()['extra']['gallery_comments_flag'], // plugin flag | ||
true, // desc | ||
_lang('posts.comments'), // title | ||
null // page vars | ||
] | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
use Sunlight\Router; | ||
|
||
return function (array $args) { | ||
if ($args['post']['flag'] == $this->getOptions()['extra']['gallery_comments_flag']) { | ||
$args['url'] = Router::page($args['post']['id']); | ||
} | ||
}; |
11 changes: 11 additions & 0 deletions
11
plugins/extend/gallerycomments/event/posts_1000_validate.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
use Sunlight\Database\Database as DB; | ||
use Sunlight\Page\Page; | ||
|
||
return function (array $args) { | ||
// check the existence of the gallery | ||
if (DB::count('page', 'id=' . $args['home'] . ' AND type=' . Page::GALLERY) !== 0) { | ||
$args['valid'] = true; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters