diff -u -p -r vd0/views-view-json.tpl.php vd4/views-view-json.tpl.php
--- vd0/views-view-json.tpl.php	2009-09-08 12:45:08.000000000 -0400
+++ vd4/views-view-json.tpl.php	2009-10-27 22:52:13.000000000 -0400
@@ -1,8 +1,10 @@
 <?php
-// $Id: views-view-json.tpl.php,v 1.1.2.7 2009/09/08 16:45:08 allisterbeharry Exp $
+// $Id$
+
 /**
- * @file views-view-json.tpl.php
- * View template to render view fields as JSON. Supports simple JSON and the Exhibit format.
+ * @file
+ * View template to render view fields as JSON.  Supports simple JSON
+ * and the Exhibit format.
  *
  * - $view: The view in use.
  * - $rows: The raw result objects from the query, with all data it fetched.
@@ -11,87 +13,182 @@
  * @ingroup views_templates
  * @see views_json.views.inc
  */
- 
-if ($options['format'] == 'Simple') json_simple_render($view);
-if ($options['format'] == 'Exhibit') json_exhibit_render($view);
-
-function json_simple_render($view) {
-  define('EXHIBIT_DATE_FORMAT', '%Y-%m-%d %H:%M:%S');	
-	$json = "{\n".'  "nodes":'."\n".str_repeat(" ", 4)."[\n";
-	$total_view_result_count = count((array)($view->result)); //cast the result object to an array so we can count how many properties in itt;
-	$view_result_count = 0;
-	foreach ($view->result as $node) {
-		$json.= str_repeat(" ", 6)."{\n";
-		$total_field_count = count((array)$node); //cast the node object to an array so we can count how many properties in itt
-		$field_count = 0;
-		foreach($node as $field_label => $field_value) {
-		  $label = trim(views_json_strip_illegal_chars(views_json_encode_special_chars($field_label)));
-          $value = views_json_encode_special_chars(trim(views_json_is_date($field_value)));
-          if ((is_null($value)) || ($value == '')) continue;
-//          if (preg_match('/\d/', $value)) {
-//            if (strtotime($value))
-//              $value = gmstrftime(EXHIBIT_DATE_FORMAT, strtotime($value));
-//          }
-          $label = str_replace('_value', '', str_replace("profile_values_profile_", '', $label)); //strip out Profile: from profile fields
-          $json.=str_repeat(" ", 8).'"'.$label.'"'. " ".": ".'"'.$value.'"'.((++$field_count == $total_field_count) ? "":",")."\n";
-		}
-		$json.=str_repeat(" ", 6)."}".((++$view_result_count == $total_view_result_count) ? "":",")."\n";	
-	}
-	$json.=str_repeat(" ", 4)."]\n}";
-	
-  if ($view->override_path) { //inside a live preview so just output the text
-    print $json; 
+
+
+switch ($options['format']) {
+  // Simple (Coder)
+  case 'simple-coder':
+    json_simple_render($view, TRUE);
+    break;
+
+  // MIT Simile/Exhibit
+  case 'exhibit':
+    json_exhibit_render($view);
+    break;
+
+  // MIT Simile/Exhibit (Coder)
+  case 'exhibit-coder':
+    json_exhibit_render($view, TRUE);
+    break;
+
+  // Simple
+  default:
+    json_simple_render($view);
+}
+
+
+function json_simple_render($view, $coder_mode = FALSE) {
+  define('EXHIBIT_DATE_FORMAT', '%Y-%m-%d %H:%M:%S');
+
+  $eol      = '';
+  $spaces1  = '';
+  $spaces2  = '';
+  $spaces4  = '';
+
+  if ($view->override_path) {
+    // inside a live preview so use HTML line breaks and space accordingly
+    $eol      = '<br />';
+    $spaces1  = ' ';
+    $spaces2  = str_repeat('&nbsp;', 2);
+    $spaces4  = str_repeat('&nbsp;', 4);
+  }
+
+  $json = '{' . $spaces1 .'"nodes"'. $spaces1 .':'. $spaces1 .'['. $eol;
+
+  $more_view_results = FALSE;
+  foreach ($view->result as $node) {
+    $json .= ($more_view_results ? ','. $eol : '') . $spaces2 .'{'. $eol;
+
+    $more_fields = FALSE;
+    foreach ($node as $field_label => $field_value) {
+      $label = trim(views_json_strip_illegal_chars(views_json_encode_special_chars($field_label)));
+      $value = views_json_encode_special_chars(trim(views_json_is_date($field_value)));
+      if ((is_null($value)) || ($value == '')) continue;
+
+//    if (preg_match('/\d/', $value)) {
+//      if (strtotime($value)) {
+//        $value = gmstrftime(EXHIBIT_DATE_FORMAT, strtotime($value));
+//      }
+//    }
+
+      // strip out Profile: from profile fields
+      $label = str_replace('_value', '', str_replace('profile_values_profile_', '', $label));
+
+      if ($view->override_path) {
+        $value = check_plain($value);
+      }
+
+      $json .= ($more_fields ? ','. $eol : '') . $spaces4 .'"'. $label .'"'. $spaces1 .':'. $spaces1 .'"'. $value .'"';
+
+      $more_fields = TRUE;
+    }
+
+    $json .= $eol . $spaces2 .'}';
+
+    $more_view_results = TRUE;
   }
-  else { //real deal so switch the content type and stop further processing of the page
+
+  $json .= ']'. $spaces1 .'}';
+
+  if ($view->override_path) {
+    // we're inside a live preview so pretty-print the JSON
+    print '<code>'. $json .'</code>';
+  }
+  elseif ($coder_mode) {
+    // we're in "coder" mode so just output the JSON
+    print $json;
+  }
+  else {
+    // we're in callback mode so switch the content type and stop further processing of the page
     drupal_set_header('Content-Type: text/javascript');
     print $json;
     module_invoke_all('exit');
     exit;
- }
-	
+  }
 }
 
 
-function json_exhibit_render($view) {
+function json_exhibit_render($view, $coder_mode = FALSE) {
   define('EXHIBIT_DATE_FORMAT', '%Y-%m-%d %H:%M:%S');
-  $json = "{\n".'  "items":'."\n".str_repeat(" ", 4)."[\n";
-  $total_view_result_count = count((array)($view->result)); //cast the result object to an array so we can count how many properties in itt;
-  $view_result_count = 0;
-  foreach ($view->result as $node) { 
-  	$json.=str_repeat(" ", 6)."{\n";
-    $json.=str_repeat(" ", 8).'"type" '. " ".": ".'"'.'##type##'.'",'."\n";
-    $json.=str_repeat(" ", 8).'"label" '. " "." : ".'"'.'##label##'.'",'."\n";
-  	$total_field_count = count((array)$node); //cast the node object to an array so we can count how many properties in itt
-	$field_count = 0;
-    foreach($node as $field_label => $field_value) {
+
+  $eol      = '';
+  $spaces1  = '';
+  $spaces2  = '';
+  $spaces4  = '';
+
+  if ($view->override_path) {
+    // inside a live preview so use HTML line breaks and space accordingly
+    $eol      = '<br />';
+    $spaces1  = ' ';
+    $spaces2  = str_repeat('&nbsp;', 2);
+    $spaces4  = str_repeat('&nbsp;', 4);
+  }
+
+  $json = '{' . $spaces1 .'"items"'. $spaces1 .':'. $spaces1 .'['. $eol;
+
+  $more_view_results = FALSE;
+  foreach ($view->result as $node) {
+    $json .= ($more_view_results ? ','. $eol : '') . $spaces2 .'{'. $eol;
+    $json .= $spaces4 .'"type"'. $spaces1 .':'. $spaces1 .'"'.'##type##'.'",'. $eol;
+    $json .= $spaces4 .'"label"'. $spaces1 .':'. $spaces1 .'"'.'##label##'.'",'. $eol;
+
+    $more_fields = FALSE;
+    foreach ($node as $field_label => $field_value) {
       $label = trim(views_json_strip_illegal_chars(views_json_encode_special_chars($field_label)));
       $value = views_json_encode_special_chars(trim(views_json_is_date($field_value)));
       if ((is_null($value)) || ($value == '')) continue;
-//      if (preg_match('/\d/', $value)) {
-//        if (strtotime($value))
-//          $value = gmstrftime(EXHIBIT_DATE_FORMAT, strtotime($value));
+
+//    if (preg_match('/\d/', $value)) {
+//      if (strtotime($value)) {
+//        $value = gmstrftime(EXHIBIT_DATE_FORMAT, strtotime($value));
 //      }
-      $label = str_replace('_value', '', str_replace("profile_values_profile_", '', $label)); //strip out Profile: from profile fields
-      if ($label == 'type') $json = str_replace('##type##', $value, $json);
-      elseif ($label == 'label') $json = str_replace('##label##', $value, $json);
-      else $json.=str_repeat(" ", 8).'"'.$label.'"'. " ".": ".'"'.$value.'"'.((++$field_count == $total_field_count) ? "":",")."\n";
-  	}
-    if (strpos($json, '##type##') !== false) 
-   	$json = str_replace('##type##', (isset($node->type) ? $node->type : 'Item'), $json);
-    if (strpos($json, '##label##') !== false) 
-    $json = str_replace('##label##', (isset($node->title) ? $node->title : 'none'), $json);
-  	$json.=str_repeat(" ", 6)."}".((++$view_result_count == $total_view_result_count) ? "":",")."\n";
-  }
-  $json.=str_repeat(" ", 4)."]\n}";
-  
-  if ($view->override_path) { //inside a live preview so just output the text
-  	print $json; 
+//    }
+
+      // strip out Profile: from profile fields
+      $label = str_replace('_value', '', str_replace('profile_values_profile_', '', $label));
+
+      if ($view->override_path) {
+        $value = check_plain($value);
+      }
+
+      if ($label == 'type') {
+        $json = str_replace('##type##', $value, $json);
+      }
+      elseif ($label == 'label') {
+        $json = str_replace('##label##', $value, $json);
+      }
+      else {
+        $json .= ($more_fields ? ','. $eol : '') . $spaces4 .'"'. $label .'"'. $spaces1 .':'. $spaces1 .'"'. $value .'"';
+      }
+    }
+
+    if (strpos($json, '##type##') !== FALSE) {
+      $json = str_replace('##type##', (isset($node->type) ? $node->type : 'Item'), $json);
+    }
+    if (strpos($json, '##label##') !== FALSE) {
+      $json = str_replace('##label##', (isset($node->title) ? $node->title : 'none'), $json);
+    }
+
+    $json .= $eol . $spaces2 .'}';
+
+    $more_view_results = TRUE;
   }
-  else { //real deal so switch the content type and stop further processing of the page
+
+  $json .= ']'. $spaces1 .'}';
+
+  if ($view->override_path) {
+    // we're inside a live preview so pretty-print the JSON
+    print '<code>'. $json .'</code>';
+  }
+  elseif ($coder_mode) {
+    // we're in "coder" mode so just output the JSON
+    print $json;
+  }
+  else {
+    // we're in callback mode so switch the content type and stop further processing of the page
     drupal_set_header('Content-Type: text/javascript');
     print $json;
     module_invoke_all('exit');
     exit;
- }
-
+  }
 }
diff -u -p -r vd0/views-view-rdf.tpl.php vd4/views-view-rdf.tpl.php
--- vd0/views-view-rdf.tpl.php	2009-05-21 21:25:41.000000000 -0400
+++ vd4/views-view-rdf.tpl.php	2009-10-15 19:10:51.000000000 -0400
@@ -1,7 +1,7 @@
 <?php
-// $Id: views-view-rdf.tpl.php,v 1.1.2.8 2009/05/22 01:25:41 allisterbeharry Exp $
+// $Id$
 /**
- * @file views-view-rdf.tpl.php
+ * @file
  * View template to render views as RDF. Supports FOAF and SIOC vocabulary.
  *
  * - $view: The view in use.
@@ -18,11 +18,13 @@ if ($options['vocabulary'] == 'SIOC') rd
 /**
  * Render nodes as FOAF in XML
  *
- * @param array $nodes
- * @return none
+ * @param $view
+ *   The view containing the nodes to render
+ * @return
+ *   FOAF XML
  */
 function rdf_foaf_xml_render($view) {
-	global $base_url;
+  global $base_url;
   $xml .= '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
   $xml .= '<!-- generator="Drupal Views_Datasource.Module" -->'."\n";
   $xml .= '<rdf:RDF xmlns="http://xmlns.com/foaf/0.1"'."\n";
@@ -31,120 +33,123 @@ function rdf_foaf_xml_render($view) {
   $xml .= '  xmlns:dc="http://purl.org/dc/elements/1.1/"'."\n";
   $xml .= '  xmlns:foaf="http://xmlns.com/foaf/0.1/">'."\n";
   foreach ($view->result as $node) {
-    $xml.="<foaf:Person>";
-    foreach($node as $field_label => $field_value) {
+    $xml .= "<foaf:Person>";
+    foreach ($node as $field_label => $field_value) {
       $label = views_rdf_strip_illegal_chars($field_label);
       $value = views_xml_strip_illegal_chars(views_xml_is_date($field_value));
       if (is_null($value) || ($value === '')) continue;
-//      if (strtotime($value))
+//      if (strtotime($value)) {
 //        $value = date(DATE_ISO8601, strtotime($value));
-      if (stripos($label, 'firstname') !== false) {
-        $xml.="  <foaf:firstName>$value</foaf:firstName>\n";
+//      }
+      if (stripos($label, 'firstname') !== FALSE) {
+        $xml .= "  <foaf:firstName>$value</foaf:firstName>\n";
         continue;
-      }      
-      if (stripos($label, 'surname') !== false) {
-        $xml.="  <foaf:surName>$value</foaf:surName>\n";
+      }
+      if (stripos($label, 'surname') !== FALSE) {
+        $xml .= "  <foaf:surName>$value</foaf:surName>\n";
         continue;
-      }      
-      if ((stripos($label, 'name') == true) && ((stripos($label, 'surname') === false) && (stripos($label, 'firstname') === false))) {
-        //if (stripos($xml, "<foaf:name>") === false)
-          $xml.="  <foaf:name>$value</foaf:name>\n";
+      }
+      if ((stripos($label, 'name') == TRUE) && ((stripos($label, 'surname') === FALSE) && (stripos($label, 'firstname') === FALSE))) {
+        // if (stripos($xml, "<foaf:name>") === FALSE)
+        $xml .= "  <foaf:name>$value</foaf:name>\n";
         continue;
       }
-      if (stripos($label, 'title') !== false) {
-        $xml.="  <foaf:title>$value</foaf:title>\n";
+      if (stripos($label, 'title') !== FALSE) {
+        $xml .= "  <foaf:title>$value</foaf:title>\n";
         continue;
       }
-      if (stripos($label, 'nick') !== false) {
-        $xml.="  <foaf:nick>$value</foaf:nick>\n";
+      if (stripos($label, 'nick') !== FALSE) {
+        $xml .= "  <foaf:nick>$value</foaf:nick>\n";
         continue;
       }
-      if ((stripos($label, 'mbox') !== false) && !(stripos($label, 'mbox_sha1sum') !== false)) {
-        $xml.="  <foaf:mbox>$value</foaf:mbox>\n";
+      if ((stripos($label, 'mbox') !== FALSE) && !(stripos($label, 'mbox_sha1sum') !== FALSE)) {
+        $xml .= "  <foaf:mbox>$value</foaf:mbox>\n";
         continue;
       }
-      if ((stripos($label, 'mail') == true) && (stripos($xml, '<foaf:mbox>') == false)) {
-          $xml.="  <foaf:mbox>$value</foaf:mbox>\n";
-          $xml.="  <foaf:mbox_sha1sum>".md5("mailto:".$value)."</foaf:mbox_sha1sum>\n";
+      if ((stripos($label, 'mail') == TRUE) && (stripos($xml, '<foaf:mbox>') == FALSE)) {
+          $xml .= "  <foaf:mbox>$value</foaf:mbox>\n";
+          $xml .= "  <foaf:mbox_sha1sum>". md5("mailto:". $value) ."</foaf:mbox_sha1sum>\n";
         continue;
       }
-      if (stripos($label, 'mbox_sha1sum') !== false) {
-        $xml.="  <foaf:mbox_sha1sum>$value</foaf:mbox_sha1sum>\n";
+      if (stripos($label, 'mbox_sha1sum') !== FALSE) {
+        $xml .= "  <foaf:mbox_sha1sum>$value</foaf:mbox_sha1sum>\n";
         continue;
       }
-      if (stripos($label, 'openid') !== false) {
-        $xml.="  <foaf:openid>$value</foaf:openid>\n";
+      if (stripos($label, 'openid') !== FALSE) {
+        $xml .= "  <foaf:openid>$value</foaf:openid>\n";
         continue;
       }
-      if (strpos($label, 'workplaceHomepage') !== false) {
-        $xml.='  <foaf:workplaceHomepage rdf:resource="'.$value.'"/>'."\n";
+      if (strpos($label, 'workplaceHomepage') !== FALSE) {
+        $xml .= '  <foaf:workplaceHomepage rdf:resource="'. $value .'"/>'."\n";
         continue;
       }
-      if (strpos($label, 'homepage') !== false) {
-        $xml.='  <foaf:homepage rdf:resource="'.$value.'"/>'."\n";
+      if (strpos($label, 'homepage') !== FALSE) {
+        $xml .= '  <foaf:homepage rdf:resource="'. $value .'"/>'."\n";
         continue;
-      } 
-      if (stripos($label, 'weblog') !== false) {
-        $xml.='  <foaf:weblog rdf:resource="'.$value.'"/>'."\n";
+      }
+      if (stripos($label, 'weblog') !== FALSE) {
+        $xml .= '  <foaf:weblog rdf:resource="'. $value .'"/>'."\n";
         continue;
       }
-      if (strpos($label, 'img') !== false) {
-        $xml.='  <foaf:img rdf:resource="'.$value.'"/>'."\n";
-        $xml.='  <foaf:depiction rdf:resource="'.$value.'"/>'."\n";
+      if (strpos($label, 'img') !== FALSE) {
+        $xml .= '  <foaf:img rdf:resource="'. $value .'"/>'."\n";
+        $xml .= '  <foaf:depiction rdf:resource="'. $value .'"/>'."\n";
         continue;
       }
-      if (stripos($label, 'member') !== false) {
-        $xml.="  <foaf:member>$value</foaf:member>\n";
+      if (stripos($label, 'member') !== FALSE) {
+        $xml .= "  <foaf:member>$value</foaf:member>\n";
         continue;
-      }      
-      if (stripos($label, 'phone') !== false) {
-        $xml.="  <foaf:phone>$value</foaf:phone>\n";
+      }
+      if (stripos($label, 'phone') !== FALSE) {
+        $xml .= "  <foaf:phone>$value</foaf:phone>\n";
         continue;
       }
-      if (stripos($label, 'jabberID') !== false) {
-        $xml.="  <foaf:jabberID>$value</foaf:jabberID>\n";
+      if (stripos($label, 'jabberID') !== FALSE) {
+        $xml .= "  <foaf:jabberID>$value</foaf:jabberID>\n";
         continue;
       }
-      if (stripos($label, 'msnChatID') !== false) {
-        $xml.="  <foaf:msnChatID>$value</foaf:msnChatID>\n";
+      if (stripos($label, 'msnChatID') !== FALSE) {
+        $xml .= "  <foaf:msnChatID>$value</foaf:msnChatID>\n";
         continue;
       }
-      if (stripos($label, 'aimChatID') !== false) {
-        $xml.="  <foaf:aimChatID>$value</foaf:aimChatID>\n";
+      if (stripos($label, 'aimChatID') !== FALSE) {
+        $xml .= "  <foaf:aimChatID>$value</foaf:aimChatID>\n";
         continue;
       }
-      if (stripos($label, 'yahooChatID') !== false) {
-        $xml.="  <foaf:yahooChatID>$value</foaf:yahooChatID>\n";
+      if (stripos($label, 'yahooChatID') !== FALSE) {
+        $xml .= "  <foaf:yahooChatID>$value</foaf:yahooChatID>\n";
         continue;
-      }            
+      }
     }
-    $xml.="</foaf:Person>\n";
+    $xml .= "</foaf:Person>\n";
   }
-  $xml.="</rdf:RDF>\n";
-  if ($view->override_path) //inside live preview 
+  $xml .= "</rdf:RDF>\n";
+  if ($view->override_path) {       // inside live preview
     print htmlspecialchars($xml);
-  else {  
+  }
+  else {
     drupal_set_header('Content-Type: application/rdf+xml');
     print $xml;
     module_invoke_all('exit');
     exit;
-  }  
-  
+  }
 }
 
 /**
  * Render users, blog and forum posts and comments, as SIOC in XML
  *
- * @param object $view
- * @return none
+ * @param $view
+ *   The view containing the fields to render
+ * @return
+ *   SIOC XML
  */
 function rdf_sioc_xml_render($view) {
-	//var_dump($view);
-	//module_invoke_all('exit');
-  //exit;
-	global $base_url;
-	$xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
-	$xml .= '<!-- generator="Drupal Views_Datasource.Module" -->'."\n";
+  // var_dump($view);
+  // module_invoke_all('exit');
+  // exit;
+  global $base_url;
+  $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
+  $xml .= '<!-- generator="Drupal Views_Datasource.Module" -->'."\n";
   $xml .= "<rdf:RDF\r\n";
   $xml .= "  xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\r\n";
   $xml .= "  xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\"\r\n";
@@ -155,166 +160,167 @@ function rdf_sioc_xml_render($view) {
   $xml .= "  xmlns:admin=\"http://webns.net/mvcb/\"\r\n";
   $xml .= "  xmlns:foaf=\"http://xmlns.com/foaf/0.1/\">\r\n";
   if ($view->base_table == 'users') {
-  	$has_uid = false;
-  	$has_name = false;
-  	$has_email = false;
-    foreach($view->field as $field) {
-    	//if (($field->field_alias == 'uid') && ($field['options']['field'] ==  'uid'))
-    	if ($field->options['field'] ==  'uid') 
-    	  $has_uid = true;
-    	if ($field->options['field'] ==  'name') 
-        $has_name = true;
-      if ($field->options['field'] ==  'mail') 
-        $has_email = true;   
-    }
-  	if (!$has_uid) {
-  		if ($view->override_path)
-  		  print ('<b style="color:red">The uid field must be present.</b>');
-      else
-  	    drupal_set_message('The uid field must be present.', 'error');
-  	  return;
-  	}
+    $has_uid = FALSE;
+    $has_name = FALSE;
+    $has_email = FALSE;
+    foreach ($view->field as $field) {
+      // if (($field->field_alias == 'uid') && ($field['options']['field'] == 'uid'))
+      if ($field->options['field'] == 'uid')
+        $has_uid = TRUE;
+      if ($field->options['field'] == 'name')
+        $has_name = TRUE;
+      if ($field->options['field'] == 'mail')
+        $has_email = TRUE;
+    }
+    if (!$has_uid) {
+      if ($view->override_path)
+        print '<b style="color:red">The uid field must be present.</b>';
+      else
+        drupal_set_message(t('The uid field must be present.'), 'error');
+      return;
+    }
     if (!$has_name) {
       if ($view->override_path)
-        print ('<b style="color:red">The name field must be present.</b>');
+        print '<b style="color:red">The name field must be present.</b>';
       else
-        drupal_set_message('The name field must be present.', 'error');
+        drupal_set_message(t('The name field must be present.'), 'error');
       return;
     }
     if (!$has_email) {
       if ($view->override_path)
-        print ('<b style="color:red">The email field must be present.</b>');
+        print '<b style="color:red">The email field must be present.</b>';
       else
-        drupal_set_message('The email field must be present.', 'error');
+        drupal_set_message(t('The email field must be present.'), 'error');
       return;
-    } 
-    $xml .= "<foaf:Document rdf:about=\"".url($view->name, array('absolute'=>true))."\">\n";
-    $xml .= "  <dc:title>SIOC user profiles for: ".variable_get('site_name', 'drupal')."</dc:title>\n";
+    }
+    $xml .= "<foaf:Document rdf:about=\"". url($view->name, array('absolute' => TRUE)) ."\">\n";
+    $xml .= "  <dc:title>SIOC user profiles for: ". variable_get('site_name', 'drupal') ."</dc:title>\n";
     $xml .= "  <dc:description>\n";
-    $xml .= "    A User is an online account of a member of an online community. 
-     It is connected to Items and Posts that a User creates or edits, 
-     to Containers and Forums that it is subscribed to or moderates and 
-     to Sites that it administers. Users can be grouped for purposes of 
-     allowing access to certain Forums or enhanced community site features (weblogs, webmail, etc.).
-     A foaf:Person will normally hold a registered User account on a Site 
-     (through the property foaf:holdsAccount), and will use this account 
-     to create content and interact with the community. sioc:User describes 
-     properties of an online account, and is used in combination with a 
-     foaf:Person (using the property sioc:account_of) which describes 
-     information about the individual itself.\n";
+    $xml .= "    A User is an online account of a member of an online community. ";
+    $xml .= "It is connected to Items and Posts that a User creates or edits, ";
+    $xml .= "to Containers and Forums that it is subscribed to or moderates and ";
+    $xml .= "to Sites that it administers. Users can be grouped for purposes of ";
+    $xml .= "allowing access to certain Forums or enhanced community site features (weblogs, webmail, etc.).";
+    $xml .= "A foaf:Person will normally hold a registered User account on a Site ";
+    $xml .= "(through the property foaf:holdsAccount), and will use this account ";
+    $xml .= "to create content and interact with the community. sioc:User describes ";
+    $xml .= "properties of an online account, and is used in combination with a ";
+    $xml .= "foaf:Person (using the property sioc:account_of) which describes ";
+    $xml .= "information about the individual itself.\n";
     $xml .= "  </dc:description>\n";
     $xml .= "####foaf_topics####\n";
     $xml .= "  <admin:generatorAgent rdf:resource=\"http://drupal.org/project/views_datasource\"/>\n";
     $xml .= "</foaf:Document>\n";
-    foreach($view->result as $node) $xml .= rdf_sioc_xml_user_render($node);     
+    foreach ($view->result as $node) $xml .= rdf_sioc_xml_user_render($node);
   }
   if ($view->base_table == 'node') {
-    $has_nid = false;
-    $has_type = false;
-    $has_created = false;
-    $has_changed = false;
-    $has_last_updated = false;
-    $has_title = false;
-    $has_body = false;
-    $has_uid = false;
-    foreach($view->field as $field) {
-      //if (($field->field_alias == 'uid') && ($field['options']['field'] ==  'uid'))
-      if ($field->options['field'] ==  'nid') 
-        $has_nid = true;
-      if ($field->options['field'] ==  'type') 
-        $has_type = true;
-      if ($field->options['field'] ==  'created') 
-        $has_created = true;
-      if ($field->options['field'] ==  'changed') 
-        $has_changed = true;
-      if ($field->options['field'] ==  'last_updated') 
-        $has_last_updated = true;
-      if ($field->options['field'] ==  'title') 
-        $has_title = true;
+    $has_nid = FALSE;
+    $has_type = FALSE;
+    $has_created = FALSE;
+    $has_changed = FALSE;
+    $has_last_updated = FALSE;
+    $has_title = FALSE;
+    $has_body = FALSE;
+    $has_uid = FALSE;
+    foreach ($view->field as $field) {
+      // if (($field->field_alias == 'uid') && ($field['options']['field'] ==  'uid'))
+      if ($field->options['field'] == 'nid')
+        $has_nid = TRUE;
+      if ($field->options['field'] == 'type')
+        $has_type = TRUE;
+      if ($field->options['field'] == 'created')
+        $has_created = TRUE;
+      if ($field->options['field'] == 'changed')
+        $has_changed = TRUE;
+      if ($field->options['field'] == 'last_updated')
+        $has_last_updated = TRUE;
+      if ($field->options['field'] == 'title')
+        $has_title = TRUE;
       if ($field->options['field'] == 'body')
-        $has_body = true;
-      if ($field->options['field'] ==  'uid') 
-        $has_uid = true;        
+        $has_body = TRUE;
+      if ($field->options['field'] == 'uid')
+        $has_uid = TRUE;
     }
     if (!$has_nid) {
       if ($view->override_path)
-        print ('<b style="color:red">The Node: Nid field must be present.</b>');
+        print '<b style="color:red">The Node: Nid field must be present.</b>';
       else
-        drupal_set_message('The Node: Nid field must be present.', 'error');
+        drupal_set_message(t('The Node: Nid field must be present.'), 'error');
       return;
     }
     if (!$has_type) {
       if ($view->override_path)
-        print ('<b style="color:red">The Node: Type field must be present.</b>');
+        print '<b style="color:red">The Node: Type field must be present.</b>';
       else
-        drupal_set_message('The Node: Type field must be present.', 'error');
+        drupal_set_message(t('The Node: Type field must be present.'), 'error');
       return;
     }
     if (!$has_created) {
       if ($view->override_path)
-        print ('<b style="color:red">The Node: Post date field must be present.</b>');
+        print '<b style="color:red">The Node: Post date field must be present.</b>';
       else
-        drupal_set_message('The Node: Post date field must be present.', 'error');
+        drupal_set_message(t('The Node: Post date field must be present.'), 'error');
       return;
     }
     if (!$has_changed) {
       if ($view->override_path)
-        print ('<b style="color:red">The Node: Updated date field must be present.</b>');
+        print '<b style="color:red">The Node: Updated date field must be present.</b>';
       else
-        drupal_set_message('The Node: Updated date field must be present.', 'error');
+        drupal_set_message(t('The Node: Updated date field must be present.'), 'error');
       return;
     }
     if (!$has_last_updated) {
       if ($view->override_path)
-        print ('<b style="color:red">The Node: Updated/commented date field must be present.</b>');
+        print '<b style="color:red">The Node: Updated/commented date field must be present.</b>';
       else
-        drupal_set_message('The Node: Updated/commented date field must be present.', 'error');
+        drupal_set_message(t('The Node: Updated/commented date field must be present.'), 'error');
       return;
     }
     if (!$has_title) {
       if ($view->override_path)
-        print ('<b style="color:red">The Node: Title field must be present.</b>');
+        print '<b style="color:red">The Node: Title field must be present.</b>';
       else
-        drupal_set_message('The Node: Title field must be present.', 'error');
+        drupal_set_message(t('The Node: Title field must be present.'), 'error');
       return;
     }
     if (!$has_body) {
       if ($view->override_path)
-        print ('<b style="color:red">The Node: Body field must be present.</b>');
+        print '<b style="color:red">The Node: Body field must be present.</b>';
       else
-        drupal_set_message('The Node: Body field must be present.', 'error');
+        drupal_set_message(t('The Node: Body field must be present.'), 'error');
       return;
-    }    
+    }
     if (!$has_uid) {
       if ($view->override_path)
-        print ('<b style="color:red">The User: Uid field must be present.</b>');
+        print '<b style="color:red">The User: Uid field must be present.</b>';
       else
-        drupal_set_message('The User: Uid field must be present.', 'error');
+        drupal_set_message(t('The User: Uid field must be present.'), 'error');
       return;
     }
     $users = array();
     $nodes = array();
-    $xml .= "<foaf:Document rdf:about=\"".url($view->name, array('absolute'=>true))."\">\n";
-    $xml .= "  <dc:title>SIOC profile for: ".variable_get('site_name', 'drupal')."</dc:title>\n";
+    $xml .= "<foaf:Document rdf:about=\"". url($view->name, array('absolute' => TRUE)) ."\">\n";
+    $xml .= "  <dc:title>SIOC profile for: ". variable_get('site_name', 'drupal') ."</dc:title>\n";
     $xml .= "  <dc:description>\n";
-    $xml .= "    A SIOC profile describes the structure and contents of a weblog in a machine readable form. For more information please refer to http://sioc-project.org/.
-    A Post is an article or message posted by a User to a Forum or Site. A series of Posts 
-    may be threaded if they share a common subject and are connected by reply or 
-    by date relationships. Posts will have content and may also have attached 
-    files, which can be edited or deleted by the Moderator of the Forum or Site that 
-    contains the Post.\n";
+    $xml .= "    A SIOC profile describes the structure and contents of a weblog in a machine readable form. For more information please refer to http://sioc-project.org/.";
+    $xml .= "A Post is an article or message posted by a User to a Forum or Site. A series of Posts ";
+    $xml .= "may be threaded if they share a common subject and are connected by reply or ";
+    $xml .= "by date relationships. Posts will have content and may also have attached ";
+    $xml .= "files, which can be edited or deleted by the Moderator of the Forum or Site that ";
+    $xml .= "contains the Post.\n";
     $xml .= "  </dc:description>\n";
-    //$xml .= "  <foaf:primaryTopic rdf:resource=\"$node_url\"/>\n";
+    // $xml .= "  <foaf:primaryTopic rdf:resource=\"$node_url\"/>\n";
     $xml .= "  <admin:generatorAgent rdf:resource=\"http://drupal.org/project/views_datasource\"/>\n";
     $xml .= "</foaf:Document>\n";
-    foreach($view->result as $node) rdf_sioc_xml_node_render($node, &$users, &$nodes);
+    foreach ($view->result as $node) rdf_sioc_xml_node_render($node, &$users, &$nodes);
     foreach ($users as $user_xml) $xml .= $user_xml;
     foreach ($nodes as $node_xml) $xml .= $node_xml;
   }
-  $xml.="</rdf:RDF>\n";
-  if ($view->override_path) //inside live preview 
+  $xml .= "</rdf:RDF>\n";
+  if ($view->override_path) {       // inside live preview
     print htmlspecialchars($xml);
-  else {  
+  }
+  else {
     drupal_set_header('Content-Type: application/rdf+xml');
     print $xml;
     module_invoke_all('exit');
@@ -322,116 +328,118 @@ function rdf_sioc_xml_render($view) {
   }
 }
 
-function rdf_sioc_xml_user_render($node, $uid=null, $user_name=null, $user_email=null) {
+function rdf_sioc_xml_user_render($node, $uid = NULL, $user_name = NULL, $user_email = NULL) {
   if (func_num_args() == 1) {
-	  foreach($node as $field_label=>$field_value) {
+    foreach ($node as $field_label => $field_value) {
       $label = views_rdf_strip_illegal_chars($field_label);
       $value = views_xml_strip_illegal_chars(views_xml_is_date($field_value));
       if (is_null($value) || ($value === '')) continue;
 //      if (strtotime($value))
 //        $value = date(DATE_ISO8601, strtotime($value));
-      if ((strtolower($label) == 'id') || (strtolower($label) == 'uid')) {
-        $uid = $value;      
+      if ((drupal_strtolower($label) == 'id') || (drupal_strtolower($label) == 'uid')) {
+        $uid = $value;
+      }
+      if ((drupal_strtolower($label) == 'name') || (drupal_strtolower($label) == 'users_name')) {
+        $user_name = $value;
       }
-      if ((strtolower($label) == 'name') || (strtolower($label) == 'users_name')) {
-        $user_name = $value;      
+      if ((drupal_strtolower($label) == 'email') || (drupal_strtolower($label) == 'users_mail')) {
+        $user_email = $value;
       }
-      if ((strtolower($label) == 'email') || (strtolower($label) == 'users_mail')) {
-        $user_email = $value;      
-      }            
     }
     if (empty($user_name)) return;
   }
-  $xml .="<foaf:Person rdf:about=\"".url('user/'.$uid, array('absolute'=>true))."\">\n";
+  $xml .="<foaf:Person rdf:about=\"". url('user/'. $uid, array('absolute' => TRUE)) ."\">\n";
   $xml .="  <foaf:name>$user_name</foaf:name>\n";
-  $xml .="  <foaf:mbox_sha1sum>".md5('mailto:'.$user_email)."</foaf:mbox_sha1sum>\n";
+  $xml .="  <foaf:mbox_sha1sum>". md5('mailto:'. $user_email) ."</foaf:mbox_sha1sum>\n";
   $xml .="  <foaf:holdsAccount>\n";
   $xml .="    <sioc:User rdf:nodeID=\"$uid\">\n";
   $xml .="      <sioc:name>$user_name</sioc:name>\n";
   $xml .="      <sioc:email rdf:resource=\"mailto:$user_email\"/>\n";
-  $xml .="      <sioc:email_sha1>".md5('mailto:'.$user_email)."</sioc:email_sha1>\n";
-  $xml .="      <sioc:link rdf:resource=\"".url('user/'.$uid, array('absolute'=>true))."\" rdfs:label=\"$user_name\"/>\n";
+  $xml .="      <sioc:email_sha1>". md5('mailto:'. $user_email) ."</sioc:email_sha1>\n";
+  $xml .="      <sioc:link rdf:resource=\"". url('user/'. $uid, array('absolute' => TRUE)) ."\" rdfs:label=\"$user_name\"/>\n";
   $roles = array();
   $roles_query = db_query("SELECT r.name AS name, r.rid AS rid FROM {users_roles} ur, {role} r WHERE ur.uid = %d AND ur.rid = r.rid", $uid);
   while ($role = db_fetch_object($roles_query)) $roles[$role->rid] = $role->name;
   if (count($roles) > 0) {
     $xml .="      <sioc:has_function>\n";
-    foreach($roles as $rid=>$name)
+    foreach ($roles as $rid => $name)
     $xml .="        <sioc:Role><rdfs:label><![CDATA[$name]]></rdfs:label></sioc:Role>\n";
-    $xml .="      </sioc:has_function>\n";    
-  }             
+    $xml .="      </sioc:has_function>\n";
+  }
   $xml .="    </sioc:User>\n";
   $xml .="  </foaf:holdsAccount>\n";
-  $xml .="</foaf:Person>\n";  
-	return $xml;
+  $xml .="</foaf:Person>\n";
+  return $xml;
 }
 
-function rdf_sioc_xml_node_render($node, &$users=null, &$nodes = null) {
-	global $base_url;
-  //i
-  foreach($node as $field_label=>$field_value) {
+function rdf_sioc_xml_node_render($node, &$users = NULL, &$nodes = NULL) {
+  global $base_url;
+  // i
+  foreach ($node as $field_label => $field_value) {
     $label = views_rdf_strip_illegal_chars($field_label);
     $value = views_rdf_strip_illegal_chars(views_rdf_is_date($field_value));
     if (is_null($value) || ($value === '')) continue;
 //    if (strtotime($value))
 //      $value = date(DATE_ISO8601, strtotime($value));
-    if ((strtolower($label) == 'id') || (strtolower($label) == 'nid')) {
-      $nid = $value;      
+    if ((drupal_strtolower($label) == 'id') || (drupal_strtolower($label) == 'nid')) {
+      $nid = $value;
     }
-    if ((strtolower($label) == 'title') || (strtolower($label) == 'node_title')) {
-      $title = $value;      
+    if ((drupal_strtolower($label) == 'title') || (drupal_strtolower($label) == 'node_title')) {
+      $title = $value;
     }
-    if ((strtolower($label) == 'body') || (strtolower($label) == 'node_revisions_body')) {
-      $body = $value;      
+    if ((drupal_strtolower($label) == 'body') || (drupal_strtolower($label) == 'node_revisions_body')) {
+      $body = $value;
     }
-    if ((strtolower($label) == 'type') || (strtolower($label) == 'node_type')) {
-      $type = $value;      
+    if ((drupal_strtolower($label) == 'type') || (drupal_strtolower($label) == 'node_type')) {
+      $type = $value;
     }
-    if ((strtolower($label) == 'created') || (strtolower($label) == 'node_created')) {
+    if ((drupal_strtolower($label) == 'created') || (drupal_strtolower($label) == 'node_created')) {
       $created = $value;
     }
-    if ((strtolower($label) == 'changed') || (strtolower($label) == 'node_changed')) {
-      $changed = $value;      
-    }            
-    if ((strtolower($label) == 'last_updated') || (strtolower($label) == 'node_comment_statistics_last_updated')) {
-      $last_updated = $value;      
-    }
-    if ((strtolower($label) == 'uid') || (strtolower($label) == 'users_uid')) {
-      $uid = $value;      
-    }    
+    if ((drupal_strtolower($label) == 'changed') || (drupal_strtolower($label) == 'node_changed')) {
+      $changed = $value;
+    }
+    if ((drupal_strtolower($label) == 'last_updated') || (drupal_strtolower($label) == 'node_comment_statistics_last_updated')) {
+      $last_updated = $value;
+    }
+    if ((drupal_strtolower($label) == 'uid') || (drupal_strtolower($label) == 'users_uid')) {
+      $uid = $value;
+    }
   }
-  $user = user_load($uid);  
-  if (!array_key_exists($uid, $users)) $users[$uid] = rdf_sioc_xml_user_render(null, $uid, $user->name, $user->mail);
+  $user = user_load($uid);
+  if (!array_key_exists($uid, $users)) $users[$uid] = rdf_sioc_xml_user_render(NULL, $uid, $user->name, $user->mail);
   if (!array_key_exists($nid, $nodes)) {
-    if (($type == 'page') || ($type == 'story') || ($type == 'forum') || ($type == 'blog')) $nodes[$nid] = rdf_sioc_xml_story_render($xml, $nid, $title, $type, $created, $changed, $last_updated, $uid, $body);  	
+    if (($type == 'page') || ($type == 'story') || ($type == 'forum') || ($type == 'blog')) {
+      $nodes[$nid] = rdf_sioc_xml_story_render($xml, $nid, $title, $type, $created, $changed, $last_updated, $uid, $body);
+    }
   }
-  //$xml = '';
-  //var_dump($nodes);
-  //var_dump($users);
-  //module_invoke_all('exit');
+  // $xml = '';
+  // var_dump($nodes);
+  // var_dump($users);
+  // module_invoke_all('exit');
   return;
 }
 
 function rdf_sioc_xml_story_render($xml, $nid, $title, $type, $created, $changed, $last_updated, $uid, $body) {
-	$node_url = url($nid, array('absolute'=>true));
+  $node_url = url($nid, array('absolute' => TRUE));
   $xml .= "<sioc:Post rdf:about=\"$node_url\">\n";
   $xml .= "  <dc:title>$title</dc:title>\n";
   $xml .= "  <sioc:content>\n ";
   $xml .= "    <![CDATA[$body]]>\n";
   $xml .= "  </sioc:content>\n";
-  $xml .= "  <dc:created>".date(DATE_ISO8601, $created)."</dc:created>\n";
-  $xml .= "  <dc:modified>".date(DATE_ISO8601, $changed)."</dc:modified>\n";
+  $xml .= "  <dc:created>". format_date($created, 'custom', DATE_ISO8601) ."</dc:created>\n";
+  $xml .= "  <dc:modified>". format_date($changed, 'custom', DATE_ISO8601) ."</dc:modified>\n";
   $xml .= "  <sioc:link rdf:resource=\"$node_url\" rdfs:label=\"$title\" />\n";
   $xml .= "  <sioc:has_creator rdf:nodeID=\"$uid\"/>\n";
-  
-  /*Add taxonomy terms as SIOC topics*/
+
+  /* Add taxonomy terms as SIOC topics */
   $query = db_query('SELECT tn.tid AS tid, td.name AS name FROM {term_node} tn, {term_data} td WHERE td.tid = tn.tid AND tn.nid = %d', $nid);
   while ($term = db_fetch_object($query)) {
-    $taxonomy_terms = "  <sioc:topic rdfs:label=\"$term->name\" rdf:resource=\"".url("taxonomy/term/$term->tid", array('absolute' => TRUE))."\" />\n";
+    $taxonomy_terms = "  <sioc:topic rdfs:label=\"$term->name\" rdf:resource=\"". url("taxonomy/term/$term->tid", array('absolute' => TRUE)) ."\" />\n";
   }
   $xml .= $taxonomy_terms;
-  
-  /*Add comments as SIOC replies*/
+
+  /* Add comments as SIOC replies */
   $query_count = 'SELECT COUNT(*) FROM {comments} WHERE nid = %d AND status = %d';
   $query = 'SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.signature, u.picture, u.data, c.thread, c.status FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.nid = %d and c.status = %d ORDER BY SUBSTRING(c.thread, 1, (LENGTH(c.thread) - 1))';
   $query_args = array($nid, COMMENT_PUBLISHED);
@@ -453,8 +461,8 @@ function rdf_sioc_xml_story_render($xml,
 //        $comment_children--;
 //        $comments .= "  </sioc:has_reply>\n";
 //      }
-//    }        
-//    $comments .="     <sioc:Post rdf:about=\"$node_url#comment-$comment->cid\">\n";    
+//    }
+//    $comments .="     <sioc:Post rdf:about=\"$node_url#comment-$comment->cid\">\n";
 //    while ($comment_children-- > 0) {
 //      $num_rows = TRUE;
 //      $comments .="       <sioc:content><![CDATA[$comment->comment]]></sioc:content>\n";
@@ -465,22 +473,22 @@ function rdf_sioc_xml_story_render($xml,
     $comments .= "  <sioc:has_reply>\n";
     $comments .= "    <sioc:Post rdf:about=\"$node_url#comment-$comment->cid\">\n";
     if ($comment->subject) $comments .= "      <dc:title>$comment->subject</dc:title>\n";
-    if ($comment->timestamp) $comments .= "      <dc:created>".date(DATE_ISO8601, $comment->timestamp)."</dc:created>\n";
+    if ($comment->timestamp) $comments .= "      <dc:created>". format_date($comment->timestamp, 'custom', DATE_ISO8601) ."</dc:created>\n";
     if ($comment->uid) {
-    	$comments .= "    <sioc:has_creator>\n";
+      $comments .= "    <sioc:has_creator>\n";
       $comments .= "      <sioc:User>\n";
       $comments .= "        <sioc:name>$comment->registered_name</sioc:name>\n";
       $comments .= "        <sioc:email rdf:resource=\"mailto:$comment->mail\"/>\n";
-      $comments .="         <sioc:link rdf:resource=\"".url('user/'.$comment->uid, array('absolute'=>true))."\" rdfs:label=\"$comment->registered_name\"/>\n";
-  	  $comments .= "      </sioc:User>\n";
-  	  $comments .= "    </sioc:has_creator>\n";
-    }    	    
+      $comments .="         <sioc:link rdf:resource=\"". url('user/'. $comment->uid, array('absolute' => TRUE)) ."\" rdfs:label=\"$comment->registered_name\"/>\n";
+      $comments .= "      </sioc:User>\n";
+      $comments .= "    </sioc:has_creator>\n";
+    }
     $comments .= "      <sioc:content><![CDATA[$comment->comment]]></sioc:content>\n";
     $comments .= "    </sioc:Post>\n";
     $comments .= "  </sioc:has_reply>\n";
   }
-  $xml.= $comments;
-  
+  $xml .= $comments;
+
   $xml .= "</sioc:Post>\n";
-	return $xml;
-}	 
\ No newline at end of file
+  return $xml;
+}
diff -u -p -r vd0/views-view-row-unformatted.tpl.php vd4/views-view-row-unformatted.tpl.php
--- vd0/views-view-row-unformatted.tpl.php	2008-07-08 15:43:38.000000000 -0400
+++ vd4/views-view-row-unformatted.tpl.php	2009-10-15 19:10:51.000000000 -0400
@@ -1,15 +1,18 @@
 <?php
-// $Id: views-view-row-unformatted.tpl.php,v 1.1.2.1 2008/07/08 19:43:38 allisterbeharry Exp $
+// $Id$
+
 /**
- * @file views-view-row-unformatted.tpl.php
+ * @file
  * Simple view template to view unformatted fields from the views query.
  *
  * - $view: The view in use.
  * - $fields: an array of $field objects. Each one contains:
  *   - $field->content: The output of the field.
- *   - $field->raw: The raw data for the field, if it exists. This is NOT output safe.
+ *   - $field->raw: The raw data for the field, if it exists.
+ *     This is NOT output safe.
  *   - $field->class: The safe class id to use.
- *   - $field->handler: The Views field handler object controlling this field. Do not use
+ *   - $field->handler: The Views field handler object controlling this field.
+ *     Do not use
  *     var_export to dump this object, as it can't handle the recursion.
  *   - $field->separator: an optional separator that may appear before a field.
  * - $row: The raw result object from the query, with all data it fetched.
@@ -18,19 +21,17 @@
  * @see views_json.views.inc
  */
 
-//print ('template');
-//print_r($fields);
-//print_r($row);
-//print_r($options);
-//foreach ($fields as $id => $field)  
-// print $id.":".$field->content."\n";
+// print ('template');
+// print_r($fields);
+// print_r($row);
+// print_r($options);
+// foreach ($fields as $id => $field)
+//   print $id.":".$field->content."\n";
 
 $field_separator = filter_xss($options['separator']);
-foreach($row as $field_label => $field_value) { 
+foreach ($row as $field_label => $field_value) {
   $label = str_replace(':', '#colon#', $field_label);
   $value = filter_xss(str_replace(':', '#colon#', $field_value));
-  $row_unformatted.=  $label.":".(!is_null($value) ? $value : "").$field_separator;
+  $row_unformatted .= $label .":". (!is_null($value) ? $value : "") . $field_separator;
 }
-print rtrim($row_unformatted, $field_separator).PHP_EOL;
-
-  
\ No newline at end of file
+print rtrim($row_unformatted, $field_separator) . PHP_EOL;
diff -u -p -r vd0/views-view-xhtml.tpl.php vd4/views-view-xhtml.tpl.php
--- vd0/views-view-xhtml.tpl.php	2009-09-08 12:43:07.000000000 -0400
+++ vd4/views-view-xhtml.tpl.php	2009-10-15 19:10:51.000000000 -0400
@@ -1,8 +1,9 @@
 <?php
-// $Id: views-view-xhtml.tpl.php,v 1.1.2.8 2009/09/08 16:43:07 allisterbeharry Exp $
+// $Id$
 /**
- * @file views-view-xhtml.tpl.php
- * View template to render views as XHTML microformats. Supports hCard and hCalendar format 
+ * @file
+ * View template to render views as XHTML microformats.
+ * Supports hCard and hCalendar format.
  *
  * - $view: The view in use.
  * - $rows: The raw result objects from the query, with all data it fetched.
@@ -11,7 +12,7 @@
  * @ingroup views_templates
  * @see views_xhtml.views.inc
  */
-  
+
 if ($options['format'] == 'hcard') xhtml_hcard_render($view);
 if ($options['format'] == 'hcalendar') xhtml_hcalendar_render($view);
 
@@ -25,219 +26,221 @@ function xhtml_hcard_render($view) {
   $xhtml .= '</head>'."\r\n";
   $xhtml .= '<body>'."\r\n";
   foreach ($view->result as $node) {
-    $hcard = array('adr'=> array(
-                           'type' => '', 
-                           'post-office-box' => '',
-                           'street-address' => array(),
-                           'extended-address' => '',
-                           'region' => '',
-                           'locality' => '',
-                           'postal-code' => '',
-                           'country-name' => ''    
-                           ),
-                   'agent' => array(),
-                   'bday' => '',
-                   'class' => '',
-                   'category' => array(),
-                   'email' => array(),
-                   'fn' => '',
-                   'n' => array(
-                          'honorific-prefix' => '',
-                          'given-name' => '',
-                          'additional-name' => '',
-                          'family-name' => '',
-                          'honorific-suffix' => ''    
-                           ),
-                   'nickname' => '',                
-                   'org' => array (
-                           'organization-name' => '',
-                           'organization-unit' => array()
-                           ),                        
-                   'photo' => '',
-                   'tel'=> array()         
-                  );
-    foreach($node as $field_label => $field_value) {
+    $hcard = array(
+      'adr' => array(
+        'type' => '',
+        'post-office-box' => '',
+        'street-address' => array(),
+        'extended-address' => '',
+        'region' => '',
+        'locality' => '',
+        'postal-code' => '',
+        'country-name' => '',
+      ),
+      'agent' => array(),
+      'bday' => '',
+      'class' => '',
+      'category' => array(),
+      'email' => array(),
+      'fn' => '',
+      'n' => array(
+        'honorific-prefix' => '',
+        'given-name' => '',
+        'additional-name' => '',
+        'family-name' => '',
+        'honorific-suffix' => '',
+      ),
+      'nickname' => '',
+      'org' => array(
+        'organization-name' => '',
+        'organization-unit' => array(),
+      ),
+      'photo' => '',
+      'tel' => array(),
+    );
+    foreach ($node as $field_label => $field_value) {
       $label = views_rdf_strip_illegal_chars($field_label);
       $value = views_xml_strip_illegal_chars(views_xml_is_date($field_value));
-      $label = str_replace('_value', '', str_replace("profile_values_profile_", '', $label)); //strip out Profile: from profile fields
+      $label = str_replace('_value', '', str_replace("profile_values_profile_", '', $label));       // strip out Profile: from profile fields
       if (is_null($value) || ($value === '')) continue;
-      //$xhtml .= "$label:$value";
+      // $xhtml .= "$label:$value";
       if (stripos($label, 'address_type') !== FALSE) {
-        $hcard['adr']['type'] = $value; 
+        $hcard['adr']['type'] = $value;
       }
-      if (stripos($label, 'post_office_box') !== FALSE) { 
-        $hcard['adr']['post-office-box'] = $value;  
+      if (stripos($label, 'post_office_box') !== FALSE) {
+        $hcard['adr']['post-office-box'] = $value;
       }
       if (stripos($label, 'street_address') !== FALSE) {
-        $hcard['adr']['street-address'][] = $value;  
+        $hcard['adr']['street-address'][] = $value;
       }
       if (stripos($label, 'extended_address') !== FALSE) {
-        $hcard['adr']['extended-address'] = $value;  
+        $hcard['adr']['extended-address'] = $value;
       }
       if (stripos($label, 'region') !== FALSE) {
-        $hcard['adr']['region'] = $value;  
+        $hcard['adr']['region'] = $value;
       }
       if (stripos($label, 'locality') !== FALSE) {
-        $hcard['adr']['locality'] = $value;  
+        $hcard['adr']['locality'] = $value;
       }
       if (stripos($label, 'postal_code') !== FALSE) {
-        $hcard['adr']['postal-code'] = $value;  
+        $hcard['adr']['postal-code'] = $value;
       }
       if (stripos($label, 'country_name') !== FALSE) {
-        $hcard['adr']['country-name'] = $value;  
+        $hcard['adr']['country-name'] = $value;
       }
       if (stripos($label, 'agent') !== FALSE) {
-        $hcard['agent'][] = $value;  
+        $hcard['agent'][] = $value;
       }
       if (stripos($label, 'bday') !== FALSE) {
         if (preg_match('/\d/', $value)) {
           if (strtotime($value))
-            $value = date(EXHIBIT_DATE_FORMAT, strtotime($value));
+            $value = format_date(strtotime($value), 'custom', EXHIBIT_DATE_FORMAT);
         }
-        $hcard['bday'] = $value;  
+        $hcard['bday'] = $value;
       }
       if (stripos($label, 'class') !== FALSE) {
-        $hcard['class'] = $value;  
+        $hcard['class'] = $value;
       }
       if (stripos($label, 'category') !== FALSE) {
-        $hcard['category'][] = $value;  
+        $hcard['category'][] = $value;
       }
       if (stripos($label, 'email') !== FALSE) {
-        $hcard['email'][$label] = $value;  
+        $hcard['email'][$label] = $value;
       }
       if (stripos($label, 'honorific_prefix') !== FALSE) {
-        $hcard['n']['honorific-prefix'] = $value;  
+        $hcard['n']['honorific-prefix'] = $value;
       }
       if (stripos($label, 'given_name') !== FALSE) {
-        $hcard['n']['given-name'] = $value;  
+        $hcard['n']['given-name'] = $value;
       }
       if (stripos($label, 'additional_name') !== FALSE) {
-        $hcard['n']['additional-name'] = $value;  
+        $hcard['n']['additional-name'] = $value;
       }
       if (stripos($label, 'family-name') !== FALSE) {
-        $hcard['n']['family-name'] = $value;  
+        $hcard['n']['family-name'] = $value;
       }
       if (stripos($label, 'honorific_suffix') !== FALSE) {
-        $hcard['n']['honorific-suffix'] = $value;  
-      }        
+        $hcard['n']['honorific-suffix'] = $value;
+      }
       if (stripos($label, 'fn') !== FALSE) {
-        $hcard['fn'] = $value;  
+        $hcard['fn'] = $value;
       }
       if (stripos($label, 'nickname') !== FALSE) {
-        $hcard['nickname'] = $value;  
+        $hcard['nickname'] = $value;
       }
       if (stripos($label, 'organization_name') !== FALSE) {
-        $hcard['org']['organization-name'] = $value;  
+        $hcard['org']['organization-name'] = $value;
       }
       if (stripos($label, 'organization_unit') !== FALSE) {
-        $hcard['org']['organization-unit'][] = $value;  
+        $hcard['org']['organization-unit'][] = $value;
       }
       if (stripos($label, 'photo') !== FALSE) {
-        $hcard['photo'] = $value;  
+        $hcard['photo'] = $value;
       }
       if (stripos($label, 'tel') === 0) {
-        $hcard['tel'][$label] = $value;  
-      }                                
-    } 
+        $hcard['tel'][$label] = $value;
+      }
+    }
     $xhtml .= '<div class = "vcard">'."\r\n";
     if ($hcard['photo'] != '')
-      $xhtml .='  <img class="photo" alt="photo" title="photo" style="height:96px;width:96px" src="'.$hcard['photo'].'"/>'."<br/>\r\n";      
+      $xhtml .= '  <img class="photo" alt="photo" title="photo" style="height:96px;width:96px" src="'. $hcard['photo'] .'"/>'."<br/>\r\n";
     if ($hcard['fn'])
-      $xhtml .='  <span class="fn">'.$hcard['fn'].'</span>'."<br/>\r\n";
+      $xhtml .= '  <span class="fn">'. $hcard['fn'] .'</span>'."<br/>\r\n";
     if ($hcard['nickname'])
-      $xhtml .='  <span class="nickname">'.$hcard['nickname'].'</span>'."<br/>\r\n";
+      $xhtml .= '  <span class="nickname">'. $hcard['nickname'] .'</span>'."<br/>\r\n";
     $name = $hcard['n'];
-    if ($hcard['fn']) 
+    if ($hcard['fn'])
       $xhtml .= '  <span class = "n">'."\r\n";
     else
       $xhtml .= '  <span class = "fn n">'."\r\n";
     if ($name['honorific-prefix'] !== '')
-      $xhtml .='    <span class="honorific-prefix">'.$name['honorific-prefix'].'</span>'."\r\n";
+      $xhtml .= '    <span class="honorific-prefix">'. $name['honorific-prefix'] .'</span>'."\r\n";
     if ($name['given-name'] !== '')
-      $xhtml .='    <span class="given-name">'.$name['given-name'].'</span>'."\r\n";
+      $xhtml .= '    <span class="given-name">'. $name['given-name'] .'</span>'."\r\n";
     if ($name['additional-name'] !== '')
-      $xhtml .='    <span class="additional-name">'.$name['additional-name'].'</span>'."\r\n";
+      $xhtml .= '    <span class="additional-name">'. $name['additional-name'] .'</span>'."\r\n";
     if ($name['family-name'] !== '')
-      $xhtml .='    <span class="family-name">'.$name['family-name'].'</span>'."\r\n";
+      $xhtml .= '    <span class="family-name">'. $name['family-name'] .'</span>'."\r\n";
     if ($name['honorific-suffix'] !== '')
-      $xhtml .='    <span class="honorific-suffix">'.$name['honorific-suffix'].'</span>'."\r\n";
+      $xhtml .= '    <span class="honorific-suffix">'. $name['honorific-suffix'] .'</span>'."\r\n";
     $xhtml .= '  </span><br/>'."\r\n";
     if ($hcard['nickname'] !== '')
-      $xhtml .= '    <span class="nickname">'.$hcard['nickname'].'</span><br/>'."\r\n";                  
+      $xhtml .= '    <span class="nickname">'. $hcard['nickname'] .'</span><br/>'."\r\n";
     $org = $hcard['org'];
     $xhtml .= '  <span class="org">'."\r\n";
     if ($org['organization-name'] !== '')
-      $xhtml.= '    <span class="organization name">'.$org['organization-name'].'</span><br/>'."\r\n";
-    $org_units = $org['organization-unit'];  
-    foreach ($org_units as $org_unit) 
-      $xhtml .='    <span class="organization-unit">'.$org_unit.'</span>'."<br/>\r\n";
-    $xhtml .= '  </span>'."\r\n";  
+      $xhtml .= '    <span class="organization name">'. $org['organization-name'] .'</span><br/>'."\r\n";
+    $org_units = $org['organization-unit'];
+    foreach ($org_units as $org_unit)
+      $xhtml .= '    <span class="organization-unit">'. $org_unit .'</span>'."<br/>\r\n";
+    $xhtml .= '  </span>'."\r\n";
     $address = $hcard['adr'];
     $xhtml .= '  <span class = "adr">'."\r\n";
     if ($address['type'] !== '')
-      $xhtml .='    <span class="type">'.$address['type'].'</span>'."<br/>\r\n";
+      $xhtml .= '    <span class="type">'. $address['type'] .'</span>'."<br/>\r\n";
     if ($address['post-office-box'] !== '')
-      $xhtml .='    <span class="post-office-box">'.$address['post-office-box'].'</span>'."<br/>\r\n";
-    $street_addresses = $address['street-address'];  
-    foreach ($street_addresses as $street_address) 
-      $xhtml .='    <span class="street-address">'.$street_address.'</span>'."<br/>\r\n";
+      $xhtml .= '    <span class="post-office-box">'. $address['post-office-box'] .'</span>'."<br/>\r\n";
+    $street_addresses = $address['street-address'];
+    foreach ($street_addresses as $street_address)
+      $xhtml .= '    <span class="street-address">'. $street_address .'</span>'."<br/>\r\n";
     if ($address['extended-address'] !== '')
-      $xhtml .='    <span class="extended-address">'.$address['extended-address'].'</span>'."<br/>\r\n";
+      $xhtml .= '    <span class="extended-address">'. $address['extended-address'] .'</span>'."<br/>\r\n";
     if ($address['region'] !== '')
-      $xhtml .='    <span class="region">'.$address['region'].'</span>'."<br/>\r\n";
+      $xhtml .= '    <span class="region">'. $address['region'] .'</span>'."<br/>\r\n";
     if ($address['locality'] !== '')
-      $xhtml .='    <span class="locality">'.$address['locality'].'</span>'."<br/>\r\n";
+      $xhtml .= '    <span class="locality">'. $address['locality'] .'</span>'."<br/>\r\n";
     if ($address['postal-code'] !== '')
-      $xhtml .='    <span class="postal-code">'.$address['postal-code'].'</span>'."<br/>\r\n";
+      $xhtml .= '    <span class="postal-code">'. $address['postal-code'] .'</span>'."<br/>\r\n";
     if ($address['country-name'] !== '')
-      $xhtml .='    <span class="country-name">'.$address['country-name'].'</span>'."\r\n";
-    $xhtml .= '  </span><br/>'."\r\n";       
+      $xhtml .= '    <span class="country-name">'. $address['country-name'] .'</span>'."\r\n";
+    $xhtml .= '  </span><br/>'."\r\n";
     $agents = $hcard['agent'];
-    foreach ($agents as $agent) 
-      $xhtml .='  <span class="agent">'.$agent.'</span>'."<br/>\r\n";
+    foreach ($agents as $agent)
+      $xhtml .= '  <span class="agent">'. $agent .'</span>'."<br/>\r\n";
     $birthday =  $hcard['bday'];
-    if ($birthday !== '') 
-      $xhtml .='  <span class="bday">'.$birthday.'</span>'."<br/>\r\n";      
+    if ($birthday !== '')
+      $xhtml .= '  <span class="bday">'. $birthday .'</span>'."<br/>\r\n";
     $class = $hcard['class'];
     if ($class !== '')
-      $xhtml .='  <span class="class">'.$class.'</span>'."<br/>\r\n";
-    $categories = $hcard['category'];  
-    foreach ($categories as $category) 
-      $xhtml .='  <span class="category">'.$category.'</span>'."<br/>\r\n";
+      $xhtml .= '  <span class="class">'. $class .'</span>'."<br/>\r\n";
+    $categories = $hcard['category'];
+    foreach ($categories as $category)
+      $xhtml .= '  <span class="category">'. $category .'</span>'."<br/>\r\n";
     if ($hcard['email']) {
-      $email_addrs = $hcard['email']; 
-      foreach ($email_addrs as $email_type => $email_addr) 
-        $xhtml .='  <span class="email">'."\r\n".
-                  '    <span class="type">'.$email_type.': </span>'."\r\n".
-                  '    <a class="value" href="mailto:'.$email_addr.'">'.$email_addr.'</a>'."\r\n".
-                  '  </span>'."<br/>\r\n";    
-    
+      $mail_addrs = $hcard['email'];
+      foreach ($mail_addrs as $mail_type => $mail_addr)
+        $xhtml .= '  <span class="email">'."\r\n".
+                  '    <span class="type">'. $mail_type .': </span>'."\r\n".
+                  '    <a class="value" href="mailto:'. $mail_addr .'">'. $mail_addr .'</a>'."\r\n".
+                  '  </span>'."<br/>\r\n";
+
     }
     if ($hcard['tel']) {
       $tel_nos = $hcard['tel'];
-      foreach ($tel_nos as $tel_no_type => $tel_no) 
-        $xhtml .='  <span class="tel">'.
-                    '<span class="type">'.$tel_no_type.': </span>'.
-                    '<span class="value">'.$tel_no.'</span>'.
-                    '</span>'."<br/>\r\n";    
-    }    
+      foreach ($tel_nos as $tel_no_type => $tel_no)
+        $xhtml .= '  <span class="tel">'.
+                    '<span class="type">'. $tel_no_type .': </span>'.
+                    '<span class="value">'. $tel_no .'</span>'.
+                    '</span>'."<br/>\r\n";
+    }
     $xhtml .= '</div>'."\r\n";
   }
 
-  $xhtml.='</body>'."\r\n";
-  $xhtml.='</html>'."\r\n";
-  if ($view->override_path) //inside live preview 
+  $xhtml .= '</body>'."\r\n";
+  $xhtml .= '</html>'."\r\n";
+  if ($view->override_path) {       // inside live preview
     print htmlspecialchars($xhtml);
-  else {  
-   drupal_set_header('Content-Type: text/html');
-   print $xhtml;
-   //var_dump($view);
-   module_invoke_all('exit');
-   exit;
-  }  
+  }
+  else {
+    drupal_set_header('Content-Type: text/html');
+    print $xhtml;
+    // var_dump($view);
+    module_invoke_all('exit');
+    exit;
+  }
 }
 
-function xhtml_hcalendar_render ($view) {
+function xhtml_hcalendar_render($view) {
   $xhtml .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n";
   $xhtml .= '<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"'.">\r\n";
   $xhtml .= '<head>'."\r\n";
@@ -247,141 +250,141 @@ function xhtml_hcalendar_render ($view) 
   $xhtml .= '</head>'."\r\n";
   $xhtml .= '<body>'."\r\n";
   foreach ($view->result as $node) {
-  	$hcalendar = array();
-  	foreach($node as $field_label => $field_value) {
+    $hcalendar = array();
+    foreach ($node as $field_label => $field_value) {
       $label = views_rdf_strip_illegal_chars($field_label);
       $value = views_xml_strip_illegal_chars(views_xhtml_is_date($field_value));
-      $label = str_replace('_value', '', str_replace("profile_values_profile_", '', $label)); //strip out Profile: from profile fields
+      $label = str_replace('_value', '', str_replace("profile_values_profile_", '', $label));       // strip out Profile: from profile fields
       if (is_null($value) || ($value === '')) continue;
-  	      if (stripos($label, 'class') !== FALSE) {
-        $hcalendar['class'] = $value;  
+      if (stripos($label, 'class') !== FALSE) {
+        $hcalendar['class'] = $value;
       }
       if (stripos($label, 'category') !== FALSE) {
-        $hcalendar['category'][] = $value;  
+        $hcalendar['category'][] = $value;
       }
       if (stripos($label, 'description') !== FALSE) {
-        $hcalendar['description'] = $value; 
+        $hcalendar['description'] = $value;
       }
       if (stripos($label, 'summary') !== FALSE) {
-        $hcalendar['summary'] = $value; 
+        $hcalendar['summary'] = $value;
       }
       if ((stripos($label, 'dtstart') !== FALSE) || (stripos($label, 'event_start') !== FALSE) || (stripos($label, 'eventstarttime') !== FALSE)) {
         if (preg_match('/\d/', $value)) {
           if (strtotime($value))
-            $value = date(EXHIBIT_DATE_FORMAT, strtotime($value));
+            $value = format_date(strtotime($value), 'custom', EXHIBIT_DATE_FORMAT);
         }
-        $hcalendar['dtstart'] = $value;        
+        $hcalendar['dtstart'] = $value;
       }
       if ((stripos($label, 'dtend') !== FALSE) || (stripos($label, 'event_end') !== FALSE) || (stripos($label, 'eventendtime') !== FALSE)) {
         if (preg_match('/\d/', $value)) {
           if (strtotime($value))
-            $value = date(EXHIBIT_DATE_FORMAT, strtotime($value));
+            $value = format_date(strtotime($value), 'custom', EXHIBIT_DATE_FORMAT);
         }
-        $hcalendar['dtend'] = $value; 
+        $hcalendar['dtend'] = $value;
       }
       if (stripos($label, 'duration') !== FALSE) {
-        $hcalendar['duration'] = $value; 
+        $hcalendar['duration'] = $value;
       }
       if (stripos($label, 'geo_latitude') !== FALSE) {
-        $hcalendar['geo']['latitude'] = $value; 
+        $hcalendar['geo']['latitude'] = $value;
       }
       if (stripos($label, 'geo_longitude') !== FALSE) {
-        $hcalendar['geo']['longitude'] = $value; 
+        $hcalendar['geo']['longitude'] = $value;
       }
       if (stripos($label, 'location') !== FALSE) {
-        $hcalendar['location'] = $value; 
+        $hcalendar['location'] = $value;
       }
       if (stripos($label, 'status') !== FALSE) {
-        $hcalendar['status'] = $value; 
+        $hcalendar['status'] = $value;
       }
       if (stripos($label, 'uid') !== FALSE) {
-        $hcalendar['uid'] = $value; 
+        $hcalendar['uid'] = $value;
       }
       if (stripos($label, 'url') !== FALSE) {
-        $hcalendar['url'] = $value; 
+        $hcalendar['url'] = $value;
       }
       if (stripos($label, 'last_modified') !== FALSE) {
         if (preg_match('/\d/', $value)) {
           if (strtotime($value))
-            $value = date(EXHIBIT_DATE_FORMAT, strtotime($value));
-        }        
-        $hcalendar['last-modified'] = $value; 
+            $value = format_date(strtotime($value), 'custom', EXHIBIT_DATE_FORMAT);
+        }
+        $hcalendar['last-modified'] = $value;
       }
       if (stripos($label, 'address_type') !== FALSE) {
-        $hcalendar['adr']['type'] = $value; 
+        $hcalendar['adr']['type'] = $value;
       }
       if (stripos($label, 'post_office_box') !== FALSE) {
-        $hcalendar['adr']['post-office-box'] = $value;  
+        $hcalendar['adr']['post-office-box'] = $value;
       }
       if (stripos($label, 'street_address') !== FALSE) {
-        $hcalendar['adr']['street-address'][] = $value;  
+        $hcalendar['adr']['street-address'][] = $value;
       }
       if (stripos($label, 'extended_address') !== FALSE) {
-        $hcalendar['adr']['extended-address'] = $value;  
+        $hcalendar['adr']['extended-address'] = $value;
       }
       if (stripos($label, 'region') !== FALSE) {
-        $hcalendar['adr']['region'] = $value;  
+        $hcalendar['adr']['region'] = $value;
       }
       if (stripos($label, 'locality') !== FALSE) {
-        $hcalendar['adr']['locality'] = $value;  
+        $hcalendar['adr']['locality'] = $value;
       }
       if (stripos($label, 'postal_code') !== FALSE) {
-        $hcalendar['adr']['postal-code'] = $value;  
+        $hcalendar['adr']['postal-code'] = $value;
       }
       if (stripos($label, 'country_name') !== FALSE) {
-        $hcalendar['adr']['country-name'] = $value;  
+        $hcalendar['adr']['country-name'] = $value;
       }
     }
     $xhtml .= '<div class = "vevent">'."\r\n";
     $class = $hcalendar['class'];
-    if ($class) $xhtml .='  <span class="class">'.$class.'</span>'."<br/>\r\n";
+    if ($class) $xhtml .= '  <span class="class">'. $class .'</span>'."<br/>\r\n";
     $categories = $hcalendar['category'];
-    if ($categories)  
-      foreach ($categories as $category) $xhtml .='  <span class="category">'.$category.'</span>'."<br/>\r\n";
+    if ($categories)
+      foreach ($categories as $category) $xhtml .= '  <span class="category">'. $category .'</span>'."<br/>\r\n";
     $dtstart = $hcalendar['dtstart'];
-    if ($dtstart) 
-    $xhtml .='  <span class="dtstart">'.$dtstart.'</span>'."<br/>\r\n";
+    if ($dtstart)
+    $xhtml .= '  <span class="dtstart">'. $dtstart .'</span>'."<br/>\r\n";
     $summary = $hcalendar['summary'];
-    if ($summary) $xhtml .='  <span class="summary">'.$summary.'</span>'."<br/>\r\n";
+    if ($summary) $xhtml .= '  <span class="summary">'. $summary .'</span>'."<br/>\r\n";
     $dtend = $hcalendar['dtend'];
-    if ($dtend) $xhtml .='  <span class="dtend">'.$dtend.'</span>'."<br/>\r\n";
+    if ($dtend) $xhtml .= '  <span class="dtend">'. $dtend .'</span>'."<br/>\r\n";
     $location = $hcalendar['location'];
-    if ($location) $xhtml .='  <span class="location">'.$location.'</span>'."<br/>\r\n";
+    if ($location) $xhtml .= '  <span class="location">'. $location .'</span>'."<br/>\r\n";
     $geo_latitude = $hcalendar['geo-latitude'];
     $geo_longitude = $hcalendar['geo-longitude'];
     if ($geo_latitude || $geo_longitude) {
       $xhtml .= "  <div class=\"geo\">\n";
       if ($location) $xhtml .= "    $location: ";
       if ($geo_latitude) $xhtml .= "    <span class=\"latitude\">$geo_latitude</span>; ";
-      if ($geo_longitude) $xhtml .="    <span class=\"longitude\">$geo_longitude</span>";
+      if ($geo_longitude) $xhtml .= "    <span class=\"longitude\">$geo_longitude</span>";
       $xhtml .= "  </div>\n";
     }
     $status = $hcalendar['status'];
-    if ($status) $xhtml .='  <span class="status">'.$status.'</span>'."<br/>\r\n";
+    if ($status) $xhtml .= '  <span class="status">'. $status .'</span>'."<br/>\r\n";
     $duration = $hcalendar['duration'];
-    if ($duration) $xhtml .='  <span class="duration">'.$duration.'</span>'."<br/>\r\n";
+    if ($duration) $xhtml .= '  <span class="duration">'. $duration .'</span>'."<br/>\r\n";
     $uid= $hcalendar['uid'];
-    if ($uid) $xhtml .='  <span class="uid">'.$uid.'</span>'."<br/>\r\n";
+    if ($uid) $xhtml .= '  <span class="uid">'. $uid .'</span>'."<br/>\r\n";
     $url = $hcalendar['url'];
-    if ($url) $xhtml .='  <span class="url">'.$url.'</span>'."<br/>\r\n";
+    if ($url) $xhtml .= '  <span class="url">'. $url .'</span>'."<br/>\r\n";
     $last_modified = $hcalendar['last-modified'];
-    if ($last_modified) $xhtml .='  <span class="last-modified">'.$last_modified.'</span>'."<br/>\r\n";
+    if ($last_modified) $xhtml .= '  <span class="last-modified">'. $last_modified .'</span>'."<br/>\r\n";
     $description = $hcalendar['description'];
-    if ($description) $xhtml .='  <span class="description">'.$description.'</span>'."<br/>\r\n";
+    if ($description) $xhtml .= '  <span class="description">'. $description .'</span>'."<br/>\r\n";
     $adr = $hcalendar['adr'];
     if ($adr) {
       $xhtml .= "  <div class=\"adr\">\n";
       $adr_type = $adr['address-type'];
-      if ($adr_type) $xhtml .= '    <span class="address-type">'.$adr_type.'</span>'."<br/>\r\n"; 
-      $xhtml .="  </div>";
+      if ($adr_type) $xhtml .= '    <span class="address-type">'. $adr_type .'</span>'."<br/>\r\n";
+      $xhtml .= "  </div>";
     }
-    $xhtml .= '</div>'."\r\n";    
+    $xhtml .= '</div>'."\r\n";
   }
-	$xhtml.='</body>'."\r\n";
-  $xhtml.='</html>'."\r\n";
+  $xhtml .= '</body>'."\r\n";
+  $xhtml .= '</html>'."\r\n";
   drupal_set_header('Content-Type: text/html');
-  //var_dump($view);
+  // var_dump($view);
   print $xhtml;
   module_invoke_all('exit');
   exit;
-}
\ No newline at end of file
+}
diff -u -p -r vd0/views-view-xml.tpl.php vd4/views-view-xml.tpl.php
--- vd0/views-view-xml.tpl.php	2009-10-07 11:12:12.000000000 -0400
+++ vd4/views-view-xml.tpl.php	2009-10-15 19:10:51.000000000 -0400
@@ -1,8 +1,10 @@
 <?php
-// $Id: views-view-xml.tpl.php,v 1.1.2.10 2009/10/07 15:12:12 allisterbeharry Exp $
+// $Id$
+
 /**
- * @file views-view-xml.tpl.php
- * View template to render view fields as XML. Supports raw XML, OPML and Atoma schema.
+ * @file
+ * View template to render view fields as XML.  Supports raw XML, OPML,
+ * and Atom schema.
  *
  * - $view: The view in use.
  * - $rows: The raw result objects from the query, with all data it fetched.
@@ -17,116 +19,118 @@ if ($options['schema'] == 'opml') xml_op
 if ($options['schema'] == 'atom') xml_atom_render($view);
 
 function xml_raw_render($view) {
-	$xml .= '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
+  $xml .= '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
   $xml .= '<!-- generator="Drupal Views_Datasource.Module" -->'."\n";
-  $xml .='<nodes>'."\n";  
-  
+  $xml .='<nodes>'."\n";
+
   foreach ($view->result as $node) {
-    $xml .= '  <node>'."\n";   
-    foreach($node as $label => $value) {
+    $xml .= '  <node>'."\n";
+    foreach ($node as $label => $value) {
       $label = views_xml_strip_illegal_chars($label);
       $value = views_xml_strip_illegal_chars(views_xml_is_date($value));
       if (is_null($value) || ($value === '')) continue;
 //      if (preg_match('/\d/', $value)) {
 //        if (strtotime($value))
 //          $value = date(DATE_ISO8601, strtotime($value));
-//      }     
-      $label = str_replace('_value', '', str_replace("profile_values_profile_", '', $label)); //strip out Profile: from profile fields
-      
+//      }
+      $label = str_replace('_value', '', str_replace("profile_values_profile_", '', $label));       // strip out Profile: from profile fields
+
       $xml .= "    <$label><![CDATA[$value]]></$label>\n";
     }
   $xml .= '  </node>'."\n";
   }
   $xml .='</nodes>'."\n";
-  if ($view->override_path) //inside live preview 
+  if ($view->override_path) {       // inside live preview
     print htmlspecialchars($xml);
-  else {  
-   drupal_set_header('Content-Type: text/xml');
-   print $xml;
-   module_invoke_all('exit');
-   exit;
+  }
+  else {
+    drupal_set_header('Content-Type: text/xml');
+    print $xml;
+    module_invoke_all('exit');
+    exit;
   }
 }
 
 function xml_opml_render($view) {
-	//var_dump($view);
-	//return;
+  // var_dump($view);
+  // return;
   global $user;
   global $base_url;
-	$xml .= '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
+  $xml .= '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
   $xml .= '<!-- generator="Drupal Views_Datasource.Module" -->'."\n";
-  $xml .='<opml version="2.0">'."\n";  
-	$xml .='<head>'."\n";
-	$xml .='  <title>'.variable_get('site_name', 'drupal').'-'.$view->name.'</title>'."\n";
-	$xml .='  <ownerName>'.$user->name.'</ownerName>'."\n";
-	$xml .='  <ownerEmail>'.$user->mail.'</ownerEmail>'."\n";
-	$xml .='  <docs>'.$base_url.'</docs>';
-	$xml .='  <dateCreated>'.date(DATE_ISO8601, time()).'</dateCreated>'."\n";
-	$xml .='</head>'."\n";
-	$xml .='<body>'."\n";
+  $xml .='<opml version="2.0">'."\n";
+  $xml .='<head>'."\n";
+  $xml .='  <title>'. variable_get('site_name', 'drupal') .'-'. $view->name .'</title>'."\n";
+  $xml .='  <ownerName>'. $user->name .'</ownerName>'."\n";
+  $xml .='  <ownerEmail>'. $user->mail .'</ownerEmail>'."\n";
+  $xml .='  <docs>'. $base_url .'</docs>';
+  $xml .='  <dateCreated>'. format_date(time(), 'custom', DATE_ISO8601) .'</dateCreated>'."\n";
+  $xml .='</head>'."\n";
+  $xml .='<body>'."\n";
   foreach ($view->result as $node) {
     $xml .= '  <outline ';
-    $fieldcount = 0;   
-    foreach($node as $field_name=>$field_value) {
+    $fieldcount = 0;
+    foreach ($node as $field_name => $field_value) {
       $label = views_xml_strip_illegal_chars($field_name);
       $value = views_xml_strip_illegal_chars(views_xml_is_date($field_value));
       if (is_null($value) || ($value === '')) continue;
-      $fieldcount++;      
-      $label = str_replace('_value', '', str_replace("profile_values_profile_", '', $label)); //strip out Profile: from profile fields
+      $fieldcount++;
+      $label = str_replace('_value', '', str_replace("profile_values_profile_", '', $label));       // strip out Profile: from profile fields
       if (is_null($value) || ($value === '')) continue;
-      if ((strtolower($label) == 'text') || (strtolower($label) == 'node_revisions_body'))
+      if ((drupal_strtolower($label) == 'text') || (drupal_strtolower($label) == 'node_revisions_body'))
         $label = "text";
       if (is_null($value) || ($value === '') || ($value === 0)) continue;
-      if ((strtolower($label) == 'type') || (strtolower($label) == 'node_type'))
-        $label = "type";  
-      if ((strtolower($label) == 'id') || (strtolower($label) == 'nid')) { //if a nid is given construct the url attribute
-      	//$url = $base_url.'index.php?q=node/'.$value;
-      	$url = url("node/".$value, array('absolute'=>true));  
-      }
-        
-      if ((strtolower($label) == 'published') || (strtolower($label) == 'node_created')) {
-      	$label = 'created';
-        if (intval($value)) //timestamp
-          $value =  date(DATE_RFC822, intval($value)) ;
-        else if(getdate($value)) //string date
-           $value = date(DATE_RFC822, strtotime($value)); 
-      }  
-      $xml .= $label. '="'.preg_replace('/[^A-Za-z0-9 :\/\-_\.\?\=]/','',$value).'" ';
-      
-      //$xml .= $label. '="'.$value.'" ';
-    }
-    if ($url) $xml.=' '.'url="'.$url.'" ';
-  $xml .=  ' />'."\n";
-  }
-	$xml .='</body>'."\n";
-  $xml .='</opml>'."\n";
-	if ($view->override_path) //inside live preview 
-	  print htmlspecialchars($xml);
-	else {  
-   drupal_set_header('Content-Type: text/xml');
-   print $xml;
-   //var_dump($view);
-   module_invoke_all('exit');
-   exit;
-	}
+      if ((drupal_strtolower($label) == 'type') || (drupal_strtolower($label) == 'node_type'))
+        $label = "type";
+      if ((drupal_strtolower($label) == 'id') || (drupal_strtolower($label) == 'nid')) {      // if a nid is given construct the url attribute
+        // $url = $base_url .'index.php?q=node/'. $value;
+        $url = url("node/". $value, array('absolute' => TRUE));
+      }
+
+      if ((drupal_strtolower($label) == 'published') || (drupal_strtolower($label) == 'node_created')) {
+        $label = 'created';
+        if (intval($value))           // timestamp
+          $value = format_date(intval($value), 'custom', DATE_RFC822);
+        elseif (getdate($value))      // string date
+          $value = format_date(strtotime($value), 'custom', DATE_RFC822);
+      }
+      $xml .= $label .'="'. preg_replace('/[^A-Za-z0-9 :\/\-_\.\?\=]/', '', $value) .'" ';
+
+      // $xml .= $label .'="'. $value .'" ';
+    }
+    if ($url) $xml .= ' '.'url="'. $url .'" ';
+    $xml .=  ' />'."\n";
+  }
+  $xml .= '</body>'."\n";
+  $xml .= '</opml>'."\n";
+  if ($view->override_path) {       // inside live preview
+    print htmlspecialchars($xml);
+  }
+  else {
+    drupal_set_header('Content-Type: text/xml');
+    print $xml;
+    // var_dump($view);
+    module_invoke_all('exit');
+    exit;
+  }
 }
 
 function xml_atom_render($view) {
-	global $base_url;
-	
+  global $base_url;
+
   $xml .= '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
   $xml .= '<!-- generator="Drupal Views_Datasource.Module" -->'."\n";
-  $xml .='<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">'."\n";  
-  $xml .='  <title>'.$view->name.'</title>'."\n";
-  $xml .='  <link rel="alternate" type="text/html" href="'.$base_url.'"/>'."\n";
-  $xml .='  <link rel ="self" type="application/atom+xml" href="'.$base_url.'/'.$view->display_handler->options['path'].'"/>'."\n";
-  $xml .='  <id>'.$base_url.'/'.$view->display_handler->options['path'].'</id>'."\n";//use path as id
-  $xml .='  <updated>###feed_updated###</updated>'."\n"; //will set later 
-  $xml .='  <generator>Views Datasource module</generator>'."\n"; 
+  $xml .='<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">'."\n";
+  $xml .='  <title>'. $view->name .'</title>'."\n";
+  $xml .='  <link rel="alternate" type="text/html" href="'. $base_url .'"/>'."\n";
+  $xml .='  <link rel ="self" type="application/atom+xml" href="'. $base_url .'/'. $view->display_handler->options['path'] .'"/>'."\n";
+  $xml .='  <id>'. $base_url .'/'. $view->display_handler->options['path'] .'</id>'."\n";       // use path as id
+  $xml .='  <updated>###feed_updated###</updated>'."\n";        // will set later
+  $xml .='  <generator>Views Datasource module</generator>'."\n";
   $feed_last_updated = 0;
   foreach ($view->result as $node) {
-  	$entry = array();   
-    foreach($node as $field_name=>$field_value) {
+    $entry = array();
+    foreach ($node as $field_name => $field_value) {
       $label = views_xml_strip_illegal_chars($field_name);
       $value = views_xml_strip_illegal_chars(views_xml_is_date($field_value));
       if (is_null($value) || ($value === '')) continue;
@@ -134,84 +138,85 @@ function xml_atom_render($view) {
 //        if (strtotime($value))
 //          $value = date(DATE_ISO8601, strtotime($value));
 //      }
-      $label = str_replace('_value', '', str_replace("profile_values_profile_", '', $label)); //strip out Profile: from profile fields
-      if (strtolower($label) == 'nid') $entry['nid'] = $value;
-      if ((strtolower($label) == 'updated') || (strtolower($label) == 'updated date') || (strtolower($label) == 'node_changed')) {
-      	if (intval($value)) //timestamp
-      	  $entry['updated'] =  intval($value) ;
-      	else if(getdate($value)) { //string date
-      		$entry['updated'] = strtotime($value);
-      	}
-      } 
-      if ((strtolower($label) == 'title') || (strtolower($label) == 'node_title')) 
+      $label = str_replace('_value', '', str_replace("profile_values_profile_", '', $label));       // strip out Profile: from profile fields
+      if (drupal_strtolower($label) == 'nid') $entry['nid'] = $value;
+      if ((drupal_strtolower($label) == 'updated') || (drupal_strtolower($label) == 'updated date') || (drupal_strtolower($label) == 'node_changed')) {
+        if (intval($value))       // timestamp
+          $entry['updated'] = intval($value) ;
+        elseif (getdate($value)) {      // string date
+          $entry['updated'] = strtotime($value);
+        }
+      }
+      if ((drupal_strtolower($label) == 'title') || (drupal_strtolower($label) == 'node_title'))
         $entry['title'] = $value;
-      if (strtolower($label) == 'link') $entry['link'] = $value;
-      if ((strtolower($label) == 'published') || (strtolower($label) == 'node_created')) {
-      	if (intval($value)) //timestamp
+      if (drupal_strtolower($label) == 'link') $entry['link'] = $value;
+      if ((drupal_strtolower($label) == 'published') || (drupal_strtolower($label) == 'node_created')) {
+        if (intval($value))       // timestamp
           $entry['published'] =  intval($value) ;
-        else if(getdate($value)) { //string date
-           $entry['published'] = strtotime($value);
-      	}
-      }
-      if ((strtolower($label) == 'author') || (strtolower($label) == 'users_name')) $entry['author'] = $value;
-      if ((strtolower($label) == 'email') || (strtolower($label) == 'users_mail')) $entry['email'] = $value;
-      if ((strtolower($label) == 'content') || (strtolower($label) == 'node_revisions_body')) $entry['content'] = $value;
-      if ((strtolower($label) == 'summary') || (strtolower($label) == 'node_teaser') || (strtolower($label) == 'node_revisions_teaser')) $entry['summary'] = $value;
+        elseif (getdate($value)) {      // string date
+          $entry['published'] = strtotime($value);
+        }
+      }
+      if ((drupal_strtolower($label) == 'author') || (drupal_strtolower($label) == 'users_name')) $entry['author'] = $value;
+      if ((drupal_strtolower($label) == 'email') || (drupal_strtolower($label) == 'users_mail')) $entry['email'] = $value;
+      if ((drupal_strtolower($label) == 'content') || (drupal_strtolower($label) == 'node_revisions_body')) $entry['content'] = $value;
+      if ((drupal_strtolower($label) == 'summary') || (drupal_strtolower($label) == 'node_teaser') || (drupal_strtolower($label) == 'node_revisions_teaser')) $entry['summary'] = $value;
     }
     if (isset($entry['nid']) && (isset($entry['updated'])) && (isset($entry['link'])) && (isset($entry['title'])) && (isset($entry['published']))) {
-   	  if (parse_url($entry['link'])) 
-   	    $link = $entry['link'];	
-   	  else {
-        print ('<b style="color:red">The link URL is not valid.</b>');
+      if (parse_url($entry['link']))
+        $link = $entry['link'];
+      else {
+        print '<b style="color:red">The link URL is not valid.</b>';
         return;
-   	  }
+      }
     }
-    elseif (isset($entry['nid']) && (isset($entry['updated'])) && (isset($entry['title'])) && (isset($entry['published']))) { //make the entry path with base_url + nid {
-   	  $entry['link'] = $base_url.'/index.php?q=node/'.$entry['nid'];
+    elseif (isset($entry['nid']) && (isset($entry['updated'])) && (isset($entry['title'])) && (isset($entry['published']))) {       // make the entry path with base_url + nid {
+      $entry['link'] = $base_url .'/index.php?q=node/'. $entry['nid'];
     }
     else {
-      print ('<b style="color:red">The fields "nid", "title", "post date", and "updated date" must exist.');
-      return;  
+      print '<b style="color:red">The fields "nid", "title", "post date", and "updated date" must exist.';
+      return;
     }
     $link = $entry['link'];
     $link_url = parse_url($link);
     $nid = $entry['nid'];
     $updated = $entry['updated'];
-    if ($updated > $feed_last_updated) $feed_last_updated = $updated; //Overall feed updated is the most recent node updated timestamp
+    if ($updated > $feed_last_updated) $feed_last_updated = $updated;         // Overall feed updated is the most recent node updated timestamp
     $title = $entry['title'];
     $published = $entry['published'];
     $author = $entry['author'];
-    $email = $entry['email'];
+    $mail = $entry['email'];
     $content = $entry['content'];
     $summary = $entry['summary'];
-    
-    //Create an id for the entry using tag URIs
-    $id = 'tag:'.$link_url['host'].','.date('Y-m-d', $updated).':'.$link_url['path'].'?'.$link_url['query'];
+
+    // Create an id for the entry using tag URIs
+    $id = 'tag:'. $link_url['host'] .','. format_date($updated, 'custom', 'Y-m-d') .':'. $link_url['path'] .'?'. $link_url['query'];
     $xml .= '  <entry>'."\n";
-    $xml .= '    <id>'.$id.'</id>'."\n"; 
-    $xml .= '    <updated>'.date(DATE_ATOM, $updated).'</updated>'."\n";
-    $xml .= '    <title type="text">'.$title.'</title>'."\n";
-    $xml .= '    <link rel="alternate" type="text/html" href="'.$link.'"/>'."\n";
-    $xml .= '    <published>'.date(DATE_ATOM, $published).'</published>'."\n";
+    $xml .= '    <id>'. $id .'</id>'."\n";
+    $xml .= '    <updated>'. format_date($updated, 'custom', DATE_ATOM) .'</updated>'."\n";
+    $xml .= '    <title type="text">'. $title .'</title>'."\n";
+    $xml .= '    <link rel="alternate" type="text/html" href="'. $link .'"/>'."\n";
+    $xml .= '    <published>'. format_date($published, 'custom', DATE_ATOM) .'</published>'."\n";
     if ($author) {
-    	if ($email) {
-    		$xml .= '    <author><name>'.$author.'</name><email>'.$email.'</email></author>'."\n";
-    	}
-      else $xml .= '    <author><name>'.$author.'</name></author>'."\n";
+      if ($mail) {
+        $xml .= '    <author><name>'. $author .'</name><email>'. $mail .'</email></author>'."\n";
+      }
+      else $xml .= '    <author><name>'. $author .'</name></author>'."\n";
     }
-    if ($content)$xml .= '    <content type="html" xml:base="'.$base_url.'"><![CDATA['.$content.']]></content>'."\n";
-    if ($summary)$xml .= '    <summary type="html" xml:base="'.$base_url.'"><![CDATA['.$summary.']]></summary>'."\n";
+    if ($content) $xml .= '    <content type="html" xml:base="'. $base_url .'"><![CDATA['. $content .']]></content>'."\n";
+    if ($summary) $xml .= '    <summary type="html" xml:base="'. $base_url .'"><![CDATA['. $summary .']]></summary>'."\n";
     $xml .= '  </entry>'."\n";
   }
   $xml .='</feed>'."\n";
-  $xml = str_replace('###feed_updated###', date(DATE_ATOM, $feed_last_updated), $xml);
-  if ($view->override_path) //inside live preview 
+  $xml = str_replace('###feed_updated###', format_date($feed_last_updated, 'custom', DATE_ATOM), $xml);
+  if ($view->override_path) {       // inside live preview
     print htmlspecialchars($xml);
-  else {  
-   drupal_set_header('Content-Type: application/atom+xml');
-   print $xml;
-   //var_dump($label);   
-   module_invoke_all('exit');
-   exit;
+  }
+  else {
+    drupal_set_header('Content-Type: application/atom+xml');
+    print $xml;
+    // var_dump($label);
+    module_invoke_all('exit');
+    exit;
   }
 }
Only in vd4/: views_datasource_alpha3_002.patch
diff -u -p -r vd0/views_json.module vd4/views_json.module
--- vd0/views_json.module	2009-09-08 12:37:48.000000000 -0400
+++ vd4/views_json.module	2009-10-27 23:57:59.000000000 -0400
@@ -1,42 +1,49 @@
 <?php
-//$Id: views_json.module,v 1.1.2.3 2009/09/08 16:37:48 allisterbeharry Exp $
+// $Id$
+
 /**
- @file views_json.module
- Module definition for views_json 
- @see views_json.views.inc
-*/
+ * @file
+ * Module definition for views_json
+ *
+ * @see views_json.views.inc
+ */
+
 
 function views_json_views_api() {
   return array(
     'api' => 2,
-    /*'path' => drupal_get_path('module', 'views_json'),*/
+//    'path' => drupal_get_path('module', 'views_json'),
   );
 }
 
 
 /**
- * Strips illegal JSON characters in identifier string
+ * Strips illegal JSON characters in identifier string.
  *
- * @param string $input
- * @return string
+ * @param $input
+ *   JSON to process.
+ * @return
+ *   JSON with illegal characters stripped away.
  */
-
 function views_json_strip_illegal_chars($input) {
- $output = str_replace(array('{','}','[', ']', ':', ',', '"', "'", chr(47), chr(92)), '', $input);
- $output = preg_replace(
-                        '/[\x{80}-\x{A0}'. // Non-printable ISO-8859-1 + NBSP
-                        '\x{01}-\x{1F}'. //Non-printable ASCII characters
-                        '\x{0}]/u', // NULL byte
-        '', $output);
+  $output = str_replace(array('{', '}', '[', ']', ':', ',', '"', "'", chr(47), chr(92)), '', $input);
+  $output = preg_replace(
+              '/[\x{80}-\x{A0}'.      // Non-printable ISO-8859-1 + NBSP
+              '\x{01}-\x{1F}'.        // Non-printable ASCII characters
+              '\x{0}]/u',             // NULL byte
+            '', $output);
 
- return check_plain(strip_tags($output));;  
+  return check_plain(strip_tags($output));
 }
 
+
 /**
  * Encodes special JSON characters in string
  *
- * @param string $input
- * @return string
+ * @param $input
+ *   String to process.
+ * @return
+ *   String with special JSON characters encoded.
  */
 function views_json_encode_special_chars($input) {
   $output = str_replace(chr(92), '\\', $input);
@@ -44,23 +51,56 @@ function views_json_encode_special_chars
   $output = str_replace('"', '\"', $output);
   $output = str_replace(chr(8), '\b', $output);
   $output = str_replace(chr(12), '\f', $output);
-  $output = str_replace(chr(13).chr(10), '\n', $output);
+  $output = str_replace(chr(13) . chr(10), '\n', $output);
   $output = str_replace(chr(10), '\n', $output);
   $output = str_replace(chr(13), '\r', $output);
   $output = str_replace(chr(9), '\t', $output);
   return $output;
 }
 
+
 /**
- * If input is a serialized date array, return a date string 
+ * If input is a serialized date array, return a date string
  *
- * @param unknown_type $input
- * @return unknown
+ * @param $input
+ *   Input to check.
+ * @return
+ *   Either the original input or a date string.
  */
-function views_json_is_date ($input) {
-  if (strpos($input, 'a:3:{s:5:"month"') !== 0) return $input; 
-  else { //serialized date array
+function views_json_is_date($input) {
+  if (strpos($input, 'a:3:{s:5:"month"') !== 0) {
+    return $input;
+  }
+  else {        // serialized date array
     $date = unserialize($input);
-    return date(DATE_ISO8601, mktime(0, 0, 0, $date['month'], $date['day'], $date['year']));
+    return format_date(mktime(0, 0, 0, $date['month'], $date['day'], $date['year']), 'custom', DATE_ISO8601);
   }
-}
\ No newline at end of file
+}
+
+
+/**
+ * Gets JSON data from a View rendered in the JSON data document style.
+ *
+ * This is useful for when working with a JSON view in code.
+ *
+ * @param $name
+ *   The name of the view.
+ * @param $display_id
+ *   The display of the view to use.
+ * @param $args
+ *   The arguments to pass to the view.
+ * @return
+ *   The JSON object in associative array form or NULL otherwise.
+ */
+function views_json_get_json($name, $display_id = 'default', $args = array()) {
+  $view = views_get_view($name);
+  if (!is_object($view)) return NULL;
+
+  $preview    = $view->preview($display_id, $args);
+  $start_pos  = strpos($preview, '{');
+  $finish_pos = strrpos($preview, '}');
+  $length     = $finish_pos - $start_pos + 1;
+  $json       = trim(substr($preview, $start_pos, $length));
+
+  return json_decode($json, TRUE);
+}
diff -u -p -r vd0/views_json.views.inc vd4/views_json.views.inc
--- vd0/views_json.views.inc	2009-09-08 12:37:48.000000000 -0400
+++ vd4/views_json.views.inc	2009-10-15 19:10:51.000000000 -0400
@@ -1,41 +1,45 @@
 <?php
-//$Id: views_json.views.inc,v 1.1.2.3 2009/09/08 16:37:48 allisterbeharry Exp $
+// $Id$
+
 /**
- * @file views_json.views.inc 
+ * @file
  * Views style plugin to render nodes in the JSON data format.
- * @see views-view-json.tpl.php views-view-row-unformatted.tpl.php
+ *
+ * @see views-view-json.tpl.php, views-view-row-unformatted.tpl.php
  * @ingroup views_plugins
  */
 
+
 /**
- * Implementation of hook_views_plugin
- *
+ * Implementation of hook_views_plugin().
  */
 function views_json_views_plugins() {
   return array(
-    'module' => 'views_json',
-    'style' => array( //declare the views_json style plugin
+    'module'  => 'views_json',
+    'style'   => array(                 // declare the views_json style plugin
       'views_json' => array(
-        'title' => t('JSON data document'),
-        'theme' => 'views_view_json',
-        'help' => t('Displays nodes in the JSON data format.'),
-        'handler' => 'views_plugin_style_json',
+        'title'           => t('JSON data document'),
+        'theme'           => 'views_view_json',
+        'help'            => t('Displays nodes in the JSON data format.'),
+        'handler'         => 'views_plugin_style_json',
         'uses row plugin' => TRUE,
-        'uses fields' => TRUE,
-        'uses options' => TRUE,
-        'type' => 'normal',       
+        'uses fields'     => TRUE,
+        'uses options'    => TRUE,
+        'type'            => 'normal',
       ),
     ),
   );
 }
 
+
 /**
  * Theme preprocess function for views-view-json.tpl.php
  *
- * @param array $vars
+ * @param $vars
+ *   Template variables.
  */
 function template_preprocess_views_view_json(&$vars) {
   $view     = &$vars['view'];
   $options  = $view->style_handler->options;
   $handler  = $view->style_handler;
-}
\ No newline at end of file
+}
diff -u -p -r vd0/views_plugin_style_json.inc vd4/views_plugin_style_json.inc
--- vd0/views_plugin_style_json.inc	2009-10-07 11:27:38.000000000 -0400
+++ vd4/views_plugin_style_json.inc	2009-10-15 19:10:51.000000000 -0400
@@ -1,36 +1,40 @@
 <?php
-//$Id: views_plugin_style_json.inc,v 1.1.2.2 2009/10/07 15:27:38 allisterbeharry Exp $
+// $Id$
+
 /**
  * @file
  * Implementation of views_plugin_style for views_json
  */
 
+
 /**
  * Implementation of views_plugin_style
- *
  */
 class views_plugin_style_json extends views_plugin_style {
-  
   /**
    * Set default options
    */
   function options(&$options) {
     $options['format'] = 'Simple';
   }
-  
+
   /**
    * Provide a form for setting options.
    *
-   * @param array $form
-   * @param array $form_state
-   */  
+   * @param $form
+   * @param $form_state
+   */
   function options_form(&$form, &$form_state) {
     $form['format'] = array(
-      '#type' => 'radios',
-      '#title' => t('JSON data format'),
-      '#options' => array('Simple' => t('Simple'), 'Exhibit' => t('MIT Simile/Exhibit')),
-      '#default_value' => $this->options['format'],
+      '#type'           => 'radios',
+      '#title'          => t('JSON data format'),
+      '#options'        => array(
+        'simple'        => t('Simple'),
+        'simple-coder'  => t('Simple (Coder)'),
+        'exhibit'       => t('MIT Simile/Exhibit'),
+        'exhibit-coder' => t('MIT Simile/Exhibit (Coder)'),
+      ),
+      '#default_value'  => $this->options['format'],
     );
   }
-
-}
\ No newline at end of file
+}
diff -u -p -r vd0/views_plugin_style_rdf.inc vd4/views_plugin_style_rdf.inc
--- vd0/views_plugin_style_rdf.inc	2009-10-07 11:27:38.000000000 -0400
+++ vd4/views_plugin_style_rdf.inc	2009-10-15 19:10:51.000000000 -0400
@@ -1,29 +1,29 @@
 <?php
-//$Id: views_plugin_style_rdf.inc,v 1.1.2.3 2009/10/07 15:27:38 allisterbeharry Exp $
+// $Id$
+
 /**
  * @file
  * Implementation of views_plugin_style for views_rdf
  */
 
+
 /**
  * Implementation of views_plugin_style
- *
  */
 class views_plugin_style_rdf extends views_plugin_style {
-  
   /**
    * Set default options
    */
   function options(&$options) {
     $options['vocabulary'] = 'FOAF';
   }
-  
+
   /**
    * Provide a form for setting options.
    *
-   * @param array $form
-   * @param array $form_state
-   */  
+   * @param $form
+   * @param $form_state
+   */
   function options_form(&$form, &$form_state) {
     $form['vocabulary'] = array(
       '#type' => 'radios',
@@ -32,5 +32,4 @@ class views_plugin_style_rdf extends vie
       '#default_value' => $this->options['vocabulary'],
     );
   }
-
-}
\ No newline at end of file
+}
diff -u -p -r vd0/views_plugin_style_xhtml.inc vd4/views_plugin_style_xhtml.inc
--- vd0/views_plugin_style_xhtml.inc	2009-10-07 11:27:38.000000000 -0400
+++ vd4/views_plugin_style_xhtml.inc	2009-10-15 19:10:51.000000000 -0400
@@ -1,13 +1,14 @@
 <?php
-//$Id: views_plugin_style_xhtml.inc,v 1.1.2.2 2009/10/07 15:27:38 allisterbeharry Exp $
+// $Id$
+
 /**
  * @file
  * Implementation of views_plugin_style for views_xhtml
  */
 
+
 /**
  * Implementation of views_plugin_style
- *
  */
 class views_plugin_style_xhtml extends views_plugin_style {
   /**
@@ -16,13 +17,13 @@ class views_plugin_style_xhtml extends v
   function options(&$options) {
     $options['format'] = 'hcard';
   }
-  
+
   /**
    * Provide a form for setting options.
    *
-   * @param array $form
-   * @param array $form_state
-   */  
+   * @param $form
+   * @param $form_state
+   */
   function options_form(&$form, &$form_state) {
     $form['format'] = array(
       '#type' => 'radios',
@@ -31,5 +32,4 @@ class views_plugin_style_xhtml extends v
       '#default_value' => $this->options['format'],
     );
   }
-
-}
\ No newline at end of file
+}
diff -u -p -r vd0/views_plugin_style_xml.inc vd4/views_plugin_style_xml.inc
--- vd0/views_plugin_style_xml.inc	2009-10-07 11:27:38.000000000 -0400
+++ vd4/views_plugin_style_xml.inc	2009-10-15 19:10:51.000000000 -0400
@@ -1,5 +1,6 @@
 <?php
-//$Id: views_plugin_style_xml.inc,v 1.1.2.2 2009/10/07 15:27:38 allisterbeharry Exp $
+// $Id$
+
 /**
  * @file
  * Implementation of views_plugin_style for views_xml
@@ -8,23 +9,21 @@
 
 /**
  * Implementation of views_plugin_style
- *
  */
 class views_plugin_style_xml extends views_plugin_style {
-  
   /**
    * Set default options
    */
   function options(&$options) {
     $options['schema'] = 'raw';
   }
-  
+
   /**
    * Provide a form for setting options.
    *
-   * @param array $form
-   * @param array $form_state
-   */  
+   * @param $form
+   * @param $form_state
+   */
   function options_form(&$form, &$form_state) {
     $form['schema'] = array(
       '#type' => 'radios',
@@ -33,5 +32,4 @@ class views_plugin_style_xml extends vie
       '#default_value' => $this->options['schema'],
     );
   }
-  
-}
\ No newline at end of file
+}
diff -u -p -r vd0/views_rdf.module vd4/views_rdf.module
--- vd0/views_rdf.module	2009-09-08 12:37:48.000000000 -0400
+++ vd4/views_rdf.module	2009-10-15 19:10:51.000000000 -0400
@@ -1,10 +1,13 @@
 <?php
-//$Id: views_rdf.module,v 1.1.4.5 2009/09/08 16:37:48 allisterbeharry Exp $
+// $Id$
+
 /**
- @file views_rdf.module
- Module definition for views_rdf 
- @see views_rdf.views.inc
-*/
+ * @file
+ * Module definition for views_rdf
+ *
+ * @see views_rdf.views.inc
+ */
+
 
 function views_rdf_views_api() {
   return array(
@@ -12,50 +15,42 @@ function views_rdf_views_api() {
   );
 }
 
+
 /**
  * Renders a single user from a view in the
- *
- * @param unknown_type $node
  */
-//function views_rdf_sioc_render_xml_user($view_result) {
-//	
-//}
+// function views_rdf_sioc_render_xml_user($view_result) {
+//
+// }
+
+
 /**
- * Strips illegal Unicode characters and encodes entities in string
+ * Strips illegal Unicode characters and encodes entities in string.
  *
- * @param string $input
- * @return string
+ * @param $input
+ *   String to process.
+ * @return
+ *   String with illegal characters stripped away and entities encoded.
  */
 function views_rdf_strip_illegal_chars($input) {
-//  $output = preg_replace('/[\x{80}-\x{A0}'. // Non-printable ISO-8859-1 + NBSP
-//        '\x{01}-\x{1F}'. //Non-printable ASCII characters
-//        '\x{AD}'. // Soft-hyphen
-//        '\x{2000}-\x{200F}'. // Various space characters
-//        '\x{2028}-\x{202F}'. // Bidirectional text overrides
-//        '\x{205F}-\x{206F}'. // Various text hinting characters
-//        '\x{FEFF}'. // Byte order mark
-//        '\x{FF01}-\x{FF60}'. // Full-width latin
-//        '\x{FFF9}-\x{FFFD}'. // Replacement characters
-//        '\x{0}]/u', // NULL byte
-//        '', $input);
-//  $output = str_replace('"', '&quot;', $output); //encode quote
-//  $output = str_replace('&', '&amp;', $output); //encode ampersand
-//  $output = str_replace("'", '&pos;', $output); //encode apostrophe
-//  $output = str_replace('<', '&lt;', $output); //encode left-angled bracket
-//  $output = str_replace('>', '&rt;', $output); //encode right-angled bracket
   return check_plain(strip_tags($input));
 }
 
+
 /**
- * If input is a serialized date array, return a date string 
+ * If input is a serialized date array, return a date string
  *
- * @param unknown_type $input
- * @return unknown
+ * @param $input
+ *   Input to check.
+ * @return
+ *   Either the original input or a date string.
  */
-function views_rdf_is_date ($input) {
-  if (strpos($input, 'a:3:{s:5:"month"') !== 0) return $input; 
-  else { //serialized date array
+function views_rdf_is_date($input) {
+  if (strpos($input, 'a:3:{s:5:"month"') !== 0) {
+    return $input;
+  }
+  else {        // serialized date array
     $date = unserialize($input);
-    return date(DATE_ISO8601, mktime(0, 0, 0, $date['month'], $date['day'], $date['year']));
+    return format_date(mktime(0, 0, 0, $date['month'], $date['day'], $date['year']), 'custom', DATE_ISO8601);
   }
 }
diff -u -p -r vd0/views_rdf.views.inc vd4/views_rdf.views.inc
--- vd0/views_rdf.views.inc	2009-09-08 12:37:48.000000000 -0400
+++ vd4/views_rdf.views.inc	2009-10-15 19:10:51.000000000 -0400
@@ -1,41 +1,45 @@
 <?php
-//$Id: views_rdf.views.inc,v 1.1.2.3 2009/09/08 16:37:48 allisterbeharry Exp $
+// $Id$
+
 /**
- * @file views_rdf.views.inc 
+ * @file
  * Views style plugin to render nodes in the RDF data format.
+ *
  * @see views-view-rdf.tpl.php
  * @ingroup views_plugins
  */
 
+
 /**
- * Implementation of hook_views_plugin
- *
+ * Implementation of hook_views_plugin().
  */
 function views_rdf_views_plugins() {
   return array(
-    'module' => views_rdf,
-	'style' => array( //declare the views_rdf style plugin
+    'module'  => views_rdf,
+    'style'   => array(                 // declare the views_rdf style plugin
       'views_rdf' => array(
-        'title' => t('RDF data document'),
-        'theme' => 'views_view_rdf',
-        'help' => t('Displays nodes using the RDF data format.'),
-        'handler' => 'views_plugin_style_rdf',
+        'title'           => t('RDF data document'),
+        'theme'           => 'views_view_rdf',
+        'help'            => t('Displays nodes using the RDF data format.'),
+        'handler'         => 'views_plugin_style_rdf',
         'uses row plugin' => TRUE,
-        'uses fields' => TRUE,
-        'uses options' => TRUE,
-        'type' => 'normal',       
+        'uses fields'     => TRUE,
+        'uses options'    => TRUE,
+        'type'            => 'normal',
       ),
     ),
   );
 }
 
+
 /**
  * Theme preprocess function for views-view-rdf.tpl.php
  *
- * @param array $vars
+ * @param $vars
+ *   Template variables.
  */
 function template_preprocess_views_view_rdf(&$vars) {
   $view     = &$vars['view'];
   $options  = $view->style_handler->options;
   $handler  = $view->style_handler;
-}
\ No newline at end of file
+}
diff -u -p -r vd0/views_xhtml.module vd4/views_xhtml.module
--- vd0/views_xhtml.module	2009-10-07 11:06:47.000000000 -0400
+++ vd4/views_xhtml.module	2009-10-15 19:10:51.000000000 -0400
@@ -1,47 +1,65 @@
 <?php
-//$Id: views_xhtml.module,v 1.1.4.5 2009/10/07 15:06:47 allisterbeharry Exp $
+// $Id$
+
 /**
- @file views_xhtml.module
- Module definition for views_xhtml 
- @see views_xhtml.views.inc
-*/
+ * @file
+ * Module definition for views_xhtml
+ *
+ * @see views_xhtml.views.inc
+ */
+
 
 function views_xhtml_views_api() {
   return array(
-    'api' => 2
+    'api' => 2,
   );
 }
 
+
 /**
- * Strips illegal Unicode characters and encodes entities in string
+ * Strips illegal Unicode characters and encodes entities in string.
  *
- * @param string $input
- * @return string
+ * @param $input
+ *   String to process.
+ * @return
+ *   String with illegal characters stripped away and entities encoded.
  */
 function views_xhtml_strip_illegal_chars($input) {
-  $output = preg_replace('/[\x{80}-\x{A0}'. // Non-printable ISO-8859-1 + NBSP
-        '\x{01}-\x{1F}'. //Non-printable ASCII characters
-        '\x{AD}'. // Soft-hyphen
-        '\x{2000}-\x{200F}'. // Various space characters
-        '\x{2028}-\x{202F}'. // Bidirectional text overrides
-        '\x{205F}-\x{206F}'. // Various text hinting characters
-        '\x{FEFF}'. // Byte order mark
-        '\x{FF01}-\x{FF60}'. // Full-width latin
-        '\x{FFF9}-\x{FFFD}'. // Replacement characters
-        '\x{0}]/u', // NULL byte
-        '', $input);
-  $output = str_replace('"', '&quot;', $output); //encode quote
-  $output = str_replace('&', '&amp;', $output); //encode ampersand
-  $output = str_replace("'", '&apos;', $output); //encode apostrophe
-  $output = str_replace('<', '&lt;', $output); //encode left-angled bracket
-  $output = str_replace('>', '&rt;', $output); //encode right-angled bracket
+  $output = preg_replace(
+              '/[\x{80}-\x{A0}'.      // Non-printable ISO-8859-1 + NBSP
+              '\x{01}-\x{1F}'.        // Non-printable ASCII characters
+              '\x{AD}'.               // Soft-hyphen
+              '\x{2000}-\x{200F}'.    // Various space characters
+              '\x{2028}-\x{202F}'.    // Bidirectional text overrides
+              '\x{205F}-\x{206F}'.    // Various text hinting characters
+              '\x{FEFF}'.             // Byte order mark
+              '\x{FF01}-\x{FF60}'.    // Full-width latin
+              '\x{FFF9}-\x{FFFD}'.    // Replacement characters
+              '\x{0}]/u',             // NULL byte
+            '', $input);
+  $output = str_replace('"', '&quot;', $output);      // encode quote
+  $output = str_replace('&', '&amp;', $output);       // encode ampersand
+  $output = str_replace("'", '&apos;', $output);      // encode apostrophe
+  $output = str_replace('<', '&lt;', $output);        // encode left-angled bracket
+  $output = str_replace('>', '&rt;', $output);        // encode right-angled bracket
   return $output;
 }
 
-function views_xhtml_is_date ($input) {
-  if (strpos($input, 'a:3:{s:5:"month"') !== 0) return $input; 
-  else { //serialized date array
+
+/**
+ * If input is a serialized date array, return a date string
+ *
+ * @param $input
+ *   Input to check.
+ * @return
+ *   Either the original input or a date string.
+ */
+function views_xhtml_is_date($input) {
+  if (strpos($input, 'a:3:{s:5:"month"') !== 0) {
+    return $input;
+  }
+  else {        // serialized date array
     $date = unserialize($input);
-    return date(DATE_ISO8601, mktime(0, 0, 0, $date['month'], $date['day'], $date['year']));
+    return format_date(mktime(0, 0, 0, $date['month'], $date['day'], $date['year']), 'custom', DATE_ISO8601);
   }
 }
diff -u -p -r vd0/views_xhtml.views.inc vd4/views_xhtml.views.inc
--- vd0/views_xhtml.views.inc	2009-09-08 12:37:48.000000000 -0400
+++ vd4/views_xhtml.views.inc	2009-10-15 19:10:51.000000000 -0400
@@ -1,41 +1,45 @@
 <?php
-//$Id: views_xhtml.views.inc,v 1.1.2.3 2009/09/08 16:37:48 allisterbeharry Exp $
+// $Id$
+
 /**
- * @file views_xhtml.views.inc 
+ * @file
  * Views style plugin to render nodes as XHTML microformats.
+ *
  * @see views-view-xhtml.tpl.php
  * @ingroup views_plugins
  */
 
+
 /**
- * Implementation of hook_views_plugin
- *
+ * Implementation of hook_views_plugin().
  */
 function views_xhtml_views_plugins() {
   return array(
-    'module' => views_xhtml,
-	'style' => array( //declare the views_xhtml style plugin
+    'module'  => views_xhtml,
+    'style'   => array(                 // declare the views_xhtml style plugin
       'views_xhtml' => array(
-        'title' => t('XHTML data document'),
-        'theme' => 'views_view_xhtml',
-        'help' => t('Displays nodes as XHTML microformats.'),
-        'handler' => 'views_plugin_style_xhtml',
+        'title'           => t('XHTML data document'),
+        'theme'           => 'views_view_xhtml',
+        'help'            => t('Displays nodes as XHTML microformats.'),
+        'handler'         => 'views_plugin_style_xhtml',
         'uses row plugin' => TRUE,
-        'uses fields' => TRUE,
-        'uses options' => TRUE,
-        'type' => 'normal',       
+        'uses fields'     => TRUE,
+        'uses options'    => TRUE,
+        'type'            => 'normal',
       ),
     ),
   );
 }
 
+
 /**
  * Theme preprocess function for views-view-xhtml.tpl.php
  *
- * @param array $vars
+ * @param $vars
+ *   Template variables.
  */
 function template_preprocess_views_view_xhtml(&$vars) {
   $view     = &$vars['view'];
   $options  = $view->style_handler->options;
   $handler  = $view->style_handler;
-}
\ No newline at end of file
+}
diff -u -p -r vd0/views_xml.module vd4/views_xml.module
--- vd0/views_xml.module	2009-10-07 11:11:13.000000000 -0400
+++ vd4/views_xml.module	2009-10-15 19:10:51.000000000 -0400
@@ -1,10 +1,13 @@
 <?php
-//$Id: views_xml.module,v 1.1.4.6 2009/10/07 15:11:13 allisterbeharry Exp $
+// $Id$
+
 /**
- @file views_xml.module
- Module definition for views_xml 
- @see views_xml.views.inc
-*/
+ * @file
+ * Module definition for views_xml
+ *
+ * @see views_xml.views.inc
+ */
+
 
 function views_xml_views_api() {
   return array(
@@ -12,39 +15,40 @@ function views_xml_views_api() {
   );
 }
 
+
 /**
  * Strips illegal Unicode characters and encodes entities in string
  *
- * @param string $input
- * @return string
+ * @param $input
+ *   String to process.
+ * @return
+ *   String with illegal characters stripped away and entities encoded.
  */
 function views_xml_strip_illegal_chars($input) {
-/*	
-  $output = preg_replace('/[\x{80}-\x{A0}'. // Non-printable ISO-8859-1 + NBSP
-        '\x{01}-\x{1F}'. //Non-printable ASCII characters
-        '\x{AD}'. // Soft-hyphen
-        '\x{2000}-\x{200F}'. // Various space characters
-        '\x{2028}-\x{202F}'. // Bidirectional text overrides
-        '\x{205F}-\x{206F}'. // Various text hinting characters
-        '\x{FEFF}'. // Byte order mark
-        '\x{FF01}-\x{FF60}'. // Full-width latin
-        '\x{FFF9}-\x{FFFD}'. // Replacement characters
-        '\x{0}]/u', // NULL byte
-        '', $input);
-*/
-	$output = preg_replace('/\x((10?|[2-F])FFF[EF]|FDD[0-9A-F]|[19][0-9A-F]|7F|8[0-46-9A-F]|0?[1-8BCEF])/', '', $input);
-  $output = str_replace('"', '&quot;', $output); //encode quote
-  $output = str_replace('&', '&amp;', $output); //encode ampersand
-  $output = str_replace("'", '&apos;', $output); //encode apostrophe
-  $output = str_replace('<', '&lt;', $output); //encode left-angled bracket
-  $output = str_replace('>', '&rt;', $output); //encode right-angled bracket
+  $output = preg_replace('/\x((10?|[2-F])FFF[EF]|FDD[0-9A-F]|[19][0-9A-F]|7F|8[0-46-9A-F]|0?[1-8BCEF])/', '', $input);
+  $output = str_replace('"', '&quot;', $output);      // encode quote
+  $output = str_replace('&', '&amp;', $output);       // encode ampersand
+  $output = str_replace("'", '&apos;', $output);      // encode apostrophe
+  $output = str_replace('<', '&lt;', $output);        // encode left-angled bracket
+  $output = str_replace('>', '&rt;', $output);        // encode right-angled bracket
   return $output;
 }
 
-function views_xml_is_date ($input) {
-	if (strpos($input, 'a:3:{s:5:"month"') !== 0) return $input; 
-	else { //serialized date array
-		$date = unserialize($input);
-		return date(DATE_ISO8601, mktime(0, 0, 0, $date['month'], $date['day'], $date['year']));
-	}
+
+/**
+ * If input is a serialized date array, return a date string
+ *
+ * @param $input
+ *   Input to check.
+ * @return
+ *   Either the original input or a date string.
+ */
+function views_xml_is_date($input) {
+  if (strpos($input, 'a:3:{s:5:"month"') !== 0) {
+    return $input;
+  }
+  else {        // serialized date array
+    $date = unserialize($input);
+    return format_date(mktime(0, 0, 0, $date['month'], $date['day'], $date['year']), 'custom', DATE_ISO8601);
+  }
 }
diff -u -p -r vd0/views_xml.views.inc vd4/views_xml.views.inc
--- vd0/views_xml.views.inc	2009-09-08 12:37:48.000000000 -0400
+++ vd4/views_xml.views.inc	2009-10-15 19:10:51.000000000 -0400
@@ -1,29 +1,31 @@
 <?php
-//$Id: views_xml.views.inc,v 1.1.2.3 2009/09/08 16:37:48 allisterbeharry Exp $
+// $Id$
+
 /**
- * @file views_xml.views.inc 
+ * @file
  * Views style plugins to render nodes in the XML data format.
+ *
  * @see views-view-xml.tpl.php
  * @ingroup views_plugins
  */
 
+
 /**
- * Implementation of hook_views_plugin
- *
+ * Implementation of hook_views_plugin().
  */
 function views_xml_views_plugins() {
   return array(
-    'module' => views_xml,
-	'style' => array( //declare the views_xml_* style plugins
+    'module'  => views_xml,
+    'style'   => array(                 // declare the views_xml_* style plugins
       'views_xml' => array(
-        'title' => t('XML data document'),
-        'theme' => 'views_view_xml',
-        'help' => t('Displays nodes as XML.'),
-        'handler' => 'views_plugin_style_xml',
+        'title'           => t('XML data document'),
+        'theme'           => 'views_view_xml',
+        'help'            => t('Displays nodes as XML.'),
+        'handler'         => 'views_plugin_style_xml',
         'uses row plugin' => TRUE,
-        'uses fields' => TRUE,
-        'uses options' => TRUE,
-        'type' => 'normal',       
+        'uses fields'     => TRUE,
+        'uses options'    => TRUE,
+        'type'            => 'normal',
       ),
     ),
   );
@@ -33,12 +35,12 @@ function views_xml_views_plugins() {
 /**
  * Theme preprocess function for views-view-xml.tpl.php
  *
- * @param array $vars
+ * @param $vars
+ *   Template variables.
  */
 function template_preprocess_views_view_xml(&$vars) {
   $view     = &$vars['view'];
   $options  = $view->style_handler->options;
   $handler  = $view->style_handler;
-  $result = array();  
+  $result   = array();
 }
-
