<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Input; class StaticQueryUrl { public $map = array(); public $glue = '-'; private $query = array(); public function __construct($yW3Iq = array()) { $this->map = $yW3Iq; } public static function build($yW3Iq = array('key' => 'k')) { return new static($yW3Iq); } public function add($rvTrU, $GBNIv) { $this->map[$rvTrU] = $GBNIv; } public function create($lpymm) { goto FMloy; FMloy: $YjgEW = array(); goto s35Po; YcB45: return join($this->glue, $YjgEW); goto ARDRj; Z6TI5: sort($YjgEW); goto YcB45; s35Po: foreach ($lpymm as $GBNIv => $VFelt) { if (null === $VFelt) { continue; } if (isset($this->map[$GBNIv])) { if (is_array($VFelt)) { $YjgEW[] = $this->map[$GBNIv] . $VFelt[0]; } else { $YjgEW[] = $this->map[$GBNIv] . urlencode("{$VFelt}"); } } } goto Z6TI5; ARDRj: } public function createMerge($lpymm) { return $this->create(array_merge($this->query, $lpymm)); } public function parse($VNVO6) { goto CAhR1; CAhR1: $lpymm = array(); goto hGkXP; hGkXP: $SZN9e = explode($this->glue, $VNVO6); goto IKtPH; VRWfE: return $lpymm; goto YydY4; IKtPH: foreach ($SZN9e as $nsWl0) { foreach ($this->map as $rvTrU => $GBNIv) { if (strpos($nsWl0, $GBNIv) === 0) { $lpymm[$rvTrU] = substr($nsWl0, strlen($GBNIv)); } } } goto GzYE4; GzYE4: $this->query = $lpymm; goto VRWfE; YydY4: } public function parseMergeQuery($lpymm) { foreach ($lpymm as $GBNIv => $VFelt) { $this->query[$GBNIv] = $VFelt; } } public function getQuery() { return $this->query; } }