Esempio n. 1
0
 /**
  * Search KAR for a given x.
  *
  * @param string $url    The URL to grab.
  * @param int    $limit  The maximum number of results to return.
  * @param int    $offset The offset of results to return.
  */
 private function search_by_url($url, $limit = 1000, $offset = 0)
 {
     $query = '&limit=' . urlencode($limit) . '&offset=' . urlencode($offset);
     $json = $this->curl($this->_url . $url . $query);
     $objects = json_decode($json);
     if (!is_array($objects)) {
         return;
     }
     $ids = array();
     foreach ($objects as $k => $v) {
         $object = Publication::create_from_api($this, $v);
         $objects[$k] = $object;
         $ids[] = $object->get_id();
     }
     $this->cache_people($ids);
     $this->cache_divisions($ids);
     $this->cache_files($ids);
     return $objects;
 }