| @@ -1,89 +1,89 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -namespace FL\Assistant\Providers; | |
| 4 | - | |
| 5 | -use FL\Assistant\System\Contracts\ServiceProviderAbstract; | |
| 6 | -use FL\Assistant\Helpers\BeaverBuilderHelper; | |
| 7 | - | |
| 8 | -use FL\Assistant\Hooks\Actions\OnEditUserProfile; | |
| 9 | -use FL\Assistant\Hooks\Actions\OnEnqueueScripts; | |
| 10 | -use FL\Assistant\Hooks\Actions\OnPersonalOptionsUpdate; | |
| 11 | -use FL\Assistant\Hooks\Actions\OnWPBeforeAdminBarRender; | |
| 12 | -use FL\Assistant\Hooks\Actions\OnBeforeDeletePost; | |
| 13 | -use FL\Assistant\Hooks\Actions\OnDeleteTerm; | |
| 14 | -use FL\Assistant\Hooks\Actions\OnCustomizeRegister; | |
| 15 | -use FL\Assistant\Hooks\Actions\OnWPHead; | |
| 16 | -use FL\Assistant\Hooks\Actions\OnWP; | |
| 17 | - | |
| 18 | -use FL\Assistant\Hooks\Filters\OnHeartbeatReceived; | |
| 19 | -use FL\Assistant\Hooks\Filters\OnFLBuilderUIBarButtons; | |
| 20 | -use FL\Assistant\Hooks\Filters\OnScriptLoaderTag; | |
| 21 | - | |
| 22 | -use FL\Assistant\Hooks\AdminColumns; | |
| 23 | -use FL\Assistant\Hooks\ImageProxy; | |
| 24 | -use FL\Assistant\Hooks\PostPreview; | |
| 25 | -use FL\Assistant\Hooks\CustomizerPreview; | |
| 26 | - | |
| 27 | -class HooksServiceProvider extends ServiceProviderAbstract { | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * @throws \FL\Assistant\System\Container\InjectionException | |
| 31 | - */ | |
| 32 | - public function bootstrap() { | |
| 33 | - | |
| 34 | - register_activation_hook( | |
| 35 | - FL_ASSISTANT_FILE, function () { | |
| 36 | - do_action( 'fl_assistant_activate' ); | |
| 37 | - } | |
| 38 | - ); | |
| 39 | - | |
| 40 | - $this->actions(); | |
| 41 | - $this->filters(); | |
| 42 | - | |
| 43 | - new AdminColumns(); | |
| 44 | - new ImageProxy(); | |
| 45 | - new PostPreview(); | |
| 46 | - new CustomizerPreview(); | |
| 47 | - } | |
| 48 | - | |
| 49 | - public function actions() { | |
| 50 | - | |
| 51 | - // Enqueue Assistant frontend | |
| 52 | - $enqueue_scripts = $this->injector->make( OnEnqueueScripts::class ); | |
| 53 | - $priority = BeaverBuilderHelper::is_assistant_extension() ? 1 : 10; | |
| 54 | - add_action( 'wp_enqueue_scripts', $enqueue_scripts, $priority ); | |
| 55 | - add_action( 'admin_enqueue_scripts', $enqueue_scripts, $priority ); | |
| 56 | - add_action( 'fl_builder_ui_enqueue_scripts', $enqueue_scripts, $priority ); | |
| 57 | - | |
| 58 | - // setup user profile meta fields - shows on YOUR profile, not on others. | |
| 59 | - add_action( 'show_user_profile', $this->injector->make( OnEditUserProfile::class ) ); | |
| 60 | - add_action( 'personal_options_update', $this->injector->make( OnPersonalOptionsUpdate::class ) ); | |
| 61 | - | |
| 62 | - // Add Assistant Toolbar Item | |
| 63 | - add_action( 'wp_before_admin_bar_render', $this->injector->make( OnWPBeforeAdminBarRender::class ) ); | |
| 64 | - | |
| 65 | - // post actions | |
| 66 | - add_action( 'before_delete_post', $this->injector->make( OnBeforeDeletePost::class ) ); | |
| 67 | - | |
| 68 | - // taxonomy actions | |
| 69 | - add_action( 'delete_term', $this->injector->make( OnDeleteTerm::class ) ); | |
| 70 | - | |
| 71 | - // Customize register | |
| 72 | - add_action( 'customize_register', $this->injector->make( OnCustomizeRegister::class ) ); | |
| 73 | - | |
| 74 | - // Code snippets | |
| 75 | - add_action( 'wp_head', $this->injector->make( OnWPHead::class ) ); | |
| 76 | - add_action( 'wp', $this->injector->make( OnWP::class ) ); | |
| 77 | - | |
| 78 | - } | |
| 79 | - | |
| 80 | - public function filters() { | |
| 81 | - | |
| 82 | - // setup heartbeat | |
| 83 | - add_filter( 'heartbeat_received', $this->injector->make( OnHeartbeatReceived::class ), 11, 2 ); | |
| 84 | - | |
| 85 | - add_filter( 'fl_builder_ui_bar_buttons', $this->injector->make( OnFLBuilderUIBarButtons::class ) ); | |
| 86 | - | |
| 87 | - add_filter( 'script_loader_tag', $this->injector->make( OnScriptLoaderTag::class ), 10, 3 ); | |
| 88 | - } | |
| 89 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace FL\Assistant\Providers; | |
| 4 | + | |
| 5 | +use FL\Assistant\System\Contracts\ServiceProviderAbstract; | |
| 6 | +use FL\Assistant\Helpers\BeaverBuilderHelper; | |
| 7 | + | |
| 8 | +use FL\Assistant\Hooks\Actions\OnEditUserProfile; | |
| 9 | +use FL\Assistant\Hooks\Actions\OnEnqueueScripts; | |
| 10 | +use FL\Assistant\Hooks\Actions\OnPersonalOptionsUpdate; | |
| 11 | +use FL\Assistant\Hooks\Actions\OnWPBeforeAdminBarRender; | |
| 12 | +use FL\Assistant\Hooks\Actions\OnBeforeDeletePost; | |
| 13 | +use FL\Assistant\Hooks\Actions\OnDeleteTerm; | |
| 14 | +use FL\Assistant\Hooks\Actions\OnCustomizeRegister; | |
| 15 | +use FL\Assistant\Hooks\Actions\OnWPHead; | |
| 16 | +use FL\Assistant\Hooks\Actions\OnWP; | |
| 17 | + | |
| 18 | +use FL\Assistant\Hooks\Filters\OnHeartbeatReceived; | |
| 19 | +use FL\Assistant\Hooks\Filters\OnFLBuilderUIBarButtons; | |
| 20 | +use FL\Assistant\Hooks\Filters\OnScriptLoaderTag; | |
| 21 | + | |
| 22 | +use FL\Assistant\Hooks\AdminColumns; | |
| 23 | +use FL\Assistant\Hooks\ImageProxy; | |
| 24 | +use FL\Assistant\Hooks\PostPreview; | |
| 25 | +use FL\Assistant\Hooks\CustomizerPreview; | |
| 26 | + | |
| 27 | +class HooksServiceProvider extends ServiceProviderAbstract { | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * @throws \FL\Assistant\System\Container\InjectionException | |
| 31 | + */ | |
| 32 | + public function bootstrap() { | |
| 33 | + | |
| 34 | + register_activation_hook( | |
| 35 | + FL_ASSISTANT_FILE, function () { | |
| 36 | + do_action( 'fl_assistant_activate' ); | |
| 37 | + } | |
| 38 | + ); | |
| 39 | + | |
| 40 | + $this->actions(); | |
| 41 | + $this->filters(); | |
| 42 | + | |
| 43 | + new AdminColumns(); | |
| 44 | + new ImageProxy(); | |
| 45 | + new PostPreview(); | |
| 46 | + new CustomizerPreview(); | |
| 47 | + } | |
| 48 | + | |
| 49 | + public function actions() { | |
| 50 | + | |
| 51 | + // Enqueue Assistant frontend | |
| 52 | + $enqueue_scripts = $this->injector->make( OnEnqueueScripts::class ); | |
| 53 | + $priority = BeaverBuilderHelper::is_assistant_extension() ? 1 : 10; | |
| 54 | + add_action( 'wp_enqueue_scripts', $enqueue_scripts, $priority ); | |
| 55 | + add_action( 'admin_enqueue_scripts', $enqueue_scripts, $priority ); | |
| 56 | + add_action( 'fl_builder_ui_enqueue_scripts', $enqueue_scripts, $priority ); | |
| 57 | + | |
| 58 | + // setup user profile meta fields - shows on YOUR profile, not on others. | |
| 59 | + add_action( 'show_user_profile', $this->injector->make( OnEditUserProfile::class ) ); | |
| 60 | + add_action( 'personal_options_update', $this->injector->make( OnPersonalOptionsUpdate::class ) ); | |
| 61 | + | |
| 62 | + // Add Assistant Toolbar Item | |
| 63 | + add_action( 'wp_before_admin_bar_render', $this->injector->make( OnWPBeforeAdminBarRender::class ) ); | |
| 64 | + | |
| 65 | + // post actions | |
| 66 | + add_action( 'before_delete_post', $this->injector->make( OnBeforeDeletePost::class ) ); | |
| 67 | + | |
| 68 | + // taxonomy actions | |
| 69 | + add_action( 'delete_term', $this->injector->make( OnDeleteTerm::class ) ); | |
| 70 | + | |
| 71 | + // Customize register | |
| 72 | + add_action( 'customize_register', $this->injector->make( OnCustomizeRegister::class ) ); | |
| 73 | + | |
| 74 | + // Code snippets | |
| 75 | + add_action( 'wp_head', $this->injector->make( OnWPHead::class ) ); | |
| 76 | + add_action( 'wp', $this->injector->make( OnWP::class ) ); | |
| 77 | + | |
| 78 | + } | |
| 79 | + | |
| 80 | + public function filters() { | |
| 81 | + | |
| 82 | + // setup heartbeat | |
| 83 | + add_filter( 'heartbeat_received', $this->injector->make( OnHeartbeatReceived::class ), 11, 2 ); | |
| 84 | + | |
| 85 | + add_filter( 'fl_builder_ui_bar_buttons', $this->injector->make( OnFLBuilderUIBarButtons::class ) ); | |
| 86 | + | |
| 87 | + add_filter( 'script_loader_tag', $this->injector->make( OnScriptLoaderTag::class ), 10, 3 ); | |
| 88 | + } | |
| 89 | +} | |