Esempio n. 1
0
 function toPng($url)
 {
     global $AR;
     $image = false;
     if ($AR->Webkit2png->path) {
         $url = ar::url($url);
         if ($url->host) {
             // only allow remote fetches
             $cmd = $AR->Webkit2png->xvfbPath . ' ' . $AR->Webkit2png->xvfbOptions . ' ' . $AR->Webkit2png->path . ' ' . $AR->Webkit2png->options . ' ' . escapeshellarg((string) $url);
             //echo $cmd;
             $image = shell_exec($cmd);
         }
     }
     return $image;
 }
Esempio n. 2
0
File: url.php Progetto: poef/ariadne
 function testArrayAccess()
 {
     $base = 'https://www.ariadne-cms.org/';
     $url = ar::url($base);
     $url->query['test']['foo'] = 'bar';
     $this->assertEquals('bar', $url->query['test']['foo']);
     $this->assertEquals($base . '?test%5Bfoo%5D=bar', (string) $url);
     $url->query->test['bar'] = 'foo';
     $this->assertEquals('foo', $url->query->test['bar']);
     $this->assertEquals($base . '?test%5Bfoo%5D=bar&test%5Bbar%5D=foo', (string) $url);
 }
Esempio n. 3
0
 public function post($path, $options = array())
 {
     $url = ar::url($this->rootURL . $path . '.json');
     $json = $this->client->post($url, $options);
     if ($json && !ar_error::isError($json)) {
         return json_decode($json);
     } else {
         return $json;
     }
 }
Esempio n. 4
0
File: xml.php Progetto: poef/ariadne
 protected function bindValue($source, $type)
 {
     if ($source instanceof ar_xmlNode || $source instanceof ar_xmlNodes) {
         $nodeValue = $source->nodeValue;
         if (is_array($nodeValue) && !count($nodeValue)) {
             $nodeValue = null;
         }
     } else {
         $nodeValue = $source;
     }
     if (is_callable($type)) {
         $nodeValue = call_user_func($type, $source);
     } else {
         switch ($type) {
             case 'int':
                 $nodeValue = (int) $nodeValue;
                 break;
             case 'float':
                 $nodeValue = (double) $nodeValue;
                 break;
             case 'string':
                 $nodeValue = (string) $nodeValue;
                 break;
             case 'bool':
                 $nodeValue = (bool) $nodeValue;
                 break;
             case 'url':
                 $nodeValue = ar::url($nodeValue);
                 break;
             case 'xml':
             case 'html':
                 if ($source instanceof ar_xmlNode || $source instanceof ar_xmlNodes) {
                     $nodeValue = (string) $source;
                 }
                 break;
             default:
                 if (is_string($type) && class_exists($type) && ar_pinp::isAllowed($type, '__construct')) {
                     $nodeValue = new $type($nodeValue);
                 }
                 break;
         }
     }
     return $nodeValue;
 }
Esempio n. 5
0
File: ar.php Progetto: poef/ariadne
 public static function _url($url)
 {
     return ar::url($url);
 }