From 989ab79f9171fc73cdfd74c61ebb84c30e6834a7 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Tue, 27 Apr 2021 12:05:58 +0200 Subject: [PATCH] Inject TGM_Plugin_Activation into TGMPA_List_Table This allows each list to use its corresponding TGMPA instance, instead of all lists using the same global instance. TGMPA/TGM-Plugin-Activation#804 --- class-tgm-plugin-activation.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/class-tgm-plugin-activation.php b/class-tgm-plugin-activation.php index 7f70bad9..644971f8 100755 --- a/class-tgm-plugin-activation.php +++ b/class-tgm-plugin-activation.php @@ -755,7 +755,7 @@ protected function add_admin_menu( array $args ) { */ public function install_plugins_page() { // Store new instance of plugin table in object. - $plugin_table = new TGMPA_List_Table(); + $plugin_table = new TGMPA_List_Table($this); // Return early if processing a plugin installation action. if ( ( ( 'tgmpa-bulk-install' === $plugin_table->current_action() || 'tgmpa-bulk-update' === $plugin_table->current_action() ) && $plugin_table->process_bulk_actions() ) || $this->do_plugin_install() ) { @@ -2271,10 +2271,12 @@ class TGMPA_List_Table extends WP_List_Table { /** * References parent constructor and sets defaults for class. * + * @param TGM_Plugin_Activation $tgmpa The TGMPA instance to be used by this list. + * * @since 2.2.0 */ - public function __construct() { - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); + public function __construct($tgmpa) { + $this->tgmpa = $tgmpa; parent::__construct( array(