public static function register()
 {
     TMM_Event::init();
     //TMM_GoogleCalendar::init();
     $args = array('labels' => array('name' => __('Events', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'singular_name' => __('Event', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'add_new' => __('Add New', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'add_new_item' => __('Add New Event', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'edit_item' => __('Edit Event', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'new_item' => __('New Event', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'view_item' => __('View Event', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'search_items' => __('Search In Events', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'not_found' => __('Nothing found', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'not_found_in_trash' => __('Nothing found in Trash', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'parent_item_colon' => ''), 'public' => true, 'archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => true, 'menu_position' => null, 'supports' => array('title', 'editor', 'thumbnail', 'excerpt', 'tags', 'comments'), 'rewrite' => array('slug' => 'event'), 'show_in_admin_bar' => true, 'taxonomies' => array('events-categories'), 'menu_icon' => 'dashicons-calendar');
     register_post_type('event', $args);
     //*** taxonomies ****
     register_taxonomy("events-categories", array("event"), array("hierarchical" => true, "labels" => array('name' => __('Events Categories', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'singular_name' => __('Event category', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'add_new' => __('Add New', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'add_new_item' => __('Add New Event category', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'edit_item' => __('Edit Event category', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'new_item' => __('New Event category', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'view_item' => __('View Event category', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'search_items' => __('Search Events categories', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'not_found' => __('No Events categories found', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'not_found_in_trash' => __('No Events categories found in Trash', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'parent_item_colon' => ''), "singular_label" => __("Events", TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'public' => true, "show_tagcloud" => true, 'query_var' => true, "rewrite" => true, 'show_in_nav_menus' => true, 'capabilities' => array('manage_terms'), 'show_ui' => true));
     add_filter("manage_event_posts_columns", array('TMM_Event', "show_edit_columns"));
     add_action("manage_event_posts_custom_column", array('TMM_Event', "show_edit_columns_content"));
     //***
     add_filter("manage_edit-event_sortable_columns", array('TMM_Event', "event_sortable_columns"));
     add_action('pre_get_posts', array('TMM_Event', "event_column_orderby"));
     if (class_exists('TMM')) {
         $events_set_old_ev_to_draft = TMM::get_option("events_set_old_ev_to_draft");
         if ($events_set_old_ev_to_draft) {
             //set crone
             add_action('old_events_shedules', array(__CLASS__, 'old_events_shedules'));
             if (!wp_next_scheduled('old_events_shedules')) {
                 wp_schedule_event(time(), 'hourly', 'old_events_shedules');
             }
         } else {
             wp_clear_scheduled_hook('old_events_shedules');
         }
     }
 }
                    </div><!--/ #event_timer-->	

                </div><!--/ .event-holder-->

                <script type="text/javascript">
                    var countdown_<?php 
            echo $inique_id;
            ?>
 = null;
                    jQuery(function() {       
                        countdown_<?php 
            echo $inique_id;
            ?>
 = new THEMEMAKERS_EVENT_COUNTDOWN(<?php 
            echo strtotime(TMM_Event::convert_time_to_zone_time($event['start']), $now);
            ?>
, "#event_timer_<?php 
            echo $inique_id;
            ?>
");
                        countdown_<?php 
            echo $inique_id;
            ?>
.init();
                    });
                </script>

            </div><!--/ .widget-->

        <?php 
        $event_date = TMM_Event::get_event_date($ev_mktime);
        $ev_end_mktime = (int) get_post_meta($post->ID, 'ev_end_mktime', true);
        $event_end_date = TMM_Event::get_event_date($ev_end_mktime);
        $repeats_every = get_post_meta($post->ID, 'event_repeating', true);
        $events_show_duration = TMM::get_option('events_show_duration');
        if ($events_show_duration) {
            $event_duration_sec = TMM_Event::get_event_duration($ev_mktime, $ev_end_mktime);
            $duration_hh = $event_duration_sec[0];
            $duration_mm = $event_duration_sec[1];
        }
        if ($event_allday == 1) {
            $event_start_time = '';
            $event_end_time = '';
        } else {
            $event_start_time = TMM_Event::get_event_time($ev_mktime);
            $event_end_time = TMM_Event::get_event_time($ev_end_mktime);
        }
        $e_category = get_the_term_list($post->ID, 'events-categories', '', ', ', '');
        ?>

			<div class="event-details">
				<div class="event-start">
					<strong><?php 
        _e('Start', TMM_EVENTS_PLUGIN_TEXTDOMAIN);
        ?>
</strong>
					<span><?php 
        echo $event_date . ' ' . $event_start_time;
        ?>
</span>
				</div>
?>
<div class="widget widget_upcoming_events">


	<?php 
$start = current_time('timestamp');
if (isset($delay)) {
    $start = $start - $delay * 3600;
} else {
    $delay = 0;
}
$category_obj = get_term_by('id', (int) $category, 'events-categories');
if ($category && $category_obj) {
    $category = $category_obj->term_taxonomy_id;
}
$data = TMM_Event::get_soonest_event($start, $count, $deep, $category, $delay);
if ($sorting == 'DESC') {
    $data = array_reverse($data);
}
?>

    <ul class="clearfix">
        <?php 
if (!empty($data)) {
    ?>
            <?php 
    foreach ($data as $event) {
        ?>
                <li>
                    <div class="post-content">
						<h5 class="title">
Ejemplo n.º 5
0
?>
 = null;
    jQuery(function() {
        var arguments = {
            header: {
                left: "prev,next today",
                center: "title",
                right: "month,agendaWeek,agendaDay"
            },
			first_day:<?php 
echo get_option('start_of_week');
?>
        };
        calendar_<?php 
echo $inique_id;
?>
 = new THEMEMAKERS_EVENT_CALENDAR("#calendar_<?php 
echo $inique_id;
?>
", arguments, false, "<?php 
echo TMM_Event::get_timezone_string();
?>
");
        calendar_<?php 
echo $inique_id;
?>
.init();
        
    });
</script>
<div class="widget widget_upcoming_events">

    <?php 
if (!empty($instance['title'])) {
    ?>
        <h3 class="widget-title"><?php 
    echo $instance['title'];
    ?>
</h3>
    <?php 
}
?>

    <?php 
$data = TMM_Event::get_soonest_event(current_time('timestamp'), (int) $instance['count'], (int) $instance['month_deep']);
?>

    <ul class="clearfix">
        <?php 
if (!empty($data)) {
    ?>
            <?php 
    foreach ($data as $event) {
        ?>
                <li>
                    <div class="post-content">
                        <a class="post-title" href="<?php 
        echo $event['url'];
        ?>
"><?php 
        echo $event['title'];
Ejemplo n.º 7
0
 public static function get_event_time($timestamp, $hide_time_zone = false)
 {
     $time = '';
     $time_format = '';
     if ($timestamp) {
         if (TMM::get_option('events_time_format') === '1') {
             $time_format = 'h:i A';
         } else {
             $time_format = 'H:i';
         }
         $time = date($time_format, $timestamp);
         if (TMM::get_option('events_hide_time_zone') === '0' && !$hide_time_zone) {
             $time .= ' ' . TMM_Event::get_timezone_string();
         }
     }
     return $time;
 }