Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
Plugin_Installer_Skin
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
12
0.00% covered (danger)
0.00%
0 / 1
 add_changelog_entry_to_upgrade_screen
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
12
1<?php
2
3namespace BrianHenryIE\WC_Address_Validation\Admin;
4
5class Plugin_Installer_Skin {
6
7    /**
8     * When installing a plugin via zip, and the plugin already exists, append the changelog to the warning message.
9     *
10     * Filter the compare table output for overwriting a plugin package on upload.
11     *
12     * @hooked install_plugin_overwrite_comparison
13     * @see Plugin_Installer_Skin::do_overwrite()
14     *
15     * @param string $table               The output table with Name, Version, Author, RequiresWP, and RequiresPHP info.
16     * @param array  $current_plugin_data Array with current plugin data.
17     * @param array  $new_plugin_data     Array with uploaded plugin data.
18     */
19    public function add_changelog_entry_to_upgrade_screen( string $table, array $current_plugin_data, array $new_plugin_data ) {
20
21        if ( ! isset( $current_plugin_data['TextDomain'] ) || 'bh-wc-address-validation' !== $current_plugin_data['TextDomain'] ) {
22            return $table;
23        }
24
25        $table .= '<p>1.4.0 – Add: changelog on plugin install screen; Fix: Accidentally included outdated library files.</p>';
26
27        $table .= '<hr/>';
28
29        return $table;
30    }
31}