function amr_make_excerpt_from_description($e)
{
    if (empty($e['excerpt'])) {
        if (!empty($e['DESCRIPTION'])) {
            // must be abn ics file
            $desc = amr_just_flatten_array($e['DESCRIPTION']);
        } else {
            if (!empty($e['CONTENT'])) {
                // must be abn ics file
                $desc = strip_shortcodes(amr_just_flatten_array($e['CONTENT']));
            } else {
                $desc = '';
            }
        }
        $length = apply_filters('excerpt_length', 55);
        // in case a filter returns garbage;
        if (!is_int($length)) {
            $length = 55;
        }
        $excerpt = substr($desc, 0, $length) . '...';
        return $excerpt;
    } else {
        return $e['excerpt'];
    }
}
Exemple #2
0
 function add_event_to_google($e)
 {
     global $amr_options;
     if (!isset($e['EventDate'])) {
         return '';
     }
     if (isset($e['LOCATION'])) {
         $l = '&location=' . esc_html(strip_tags(str_replace(' ', '%20', $e['LOCATION'])));
     } else {
         $l = '';
     }
     if (!isset($e['SUMMARY'])) {
         $e['SUMMARY'] = '';
     }
     if (!isset($e['DESCRIPTION'])) {
         $e['DESCRIPTION'] = '';
     }
     $t = __("Add event to google", 'amr-ical-events-list');
     if (isset($amr_options['no_images']) and $amr_options['no_images']) {
         $t2 = $t;
     } else {
         $t2 = '<img src="' . IMAGES_LOCATION . ADDTOGOOGLEIMAGE . '" alt="' . $t . '" class="amr-bling"/>';
     }
     $details = amr_just_flatten_array($e['DESCRIPTION']);
     //var_dump($details);
     if (!empty($details)) {
         $details = '&amp;details=' . rawurlencode(strip_tags($details));
     }
     /* adds a button to add the current calendar link to the users google calendar */
     $html = '<a class= "amr-bling hrefaddtogoogle" href="http://www.google.com/calendar/event?action=TEMPLATE' . '&amp;text=' . str_replace(' ', '%20', esc_html(strip_tags(amr_just_flatten_array($e['SUMMARY'])))) . '&amp;dates=' . amr_get_googleeventdate($e) . $l . '&amp;trp=false' . $details . '" target="_blank" title="' . $t . '" >' . $t2 . '</a>';
     return $html;
     /* Note google only allows simple html*/
 }