function getPictosFromText($var) { return explode(' ', $var); } if (isset($_GET['pictos']) && strlen(trim($_GET['pictos'])) > 0) { $pictos = trim($_GET['pictos']); //$able->setTextInput($text); $pictoArray = getPictosFromText($pictos); $able->setPictos($pictoArray); if (isset($_GET['language']) && strlen(trim($_GET['language'])) > 0) { $language = trim($_GET['language']); if (isset($_GET['type']) && strlen(trim($_GET['type'])) > 0) { //Parameters are ok $type = trim($_GET['type']); if (strcmp($language, "spanish") != 0 && strcmp($language, "english") != 0 && strcmp($language, "dutch") != 0) { $able->setStatus(LANGUAGE_NOT_SUPPORTED); } else { // Language is supported if (strcmp($type, "beta") != 0 && strcmp($type, "sclera") != 0) { $able->setStatus(TYPE_NOT_SUPPORTED); } else { // Type is supported // Prepares an HTTP request using CURL to the selected Text2Picto service $handler = curl_init(); curl_setopt($handler, CURLOPT_URL, PICTO2TEXT); curl_setopt($handler, CURLOPT_POST, true); curl_setopt($handler, CURLOPT_POSTFIELDS, "input=" . $pictos . "&language=" . $language . "&picto=" . $type); curl_setopt($handler, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded')); curl_setopt($handler, CURLOPT_RETURNTRANSFER, 1); // Send the request to the Text2Picto service $response = curl_exec($handler);
require_once "settings.php"; require_once "arasaac.php"; // Instantiate the object Able $able = new Able(); // Sets the pictos value to "Error" $able->setPictos("Error"); if (isset($_GET['text']) && strlen(trim($_GET['text'])) > 0) { $text = trim($_GET['text']); $able->setTextInput($text); if (isset($_GET['language']) && strlen(trim($_GET['language'])) > 0) { $language = trim($_GET['language']); if (isset($_GET['type']) && strlen(trim($_GET['type'])) > 0) { //Parameters are ok $type = trim($_GET['type']); if (strcmp($language, "spanish") != 0 && strcmp($language, "english") != 0 && strcmp($language, "dutch") != 0) { $able->setStatus(LANGUAGE_NOT_SUPPORTED); } else { //Language is supported if (strcmp($type, "beta") != 0 && strcmp($type, "sclera") != 0) { if (strcmp($type, "arasaac") == 0 && (strcmp($language, "spanish") == 0 || strcmp($language, "english") == 0)) { $array_response = NULL; if (isset($_GET["parallel"])) { $parallel = $_GET["parallel"]; if (strcmp($parallel, "true") == 0) { $array_response = arasaacParallel($text, $language); } else { $array_response = arasaacNotParallel($text, $language); } } else { $array_response = arasaacNotParallel($text, $language); }