function dbem_global_map_json($eventful = false)
{
    $json = '{"locations":[';
    $locations = dbem_get_locations($eventful);
    $json_locations = array();
    foreach ($locations as $location) {
        $json_location = array();
        foreach ($location as $key => $value) {
            $json_location[] = '"' . $key . '":"' . $value . '"';
        }
        $json_location[] = '"location_baloon":"' . dbem_replace_locations_placeholders(get_option('dbem_location_baloon_format'), $location) . '"';
        $json_locations[] = "{" . implode(",", $json_location) . "}";
    }
    $json .= implode(",", $json_locations);
    $json .= "]}";
    echo $json;
}
function dbem_events_page_title($data)
{
    $events_page_id = get_option('dbem_events_page');
    $events_page = get_page($events_page_id);
    $events_page_title = $events_page->post_title;
    if ($data == $events_page_title && is_page($events_page_id)) {
        if (isset($_REQUEST['calendar_day']) && $_REQUEST['calendar_day'] != '') {
            $date = $_REQUEST['calendar_day'];
            $events_N = dbem_events_count_for($date);
            if ($events_N == 1) {
                $events = dbem_get_events("", $_REQUEST['calendar_day']);
                $event = $events[0];
                $stored_page_title_format = get_option('dbem_event_page_title_format');
                $page_title = dbem_replace_placeholders($stored_page_title_format, $event);
                return $page_title;
            }
        }
        if (isset($_REQUEST['location_id']) && ($_REQUEST['location_id'] |= '')) {
            $location = dbem_get_location($_REQUEST['location_id']);
            $stored_page_title_format = get_option('dbem_location_page_title_format');
            $page_title = dbem_replace_locations_placeholders($stored_page_title_format, $location);
            return $page_title;
        }
        if (isset($_REQUEST['event_id']) && $_REQUEST['event_id'] != '') {
            // single event page
            $event_ID = $_REQUEST['event_id'];
            $event = dbem_get_event($event_ID);
            $stored_page_title_format = get_option('dbem_event_page_title_format');
            $page_title = dbem_replace_placeholders($stored_page_title_format, $event);
            return $page_title;
        } elseif (isset($_REQUEST['category']) && $_REQUEST['category'] != '') {
            /* ROR Begin Edit */
            $page_title = get_option('dbem_events_page_title');
            $category = dbem_get_category($_REQUEST['category']);
            $page_title .= " › " . $category['category_name'];
            return $page_title;
            /* ROR End Edit */
        } else {
            // Multiple events page
            /* ROR Begin Edit */
            /* Cut this out because it makes things ugly */
            $page_title = get_option('dbem_events_page_title');
            /* ROR End Edit */
            return $page_title;
        }
    } else {
        return $data;
    }
}
Esempio n. 3
0
function dbem_events_page_title($data)
{
    $events_page_id = get_option('dbem_events_page');
    $events_page = get_page($events_page_id);
    $events_page_title = $events_page->post_title;
    if ($data == $events_page_title && is_page($events_page_id)) {
        if (isset($_REQUEST['calendar_day']) && $_REQUEST['calendar_day'] != '') {
            $date = $_REQUEST['calendar_day'];
            $events_N = dbem_events_count_for($date);
            if ($events_N == 1) {
                $events = dbem_get_events("", $_REQUEST['calendar_day']);
                $event = $events[0];
                $stored_page_title_format = get_option('dbem_event_page_title_format');
                $page_title = dbem_replace_placeholders($stored_page_title_format, $event);
                return $page_title;
            }
        }
        if (isset($_REQUEST['location_id']) && ($_REQUEST['location_id'] |= '')) {
            $location = dbem_get_location($_REQUEST['location_id']);
            $stored_page_title_format = get_option('dbem_location_page_title_format');
            $page_title = dbem_replace_locations_placeholders($stored_page_title_format, $location);
            return $page_title;
        }
        if (isset($_REQUEST['event_id']) && $_REQUEST['event_id'] != '') {
            // single event page
            $event_ID = $_REQUEST['event_id'];
            $event = dbem_get_event($event_ID);
            $stored_page_title_format = get_option('dbem_event_page_title_format');
            $page_title = dbem_replace_placeholders($stored_page_title_format, $event);
            return $page_title;
        } else {
            // Multiple events page
            $page_title = get_option('dbem_events_page_title');
            return $page_title;
        }
    } else {
        return $data;
    }
}
Esempio n. 4
0
function dbem_single_location_map($location)
{
    $gmap_is_active = get_option('dbem_gmap_is_active');
    $map_text = addslashes(dbem_replace_locations_placeholders(get_option('dbem_location_baloon_format'), $location));
    if ($gmap_is_active) {
        $gmaps_key = get_option('dbem_gmap_key');
        $map_div = "<div id='dbem-location-map' style=' background: green; width: 400px; height: 300px'></div>";
        $map_div .= "<script type='text/javascript'>\n  \t\t\t<!--// \n  \t\tlatitude = parseFloat('" . $location['location_latitude'] . "');\n  \t\tlongitude = parseFloat('" . $location['location_longitude'] . "');\n  \t\tGMapsKey = '{$gmaps_key}';\n  \t\tmap_text = '{$map_text}';\n\t\t//-->\n\t\t</script>";
        $map_div .= "<script src='" . get_bloginfo('url') . "/wp-content/plugins/events-manager/dbem_single_location_map.js' type='text/javascript'></script>";
    } else {
        $map_div = "";
    }
    return $map_div;
}