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 | index.php +47 -60 1.6.41.7.4 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 -/*
2 +/**
3 3 Plugin Name: Code Profiler
4 -Plugin URI: https://code-profiler.com/
4 +Plugin URI: https://nintechnet.com/codeprofiler/
5 5 Description: A profiler to measure the performance of your WordPress plugins and themes.
6 6 Author: Jerome Bruandet ~ NinTechNet Ltd.
7 7 Author URI: https://nintechnet.com/
8 -Version: 1.6.4
8 +Version: 1.7.4
9 9 Network: true
10 10 License: GPLv3 or later
11 11 Text Domain: code-profiler
12 12 Domain Path: /languages
@@ -11,10 +11,10 @@
11 11 Text Domain: code-profiler
12 12 Domain Path: /languages
13 13 */
14 14
15 -define('CODE_PROFILER_VERSION', '1.6.4');
16 -/*
15 +define('CODE_PROFILER_VERSION', '1.7.4');
16 +/**
17 17 +=====================================================================+
18 18 | ____ _ ____ __ _ _ |
19 19 | / ___|___ __| | ___ | _ \ _ __ ___ / _(_) | ___ _ __ |
20 20 | | | / _ \ / _` |/ _ \ | |_) | '__/ _ \| |_| | |/ _ \ '__| |
@@ -20,9 +20,9 @@
20 20 | | | / _ \ / _` |/ _ \ | |_) | '__/ _ \| |_| | |/ _ \ '__| |
21 21 | | |__| (_) | (_| | __/ | __/| | | (_) | _| | | __/ | |
22 22 | \____\___/ \__,_|\___| |_| |_| \___/|_| |_|_|\___|_| |
23 23 | |
24 - | (c) Jerome Bruandet ~ https://code-profiler.com/ |
24 + | (c) Jerome Bruandet ~ https://nintechnet.com/codeprofiler/ |
25 25 +=====================================================================+
26 26 */
27 27
28 28 if (! defined('ABSPATH') ) {
@@ -28,9 +28,9 @@
28 28 if (! defined('ABSPATH') ) {
29 29 die('Forbidden');
30 30 }
31 31
32 -// =====================================================================
32 +// ===================================================================== 2023-08-20
33 33 // Menu functions
34 34 require __DIR__ .'/lib/menu.php';
35 35 // Helper (can be already loaded by the MU plugin)
36 36 require_once __DIR__ .'/lib/helper.php';
@@ -41,18 +41,16 @@
41 41
42 42 function code_profiler_activate() {
43 43
44 44 if (! defined('WP_CLI') && ! current_user_can('activate_plugins') ) {
45 - exit( esc_html__('Your are not allowed to activate plugins.',
46 - 'code-profiler')
47 - );
45 + exit( esc_html__('Your are not allowed to activate plugins.', 'code-profiler') );
48 46 }
49 47
50 48 global $wp_version;
51 49 if ( version_compare( $wp_version, '5.0', '<') ) {
52 50 exit( sprintf(
53 - esc_html__('Code Profiler requires WordPress %s or greater but '.
54 - 'your current version is %s.', 'code-profiler'),
51 + esc_html__('Code Profiler requires WordPress %s or greater but your current version is %s.',
52 + 'code-profiler'),
55 53 '5.0',
56 54 esc_html( $wp_version )
57 55 ) );
58 56 }
@@ -58,10 +56,9 @@
58 56 }
59 57
60 58 if ( version_compare( PHP_VERSION, '7.1', '<') ) {
61 59 exit( sprintf(
62 - esc_html__('Code Profiler requires PHP 7.1 or greater but your '.
63 - 'current version is %s.',
60 + esc_html__('Code Profiler requires PHP 7.1 or greater but your current version is %s.',
64 61 'code-profiler'),
65 62 esc_html( PHP_VERSION )
66 63 ) );
67 64 }
@@ -67,11 +64,10 @@
67 64 }
68 65
69 66 // If the pro version is active, we refuse to run and throw an error message
70 67 if ( is_plugin_active('code-profiler-pro/index.php') ) {
71 - exit( esc_html__('Code Profiler Pro is active on this site, '.
72 - 'please disable it first if you want to run the free version.',
73 - 'code-profiler')
68 + exit( esc_html__('Code Profiler Pro is active on this site, please disable it first if you '.
69 + 'want to run the free version.', 'code-profiler')
74 70 );
75 71 }
76 72
77 73 // Verify/create our storage folder
@@ -91,11 +87,9 @@
91 87
92 88 function code_profiler_deactivate() {
93 89
94 90 if (! defined('WP_CLI') && ! current_user_can('activate_plugins') ) {
95 - exit( esc_html__('Your are not allowed to deactivate plugins.',
96 - 'code-profiler')
97 - );
91 + exit( esc_html__('Your are not allowed to deactivate plugins.', 'code-profiler') );
98 92 }
99 93
100 94 // Remove the MU plugin
101 95 if ( file_exists( WPMU_PLUGIN_DIR .'/'. CODE_PROFILER_MUPLUGIN ) ) {
@@ -126,9 +120,9 @@
126 120 }
127 121
128 122 add_action('admin_menu', 'code_profiler_admin_menu');
129 123
130 -// =====================================================================
124 +// ===================================================================== 2023-08-20
131 125 // Register scripts and styles.
132 126
133 127 function code_profiler_enqueue( $hook ) {
134 128
@@ -188,55 +182,50 @@
188 182
189 183 // JS i18n
190 184 $code_profiler_i18n = [
191 185 'missing_nonce' =>
192 - esc_attr__('Security nonce is missing, try to reload the page.',
193 - 'code-profiler'),
186 + esc_attr__('Security nonce is missing, try to reload the page.', 'code-profiler'),
194 187 'missing_frontbackend' =>
195 - esc_attr__('Please select either the fontend or backend option.',
196 - 'code-profiler'),
188 + esc_attr__('Please select either the fontend or backend option.', 'code-profiler'),
197 189 'missing_profileid' =>
198 190 esc_attr__('Missing profile identifier.', 'code-profiler'),
199 191 'missing_profilename' =>
200 - esc_attr__('Please enter a name for this profile.',
192 + esc_attr__('Please enter a name for this profile.', 'code-profiler'),
193 + 'missing_userauth' =>
194 + esc_attr__('Please select whether the profiler should run as an authenticated user or not.',
201 195 'code-profiler'),
202 - 'missing_userauth' =>
203 - esc_attr__('Please select whether the profiler should run as '.
204 - 'an authenticated user or not.', 'code-profiler'),
205 196 'missing_username' =>
206 - esc_attr__('Please enter the name of the user.',
207 - 'code-profiler'),
197 + esc_attr__('Please enter the name of the user.', 'code-profiler'),
198 + 'missing_ajax' =>
199 + esc_attr__('Please enter a valid AJAX payload, or change the content-type option. '.
200 + 'If you want to send an empty value, enter: {}', 'code-profiler'),
208 201 'missing_post' =>
209 - esc_attr__('Please select a page to profile.',
210 - 'code-profiler'),
202 + esc_attr__('Please select a page to profile.', 'code-profiler'),
211 203 'unknown_error' =>
212 - esc_attr__('Unknown error returned by AJAX',
213 - 'code-profiler'),
204 + esc_attr__('Unknown error returned by AJAX', 'code-profiler'),
214 205 'http_error' =>
215 - esc_attr__('The HTTP server returned the following error:',
206 + esc_attr__('The HTTP server returned the following error:', 'code-profiler'),
207 + 'timeout_error' =>
208 + esc_attr__('You can try to select a lower Accuracy and Precision level in the Settings page',
216 209 'code-profiler'),
217 - 'timeout_error' =>
218 - esc_attr__('You can try to select a lower Accuracy and Precision'.
219 - ' level in the Settings page', 'code-profiler'),
220 210 'notfound_error' =>
221 - esc_attr__('The requested page does not seem to exist. Please '.
222 - 'check the syntax of the URL you want to profile',
211 + esc_attr__('The requested page does not seem to exist. Please check the syntax of the URL '.
212 + 'you want to profile',
223 213 'code-profiler'),
224 214 'forbidden_error' =>
225 - esc_attr__('The server rejected and blocked the requested page. '.
226 - 'Make sure you are allowed to access that page or that there is '.
227 - 'no security plugin or application blocking it', 'code-profiler'),
215 + esc_attr__('The server rejected and blocked the requested page. Make sure you are allowed '.
216 + 'to access that page or that there is no security plugin or application blocking it',
217 + 'code-profiler'),
228 218 'internal_error' =>
229 - esc_attr__('This is an internal server error. Please check your '.
230 - 'server, PHP and Code Profiler logs as they may contain more '.
231 - 'details about the error', 'code-profiler'),
219 + esc_attr__('This is an internal server error. Please check your server, PHP and Code '.
220 + 'Profiler logs as they may contain more details about the error', 'code-profiler'),
232 221 'unknown_error' =>
233 222 esc_attr__('An unknown error occurred:', 'code-profiler'),
234 223 'preparing_report' =>
235 224 esc_attr__('Preparing the report', 'code-profiler') .'...',
236 225 'empty_log' =>
237 - esc_attr__('No records were found that match the specified '.
238 - 'search criteria.', 'code-profiler'),
226 + esc_attr__('No records were found that match the specified search criteria.',
227 + 'code-profiler'),
239 228 'delete_log' =>
240 229 esc_attr__('Delete log?', 'code-profiler'),
241 230 'delete_profile' =>
242 231 esc_attr__('Delete this profile?', 'code-profiler'),
@@ -246,10 +235,9 @@
246 235 'pc_plugins' =>
247 236 /* Translators: xx% of all plugins and the theme */
248 237 esc_attr__('% of all plugins and the theme', 'code-profiler'),
249 238 'exec_tot_plugins_1' =>
250 - esc_attr__('Plugins and theme execution time, in seconds',
251 - 'code-profiler'),
239 + esc_attr__('Plugins and theme execution time, in seconds', 'code-profiler'),
252 240 'chart_total' =>
253 241 esc_attr__('total:', 'code-profiler'),
254 242 'iolist_total_calls' =>
255 243 esc_attr__('Total calls', 'code-profiler'),
@@ -257,13 +245,11 @@
257 245 esc_attr__('File I/O operations', 'code-profiler'),
258 246 'disk_io_bytes' =>
259 247 esc_attr__('Total bytes', 'code-profiler'),
260 248 'disk_io_title' =>
261 - esc_attr__('Total Disk I/O read and write, in bytes',
262 - 'code-profiler'),
249 + esc_attr__('Total Disk I/O read and write, in bytes', 'code-profiler'),
263 250 'text_copied' =>
264 - esc_attr__('The text was successfully copied to the clipboard.',
265 - 'code-profiler')
251 + esc_attr__('The text was successfully copied to the clipboard.', 'code-profiler')
266 252
267 253 ];
268 254 wp_localize_script(
269 255 'code_profiler_javascript',
@@ -273,16 +259,17 @@
273 259 }
274 260
275 261 add_action('admin_enqueue_scripts', 'code_profiler_enqueue');
276 262
277 -// =====================================================================
263 +// ===================================================================== 2023-08-20
278 264 // Display the settings link in the "Plugins" page.
279 265
280 266 function code_profiler_settings_link( $links ) {
281 267
282 - $links[] = '<a href="'. get_admin_url( null, 'admin.php?page=code-profiler') .
283 - '">'. esc_html__('Start Profiling', 'code-profiler'). '</a>';
284 - $links[] = '<a style="font-weight:700;color:#006393;" href="https://code-profiler.com/" target="_blank" rel="noopener noreferrer">'.
268 + $links[] = '<a href="'. get_admin_url( null, 'admin.php?page=code-profiler') .'">'.
269 + esc_html__('Start Profiling', 'code-profiler'). '</a>';
270 + $links[] = '<a style="font-weight:700;color:#006393;" href="https://nintechnet.com/codeprofiler/" '.
271 + 'target="_blank" rel="noopener noreferrer">'.
285 272 esc_html__('Go Pro', 'code-profiler'). '</a>';
286 273 return $links;
287 274 }
288 275
@@ -287,9 +274,9 @@
287 274 }
288 275
289 276 add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'code_profiler_settings_link');
290 277
291 -// =====================================================================
278 +// ===================================================================== 2023-08-20
292 279 // WP CLI commands.
293 280
294 281 if ( defined('WP_CLI') && WP_CLI ) {
295 282 require_once __DIR__ . '/lib/class-cli.php';