protected function build() { $context = $this->getLime(); $q = $this->query($context); $resp = new XMLResponse(); $cnode = $resp->attach('context'); $cnode->appendChild($resp->attach('type', $context->type)); $cnode->appendChild($resp->attach('id', $context->id)); $cnode->appendChild($resp->attach('name', $context->name)); $resp->append($cnode); if ($q->select()) { $resp->status = "ok"; while ($image = $q->hash()) { $node = $resp->attach('image'); $meta = unserialize($image['meta']); $node->appendChild($resp->attach('id', $image['id'])); NuEvent::filter("lime_image_xml", $node, $image); $node->appendChild($resp->attach('timestamp', $meta->gmts)); $node->appendChild($resp->attach('utc', date('r', $meta->gmts))); $node->appendChild($resp->attach('uploader', $meta->user)); $node->appendChild($resp->attach('method', $meta->method)); if ($meta->method == 'url') { $node->appendChild($resp->attach('source', $meta->source)); } $node->appendChild($resp->attach('width', $meta->info[0])); $node->appendChild($resp->attach('height', $meta->info[1])); $resp->append($node); } } return $resp; }
protected function build() { // get Lime, get query $context = $this->getLime(); $q = $this->query($context); // build resp $resp = new JSON($this->time); if ($q->select()) { $resp->status = "ok"; $images = array(); while ($image = $q->hash()) { $data = new Object(); $meta = unserialize($image['meta']); $data->id = $image['id']; $data = NuEvent::filter('lime_image_json', $data, $image); // default data $data->width = $meta->info[0]; $data->height = $meta->info[1]; $data->timestamp = $meta->gmts; $data->utc = date('r', $meta->gmts); $data->uploader = $meta->user; $data->method = $meta->method; if ($meta->method == 'url') { $data->source = $meta->source; } $images[] = $data; } $resp->images = $images; } return $resp; }
public static function loadPage($lime, $owner, &$id = false) { $page = null; $version = self::load($lime, $owner); if (!is_null($version)) { $id = $version['id']; if ($version['text']) { $page = NuEvent::filter('lime_page_instance', $page, $version['text']); } } return $page; }