PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 8.1.1
Jetpack – WP Security, Backup, Speed, & Growth v8.1.1
12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 14.4.2 All 500 releases
jetpack / modules / wordads / php / admin.php
admin.php
50 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * The standard set of admin pages for the user if Jetpack is installed
5 */
6 class WordAds_Admin {
7
8 /**
9 * @since 4.5.0
10 */
11 function __construct() {
12 global $wordads;
13
14 if ( current_user_can( 'manage_options' ) && isset( $_GET['ads_debug'] ) ) {
15 WordAds_API::update_wordads_status_from_api();
16 add_action( 'admin_notices', array( $this, 'debug_output' ) );
17 }
18 }
19
20 /**
21 * Output the API connection debug
22 *
23 * @since 4.5.0
24 */
25 function debug_output() {
26 global $wordads, $wordads_status_response;
27 $response = $wordads_status_response;
28 if ( empty( $response ) ) {
29 $response = 'No response from API :(';
30 } else {
31 $response = print_r( $response, 1 );
32 }
33
34 $status = $wordads->option( 'wordads_approved' ) ?
35 '<span style="color:green;">Yes</span>' :
36 '<span style="color:red;">No</span>';
37
38 $type = $wordads->option( 'wordads_approved' ) ? 'updated' : 'error';
39 echo <<<HTML
40 <div class="notice $type is-dismissible">
41 <p>Status: $status</p>
42 <pre>$response</pre>
43 </div>
44 HTML;
45 }
46 }
47
48 global $wordads_admin;
49 $wordads_admin = new WordAds_Admin();
50