'Unauthorized'], 403); return; } $api_url = "/wordpress/wpapi.php?action=leadboxids&" . APWTLBAPIAuth(); $response = APWTRemoteGet($api_url); if (!$response) { wp_send_json_error(['message' => 'Failed to fetch leadboxes']); return; } $leadboxes = explode("-|-", $response); array_pop($leadboxes); $formatted_leadboxes = []; foreach ($leadboxes as $val) { $pieces = explode("-*-", $val); if (count($pieces) === 2 && intval($pieces[0]) > 0) { $formatted_leadboxes[] = [ 'id' => sanitize_text_field($pieces[0]), 'name' => sanitize_text_field($pieces[1]), ]; } } wp_send_json_success($formatted_leadboxes); } function APWT_admin_menu() { add_menu_page("AllProWebTools","AllProWebTools",'activate_plugins',"AllProWebTools3","APWTLBSettings",plugins_url( 'wp-icon.png', __FILE__ )); } function APWTLBSettings() { //formerly APWTSettings if ( !current_user_can( 'manage_options' ) ) { wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); } if (isset($_POST['B1'])) { $APWTAPIKey = preg_replace('/[^\da-z]/i', '', $_POST['apikey']); $APWTAPIAuth = preg_replace('/[^\da-z]/i', '', $_POST['apiauth']); if((strlen($APWTAPIKey) != 25) && ($APWTAPIKey != '')) { $message = '
Invalid API Key
'; $count = 0; } else { //they have entered their api key - now save it $_SESSION['serverurl'] = ''; if (!add_option( 'APWTAPIKEY', $APWTAPIKey)) { update_option( 'APWTAPIKEY', $APWTAPIKey ); if($APWTAPIKey == '') { $count = 0; } else { $count = 1; } } } if((strlen($APWTAPIAuth) != 16) && ($APWTAPIAuth != '')) { $message = '
Invalid API Auth
'; $count2 = 0; } else { //they have entered their api key - now save it if (!add_option( 'APWTAPIAUTH', $APWTAPIAuth)) { update_option( 'APWTAPIAUTH', $APWTAPIAuth ); if($APWTAPIAuth == '') { $count2 = 0; } else { $count2 = 1; } } } $count3 = $count + $count2; if($count3 == 2) { $message = '
Congratulations You Are Ready To Go!
'; } } else { $message = ''; } print $message; ?>

AllProWebTools API Settings

">
">

Detailed instructions are available here.