PluginProbe
Code Profiler – WordPress Performance Profiling and Debugging Made Easy / 1.5.1
Code Profiler – WordPress Performance Profiling and Debugging Made Easy v1.5.1
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_profiles_list.php

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

117 lines 3.9 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://code-profiler.com/ |
11 +=====================================================================+
12 */
13
14 if (! defined( 'ABSPATH' ) ) { die( 'Forbidden' ); }
15
16 // =====================================================================
17 // Display Profiles List tab.
18
19 echo code_profiler_display_tabs( 2 );
20
21 // Look for actions
22 $section = 0;
23 $section_list = [
24 1 => esc_html__('Plugins & Theme Performance', 'code-profiler'),
25 2 => esc_html__('File I/O Statistics', 'code-profiler'),
26 3 => esc_html__('Disk I/O Statistics', 'code-profiler'),
27 4 => esc_html__('Pro Features', 'code-profiler')
28 ];
29 if (! empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'view_profile' &&
30 ! empty( $_REQUEST['section'] ) && ! empty( $section_list[ $_REQUEST['section'] ] ) ) {
31 // Make sure the profile exists and get its full path
32 $profile_path = code_profiler_get_profile_path( $_REQUEST['id'] );
33 if ( $profile_path !== false ) {
34 $section = (int) $_REQUEST['section'];
35 $id = sanitize_text_field( $_REQUEST['id'] );
36 }
37 }
38
39 // Search query: get rid of slashes added by WordPress
40 if (! empty( $_REQUEST['s'] ) ) {
41 $_REQUEST['s'] = sanitize_text_field ( stripslashes( $_REQUEST['s'] ) );
42 }
43
44 if (! empty( $section ) ) {
45 // View selected profile
46 require 'menu_view_profile.php';
47
48 } else {
49 // Show profiles list table
50
51 // Load WP_List_Table class
52 if (! class_exists( 'WP_List_Table' ) ) {
53 require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
54 }
55 require 'class-table-profiles.php';
56 $CPTableProfiles = new CodeProfiler_Table_Profiles();
57
58 // Profile(s) deletion
59 if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'delete_profiles' &&
60 ! empty( $_REQUEST['profiles'] ) ) {
61 // Verify security nonce
62 if ( wp_verify_nonce( $_REQUEST['_wpnonce'], 'bulk-'. $CPTableProfiles->_args['plural'] ) === false ) {
63 wp_nonce_ays( 'bulk-' . $CPTableProfiles->_args['plural'] );
64 }
65
66 $error = $CPTableProfiles->delete_profiles( $_REQUEST['profiles'] );
67 if ( $error === true ) {
68 printf(
69 CODE_PROFILER_ERROR_NOTICE,
70 esc_html__('Some errors occured when trying to delete the selected profiles.', 'code-profiler' )
71 );
72 } else {
73 printf(
74 CODE_PROFILER_UPDATE_NOTICE,
75 esc_html__('The selected profiles were deleted.', 'code-profiler' )
76 );
77 }
78 }
79
80 ?>
81 <br />
82 <form id="profile-form" method="post"<?php
83 if (! empty( $_SERVER['QUERY_STRING'] ) ) {
84 echo ' action="?'. esc_attr( $_SERVER['QUERY_STRING'] ) .'"';
85 }
86 ?> onsubmit="return cpjs_search_query();">
87
88 <?php
89 // Search query
90 if (! empty( $_REQUEST['s'] ) ) {
91 echo '<span class="subtitle">';
92 printf( esc_html__( 'Filter: %s' ), '<code>' . esc_html( $_REQUEST['s'] ) . '</code>' );
93 echo '</span>';
94 }
95 $CPTableProfiles->prepare_items();
96 $CPTableProfiles->search_box( esc_attr__('Filter', 'code-profiler'), 'search_id' );
97 $CPTableProfiles->display();
98 ?>
99 </form>
100 <!-- Help -->
101 <div class="tablenav bottom">
102 <div id="cp-footer-help" style="display:none">
103 <?php
104 $type = 'profiles_list';
105 include 'help.php';
106 ?>
107 <br />
108 </div>
109 <div class="alignleft actions bulkactions">
110 <input type="button" class="button-primary" style="min-width:100px" value="<?php esc_attr_e('Help', 'code-profiler' )?>" onclick="jQuery('#cp-footer-help').slideToggle(500);"/>
111 </div>
112 </div>
113 <?php
114 }
115 // =====================================================================
116 // EOF
117