예제 #1
0
    $countries = get_countries();
    $term = strtolower($_GET['term']);
    $result = array();
    $max_result = isset($_GET["maxRows"]) ? (int) $_GET["maxRows"] : 10;
    $i = 0;
    foreach ($countries as $code => $country) {
        if (stripos(strtolower($country), $term) !== false && $i < $max_result) {
            array_push($result, array("term" => $code, "value" => $country));
            $i++;
        }
    }
    echo json_encode($result);
    exit;
}
if (isset($_GET['term']) && $_GET['type'] == "genre") {
    $genres = wordtour_get_all_genre();
    $term = strtolower($_GET['term']);
    $result = array();
    $max_result = isset($_GET["maxRows"]) ? (int) $_GET["maxRows"] : 10;
    $i = 0;
    foreach ($genres as $genre) {
        if (stripos(strtolower($genre), $term) !== false && $i < $max_result) {
            array_push($result, array("term" => $genre, "value" => ucwords($genre)));
            $i++;
        }
    }
    echo json_encode($result);
    exit;
}
if (isset($_GET['term']) && $_GET['type'] == "event_type") {
    $type = get_all_event_type();
예제 #2
0
function wordtour_add_genre($genre = "")
{
    try {
        $genres = wordtour_get_all_genre();
        $genre = strtolower($genre);
        if (!empty($genre) && !in_array($genre, $genres)) {
            $genres[] = $genre;
            update_option("wordtour_genre", serialize($genres));
        }
    } catch (Exception $e) {
    }
}