I found a solution for the Fatal Error! Just follow up and the Fatal will be gone and the plugin will be activated:
1) Use FTP, File Manager, or cPanel to locate the
wp-config.php file in the root directory of your WordPress installation.
and add this code before the "That's all, stop editing! Happy publishing." :
error_reporting( E_ALL & ~E_DEPRECATED & ~E_NOTICE );
Then--->
2) Copy and Paste the following code in /wp-content/plugins/sonaar-music-pro/includes/class-sonaar-music-licences.php
Open class-sonaar-music-licences.php and just replace it with this one:
<?php
add_action( 'wp_ajax_sonaar_music_registerLicence', 'sonaar_music_registerLicence' );
function printPurchasedPlan(){
$SRMP3_plan = get_site_option('SRMP3_purchased_plan');
if(!$SRMP3_plan) return 'Unregistered';
switch ($SRMP3_plan) {
case '1':
$SRMP3_plan = 'Starter';
break;
case '6':
$SRMP3_plan = 'Starter with Template Addon';
break;
case '5':
$SRMP3_plan = 'Business';
break;
case '7':
$SRMP3_plan = 'Business with Template Addon';
break;
case '3':
$SRMP3_plan = 'Unlimited';
break;
case '4':
$SRMP3_plan = 'Lifetime';
break;
default:
$SRMP3_plan = false;
break;
}
return $SRMP3_plan;
}
function sonaar_music_registerLicence($localdata) {
$data = ( $localdata ) ? $localdata : $_POST['data'];
$response = update_site_option('sonaar_music_licence', $data['licenceKey']);
delete_site_transient('sonaar_music_licence');
delete_site_transient('SRMP3_plugin_update_transient');
$response = set_site_transient( 'sonaar_music_licence', $data, 7 * DAY_IN_SECONDS );
delete_site_option('SRMP3_purchased_plan');
// Ensure $data['response'] is an array
$data['response'] = (array) $data['response'];
if ( array_key_exists('license_info', $data['response']) ) {
$data['response']['license_info'] = (array) $data['response']['license_info'];
update_site_option('SRMP3_License_Status', $data['response']['license_info']['status']);
if ( $data['response']['license_info']['status'] === 'active' ) {
add_site_option('SRMP3_purchased_plan', $data['response']['license_info']['price_id']);
if ( $data['response']['license_info']['price_id'] == '3' || $data['response']['license_info']['price_id'] == '4' || $data['response']['license_info']['price_id'] == '5' || $data['response']['license_info']['price_id'] == '7' ) {
add_site_option('SRMP3_ecommerce', true);
} else {
delete_site_option('SRMP3_ecommerce');
}
}
}
if ( $localdata ) {
return $response;
}
// Create an associative array containing response and price_id
$result = array(
'response' => $data['response'],
'price_id' => printPurchasedPlan()
);
wp_send_json( $result );
}
add_action( 'wp_ajax_sonaar_music_activateRemoteLicence', 'sonaar_music_activateRemoteLicence' );
function sonaar_music_activateRemoteLicence($localdata) {
global $wp_version;
$data = ($localdata) ? $localdata : $_POST['data'];
$data['item_id'] = '5816';
$api_url = '
https://sonaar.io/wp-json/wp/v2/sonaar-api/';
$user_agent = 'SRMP3PRO/' . SRMP3PRO_VERSION . ' WordPress/' . $wp_version . '; ' . get_bloginfo('url');
$data = wp_remote_post($api_url, array(
'body' => array('remotelicence' => $data),
'headers' => array(
'User-Agent' => $user_agent
)
));
if ($localdata) {
return $data;
}
wp_send_json( $data );
}
function sonaar_music_validateCurrentLicence( $licence ) {
if ( get_site_url() != '
https://sonaar.io' ) {
// Ensure $licence is an array
if ( is_array( $licence ) && isset( $licence['licenceKey'] ) ) {
return $licence['licenceKey'];
}
$response = sonaar_music_activateRemoteLicence( array(
'licenceKey' => get_site_option( 'sonaar_music_licence' ),
'siteUrl' => $_SERVER['SERVER_NAME'],
)
);
if ( is_wp_error( $response ) ) {
return false;
}
$response = json_decode( $response['body'], true ); // Ensure this is decoded as an array
$register = sonaar_music_registerLicence( array(
'licenceKey'=> get_site_option( 'sonaar_music_licence' ),
'response'=> $response,
)
);
if (!$register) {
return false;
}
$licence = get_site_transient( 'sonaar_music_licence' );
// Ensure $licence is an array before accessing keys
if ( is_array( $licence ) && isset( $licence['licenceKey'] ) ) {
return $licence['licenceKey'];
} else {
return false;
}
}
}
if ( is_admin() ) {
sonaar_music_validateCurrentLicence( get_site_transient('sonaar_music_licence') );
}
add_action( 'wp_ajax_sonaar_music_clearCache', 'sonaar_music_clearCache' );
function sonaar_music_clearCache($type){
$data = $_POST['data'];
switch ($data['type']) {
case 'transient':
delete_site_transient('sonaar_music_licence');
delete_site_transient('SRMP3_plugin_update_transient');
break;
case 'option':
delete_site_transient('sonaar_music_licence');
delete_site_transient('SRMP3_plugin_update_transient');
delete_site_option('sonaar_music_licence');
delete_site_option('SRMP3_purchased_plan');
break;
default:
break;
}
}
add_action( 'wp_ajax_sonaar_music_invalidateLicense', 'sonaar_music_invalidateLicense' );
function sonaar_music_invalidateLicense(){
delete_site_transient('SRMP3_plugin_update_transient');
delete_site_transient('sonaar_music_licence');
delete_site_option('SRMP3_purchased_plan');
}