PluginProbe
Code Profiler – WordPress Performance Profiling and Debugging Made Easy / 1.7.4
Code Profiler – WordPress Performance Profiling and Debugging Made Easy v1.7.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
← All changes | static/code-profiler.js +30 -78 1.9.41.7.4 View file →
@@ -68,41 +68,28 @@
68 68 function cpjs_front_or_backend( item ) {
69 69 'use strict';
70 70 // Enable/disable frontend/backend select box
71 71 // depending on user's choice
72 - if ( item == 'frontend') {
72 + if ( item == 1 ) {
73 73 jQuery('#p-frontend').show();
74 74 jQuery('#p-backend').hide();
75 75 jQuery('#p-custom').hide();
76 - jQuery('#p-wpcron').hide();
77 76 jQuery('#id-frontend').focus();
78 77 jQuery('#user-unauthenticated').prop('disabled', false);
79 - jQuery('#user-authenticated').prop('disabled', false);
80 - } else if ( item == 'backend') {
78 + } else if ( item == 2 ) {
81 79 jQuery('#p-backend').show();
82 80 jQuery('#p-frontend').hide();
83 81 jQuery('#p-custom').hide();
84 - jQuery('#p-wpcron').hide();
85 82 jQuery('#id-backend').focus();
86 83 jQuery('#user-unauthenticated').prop('disabled', true);
87 - jQuery('#user-authenticated').prop('disabled', false);
88 84 jQuery('#user-authenticated').prop('checked', true);
89 85 jQuery('#user-name').prop('disabled', false);
90 - } else if ( item == 'custom') {
86 + } else {
91 87 jQuery('#p-custom').show();
92 88 jQuery('#p-frontend').hide();
93 89 jQuery('#p-backend').hide();
94 - jQuery('#p-wpcron').hide();
95 90 jQuery('#id-custom').focus();
96 91 jQuery('#user-unauthenticated').prop('disabled', false);
97 - jQuery('#user-authenticated').prop('disabled', false);
98 - } else {
99 - jQuery('#p-wpcron').show();
100 - jQuery('#p-custom').hide();
101 - jQuery('#p-frontend').hide();
102 - jQuery('#p-backend').hide();
103 - jQuery('#id-wpcron').focus();
104 - jQuery('#user-unauthenticated').prop('disabled', false);
105 92 }
106 93 }
107 94
108 95 function cpjs_authenticated( id ) {
@@ -132,18 +119,12 @@
132 119
133 120 function cpjs_content_type( value ) {
134 121 if ( value == 1 ) {
135 122 jQuery('#ct-1').slideDown();
136 - jQuery('#ct-3').slideUp();
137 123 jQuery('#ct-2').slideUp();
138 - } else if ( value == 2 ) {
124 + } else {
139 125 jQuery('#ct-2').slideDown();
140 - jQuery('#ct-3').slideUp();
141 126 jQuery('#ct-1').slideUp();
142 - } else {
143 - jQuery('#ct-3').slideDown();
144 - jQuery('#ct-1').slideUp();
145 - jQuery('#ct-2').slideUp();
146 127 }
147 128 }
148 129
149 130 function cpjs_isJSON( data ) {
@@ -159,15 +140,8 @@
159 140 return null;
160 141 }
161 142 }
162 143
163 -function cpjs_ismultiline( data ) {
164 - if ( data.match( /[\n\r]/) ) {
165 - return true;
166 - }
167 - return false;
168 -}
169 -
170 144 // =====================================================================
171 145 // Log page: filter and delete the log.
172 146
173 147 function cpjs_filter_log() {
@@ -208,15 +182,9 @@
208 182 // =====================================================================
209 183 // AJAX call to start the profiler.
210 184
211 185 function cpjs_start_profiler() {
212 -
213 186 'use strict';
214 -
215 - jQuery('html, body').animate( {
216 - scrollTop: jQuery('#button-adv-settings').offset().top
217 - }, 1000 );
218 -
219 187 // Get the nonce
220 188 var cp_nonce = jQuery('#cp_nonce').val();
221 189 if ( cp_nonce == '') {
222 190 alert( cpi18n.missing_nonce );
@@ -224,25 +192,18 @@
224 192 }
225 193
226 194 // Get the scan type (frontend/backend)
227 195 var post;
228 - var x_end = jQuery('input[name="x_end"]:checked').val();
229 - if ( x_end == 'frontend') {
196 + var where = jQuery('input[name="where"]:checked').val();
197 + if ( where == 'frontend') {
230 198 post = jQuery('#id-frontend').val();
231 199
232 - } else if ( x_end == 'backend') {
200 + } else if ( where == 'backend') {
233 201 post = jQuery('#id-backend').val();
234 202
235 - } else if ( x_end == 'custom') {
203 + } else if ( where == 'custom') {
236 204 post = jQuery('#id-custom').val().trim(); // Trim user input
237 205
238 - } else if ( x_end == 'wpcron') {
239 - post = jQuery('#id-wpcron').val();
240 - if ( post == 0 ) {
241 - alert( cpi18n.missing_wpcron );
242 - return;
243 - }
244 -
245 206 } else {
246 207 alert( cpi18n.missing_frontbackend );
247 208 return;
248 209 }
@@ -258,16 +219,16 @@
258 219 jQuery('input[name="profile"]').focus();
259 220 return;
260 221 }
261 222
262 - var x_auth = jQuery('input[name="x_auth"]:checked').val();
263 - if ( x_auth == '') {
223 + var user = jQuery('input[name="user"]:checked').val();
224 + if ( user == '') {
264 225 alert( cpi18n.missing_userauth );
265 226 return;
266 227 }
267 228
268 229 var username = jQuery('#user-name').val().trim(); // Trim user input
269 - if ( x_auth == 'authenticated') {
230 + if ( user == 'authenticated') {
270 231 if ( username == '') {
271 232 alert( cpi18n.missing_username );
272 233 jQuery('#user-name').focus();
273 234 return;
@@ -273,11 +234,11 @@
273 234 return;
274 235 }
275 236 }
276 237
277 - var user_agent = jQuery('#ua-id').val();
278 - if ( user_agent == 'undefined') {
279 - user_agent = 'FireFox';
238 + var ua = jQuery('#ua-id').val();
239 + if ( ua == 'undefined') {
240 + ua = 'FireFox';
280 241 }
281 242
282 243 var theme = jQuery('#id-theme').val();
283 244
@@ -292,22 +253,15 @@
292 253 }
293 254
294 255 //Content type
295 256 var ct = jQuery('#id-content-type').val();
257 + // application/json
296 258 if ( ct == 2 ) {
297 - // application/json
298 259 if ( cpjs_isJSON( payload ) == null ) {
299 260 alert( cpi18n.missing_ajax );
300 261 jQuery('#user-name').focus();
301 262 return;
302 263 }
303 - } else if ( ct == 3 ) {
304 - // Raw format must be on one single line
305 - if ( cpjs_ismultiline( payload.trim() ) == true ) {
306 - alert( cpi18n.multiline_raw );
307 - jQuery('#post-value').focus();
308 - return;
309 - }
310 264 }
311 265
312 266 var cookies = jQuery('#cp-cookies').val();
313 267 var headers = jQuery('#custom-headers').val();
@@ -323,13 +277,13 @@
323 277
324 278 var data = {
325 279 'action': 'codeprofiler_start_profiler',
326 280 'cp_nonce': cp_nonce,
327 - 'x_end': x_end,
281 + 'where': where,
328 282 'post': post,
329 283 'content_type': ct,
330 284 'profile': profile,
331 - 'x_auth': x_auth,
285 + 'user': user,
332 286 'username': username,
333 287 'cookies': cookies,
334 288 'custom_headers': headers,
335 289 'exclusions': exclusions,
@@ -334,9 +288,9 @@
334 288 'custom_headers': headers,
335 289 'exclusions': exclusions,
336 290 'method': method,
337 291 'payload': payload,
338 - 'user_agent': user_agent,
292 + 'ua': ua,
339 293 'theme': theme
340 294 };
341 295 // Send the request via AJAX
342 296 jQuery.ajax( {
@@ -598,8 +552,11 @@
598 552 type: 'bar',
599 553 options: {
600 554 animation: {
601 555 duration: 1000,
556 + onComplete: function() {
557 + document.getElementById('download-png-img').href = myChart.toBase64Image();
558 + }
602 559 },
603 560 indexAxis: _indexAxis,
604 561 plugins: chartPlugins
605 562 },
@@ -605,11 +562,8 @@
605 562 },
606 563 plugins:[ plugin],
607 564 data: chartData
608 565 });
609 - /** Since Chartjs v4.5.1 **/
610 -// document.getElementById('download-png-img').href = myChart.toBase64Image();
611 -
612 566 };
613 567
614 568 var ctx = document.getElementById('myChart').getContext('2d');
615 569
@@ -683,8 +637,9 @@
683 637 animation: {
684 638 duration: 700,
685 639 onComplete: function() {
686 640 jQuery('#cp-footer-buttons').slideDown(200);
641 + document.getElementById('download-png-img').href = myChart.toBase64Image();
687 642 }
688 643 },
689 644 indexAxis: _indexAxis,
690 645 plugins: chartPlugins
@@ -690,11 +645,8 @@
690 645 plugins: chartPlugins
691 646 },
692 647 plugins:[plugin]
693 648 });
694 - /** Since Chartjs v4.5.1 **/
695 - document.getElementById('download-png-img').href = myChart.toBase64Image();
696 -
697 649 }
698 650
699 651 // =====================================================================
700 652 // File I/O chart.
@@ -714,8 +666,11 @@
714 666 type: 'line',
715 667 options: {
716 668 animation: {
717 669 duration: 1000,
670 + onComplete: function() {
671 + document.getElementById('download-png-img').href = myChart.toBase64Image();
672 + }
718 673 },
719 674 indexAxis: _indexAxis,
720 675 plugins: chartPlugins
721 676 },
@@ -721,10 +676,8 @@
721 676 },
722 677 plugins:[ plugin],
723 678 data: chartData
724 679 });
725 - /** Since Chartjs v4.5.1 **/
726 -// document.getElementById('download-png-img').href = myChart.toBase64Image();
727 680 };
728 681
729 682 var ctx = document.getElementById('myChart').getContext('2d');
730 683
@@ -785,8 +738,9 @@
785 738 animation: {
786 739 duration: 700,
787 740 onComplete: function() {
788 741 jQuery('#cp-footer-buttons').slideDown(200);
742 + document.getElementById('download-png-img').href = myChart.toBase64Image();
789 743 }
790 744 },
791 745 indexAxis: _indexAxis,
792 746 plugins: chartPlugins
@@ -792,10 +746,8 @@
792 746 plugins: chartPlugins
793 747 },
794 748 plugins:[plugin]
795 749 });
796 - /** Since Chartjs v4.5.1 **/
797 - document.getElementById('download-png-img').href = myChart.toBase64Image();
798 750
799 751 }
800 752 // =====================================================================
801 753 // Disk I/O chart.
@@ -815,8 +767,11 @@
815 767 type: 'line',
816 768 options: {
817 769 animation: {
818 770 duration: 1000,
771 + onComplete: function() {
772 + document.getElementById('download-png-img').href = myChart.toBase64Image();
773 + }
819 774 },
820 775 indexAxis: _indexAxis,
821 776 plugins: chartPlugins
822 777 },
@@ -822,10 +777,8 @@
822 777 },
823 778 plugins:[ plugin],
824 779 data: chartData
825 780 });
826 - /** Since Chartjs v4.5.1 **/
827 -// document.getElementById('download-png-img').href = myChart.toBase64Image();
828 781 };
829 782 var ctx = document.getElementById('myChart').getContext('2d');
830 783
831 784 var chartData = {
@@ -885,8 +838,9 @@
885 838 animation: {
886 839 duration: 700,
887 840 onComplete: function() {
888 841 jQuery('#cp-footer-buttons').slideDown(200);
842 + document.getElementById('download-png-img').href = myChart.toBase64Image();
889 843 }
890 844 },
891 845 indexAxis: _indexAxis,
892 846 plugins: chartPlugins
@@ -892,10 +846,8 @@
892 846 plugins: chartPlugins
893 847 },
894 848 plugins:[plugin]
895 849 });
896 - /** Since Chartjs v4.5.1 **/
897 - document.getElementById('download-png-img').href = myChart.toBase64Image();
898 850 }
899 851
900 852 // =====================================================================
901 853 // Settings page