Commit 4ee80ea0 authored by Robert Rollins's avatar Robert Rollins

Got rid of all the pointless whitespace.

I used to like keeping whitespace on blank lines that lined up with the
indentiation level of the code. I don't like doing that any more, so out it goes.
parent 943ac4f8
...@@ -67,7 +67,7 @@ HOW TO EXPORT AN ICAL FEED USING THE iCal Entities PLUGIN ...@@ -67,7 +67,7 @@ HOW TO EXPORT AN ICAL FEED USING THE iCal Entities PLUGIN
as the event date for the iCal feed. Make sure that you choose a field that as the event date for the iCal feed. Make sure that you choose a field that
is a part of every entity that your View displays. Otherwise, the entities is a part of every entity that your View displays. Otherwise, the entities
which don't have that field will be left out of the iCal feed. which don't have that field will be left out of the iCal feed.
9. You may optionally choose a field that will be used to populate the 9. You may optionally choose a field that will be used to populate the
Location property of events in your iCal feed. This field can be a text Location property of events in your iCal feed. This field can be a text
field, a Node Reference field, an Addressfield, or a Location field. field, a Node Reference field, an Addressfield, or a Location field.
10. Give the Feed a path like 'calendar/%/export.ics', including a '/%/' for 10. Give the Feed a path like 'calendar/%/export.ics', including a '/%/' for
......
...@@ -80,7 +80,7 @@ function hook_date_ical_export_raw_event_alter(&$event, $view, $context) { ...@@ -80,7 +80,7 @@ function hook_date_ical_export_raw_event_alter(&$event, $view, $context) {
$event['comment'] = check_plain($comment['value']); $event['comment'] = check_plain($comment['value']);
} }
} }
// Example: Retrieving information from additional fields in the View (using // Example: Retrieving information from additional fields in the View (using
// the Fields plugin). // the Fields plugin).
$event['comment'] = $view->style_plugin->get_field($context['row_index'], 'field_comment'); $event['comment'] = $view->style_plugin->get_field($context['row_index'], 'field_comment');
......
...@@ -9,10 +9,10 @@ ...@@ -9,10 +9,10 @@
*/ */
function date_ical_requirements($phase) { function date_ical_requirements($phase) {
$requirements = array(); $requirements = array();
// Ensure translations don't break at install time. // Ensure translations don't break at install time.
$t = get_t(); $t = get_t();
if ($phase == 'runtime') { if ($phase == 'runtime') {
if (!function_exists('libraries_detect')) { if (!function_exists('libraries_detect')) {
$requirements['date_ical'] = array( $requirements['date_ical'] = array(
...@@ -26,7 +26,7 @@ function date_ical_requirements($phase) { ...@@ -26,7 +26,7 @@ function date_ical_requirements($phase) {
// Return immediately, since we can't even attempt to determine if iCalcreator is installed. // Return immediately, since we can't even attempt to determine if iCalcreator is installed.
return $requirements; return $requirements;
} }
$library = libraries_detect('iCalcreator'); $library = libraries_detect('iCalcreator');
if ($library && !empty($library['installed'])) { if ($library && !empty($library['installed'])) {
$requirements['date_ical'] = array( $requirements['date_ical'] = array(
...@@ -46,7 +46,7 @@ function date_ical_requirements($phase) { ...@@ -46,7 +46,7 @@ function date_ical_requirements($phase) {
); );
} }
} }
return $requirements; return $requirements;
} }
...@@ -73,7 +73,7 @@ function date_ical_update_7300() { ...@@ -73,7 +73,7 @@ function date_ical_update_7300() {
// Drupal attempts to instantiate the old feeds plugin classes. // Drupal attempts to instantiate the old feeds plugin classes.
registry_rebuild(); registry_rebuild();
cache_clear_all('plugins:feeds:plugins', 'cache'); cache_clear_all('plugins:feeds:plugins', 'cache');
// Update all the importers which used DateIcalIcalcreatorParser to use // Update all the importers which used DateIcalIcalcreatorParser to use
// DateiCalFeedsParser instead. // DateiCalFeedsParser instead.
$importer_data = ctools_export_load_object('feeds_importer', 'all'); $importer_data = ctools_export_load_object('feeds_importer', 'all');
...@@ -81,7 +81,7 @@ function date_ical_update_7300() { ...@@ -81,7 +81,7 @@ function date_ical_update_7300() {
$importer = feeds_importer($key); $importer = feeds_importer($key);
$importer_config = $importer->getConfig(); $importer_config = $importer->getConfig();
$needs_update = ($importer_config['parser']['plugin_key'] == 'DateIcalIcalcreatorParser'); $needs_update = ($importer_config['parser']['plugin_key'] == 'DateIcalIcalcreatorParser');
$processor = $importer->processor; $processor = $importer->processor;
$processor_config = $processor->getconfig(); $processor_config = $processor->getconfig();
// Also update importers which use the new parser, but have un-capitalized // Also update importers which use the new parser, but have un-capitalized
...@@ -91,18 +91,18 @@ function date_ical_update_7300() { ...@@ -91,18 +91,18 @@ function date_ical_update_7300() {
&& !empty($processor_config['mappings'][0]['source'])) { && !empty($processor_config['mappings'][0]['source'])) {
$needs_update = (strtoupper($processor_config['mappings'][0]['source']) != $processor_config['mappings'][0]['source']); $needs_update = (strtoupper($processor_config['mappings'][0]['source']) != $processor_config['mappings'][0]['source']);
} }
if ($needs_update) { if ($needs_update) {
$importer->setPlugin('DateiCalFeedsParser'); $importer->setPlugin('DateiCalFeedsParser');
// Source keys are now capitalized, so we need to update the mappings. // Source keys are now capitalized, so we need to update the mappings.
foreach ($processor_config['mappings'] as &$mapping) { foreach ($processor_config['mappings'] as &$mapping) {
$mapping['source'] = strtoupper($mapping['source']); $mapping['source'] = strtoupper($mapping['source']);
} }
$processor->setConfig($processor_config); $processor->setConfig($processor_config);
$importer->save(); $importer->save();
// When this importer object got created, a warning was issued about its // When this importer object got created, a warning was issued about its
// parser plugin being missing. We corrected that warning above, so we // parser plugin being missing. We corrected that warning above, so we
// should clear it out to avoid potential confusion. // should clear it out to avoid potential confusion.
......
...@@ -121,10 +121,10 @@ function date_ical_preprocess_node(&$variables) { ...@@ -121,10 +121,10 @@ function date_ical_preprocess_node(&$variables) {
$variables['page'] = TRUE; $variables['page'] = TRUE;
$variables['title_prefix'] = ''; $variables['title_prefix'] = '';
$variables['title_suffix'] = ''; $variables['title_suffix'] = '';
// We don't want to see the author information in our feed. // We don't want to see the author information in our feed.
$variables['display_submitted'] = FALSE; $variables['display_submitted'] = FALSE;
// Comments and links don't belong in an iCal feed. // Comments and links don't belong in an iCal feed.
if (isset($variables['content']['comments'])) { if (isset($variables['content']['comments'])) {
unset($variables['content']['comments']); unset($variables['content']['comments']);
...@@ -174,7 +174,7 @@ function date_ical_libraries_info() { ...@@ -174,7 +174,7 @@ function date_ical_libraries_info() {
'php' => array('iCalcreator.class.php'), 'php' => array('iCalcreator.class.php'),
), ),
); );
return $libraries; return $libraries;
} }
...@@ -231,14 +231,14 @@ function date_ical_sanitize_text($text = '') { ...@@ -231,14 +231,14 @@ function date_ical_sanitize_text($text = '') {
// HTML tags may get converted to < and such by the View code, so we need // HTML tags may get converted to < and such by the View code, so we need
// to convert them back to HTML so we can remove them with strip_tags(). // to convert them back to HTML so we can remove them with strip_tags().
$text = decode_entities($text); $text = decode_entities($text);
// Convert <p> tags to double newlines. // Convert <p> tags to double newlines.
$text = trim(preg_replace("/<p.*?>/i", "\n\n", $text)); $text = trim(preg_replace("/<p.*?>/i", "\n\n", $text));
// Separate heading tags from the text around them in both directions. // Separate heading tags from the text around them in both directions.
$text = trim(preg_replace("/<\\?h\d.*?>/i", "\n\n", $text)); $text = trim(preg_replace("/<\\?h\d.*?>/i", "\n\n", $text));
// Add a newline for each <div>. // Add a newline for each <div>.
$text = trim(preg_replace("/<div.*?>/i", "\n", $text)); $text = trim(preg_replace("/<div.*?>/i", "\n", $text));
// Strip the remaining HTML. // Strip the remaining HTML.
$text = strip_tags($text); $text = strip_tags($text);
// Remove newlines added at the beginning. // Remove newlines added at the beginning.
...@@ -278,7 +278,7 @@ function date_ical_feeds_set_rrule($source, $entity, $target, $repeat_rule) { ...@@ -278,7 +278,7 @@ function date_ical_feeds_set_rrule($source, $entity, $target, $repeat_rule) {
array('RRULE', 'RDATE', 'EXRULE', 'EXDATE'), array('RRULE', 'RDATE', 'EXRULE', 'EXDATE'),
explode('|', $repeat_rule) explode('|', $repeat_rule)
); );
module_load_include('inc', 'date_ical', 'date_ical.utils'); module_load_include('inc', 'date_ical', 'date_ical.utils');
// This "loop" is really just to make sure we get the right array keys. It // This "loop" is really just to make sure we get the right array keys. It
// souldn't ever execute more than once. // souldn't ever execute more than once.
...@@ -296,7 +296,7 @@ function date_ical_feeds_set_rrule($source, $entity, $target, $repeat_rule) { ...@@ -296,7 +296,7 @@ function date_ical_feeds_set_rrule($source, $entity, $target, $repeat_rule) {
function date_ical_get_location_fields($base = 'node', $reset = FALSE) { function date_ical_get_location_fields($base = 'node', $reset = FALSE) {
static $fields = array(); static $fields = array();
$empty = array('name' => array(), 'alias' => array()); $empty = array('name' => array(), 'alias' => array());
if (empty($fields[$base]) || $reset) { if (empty($fields[$base]) || $reset) {
$cid = 'date_ical_location_fields_' . $base; $cid = 'date_ical_location_fields_' . $base;
if (!$reset && $cached = cache_get($cid, 'cache_views')) { if (!$reset && $cached = cache_get($cid, 'cache_views')) {
...@@ -326,10 +326,10 @@ function _date_ical_get_location_fields($base = 'node') { ...@@ -326,10 +326,10 @@ function _date_ical_get_location_fields($base = 'node') {
if (empty($base)) { if (empty($base)) {
$base = 'node'; $base = 'node';
} }
$cid = 'date_ical_location_fields_' . $base; $cid = 'date_ical_location_fields_' . $base;
cache_clear_all($cid, 'cache_views'); cache_clear_all($cid, 'cache_views');
// Iterate over all the fields that Views knows about. // Iterate over all the fields that Views knows about.
$all_fields = date_views_views_fetch_fields($base, 'field'); $all_fields = date_views_views_fetch_fields($base, 'field');
$fields = array(); $fields = array();
...@@ -338,7 +338,7 @@ function _date_ical_get_location_fields($base = 'node') { ...@@ -338,7 +338,7 @@ function _date_ical_get_location_fields($base = 'node') {
$tmp = explode('.', $name); $tmp = explode('.', $name);
$field_name = $tmp[1]; $field_name = $tmp[1];
$table_name = $tmp[0]; $table_name = $tmp[0];
// Skip unsupported field types and fields that weren't defined through // Skip unsupported field types and fields that weren't defined through
// the Field module. // the Field module.
$info = field_info_field($field_name); $info = field_info_field($field_name);
...@@ -353,7 +353,7 @@ function _date_ical_get_location_fields($base = 'node') { ...@@ -353,7 +353,7 @@ function _date_ical_get_location_fields($base = 'node') {
if (!$info || !in_array($info['type'], $supported_location_fields)) { if (!$info || !in_array($info['type'], $supported_location_fields)) {
continue; continue;
} }
// Build an array of the field info that we'll need. // Build an array of the field info that we'll need.
$alias = str_replace('.', '_', $alias); $alias = str_replace('.', '_', $alias);
$fields['name'][$name] = array( $fields['name'][$name] = array(
...@@ -362,14 +362,14 @@ function _date_ical_get_location_fields($base = 'node') { ...@@ -362,14 +362,14 @@ function _date_ical_get_location_fields($base = 'node') {
'field_name' => $field_name, 'field_name' => $field_name,
'type' => $info['type'], 'type' => $info['type'],
); );
// These are here only to make this $field array conform to the same format // These are here only to make this $field array conform to the same format
// as the one returned by _date_views_fields(). They're probably not needed, // as the one returned by _date_views_fields(). They're probably not needed,
// but I thought that consistency would be a good idea. // but I thought that consistency would be a good idea.
$fields['name'][$name]['real_field_name'] = $field_name; $fields['name'][$name]['real_field_name'] = $field_name;
$fields['alias'][$alias] = $fields['name'][$name]; $fields['alias'][$alias] = $fields['name'][$name];
} }
cache_set($cid, $fields, 'cache_views'); cache_set($cid, $fields, 'cache_views');
return $fields; return $fields;
} }
......
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
function _date_ical_get_repeat_dates($field_name, $repeat_data, $item, $source) { function _date_ical_get_repeat_dates($field_name, $repeat_data, $item, $source) {
module_load_include('inc', 'date_api', 'date_api_ical'); module_load_include('inc', 'date_api', 'date_api_ical');
$field_info = field_info_field($field_name); $field_info = field_info_field($field_name);
$rrule_values = _date_ical_parse_repeat_rule($repeat_data['RRULE']); $rrule_values = _date_ical_parse_repeat_rule($repeat_data['RRULE']);
//$exrule_values = _date_ical_parse_repeat_rule($repeat_data['EXRULE']); //$exrule_values = _date_ical_parse_repeat_rule($repeat_data['EXRULE']);
$rdates = _date_ical_parse_repeat_dates($repeat_data['RDATE']); $rdates = _date_ical_parse_repeat_dates($repeat_data['RDATE']);
$exdates = _date_ical_parse_repeat_dates($repeat_data['EXDATE']); $exdates = _date_ical_parse_repeat_dates($repeat_data['EXDATE']);
// By the time we get here, the start and end dates have been // By the time we get here, the start and end dates have been
// adjusted back to UTC, but we want localtime dates to do // adjusted back to UTC, but we want localtime dates to do
// things like '+1 Tuesday', so adjust back to localtime. // things like '+1 Tuesday', so adjust back to localtime.
...@@ -40,7 +40,7 @@ function _date_ical_get_repeat_dates($field_name, $repeat_data, $item, $source) ...@@ -40,7 +40,7 @@ function _date_ical_get_repeat_dates($field_name, $repeat_data, $item, $source)
} }
$duration = $start->difference($end); $duration = $start->difference($end);
$start_datetime = date_format($start, DATE_FORMAT_DATETIME); $start_datetime = date_format($start, DATE_FORMAT_DATETIME);
if (!empty($rrule_values['UNTIL']['datetime'])) { if (!empty($rrule_values['UNTIL']['datetime'])) {
// The spec says that UNTIL must be in UTC, but not all feed creators // The spec says that UNTIL must be in UTC, but not all feed creators
// follow that rule. If the user specified that he wanted to overcome this // follow that rule. If the user specified that he wanted to overcome this
...@@ -50,7 +50,7 @@ function _date_ical_get_repeat_dates($field_name, $repeat_data, $item, $source) ...@@ -50,7 +50,7 @@ function _date_ical_get_repeat_dates($field_name, $repeat_data, $item, $source)
// Change the parsed UNTIL from UTC to $timezone, so that the // Change the parsed UNTIL from UTC to $timezone, so that the
// date_ical_date() won't convert it. // date_ical_date() won't convert it.
$rrule_values['UNTIL']['tz'] = $timezone; $rrule_values['UNTIL']['tz'] = $timezone;
// Convert the unparsed UNTIL to UTC, since the Date code will use it. // Convert the unparsed UNTIL to UTC, since the Date code will use it.
// It may currently have a Z on it, but only because iCalcreator blindly // It may currently have a Z on it, but only because iCalcreator blindly
// adds one to DATETIME-type UNTILs if it's not there. // adds one to DATETIME-type UNTILs if it's not there.
...@@ -81,7 +81,7 @@ function _date_ical_get_repeat_dates($field_name, $repeat_data, $item, $source) ...@@ -81,7 +81,7 @@ function _date_ical_get_repeat_dates($field_name, $repeat_data, $item, $source)
// No UNTIL and no COUNT? This is an illegal RRULE. // No UNTIL and no COUNT? This is an illegal RRULE.
return array(); return array();
} }
// Convert the EXDATE and RDATE values to datetime strings. // Convert the EXDATE and RDATE values to datetime strings.
// Even though exdates and rdates can be specified to the second, Date // Even though exdates and rdates can be specified to the second, Date
// Repeat's code checks them by comparing them to the date value only. // Repeat's code checks them by comparing them to the date value only.
...@@ -95,9 +95,9 @@ function _date_ical_get_repeat_dates($field_name, $repeat_data, $item, $source) ...@@ -95,9 +95,9 @@ function _date_ical_get_repeat_dates($field_name, $repeat_data, $item, $source)
$date = date_ical_date($rdate, $timezone); $date = date_ical_date($rdate, $timezone);
$additions[] = date_format($date, 'Y-m-d'); $additions[] = date_format($date, 'Y-m-d');
} }
// TODO: EXRULEs. // TODO: EXRULEs.
$date_repeat_compatible_rrule = "{$repeat_data['RRULE']}\n{$repeat_data['RDATE']}\n{$repeat_data['EXDATE']}"; $date_repeat_compatible_rrule = "{$repeat_data['RRULE']}\n{$repeat_data['RDATE']}\n{$repeat_data['EXDATE']}";
$calculated_dates = date_repeat_calc($date_repeat_compatible_rrule, $start_datetime, $final_repeat_datetime, $exceptions, $timezone, $additions); $calculated_dates = date_repeat_calc($date_repeat_compatible_rrule, $start_datetime, $final_repeat_datetime, $exceptions, $timezone, $additions);
$repeat_dates = array(); $repeat_dates = array();
...@@ -131,7 +131,7 @@ function _date_ical_get_repeat_dates($field_name, $repeat_data, $item, $source) ...@@ -131,7 +131,7 @@ function _date_ical_get_repeat_dates($field_name, $repeat_data, $item, $source)
*/ */
function _date_ical_parse_repeat_rule($repeat_rule_string) { function _date_ical_parse_repeat_rule($repeat_rule_string) {
module_load_include('inc', 'date_api', 'date_api_ical'); module_load_include('inc', 'date_api', 'date_api_ical');
$repeat_rule_string = preg_replace('/(R|EX)RULE.*:/', '', $repeat_rule_string); $repeat_rule_string = preg_replace('/(R|EX)RULE.*:/', '', $repeat_rule_string);
$items = array('DATA' => $repeat_rule_string); $items = array('DATA' => $repeat_rule_string);
foreach (explode(';', $repeat_rule_string) as $recur_val) { foreach (explode(';', $repeat_rule_string) as $recur_val) {
...@@ -140,7 +140,7 @@ function _date_ical_parse_repeat_rule($repeat_rule_string) { ...@@ -140,7 +140,7 @@ function _date_ical_parse_repeat_rule($repeat_rule_string) {
if (empty($key) || empty($value)) { if (empty($key) || empty($value)) {
continue; continue;
} }
// The following keys never have multiple values. // The following keys never have multiple values.
if (in_array($key, array('UNTIL', 'FREQ', 'INTERVAL', 'COUNT', 'WKST'))) { if (in_array($key, array('UNTIL', 'FREQ', 'INTERVAL', 'COUNT', 'WKST'))) {
if ($key == 'UNTIL') { if ($key == 'UNTIL') {
...@@ -152,7 +152,7 @@ function _date_ical_parse_repeat_rule($repeat_rule_string) { ...@@ -152,7 +152,7 @@ function _date_ical_parse_repeat_rule($repeat_rule_string) {
// The rest can be multi-value csv strings. // The rest can be multi-value csv strings.
$value = explode(',', $value); $value = explode(',', $value);
} }
$items[$key] = $value; $items[$key] = $value;
} }
return $items; return $items;
...@@ -171,10 +171,10 @@ function _date_ical_parse_repeat_rule($repeat_rule_string) { ...@@ -171,10 +171,10 @@ function _date_ical_parse_repeat_rule($repeat_rule_string) {
*/ */
function _date_ical_parse_repeat_dates($repeat_date_string) { function _date_ical_parse_repeat_dates($repeat_date_string) {
module_load_include('inc', 'date_api', 'date_api_ical'); module_load_include('inc', 'date_api', 'date_api_ical');
$properties = explode("\n", str_replace("\r\n", "\n", $repeat_date_string)); $properties = explode("\n", str_replace("\r\n", "\n", $repeat_date_string));
$parsed_dates = array(); $parsed_dates = array();
foreach ($properties as $property) { foreach ($properties as $property) {
$matches = array(); $matches = array();
if (preg_match('/(R|EX)DATE([^:]*):(.*)/', $property, $matches)) { if (preg_match('/(R|EX)DATE([^:]*):(.*)/', $property, $matches)) {
......
...@@ -5,14 +5,14 @@ ...@@ -5,14 +5,14 @@
*/ */
class DateiCalFeedsParser extends FeedsParser { class DateiCalFeedsParser extends FeedsParser {
/** /**
* Implements FeedsParser::getMappingSources(). * Implements FeedsParser::getMappingSources().
*/ */
public function getMappingSources() { public function getMappingSources() {
return parent::getMappingSources() + self::getiCalMappingSources(); return parent::getMappingSources() + self::getiCalMappingSources();
} }
/** /**
* Implements FeedsParser::parse(). * Implements FeedsParser::parse().
*/ */
...@@ -22,10 +22,10 @@ class DateiCalFeedsParser extends FeedsParser { ...@@ -22,10 +22,10 @@ class DateiCalFeedsParser extends FeedsParser {
throw new DateIcalException(t('Unable to load the iCalcreator library. Please ensure that it is properly installed.')); throw new DateIcalException(t('Unable to load the iCalcreator library. Please ensure that it is properly installed.'));
} }
$state = $source->state(FEEDS_PARSE); $state = $source->state(FEEDS_PARSE);
// Read the iCal feed into memory. // Read the iCal feed into memory.
$ical_feed_contents = $fetcher_result->getRaw(); $ical_feed_contents = $fetcher_result->getRaw();
// Parse the feed into an iCalcreator vcalendar object. // Parse the feed into an iCalcreator vcalendar object.
$calendar = new vcalendar(); $calendar = new vcalendar();
if ($calendar->parse($ical_feed_contents) === FALSE) { if ($calendar->parse($ical_feed_contents) === FALSE) {
...@@ -33,41 +33,41 @@ class DateiCalFeedsParser extends FeedsParser { ...@@ -33,41 +33,41 @@ class DateiCalFeedsParser extends FeedsParser {
$url = $source->config[$plugin]['source']; $url = $source->config[$plugin]['source'];
throw new DateIcalException(t('Parsing the data from %url failed. Please ensure that this URL leads to a valid iCal feed.', array('%url' => $url))); throw new DateIcalException(t('Parsing the data from %url failed. Please ensure that this URL leads to a valid iCal feed.', array('%url' => $url)));
} }
// Total hack to get around iCalcreator's mistreatment of UID "0". // Total hack to get around iCalcreator's mistreatment of UID "0".
if (empty($calendar->components[0]->uid) || empty($calendar->components[0]->uid['value'])) { if (empty($calendar->components[0]->uid) || empty($calendar->components[0]->uid['value'])) {
$calendar->components[0]->uid = array('value' => 'zero', 'params' => NULL); $calendar->components[0]->uid = array('value' => 'zero', 'params' => NULL);
} }
// Allow modules to alter the vcalendar object before we interpret it. // Allow modules to alter the vcalendar object before we interpret it.
$context = array( $context = array(
'source' => $source, 'source' => $source,
'fetcher_result' => $fetcher_result, 'fetcher_result' => $fetcher_result,
); );
drupal_alter('date_ical_import_vcalendar', $calendar, $context); drupal_alter('date_ical_import_vcalendar', $calendar, $context);
// We've got a vcalendar object created from the feed data. Now we need to // We've got a vcalendar object created from the feed data. Now we need to
// convert that vcalendar into an array of Feeds-compatible data arrays. // convert that vcalendar into an array of Feeds-compatible data arrays.
// ParserVcalendar->parse() does that. // ParserVcalendar->parse() does that.
require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'date_ical') . '/libraries/ParserVcalendar.inc'; require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'date_ical') . '/libraries/ParserVcalendar.inc';
$parser = new ParserVcalendar($calendar, $source, $fetcher_result, $source->getConfigFor($this)); $parser = new ParserVcalendar($calendar, $source, $fetcher_result, $source->getConfigFor($this));
// Using the stored progress pointer (or 0 if it's not set), // Using the stored progress pointer (or 0 if it's not set),
// determine which section of the feed to parse, then parse it. // determine which section of the feed to parse, then parse it.
$offset = isset($state->pointer) ? $state->pointer : 0; $offset = isset($state->pointer) ? $state->pointer : 0;
$limit = $source->importer->getLimit(); $limit = $source->importer->getLimit();
$rows = $parser->parse($offset, $limit); $rows = $parser->parse($offset, $limit);
// Report progress. // Report progress.
$state->total = $parser->getTotalComponents(); $state->total = $parser->getTotalComponents();
// We need to add 1 to the index of the last parsed componenent so that // We need to add 1 to the index of the last parsed componenent so that
// the subsequent batch starts on the first unparsed component. // the subsequent batch starts on the first unparsed component.
$state->pointer = $parser->getLastComponentParsed() + 1; $state->pointer = $parser->getLastComponentParsed() + 1;
$state->progress($state->total, $state->pointer); $state->progress($state->total, $state->pointer);
return new FeedsParserResult($rows); return new FeedsParserResult($rows);
} }
/** /**
* Defines the default configuration settings for an actual import. * Defines the default configuration settings for an actual import.
*/ */
...@@ -78,7 +78,7 @@ class DateiCalFeedsParser extends FeedsParser { ...@@ -78,7 +78,7 @@ class DateiCalFeedsParser extends FeedsParser {
'skip_days' => $this->config['skip_days'], 'skip_days' => $this->config['skip_days'],
); );
} }
/** /**
* Defines the default settings shown on the configuration form. * Defines the default settings shown on the configuration form.
*/ */
...@@ -90,7 +90,7 @@ class DateiCalFeedsParser extends FeedsParser { ...@@ -90,7 +90,7 @@ class DateiCalFeedsParser extends FeedsParser {
'skip_days' => NULL, 'skip_days' => NULL,
); );
} }
/** /**
* Builds the configuration form. * Builds the configuration form.
*/ */
...@@ -133,7 +133,7 @@ class DateiCalFeedsParser extends FeedsParser { ...@@ -133,7 +133,7 @@ class DateiCalFeedsParser extends FeedsParser {
); );
return $form; return $form;
} }
/** /**
* Validation handler for configForm. * Validation handler for configForm.
*/ */
...@@ -145,7 +145,7 @@ class DateiCalFeedsParser extends FeedsParser { ...@@ -145,7 +145,7 @@ class DateiCalFeedsParser extends FeedsParser {
$source_config['skip_days'] = NULL; $source_config['skip_days'] = NULL;
} }
} }
/** /**
* Creates the list of mapping sources offered by DateiCalFeedsParser. * Creates the list of mapping sources offered by DateiCalFeedsParser.
*/ */
...@@ -210,10 +210,10 @@ class DateiCalFeedsParser extends FeedsParser { ...@@ -210,10 +210,10 @@ class DateiCalFeedsParser extends FeedsParser {
'description' => t('The CATEGORIES property. Catagories that describe the event, which can be imported into taxonomy terms.'), 'description' => t('The CATEGORIES property. Catagories that describe the event, which can be imported into taxonomy terms.'),
'date_ical_parse_handler' => 'parseMultivalueProperty', 'date_ical_parse_handler' => 'parseMultivalueProperty',
); );
// Allow other modules to add custom source fields. // Allow other modules to add custom source fields.
drupal_alter('date_ical_mapping_sources', $sources); drupal_alter('date_ical_mapping_sources', $sources);
return $sources; return $sources;
} }
} }
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
*/ */
function date_ical_views_plugins() { function date_ical_views_plugins() {
$includes_path = drupal_get_path('module', 'date_ical') . '/includes'; $includes_path = drupal_get_path('module', 'date_ical') . '/includes';
$data = array( $data = array(
'module' => 'date_ical', 'module' => 'date_ical',
'style' => array( 'style' => array(
...@@ -48,6 +48,6 @@ function date_ical_views_plugins() { ...@@ -48,6 +48,6 @@ function date_ical_views_plugins() {
), ),
), ),
); );
return $data; return $data;
} }
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* A Views plugin which builds an iCal VEVENT from a views row with Fields. * A Views plugin which builds an iCal VEVENT from a views row with Fields.
*/ */
class date_ical_plugin_row_ical_fields extends views_plugin_row { class date_ical_plugin_row_ical_fields extends views_plugin_row {
/** /**
* Set up the options for the row plugin. * Set up the options for the row plugin.
*/ */
...@@ -22,7 +22,7 @@ class date_ical_plugin_row_ical_fields extends views_plugin_row { ...@@ -22,7 +22,7 @@ class date_ical_plugin_row_ical_fields extends views_plugin_row {
$options['additional_settings']['skip_blank_dates'] = array('default' => FALSE); $options['additional_settings']['skip_blank_dates'] = array('default' => FALSE);
return $options; return $options;
} }
/** /**
* Build the form for setting the row plugin's options. * Build the form for setting the row plugin's options.
*/ */
...@@ -32,7 +32,7 @@ class date_ical_plugin_row_ical_fields extends views_plugin_row { ...@@ -32,7 +32,7 @@ class date_ical_plugin_row_ical_fields extends views_plugin_row {
$date_field_labels = $this->get_date_field_candidates($all_field_labels); $date_field_labels = $this->get_date_field_candidates($all_field_labels);
$date_field_label_options = array_merge(array('first_available' => t('First populated Date field')), $date_field_labels); $date_field_label_options = array_merge(array('first_available' => t('First populated Date field')), $date_field_labels);
$text_field_label_options = array_merge(array('' => t('- None -')), $all_field_labels); $text_field_label_options = array_merge(array('' => t('- None -')), $all_field_labels);
$form['instructions'] = array( $form['instructions'] = array(
// The surrounding <div> ensures that the settings dialog expands. // The surrounding <div> ensures that the settings dialog expands.
'#prefix' => '<div style="font-size: 90%">', '#prefix' => '<div style="font-size: 90%">',
...@@ -88,7 +88,7 @@ class date_ical_plugin_row_ical_fields extends views_plugin_row { ...@@ -88,7 +88,7 @@ class date_ical_plugin_row_ical_fields extends views_plugin_row {
'#default_value' => $this->options['additional_settings']['skip_blank_dates'], '#default_value' => $this->options['additional_settings']['skip_blank_dates'],
); );
} }
/** /**
* Set up the environment for the render() function. * Set up the environment for the render() function.
*/ */
...@@ -101,13 +101,13 @@ class date_ical_plugin_row_ical_fields extends views_plugin_row { ...@@ -101,13 +101,13 @@ class date_ical_plugin_row_ical_fields extends views_plugin_row {
} }
$this->repeated_dates = array(); $this->repeated_dates = array();
} }
/** /**
* Returns an Event array row in the query with index: $row->index. * Returns an Event array row in the query with index: $row->index.
*/ */
public function render($row) { public function render($row) {
$date_field_name = $this->options['date_field']; $date_field_name = $this->options['date_field'];
// If this view is set to use the first populated date field, check each // If this view is set to use the first populated date field, check each
// field in the row to find the first non-NULL Date field. // field in the row to find the first non-NULL Date field.
if ($date_field_name == 'first_available') { if ($date_field_name == 'first_available') {
...@@ -123,7 +123,7 @@ class date_ical_plugin_row_ical_fields extends views_plugin_row { ...@@ -123,7 +123,7 @@ class date_ical_plugin_row_ical_fields extends views_plugin_row {
} }
} }
} }
// Fetch the event's date information. // Fetch the event's date information.
try { try {
if ($date_field_name == 'first_available') {