Automatic_Upgrader_Skin

Upgrader Skin for Automatic WordPress Upgrades.

Defined (1)

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

/wp-admin/includes/class-wp-upgrader-skins.php  
  1. class Automatic_Upgrader_Skin extends WP_Upgrader_Skin { 
  2. protected $messages = array(); 
  3.  
  4. /** 
  5. * @param bool $error 
  6. * @param string $context 
  7. * @param bool $allow_relaxed_file_ownership 
  8. * @return bool 
  9. */ 
  10. public function request_filesystem_credentials( $error = false, $context = '', $allow_relaxed_file_ownership = false ) { 
  11. if ( $context ) { 
  12. $this->options['context'] = $context; 
  13. // TODO: fix up request_filesystem_credentials(), or split it, to allow us to request a no-output version 
  14. // This will output a credentials form in event of failure, We don't want that, so just hide with a buffer 
  15. ob_start(); 
  16. $result = parent::request_filesystem_credentials( $error, $context, $allow_relaxed_file_ownership ); 
  17. ob_end_clean(); 
  18. return $result; 
  19.  
  20. /** 
  21. * @access public 
  22. * @return array 
  23. */ 
  24. public function get_upgrade_messages() { 
  25. return $this->messages; 
  26.  
  27. /** 
  28. * @param string|array|WP_Error $data 
  29. */ 
  30. public function feedback( $data ) { 
  31. if ( is_wp_error( $data ) ) { 
  32. $string = $data->get_error_message(); 
  33. } elseif ( is_array( $data ) ) { 
  34. return; 
  35. } else { 
  36. $string = $data; 
  37. if ( ! empty( $this->upgrader->strings[ $string ] ) ) 
  38. $string = $this->upgrader->strings[ $string ]; 
  39.  
  40. if ( strpos( $string, '%' ) !== false ) { 
  41. $args = func_get_args(); 
  42. $args = array_splice( $args, 1 ); 
  43. if ( ! empty( $args ) ) 
  44. $string = vsprintf( $string, $args ); 
  45.  
  46. $string = trim( $string ); 
  47.  
  48. // Only allow basic HTML in the messages, as it'll be used in emails/logs rather than direct browser output. 
  49. $string = wp_kses( $string, array( 
  50. 'a' => array( 
  51. 'href' => true 
  52. ),  
  53. 'br' => true,  
  54. 'em' => true,  
  55. 'strong' => true,  
  56. ) ); 
  57.  
  58. if ( empty( $string ) ) 
  59. return; 
  60.  
  61. $this->messages[] = $string; 
  62.  
  63. /** 
  64. * @access public 
  65. */ 
  66. public function header() { 
  67. ob_start(); 
  68.  
  69. /** 
  70. * @access public 
  71. */ 
  72. public function footer() { 
  73. $output = ob_get_clean(); 
  74. if ( ! empty( $output ) ) 
  75. $this->feedback( $output );