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_view_profile.php

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

207 lines 6.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://code-profiler.com/ |
11 +=====================================================================+
12 */
13
14 if (! defined( 'ABSPATH' ) ) { die( 'Forbidden' ); }
15
16 // =====================================================================
17 // Display selected profile.
18
19 // Display the profile name
20 if ( preg_match('`/\d{10}\.\d+?\.(.+)$`', $profile_path, $match ) ) {
21 $profile_name = sanitize_file_name( $match[1] );
22 } else {
23 $profile_name = 'profile';
24 }
25 // Fetch summary to display in tooltip (CP >1.2)
26 $summary_stats = code_profiler_getsummarystats( $profile_path );
27
28 ?><br />
29 <div class="alignleft actions bulkactions">
30 <select style="max-width: none;" onchange='window.location="?page=code-profiler&cptab=profiles_list&action=view_profile&section=" + this.value;'>
31 <?php
32 foreach( $section_list as $num => $section_name ) {
33 $orderby = '';
34 $order = '';
35 // Set the sorting order for the select box URI
36 if ( $num == 2 || $num == 3 ) {
37 $orderby = 'time'; $order = 'desc';
38 } elseif ( $num == 4 ) {
39 $orderby = 'order'; $order = 'asc';
40 }
41 echo '<option value="'. (int) $num .
42 sprintf(
43 '&id=%s&orderby=%s&order=%s',
44 esc_attr( $id ),
45 esc_attr( $orderby ),
46 esc_attr( $order )
47 ) .'"'.
48 selected( $num, $section ) .'>'.
49 sprintf(
50 esc_html__('Page %s: %s', 'code-profiler'),
51 (int) $num,
52 esc_html( $section_name )
53 ) .
54 '</option>';
55 }
56 ?>
57 </select>
58 <?php
59 if ( $section > 1 ) {
60 if ( $section == 3 || $section == 4 ) {
61 $orderby = 'time';
62 $order = 'desc';
63 } elseif ( $section == 5 ) {
64 $orderby = 'order';
65 $order = 'asc';
66 }
67 ?>
68 <a class="prev-page button" href="?page=code-profiler&cptab=profiles_list&action=view_profile&id=<?php echo esc_attr( $id ) ?>&section=<?php echo esc_attr( $section - 1 ) ?><?php
69 sprintf(
70 '&orderby=%s&order=%s',
71 esc_attr( $orderby ),
72 esc_attr( $order )
73 )
74 ?>">&lsaquo;</a>
75
76 <?php
77 } else {
78 ?>
79 <input type="button" class="prev-page button" value="&lsaquo;" disabled />
80 <?php
81 }
82 if ( $section < count( $section_list ) ) {
83 if ( $section == 1 || $section == 2 ) {
84 $orderby = 'time';
85 $order = 'desc';
86 } elseif ( $section == 3 ) {
87 $orderby = 'order';
88 $order = 'asc';
89 }
90 ?>
91 <a class="next-page button" href="?page=code-profiler&cptab=profiles_list&action=view_profile&id=<?php echo esc_attr( $id ) ?>&section=<?php echo esc_attr( $section + 1 ) ?><?php
92 sprintf(
93 '&orderby=%s&order=%s',
94 esc_attr( $orderby ),
95 esc_attr( $order )
96 )
97 ?>">&rsaquo;</a>
98 <?php
99
100 } else {
101 ?>
102 <input class="next-page button" type="button" value="&rsaquo;" disabled />
103 <?php
104 }
105 if ( $section != 4 ) {
106 echo '<p><span class="description">';
107 printf( esc_html__( 'Viewing: %s', 'code-profiler' ), esc_html( $match[1] ) );
108 echo '</span>';
109 if ( $summary_stats ) {
110 echo '<span class="code-profiler-tip" data-tip="'. esc_attr( $summary_stats ) .'"></span>';
111 }
112 echo '</p>';
113 }
114 ?>
115 </div>
116 <?php
117 if ( $section == 1 ) {
118 require 'menu_view_plugins.php';
119
120 } elseif ( $section == 2 ) {
121 require 'menu_view_iostats.php';
122
123 } elseif ( $section == 3 ) {
124 require 'menu_view_diskio.php';
125
126 } elseif ( $section == 4 ) {
127 require 'menu_pro.php';
128
129 }
130
131 if ( isset( $buffer['error'] ) ) {
132 echo code_profiler_buffer_error( $buffer['error'] );
133 return;
134 }
135
136 if ( $section == 4 ) { return; }
137
138 // Display footer with help, menu and buttons.
139
140 // Hide it while the graphs are loading
141 if ( $section == 1 || $section == 2 || $section == 3 ) {
142 echo '<div id="cp-footer-buttons" style="display:none" class="tablenav bottom">';
143 } else {
144 echo '<div class="tablenav bottom">';
145 }
146
147 ?>
148 <div id="cp-footer-help" style="display:none">
149 <?php include 'help.php'; ?>
150 <br />
151 </div>
152
153 <div style="text-align:center;">
154 <?php
155 if (! empty( $hidden ) ) {
156 echo '<p class="description">';
157 printf( esc_html__('Hidden items: %s', 'code-profiler'), $hidden );
158
159 if ( $type == 'slugs' && isset( $hidden_max_plugins ) ) {
160 ?>
161 <span class="code-profiler-tip" data-tip="<?php printf( esc_attr__('Only the first %s plugins will be shown on the graph. You can modify that value in the "Settings" page.', 'code-profiler' ), (int) $chart_max_plugins ) ?>"></span>
162 </p>
163 <?php
164 } else {
165 ?>
166 <span class="code-profiler-tip" data-tip="<?php esc_attr_e('Items that have an empty value are not shown. If you want to display them anyway, you can enable that option in the "Settings" page.', 'code-profiler' ) ?>"></span>
167 </p>
168 <?php
169 }
170 }
171 ?>
172 </div>
173
174 <div class="alignleft actions bulkactions">
175 <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);"/>
176 </div>
177
178 <div class="tablenav-pages">
179
180 <?php
181 if ( isset( $rotate_img ) ) {
182 ?>
183 <button type="button" class="button-secondary" id="htov" title="<?php esc_attr_e('Click to rotate graph', 'code-profiler' )?>"><span class="dashicons dashicons-image-rotate" style="display: inline-block;vertical-align: middle;"></span></button>&nbsp;
184 <?php
185 }
186 if ( isset( $save_png ) ) {
187 ?>
188 <a type="button" class="button-secondary" id="download-png-img" download="<?php echo esc_attr( $profile_name) ?>_plugins.png" title="<?php esc_attr_e('Click to download as an image', 'code-profiler' )?>" target="_blank"><span class="dashicons dashicons-download" style="display: inline-block;vertical-align: middle;"></span><?php esc_attr_e('Download as a PNG image', 'code-profiler' )?></a>&nbsp;
189 <?php
190 }
191 ?>
192 </div>
193 </div>
194
195 <?php
196
197 // =====================================================================
198
199 function code_profiler_buffer_error( $error ) {
200
201 return $error;
202
203 }
204
205 // =====================================================================
206 // EOF
207