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 +47 -4 1.6.41.7.4 View file →
@@ -5,9 +5,9 @@
5 5 | | | / _ \ / _` |/ _ \ | |_) | '__/ _ \| |_| | |/ _ \ '__| |
6 6 | | |__| (_) | (_| | __/ | __/| | | (_) | _| | | __/ | |
7 7 | \____\___/ \__,_|\___| |_| |_| \___/|_| |_|_|\___|_| |
8 8 | |
9 - | (c) Jerome Bruandet ~ https://code-profiler.com/ |
9 + | (c) Jerome Bruandet ~ https://nintechnet.com/codeprofiler/ |
10 10 +=====================================================================+
11 11 */
12 12
13 13 // =====================================================================
@@ -108,14 +108,40 @@
108 108
109 109 function cpjs_get_post( id ) {
110 110 if ( id == 1 ) {
111 111 jQuery('#post-value').prop('disabled', false);
112 + jQuery('#id-content-type').prop('disabled', false);
112 113 jQuery('#post-value').focus();
113 114 } else {
114 115 jQuery('#post-value').prop('disabled', true);
116 + jQuery('#id-content-type').prop('disabled', true);
115 117 }
116 118 }
117 119
120 +function cpjs_content_type( value ) {
121 + if ( value == 1 ) {
122 + jQuery('#ct-1').slideDown();
123 + jQuery('#ct-2').slideUp();
124 + } else {
125 + jQuery('#ct-2').slideDown();
126 + jQuery('#ct-1').slideUp();
127 + }
128 +}
129 +
130 +function cpjs_isJSON( data ) {
131 +
132 + if ( jQuery('#id-content-type').val() == 1 || jQuery('#get-method').prop('checked') == true ) {
133 + // Ignore
134 + return 1;
135 + }
136 + try {
137 + return JSON.parse( data );
138 + } catch (e) {
139 + // Not a JSON-encoded string
140 + return null;
141 + }
142 +}
143 +
118 144 // =====================================================================
119 145 // Log page: filter and delete the log.
120 146
121 147 function cpjs_filter_log() {
@@ -213,8 +239,10 @@
213 239 if ( ua == 'undefined') {
214 240 ua = 'FireFox';
215 241 }
216 242
243 + var theme = jQuery('#id-theme').val();
244 +
217 245 // GET or POST
218 246 var method = jQuery('input[name="method"]:checked').val();
219 247 var payload = '';
220 248 if ( method == 'post') {
@@ -223,11 +251,23 @@
223 251 } else {
224 252 method = 'get';
225 253 }
226 254
227 - var cookies = jQuery('#cp-cookies').val();
228 - var headers = jQuery('#custom-headers').val();
255 + //Content type
256 + var ct = jQuery('#id-content-type').val();
257 + // application/json
258 + if ( ct == 2 ) {
259 + if ( cpjs_isJSON( payload ) == null ) {
260 + alert( cpi18n.missing_ajax );
261 + jQuery('#user-name').focus();
262 + return;
263 + }
264 + }
229 265
266 + var cookies = jQuery('#cp-cookies').val();
267 + var headers = jQuery('#custom-headers').val();
268 + var exclusions = jQuery('#exclusions').val();
269 +
230 270 // Change buttons status and add animated image with status message
231 271 jQuery('#start-profile').prop('disabled', true);
232 272 jQuery('#cp-progress-div').slideDown();
233 273 jQuery('#progress-gif').slideDown();
@@ -239,16 +279,19 @@
239 279 'action': 'codeprofiler_start_profiler',
240 280 'cp_nonce': cp_nonce,
241 281 'where': where,
242 282 'post': post,
283 + 'content_type': ct,
243 284 'profile': profile,
244 285 'user': user,
245 286 'username': username,
246 287 'cookies': cookies,
247 288 'custom_headers': headers,
289 + 'exclusions': exclusions,
248 290 'method': method,
249 291 'payload': payload,
250 - 'ua': ua
292 + 'ua': ua,
293 + 'theme': theme
251 294 };
252 295 // Send the request via AJAX
253 296 jQuery.ajax( {
254 297 type: 'POST',