From 852c7e13e1255716f72f8e42ae02d306ab18b0dd Mon Sep 17 00:00:00 2001 From: Thomas Griffin Date: Tue, 18 Mar 2014 11:53:16 -0400 Subject: [PATCH] Fixes #171. Fixes permissions error by using network_admin_url instead of admin_url. Reverted back to admin_url since after testing it works fine for MultiSite. --- class-tgm-plugin-activation.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/class-tgm-plugin-activation.php b/class-tgm-plugin-activation.php index c3e31dbd..365edd03 100755 --- a/class-tgm-plugin-activation.php +++ b/class-tgm-plugin-activation.php @@ -440,7 +440,7 @@ protected function do_plugin_install() { 'plugin_source' => $plugin['source'], 'tgmpa-install' => 'install-plugin', ), - network_admin_url( 'themes.php' ) + admin_url( 'themes.php' ) ), 'tgmpa-install' ); @@ -504,7 +504,7 @@ protected function do_plugin_install() { if ( is_wp_error( $activate ) ) { echo '

' . $activate->get_error_message() . '

'; - echo '

' . $this->strings['return'] . '

'; + echo '

' . $this->strings['return'] . '

'; return true; // End it here if there is an error with automatic activation } else { @@ -516,7 +516,7 @@ protected function do_plugin_install() { $complete = array(); foreach ( $this->plugins as $plugin ) { if ( ! is_plugin_active( $plugin['file_path'] ) ) { - echo '

' . $this->strings['return'] . '

'; + echo '

' . $this->strings['return'] . '

'; $complete[] = $plugin; break; } @@ -531,7 +531,7 @@ protected function do_plugin_install() { // All plugins are active, so we display the complete string and hide the plugin menu. if ( empty( $complete ) ) { - echo '

' . sprintf( $this->strings['complete'], '' . __( 'Return to the Dashboard', 'tgmpa' ) . '' ) . '

'; + echo '

' . sprintf( $this->strings['complete'], '' . __( 'Return to the Dashboard', 'tgmpa' ) . '' ) . '

'; echo ''; } @@ -553,7 +553,7 @@ protected function do_plugin_install() { if ( is_wp_error( $activate ) ) { echo '

' . $activate->get_error_message() . '

'; - echo '

' . $this->strings['return'] . '

'; + echo '

' . $this->strings['return'] . '

'; return true; // End it here if there is an error with activation. } else { @@ -702,7 +702,7 @@ public function notices() { 'width' => '640', 'height' => '500', ), - network_admin_url( 'plugin-install.php' ) + admin_url( 'plugin-install.php' ) ); $linked_plugin_groups[] = '' . $plugin_group_single_name . ''; @@ -723,8 +723,8 @@ public function notices() { } // Setup variables to determine if action links are needed. - $show_install_link = $install_link ? '' . translate_nooped_plural( $this->strings['install_link'], $install_link_count, 'tgmpa' ) . '' : ''; - $show_activate_link = $activate_link ? '' . translate_nooped_plural( $this->strings['activate_link'], $activate_link_count, 'tgmpa' ) . '' : ''; + $show_install_link = $install_link ? '' . translate_nooped_plural( $this->strings['install_link'], $install_link_count, 'tgmpa' ) . '' : ''; + $show_activate_link = $activate_link ? '' . translate_nooped_plural( $this->strings['activate_link'], $activate_link_count, 'tgmpa' ) . '' : ''; // Define all of the action links. $action_links = apply_filters( @@ -1150,7 +1150,7 @@ protected function _gather_plugin_data() { 'width' => '640', 'height' => '500', ), - network_admin_url( 'plugin-install.php' ) + admin_url( 'plugin-install.php' ) ); $table_data[$i]['plugin'] = '' . $plugin['name'] . ''; @@ -1297,7 +1297,7 @@ public function column_plugin( $item ) { 'plugin_source' => $item['url'], 'tgmpa-install' => 'install-plugin', ), - network_admin_url( 'themes.php' ) + admin_url( 'themes.php' ) ), 'tgmpa-install' ), @@ -1319,7 +1319,7 @@ public function column_plugin( $item ) { 'tgmpa-activate' => 'activate-plugin', 'tgmpa-activate-nonce' => wp_create_nonce( 'tgmpa-activate' ), ), - network_admin_url( 'themes.php' ) + admin_url( 'themes.php' ) ), $item['sanitized_plugin'] ), @@ -1358,7 +1358,7 @@ public function column_cb( $item ) { */ public function no_items() { - printf( __( 'No plugins to install or activate. Return to the Dashboard', 'tgmpa' ), network_admin_url() ); + printf( __( 'No plugins to install or activate. Return to the Dashboard', 'tgmpa' ), admin_url() ); echo ''; } @@ -1528,7 +1528,7 @@ public function process_bulk_actions() { 'plugin_paths' => urlencode( implode( ',', $plugin_paths ) ), 'plugin_names' => urlencode( implode( ',', $plugin_names ) ), ), - network_admin_url( 'themes.php' ) + admin_url( 'themes.php' ) ), 'bulk-plugins' ); @@ -1571,7 +1571,7 @@ public function process_bulk_actions() { } // Finally, all the data is prepared to be sent to the installer. - $url = add_query_arg( array( 'page' => TGM_Plugin_Activation::$instance->menu ), network_admin_url( 'themes.php' ) ); + $url = add_query_arg( array( 'page' => TGM_Plugin_Activation::$instance->menu ), admin_url( 'themes.php' ) ); $nonce = 'bulk-plugins'; $names = $plugin_names; @@ -2144,7 +2144,7 @@ public function bulk_footer() { $complete = array(); foreach ( TGM_Plugin_Activation::$instance->plugins as $plugin ) { if ( ! is_plugin_active( $plugin['file_path'] ) ) { - echo '

' . TGM_Plugin_Activation::$instance->strings['return'] . '

'; + echo '

' . TGM_Plugin_Activation::$instance->strings['return'] . '

'; $complete[] = $plugin; break; } @@ -2159,7 +2159,7 @@ public function bulk_footer() { // All plugins are active, so we display the complete string and hide the menu to protect users. if ( empty( $complete ) ) { - echo '

' . sprintf( TGM_Plugin_Activation::$instance->strings['complete'], '' . __( 'Return to the Dashboard', 'tgmpa' ) . '' ) . '

'; + echo '

' . sprintf( TGM_Plugin_Activation::$instance->strings['complete'], '' . __( 'Return to the Dashboard', 'tgmpa' ) . '' ) . '

'; echo ''; }