" onclick="return confirm('');">
get_namespaces(); $all_routes = array_keys( $wp_rest_server->get_routes() ); $whitelisted_routes = is_array( get_option( 'DRA_route_whitelist' ) ) ? get_option( 'DRA_route_whitelist' ) : array(); $loopCounter = 0; $current_namespace = ''; foreach ( $all_routes as $route ) { $is_route_namespace = in_array( ltrim( $route, "/" ), $all_namespaces ); $checkedProp = DRA_get_route_checked_prop( $route, $whitelisted_routes ); if ( $is_route_namespace || "/" == $route ) { $current_namespace = $route; if ( 0 != $loopCounter ) { echo ""; } $route_for_display = ( "/" == $route ) ? "/ " . esc_html__( "REST API ROOT", "disable-json-api" ) . "" : esc_html( $route ); echo "

"; } /** * During comparison, encode the route being requested in the same fashion that it's stored in the database option * Encoding during save happens in Disable_REST_API::maybe_process_settings_form() * * @param $route * @param $whitelisted_routes * * @return string */ function DRA_get_route_checked_prop( $route, $whitelisted_routes ) { $is_route_checked = in_array( esc_html( $route ), $whitelisted_routes, true ); return checked( $is_route_checked, true, false ); }