예제 #1
0
파일: folksoCloud.php 프로젝트: josf/folkso
 /**
  * Get the raw cloud information from the server. This data is
  * stored in $this->pdata->cloud.
  *
  * @returns folksoCloud object.
  */
 public function getData($max_tags = 0, $meta_only = false, $cloudtype = '')
 {
     $fc = new folksoClient($this->loc->web_url, $this->loc->server_web_path . 'resource.php', 'GET');
     $fc->set_getfields(array('folksoclouduri' => 1, 'folksores' => $this->url, 'folksodatatype' => 'xml', 'folksolimit' => $max_tags));
     if ($cloudtype == 'bypop') {
         $fc->add_getfield('bypop', 1);
     } elseif ($cloudtype == 'bydate') {
         $fc->add_getfield('bydate', 1);
     }
     $result = $fc->execute();
     $status = $fc->query_resultcode();
     if (!$status) {
         trigger_error('no valid status here.', E_USER_ERROR);
     }
     $this->store_new_xml($result, $status);
     return $this;
 }
예제 #2
0
 /**
  * Retrieves an xml list of  tags and sets the $this->ptags object.
  * 
  * @param A resource, either an id or a URL. Default is to use $this->url.
  * @returns folksoPagetags with only the xml part ($rm->xml).
  */
 public function getData($url = '', $max = 0)
 {
     $fc = new folksoClient($this->loc->db_server, $this->loc->get_path . 'resource.php', 'GET');
     $fc->set_getfields(array('folksores' => $url ? $url : $this->url, 'folksodatatype' => 'xml'));
     if (is_numeric($max) && $max > 0) {
         $fc->add_getfield('limit', $max);
     }
     $result = $fc->execute();
     $status = $fc->query_resultcode();
     $this->store_new_xml($result, $status);
     return $this;
 }
예제 #3
0
 function testGetfields()
 {
     $fields = array('folksoStuff' => 'bob', 'folksoThing' => 'blender');
     $this->cl->set_getfields($fields);
     $this->assertTrue(is_string($this->cl->getfields));
     $this->assertEqual($this->cl->getfields, 'folksoStuff=bob&folksoThing=blender');
     $this->assertEqual($this->cl->build_req(), 'localhost/tag.php?folksoStuff=bob&folksoThing=blender');
     $this->cl->datastyle = 'b';
     $this->assertEqual($this->cl->build_req(), 'localhost/tag.php?folksoStuff=bob&folksoThing=blender&folksodatastyle=b');
     $this->assertEqual($this->cl->content_length, 0);
     $this->cl->add_getfield('splurg', 'blorp');
     $this->assertPattern('/blorp/', $this->cl->build_req());
     $this->assertPattern('/splurg/', $this->cl->build_req());
     print $this->cl->build_req();
     $bb = new folksoClient('localhost', '/tag.php', 'GET');
     $bb->set_getfields(array('folksoB' => 'bébé'));
     $this->assertEqual($bb->getfields, 'folksoB=' . urlencode('bébé'));
     $bb->add_getfield('bebop', 'areebob');
     $this->assertPattern('/bebop=/', $bb->build_req());
     $this->assertPattern('/=areebob/', $bb->build_req());
     $this->cl->execute();
     $this->assertEqual($this->cl->query_resultcode(), 200);
 }