Пример #1
0
}
if (isset($_GET['eventsPage']) && isset($_GET['eventsStart']) && isset($_GET['eventsEnd']) && isset($_GET['eventsFile'])) {
    $icsOptions = WPICSImporter::getAdminOptions();
    $gmt_start = $_GET['eventsStart'];
    $gmt_end = $_GET['eventsEnd'];
    if ($icsOptions['limit_type'] == 'days') {
        $gmt_start += (int) $icsOptions['event_limit'] * 24 * 3600 * (int) $_GET['eventsPage'];
        $gmt_end += (int) $icsOptions['event_limit'] * 24 * 3600 * (int) $_GET['eventsPage'];
        $icsOptions['event_limit'] = 0;
        $start = 0;
    } else {
        $gmt_end = NULL;
        $start = $icsOptions['event_limit'] * (int) $_GET['eventsPage'];
        $icsOptions['event_limit'] = $icsOptions['event_limit'] * ((int) $_GET['eventsPage'] + 1);
    }
    $output = ICalEvents::display_events(unserialize(base64_decode($_GET['eventsFile'])), $gmt_start, $gmt_end, $icsOptions['event_limit'], $start, $_GET['uuid']);
    echo $output;
    exit;
}
if (isset($_GET['downloadEvent'])) {
    $options = get_option(ADMIN_OPTIONS_NAME);
    $calendars = unserialize($options['ics_files']);
    $events = ICalEvents::get_event($calendars[$_GET['calendarID']], $_GET['downloadEvent']);
    header("Content-Type: text/Calendar");
    header("Content-Disposition: inline; filename=calendar-event.ics");
    echo "BEGIN:VCALENDAR\n";
    echo "PRODID:ICS Calendar for Wordpress (fullimpact.net)\n";
    foreach ($events as $event) {
        echo "BEGIN:VEVENT\n";
        echo utf8_decode(implode("\n", $event['raw'])) . "\n";
    }
Пример #2
0
 function placePageCalendar($content)
 {
     // Get the options...
     $icsOptions = $this->getAdminOptions();
     // SET LOCALE FOR EVERY PAGE/EVENT
     if (!empty($icsOptions['date_language'])) {
         $fixed_locales = preg_replace('/ +/', '', $icsOptions['date_language']);
         $locales = explode(',', $fixed_locales);
         if (!setlocale(LC_ALL, $locales)) {
             //return "Locale Error";
             exit;
         }
     }
     // Only do this if this is a page and it has the appropriate custom field
     if (is_page()) {
         $savedLimit = $icsOptions['event_limit'];
         $savedDefault = $icsOptions['ics_file_default'];
         if (isset($_GET['ics-perm'])) {
             $icsArray = unserialize($icsOptions['ics_files']);
             $output = '<a style="float:right;" href="' . preg_replace('/ics-perm=([^&?]*)(&|\\?)?/i', '', $_SERVER['REQUEST_URI']) . '">' . __('Return to Calendar', 'WPICSImporter') . '</a>' . '<br style="clear:both;" />';
             return $output . ICalEvents::display_one_event($icsArray, $_GET['ics-perm']);
         }
         if (preg_match('/\\[' . $this->showEvents . '=?([0-9]*)?( +cal=)?([0-9,]{1,})?\\]/i', $content, $args)) {
             define('ICAL_EVENTS_CACHE_TTL', $icsOptions['cache_time']);
             preg_match_all('/\\[' . $this->showEvents . '=?([0-9]*)?( +cal=)?([0-9,]{1,})?\\]/i', $content, $args);
             foreach ($args[1] as $k => $arg) {
                 $more = '';
                 if (!empty($arg)) {
                     $icsOptions['event_limit'] = $arg;
                     $more .= '=' . $arg;
                 } else {
                     $icsOptions['event_limit'] = $savedLimit;
                 }
                 if (!empty($args[3][$k])) {
                     $icsOptions['ics_file_default'] = $args[3][$k];
                     $more .= ' +cal=' . $args[3][$k];
                 } else {
                     $icsOptions['ics_file_default'] = $savedDefault;
                 }
                 if ($icsOptions['use_custom_format'] == 'true') {
                     $eventsContent = ICalEvents::custom_display_events($icsOptions);
                 } else {
                     if ($icsOptions['gmt_start_now'] == 'true') {
                         $gmt_start = time();
                         $gmt_end = NULL;
                         if ($icsOptions['limit_type'] == 'days') {
                             $gmt_end = time() + (int) $icsOptions['event_limit'] * 24 * 3600;
                             $icsOptions['event_limit'] = 0;
                         }
                     } else {
                         if ($icsOptions['gmt_start'] != '') {
                             $gmt_start = strtotime($icsOptions['gmt_start'], time());
                         }
                         if ($icsOptions['gmt_end'] != '') {
                             $gmt_end = strtotime($icsOptions['gmt_end'], time());
                         }
                     }
                     $icsArray = unserialize($icsOptions['ics_files']);
                     if ($icsOptions['ics_file_default'] == 'combine') {
                         $icsFile = $icsArray;
                     } elseif (strstr($icsOptions['ics_file_default'], ',')) {
                         $cals = explode(',', $icsOptions['ics_file_default']);
                         foreach ($cals as $calid) {
                             $icsFile[] = $icsArray[trim($calid)];
                         }
                     } elseif (!empty($icsArray[$icsOptions['ics_file_default']])) {
                         $icsFile = $icsArray[$icsOptions['ics_file_default']];
                     } else {
                         $icsFile = array_shift($icsArray);
                     }
                     $eventsContent = ICalEvents::display_events($icsFile, $gmt_start, $gmt_end, $icsOptions['event_limit']);
                 }
                 $content = preg_replace('/\\[' . $this->showEvents . $more . '\\]/i', $eventsContent, $content);
             }
         }
         if (preg_match('/\\[' . $this->showCalendar . '( +cal=)?([0-9,]{1,})?\\]/i', $content)) {
             $cssAdd = '<style type="text/css" media="screen">@import "' . (empty($icsOptions['cal_css_file']) ? ICSCALENDAR_URLPATH . 'library/ics-calendar.css' : $icsOptions['cal_css_file']) . '";</style>' . "\n";
             $eventid = '';
             if (!empty($_GET['icsevent'])) {
                 $eventid = $_GET['icsevent'];
             }
             if (!empty($_GET['icsdate'])) {
                 $eventdate = $_GET['icsdate'];
             }
             $icsArray = unserialize($icsOptions['ics_files']);
             preg_match_all('/\\[' . $this->showCalendar . '( +cal=)?([0-9,]{1,})?\\]/i', $content, $finds);
             foreach ($finds[2] as $find) {
                 if (!empty($find)) {
                     $icsOptions['ics_file_default'] = $find;
                     $more = ' +cal=' . $find;
                 } else {
                     $icsOptions['ics_file_default'] = $savedDefault;
                     $more = '';
                 }
                 $calDisplay = $cssAdd . icsCalDisplay::initCalendar($icsOptions, $eventid, $eventdate);
                 $content = preg_replace('/\\[' . $this->showCalendar . $more . '\\]/i', $calDisplay, $content);
             }
         }
     }
     return $content;
 }
Пример #3
0
		<strong>Bill Good Marketing, 12393 Gateway Park Place, Suite 600, Draper, Utah</strong><br /><br />
		
		<a href="http://maps.google.com/maps?f=q&hl=en&geocode=&time=&date=&ttype=&q=12393+Gateway+Park+Pl+Ste+600,+draper,+utah&sll=40.520259,-111.894593&sspn=0.032297,0.037165&ie=UTF8&ll=40.527566,-111.89764&spn=0.064587,0.074329&z=14&iwloc=addr&om=1"><img style="border-top: 1px solid #909090; border-bottom: 1px solid #909090;" src="/wp-content/themes/choke/images/map.jpg" /></a>
		</p>
	
		<h2>calendar</h2>
		<p>The calendar is a aggregate of local user groups, organizations, 
		and group sponsored activities. Subscribe to our feed to have it 
		automatically added to your own calendar. If you do not have a 
		calendar application that can subscribe to feeds, you may use this 
		<a href="/calendar/month.php" target="_blank">web calendar</a> to view the events.</p>
		<p>Are you aware of a PHP or web development related event that's not listed here? Do you 
		or your organization publish a calendar that could be included? Send an email 
		about it to the list or post a note in the channel and we'll add it to the calendar.</p>
		<p><a class="subscribecal" href="webcal://ugaf.org/calendar/calendars/UGAF.ics">subscribe to calendar</a></p>
	
		<h2>events</h2>
		<ul class="nobullets">
			<?php 
//$from = time() - (90 * 24 * 60 * 60); // three months back
//$from = time();
$from = time() - 1 * 24 * 60 * 60;
ICalEvents::display_events('url=http://uphpu.org/calendar/calendars/UPHPU.ics&limit=20&use_description=0&use_location=1&after_date=</strong><br />&date_format=%G %B %e / &time_format=%R&gmt_start=' . $from);
?>
		</ul>

<?php 
get_footer();
?>