Esempio n. 1
0
 function WYURL($s)
 {
     global $goApp;
     $sQuery = "";
     $iPos = 0;
     $aQueryPairs = array();
     $sPair = "";
     $aKeyValue = array();
     $iMaxProtocolIdentLen = 5;
     // https
     $iPos = strpos($s, ":");
     if ($iPos !== false && $iPos <= $iMaxProtocolIdentLen) {
         $this->sProtocol = strtolower(substr($s, 0, $iPos));
         $s = substr($s, $iPos + 1);
     } else {
         $this->sProtocol = "http";
     }
     if (substr($s, 0, 2) == "//") {
         $iPos = strpos($s, "/", 2);
         if ($iPos !== false) {
             $this->sHost = substr($s, 2, $iPos - 2);
             $s = substr($s, $iPos);
             if (!$s) {
                 $s = "/";
             }
         } else {
             $this->sHost = substr($s, 2);
             $s = "/";
         }
     } else {
         $this->sHost = WYApplication::sHTTPHost();
     }
     $iPos = strpos($s, "#");
     if ($iPos !== false) {
         $this->sAnchor = substr($s, $iPos + 1);
         $s = substr($s, 0, $iPos);
     } else {
         $this->sAnchor = "";
     }
     $this->dQuery = array();
     $iPos = strpos($s, "?");
     if ($iPos !== false) {
         $sQuery = substr($s, $iPos + 1);
         $aQueryPairs = explode("&", $sQuery);
         foreach ($aQueryPairs as $sPair) {
             $aKeyValue = explode("=", $sPair);
             $this->dQuery[$aKeyValue[0]] = isset($aKeyValue[1]) ? urldecode($aKeyValue[1]) : "";
         }
         $s = substr($s, 0, $iPos);
     }
     parent::WYPath($s);
 }