/wp-admin/includes/class-language-pack-upgrader-skin.php

  1. <?php 
  2. /** 
  3. * Upgrader API: Language_Pack_Upgrader_Skin class 
  4. * 
  5. * @package WordPress 
  6. * @subpackage Upgrader 
  7. * @since 4.6.0 
  8. */ 
  9.  
  10. /** 
  11. * Translation Upgrader Skin for WordPress Translation Upgrades. 
  12. * 
  13. * @since 3.7.0 
  14. * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php. 
  15. * 
  16. * @see WP_Upgrader_Skin 
  17. */ 
  18. class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin { 
  19. public $language_update = null; 
  20. public $done_header = false; 
  21. public $done_footer = false; 
  22. public $display_footer_actions = true; 
  23.  
  24. /** 
  25. * 
  26. * @param array $args 
  27. */ 
  28. public function __construct( $args = array() ) { 
  29. $defaults = array( 'url' => '', 'nonce' => '', 'title' => __( 'Update Translations' ), 'skip_header_footer' => false ); 
  30. $args = wp_parse_args( $args, $defaults ); 
  31. if ( $args['skip_header_footer'] ) { 
  32. $this->done_header = true; 
  33. $this->done_footer = true; 
  34. $this->display_footer_actions = false; 
  35. parent::__construct( $args ); 
  36.  
  37. /** 
  38. * @access public 
  39. */ 
  40. public function before() { 
  41. $name = $this->upgrader->get_name_for_update( $this->language_update ); 
  42.  
  43. echo '<div class="update-messages lp-show-latest">'; 
  44.  
  45. printf( '<h2>' . __( 'Updating translations for %1$s (%2$s)…' ) . '</h2>', $name, $this->language_update->language ); 
  46.  
  47. /** 
  48. * 
  49. * @param string|WP_Error $error 
  50. */ 
  51. public function error( $error ) { 
  52. echo '<div class="lp-error">'; 
  53. parent::error( $error ); 
  54. echo '</div>'; 
  55.  
  56. /** 
  57. * @access public 
  58. */ 
  59. public function after() { 
  60. echo '</div>'; 
  61.  
  62. /** 
  63. * @access public 
  64. */ 
  65. public function bulk_footer() { 
  66. $this->decrement_update_count( 'translation' ); 
  67. $update_actions = array(); 
  68. $update_actions['updates_page'] = '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>'; 
  69.  
  70. /** 
  71. * Filters the list of action links available following a translations update. 
  72. * 
  73. * @since 3.7.0 
  74. * 
  75. * @param array $update_actions Array of translations update links. 
  76. */ 
  77. $update_actions = apply_filters( 'update_translations_complete_actions', $update_actions ); 
  78.  
  79. if ( $update_actions && $this->display_footer_actions ) 
  80. $this->feedback( implode( ' | ', $update_actions ) ); 
.