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

112 lines 3.7 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 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 if (! empty( $section ) ) {
40 // View selected profile
41 require 'menu_view_profile.php';
42
43 } else {
44 // Show profiles list table
45
46 // Load WP_List_Table class
47 if (! class_exists('WP_List_Table') ) {
48 require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
49 }
50 require 'class-table-profiles.php';
51 $CPTableProfiles = new CodeProfiler_Table_Profiles();
52
53 // Profile(s) deletion
54 if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'delete_profiles' &&
55 ! empty( $_REQUEST['profiles'] ) ) {
56 // Verify security nonce
57 if ( wp_verify_nonce( $_REQUEST['_wpnonce'], 'bulk-'. $CPTableProfiles->_args['plural'] ) === false ) {
58 wp_nonce_ays('bulk-' . $CPTableProfiles->_args['plural'] );
59 }
60
61 $error = $CPTableProfiles->delete_profiles( $_REQUEST['profiles'] );
62 if ( $error === true ) {
63 printf(
64 CODE_PROFILER_ERROR_NOTICE,
65 esc_html__('Some errors occured when trying to delete the selected profiles.', 'code-profiler')
66 );
67 } else {
68 printf(
69 CODE_PROFILER_UPDATE_NOTICE,
70 esc_html__('The selected profiles were deleted.', 'code-profiler')
71 );
72 }
73 }
74
75 ?>
76 <br />
77 <form id="profile-form" method="post"<?php
78 if (! empty( $_SERVER['QUERY_STRING'] ) ) {
79 echo ' action="?'. esc_attr( $_SERVER['QUERY_STRING'] ) .'"';
80 }
81 ?> onsubmit="return cpjs_search_query();">
82
83 <?php
84 // Search query
85 if (! empty( $_REQUEST['s'] ) ) {
86 echo '<span class="subtitle">';
87 printf( esc_html__('Filter: %s'), '<code>' . esc_html( stripslashes( $_REQUEST['s'] ) ) . '</code>');
88 echo '</span>';
89 }
90 $CPTableProfiles->prepare_items();
91 $CPTableProfiles->search_box( esc_attr__('Filter', 'code-profiler'), 'search_id');
92 $CPTableProfiles->display();
93 ?>
94 </form>
95 <!-- Help -->
96 <div class="tablenav bottom">
97 <div id="cp-footer-help" style="display:none">
98 <?php
99 $type = 'profiles_list';
100 include 'help.php';
101 ?>
102 <br />
103 </div>
104 <div class="alignleft actions bulkactions">
105 <input type="button" class="button button-primary" style="min-width:100px" value="<?php esc_attr_e('Help', 'code-profiler')?>" onclick="jQuery('#cp-footer-help').slideToggle(500);"/>
106 </div>
107 </div>
108 <?php
109 }
110 // =====================================================================
111 // EOF
112