poco should now be spec compliant

This commit is contained in:
Friendika 2011-10-27 04:38:33 -07:00
parent abe96155b4
commit ea0ab6fbac
4 changed files with 14 additions and 10 deletions

View file

@ -170,12 +170,12 @@
#$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){

View file

@ -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') {

View file

@ -1,7 +1,7 @@
<entry>
{{ if $entry.id }}<id>$entry.id</id>{{ endif }}
{{ if $entry.displayName }}<displayName>$entry.displayName</displayName>{{ endif }}
{{ if $entry.preferredName }}<preferredName>$entry.preferredName</preferredName>{{ endif }}
{{ if $entry.preferredUsername }}<preferredUsername>$entry.preferredUsername</preferredUsername>{{ endif }}
{{ if $entry.urls }}<urls><value>$entry.urls.value</value><type>$entry.urls.type</type></urls>{{ endif }}
{{ if $entry.photos }}<photos><value>$entry.photos.value</value><type><$entry.photos.type></type></photos>{{ endif }}
{{ if $entry.photos }}<photos><value>$entry.photos.value</value><type>$entry.photos.type</type></photos>{{ endif }}
</entry>

View file

@ -3,12 +3,16 @@
{{ if $response.sorted }}<sorted>$response.sorted</sorted>{{ endif }}
{{ if $response.filtered }}<filtered>$response.filtered</filtered>{{ endif }}
{{ if $response.updatedSince }}<updatedSince>$response.updatedSince</updatedSince>{{ endif }}
{{ if $response.startIndex }}<startIndex>$response.startIndex</startIndex>{{ endif }}
{{ if $response.itemsPerPage }}<itemsPerPage>$response.itemsPerPage</itemsPerPage>{{ endif }}
{{ if $response.totalResults }}<totalResults>$response.totalResults</totalResults>{{ endif }}
<startIndex>$response.startIndex</startIndex>
<itemsPerPage>$response.itemsPerPage</itemsPerPage>
<totalResults>$response.totalResults</totalResults>
{{ if $response.totalResults }}
{{ for $response.entry as $entry }}
{{ inc poco_entry_xml.tpl }}{{ endinc }}
{{ endfor }}
{{ else }}
<entry></entry>
{{ endif }}
</response>