PluginProbe
Post Snippets – Custom WordPress Code Snippets Customizer / trunk
Post Snippets – Custom WordPress Code Snippets Customizer vtrunk
4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.1 1.7.2 1.7.3 1.8 1.8.1 1.8.2 1.8.3 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.8.9.1 1.8.9.2 1.9 1.9.1 1.9.2 1.9.3 1.9.4 1.9.5 All 115 releases
post-snippets / src / PostSnippets / Help.php

Help.php in Post Snippets – Custom WordPress Code Snippets Customizer trunk, at src/PostSnippets/Help.php

131 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace PostSnippets;
3
4 if ( ! defined( 'ABSPATH' ) ) exit;
5
6 /**
7 * Handles the plugin help screen.
8 *
9 */
10 class Help
11 {
12 /**
13 * Define actions.
14 *
15 * @param string
16 * @return void
17 */
18 public function __construct($optionPage)
19 {
20 add_action('load-'.$optionPage, array(&$this, 'tabs'));
21
22 add_action('load-post.php', array(&$this, 'postEditor'));
23 add_action('load-post-new.php', array(&$this, 'postEditor'));
24 }
25
26 /**
27 * Load the post editor tab in the admin_head filter.
28 *
29 * We load the tab that will integrate in the post editor help menu via the
30 * admin_head hook, as we are not otherwise able to make it get ordered
31 * below the native help tabs.
32 *
33 * @return void.
34 */
35 public function postEditor()
36 {
37 add_action('admin_head', array(&$this, 'postEditorTabs'));
38 }
39
40 /**
41 * Setup the help tabs and sidebar.
42 *
43 * @return void
44 */
45 public function tabs()
46 {
47 $screen = get_current_screen();
48 $screen->set_help_sidebar($this->content('help/sidebar'));
49 $screen->add_help_tab(
50 array(
51 'id' => 'usage-plugin-help',
52 'title' => __('Usage', 'post-snippets'),
53 'content' => $this->content('help/usage')
54 )
55 );
56 $screen->add_help_tab(
57 array(
58 'id' => 'post-plugin-help',
59 'title' => __('Post Editor', 'post-snippets'),
60 'content' => $this->content('help/post')
61 )
62 );
63 if (!defined('POST_SNIPPETS_DISABLE_PHP')) {
64 $screen->add_help_tab(
65 array(
66 'id' => 'php-plugin-help',
67 'title' => __('PHP', 'post-snippets'),
68 'content' => $this->content('help/php')
69 )
70 );
71 }
72 $screen->add_help_tab(
73 array(
74 'id' => 'advanced-plugin-help',
75 'title' => __('Advanced', 'post-snippets'),
76 'content' => $this->content('help/advanced')
77 )
78 );
79 $screen->add_help_tab(
80 array(
81 'id' => 'filters-plugin-help',
82 'title' => __('Filters', 'post-snippets'),
83 'content' => $this->content('help/filters')
84 )
85 );
86 $screen->add_help_tab(
87 array(
88 'id' => 'restapi-plugin-help',
89 'title' => __('REST API', 'post-snippets'),
90 'content' => $this->content('help/restapi')
91 )
92 );
93 $screen->add_help_tab(
94 array(
95 'id' => 'gutenberg-plugin-help',
96 'title' => __('Gutenberg Block', 'post-snippets'),
97 'content' => $this->content('help/gutenberg')
98 )
99 );
100 }
101
102 /**
103 * Setup the help tab for the post editor.
104 *
105 * @return void
106 */
107 public function postEditorTabs()
108 {
109 $screen = get_current_screen();
110
111 $screen->add_help_tab(
112 array(
113 'id' => 'postsnippets-plugin-help',
114 'title' => 'Post Snippets',
115 'content' => $this->content('help/post')
116 )
117 );
118 }
119
120 /**
121 * Get the content for a help tab
122 *
123 * @param string $tab
124 * @return string
125 */
126 private function content($tab)
127 {
128 return View::render($tab);
129 }
130 }
131