コード例 #1
0
header('Content-Type: application/json');
header("Access-Control-Allow-Origin: *");
require_once "Able.php";
require_once "errors.php";
require_once "settings.php";
// Instantiate the object Able
$able = new Able();
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();
コード例 #2
0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions & limitations
 * under the License.
 */
header('Content-Type: application/json');
header("Access-Control-Allow-Origin: *");
require_once "Able.php";
require_once "errors.php";
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;