PluginProbe
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More / trunk
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More vtrunk
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.10 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 47 releases
content-control / classes / Controllers / Admin / SettingsPage.php

SettingsPage.php in Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More trunk, at classes/Controllers/Admin/SettingsPage.php

74 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Settings Page Controller Class.
4 *
5 * @package ContentControl
6 */
7
8 namespace ContentControl\Controllers\Admin;
9
10 use ContentControl\Base\Controller;
11
12 defined( 'ABSPATH' ) || exit;
13
14 /**
15 * Settings Page Controller.
16 *
17 * @package ContentControl\Admin
18 */
19 class SettingsPage extends Controller {
20
21 /**
22 * Initialize the settings page.
23 */
24 public function init() {
25 add_action( 'admin_menu', [ $this, 'register_page' ], 999 );
26 add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
27 }
28
29 /**
30 * Register admin options pages.
31 *
32 * @return void
33 */
34 public function register_page() {
35 add_options_page(
36 __( 'Content Control', 'content-control' ),
37 __( 'Content Control', 'content-control' ),
38 'manage_options',
39 'content-control-settings',
40 [ $this, 'render_page' ]
41 );
42 }
43
44 /**
45 * Render settings page title & container.
46 *
47 * @return void
48 */
49 public function render_page() {
50 ?>
51 <div id="content-control-root-container"></div>
52 <script>jQuery(() => window.contentControl.settingsPage.init());</script>
53 <?php
54 }
55
56 /**
57 * Enqueue assets for the settings page.
58 *
59 * @param string $hook Page hook name.
60 *
61 * @return void
62 */
63 public function enqueue_scripts( $hook ) {
64 if ( 'settings_page_content-control-settings' !== $hook ) {
65 return;
66 }
67
68 wp_enqueue_editor();
69 wp_tinymce_inline_scripts();
70
71 wp_enqueue_script( 'content-control-settings-page' );
72 }
73 }
74