<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Input; class StaticQueryUrl { public $map = array(); public $glue = '-'; private $query = array(); public function __construct($PGfuX = array()) { $this->map = $PGfuX; } public static function build($PGfuX = array('key' => 'k')) { return new static($PGfuX); } public function add($VFU9l, $pztz4) { $this->map[$VFU9l] = $pztz4; } public function create($vw3jY) { goto FPe3t; savwB: return join($this->glue, $tpgiq); goto CK7G2; Pqxsm: sort($tpgiq); goto savwB; FPe3t: $tpgiq = array(); goto f2b7T; f2b7T: foreach ($vw3jY as $pztz4 => $Q0rz2) { if (null === $Q0rz2) { continue; } if (isset($this->map[$pztz4])) { if (is_array($Q0rz2)) { $tpgiq[] = $this->map[$pztz4] . $Q0rz2[0]; } else { $tpgiq[] = $this->map[$pztz4] . urlencode("{$Q0rz2}"); } } } goto Pqxsm; CK7G2: } public function createMerge($vw3jY) { return $this->create(array_merge($this->query, $vw3jY)); } public function parse($PoOp2) { goto Ip01u; g7_aE: foreach ($auep5 as $OV1o4) { foreach ($this->map as $VFU9l => $pztz4) { if (strpos($OV1o4, $pztz4) === 0) { $vw3jY[$VFU9l] = substr($OV1o4, strlen($pztz4)); } } } goto PNPfn; sw7EC: return $vw3jY; goto rpUgB; PuNlq: $auep5 = explode($this->glue, $PoOp2); goto g7_aE; Ip01u: $vw3jY = array(); goto PuNlq; PNPfn: $this->query = $vw3jY; goto sw7EC; rpUgB: } public function parseMergeQuery($vw3jY) { foreach ($vw3jY as $pztz4 => $Q0rz2) { $this->query[$pztz4] = $Q0rz2; } } public function getQuery() { return $this->query; } }