removing middleware test api
This commit is contained in:
parent
d03d3f9e8e
commit
fd6f769d35
|
|
@ -8,8 +8,6 @@ require_once(__DIR__ . '/includes/admin.php');
|
||||||
require_once(__DIR__ . '/includes/logos.php');
|
require_once(__DIR__ . '/includes/logos.php');
|
||||||
require_once(__DIR__ . '/includes/api.php');
|
require_once(__DIR__ . '/includes/api.php');
|
||||||
require_once(__DIR__ . '/includes/statistics-page.php');
|
require_once(__DIR__ . '/includes/statistics-page.php');
|
||||||
// require_once(__DIR__ . '/includes/route.php');
|
|
||||||
|
|
||||||
|
|
||||||
// require_once(__DIR__ . '/includes/widget.php');
|
// require_once(__DIR__ . '/includes/widget.php');
|
||||||
// require_once( __DIR__ . '/includes/taxonomy.php');
|
// require_once( __DIR__ . '/includes/taxonomy.php');
|
||||||
|
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
function validateStatistics($data)
|
|
||||||
{
|
|
||||||
if (!isset($data->user_locale) || !is_string($data->user_locale) || strlen($data->user_locale) > 3) {
|
|
||||||
throw new Exception("La propriété 'user_locale' est manquante ou invalide.");
|
|
||||||
}
|
|
||||||
if (!isset($data->user_country) || !is_string($data->user_country)) {
|
|
||||||
throw new Exception("La propriété 'user_country' est manquante ou invalide.");
|
|
||||||
}
|
|
||||||
if (!isset($data->level_post_id) || !is_numeric($data->level_post_id)) {
|
|
||||||
throw new Exception("La propriété 'level_post_id' est manquante ou invalide.");
|
|
||||||
}
|
|
||||||
if (!isset($data->level_score) || !is_numeric($data->level_score)) {
|
|
||||||
throw new Exception("La propriété 'level_score' est manquante ou invalide.");
|
|
||||||
}
|
|
||||||
if (!isset($data->level_completion_time) || !is_numeric($data->level_completion_time)) {
|
|
||||||
throw new Exception("La propriété 'level_completion_time' est manquante ou invalide.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$json = file_get_contents('php://input');
|
|
||||||
$data = json_decode($json);
|
|
||||||
|
|
||||||
|
|
||||||
write_log($data);
|
|
||||||
write_log(validateStatistics($data));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if (isset($data->propriete) && is_string($data->propriete)) {
|
|
||||||
// write_log($data);
|
|
||||||
// write_log($cleanData = htmlspecialchars($data));
|
|
||||||
// } else {
|
|
||||||
// // Les données ne sont pas valides, gérer l'erreur
|
|
||||||
// }
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
<?php
|
|
||||||
add_action('template_redirect', function () {
|
|
||||||
$uri = $_SERVER['REQUEST_URI'];
|
|
||||||
if (strpos($uri, '/api/truc') !== false) {
|
|
||||||
// Traitez la route ici ou redirigez la requête
|
|
||||||
include_once(__DIR__ . '/middleware-api.php');
|
|
||||||
exit; // Arrêtez l'exécution pour éviter de revenir à WordPress
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Loading…
Reference in New Issue
Block a user