1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace GeminiLabs\SiteReviews; |
4
|
|
|
|
5
|
|
|
use GeminiLabs\SiteReviews\Contracts\HooksContract; |
6
|
|
|
use GeminiLabs\SiteReviews\Controllers\AdminController; |
7
|
|
|
use GeminiLabs\SiteReviews\Controllers\BlocksController; |
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\RebusifyController; |
14
|
|
|
use GeminiLabs\SiteReviews\Controllers\ReviewController; |
15
|
|
|
use GeminiLabs\SiteReviews\Controllers\SettingsController; |
16
|
|
|
use GeminiLabs\SiteReviews\Controllers\TaxonomyController; |
17
|
|
|
use GeminiLabs\SiteReviews\Modules\Console; |
18
|
|
|
|
19
|
|
|
class Actions implements HooksContract |
20
|
|
|
{ |
21
|
|
|
protected $admin; |
22
|
|
|
protected $app; |
23
|
|
|
protected $blocks; |
24
|
|
|
protected $console; |
25
|
|
|
protected $editor; |
26
|
|
|
protected $listtable; |
27
|
|
|
protected $menu; |
28
|
|
|
protected $main; |
29
|
|
|
protected $public; |
30
|
|
|
protected $rebusify; |
31
|
|
|
protected $review; |
32
|
|
|
protected $router; |
33
|
|
|
protected $settings; |
34
|
|
|
protected $taxonomy; |
35
|
|
|
|
36
|
|
|
public function __construct(Application $app ) { |
37
|
|
|
$this->app = $app; |
38
|
|
|
$this->admin = $app->make(AdminController::class); |
39
|
|
|
$this->blocks = $app->make(BlocksController::class); |
40
|
|
|
$this->console = $app->make(Console::class); |
41
|
|
|
$this->editor = $app->make(EditorController::class); |
42
|
|
|
$this->listtable = $app->make(ListTableController::class); |
43
|
|
|
$this->main = $app->make(MainController::class); |
44
|
|
|
$this->menu = $app->make(MenuController::class); |
45
|
|
|
$this->public = $app->make(PublicController::class); |
46
|
|
|
$this->rebusify = $app->make(RebusifyController::class); |
47
|
|
|
$this->review = $app->make(ReviewController::class); |
48
|
|
|
$this->router = $app->make(Router::class); |
49
|
|
|
$this->settings = $app->make(SettingsController::class); |
50
|
|
|
$this->taxonomy = $app->make(TaxonomyController::class); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @return void |
55
|
|
|
*/ |
56
|
|
|
public function run() |
57
|
|
|
{ |
58
|
|
|
add_action('admin_enqueue_scripts', [$this->admin, 'enqueueAssets']); |
59
|
|
|
add_action('admin_init', [$this->admin, 'registerTinymcePopups']); |
60
|
|
|
add_action('media_buttons', [$this->admin, 'renderTinymceButton'], 11); |
61
|
|
|
add_action('plugins_loaded', [$this->app, 'getDefaults'], 11); |
62
|
|
|
add_action('plugins_loaded', [$this->app, 'registerAddons']); |
63
|
|
|
add_action('plugins_loaded', [$this->app, 'registerLanguages']); |
64
|
|
|
add_action('plugins_loaded', [$this->app, 'registerReviewTypes']); |
65
|
|
|
add_action('upgrader_process_complete', [$this->app, 'upgraded'], 10, 2); |
66
|
|
|
add_action('init', [$this->blocks, 'registerAssets'], 9); |
67
|
|
|
add_action('init', [$this->blocks, 'registerBlocks']); |
68
|
|
|
add_action('admin_footer', [$this->console, 'logOnce']); |
69
|
|
|
add_action('wp_footer', [$this->console, 'logOnce']); |
70
|
|
|
add_action('admin_enqueue_scripts', [$this->editor, 'customizePostStatusLabels']); |
71
|
|
|
add_action('add_meta_boxes_'.Application::POST_TYPE, [$this->editor, 'registerMetaBoxes']); |
72
|
|
|
add_action('admin_print_scripts', [$this->editor, 'removeAutosave'], 999); |
73
|
|
|
add_action('admin_menu', [$this->editor, 'removeMetaBoxes']); |
74
|
|
|
add_action('current_screen', [$this->editor, 'removePostTypeSupport']); |
75
|
|
|
add_action('post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox']); |
76
|
|
|
add_action('admin_head', [$this->editor, 'renderReviewFields']); |
77
|
|
|
add_action('admin_action_revert', [$this->editor, 'revertReview']); |
78
|
|
|
add_action('save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes']); |
79
|
|
|
add_action('admin_action_approve', [$this->listtable, 'approve']); |
80
|
|
|
add_action('bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2); |
81
|
|
|
add_action('restrict_manage_posts', [$this->listtable, 'renderColumnFilters']); |
82
|
|
|
add_action('manage_'.Application::POST_TYPE.'_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2); |
83
|
|
|
add_action('save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields']); |
84
|
|
|
add_action('pre_get_posts', [$this->listtable, 'setQueryForColumn']); |
85
|
|
|
add_action('admin_action_unapprove', [$this->listtable, 'unapprove']); |
86
|
|
|
add_action('init', [$this->main, 'registerPostType'], 8); |
87
|
|
|
add_action('init', [$this->main, 'registerShortcodes']); |
88
|
|
|
add_action('init', [$this->main, 'registerTaxonomy']); |
89
|
|
|
add_action('widgets_init', [$this->main, 'registerWidgets']); |
90
|
|
|
add_action('admin_menu', [$this->menu, 'registerMenuCount']); |
91
|
|
|
add_action('admin_menu', [$this->menu, 'registerSubMenus']); |
92
|
|
|
add_action('admin_init', [$this->menu, 'setCustomPermissions'], 999); |
93
|
|
|
add_action('wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999); |
94
|
|
|
add_filter('site-reviews/builder', [$this->public, 'modifyBuilder']); |
95
|
|
|
add_action('wp_footer', [$this->public, 'renderSchema']); |
96
|
|
|
add_action('site-reviews/review/created', [$this->rebusify, 'onCreated']); |
97
|
|
|
add_action('site-reviews/review/reverted', [$this->rebusify, 'onReverted']); |
98
|
|
|
add_action('site-reviews/review/saved', [$this->rebusify, 'onSaved']); |
99
|
|
|
add_action('updated_postmeta', [$this->rebusify, 'onUpdatedMeta'], 10, 4); |
100
|
|
|
add_action('set_object_terms', [$this->review, 'onAfterChangeCategory'], 10, 6); |
101
|
|
|
add_action('transition_post_status', [$this->review, 'onAfterChangeStatus'], 10, 3); |
102
|
|
|
add_action('site-reviews/review/created', [$this->review, 'onAfterCreate']); |
103
|
|
|
add_action('before_delete_post', [$this->review, 'onBeforeDelete']); |
104
|
|
|
add_action('update_postmeta', [$this->review, 'onBeforeUpdate'], 10, 4); |
105
|
|
|
add_action('admin_init', [$this->router, 'routeAdminPostRequest']); |
106
|
|
|
add_action('wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest']); |
107
|
|
|
add_action('wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest']); |
108
|
|
|
add_action('init', [$this->router, 'routePublicPostRequest']); |
109
|
|
|
add_action('admin_init', [$this->settings, 'registerSettings']); |
110
|
|
|
add_action(Application::TAXONOMY.'_term_edit_form_top', [$this->taxonomy, 'disableParents']); |
111
|
|
|
add_action(Application::TAXONOMY.'_term_new_form_tag', [$this->taxonomy, 'disableParents']); |
112
|
|
|
add_action(Application::TAXONOMY.'_add_form_fields', [$this->taxonomy, 'enableParents']); |
113
|
|
|
add_action(Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents']); |
114
|
|
|
add_action('restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9); |
115
|
|
|
add_action('set_object_terms', [$this->taxonomy, 'restrictTermSelection'], 9, 6); |
116
|
|
|
} |
117
|
|
|
} |
118
|
|
|
|