| Server IP : 172.67.71.254 / Your IP : 216.73.216.4 Web Server : nginx/1.27.1 System : Linux in-5 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64 User : arabianexpress ( 1872) PHP Version : 8.0.30 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /storage/v9321/rimskannur/public_html/wp-content/plugins/ninja-forms/includes/Routes/ |
Upload File : |
<?php if ( ! defined( 'ABSPATH' ) ) exit;
/**
* Class NF_Routes_SubmissionsActions
*/
final class NF_Routes_Telemetry extends NF_Abstracts_Routes
{
/**
* Register REST API routes related to Telemetry
*
* @since 3.8.18
*
* @route "nf-be-data/store"
*/
function register_routes() {
$opted_out = !has_filter( 'ninja_forms_settings_licenses_addons' ) && ( ! (bool) get_option( 'ninja_forms_allow_tracking' ) || (bool) get_option( 'ninja_forms_do_not_allow_tracking' ) );
if(!$opted_out) {
register_rest_route('nf-be-data', 'store', array(
'methods' => 'POST',
'callback' => [ $this, 'nf_be_store_data' ],
'permission_callback' => [ $this, 'nf_be_store_data_permission_callback' ]
));
}
}
// Security check for the rest route
function nf_be_store_data_permission_callback() {
return is_user_logged_in();
}
// Action for the REST route
function nf_be_store_data($request) {
$data = json_decode($request['data'], true);
if(!$data || $data[2] <= 0) {
return new WP_REST_Response('Invalid data', 400);
}
$data[] = get_current_user_id();
$stored_data = get_option('nf_be_data', []);
$stored_data[] = $data;
update_option('nf_be_data', $stored_data);
return new WP_REST_Response('Data stored', 200);
}
}