Source of file AbcURL.php
Size: 1,132 Bytes - Last Modified: 2022-01-13T10:01:10+00:00
/var/www/docs.ssmods.com/process/src/src/abc/code/Classes/AbcURL.php
123456789101112131415161718192021222324252627282930313233343536373839 | <?php class AbcURL{ public $URL; public $originalURL; public function __construct($URL = null){ if (!$URL) $URL = $_SERVER['REQUEST_URI']; $this->URL = $URL; $this->originalURL = $URL; } public static function get($URL = null){ return new self($URL); } // this is a bit brief but will work until something better is put in place public function q(array $data){ $url = parse_url($this->URL); !empty($url['query']) ? parse_str($url['query'],$r) : $r = array() ; $data = array_merge($r,$data); $url['query'] = http_build_query($data); $this->URL = self::buildURL($url); return $this; } public static function buildURL($data){ $url = ""; if (!empty($data['scheme'])) $url.=$data['scheme']."://"; if (!empty($data['user']) && !empty($url['pass'])) $url.=$data['user'].":".$url['pass']."@"; if (!empty($data['host'])) $url.=$data['host']; if (!empty($data['path'])) $url.=$data['path']; if (!empty($data['query'])) $url.="?".$data['query']; if (!empty($data['fragment'])) $url.="#".$data['fragment']; return $url; } } |