WordAds_Admin

The standard set of admin pages for the user if Jetpack is installed.

Defined (1)

The class is defined in the following location(s).

/modules/wordads/php/admin.php  
  1. class WordAds_Admin { 
  2.  
  3. /** 
  4. * @since 4.5.0 
  5. */ 
  6. function __construct() { 
  7. global $wordads; 
  8.  
  9. if ( current_user_can( 'manage_options' ) && isset( $_GET['ads_debug'] ) ) { 
  10. WordAds_API::update_wordads_status_from_api(); 
  11. add_action( 'admin_notices', array( $this, 'debug_output' ) ); 
  12.  
  13. /** 
  14. * Output the API connection debug 
  15. * @since 4.5.0 
  16. */ 
  17. function debug_output() { 
  18. global $wordads, $wordads_status_response; 
  19. $response = $wordads_status_response; 
  20. if ( empty( $response ) ) { 
  21. $response = 'No response from API :('; 
  22. } else { 
  23. $response = print_r( $response, 1 ); 
  24.  
  25. $status = $wordads->option( 'wordads_approved' ) ? 
  26. '<span style="color:green;">Yes</span>' : 
  27. '<span style="color:red;">No</span>'; 
  28.  
  29. $type = $wordads->option( 'wordads_approved' ) ? 'updated' : 'error'; 
  30. echo <<<HTML 
  31. <div class="notice $type is-dismissible"> 
  32. <p>Status: $status</p> 
  33. <pre>$response</pre> 
  34. </div> 
  35. HTML;