当前位置: 首页>>代码示例>>PHP>>正文


PHP vcalendar::getProperty方法代码示例

本文整理汇总了PHP中vcalendar::getProperty方法的典型用法代码示例。如果您正苦于以下问题:PHP vcalendar::getProperty方法的具体用法?PHP vcalendar::getProperty怎么用?PHP vcalendar::getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vcalendar的用法示例。


在下文中一共展示了vcalendar::getProperty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: iCal2xls


//.........这里部分代码省略.........
             return utf8_decode($s);
         }
     }
     /** Creating a workbook */
     require_once 'Spreadsheet/Excel/Writer.php';
     if ($save) {
         $workbook = new Spreadsheet_Excel_Writer($outputdirFile);
     } else {
         $workbook = new Spreadsheet_Excel_Writer();
     }
     $workbook->setVersion(8);
     // Use Excel97/2000 Format
     /** opt. sending HTTP headers */
     if (!$save) {
         $workbook->send($outputFileParts['basename']);
     }
     /** Creating a worksheet */
     $worksheet =& $workbook->addWorksheet($inputFileParts['filename']);
     /** fix formats */
     $format_bold =& $workbook->addFormat();
     $format_bold->setBold();
     $timeexec['wrkbkOk'] = microtime(TRUE);
     /** info rows */
     $row = -1;
     $worksheet->writeString(++$row, 0, 'kigkonsult.se', $format_bold);
     $worksheet->writeString($row, 1, ICALCREATOR_VERSION, $format_bold);
     $worksheet->writeString($row, 2, ICALCNVVERSION . ' iCal2xls', $format_bold);
     $worksheet->writeString($row, 3, date('Y-m-d H:i:s'));
     $filename = $remoteInput ? $inputdirFile : $inputFileParts['basename'];
     $worksheet->writeString(++$row, 0, 'iCal input', $format_bold);
     $worksheet->writeString($row, 1, $filename);
     $worksheet->writeString($row, 2, 'xls output', $format_bold);
     $worksheet->writeString($row, 3, $outputFileParts['basename']);
     if (FALSE !== ($prop = $calendar->getProperty('CALSCALE'))) {
         $worksheet->writeString(++$row, 0, 'CALSCALE', $format_bold);
         $worksheet->writeString($row, 1, $prop);
     }
     if (FALSE !== ($prop = $calendar->getProperty('METHOD'))) {
         $worksheet->writeString(++$row, 0, 'METHOD', $format_bold);
         $worksheet->writeString($row, 1, $prop);
     }
     while (FALSE !== ($xprop = $calendar->getProperty())) {
         $worksheet->writeString(++$row, 0, $xprop[0], $format_bold);
         $worksheet->writeString($row, 1, $xprop[1]);
     }
     $timeexec['infoOk'] = microtime(TRUE);
     if (FALSE === ($propsToSkip = $this->getConfig('skip'))) {
         $propsToSkip = array();
     }
     /** fix property order list */
     $proporderOrg = array();
     for ($key = 2; $key < 99; $key++) {
         if (FALSE !== ($value = $this->getConfig($key))) {
             $proporderOrg[$value] = $key;
             if ($this->log) {
                 $this->log->log("{$value} in column {$key}", 7);
             }
         }
     }
     /** fix vtimezone property order list */
     $proporder = $proporderOrg;
     $proporder['TYPE'] = 0;
     $proporder['ORDER'] = 1;
     $props = array('TZID', 'LAST-MODIFIED', 'TZURL', 'DTSTART', 'TZOFFSETTO', 'TZOFFSETFROM', 'COMMENT', 'RRULE', 'RDATE', 'TZNAME');
     $pix = 2;
     foreach ($props as $prop) {
开发者ID:andyUA,项目名称:kabmin-new,代码行数:67,代码来源:iCalcnv.class.php

示例2: add_vcalendar_events_to_db

 /**
  * Process vcalendar instance - add events to database.
  *
  * @param vcalendar $v    Calendar to retrieve data from.
  * @param array     $args Arbitrary arguments map.
  *
  * @throws Ai1ec_Parse_Exception
  *
  * @internal param stdClass $feed           Instance of feed (see Ai1ecIcs plugin).
  * @internal param string   $comment_status WP comment status: 'open' or 'closed'.
  * @internal param int      $do_show_map    Map display status (DB boolean: 0 or 1).
  *
  * @return int Count of events added to database.
  */
 public function add_vcalendar_events_to_db(vcalendar $v, array $args)
 {
     $feed = isset($args['feed']) ? $args['feed'] : null;
     $comment_status = isset($args['comment_status']) ? $args['comment_status'] : 'open';
     $do_show_map = isset($args['do_show_map']) ? $args['do_show_map'] : 0;
     $count = 0;
     $events_in_db = $args['events_in_db'];
     $v->sort();
     // Reverse the sort order, so that RECURRENCE-IDs are listed before the
     // defining recurrence events, and therefore take precedence during
     // caching.
     $v->components = array_reverse($v->components);
     // TODO: select only VEVENT components that occur after, say, 1 month ago.
     // Maybe use $v->selectComponents(), which takes into account recurrence
     // Fetch default timezone in case individual properties don't define it
     $timezone = $v->getProperty('X-WR-TIMEZONE');
     $timezone = (string) $timezone[1];
     // go over each event
     while ($e = $v->getComponent('vevent')) {
         // Event data array.
         $data = array();
         // =====================
         // = Start & end times =
         // =====================
         $start = $e->getProperty('dtstart', 1, true);
         $end = $e->getProperty('dtend', 1, true);
         // For cases where a "VEVENT" calendar component
         // specifies a "DTSTART" property with a DATE value type but none
         // of "DTEND" nor "DURATION" property, the event duration is taken to
         // be one day.  For cases where a "VEVENT" calendar component
         // specifies a "DTSTART" property with a DATE-TIME value type but no
         // "DTEND" property, the event ends on the same calendar date and
         // time of day specified by the "DTSTART" property.
         if (empty($end)) {
             // #1 if duration is present, assign it to end time
             $end = $e->getProperty('duration', 1, true, true);
             if (empty($end)) {
                 // #2 if only DATE value is set for start, set duration to 1 day
                 if (!isset($start['value']['hour'])) {
                     $end = array('value' => array('year' => $start['value']['year'], 'month' => $start['value']['month'], 'day' => $start['value']['day'] + 1, 'hour' => 0, 'min' => 0, 'sec' => 0));
                     if (isset($start['value']['tz'])) {
                         $end['value']['tz'] = $start['value']['tz'];
                     }
                 } else {
                     // #3 set end date to start time
                     $end = $start;
                 }
             }
         }
         $categories = $e->getProperty("CATEGORIES", false, true);
         $imported_cat = array();
         // If the user chose to preserve taxonomies during import, add categories.
         if ($categories && $feed->keep_tags_categories) {
             $imported_cat = $this->_add_categories_and_tags($categories['value'], $imported_cat, false, true);
         }
         $feed_categories = $feed->feed_category;
         if (!empty($feed_categories)) {
             $imported_cat = $this->_add_categories_and_tags($feed_categories, $imported_cat, false, false);
         }
         $tags = $e->getProperty("X-TAGS", false, true);
         $imported_tags = array();
         // If the user chose to preserve taxonomies during import, add tags.
         if ($tags && $feed->keep_tags_categories) {
             $imported_tags = $this->_add_categories_and_tags($tags[1]['value'], $imported_tags, true, true);
         }
         $feed_tags = $feed->feed_tags;
         if (!empty($feed_tags)) {
             $imported_tags = $this->_add_categories_and_tags($feed_tags, $imported_tags, true, true);
         }
         // Event is all-day if no time components are defined
         $allday = $this->_is_timeless($start['value']) && $this->_is_timeless($end['value']);
         // Also check the proprietary MS all-day field.
         $ms_allday = $e->getProperty('X-MICROSOFT-CDO-ALLDAYEVENT');
         if (!empty($ms_allday) && $ms_allday[1] == 'TRUE') {
             $allday = true;
         }
         $start = $this->_time_array_to_datetime($start, $timezone);
         $end = $this->_time_array_to_datetime($end, $timezone);
         if (false === $start || false === $end) {
             throw new Ai1ec_Parse_Exception('Failed to parse one or more dates given timezone "' . var_export($timezone, true) . '"');
             continue;
         }
         // If all-day, and start and end times are equal, then this event has
         // invalid end time (happens sometimes with poorly implemented iCalendar
         // exports, such as in The Event Calendar), so set end time to 1 day
         // after start time.
//.........这里部分代码省略.........
开发者ID:newmight2015,项目名称:psmpsm,代码行数:101,代码来源:ics.php

示例3: _add_recurring_events_exclusions

 /**
  * Returns modified exclusions structure for given event.
  *
  * @param vcalendar       $e          Vcalendar event object.
  * @param array           $exclusions Exclusions.
  * @param Ai1ec_Date_Time $start Date time object.
  *
  * @return array Modified exclusions structure.
  */
 protected function _add_recurring_events_exclusions($e, $exclusions, $start)
 {
     $recurrence_id = $e->getProperty('recurrence-id');
     if (false === $recurrence_id || !isset($recurrence_id['year']) || !isset($recurrence_id['month']) || !isset($recurrence_id['day'])) {
         return $exclusions;
     }
     $year = $month = $day = $hour = $min = $sec = null;
     extract($recurrence_id, EXTR_IF_EXISTS);
     $timezone = '';
     $exdate = sprintf('%04d%02d%02d', $year, $month, $day);
     if (null === $hour || null === $min || null === $sec) {
         $hour = $min = $sec = '00';
         $timezone = 'Z';
     }
     $exdate .= sprintf('T%02d%02d%02d%s', $hour, $min, $sec, $timezone);
     $exclusions[$e->getProperty('uid')][] = $exdate;
     return $exclusions;
 }
开发者ID:sedici,项目名称:wpmu-istec,代码行数:27,代码来源:ics.php

示例4: add_vcalendar_events_to_db

 /**
  * add_vcalendar_events_to_db method
  *
  * Process vcalendar instance - add events to database
  *
  * @param vcalendar $v              Calendar to retrieve data from
  * @param stdClass  $feed           Instance of feed (see Ai1ecIcs plugin)
  * @param string    $comment_status WP comment status: 'open' or 'closed'
  * @param int       $do_show_map    Map display status (DB boolean: 0 or 1)
  *
  * @return int Count of events added to database
  */
 public function add_vcalendar_events_to_db(vcalendar $v, $feed, $comment_status, $do_show_map = 0)
 {
     global $ai1ec_events_helper;
     $count = 0;
     $do_show_map = Ai1ec_Number_Utility::db_bool($do_show_map);
     $v->sort();
     // Reverse the sort order, so that RECURRENCE-IDs are listed before the
     // defining recurrence events, and therefore take precedence during
     // caching.
     $v->components = array_reverse($v->components);
     // TODO: select only VEVENT components that occur after, say, 1 month ago.
     // Maybe use $v->selectComponents(), which takes into account recurrence
     // Fetch default timezone in case individual properties don't define it
     $timezone = $v->getProperty('X-WR-TIMEZONE');
     $timezone = $timezone[1];
     // go over each event
     while ($e = $v->getComponent('vevent')) {
         // Event data array.
         $data = array();
         // =====================
         // = Start & end times =
         // =====================
         $start = $e->getProperty('dtstart', 1, true);
         $end = $e->getProperty('dtend', 1, true);
         // For cases where a "VEVENT" calendar component
         // specifies a "DTSTART" property with a DATE value type but no
         // "DTEND" nor "DURATION" property, the event's duration is taken to
         // be one day.  For cases where a "VEVENT" calendar component
         // specifies a "DTSTART" property with a DATE-TIME value type but no
         // "DTEND" property, the event ends on the same calendar date and
         // time of day specified by the "DTSTART" property.
         if (empty($end)) {
             // #1 if duration is present, assign it to end time
             $end = $e->getProperty('duration', 1, true, true);
             if (empty($end)) {
                 // #2 if only DATE value is set for start, set duration to 1 day
                 if (!isset($start['value']['hour'])) {
                     $end = array('year' => $start['value']['year'], 'month' => $start['value']['month'], 'day' => $start['value']['day'] + 1, 'hour' => 0, 'min' => 0, 'sec' => 0, 'tz' => $start['value']['tz']);
                 } else {
                     // #3 set end date to start time
                     $end = $start;
                 }
             }
         }
         // Event is all-day if no time components are defined
         $allday = !isset($start['value']['hour']);
         // Also check the proprietary MS all-day field.
         $ms_allday = $e->getProperty('X-MICROSOFT-CDO-ALLDAYEVENT');
         if (!empty($ms_allday) && $ms_allday[1] == 'TRUE') {
             $allday = true;
         }
         // convert times to GMT UNIX timestamps
         $start = $this->time_array_to_timestamp($start, $timezone);
         $end = $this->time_array_to_timestamp($end, $timezone);
         if (false === $start || false === $end) {
             trigger_error('Failed to parse one or more dates given timezone "' . var_export($timezone, true) . '".', E_USER_WARNING);
             continue;
         }
         // If all-day, and start and end times are equal, then this event has
         // invalid end time (happens sometimes with poorly implemented iCalendar
         // exports, such as in The Event Calendar), so set end time to 1 day
         // after start time.
         if ($allday && $start === $end) {
             $end += 24 * 60 * 60;
         }
         // Due to potential time zone differences (WP time zone vs. feed time
         // zone), must set all-day event start/end dates to midnight of the
         // respective days, in the *local* time zone.
         if ($allday) {
             $start = $ai1ec_events_helper->gmgetdate($start);
             $start = gmmktime(0, 0, 0, $start['mon'], $start['mday'], $start['year']);
             $start = $ai1ec_events_helper->local_to_gmt($start);
             $end = $ai1ec_events_helper->gmgetdate($end);
             $end = gmmktime(0, 0, 0, $end['mon'], $end['mday'], $end['year']);
             $end = $ai1ec_events_helper->local_to_gmt($end);
         }
         $data += compact('start', 'end', 'allday');
         // =======================================
         // = Recurrence rules & recurrence dates =
         // =======================================
         if ($rrule = $e->createRrule()) {
             $rrule = trim(end(explode(':', $rrule)));
         }
         if ($exrule = $e->createExrule()) {
             $exrule = trim(end(explode(':', $exrule)));
         }
         if ($rdate = $e->createRdate()) {
             $rdate = trim(end(explode(':', $rdate)));
//.........这里部分代码省略.........
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:101,代码来源:class-ai1ec-importer-helper.php

示例5: iCal2csv


//.........这里部分代码省略.........
            error_log($msg);
        }
        return FALSE;
    }
    if ($log) {
        $timeexec['fileOk'] = microtime(TRUE);
    }
    if (!function_exists('iCaldate2timestamp')) {
        function iCaldate2timestamp($d)
        {
            if (6 > count($d)) {
                return mktime(0, 0, 0, $d['month'], $d['day'], $d['year']);
            } else {
                return mktime($d['hour'], $d['min'], $d['sec'], $d['month'], $d['day'], $d['year']);
            }
        }
    }
    if (!function_exists('fixiCalString')) {
        function fixiCalString($s)
        {
            $s = str_replace('\\,', ',', $s);
            $s = str_replace('\\;', ';', $s);
            $s = str_replace('\\n ', chr(10), $s);
            $s = str_replace('\\\\', '\\', $s);
            return $s;
        }
    }
    /* create output array */
    $rows = array();
    /* info rows */
    $rows[] = array('kigkonsult.se', ICALCREATOR_VERSION, $iCal2csv_VERSION, date('Y-m-d H:i:s'));
    $filename = $remoteInput ? $filename : $inputFileParts['basename'];
    $rows[] = array('iCal input', $filename, 'csv output', $outputFileParts['basename']);
    if ($prop = $calendar->getProperty('CALSCALE')) {
        $rows[] = array('CALSCALE', $prop);
    }
    if ($prop = $calendar->getProperty('METHOD')) {
        $rows[] = array('METHOD', $prop);
    }
    while ($xprop = $calendar->getProperty()) {
        $rows[] = array($xprop[0], $xprop[1]);
    }
    if ($log) {
        $timeexec['infoOk'] = microtime(TRUE);
    }
    /* fix vtimezone property order list */
    $proporder = array();
    foreach ($conf as $key => $value) {
        if ('2' <= $key && '99' > $key) {
            $proporder[$value] = $key;
            if ($log) {
                $log->log("{$iCal2csv_VERSION} {$value} in column {$key}", 7);
            }
        }
    }
    $proporder['TYPE'] = 0;
    $proporder['ORDER'] = 1;
    $props = array('TZID', 'LAST-MODIFIED', 'TZURL', 'DTSTART', 'TZOFFSETTO', 'TZOFFSETFROM', 'TZOFFSETTFROM', 'COMMENT', 'RRULE', 'RDATE', 'TZNAME');
    $pix = 2;
    foreach ($props as $prop) {
        if (isset($proporder[$prop])) {
            continue;
        }
        if (isset($conf['skip']) && in_array($prop, $conf['skip'])) {
            if ($log) {
                $log->log("{$iCal2csv_VERSION} {$prop} removed from output", 7);
开发者ID:santas156,项目名称:joomleague-2-komplettpaket,代码行数:67,代码来源:iCal2csv.php

示例6: ElggFile

$thumb = new ElggFile();
$thumb->setMimeType($_FILES['ical_file']['type']);
$thumb->setFilename($_FILES['ical_file']['name']);
$thumb->open('write');
$thumb->close();
// copy the file
$moved = move_uploaded_file($_FILES['ical_file']['tmp_name'], $thumb->getFilenameOnFilestore());
if (!$moved) {
    register_error(elgg_echo('event_calendar:file:cannotload'));
    forward(REFERER);
}
$path = pathinfo($thumb->getFilenameOnFilestore());
$config = array('unique_id' => elgg_get_site_url(), 'delimiter' => '/', 'directory' => $path['dirname'], 'filename' => $_FILES['ical_file']['name']);
$v = new vcalendar($config);
$v->parse();
$timezone_calendar = $v->getProperty('X-WR-TIMEZONE');
$export_timezone = false;
if ($timezone_calendar[1]) {
    $export_timezone = $timezone_calendar[1];
}
$event_calendar_times = elgg_get_plugin_setting('times', 'event_calendar');
$event_calendar_region_display = elgg_get_plugin_setting('region_display', 'event_calendar');
$event_calendar_type_display = elgg_get_plugin_setting('type_display', 'event_calendar');
$event_calendar_more_required = elgg_get_plugin_setting('more_required', 'event_calendar');
// for now, turn off the more_required setting during import
elgg_set_plugin_setting('more_required', 'no', 'event_calendar');
$created = array();
// an array to hold all of the created events
while ($vevent = $v->getComponent()) {
    if ($vevent instanceof vevent) {
        $dtstart = $vevent->getProperty('dtstart');
开发者ID:iionly,项目名称:event_calendar,代码行数:31,代码来源:import.php


注:本文中的vcalendar::getProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。