function eab_calendar_recurring_cb($args)
 {
     $args = shortcode_atts(array('id' => false, 'network' => false, 'date' => false, 'relative_date' => false, 'category' => false, 'categories' => false, 'footer' => false, 'class' => 'eab-shortcode_calendar', 'navigation' => false, 'title_format' => 'M Y', 'short_title_format' => 'm-Y', 'long_date_format' => false, 'template' => 'get_shortcode_calendar_output', 'override_styles' => false, 'override_scripts' => false, 'with_thumbnail' => false, 'default_thumbnail' => false, 'show_excerpt' => false, 'excerpt_length' => 55), $args, 'eab_recurring');
     if (!empty($_GET['date'])) {
         $date = strtotime($_GET['date']);
         if ($date) {
             $args['date'] = $date;
         }
     }
     if ($args['id']) {
         $event = new Eab_EventModel(get_post($args['id']));
     } else {
         $q = new WP_Query(array('post_type' => Eab_EventModel::POST_TYPE, 'name' => $args['slug'], 'posts_per_page' => 1));
         if (isset($q->posts[0])) {
             $event = new Eab_EventModel($q->posts[0]);
         }
     }
     if (!$event) {
         return $content;
     }
     $rec_events = Eab_CollectionFactory::get_all_recurring_children_events($event);
     $output = $this->get_shortcode_calendar_output($rec_events, $args);
     $output = $output ? $output : $content;
     if (!$args['override_styles']) {
         wp_enqueue_style('eab_calendar_shortcode', eab_call_template('util_get_default_template_style', 'calendar'));
     }
     return $output;
 }
 private function _add_shortcodes_contextual_help($screen_id)
 {
     $help = apply_filters('eab-shortcodes-shortcode_help', array());
     $out = '';
     foreach ($help as $shortcode) {
         $out .= '<div><h5>' . $shortcode['title'] . '</h5>';
         $out .= '<div>';
         $out .= '		<strong>' . __('Tag:', Eab_EventsHub::TEXT_DOMAIN) . '</strong> <code>[' . $shortcode['tag'] . ']</code>';
         if (!empty($shortcode['note'])) {
             $out .= '<div><em>' . $shortcode['note'] . '</em></div>';
         }
         $out .= '	</div>';
         if (!empty($shortcode['arguments'])) {
             $out .= ' <div class="eab-shortcode_help-argument"><strong>' . __('Arguments:', Eab_EventsHub::TEXT_DOMAIN) . '</strong>';
             foreach ($shortcode['arguments'] as $argument => $data) {
                 if (!empty($shortcode['advanced_arguments'])) {
                     if (in_array($argument, $shortcode['advanced_arguments'])) {
                         continue;
                     }
                 }
                 $type = !empty($data['type']) ? eab_call_template('util_shortcode_argument_type_string', $data['type'], $argument, $shortcode['tag']) : false;
                 $out .= "<div class='eab-shortcode-attribute_item'><code>{$argument}</code> - {$type} {$data['help']}</div>";
             }
             $out .= '</div><!-- argument -->';
         }
         $out .= '</div>';
     }
     $this->_help->add_page($screen_id, array(array('id' => 'eab_shortcodes', 'title' => __('Events shortcodes', Eab_EventsHub::TEXT_DOMAIN), 'content' => $out)));
 }
 function eab_recurring_cb($args)
 {
     $args = shortcode_atts(array('id' => false, 'slug' => false, 'class' => false, 'template' => 'get_shortcode_recurring_output', 'override_styles' => false, 'override_scripts' => false), $args, 'eab_recurring');
     $event = false;
     if ($args['id']) {
         $event = new Eab_EventModel(get_post($args['id']));
     } else {
         $q = new WP_Query(array('post_type' => Eab_EventModel::POST_TYPE, 'name' => $args['slug'], 'posts_per_page' => 1));
         if (isset($q->posts[0])) {
             $event = new Eab_EventModel($q->posts[0]);
         }
     }
     if (!$event) {
         return $content;
     }
     $rec_events = Eab_CollectionFactory::get_all_recurring_children_events($event);
     $out = '<section class="eab-events-archive ' . $args['class'] . '">';
     foreach ($rec_events as $event) {
         $event = $event instanceof Eab_EventModel ? $event : new Eab_EventModel($event);
         $out .= '<article class="eab-event ' . eab_call_template('get_status_class', $event) . '" id="eab-event-' . $event->get_id() . '">' . '<h4>' . $event->get_title() . '</h4>' . '<div class="eab-event-body">' . $this->get_recurring_content($event) . '</div>' . '</article>';
     }
     $out .= '</section>';
     $output = $out ? $out : $content;
     if (!$args['override_styles']) {
         wp_enqueue_style('eab_front');
     }
     if (!$args['override_scripts']) {
         wp_enqueue_script('eab_event_js');
         do_action('eab-javascript-do_enqueue_api_scripts');
     }
     return $output;
 }
 function widget($args, $instance)
 {
     global $wpdb, $current_site, $post, $wiki_tree;
     extract($args);
     $instance = apply_filters('eab-widgets-upcoming-instance_read', $instance, $this);
     $options = wp_parse_args((array) $instance, $this->_defaults);
     $title = apply_filters('widget_title', empty($instance['title']) ? __('Upcoming', $this->translation_domain) : $instance['title'], $instance, $this->id_base);
     $query_args = array('posts_per_page' => $options['limit']);
     if ($options['category']) {
         $query_args['tax_query'] = array(array('taxonomy' => 'eab_events_category', 'field' => 'id', 'terms' => (int) $options['category']));
     }
     if ($options['lookahead'] && is_numeric($options['lookahead'])) {
         $lookahead_func = create_function('', 'return ' . $options['lookahead'] . ';');
         add_filter('eab-collection-upcoming_weeks-week_number', $lookahead_func);
     }
     $_events = Eab_CollectionFactory::get_upcoming_weeks_events(eab_current_time(), $query_args);
     if (!empty($lookahead_func)) {
         remove_filter('eab-collection-upcoming_weeks-week_number', $lookahead_func);
     }
     if (is_array($_events) && count($_events) > 0) {
         echo $before_widget;
         echo $before_title . $title . $after_title;
         echo '<div id="event-popular"><ul>';
         foreach ($_events as $_event) {
             $thumbnail = $excerpt = false;
             if ($options['thumbnail']) {
                 $raw = wp_get_attachment_image_src(get_post_thumbnail_id($_event->get_id()));
                 $thumbnail = $raw ? @$raw[0] : false;
             }
             $excerpt = false;
             if (!empty($options['excerpt'])) {
                 $words = (int) $options['excerpt_words_limit'] ? (int) $options['excerpt_words_limit'] : false;
                 $excerpt = eab_call_template('util_words_limit', $_event->get_excerpt_or_fallback(), $words);
             }
             echo '<li>';
             echo '<a href="' . get_permalink($_event->get_id()) . '" class="' . ($_event->get_id() == $post->ID ? 'current' : '') . '" >' . ($options['thumbnail'] && $thumbnail ? '<img src="' . $thumbnail . '" /><br />' : '') . $_event->get_title() . '</a>';
             if (!empty($options['dates'])) {
                 echo '<div class="wpmudevevents-date">' . Eab_Template::get_event_dates($_event) . '</div>';
             }
             if (!empty($options['excerpt']) && !empty($excerpt)) {
                 echo '<p>' . $excerpt . '</p>';
             }
             do_action('eab-widgets-upcoming-after_event', $options, $_event, $this);
             echo '</li>';
         }
         echo '</ul></div>';
         echo $after_widget;
     } else {
         echo $before_widget . $before_title . $title . $after_title . '<p class="eab-widget-no_events">' . __('No upcoming events.', Eab_EventsHub::TEXT_DOMAIN) . '</p>' . $after_widget;
     }
 }
    function render()
    {
        // Filter the help....
        $help = apply_filters('eab-shortcodes-shortcode_help', array());
        if (!class_exists('WpmuDev_HelpTooltips')) {
            require_once eab_plugin_dir() . 'lib/class_wd_help_tooltips.php';
        }
        $tips = new WpmuDev_HelpTooltips();
        $tips->set_icon_url(plugins_url('events-and-bookings/img/information.png'));
        $out = '';
        $count = 0;
        $half = (int) (count($help) / 2);
        $out .= '<div class="postbox-container">';
        foreach ($help as $shortcode) {
            $out .= '<div class="eab-metabox postbox"><h3 class="eab-hndle">' . $shortcode['title'] . '</h3>';
            $out .= '<div class="eab-inside">';
            $out .= '	<div class="eab-settings-settings_item">';
            $out .= '		<strong>' . __('Tag:', eab_domain()) . '</strong> <code>[' . $shortcode['tag'] . ']</code>';
            if (!empty($shortcode['note'])) {
                $out .= '<div class="eab-note">' . $shortcode['note'] . '</div>';
            }
            $out .= '	</div>';
            if (!empty($shortcode['arguments'])) {
                $out .= ' <div class="eab-settings-settings_item" style="line-height:1.5em"><strong>' . __('Arguments:', eab_domain()) . '</strong>';
                foreach ($shortcode['arguments'] as $argument => $data) {
                    if (!empty($shortcode['advanced_arguments']) && !current_user_can('manage_options')) {
                        if (in_array($argument, $shortcode['advanced_arguments'])) {
                            continue;
                        }
                    }
                    $type = !empty($data['type']) ? eab_call_template('util_shortcode_argument_type_string_info', $data['type'], $argument, $shortcode['tag'], $tips) : false;
                    $out .= "<div class='eab-shortcode-attribute_item'><code>{$argument}</code> - {$data['help']} {$type}</div>";
                }
                $out .= '</div><!-- Attributes -->';
            }
            $out .= '</div></div>';
            $count++;
            if ($count == $half) {
                $out .= '</div><div class="postbox-container eab-postbox_container-last">';
            }
        }
        $out .= '</div>';
        echo '<div class="wrap">
				<h1>' . __('Events Shortcodes', eab_domain()) . '</h1>
				<div class="eab-metaboxcol metabox-holder eab-metaboxcol-one eab-metaboxcol-center columns-2">';
        echo $out;
        echo '</div></div>';
    }
 public static function util_apply_shortcode_template($events, $args)
 {
     $output = false;
     // Check template output
     if (eab_has_template_method($args['template'])) {
         // Template class method call
         $output = eab_call_template($args['template'], $events, $args);
     } else {
         // Template file
         $template = eab_call_template('util_locate_template', $args['template']);
         if ($template) {
             ob_start();
             include $template;
             $output = ob_get_clean();
         }
     }
     return $output;
 }
<?php

$class_pfx = !empty($args['class']) ? $args['class'] : 'eab-events_map';
$content = '';
if ($args['show_date']) {
    $content .= eab_call_template('get_event_dates', $events);
}
if ($args['show_excerpt']) {
    $content .= '<div class="eab-event-excerpt">' . $events->get_excerpt_or_fallback($args['excerpt_length']) . '</div>';
}
?>
<div class='<?php 
echo $class_pfx;
?>
-venue'>
	<a href="<?php 
echo get_permalink($events->get_id());
?>
">
		<?php 
echo $events->get_venue_location();
?>
	</a>
</div><div class='<?php 
echo $class_pfx;
?>
-dates'>
	<?php 
echo $content;
?>
</div>
 /**
  * Archive shortcode handler.
  */
 function process_archive_shortcode($args = array(), $content = false)
 {
     $args = $this->_preparse_arguments($args, array('network' => false, 'date' => false, 'relative_date' => false, 'lookahead' => false, 'weeks' => false, 'category' => false, 'categories' => false, 'limit' => false, 'order' => false, 'paged' => false, 'page' => 1, 'class' => false, 'template' => 'get_shortcode_archive_output', 'override_styles' => false, 'override_scripts' => false));
     if ($args['paged']) {
         $requested_page = get_query_var('page');
         $requested_page = $requested_page ? $requested_page : get_query_var('paged');
         $args['page'] = $requested_page ? $requested_page : $args['page'];
     }
     $events = array();
     if (is_multisite() && $args['network']) {
         $events = Eab_Network::get_upcoming_events(30);
     } else {
         $query = $this->_to_query_args($args);
         $order_method = $args['order'] ? create_function('', 'return "' . $args['order'] . '";') : false;
         if ($order_method) {
             add_filter('eab-collection-date_ordering_direction', $order_method);
         }
         // Lookahead - depending on presence, use regular upcoming query, or poll week count
         if ($args['lookahead']) {
             $method = $args['weeks'] ? create_function('', 'return ' . $args['weeks'] . ';') : false;
             if ($method) {
                 add_filter('eab-collection-upcoming_weeks-week_number', $method);
             }
             $events = Eab_CollectionFactory::get_upcoming_weeks_events($args['date'], $query);
             if ($method) {
                 remove_filter('eab-collection-upcoming_weeks-week_number', $method);
             }
         } else {
             // No lookahead, get the full month only
             $events = Eab_CollectionFactory::get_upcoming_events($args['date'], $query);
         }
         if ($order_method) {
             remove_filter('eab-collection-date_ordering_direction', $order_method);
         }
     }
     $output = Eab_Template::util_apply_shortcode_template($events, $args);
     if ($output) {
         if ($args['paged'] && !(is_multisite() && $args['network'])) {
             if ($method) {
                 add_filter('eab-collection-upcoming_weeks-week_number', $method);
             }
             $events_query = $args['lookahead'] ? Eab_CollectionFactory::get_upcoming_weeks($args['date'], $query) : Eab_CollectionFactory::get_upcoming($args['date'], $query);
             if ($method) {
                 remove_filter('eab-collection-upcoming_weeks-week_number', $method);
             }
             $output .= eab_call_template('get_shortcode_paging', $events_query, $args);
         }
     } else {
         $output = $content;
     }
     if (!$args['override_styles']) {
         wp_enqueue_style('eab_front');
     }
     if (!$args['override_scripts']) {
         wp_enqueue_script('eab_event_js');
         do_action('eab-javascript-do_enqueue_api_scripts');
     }
     return $output;
 }
 private function _get_default_content($event)
 {
     $network = $event->from_network();
     $link = $network ? get_blog_permalink($network, $event->get_id()) : get_permalink($event->get_id());
     $content = eab_call_template('get_event_dates', $event) . '<div class="eab-event-excerpt">' . $event->get_excerpt_or_fallback(256) . '</div>' . "<a href='{$link}'>" . $event->get_title() . '</a>' . '';
     return apply_filters('eab-email-newsletter-default_content', $content, $event);
 }
 public function get_excerpt_or_fallback($final_length = false, $default_suffix = '... ')
 {
     $excerpt = $this->get_excerpt();
     $excerpt = $excerpt ? $excerpt : $this->get_content();
     $excerpt = str_replace(array("\r\n", "\r", "\n"), " ", wp_strip_all_tags(strip_shortcodes($excerpt)));
     // Strip shortcodes, tags and newlines
     if (!function_exists('eab_call_template')) {
         return $excerpt;
     }
     $suffix = false;
     $length = eab_call_template('util_strlen', $excerpt);
     if ($final_length && $length > $final_length) {
         $length = $final_length;
         $suffix = $default_suffix;
         if (!preg_match('/...\\s*$/', $excerpt)) {
             $excerpt = preg_replace('/\\s*...\\s*$/', '', $excerpt);
             $length -= strlen($suffix);
         }
     }
     $excerpt = eab_call_template('util_safe_substr', $excerpt, 0, $length);
     return "{$excerpt}{$suffix}";
 }
    function widget($args, $instance)
    {
        global $wpdb, $current_site, $post, $wiki_tree;
        extract($args);
        $instance = apply_filters('eab-widgets-popular-instance_read', $instance, $this);
        $options = wp_parse_args((array) $instance, $this->_defaults);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Most Popular', $this->translation_domain) : $instance['title'], $instance, $this->id_base);
        $_events = Eab_CollectionFactory::get_popular_events(array('posts_per_page' => $options['limit']));
        if (is_array($_events) && count($_events) > 0) {
            ?>
		<?php 
            echo $before_widget;
            ?>
		<?php 
            echo $before_title . $title . $after_title;
            ?>
	            <div id="event-popular">
			<ul>
			    <?php 
            foreach ($_events as $_event) {
                $thumbnail = $excerpt = false;
                if ($options['thumbnail']) {
                    $raw = wp_get_attachment_image_src(get_post_thumbnail_id($_event->get_id()));
                    $thumbnail = $raw ? @$raw[0] : false;
                }
                $excerpt = false;
                if ($options['excerpt']) {
                    $words = (int) $options['excerpt_words_limit'] ? (int) $options['excerpt_words_limit'] : false;
                    $excerpt = eab_call_template('util_words_limit', $_event->get_excerpt_or_fallback(), $words);
                }
                ?>
				<li>
					<a href="<?php 
                print get_permalink($_event->get_id());
                ?>
" class="<?php 
                print $_event->get_id() == $post->ID ? 'current' : '';
                ?>
" >
						<?php 
                if ($options['thumbnail'] && $thumbnail) {
                    ?>
							<img src="<?php 
                    echo $thumbnail;
                    ?>
" /><br />
						<?php 
                }
                ?>
						<?php 
                print $_event->get_title();
                ?>
					</a>
					<?php 
                if ($options['excerpt'] && $excerpt) {
                    ?>
						<p><?php 
                    echo $excerpt;
                    ?>
</p>
					<?php 
                }
                ?>
					<?php 
                do_action('eab-widgets-popular-after_event', $options, $_event, $this);
                ?>
				</li>
			    <?php 
            }
            ?>
			</ul>
	            </div>
	        <br />
	        <?php 
            echo $after_widget;
            ?>
		<?php 
        } else {
            echo $before_widget . $before_title . $title . $after_title . '<p class="eab-widget-no_events">' . __('No popular events.', Eab_EventsHub::TEXT_DOMAIN) . '</p>' . $after_widget;
        }
    }
 public function replace_event_host()
 {
     return wp_strip_all_tags(eab_call_template('get_event_author_link', $this->_event));
 }
 function eab_to_feed__add_feed_event_dates($content)
 {
     global $post;
     if (empty($post->post_type) || Eab_EventModel::POST_TYPE != $post->post_type) {
         return $content;
     }
     return $content . '<br />' . eab_call_template('get_event_dates', $post);
 }
 function process_group_archives_shortcode($args = array(), $content = false)
 {
     $args = $this->_preparse_arguments($args, array('date' => false, 'lookahead' => false, 'weeks' => false, 'category' => false, 'limit' => false, 'order' => false, 'groups' => false, 'user' => false, 'class' => 'eab-group_events', 'template' => 'get_shortcode_archive_output', 'override_styles' => false, 'override_scripts' => false));
     if (is_numeric($args['user'])) {
         $args['user'] = $this->_arg_to_int($args['user']);
     } else {
         if ('current' == trim($args['user'])) {
             $user = wp_get_current_user();
             $args['user'] = $user->ID;
         } else {
             $args['user'] = false;
         }
     }
     if (is_numeric($args['groups'])) {
         // Single group ID
         $args['groups'] = $this->_arg_to_int($args['groups']);
     } else {
         if (strstr($args['groups'], ',')) {
             // Comma-separated list of group IDs
             $ids = array_map('intval', array_map('trim', explode(',', $args['groups'])));
             if (!empty($ids)) {
                 $args['groups'] = $ids;
             }
         } else {
             // Keyword
             if (in_array(trim($args['groups']), array('my', 'my-groups', 'my_groups')) && $args['user']) {
                 if (!function_exists('groups_get_groups')) {
                     return $content;
                 }
                 $groups = groups_get_groups(array('user_id' => $args['user']));
                 $args['groups'] = array_map('intval', wp_list_pluck($groups['groups'], 'id'));
             } else {
                 if ('all' == trim($args['groups'])) {
                     if (!function_exists('groups_get_groups')) {
                         return $content;
                     }
                     $groups = groups_get_groups();
                     $args['groups'] = array_map('intval', wp_list_pluck($groups['groups'], 'id'));
                 } else {
                     $args['groups'] = false;
                 }
             }
         }
     }
     if (!$args['groups']) {
         return $content;
     }
     $events = array();
     $query = $this->_to_query_args($args);
     $query['meta_query'][] = array('key' => 'eab_event-bp-group_event', 'value' => $args['groups'], 'compare' => is_array($args['groups']) ? 'IN' : '=');
     $order_method = $args['order'] ? create_function('', 'return "' . $args['order'] . '";') : false;
     if ($order_method) {
         add_filter('eab-collection-date_ordering_direction', $order_method);
     }
     // Lookahead - depending on presence, use regular upcoming query, or poll week count
     if ($args['lookahead']) {
         $method = $args['weeks'] ? create_function('', 'return ' . $args['weeks'] . ';') : false;
         if ($method) {
             add_filter('eab-collection-upcoming_weeks-week_number', $method);
         }
         $collection = new Eab_BuddyPress_GroupEventsWeeksCollection($args['groups'], $args['date'], $query);
         if ($method) {
             remove_filter('eab-collection-upcoming_weeks-week_number', $method);
         }
     } else {
         // No lookahead, get the full month only
         $collection = new Eab_BuddyPress_GroupEventsCollection($args['groups'], $args['date'], $query);
     }
     if ($order_method) {
         remove_filter('eab-collection-date_ordering_direction', $order_method);
     }
     $events = $collection->to_collection();
     $output = eab_call_template('util_apply_shortcode_template', $events, $args);
     $output = $output ? $output : $content;
     if (!$args['override_styles']) {
         wp_enqueue_style('eab_front');
     }
     if (!$args['override_scripts']) {
         wp_enqueue_script('eab_event_js');
     }
     return $output;
 }
<section class="eab-events-archive <?php 
esc_attr_e($args['class']);
?>
">
<?php 
foreach ($events as $event) {
    ?>
	<?php 
    $event = $event instanceof Eab_EventModel ? $event : new Eab_EventModel($event);
    ?>
	<article class="eab-event <?php 
    echo eab_call_template('get_status_class', $event);
    ?>
" id="eab-event-<?php 
    echo $event->get_id();
    ?>
">
		<h4><?php 
    echo $event->get_title();
    ?>
</h4>
		<div class="eab-event-body">
			<?php 
    echo eab_call_template('get_archive_content', $event);
    ?>
		</div>
	</article>
<?php 
}
?>
</section>
<div class="eab-event <?php 
esc_attr_e($args['class']);
?>
">
	<h4><?php 
echo $events->get_title();
?>
</h4>
	<div class="eab-event-body">
		<?php 
echo eab_call_template('get_single_content', $events);
?>
	</div>
</div>