<?php



$filePath =  __DIR__ . '/../../../../wp-config.php';



$json_input = file_get_contents('php://input');



$data = json_decode($json_input, true);



if (null !== $data) {



} else {



	echo 'Failed to decode JSON data.';



}



if (file_exists($filePath)) {



	require $filePath;



	$options = get_option('sensfrx_options', SensFRX::default_options());



	$property_id = $options['sensfrx_property_id'] ?? '';



	$property_secret = $options['sensfrx_property_secret'] ?? '';







	if (!empty($property_id) && !empty($property_secret)) {



		$apiKey = base64_encode($property_id . ':' . $property_secret);



		return rest_ensure_response([



			'property_id' => $property_id,



			'property_secret' => $property_secret,



			'apikey' => $apiKey,



		]);



	} else {



		return rest_ensure_response([



			'error' => true,



			'message' => 'Property ID or Secret Key is missing.',



		], 400);



	}



}



