summaryrefslogtreecommitdiffstats
path: root/wp-admin/includes/class-language-pack-upgrader-skin.php
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:56:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:56:49 +0000
commita415c29efee45520ae252d2aa28f1083a521cd7b (patch)
treef4ade4b6668ecc0765de7e1424f7c1427ad433ff /wp-admin/includes/class-language-pack-upgrader-skin.php
parentInitial commit. (diff)
downloadwordpress-a415c29efee45520ae252d2aa28f1083a521cd7b.tar.xz
wordpress-a415c29efee45520ae252d2aa28f1083a521cd7b.zip
Adding upstream version 6.4.3+dfsg1.upstream/6.4.3+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wp-admin/includes/class-language-pack-upgrader-skin.php')
-rw-r--r--wp-admin/includes/class-language-pack-upgrader-skin.php97
1 files changed, 97 insertions, 0 deletions
diff --git a/wp-admin/includes/class-language-pack-upgrader-skin.php b/wp-admin/includes/class-language-pack-upgrader-skin.php
new file mode 100644
index 0000000..57b0a1c
--- /dev/null
+++ b/wp-admin/includes/class-language-pack-upgrader-skin.php
@@ -0,0 +1,97 @@
+<?php
+/**
+ * Upgrader API: Language_Pack_Upgrader_Skin class
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 4.6.0
+ */
+
+/**
+ * Translation Upgrader Skin for WordPress Translation Upgrades.
+ *
+ * @since 3.7.0
+ * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php.
+ *
+ * @see WP_Upgrader_Skin
+ */
+class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin {
+ public $language_update = null;
+ public $done_header = false;
+ public $done_footer = false;
+ public $display_footer_actions = true;
+
+ /**
+ * @param array $args
+ */
+ public function __construct( $args = array() ) {
+ $defaults = array(
+ 'url' => '',
+ 'nonce' => '',
+ 'title' => __( 'Update Translations' ),
+ 'skip_header_footer' => false,
+ );
+ $args = wp_parse_args( $args, $defaults );
+ if ( $args['skip_header_footer'] ) {
+ $this->done_header = true;
+ $this->done_footer = true;
+ $this->display_footer_actions = false;
+ }
+ parent::__construct( $args );
+ }
+
+ /**
+ */
+ public function before() {
+ $name = $this->upgrader->get_name_for_update( $this->language_update );
+
+ echo '<div class="update-messages lp-show-latest">';
+
+ /* translators: 1: Project name (plugin, theme, or WordPress), 2: Language. */
+ printf( '<h2>' . __( 'Updating translations for %1$s (%2$s)&#8230;' ) . '</h2>', $name, $this->language_update->language );
+ }
+
+ /**
+ * @since 5.9.0 Renamed `$error` to `$errors` for PHP 8 named parameter support.
+ *
+ * @param string|WP_Error $errors Errors.
+ */
+ public function error( $errors ) {
+ echo '<div class="lp-error">';
+ parent::error( $errors );
+ echo '</div>';
+ }
+
+ /**
+ */
+ public function after() {
+ echo '</div>';
+ }
+
+ /**
+ */
+ public function bulk_footer() {
+ $this->decrement_update_count( 'translation' );
+
+ $update_actions = array(
+ 'updates_page' => sprintf(
+ '<a href="%s" target="_parent">%s</a>',
+ self_admin_url( 'update-core.php' ),
+ __( 'Go to WordPress Updates page' )
+ ),
+ );
+
+ /**
+ * Filters the list of action links available following a translations update.
+ *
+ * @since 3.7.0
+ *
+ * @param string[] $update_actions Array of translations update links.
+ */
+ $update_actions = apply_filters( 'update_translations_complete_actions', $update_actions );
+
+ if ( $update_actions && $this->display_footer_actions ) {
+ $this->feedback( implode( ' | ', $update_actions ) );
+ }
+ }
+}