protected function setRoutes() { // define here available gateways services $gateways = $this->registerGateways(); $this->get('/', array_keys($gateways))->accept(\BOTK\Core\Representations\Standard::renderers()); $this->get('/*', function ($name) use($gateways) { if (!array_key_exists($name, $gateways)) { throw new \Exception("Gateway not found", 404); } header('Content-Type: text/turtle'); return $gateways[$name]()->getStream(); }); }
public static function textRenderer(Address $address) { return Standard::plaintextRenderer($address->toArray()); }
protected function setRoutes() { $this->get('/', 'Hello world')->accept(Standard::renderers()); }
<input type="password" name="password" id="password" value="<?php echo $password; ?> " size="40" /> </details> <label for="endpoint" id="label_for_endpoint">Endpoint: </label> <input type="text" name="endpoint" id="endpoint" value="<?php echo $endpoint; ?> " size="80" /> <details><summary>predefined namespaces</summary> <pre><code> <?php foreach (EasyRdf_Namespace::namespaces() as $prefix => $uri) { print "\tPREFIX {$prefix}: <" . htmlspecialchars($uri) . "><br />\n"; } ?> </code></pre> </details> <label for="query" id="label_for_query">Query: </label> <textarea name="query" id="query" cols="80" rows="10"><?php echo $query; ?> </textarea> <input type="reset" value="Reset" /><input type="submit" value="Submit" /> </form> <?php $form = ob_get_contents(); ob_end_clean(); echo Standard::htmlSerializer($form, Standard::$htmlMetadata, $title = 'SPARQL query Form', "<h1>{$title}</h1>", '', true);
public function testHtmlSerializer() { $array1 = array('1', 2, 'abc', 'de' => 'ef'); $tmp = Representation::htmlSerializer($array1, Representation::$htmlMetadata); $this->assertStringStartsWith('<', $tmp); }