diff options
author | friendica <info@friendica.com> | 2012-07-29 22:43:51 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-07-29 22:43:51 -0700 |
commit | 194c52aee590a209cc38ee8fb322ff7dc4a9143d (patch) | |
tree | 1fedc5103d47bd030d8519a0e09deeb25af7575b | |
parent | 4824e5b8b8d57ba9af8a5a26f78a5dc90eb714d1 (diff) | |
download | volse-hubzilla-194c52aee590a209cc38ee8fb322ff7dc4a9143d.tar.gz volse-hubzilla-194c52aee590a209cc38ee8fb322ff7dc4a9143d.tar.bz2 volse-hubzilla-194c52aee590a209cc38ee8fb322ff7dc4a9143d.zip |
get_item_elements (json version)
-rw-r--r-- | include/identity.php | 27 | ||||
-rwxr-xr-x | include/items.php | 52 |
2 files changed, 79 insertions, 0 deletions
diff --git a/include/identity.php b/include/identity.php new file mode 100644 index 000000000..7067bc667 --- /dev/null +++ b/include/identity.php @@ -0,0 +1,27 @@ +<?php + + + +class simple_identity { + + private identity_uid; + private identity_name; + private identity_url; + private identity_photo; + + function __construct($uid = '',$name = '',$url = '',$photo = '') { + $this->identity_uid = $uid; + $this->identity_name = $name; + $this->identity_url = $url; + $this->identity_photo = $photo; + } + + function to_array() { + return array( + 'zuid' => $this->identity_uid, + 'name' => $this->identity_name, + 'url' => $this->identity_url, + 'photo' => $this->identity_photo + ); + } +}
\ No newline at end of file diff --git a/include/items.php b/include/items.php index b7115587b..2381dd2ea 100755 --- a/include/items.php +++ b/include/items.php @@ -400,6 +400,58 @@ function title_is_body($title, $body) { } +function get_item_elements($j) { + + $arr = array(); + + if(strlen($j->signed)) + $arr['body'] = htmlentities($j->signed,ENT_COMPAT,'UTF-8'); + else + $arr['body'] = (($j->body) ? htmlentities($j->body,ENT_COMPAT,'UTF-8') : ''); + + $arr['created'] = datetime_convert('UTC','UTC',$j->created); + $arr['edited'] = datetime_convert('UTC','UTC',$j->edited); + + if($arr['created'] > datetime_convert()) + $arr['created'] = datetime_convert(); + if($arr['edited'] > datetime_convert()) + $arr['edited'] = datetime_convert(); + + $arr['title'] = (($j->title) ? htmlentities($j->title, ENT_COMPAT,'UTF-8') : ''); + $arr['app'] = (($j->app) ? htmlentities($j->app, ENT_COMPAT,'UTF-8') : ''); + $arr['uri'] = (($j->uri) ? htmlentities($j->uri, ENT_COMPAT,'UTF-8') : ''); + $arr['puri'] = (($j->puri) ? htmlentities($j->puri, ENT_COMPAT,'UTF-8') : ''); + $arr['plink'] = (($j->plink) ? htmlentities($j->plink, ENT_COMPAT,'UTF-8') : ''); + $arr['location'] = (($j->location) ? htmlentities($j->location, ENT_COMPAT,'UTF-8') : ''); + $arr['coord'] = (($j->coord) ? htmlentities($j->coord, ENT_COMPAT,'UTF-8') : ''); + $arr['verb'] = (($j->verb) ? htmlentities($j->verb, ENT_COMPAT,'UTF-8') : ''); + $arr['objtype'] = (($j->objtype) ? htmlentities($j->objtype, ENT_COMPAT,'UTF-8') : ''); + $arr['tgttype'] = (($j->tgttype) ? htmlentities($j->tgttype, ENT_COMPAT,'UTF-8') : ''); + + $arr['obj'] = $j->obj; + $arr['tgt'] = $j->tgt; + + $arr['attach'] = $j->attach; + $arr['tags'] = $j->tags; + + $arr['privacy'] = $j->privacy; + + $arr['flags'] = intval($j->flags); + $arr['types'] = intval($j->types); + + $arr['author'] = $j->author; + + $arr['new'] = 1; + + return $arr; + +} + + + + + + function get_atom_elements($feed,$item) { |