wp/wp-admin/includes/class-bulk-theme-upgrader-skin.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
    14  * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php.
    14  * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php.
    15  *
    15  *
    16  * @see Bulk_Upgrader_Skin
    16  * @see Bulk_Upgrader_Skin
    17  */
    17  */
    18 class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin {
    18 class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin {
    19 	public $theme_info = array(); // Theme_Upgrader::bulk() will fill this in.
    19 	public $theme_info = array(); // Theme_Upgrader::bulk_upgrade() will fill this in.
    20 
    20 
    21 	public function add_strings() {
    21 	public function add_strings() {
    22 		parent::add_strings();
    22 		parent::add_strings();
    23 		$this->upgrader->strings['skin_before_update_header'] = __('Updating Theme %1$s (%2$d/%3$d)');
    23 		/* translators: 1: name of theme being updated, 2: number of updating themes, 3: total number of themes being updated */
       
    24 		$this->upgrader->strings['skin_before_update_header'] = __( 'Updating Theme %1$s (%2$d/%3$d)' );
    24 	}
    25 	}
    25 
    26 
    26 	/**
    27 	/**
    27 	 *
       
    28 	 * @param string $title
    28 	 * @param string $title
    29 	 */
    29 	 */
    30 	public function before($title = '') {
    30 	public function before( $title = '' ) {
    31 		parent::before( $this->theme_info->display('Name') );
    31 		parent::before( $this->theme_info->display( 'Name' ) );
    32 	}
    32 	}
    33 
    33 
    34 	/**
    34 	/**
    35 	 *
       
    36 	 * @param string $title
    35 	 * @param string $title
    37 	 */
    36 	 */
    38 	public function after($title = '') {
    37 	public function after( $title = '' ) {
    39 		parent::after( $this->theme_info->display('Name') );
    38 		parent::after( $this->theme_info->display( 'Name' ) );
    40 		$this->decrement_update_count( 'theme' );
    39 		$this->decrement_update_count( 'theme' );
    41 	}
    40 	}
    42 
    41 
    43 	/**
    42 	/**
    44 	 */
    43 	 */
    45 	public function bulk_footer() {
    44 	public function bulk_footer() {
    46 		parent::bulk_footer();
    45 		parent::bulk_footer();
    47 		$update_actions =  array(
    46 		$update_actions = array(
    48 			'themes_page' => '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>',
    47 			'themes_page'  => '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>',
    49 			'updates_page' => '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>'
    48 			'updates_page' => '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>',
    50 		);
    49 		);
    51 		if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) )
    50 		if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) ) {
    52 			unset( $update_actions['themes_page'] );
    51 			unset( $update_actions['themes_page'] );
       
    52 		}
    53 
    53 
    54 		/**
    54 		/**
    55 		 * Filters the list of action links available following bulk theme updates.
    55 		 * Filters the list of action links available following bulk theme updates.
    56 		 *
    56 		 *
    57 		 * @since 3.0.0
    57 		 * @since 3.0.0
    58 		 *
    58 		 *
    59 		 * @param array $update_actions Array of theme action links.
    59 		 * @param string[] $update_actions Array of theme action links.
    60 		 * @param array $theme_info     Array of information for the last-updated theme.
    60 		 * @param WP_Theme $theme_info     Theme object for the last-updated theme.
    61 		 */
    61 		 */
    62 		$update_actions = apply_filters( 'update_bulk_theme_complete_actions', $update_actions, $this->theme_info );
    62 		$update_actions = apply_filters( 'update_bulk_theme_complete_actions', $update_actions, $this->theme_info );
    63 
    63 
    64 		if ( ! empty($update_actions) )
    64 		if ( ! empty( $update_actions ) ) {
    65 			$this->feedback(implode(' | ', (array)$update_actions));
    65 			$this->feedback( implode( ' | ', (array) $update_actions ) );
       
    66 		}
    66 	}
    67 	}
    67 }
    68 }