Example #1
0
/**
 * Converts an URL with an IDN host to a ASCII one.
 *
 * @param string $url Input URL.
 *
 * @return string converted URL.
 */
function url_with_idn_to_ascii($url)
{
    $parts = parse_url($url);
    $parts['host'] = idn_to_ascii($parts['host']);
    $httpUrl = new \http\Url($parts);
    return $httpUrl->toString();
}
Example #2
0
 public function GetUrl($numItems = 0)
 {
     $queryArray = array();
     if (!empty($this->LimitVarName) && !empty($this->Limit)) {
         $queryArray[$this->LimitVarName] = $this->Limit;
     }
     if (!empty($this->OffsetVarName) && !empty($this->Offset)) {
         $queryArray[$this->OffsetVarName] = $this->Offset;
     }
     $url = new http\Url($this->Url, array("query" => http_build_query($queryArray)));
     $this->Paginate();
     $this->TotalItems += $numItems;
     $this->HasRows = $this->TotalItems >= $this->Limit * $this->Page;
     $this->Page++;
     return $url->toString();
 }