- Replaced underscores in file path caching with a tilde instead.

This commit is contained in:
Dave Mc Nicoll committed 2019-12-19 09:53:15 -05:00
1 parent 0ce9955631
commit 079d8b058d
3 files changed
+57 -4

No files matched your search

+54 -1
View File
@@ -4,10 +4,63 @@ namespace Picea\Extension;
class UrlExtension implements Extension {
protected string $urlBase;
public array $tokens = [ "url" , "route" ];
public function __construct(string $urlBase = "") {
$this->urlBase = $urlBase;
}
public function addRoute(string $routeName, string $url, array $parameters = [])
{
}
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
return "<?php /* echo url ?? */ ?>";
}
/**
* Return URI formatted
*/
public function uri($query_string = false) {
$uri = $_SERVER['REQUEST_URI'] ?? $this->php_self() . ($query_string ? $this->query_string() : "");
}
if ( ! $query_string ) {
$uri = explode('?', $uri, 2)[0];
}
if (($base = $this->config['base'] ?? false) && ( stripos($uri, $base) === 0 )) {
$uri = substr($uri, strlen($base));
}
return '/' . ltrim($uri, '/');
}
public function php_self() {
return isset($_SERVER['PHP_SELF']) ? str_replace(NEX . '/', '', $_SERVER['PHP_SELF']) : null;
}
/**
* Return query string
*/
public function query_string() {
return isset($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : "";
}
/**
* Check if Uri's segments are valid
* @param array $segments The uri's segments
*/
public function secure($segments = []) {
return array_diff($segments, ['..', '://']);
}
public function domain() {
$domain_list = (array) $this->config('Eckinox.system.url.root');
$current = strtolower($_SERVER['HTTP_HOST']);
return $domain = in_array($current, $domain_list) ? $current : $domain_list[0];
}
}