|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace GeminiLabs\SiteReviews; |
|
4
|
|
|
|
|
5
|
|
|
use GeminiLabs\SiteReviews\Application; |
|
6
|
|
|
use GeminiLabs\SiteReviews\Contracts\HooksContract; |
|
7
|
|
|
use GeminiLabs\SiteReviews\Controllers\AdminController; |
|
8
|
|
|
use GeminiLabs\SiteReviews\Controllers\EditorController; |
|
9
|
|
|
use GeminiLabs\SiteReviews\Controllers\ListTableController; |
|
10
|
|
|
use GeminiLabs\SiteReviews\Controllers\MainController; |
|
11
|
|
|
use GeminiLabs\SiteReviews\Controllers\MenuController; |
|
12
|
|
|
use GeminiLabs\SiteReviews\Controllers\PublicController; |
|
13
|
|
|
use GeminiLabs\SiteReviews\Controllers\SettingsController; |
|
14
|
|
|
use GeminiLabs\SiteReviews\Controllers\TaxonomyController; |
|
15
|
|
|
use GeminiLabs\SiteReviews\Modules\Session; |
|
16
|
|
|
use GeminiLabs\SiteReviews\Router; |
|
17
|
|
|
|
|
18
|
|
|
class Actions implements HooksContract |
|
19
|
|
|
{ |
|
20
|
|
|
protected $admin; |
|
21
|
|
|
protected $app; |
|
22
|
|
|
protected $editor; |
|
23
|
|
|
protected $listtable; |
|
24
|
|
|
protected $menu; |
|
25
|
|
|
protected $main; |
|
26
|
|
|
protected $public; |
|
27
|
|
|
protected $router; |
|
28
|
|
|
protected $session; |
|
29
|
|
|
protected $settings; |
|
30
|
|
|
protected $taxonomy; |
|
31
|
|
|
|
|
32
|
|
|
public function __construct( Application $app ) { |
|
33
|
|
|
$this->app = $app; |
|
34
|
|
|
$this->admin = $app->make( AdminController::class ); |
|
35
|
|
|
$this->editor = $app->make( EditorController::class ); |
|
36
|
|
|
$this->listtable = $app->make( ListTableController::class ); |
|
37
|
|
|
$this->main = $app->make( MainController::class ); |
|
38
|
|
|
$this->menu = $app->make( MenuController::class ); |
|
39
|
|
|
$this->public = $app->make( PublicController::class ); |
|
40
|
|
|
$this->router = $app->make( Router::class ); |
|
41
|
|
|
$this->session = $app->make( Session::class ); |
|
42
|
|
|
$this->settings = $app->make( SettingsController::class ); |
|
43
|
|
|
$this->taxonomy = $app->make( TaxonomyController::class ); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @return void |
|
48
|
|
|
*/ |
|
49
|
|
|
public function run() |
|
50
|
|
|
{ |
|
51
|
|
|
add_action( 'admin_enqueue_scripts', [$this->admin, 'enqueueAssets'] ); |
|
52
|
|
|
add_action( 'admin_init', [$this->admin, 'registerShortcodeButtons'] ); |
|
53
|
|
|
add_action( 'edit_form_after_title', [$this->admin, 'renderReviewEditor'] ); |
|
54
|
|
|
add_action( 'edit_form_top', [$this->admin, 'renderReviewNotice'] ); |
|
55
|
|
|
add_action( 'media_buttons', [$this->admin, 'renderTinymceButton'], 11 ); |
|
56
|
|
|
add_action( 'plugins_loaded', [$this->app, 'getDefaults'], 11 ); |
|
57
|
|
|
add_action( 'plugins_loaded', [$this->app, 'registerAddons'] ); |
|
58
|
|
|
add_action( 'plugins_loaded', [$this->app, 'registerLanguages'] ); |
|
59
|
|
|
add_action( 'plugins_loaded', [$this->app, 'registerReviewTypes'] ); |
|
60
|
|
|
add_action( 'upgrader_process_complete', [$this->app, 'upgraded'], 10, 2 ); |
|
61
|
|
|
add_action( 'admin_enqueue_scripts', [$this->editor, 'customizePostStatusLabels'] ); |
|
62
|
|
|
add_action( 'site-reviews/create/review', [$this->editor, 'onCreateReview'], 10, 3 ); |
|
63
|
|
|
add_action( 'before_delete_post', [$this->editor, 'onDeleteReview'] ); |
|
64
|
|
|
add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'onSaveReview'], 20, 2 ); |
|
65
|
|
|
add_action( 'add_meta_boxes', [$this->editor, 'registerMetaBoxes'] ); |
|
66
|
|
|
add_action( 'admin_print_scripts', [$this->editor, 'removeAutosave'], 999 ); |
|
67
|
|
|
add_action( 'admin_menu', [$this->editor, 'removeMetaBoxes'] ); |
|
68
|
|
|
add_action( 'post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox'] ); |
|
69
|
|
|
add_action( 'admin_action_revert', [$this->editor, 'revertReview'] ); |
|
70
|
|
|
add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'] ); |
|
71
|
|
|
add_action( 'admin_action_approve', [$this->listtable, 'approve'] ); |
|
72
|
|
|
add_action( 'bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2 ); |
|
73
|
|
|
add_action( 'restrict_manage_posts', [$this->listtable, 'renderColumnFilters'] ); |
|
74
|
|
|
add_action( 'manage_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2 ); |
|
75
|
|
|
add_action( 'save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields'] ); |
|
76
|
|
|
add_action( 'pre_get_posts', [$this->listtable, 'setQueryForColumn'] ); |
|
77
|
|
|
add_action( 'admin_action_unapprove', [$this->listtable, 'unapprove'] ); |
|
78
|
|
|
add_action( 'init', [$this->main, 'registerPostType'], 8 ); |
|
79
|
|
|
add_action( 'init', [$this->main, 'registerShortcodes'] ); |
|
80
|
|
|
add_action( 'init', [$this->main, 'registerTaxonomy'] ); |
|
81
|
|
|
add_action( 'widgets_init', [$this->main, 'registerWidgets'] ); |
|
82
|
|
|
add_action( 'admin_menu', [$this->menu, 'registerMenuCount'] ); |
|
83
|
|
|
add_action( 'admin_menu', [$this->menu, 'registerSubMenus'] ); |
|
84
|
|
|
add_action( 'admin_init', [$this->menu, 'setCustomPermissions'], 999 ); |
|
85
|
|
|
add_action( 'wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999 ); |
|
86
|
|
|
add_action( 'wp_footer', [$this->public, 'renderSchema'] ); |
|
87
|
|
|
add_action( 'admin_init', [$this->router, 'routeAdminPostRequest'] ); |
|
88
|
|
|
add_action( 'wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] ); |
|
89
|
|
|
add_action( 'wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] ); |
|
90
|
|
|
add_action( 'init', [$this->router, 'routePublicPostRequest'] ); |
|
91
|
|
|
add_action( 'admin_init', [$this->router, 'routeWebhookRequest'] ); |
|
92
|
|
|
add_action( 'site-reviews/schedule/session/purge', [$this->session, 'deleteExpiredSessions'] ); |
|
93
|
|
|
add_action( 'admin_init', [$this->settings, 'registerSettings'] ); |
|
94
|
|
|
add_action( Application::TAXONOMY.'_term_edit_form_top', [$this->taxonomy, 'disableParents'] ); |
|
95
|
|
|
add_action( Application::TAXONOMY.'_term_new_form_tag', [$this->taxonomy, 'disableParents'] ); |
|
96
|
|
|
add_action( Application::TAXONOMY.'_add_form_fields', [$this->taxonomy, 'enableParents'] ); |
|
97
|
|
|
add_action( Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents'] ); |
|
98
|
|
|
add_action( 'restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9 ); |
|
99
|
|
|
} |
|
100
|
|
|
} |
|
101
|
|
|
|