'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 = '