From ea0ab6fbac0dc317eb2e81abedbd3855c08a14c5 Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 27 Oct 2011 04:38:33 -0700 Subject: [PATCH] poco should now be spec compliant --- include/template_processor.php | 4 ++-- mod/poco.php | 4 ++-- view/poco_entry_xml.tpl | 4 ++-- view/poco_xml.tpl | 12 ++++++++---- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/include/template_processor.php b/include/template_processor.php index 63d75eaa4..25f7703a2 100644 --- a/include/template_processor.php +++ b/include/template_processor.php @@ -165,17 +165,17 @@ $this->r = $r; $this->search = array(); $this->replace = array(); - + $this->_build_replace($r, ""); #$s = str_replace(array("\n","\r"),array("§n§","§r§"),$s); $s = $this->_build_nodes($s); + $s = preg_replace_callback('/\|\|([0-9]+)\|\|/', array($this, "_replcb_node"), $s); if ($s==Null) $this->_preg_error(); // remove comments block $s = preg_replace('/{#[^#]*#}/', "" , $s); - // replace strings recursively (limit to 10 loops) $os = ""; $count=0; while($os!=$s && $count<10){ diff --git a/mod/poco.php b/mod/poco.php index c354be863..2c2aeb656 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -76,7 +76,7 @@ function poco_init(&$a) { 'id' => false, 'displayName' => false, 'urls' => false, - 'preferredName' => false, + 'preferredUsername' => false, 'photos' => false ); @@ -114,7 +114,7 @@ function poco_init(&$a) { if($format === 'xml') { header('Content-type: text/xml'); - echo replace_macros(get_markup_template('poco_xml.tpl',array_xmlify(array('$response' => $ret)))); + echo replace_macros(get_markup_template('poco_xml.tpl'),array_xmlify(array('$response' => $ret))); http_status_exit(500); } if($format === 'json') { diff --git a/view/poco_entry_xml.tpl b/view/poco_entry_xml.tpl index 71ca2d13e..8d5515152 100644 --- a/view/poco_entry_xml.tpl +++ b/view/poco_entry_xml.tpl @@ -1,7 +1,7 @@ {{ if $entry.id }}$entry.id{{ endif }} {{ if $entry.displayName }}$entry.displayName{{ endif }} -{{ if $entry.preferredName }}$entry.preferredName{{ endif }} +{{ if $entry.preferredUsername }}$entry.preferredUsername{{ endif }} {{ if $entry.urls }}$entry.urls.value$entry.urls.type{{ endif }} -{{ if $entry.photos }}$entry.photos.value<$entry.photos.type>{{ endif }} +{{ if $entry.photos }}$entry.photos.value$entry.photos.type{{ endif }} diff --git a/view/poco_xml.tpl b/view/poco_xml.tpl index 218c97c5c..9549b695d 100644 --- a/view/poco_xml.tpl +++ b/view/poco_xml.tpl @@ -3,12 +3,16 @@ {{ if $response.sorted }}$response.sorted{{ endif }} {{ if $response.filtered }}$response.filtered{{ endif }} {{ if $response.updatedSince }}$response.updatedSince{{ endif }} -{{ if $response.startIndex }}$response.startIndex{{ endif }} -{{ if $response.itemsPerPage }}$response.itemsPerPage{{ endif }} -{{ if $response.totalResults }}$response.totalResults{{ endif }} +$response.startIndex +$response.itemsPerPage +$response.totalResults + +{{ if $response.totalResults }} {{ for $response.entry as $entry }} {{ inc poco_entry_xml.tpl }}{{ endinc }} {{ endfor }} - +{{ else }} + +{{ endif }}