Esempio n. 1
0
/**
 * This is a temporary filter function which mimicks the old filters in the old 2.x placeholders function
 * @param string $result
 * @param EM_Event $event
 * @param string $placeholder
 * @param string $target
 * @return mixed
 */
function em_event_output_placeholder($result, $event, $placeholder, $target = 'html')
{
    if ($target == 'raw') {
        return $result;
    }
    if (in_array($placeholder, array("#_EXCERPT", '#_EVENTEXCERPT', "#_LOCATIONEXCERPT")) && $target == 'html') {
        $result = apply_filters('dbem_notes_excerpt', $result);
    } elseif ($placeholder == '#_CONTACTEMAIL' && $target == 'html') {
        $result = em_ascii_encode($event->get_contact()->user_email);
    } elseif (in_array($placeholder, array('#_EVENTNOTES', '#_NOTES', '#_DESCRIPTION', '#_LOCATIONNOTES', '#_CATEGORYNOTES', '#_CATEGORYDESCRIPTION'))) {
        if ($target == 'rss') {
            $result = apply_filters('dbem_notes_rss', $result);
            $result = apply_filters('the_content_rss', $result);
        } elseif ($target == 'map') {
            $result = apply_filters('dbem_notes_map', $result);
        } elseif ($target == 'ical') {
            $result = apply_filters('dbem_notes_ical', $result);
        } elseif ($target == "email") {
            $result = apply_filters('dbem_notes_email', $result);
        } else {
            //html
            $result = apply_filters('dbem_notes', $result);
        }
    } elseif (in_array($placeholder, array("#_NAME", '#_LOCATION', '#_TOWN', '#_ADDRESS', '#_LOCATIONNAME', "#_EVENTNAME", "#_LOCATIONNAME", '#_CATEGORY'))) {
        if ($target == "rss") {
            $result = apply_filters('dbem_general_rss', $result);
        } elseif ($target == "ical") {
            $result = apply_filters('dbem_general_ical', $result);
        } elseif ($target == "email") {
            $result = apply_filters('dbem_general_email', $result);
        } else {
            //html
            $result = apply_filters('dbem_general', $result);
        }
    }
    return $result;
}
Esempio n. 2
0
/**
 * This is a temporary filter function which mimicks the old filters in the old 2.x placeholders function
 * @param string $result
 * @param EM_Event $event
 * @param string $placeholder
 * @param string $target
 * @return mixed
 */
function em_event_output_placeholder($result, $event, $placeholder, $target = 'html')
{
    if (($placeholder == "#_EXCERPT" || $placeholder == "#_LOCATIONEXCERPT") && $target == 'html') {
        $result = apply_filters('dbem_notes_excerpt', $result);
    } elseif ($placeholder == '#_CONTACTEMAIL' && $target == 'html') {
        $result = em_ascii_encode($event->contact->user_email);
    } elseif ($placeholder == "#_NOTES" || $placeholder == "#_EXCERPT" || $placeholder == "#_LOCATIONEXCERPT") {
        if ($target == 'html') {
            $result = apply_filters('dbem_notes', $result);
        } elseif ($target == 'map') {
            $result = apply_filters('dbem_notes_map', $result);
        } else {
            $result = apply_filters('dbem_notes_rss', $result);
            $result = apply_filters('the_content_rss', $result);
        }
    } elseif (in_array($placeholder, array("#_NAME", '#_ADDRESS', '#_LOCATION', '#_TOWN'))) {
        if ($target == "html") {
            $result = apply_filters('dbem_general', $result);
        } else {
            $result = apply_filters('dbem_general_rss', $result);
        }
    }
    return $result;
}