PluginProbe
Code Profiler – WordPress Performance Profiling and Debugging Made Easy / 1.4
Code Profiler – WordPress Performance Profiling and Debugging Made Easy v1.4
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.4, at lib/menu_profiles_list.php

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