public function build_week()
        {
            global $wtd_connector, $wtd_plugin;
            $data = $wtd_connector->decrypt_parse_response($_POST['data']);
            ob_start();
            if (!empty($data)) {
                $i = 0;
                $day = null;
                $events = $data;
                foreach ($events as $key => $event) {
                    $addresses = $event->addresses;
                    $vendor = $event->vendor;
                    $event_url = site_url() . '/' . $wtd_plugin['url_prefix'] . '/special/' . $event->id . '/' . sanitize_title($event->name);
                    $event_day = new DateTime('@' . strtotime($event->date));
                    if ($event_day != $day) {
                        $day = new DateTime('@' . strtotime($event->date));
                        ?>
						<span><?php 
                        echo $day->format('m/d/Y');
                        ?>
</span><?php 
                    }
                    ?>
					<div class="wtd_event_container md-whiteframe-z2" style="padding: 10px;">
						<div class="wtd_listing_sc_top_content"><?php 
                    $title = $event->name;
                    ?>
							<p class="wtd_listing_title_bar">
								<a href="<?php 
                    echo $event_url;
                    ?>
"><?php 
                    echo $title . ' - ' . $vendor;
                    ?>
</a>
							</p>
							<div layout="row">
								<a href="<?php 
                    echo $event_url;
                    ?>
">
									<img class="wtd_event_image" layout-margin src="<?php 
                    echo $event->image;
                    ?>
" alt="<?php 
                    echo $title;
                    ?>
"/>
								</a>
								<div flex layout="column">
									<div class="wtd_excerpt"><?php 
                    $desc = $event->description;
                    wtd_excerpt_generator($desc, false, $event_url);
                    ?>
									</div><?php 
                    if (!empty($vendor)) {
                        ?>
										<div>Special Hosted by: <?php 
                        echo $vendor;
                        ?>
</div><?php 
                    }
                    ?>
									<div class="wtd_week_date"><?php 
                    $time = strtotime($event->date);
                    echo date('D, F d, Y', $time);
                    ?>
									</div><?php 
                    if ($event->startTime != "00:00:00" && $event->startTime != "23:59:59" && !empty($event->startTime)) {
                        ?>
										<div class="wtd_week_date"><?php 
                        $start = new DateTime(date('Y-m-d ' . $event->startTime));
                        ?>
											Start Time: <?php 
                        echo $start->format('g:i a');
                        ?>
										</div><?php 
                    }
                    ?>
									<div class="result_address"><?php 
                    if (!empty($addresses)) {
                        if (count($addresses) == 1) {
                            $address = $addresses[0];
                            $display_address = '';
                            $street = $address->address;
                            if (!empty($street)) {
                                $display_address .= $street;
                            }
                            $city = $address->city;
                            if (!empty($city)) {
                                if (!$display_address) {
                                    $display_address .= $city;
                                } else {
                                    $display_address .= ' in ' . $city;
                                }
                            }
                            $state = $address->state;
                            if (!empty($state)) {
                                if (empty($display_address)) {
                                    $display_address .= $state;
                                } else {
                                    $display_address .= ', ' . $state;
                                }
                            }
                            $phone = $address->phone;
                            if (!empty($phone)) {
                                $display_address .= " (" . substr($phone, 0, 3) . ") " . substr($phone, 3, 3) . "-" . substr($phone, 6);
                            } else {
                                $display_address .= '';
                            }
                        } else {
                            $cities = array();
                            foreach ($addresses as $address) {
                                if (!in_array($address->city, $cities)) {
                                    $cities[] = $address->city;
                                }
                            }
                            $display_address = 'Various Locations in ' . implode(', ', $cities);
                        }
                        echo '<div>' . $display_address . '</div>';
                    }
                    ?>
									</div>
								</div>
							</div>
						</div>
					</div><?php 
                    $i++;
                }
            } else {
                ?>
				No events available.<?php 
            }
            die(ob_get_clean());
        }
 public function build_list()
 {
     global $wtd_connector, $wtd_plugin;
     $data = $wtd_connector->decrypt_parse_response($_POST['data']);
     ob_start();
     if (!empty($data)) {
         $dining = $data;
         foreach ($dining as $key => $dining) {
             if (!empty($dining->addresses)) {
                 $addresses = $dining->addresses;
             }
             if (!empty($dining->vendor)) {
                 $vendor = $dining->vendor;
             }
             $dining_url = site_url() . '/' . $wtd_plugin['url_prefix'] . '/dining/' . $dining->id . '/' . sanitize_title($dining->title) . '/';
             $desc = strip_tags($dining->description);
             $params = array('title' => $dining->title, 'thumb_url' => $dining->logoUrl, 'details_url' => $dining_url, 'vendor_name' => $dining->vendor, 'type' => $dining->vend_rec_type, 'desc' => wtd_excerpt_generator($desc, false, $dining_url), 'addresses' => $this->get_addresses($dining->addresses));
             echo $this->twig->render('wtd_list_item.twig', $params);
         }
     } else {
         ?>
         No listings of this type are available.<?php 
     }
     if ($_POST['page'] != 1) {
         ?>
         <a href="javascript:void(0)" class="wtd_pull_left" id="wtd_parse_prev">&laquo; Previous</a><?php 
     }
     if (count($data) == 10) {
         ?>
         <a href="javascript:void(0)" class="wtd_pull_right" id="wtd_parse_next">Next &raquo;</a><?php 
     }
     die;
 }