Skip to content

Commit

Permalink
Fixes TGMPA#171.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thomasgriffin committed Mar 18, 2014
1 parent 374285e commit 852c7e1
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions class-tgm-plugin-activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
Expand Down Expand Up @@ -504,7 +504,7 @@ protected function do_plugin_install() {

if ( is_wp_error( $activate ) ) {
echo '<div id="message" class="error"><p>' . $activate->get_error_message() . '</p></div>';
echo '<p><a href="' . add_query_arg( 'page', $this->menu, network_admin_url( 'themes.php' ) ) . '" title="' . esc_attr( $this->strings['return'] ) . '" target="_parent">' . $this->strings['return'] . '</a></p>';
echo '<p><a href="' . add_query_arg( 'page', $this->menu, admin_url( 'themes.php' ) ) . '" title="' . esc_attr( $this->strings['return'] ) . '" target="_parent">' . $this->strings['return'] . '</a></p>';
return true; // End it here if there is an error with automatic activation
}
else {
Expand All @@ -516,7 +516,7 @@ protected function do_plugin_install() {
$complete = array();
foreach ( $this->plugins as $plugin ) {
if ( ! is_plugin_active( $plugin['file_path'] ) ) {
echo '<p><a href="' . add_query_arg( 'page', $this->menu, network_admin_url( 'themes.php' ) ) . '" title="' . esc_attr( $this->strings['return'] ) . '" target="_parent">' . $this->strings['return'] . '</a></p>';
echo '<p><a href="' . add_query_arg( 'page', $this->menu, admin_url( 'themes.php' ) ) . '" title="' . esc_attr( $this->strings['return'] ) . '" target="_parent">' . $this->strings['return'] . '</a></p>';
$complete[] = $plugin;
break;
}
Expand All @@ -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 '<p>' . sprintf( $this->strings['complete'], '<a href="' . network_admin_url() . '" title="' . __( 'Return to the Dashboard', 'tgmpa' ) . '">' . __( 'Return to the Dashboard', 'tgmpa' ) . '</a>' ) . '</p>';
echo '<p>' . sprintf( $this->strings['complete'], '<a href="' . admin_url() . '" title="' . __( 'Return to the Dashboard', 'tgmpa' ) . '">' . __( 'Return to the Dashboard', 'tgmpa' ) . '</a>' ) . '</p>';
echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>';
}

Expand All @@ -553,7 +553,7 @@ protected function do_plugin_install() {

if ( is_wp_error( $activate ) ) {
echo '<div id="message" class="error"><p>' . $activate->get_error_message() . '</p></div>';
echo '<p><a href="' . add_query_arg( 'page', $this->menu, network_admin_url( 'themes.php' ) ) . '" title="' . esc_attr( $this->strings['return'] ) . '" target="_parent">' . $this->strings['return'] . '</a></p>';
echo '<p><a href="' . add_query_arg( 'page', $this->menu, admin_url( 'themes.php' ) ) . '" title="' . esc_attr( $this->strings['return'] ) . '" target="_parent">' . $this->strings['return'] . '</a></p>';
return true; // End it here if there is an error with activation.
}
else {
Expand Down Expand Up @@ -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[] = '<a href="' . esc_url( $url ) . '" class="thickbox" title="' . $plugin_group_single_name . '">' . $plugin_group_single_name . '</a>';
Expand All @@ -723,8 +723,8 @@ public function notices() {
}

// Setup variables to determine if action links are needed.
$show_install_link = $install_link ? '<a href="' . add_query_arg( 'page', $this->menu, network_admin_url( 'themes.php' ) ) . '">' . translate_nooped_plural( $this->strings['install_link'], $install_link_count, 'tgmpa' ) . '</a>' : '';
$show_activate_link = $activate_link ? '<a href="' . add_query_arg( 'page', $this->menu, network_admin_url( 'themes.php' ) ) . '">' . translate_nooped_plural( $this->strings['activate_link'], $activate_link_count, 'tgmpa' ) . '</a>' : '';
$show_install_link = $install_link ? '<a href="' . add_query_arg( 'page', $this->menu, admin_url( 'themes.php' ) ) . '">' . translate_nooped_plural( $this->strings['install_link'], $install_link_count, 'tgmpa' ) . '</a>' : '';
$show_activate_link = $activate_link ? '<a href="' . add_query_arg( 'page', $this->menu, admin_url( 'themes.php' ) ) . '">' . translate_nooped_plural( $this->strings['activate_link'], $activate_link_count, 'tgmpa' ) . '</a>' : '';

// Define all of the action links.
$action_links = apply_filters(
Expand Down Expand Up @@ -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'] = '<strong><a href="' . esc_url( $url ) . '" class="thickbox" title="' . $plugin['name'] . '">' . $plugin['name'] . '</a></strong>';
Expand Down Expand Up @@ -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'
),
Expand All @@ -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']
),
Expand Down Expand Up @@ -1358,7 +1358,7 @@ public function column_cb( $item ) {
*/
public function no_items() {

printf( __( 'No plugins to install or activate. <a href="%1$s" title="Return to the Dashboard">Return to the Dashboard</a>', 'tgmpa' ), network_admin_url() );
printf( __( 'No plugins to install or activate. <a href="%1$s" title="Return to the Dashboard">Return to the Dashboard</a>', 'tgmpa' ), admin_url() );
echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>';

}
Expand Down Expand Up @@ -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'
);
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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 '<p><a href="' . add_query_arg( 'page', TGM_Plugin_Activation::$instance->menu, network_admin_url( 'themes.php' ) ) . '" title="' . esc_attr( TGM_Plugin_Activation::$instance->strings['return'] ) . '" target="_parent">' . TGM_Plugin_Activation::$instance->strings['return'] . '</a></p>';
echo '<p><a href="' . add_query_arg( 'page', TGM_Plugin_Activation::$instance->menu, admin_url( 'themes.php' ) ) . '" title="' . esc_attr( TGM_Plugin_Activation::$instance->strings['return'] ) . '" target="_parent">' . TGM_Plugin_Activation::$instance->strings['return'] . '</a></p>';
$complete[] = $plugin;
break;
}
Expand All @@ -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 '<p>' . sprintf( TGM_Plugin_Activation::$instance->strings['complete'], '<a href="' . network_admin_url() . '" title="' . __( 'Return to the Dashboard', 'tgmpa' ) . '">' . __( 'Return to the Dashboard', 'tgmpa' ) . '</a>' ) . '</p>';
echo '<p>' . sprintf( TGM_Plugin_Activation::$instance->strings['complete'], '<a href="' . admin_url() . '" title="' . __( 'Return to the Dashboard', 'tgmpa' ) . '">' . __( 'Return to the Dashboard', 'tgmpa' ) . '</a>' ) . '</p>';
echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>';
}

Expand Down

0 comments on commit 852c7e1

Please sign in to comment.