Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/ninja-fo.../includes/Integrat...
File: sendwp.php
<?php
[0] Fix | Delete
[1] Fix | Delete
// Ajax called handled just below
[2] Fix | Delete
add_action( 'wp_ajax_ninja_forms_sendwp_remote_install', 'wp_ajax_ninja_forms_sendwp_remote_install_handler' );
[3] Fix | Delete
[4] Fix | Delete
function wp_ajax_ninja_forms_sendwp_remote_install_handler () {
[5] Fix | Delete
if (!current_user_can('manage_options') || ! isset($_REQUEST['nonce']) || ! wp_verify_nonce( $_REQUEST['nonce'] , 'ninja_forms_sendwp_remote_install') ) {
[6] Fix | Delete
ob_end_clean();
[7] Fix | Delete
echo json_encode( array( 'error' => esc_html__( 'Something went wrong. SendWP was not installed correctly.', 'ninja-forms') ) );
[8] Fix | Delete
exit;
[9] Fix | Delete
}
[10] Fix | Delete
[11] Fix | Delete
$all_plugins = get_plugins();
[12] Fix | Delete
$is_sendwp_installed = false;
[13] Fix | Delete
foreach(get_plugins() as $path => $details ) {
[14] Fix | Delete
if(false === strpos($path, '/sendwp.php')) continue;
[15] Fix | Delete
$is_sendwp_installed = true;
[16] Fix | Delete
activate_plugin( $path );
[17] Fix | Delete
break;
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
if( ! $is_sendwp_installed ) {
[21] Fix | Delete
[22] Fix | Delete
$plugin_slug = 'sendwp';
[23] Fix | Delete
[24] Fix | Delete
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
[25] Fix | Delete
include_once ABSPATH . 'wp-admin/includes/file.php';
[26] Fix | Delete
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
[27] Fix | Delete
[28] Fix | Delete
/*
[29] Fix | Delete
* Use the WordPress Plugins API to get the plugin download link.
[30] Fix | Delete
*/
[31] Fix | Delete
$api = plugins_api( 'plugin_information', array(
[32] Fix | Delete
'slug' => $plugin_slug,
[33] Fix | Delete
) );
[34] Fix | Delete
if ( is_wp_error( $api ) ) {
[35] Fix | Delete
ob_end_clean();
[36] Fix | Delete
echo json_encode( array( 'error' => $api->get_error_message(), 'debug' => $api ) );
[37] Fix | Delete
exit;
[38] Fix | Delete
}
[39] Fix | Delete
[40] Fix | Delete
/*
[41] Fix | Delete
* Use the AJAX Upgrader skin to quietly install the plugin.
[42] Fix | Delete
*/
[43] Fix | Delete
$upgrader = new Plugin_Upgrader( new WP_Ajax_Upgrader_Skin() );
[44] Fix | Delete
$install = $upgrader->install( $api->download_link );
[45] Fix | Delete
if ( is_wp_error( $install ) ) {
[46] Fix | Delete
ob_end_clean();
[47] Fix | Delete
echo json_encode( array( 'error' => $install->get_error_message(), 'debug' => $api ) );
[48] Fix | Delete
exit;
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
/*
[52] Fix | Delete
* Activate the plugin based on the results of the upgrader.
[53] Fix | Delete
* @NOTE Assume this works, if the download works - otherwise there is a false positive if the plugin is already installed.
[54] Fix | Delete
*/
[55] Fix | Delete
$activated = activate_plugin( $upgrader->plugin_info() );
[56] Fix | Delete
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
/*
[60] Fix | Delete
* Final check to see if SendWP is available.
[61] Fix | Delete
*/
[62] Fix | Delete
if( ! function_exists('sendwp_get_server_url') ) {
[63] Fix | Delete
ob_end_clean();
[64] Fix | Delete
echo json_encode( array(
[65] Fix | Delete
'error' => esc_html__( 'Something went wrong. SendWP was not installed correctly.' ),
[66] Fix | Delete
'install' => $install,
[67] Fix | Delete
) );
[68] Fix | Delete
exit;
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
echo json_encode( array(
[72] Fix | Delete
'partner_id' => 16,
[73] Fix | Delete
'register_url' => esc_url(sendwp_get_server_url() . '_/signup'),
[74] Fix | Delete
'client_name' => esc_attr( sendwp_get_client_name() ),
[75] Fix | Delete
'client_secret' => esc_attr( sendwp_get_client_secret() ),
[76] Fix | Delete
'client_redirect' => esc_url(sendwp_get_client_redirect()),
[77] Fix | Delete
'client_url' => esc_url( sendwp_get_client_url() ),
[78] Fix | Delete
) );
[79] Fix | Delete
exit;
[80] Fix | Delete
}
[81] Fix | Delete
[82] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function