]> git.mxchange.org Git - friendica.git/commitdiff
poco should now be spec compliant
authorFriendika <info@friendika.com>
Thu, 27 Oct 2011 11:38:33 +0000 (04:38 -0700)
committerFriendika <info@friendika.com>
Thu, 27 Oct 2011 11:38:33 +0000 (04:38 -0700)
include/template_processor.php
mod/poco.php
view/poco_entry_xml.tpl
view/poco_xml.tpl

index 63d75eaa4eda15fb9dfe2a1e3e01a223bf219179..25f7703a2192cfe4b41a76c958c35514bb75fe45 100644 (file)
                        $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){
index c354be863d5d54a78004e86ab38c7ee64e6c6374..2c2aeb656ccfd1d82c1a6632d35e9d1f4cd331ca 100644 (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') {
index 71ca2d13e836b50d5b5b62dc08dcf822e3cb090b..8d55151525b2e77599d2fb598d534866266499a3 100644 (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>
index 218c97c5cf23817e6fa0f8e5dcc03ea54104597a..9549b695d1966450827081777daf2b3911fc4c39 100644 (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>