PluginProbe
Code Profiler – WordPress Performance Profiling and Debugging Made Easy / 1.8
Code Profiler – WordPress Performance Profiling and Debugging Made Easy v1.8
1.9.5 1.9.4 1.9.3 trunk 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.6 1.6.1 1.6.10 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 All 40 releases
code-profiler / lib / menu_profiler.php

menu_profiler.php in Code Profiler – WordPress Performance Profiling and Debugging Made Easy 1.8, at lib/menu_profiler.php

459 lines 21.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 +=====================================================================+
4 | ____ _ ____ __ _ _ |
5 | / ___|___ __| | ___ | _ \ _ __ ___ / _(_) | ___ _ __ |
6 | | | / _ \ / _` |/ _ \ | |_) | '__/ _ \| |_| | |/ _ \ '__| |
7 | | |__| (_) | (_| | __/ | __/| | | (_) | _| | | __/ | |
8 | \____\___/ \__,_|\___| |_| |_| \___/|_| |_|_|\___|_| |
9 | |
10 | (c) Jerome Bruandet ~ https://nintechnet.com/codeprofiler/ |
11 +=====================================================================+
12 */
13
14 if (! defined('ABSPATH') ) { die('Forbidden'); }
15
16 // =====================================================================
17 // Display Summary tab.
18
19 // Used to display profiler's error messages while running
20 echo '<div class="error notice is-dismissible" style="display:none" id="code-profiler-error"><p></p></div>';
21 echo code_profiler_display_tabs( 1 );
22 $error = 0;
23 if (! function_exists('register_tick_function') ) {
24 $error = 'register_tick_function';
25 } elseif (! function_exists('stream_wrapper_unregister') ) {
26 $error = 'stream_wrapper_unregister';
27 } elseif (! function_exists('stream_wrapper_register') ) {
28 $error = 'stream_wrapper_register';
29 } elseif (! function_exists('stream_wrapper_restore') ) {
30 $error = 'stream_wrapper_restore';
31 }
32 if (! empty( $error ) ) {
33 printf( CODE_PROFILER_ERROR_NOTICE, sprintf(
34 esc_html__('Your PHP configuration is missing the "%s" function. Code Profiler cannot run without it. Please contact your server administrator about this error.', 'code-profiler'), $error )
35 );
36 }
37 if (! is_writable( CODE_PROFILER_UPLOAD_DIR ) ) {
38 printf( CODE_PROFILER_ERROR_NOTICE, sprintf(
39 esc_html__('The following folder is not writable: %s. Please change its permissions or ownership so that Code Profiler can write to it.', 'code-profiler'), CODE_PROFILER_UPLOAD_DIR )
40 );
41 }
42
43 // Clear the log if it's too big
44 code_profiler_clearlog();
45
46 // Clean-up temp files left in the profiles folder
47 code_profiler_cleantmpfiles();
48
49 $home = home_url('/'); // Frontend
50 $site = site_url('/'); // Backend
51
52 // Get user login name
53 $current_user = wp_get_current_user();
54
55 $cp_options = get_option('code-profiler');
56 /**
57 * Check if we've been asked to re-run a profile.
58 */
59 if (! empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'rerun' &&
60 ! empty( $_REQUEST['profiles'][0] ) ) {
61 /**
62 * Make sure the profile exists and get its full path.
63 */
64 $profile_path = code_profiler_get_profile_path( $_REQUEST['profiles'][0] );
65 if ( $profile_path !== false ) {
66
67 $cp_data = json_decode( file_get_contents("$profile_path.summary.profile"), true );
68 if (! empty( $cp_data['rerun'] ) ) {
69 $cp_options['mem'] = $cp_data['rerun'];
70 $rerun = true;
71 }
72 }
73 }
74 // Profile's name
75 if (! empty( $cp_options['mem']['profile'] ) ) {
76 $profile = $cp_options['mem']['profile'];
77 } else {
78 $profile = code_profiler_profile_name();
79 }
80 /**
81 * Memorized options from last run.
82 */
83 if ( empty( $cp_options['mem']['x_end'] ) ) {
84 $cp_options['mem']['x_end'] = 'frontend';
85 }
86 if ( empty( $cp_options['mem']['post'] ) ) {
87 $cp_options['mem']['post'] = '';
88 }
89 if ( empty( $cp_options['mem']['x_auth'] ) ) {
90 $cp_options['mem']['x_auth'] = 'unauthenticated';
91 }
92 if ( $cp_options['mem']['x_end'] == 'backend') {
93 $cp_options['mem']['x_auth'] = 'authenticated';
94 }
95 if ( empty( $cp_options['mem']['method'] ) ) {
96 $cp_options['mem']['method'] = 'get';
97 }
98 $default_theme = get_option('stylesheet');
99 if ( empty( $cp_options['mem']['theme'] ) ) {
100 $cp_options['mem']['theme'] = $default_theme;
101 }
102 if ( empty( $cp_options['mem']['user_agent'] ) ) {
103 $cp_options['mem']['user_agent'] = 'Firefox';
104 }
105 if ( isset( $cp_options['mem']['cookies'] ) ) {
106 // stripslashes is only needed for cookies
107 $cookies = trim( stripslashes( json_decode( $cp_options['mem']['cookies'] ) ) );
108 } else {
109 $cookies = '';
110 }
111 if ( empty( $cp_options['mem']['content_type'] ) ||
112 ! in_array( $cp_options['mem']['content_type'], [ 1, 2, 3 ] ) ) {
113
114 $cp_options['mem']['content_type'] = 1;
115 }
116 if ( isset( $cp_options['mem']['payload'] ) ) {
117 $payload = trim( json_decode( $cp_options['mem']['payload'] ) );
118 } else {
119 $payload = '';
120 }
121 if ( isset( $cp_options['mem']['custom_headers'] ) ) {
122 $custom_headers = trim( json_decode( $cp_options['mem']['custom_headers'] ) );
123 } else {
124 $custom_headers = '';
125 }
126 if ( isset( $cp_options['mem']['exclusions'] ) ) {
127 $exclusions = json_decode( $cp_options['mem']['exclusions'] );
128 } else {
129 $exclusions = [];
130 }
131
132 ?>
133
134 <table style="width:100%">
135 <tr>
136 <td>
137 <table class="form-table">
138 <tr>
139 <th scope="row"><?php esc_html_e('Page to profile', 'code-profiler') ?> <span class="code-profiler-tip" data-tip="<?php esc_attr_e('Select the page you want the profiler to analyze. It can be in the frontend of the site, in the admin backend or a custom URL.', 'code-profiler') ?>"></span></th>
140 <td>
141 <p><label><input type="radio" name="x_end" value="frontend" onclick="cpjs_front_or_backend(1);"<?php checked( $cp_options['mem']['x_end'], 'frontend') ?> /> <?php esc_html_e('Website frontend', 'code-profiler') ?></label>
142 &nbsp;&nbsp;&nbsp;&nbsp;
143 <label><input type="radio" name="x_end" value="custom" onclick="cpjs_front_or_backend(3);"<?php checked( $cp_options['mem']['x_end'], 'custom') ?> /> <?php esc_html_e('Custom post/URL', 'code-profiler') ?></label>
144 &nbsp;&nbsp;&nbsp;&nbsp;
145 <label><input type="radio" name="x_end" value="backend" onclick="cpjs_front_or_backend(2);"<?php checked( $cp_options['mem']['x_end'], 'backend') ?> /> <?php esc_html_e('Admin backend', 'code-profiler') ?></label>
146 </p>
147 <br />
148 <?php
149 if ( $cp_options['mem']['x_end'] == 'frontend') {
150 echo '<p id="p-frontend">';
151 } else {
152 echo '<p id="p-frontend" style="display:none">';
153 }
154 ?>
155 <?php esc_html_e('Select a page:', 'code-profiler') ?>
156 <select name="frontend" id="id-frontend">
157 <?php echo code_profiler_fetch_pages( $home, $cp_options ); ?>
158 </select>
159 </p>
160 <?php
161 if ( $cp_options['mem']['x_end'] == 'custom') {
162 $value = $cp_options['mem']['post'];
163 echo '<p id="p-custom">';
164 } else {
165 $value = '';
166 echo '<p id="p-custom" style="display:none">';
167 }
168 ?>
169 <input name="custom" id="id-custom" type="text" value="<?php echo esc_attr( $value ) ?>" size="70" placeholder="<?php
170 echo esc_attr(
171 sprintf(
172 __('e.g., %s', 'code-profiler'),
173 "{$home}foo/bar/"
174 )
175 ) ?>" />
176 </p>
177 <?php
178 if ( $cp_options['mem']['x_end'] == 'backend') {
179 echo '<p id="p-backend">';
180 } else {
181 echo '<p id="p-backend" style="display:none">';
182 }
183 if (! empty( $cp_options['mem']['username'] ) ) {
184 $username = $cp_options['mem']['username'];
185 } else {
186 $username = $current_user->user_login;
187 }
188 ?>
189 <?php esc_html_e('Select a page:', 'code-profiler') ?>
190 <select name="backend" id="id-backend"><?php echo code_profiler_fetch_admin_pages( $site, $cp_options ) ?></select>
191 </p>
192 </td>
193 </tr>
194 <tr>
195 <th scope="row"><?php esc_html_e('Run profiler as', 'code-profiler') ?> <span class="code-profiler-tip" data-tip="<?php esc_attr_e('The profiler can access the requested page as an unauthenticated user (frontend only) or as an authenticated user (frontend and backend). You can enter the login name of any registered user, but make sure that the user has the required capability to access the page you are going to profile, otherwise Code Profiler will return an error if the user isn\'t allowed to access it.', 'code-profiler') ?>"></span></th>
196 <td>
197 <p><label><input type="radio" onclick="cpjs_authenticated(0);" name="x_auth" value="unauthenticated" id="user-unauthenticated"<?php checked( $cp_options['mem']['x_auth'], 'unauthenticated'); disabled( $cp_options['mem']['x_end'], 'backend'); ?> /> <?php esc_html_e('Unauthenticated user', 'code-profiler') ?></label></p>
198 <p><label><input type="radio" onclick="cpjs_authenticated(1);" name="x_auth" value="authenticated" id="user-authenticated"<?php checked( $cp_options['mem']['x_auth'], 'authenticated') ?> /> <?php esc_html_e('Authenticated user', 'code-profiler') ?></label></p>
199 <p><label><?php esc_html_e('User:', 'code-profiler') ?> <input type="text" name="username" id="user-name" value ="<?php esc_attr_e( $username ) ?>"<?php disabled( $cp_options['mem']['x_auth'], 'unauthenticated') ?> /></label></p>
200 </td>
201 </tr>
202 <tr>
203 <th scope="row"><?php esc_html_e('Theme', 'code-profiler') ?> <span class="code-profiler-tip" data-tip="<?php esc_attr_e('If you want to profile different themes, you can use this option so that you don\'t need to modify your WordPress settings. The change will not affect your visitors, but only the profiler when it is running.', 'code-profiler') ?>"></span></th>
204 <td>
205 <select name="theme" id="id-theme">
206 <?php
207 $themes = code_profiler_get_themes();
208 foreach( $themes as $slug => $name ) {
209 if ( $slug == $default_theme ) {
210 echo '<option value=""'. selected( $cp_options['mem']['theme'], $slug, false ) .'>'.
211 esc_html( $name['n'] ) .' '. __('(active theme)', 'code-profiler') .'</option>';
212 } else {
213 echo '<option value="'. esc_attr( $slug ) .'"'. selected( $cp_options['mem']['theme'], $slug, false ) .'>'.
214 esc_html( $name['n'] ) .'</option>';
215 }
216 }
217 ?>
218 </select>
219 </td>
220 </tr>
221 <tr>
222 <th scope="row"><?php esc_html_e('User agent', 'code-profiler') ?> <span class="code-profiler-tip" data-tip="<?php esc_attr_e('Some themes and plugins may execute different code depending on the type of device used to visit the website (e.g., a desktop computer, a mobile phone, a search engine bot etc). This option lets you change the User-Agent request header used by Code Profiler.', 'code-profiler') ?>"></span></th>
223 <td>
224 <select name="user_agent" id="ua-id">
225 <?php
226 foreach( CODE_PROFILER_UA as $types => $types_array ) {
227 echo '<optgroup label="'. esc_attr( $types ) .'">';
228 foreach( $types_array as $name => $value ) {
229 echo '<option value="'. esc_attr( $name ) .'"'. selected( $cp_options['mem']['user_agent'], $name, false ) .'>'. esc_html( $name ) .'</option>';
230 }
231 echo '</optgroup>';
232 }
233 ?>
234 </select>
235 </td>
236 </tr>
237 <tr>
238 <th scope="row"><?php esc_html_e('Name of the profile', 'code-profiler') ?> <span class="code-profiler-tip" data-tip="<?php esc_attr_e('Enter the name for this profile. It will be saved to the "Profiles List" page, with all other profiles.', 'code-profiler') ?>"></span></th>
239 <td>
240 <p><label><input type="text" class="regular-text" name="profile" maxlength="100" value="<?php echo esc_attr( $profile ) ?>" id="profile-name" /></label></p>
241 <p class="description"><?php esc_html_e('Max 100 characters', 'code-profiler') ?></p>
242 </td>
243 </tr>
244 </table>
245 </td>
246 <td style="vertical-align:top;text-align: center">
247 <?php
248 /**
249 * Display any available discount coupon.
250 */
251 CodeProfiler_WPCron::display_coupon();
252 ?>
253 </td>
254 </tr>
255 </table>
256 <?php
257
258 if (! empty( $cookies ) || ! empty( $custom_headers ) || $cp_options['mem']['method'] == 'post' || ! empty( $exclusions ) ) {
259 echo '<div id="cp-advanced-settings">';
260 $disabled_button = ' disabled';
261 } else {
262 echo '<div id="cp-advanced-settings" style="display:none">';
263 $disabled_button = '';
264 }
265 ?>
266 <table class="form-table">
267 <tr>
268 <th scope="row"><?php esc_html_e('HTTP Method', 'code-profiler') ?> <span class="code-profiler-tip" data-tip="<?php esc_attr_e('You can select which HTTP method will be used by the profiler: GET or POST. If you select POST, you can also send an optional payload.', 'code-profiler') ?>"></span></th>
269 <td>
270 <p>
271 <label>
272 <input onclick="cpjs_get_post(0);" type="radio" name="method" value="get" id="get-method"<?php checked( $cp_options['mem']['method'], 'get') ?> /> GET(<?php esc_html_e('default', 'code-profiler') ?>)
273 </label>
274 </p>
275 <p>
276 <label>
277 <input onclick="cpjs_get_post(1);" type="radio" name="method" value="post" id="post-method"<?php checked( $cp_options['mem']['method'], 'post') ?> /> POST
278 </label>
279 </p>
280 <p>
281 <?php esc_html_e('Content-type:', 'code-profiler') ?>
282 <select name="cp-content-type" id="id-content-type"<?php disabled( $cp_options['mem']['method'], 'get') ?> onChange="cpjs_content_type(this.value);">
283 <option value="1"<?php selected( $cp_options['mem']['content_type'], 1 )?>>application/x-www-form-urlencoded (<?php esc_html_e('formatted', 'code-profiler') ?>)</option>
284 <option value="3"<?php selected( $cp_options['mem']['content_type'], 3 )?>>application/x-www-form-urlencoded (<?php esc_html_e('raw', 'code-profiler') ?>)</option>
285 <option value="2"<?php selected( $cp_options['mem']['content_type'], 2 )?>>application/json</option>
286 </select>
287 </p>
288 <p>
289 <textarea name="post-value" id="post-value" class="regular-text code"<?php disabled( $cp_options['mem']['method'], 'get') ?> maxlength="4000" rows="6"><?php echo esc_textarea( $payload ) ?></textarea>
290 </p>
291 <p class="description" id="ct-1"<?php echo code_profiler_showhide( $cp_options['mem']['content_type'], 1 ) ?>>
292 <?php printf( esc_html__('Optional POST payload in %s format, one item per line.', 'code-profiler'), '<code>name=value</code>') ?> <?php printf( esc_html__('%sView example%s', 'code-profiler'), '<a href="'. plugins_url('/static/help/http_method-1.png', dirname( __FILE__ ) ) .'" target="_blank" rel="noopener noreferrer">', '</a>') ?>
293 </p>
294 <p class="description" id="ct-3"<?php echo code_profiler_showhide( $cp_options['mem']['content_type'], 3 ) ?>>
295 <?php printf( esc_html__('Optional raw POST payload, on a single line.', 'code-profiler'), '<code>name=value</code>') ?> <?php printf( esc_html__('%sView example%s', 'code-profiler'), '<a href="'. plugins_url('/static/help/http_method-3.png', dirname( __FILE__ ) ) .'" target="_blank" rel="noopener noreferrer">', '</a>') ?>
296 </p>
297 <p class="description" id="ct-2"<?php echo code_profiler_showhide( $cp_options['mem']['content_type'], 2 ) ?>>
298 <?php printf( esc_html__('Optional JSON-encoded payload, on a single line.', 'code-profiler'), '<code>name=value</code>') ?> <?php printf( esc_html__('%sView example%s', 'code-profiler'), '<a href="'. plugins_url('/static/help/http_method-2.png', dirname( __FILE__ ) ) .'" target="_blank" rel="noopener noreferrer">', '</a>') ?>
299 </p>
300 </td>
301 </tr>
302 <tr>
303 <th scope="row"><?php esc_html_e('Cookie', 'code-profiler') ?> <span class="code-profiler-tip" data-tip="<?php esc_attr_e('Some websites may execute different code if the user has one or more specific cookies. You can use this field for that purpose.', 'code-profiler') ?>"></span></th>
304 <td>
305 <p><textarea name="cp-cookies" id="cp-cookies" class="regular-text code" maxlength="4000" rows="6"><?php echo esc_textarea( $cookies ) ?></textarea></p>
306 <p class="description"><?php printf( esc_html__('Optional cookie in %s format, one item per line.', 'code-profiler'), '<code>name=value</code>') ?> <?php printf( esc_html__('%sView example%s', 'code-profiler'), '<a href="'. plugins_url('/static/help/cookies.png', dirname( __FILE__ ) ) .'" target="_blank" rel="noopener noreferrer">', '</a>') ?></p>
307 </td>
308 </tr>
309 <tr>
310 <th scope="row" class="row-med"><?php esc_html_e('HTTP headers', 'code-profiler'); ?> <span class="code-profiler-tip" data-tip="<?php esc_attr_e('You can use this field to add custom HTTP headers or even override existing ones (e.g., host, user-agent, accept-language etc). HTTP header names are case-insensitive and Code Profiler will automatically convert them to lowercase. HTTP header values are case-sensitive and only ASCII printable characters are allowed.', 'code-profiler') ?>"></span></th>
311 <td>
312 <textarea autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" id="custom-headers" name="custom_headers" class="regular-text code" rows="6"><?php echo esc_textarea( $custom_headers ) ?></textarea>
313 <p class="description"><?php printf( esc_html__('Optional HTTP header in %s format, one item per line.', 'code-profiler'), '<code>name: value</code>') ?> <?php printf( esc_html__('%sView example%s', 'code-profiler'), '<a href="'. plugins_url('/static/help/custom_headers.png', dirname( __FILE__ ) ) .'" target="_blank" rel="noopener noreferrer">', '</a>') ?></p>
314 </td>
315 </tr>
316 <tr>
317 <th scope="row" class="row-med"><?php esc_html_e('File and folder exclusions', 'code-profiler'); ?> <span class="code-profiler-tip" data-tip="<?php esc_attr_e('This option lets you exclude files and folders from the profiling process. It can be a full path, a file or a folder name, or any part of them (substring). Values are case-sensitive and only ASCII printable characters are allowed.', 'code-profiler') ?>"></span></th>
318 <td>
319 <textarea autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" id="exclusions" name="exclusions" class="regular-text code" rows="6"><?php
320 foreach( $exclusions as $item ) {
321 echo esc_textarea( $item ) ."\n";
322 }
323 ?></textarea>
324 <p class="description"><?php esc_html_e('One item per line.', 'code-profiler') ?> <?php printf( esc_html__('%sView example%s', 'code-profiler'), '<a href="'. plugins_url('/static/help/exclusions.png', dirname( __FILE__ ) ) .'" target="_blank" rel="noopener noreferrer">', '</a>') ?></p>
325 </td>
326 </tr>
327 </table>
328 </div>
329 <?php wp_nonce_field('start_profiler_nonce', 'cp_nonce', 0); ?>
330 <br />
331 <div>
332 <input type="button" class="button button-secondary" id="button-adv-settings" name="adv-settings" value="<?php esc_attr_e('Advanced Options', 'code-profiler') ?>" onclick="cpjs_show_adv_settings();"<?php echo $disabled_button ?> />
333 &nbsp;&nbsp;&nbsp;
334 <input type="button" class="button button-primary" id="start-profile" name="start-profile" onClick="cpjs_start_profiler();" value="<?php esc_attr_e('Start Profiling', 'code-profiler') ?> »" title="<?php esc_attr_e('Click to start profiling your code.', 'code-profiler') ?>" />
335 </div>
336 <div id="cp-progress-div" style="display:none">
337 <br />
338 <div class="cp-progress-bar"><span id="cp-span-progress" style="width:0%"></span></div>
339 <img style="vertical-align:middle;display:none" id="progress-gif" src="<?php echo plugins_url('/static/progress.gif', dirname (__FILE__ ) ) ?>" />&nbsp;&nbsp;<font id="progress-text" style="display:none"><?php esc_html_e('Starting the profiler...', 'code-profiler') ?></font>
340 </div>
341 <?php
342
343 /**
344 * Re-run a profile.
345 */
346 if (! empty( $rerun ) ) {
347 echo '<script>window.addEventListener("load", cpjs_start_profiler);</script>';
348 }
349
350 // =====================================================================
351 // Fetch pages and posts.
352
353 function code_profiler_fetch_pages( $home, $cp_options ) {
354
355 $posts = '';
356
357 if ( empty( $cp_options['mem']['post'] ) ) {
358 $cp_options['mem']['post'] = $home;
359 }
360
361 if ( $cp_options['mem']['post'] == $home ) {
362 $pages = sprintf(
363 '<option value="%1$s" title="%1$s" selected>%2$s</option>',
364 esc_attr( $home ),
365 esc_html__('Homepage', 'code-profiler')
366 );
367 } else {
368 $pages = sprintf(
369 '<option value="%1$s" title="%1$s">%2$s</option>',
370 esc_attr( $home ),
371 esc_html__('Homepage', 'code-profiler')
372 );
373 }
374 $args = [
375 'posts_per_page' => -1,
376 'post_type' => ['page'],
377 'post_status' => 'publish',
378 'orderby' => 'post_name',
379 'order' => 'ASC'
380 ];
381 $query = new WP_Query( $args );
382
383 if ( $query ) {
384 $items = $query->posts;
385 foreach( $items as $item ) {
386 if ( empty( $item->post_title ) ) {
387 $item->post_title = __('Untitled');
388 }
389 $permalink = get_permalink( $item->ID );
390
391 if ( $cp_options['mem']['post'] == $permalink ) {
392 $pages .= sprintf(
393 '<option value="%1$s" title="%1$s" selected>%2$s</option>',
394 esc_attr( $permalink ),
395 esc_html( $item->post_title )
396 );
397 } else {
398 $pages .= sprintf(
399 '<option value="%1$s" title="%1$s">%2$s</option>',
400 esc_attr( $permalink ),
401 esc_html( $item->post_title )
402 );
403 }
404 }
405 }
406
407 return sprintf('<optgroup label="%s">%s</optgroup>',
408 esc_attr__('Pages', 'code-profiler'),
409 $pages
410 );
411 }
412
413 // =====================================================================
414 // Fetch admin pages (backend)
415
416 function code_profiler_fetch_admin_pages( $home, $cp_options ) {
417
418 $backend = '';
419
420 if ( empty( $cp_options['mem']['post'] ) ) {
421 $cp_options['mem']['post'] = $home;
422 }
423
424 if (! empty( $GLOBALS[ 'menu' ] ) ) {
425 foreach( $GLOBALS[ 'menu' ] as $menu => $value ) {
426 if (! empty( $value[0] ) && substr( $value[2], -4 ) == '.php') {
427 // E.g., "Comments", "Plugins" etc
428 $value[0] = trim( preg_replace('/\s*<.+$/', '', $value[0] ) );
429
430 if ( $cp_options['mem']['post'] == "{$home}wp-admin/{$value[2]}" ) {
431 $backend .= sprintf(
432 '<option value="%1$s" title="%1$s" selected>%2$s</option>',
433 esc_attr("{$home}wp-admin/{$value[2]}"),
434 esc_html( $value[0] )
435 );
436 } else {
437 $backend .= sprintf(
438 '<option value="%1$s" title="%1$s">%2$s</option>',
439 esc_attr("{$home}wp-admin/{$value[2]}"),
440 esc_html( $value[0] )
441 );
442 }
443 }
444 }
445 }
446 if ( empty( $backend ) ) {
447 $backend = sprintf(
448 '<option value="%1$swp-admin/" title="%1$swp-admin/">%2$s</option>',
449 esc_attr( $home ),
450 esc_html__('Dashboard', 'code-profiler')
451 );
452
453 }
454 return $backend;
455 }
456
457 // =====================================================================
458 // EOF
459