function testabsolutize()
 {
     $result = absolutize("/xxx/../YYY/./zzz/../aaa");
     $expected = "/YYY/aaa";
     $this->assertEquals($expected, $result);
     $result = absolutize("/xxx/YYY/../../zzz/./aaa");
     $expected = "/zzz/aaa";
     $this->assertEquals($expected, $result);
     $result = absolutize("/xxx/YYY/../../zzz/./aaa/..");
     $expected = "/zzz/";
     $this->assertEquals($expected, $result);
 }
Exemple #2
0
 function get($path)
 {
     $f = $this->file . '/' . $path;
     if (strpos($this->url, '?')) {
         $u = str_replace('?', "/{$path}?", $this->url);
     } else {
         if (strpos($this->url, '#')) {
             $u = str_replace('#', "/{$path}#", $this->url);
         } else {
             $u = $this->url . '/' . $path;
         }
     }
     $r = new LocalResource(absolutize($u), absolutize($f));
     return $r;
 }
Exemple #3
0
 function patch_json($json)
 {
     if (raptor_version_decimal_get() < 20004) {
         return $this->patch_array(json_decode($json, 1));
     }
     $r = 0;
     librdf_model_transaction_start($this->_model);
     $data = json_decode($json, 1);
     foreach ($data as $s => $s_data) {
         $s = absolutize($this->_base, $s);
         foreach ($s_data as $p => $p_data) {
             $r += $this->remove_any($s, $p);
         }
     }
     $r += $this->append('json', $json);
     librdf_model_transaction_commit($this->_model);
     return $r;
 }
 function __construct($url, $file)
 {
     $this->url = absolutize($url);
     $this->file = absolutize($file);
 }