Пример #1
0
            function widgetICSImporterOptions()
            {
                $options = WPICSImporter::getWidgetOptions();
                if ($_POST['icsImporterSubmit']) {
                    $options['widget_event_limit'] = $_POST['icsWidgetEventLimit'];
                    $options['widget_title'] = $_POST['icsWidgetTitle'];
                    $options['date_format'] = $_POST['icsWidgetDateFormat'];
                    $options['time_format'] = $_POST['icsWidgetTimeFormat'];
                    $options['custom_format'] = $_POST['icsCustomFormat'];
                    $options['widget_link'] = $_POST['icsWidgetLink'];
                    $options['hide_time'] = $_POST['icsWidgetHideTime'];
                    $options['gmt_start_now'] = $_POST['icsWidgetGmtStartNow'];
                    $options['show_next_buttons'] = $_POST['icsWidgetShowNextButtons'];
                    update_option('ICSWidgetOptions', $options);
                }
                foreach ($options as $key => $item) {
                    $options[$key] = stripslashes($item);
                }
                ?>
		
				<p>Title: <input type="text" name="icsWidgetTitle" value="<?php 
                echo $options['widget_title'];
                ?>
" id="icsWidgetTitle" /></p>
				<p>Event Limit: <input type="text" name="icsWidgetEventLimit" value="<?php 
                echo $options['widget_event_limit'];
                ?>
" id="icsWidgetEventLimit" /></p>
				<label for="icsWidgetGmtStartNow_checked"><input type="checkbox" id="icsWidgetGmtStartNow_checked" name="icsWidgetGmtStartNow" value="true"<?php 
                if ($options['gmt_start_now'] == "true") {
                    echo ' CHECKED';
                }
                ?>
 /> Show upcoming events only.</label>
				<p>Date Format: <input type="text" name="icsWidgetDateFormat" value="<?php 
                echo $options['date_format'];
                ?>
" id="icsWidgetDateFormat" /><br />
				<small>Default will be used if not set.</small></p>
				<p>Time Format: <input type="text" name="icsWidgetTimeFormat" value="<?php 
                echo $options['time_format'];
                ?>
" id="icsWidgetTimeFormat" /><br />
				<label><input type="checkbox" name="icsWidgetHideTime" value="true"<?php 
                if ($options['hide_time'] == "true") {
                    echo ' CHECKED';
                }
                ?>
 /> Do not display time.</label>
				<br /><small>Default will be used if not set.</small></p>
				<p>Bottom Link: <input type="text" name="icsWidgetLink" value="<?php 
                echo $options['widget_link'];
                ?>
" id="icsWidgetLink" /><br />
				<small>Will be used at the bottom of the events.</small></p>
				<p>Custom Event Format:<br />
				<textarea name="icsCustomFormat" style="width:100%; font-size:10px; " rows="4"><?php 
                echo $options['custom_format'];
                ?>
</textarea>
				</p>
				<p><label><input type="checkbox" value="1" name="icsWidgetShowNextButtons" <?php 
                if ($options['show_next_buttons'] == 1) {
                    echo 'checked="checked"';
                }
                ?>
 id="icsWidgetShowNextButtons" />
					Show Previous / Next buttons for showing more events.</label>
				</p>
				<input type="hidden" id="icsImporterSubmit" name="icsImporterSubmit" value="1" />
				
				<?php 
            }
Пример #2
0
    exit;
}
if (isset($_GET['widgetPage'])) {
    $widget = WPICSImporter::getWidgetOptions();
    $options = WPICSImporter::getAdminOptions();
    $options = WPICSImporter::prepareWidgetOptions($widget, $options);
    $options['events_page'] = (int) $_GET['widgetPage'];
    $output = ICalEvents::custom_display_events($options, true);
    echo $output['output'];
    if ($output['count'] < $options['event_limit']) {
        echo '<script>jQuery("#ics-calendar-widget-next").hide();</script>';
    }
    exit;
}
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;