$status['errorCode'
] = 'unable_to_connect_to_filesystem';
$status['errorMessage'
] =
__( 'Unable to connect to the filesystem. Please confirm your credentials.'
);
// Pass through the error from WP_Filesystem if one was raised.
if ( $wp_filesystem instanceof WP_Filesystem_Base &&
is_wp_error( $wp_filesystem->errors
) &&
$wp_filesystem->errors->
has_errors() ) { $status['errorMessage'
] =
esc_html( $wp_filesystem->errors->
get_error_message() );
} wp_send_json_error( $status );
} $install_status =
install_plugin_install_status( $api );
$pagenow =
isset( $_POST['pagenow'
] ) ?
sanitize_key( $_POST['pagenow'
] ) : '';
// If installation request is coming from import page, do not return network activation link.
$plugins_url =
( 'import' ===
$pagenow ) ?
admin_url( 'plugins.php'
) :
network_admin_url( 'plugins.php'
);
if ( current_user_can( 'activate_plugin',
$install_status['file'
] ) &&
is_plugin_inactive( $install_status['file'
] ) ) { $status['activateUrl'
] =
add_query_arg( array
( '_wpnonce' =>
wp_create_nonce( 'activate-plugin_' .
$install_status['file'
] ),
'action' => 'activate',
'plugin' =>
$install_status['file'
],
),