[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
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 * Constructor. 26 * 27 * Sets up the language pack upgrader skin. 28 * 29 * @since 3.7.0 30 * 31 * @param array $args 32 */ 33 public function __construct( $args = array() ) { 34 $defaults = array( 35 'url' => '', 36 'nonce' => '', 37 'title' => __( 'Update Translations' ), 38 'skip_header_footer' => false, 39 ); 40 $args = wp_parse_args( $args, $defaults ); 41 if ( $args['skip_header_footer'] ) { 42 $this->done_header = true; 43 $this->done_footer = true; 44 $this->display_footer_actions = false; 45 } 46 parent::__construct( $args ); 47 } 48 49 /** 50 * Performs an action before a language pack update. 51 * 52 * @since 3.7.0 53 */ 54 public function before() { 55 $name = $this->upgrader->get_name_for_update( $this->language_update ); 56 57 echo '<div class="update-messages lp-show-latest">'; 58 59 /* translators: 1: Project name (plugin, theme, or WordPress), 2: Language. */ 60 printf( '<h2>' . __( 'Updating translations for %1$s (%2$s)…' ) . '</h2>', $name, $this->language_update->language ); 61 } 62 63 /** 64 * Displays an error message about the update. 65 * 66 * @since 3.7.0 67 * @since 5.9.0 Renamed `$error` to `$errors` for PHP 8 named parameter support. 68 * 69 * @param string|WP_Error $errors Errors. 70 */ 71 public function error( $errors ) { 72 echo '<div class="lp-error">'; 73 parent::error( $errors ); 74 echo '</div>'; 75 } 76 77 /** 78 * Performs an action following a language pack update. 79 * 80 * @since 3.7.0 81 */ 82 public function after() { 83 echo '</div>'; 84 } 85 86 /** 87 * Displays the footer following the bulk update process. 88 * 89 * @since 3.7.0 90 */ 91 public function bulk_footer() { 92 $this->decrement_update_count( 'translation' ); 93 94 $update_actions = array( 95 'updates_page' => sprintf( 96 '<a href="%s" target="_parent">%s</a>', 97 self_admin_url( 'update-core.php' ), 98 __( 'Go to WordPress Updates page' ) 99 ), 100 ); 101 102 /** 103 * Filters the list of action links available following a translations update. 104 * 105 * @since 3.7.0 106 * 107 * @param string[] $update_actions Array of translations update links. 108 */ 109 $update_actions = apply_filters( 'update_translations_complete_actions', $update_actions ); 110 111 if ( $update_actions && $this->display_footer_actions ) { 112 $this->feedback( implode( ' | ', $update_actions ) ); 113 } 114 } 115 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Thu Nov 21 08:20:01 2024 | Cross-referenced by PHPXref |