PluginProbe
Code Embed / 2.6.1
Code Embed v2.6.1
2.6.4 2.6.3 2.6.2 2.6.1 trunk 1.0 1.1 1.2 1.3 1.4.1 1.5.1 1.6.1 2.0.2 2.1.2 2.2.2 2.3.9 2.4 2.5.1 2.5.2 2.6
simple-embed-code / includes / screens.php

screens.php in Code Embed 2.6.1, at includes/screens.php

165 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Add screens
4 *
5 * Add settings and tools screens.
6 *
7 * @package simple-embed-code
8 */
9
10 // Exit if accessed directly.
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit;
14 }
15
16 /**
17 * Code Embed Menu
18 *
19 * Add a new option to the Admin menu and sub-menus.
20 */
21 function ce_menu() {
22
23 // Add search sub-menu.
24
25 global $ce_search_hook;
26
27 $ce_search_hook = add_submenu_page( 'tools.php', __( 'Code Embed Search', 'simple-embed-code' ), __( 'Code Search', 'simple-embed-code' ), 'edit_posts', 'ce-search', 'ce_search' );
28
29 add_action( 'load-' . $ce_search_hook, 'ce_add_search_help' );
30
31 // Add options sub-menu.
32
33 global $ce_options_hook;
34
35 $ce_options_hook = add_submenu_page( 'options-general.php', __( 'Code Embed Settings', 'simple-embed-code' ), __( 'Code Embed', 'simple-embed-code' ), 'manage_options', 'ce-options', 'ce_options' );
36
37 add_action( 'load-' . $ce_options_hook, 'ce_add_options_help' );
38 }
39
40 add_action( 'admin_menu', 'ce_menu' );
41
42 /**
43 * Add Options Help
44 *
45 * Add help tab to options screen.
46 *
47 * @uses ce_options_help() Return help text.
48 */
49 function ce_add_options_help() {
50
51 global $ce_options_hook;
52 $screen = get_current_screen();
53
54 if ( $screen->id !== $ce_options_hook ) {
55 return;
56 }
57
58 $screen->add_help_tab(
59 array(
60 'id' => 'ce-options-help-tab',
61 'title' => __( 'Help', 'simple-embed-code' ),
62 'content' => ce_options_help(),
63 )
64 );
65
66 $screen->set_help_sidebar( ce_help_sidebar() );
67 }
68
69 /**
70 * Add Search Help
71 *
72 * Add help tab to search screen.
73 *
74 * @uses ce_search_help() Return help text.
75 */
76 function ce_add_search_help() {
77
78 global $ce_search_hook;
79 $screen = get_current_screen();
80
81 if ( $screen->id !== $ce_search_hook ) {
82 return;
83 }
84
85 $screen->add_help_tab(
86 array(
87 'id' => 'ce-search-help-tab',
88 'title' => __( 'Help', 'simple-embed-code' ),
89 'content' => ce_search_help(),
90 )
91 );
92
93 $screen->set_help_sidebar( ce_help_sidebar() );
94 }
95
96 /**
97 * Code Embed Options
98 *
99 * Define an option screen.
100 */
101 function ce_options() {
102
103 include_once __DIR__ . '/options-screen.php';
104 }
105
106 /**
107 * Code Embed Search
108 *
109 * Define the search screen.
110 */
111 function ce_search() {
112
113 include_once __DIR__ . '/search-screen.php';
114 }
115
116 /**
117 * Code Embed Options Help
118 *
119 * Return help text for options screen.
120 *
121 * @return string Help Text.
122 */
123 function ce_options_help() {
124
125 $help_text = '<p>' . __( 'Use this screen to modify the various settings, including the identifiers and keyword used to specify your embedded code.', 'simple-embed-code' ) . '</p>';
126 $help_text .= '<p>' . __( 'The first option specifies whether code embed requests should work in excerpts.', 'simple-embed-code' ) . '</p>';
127 $help_text .= '<p>' . __( 'The keyword is the name used for your custom field. The custom field\'s value is the code that you wish to embed.', 'simple-embed-code' ) . '</p>';
128 $help_text .= '<p>' . __( 'The keyword, sandwiched with the identifier before and after, is what you then need to add to your post or page to activate the embed code.', 'simple-embed-code' ) . '</p>';
129
130 return $help_text;
131 }
132
133 /**
134 * Code Embed Search Help
135 *
136 * Return help text for search screen.
137 *
138 * @return string Help Text.
139 */
140 function ce_search_help() {
141
142 $help_text = '<p>' . __( 'This screen allows you to search for posts and pages that a particular code embed has been used in.', 'simple-embed-code' ) . '</p>';
143 $help_text .= '<p>' . __( 'Simply enter the code suffix that you wish to search for and press the \'Search\' button to display a list of all the posts using it. In addition, the code will be shown alongside it. Click on the post name to edit the post.', 'simple-embed-code' ) . '</p>';
144 $help_text .= '<p>' . __( 'The search results are grouped together in matching code groups, so posts with the same code will be shown together with the same color background.', 'simple-embed-code' ) . '</p>';
145
146 return $help_text;
147 }
148
149 /**
150 * Code Embed Help Sidebar
151 *
152 * Return sidebar help text.
153 *
154 * @return string Help Text.
155 */
156 function ce_help_sidebar() {
157
158 $help_text = '<p><strong>' . __( 'For more information:', 'simple-embed-code' ) . '</strong></p>';
159 $help_text .= '<p><a href="' . esc_url( 'https://wordpress.org/plugins/simple-embed-code/' ) . '">' . __( 'Instructions', 'simple-embed-code' ) . '</a></p>';
160 $help_text .= '<p><a href="' . esc_url( 'https://github.com/dartiss/code-embed' ) . '">' . __( 'Github (code and issues)', 'simple-embed-code' ) . '</a></p>';
161 $help_text .= '<p><a href="' . esc_url( 'https://wordpress.org/support/plugin/simple-embed-code' ) . '">' . __( 'Support Forum', 'simple-embed-code' ) . '</a></p>';
162
163 return $help_text;
164 }
165