| @@ -37,22 +37,15 @@ | ||
| 37 | 37 | if ( strtolower( parse_url( $_POST['post'], PHP_URL_SCHEME ) ) == 'https') { |
| 38 | 38 | $_SERVER['HTTPS'] = 'on'; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if (! empty( $assoc_args['wpcron'] ) ) { | |
| 42 | - $_POST['x_end'] = 'wpcron'; | |
| 43 | - $_POST['post'] = $assoc_args['wpcron']; | |
| 44 | - | |
| 41 | + $_POST['x_end'] = 'frontend'; | |
| 42 | + // Detect if we're authenticated or not | |
| 43 | + if ( is_user_logged_in() === true ) { | |
| 44 | + $_POST['x_auth'] = 'authenticated'; | |
| 45 | 45 | } else { |
| 46 | - $_POST['x_end'] = 'frontend'; | |
| 47 | - // Detect if we're authenticated or not | |
| 48 | - if ( is_user_logged_in() === true ) { | |
| 49 | - $_POST['x_auth'] = 'authenticated'; | |
| 50 | - } else { | |
| 51 | - $_POST['x_auth'] = 'unauthenticated'; | |
| 52 | - } | |
| 46 | + $_POST['x_auth'] = 'unauthenticated'; | |
| 53 | 47 | } |
| 54 | - | |
| 55 | 48 | $_POST['profile'] = 'WP-CLI_' . time(); |
| 56 | 49 | $_POST['user_agent'] = 'Firefox'; |
| 57 | 50 | |
| 58 | 51 | if (! empty( $assoc_args['dest'] ) ) { |
| @@ -88,9 +81,9 @@ | ||
| 88 | 81 | $progress->tick(); |
| 89 | 82 | } |
| 90 | 83 | |
| 91 | 84 | // Run the profiler |
| 92 | - $response = json_decode( CodeProfiler_helpers::codeprofiler_start_profiler(), true ); | |
| 85 | + $response = json_decode( codeprofiler_start_profiler(), true ); | |
| 93 | 86 | if ( $response === false ) { |
| 94 | 87 | $message = __('Unknown error returned by AJAX', 'code-profiler'); |
| 95 | 88 | WP_CLI::error( $message ); |
| 96 | 89 | exit; |
| @@ -105,9 +98,9 @@ | ||
| 105 | 98 | } |
| 106 | 99 | |
| 107 | 100 | // All good, run the parser |
| 108 | 101 | $_POST['microtime'] = $response['microtime']; |
| 109 | - $response = json_decode( CodeProfiler_helpers::codeprofiler_prepare_report(), true ); | |
| 102 | + $response = json_decode( codeprofiler_prepare_report(), true ); | |
| 110 | 103 | if ( $response === false ) { |
| 111 | 104 | $message = __('Unknown error returned by AJAX', 'code-profiler'); |
| 112 | 105 | WP_CLI::error( $message ); |
| 113 | 106 | exit; |
| @@ -339,10 +332,8 @@ | ||
| 339 | 332 | " {$this->cmd_run} ". __('Run the profiler in the frontend', 'code-profiler') ."\n\n". |
| 340 | 333 | __('GLOBAL PARAMETERS', 'code-profiler') ."\n\n". |
| 341 | 334 | " --dest=<URL to profile> **". __('Pro version only', 'code-profiler') ."**\n". |
| 342 | 335 | " ". __('Path to the WordPress page or post to profile. If missing, profile the frontend.', 'code-profiler') ."\n\n". |
| 343 | - " --wpcron=<cron event> (optional)\n". | |
| 344 | - " ". __('WordPress cron event to profile.', 'code-profiler') ."\n\n". | |
| 345 | 336 | " --user=<id|login|email> (optional)\n". |
| 346 | 337 | " ". __('Run the profiler as the corresponding WordPress user. If missing, run as an unauthenticated user.', 'code-profiler') ."\n\n". |
| 347 | 338 | " --u=<username> (optional)\n". |
| 348 | 339 | " ". __('HTTP Basic authentication username. You will be prompted to enter your password.', 'code-profiler') ."\n\n". |