Source for file Util.php
Documentation is available at Util.php
* <p>Rinza_IEパッケージで共通に使用するメソッドを提供するクラスを定義しています。</p>
* @copyright Copyright (c) 2006-2007, Nihon Unisys, Ltd.
* @license http://www.tyzoh.jp/rinza/licenses/LICENSE-1.0.txt Rinza Public License
* ページURLとページ内リンクURLからリンクの絶対URLを取得
* @param string $pageURL ページのURL
* @param string $linkURL ページ内のリンクのURL
* @return string ページ内リンクの絶対URL
if (preg_match("/^(https?:|mailto:)/i", $linkURL)) { // リンクURLが "http(s):" or "mailto:" で始まる
} elseif (preg_match("/^#/", $linkURL)) { // リンクURLが "#" で始まる
$absURL = $pageURL . $linkURL;
} else { // リンクURLが "http(s):" or "mailto:" or "#" 以外で始まる
if (preg_match("/^(\/)/", $linkURL)) { // リンクURLが "/" で始まる
if (preg_match("/^(https?:)$/i", $url_dirname)) { // ページURLのdirnameが "http(s):" である
$absURL = $pageURL . $linkURL;
} else { // ページURLのdirnameが "http(s):" ではない
$checkURL = $url_dirname;
while (preg_match("/^(https?:)$/i", $checkURL) == 0) {
$absURL = $rootURL . $linkURL;
} else { // リンクURL "/" 以外で始まる
if (preg_match("/^([^(\.)]+(\.)[^(\.)]+)$/", $url_basename)) {
$absURL = $url_dirname . '/' . preg_replace("/^(\.\/)/", "", $linkURL);
$absURL = $pageURL . '/' . preg_replace("/^(\.\/)/", "", $linkURL);
// URL正規化 パス内に "../" がある場合にこれを解決したURLに修正する
$urlinfo = explode('../', $absURL);
if (($info = count($urlinfo)) > 1) {
for ($i = 0; $i < $info - 1; $i++ ) {
$rAbsURL = $tmpURL . $urlinfo[$info - 1];
$rAbsURL = $tmpURL . "/" . $urlinfo[$info - 1];
* This Program is distributed under version 1.0 of the Rinza Public
* License Agreement, that is bundled with this package in the file
* LICENSE, and is available through the website at the following URL:
* http://www.tyzoh.jp/rinza/licenses/LICENSE-1.0.txt.
* This is the Original Program.
* The Initial Developer of the Original Program is Nihon Unisys, Ltd.
* The Original Program is copyrighted (C) 2006-2007 by Nihon Unisys, Ltd. with
* There is NO WARRANTY OF ANY KIND by the Initial Developer of the
|