BugTrack/2213
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
* 相対/絶対 URI について($script, get_script_uri, get_bas...
- ページ: [[BugTrack]]
- 投稿者: [[ぃぉぃぉ]]
- 優先順位: 普通
- 状態: 完了
- カテゴリー: その他
- 投稿日: 2007-03-08 (木) 20:37:49
- バージョン: 1.4.7
- リリース予定バージョン: 1.5.2
#contents
** 関連 [#u4243420]
- [[BugTrack2/101]] サイト内のページへのリンクにもhost名...
- [[BugTrack/341]] SERVER_PORTが443だとリンクが必ず https...
-- [[BugTrack2/124]] 他のポート(443 以外)でのhttps使用
-- [[BugTrack2/299]] SSLのPortが443ではない場合、すべての...
** メッセージ [#ff7b6db9]
[[cvs:lib/func.php]]で、get_script_uri()は
// Get absolute-URI of this script
とコメントがあるように、絶対URIを出力するための関数と思わ...
get_script_uri()をgrepしてみましたが、24ファイルほどヒッ...
~これらの修正を行って動作確認でもして、変更箇所を示したら...
もともと相対URIで使用したかったのは、当方の環境ではDeleGa...
で、相対URIならいけるかな、と。試しにget_script_uriで$scr...
** 現状の修正案 [#m2fe00a8]
-[[ぃぉぃぉ]]案
--[[lib/get_script_uri>BugTrack2/213/lib/get_script_uri]]
--[[lib/make_link.php>BugTrack2/213/lib/make_link.php]]
-名無しさん案
--[[#p82c0bf9]]
** 求められている状態 [#n450c028]
それぞれ、DirectoryIndex(例えばindex.php)を削ったものと、...
*** 絶対URI (absolute URI) [#j61eb657]
http://example.com/
http://example.com/path?query=value
など、相対 URI に加えてスキーム、ホスト名、ポート番号を含...
相対URIにすると正常な動作を妨げるものがある
-RSS出力 -- 絶対URIでないと、購読者がリンクにたどり着けな...
- 自分自身のURIをコンテンツの中に表示させる場合 -- 例: NA...
-HTTP Location ヘッダで使用するURI -- http://www.studying...
-リンクは絶対URIと同様の働きをする。
-$link['reload']の出力が変わっている、ということは、get_s...
- get_script_uri() から 例えば http://pukiwiki.sourceforg...
-- これに対してはむしろ index.php のあるディレクトリURLを...
--- このコメントは逆の事を言われているように思います。デ...
--- そうでしたか。確認はしていなかったので。とにかく、デ...
- 関連: [[BugTrack/554]] [携帯電話] HTTPのLocation ヘッダ...
//#comment
*** 絶対パスによる相対URI (absolute-path reference) [#te9...
/path?query#fragment
/path/file?query#fragment
必ず ''/'' で始まる
//#comment
*** 相対パスによる相対URI (relative-path reference)[#x869...
./path/file
../path/file?query
- 絶対URIに比べ転送量が小さい
- %%get_script_uri()を呼ばずにすむ(空の文字列に置き換えれ...
*** 求められている状態のコメント [#n0c4f321]
- 相対URIでかまわない部分はget_script_uri()を'./'に置き換...
- <a href="?hoge"> は Another HTML-lint で怒られたと思い...
-- そうすると今度は index.php を省略した URL を使用できな...
-- <a href="./?hoge">なら通りそうですた。$script = './'で...
- ./ におきかえようとしているようですが、index.php とは限...
-- おーっと、そうでした。index.phpを省略できるかどうか、...
-- デフォルトは index.php などのスクリプト名、pukiwiki.in...
- 指摘があったようにindex.phpの省略/非省略がありうるので...
- いっそのこと[[静的コンテンツに偽装>cubic9.com:PukiWiki/...
- <a href="?hoge"> は Another HTML-lint で怒られるとして...
-- 結局、[[BugTrack2/213/lib/get_script_uri]] では相対ス...
-- それはなぜ -- &new{2008-01-01 (火) 14:33:03};
-- 「結局」とつなげているのでその上の文章が理由となります...
- 文字列に書き換えようとしていたのが失敗だなぁ。使用箇所...
#comment
--------
** コメント [#i542f783]
*** コメント: 従来までの推移 [#hb0abc89]
- お疲れ様です。細かく拝見していませんが・・・相対パスで...
-そもそもget_script_uri()を呼んでいるのがおかしいですよね...
-- get_script_uri() と $scriptの関係を補足します。$script...
*** コメント: 実現方法 (グローバル変数か関数か) [#vd021d1d]
-以下の仕様でいかがでしょ。 -- [[ぃぉぃぉ]] &new{2007-03-...
++ $script_rel(相対URI)、$script_abs(絶対URI)をlib/init.p...
++ 現状の$script、init.php以外で呼んでいるget_script_uri(...
- 互換性を考慮した場合、グローバル変数 $script は(従来通...
-- できれば関数を呼び出す回数を減らしたいので、$scriptを...
-- ニーズとして求められているURIは二つではないので、その...
-- セキュリティ、およびメンテナンスの観点から、グローバル...
-- クラスで作るのはどうか、といった話題もあると思います。...
- [[ぃぉぃぉ]]さんも「やっぱり関数を呼ぶか式を入れるかが...
- グローバル変数はなしだと思います。現在の $script は get...
-- なるほど、$scriptの現状が分かってきました。「下位互換...
- ずいぶんかかりましたが、get_script_uriに引数を与えて出...
-- [[./lib/get_script_uri]] -- &new{2007-04-20 (金) 03:2...
//#comment
*** コメント [#j92644bd]
- 絶対URL の取得に失敗して、質問箱にくる人もよくいますよ...
-- 絶対パスが必要なものはそういう対応をする必要があると思...
- contents を追加し、関連ページのリンクを追加し、とても大...
- henohenoさん、整理お疲れ様です。検討しやすくなりました...
- [[BugTrack2/260]] -- &new{2007-07-18 (水) 22:29:58};
- [[official:質問箱4/212]] -- &new{2007-12-30 (日) 19:46:...
- HTTP RedirectでのLocationヘッダについて、[[RFC2616>RFC:...
- bugtrack_2213_relative_script_uriブランチで仮対応しまし...
-- (1) commit:8e51d1f113 get_script_uri() のデフォルト動...
-- (2) commit:f88edebdd1 get_script_uri() を使っている個...
-- (3) commit:8e51d1f113 グローバル変数 $script を使って...
- 実質的な効果を考えるとget_script_uri()の標準状態(引数...
#comment
----
*名無しさんのまとめ案 [#zc226003]
叩き台。関数名、仕様も決めてみます。
-pukiwiki.ini.php にて絶対URIか絶対パスか相対パスのうちど...
-- $script_path_reference は以下の何れかの値を取る
--- 'full' - 絶対(Full)URI (absolute URI)
--- 'abs' - 絶対パス (absolute path-reference)
--- 'rel' - 相対パス (relative path-reference)
- 絶対URIの初期化用関数として init_script_full_uri($full)...
-- 旧 get_script_uri($init_uri = "") の動作。中々 $init_u...
- グローバル変数に従って get_script_uri() は絶対URIか絶対...
-- また get_script_uri($path_reference) の形式で 'full', ...
- 必ず絶対URI、絶対パス、相対パス、のいづれかでなければな...
get_script_uri($path_reference) の形式を使用するように''...
-- 例えば必ず絶対URIでなければならないものとして
--- RSS出力 -- 絶対URIでないと、購読者がリンクにたどり着...
--- HTTP Location ヘッダで使用するURI -- http://www.study...
--
などがある。
-- 必ず相対URIでなければならない、というものはない、むし...
--- よって実質的に get_script_uri('rel') が使用されること...
--- ちなみに get_script_uri('rel') は $script_directory_i...
-get_pkwk_baseuri 関数の設置
-- PukiWiki を設置したディレクトリへの絶対URI(index.php ...
-- get_script_uri() と同様に $path_reference 引数を持つ。...
-- 絶対パスの値から index.php を除いて、クッキーの有効パ...
-get_page_uri($page) 関数の設置 (ついでに)
-- ページ参照へのリンクURIを返す。get_script_uri() . '?' ...
-- mod_rewrite や PHP_INFO を使用して html 偽装させたい場...
-- http://www.revulo.com/PukiWiki/Plugin/RewriteMap.html ...
-- これも同様に $path_reference 引数を持つ。同様にデフォ...
**とりあえずの対応をする場合 [#o2bd77f7]
-pukiwiki.ini.php にて絶対URIを使用するか相対URIを使用す...
-init_script_full_uri($init_uri) の用意。get_script_uri($...
-get_script_uri() の変更
-get_pkwk_baseuri() 関数の設置
-get_page_uri($page) 関数の設置 (ついでに)
その後ちくちく変更していく。
絶対URIが必須な自作プラグインなどは、
$script = function_exists('init_script_full_uri') ? get_...
のように対応していってもらう。
**パッチ [#p82c0bf9]
関数設置パッチ。
diff -ru pukiwiki.orig/lib/func.php pukiwiki.path-refere...
--- pukiwiki.orig/lib/func.php 2008-01-08 08:50:30.65625...
+++ pukiwiki.path-reference/lib/func.php 2008-01-08 10:0...
@@ -709,8 +709,54 @@
}
}
-// Get absolute-URI of this script
-function get_script_uri($init_uri = '')
+// Get Page URI (would be modified to use mod_rewrite, ...
+function get_page_uri($page, $path_reference = '')
+{
+ $script = get_script_uri($path_reference);
+ $pageuri = $script . '?' . rawurlencode($page);
+ return $pageuri;
+}
+
+// Get PukiWiki base URI (no index.php)
+function get_pkwk_baseuri($path_reference = '')
+{
+ $script = get_script_uri($path_reference);
+ if (($pos = strrpos($script, '/')) !== FALSE) {
+ $baseuri = substr($script, 0, $pos + 1);
+ }
+ return $baseuri;
+}
+
+// Get script URI
+function get_script_uri($path_reference = '')
+{
+ static $script_full, $script_abs, $script_rel;
+ global $script_path_reference;
+ $path_reference = ($path_reference !== '') ? $path_ref...
+ (isset($script_path_reference) ? $script_path_referen...
+ switch ($path_reference) {
+ case 'rel':
+ if (isset($script_rel)) return $script_rel;
+ $script_rel = '';
+ return $script_rel;
+ break;
+ case 'abs':
+ if (isset($script_abs)) return $script_abs;
+ $script = init_script_full_uri();
+ $parsed = parse_url($script);
+ $script_abs = $parsed['path'];
+ return $script_abs;
+ break;
+ default: // case 'full':
+ if (isset($script_full)) return $script_full;
+ $script_full = init_script_full_uri();
+ return $script_full;
+ break;
+ }
+}
+
+// Init absolute-URI of this script and return it (old ...
+function init_script_full_uri($init_uri = '')
{
global $script_directory_index;
static $script;
diff -ru pukiwiki.orig/lib/init.php pukiwiki.path-refere...
--- pukiwiki.orig/lib/init.php 2008-01-08 08:50:30.67187...
+++ pukiwiki.path-reference/lib/init.php 2008-01-08 09:4...
@@ -129,9 +129,10 @@
// INI_FILE: Init $script
if (isset($script)) {
- get_script_uri($script); // Init manually
+ init_script_full_uri($script); // Init manually
} else {
- $script = get_script_uri(); // Init automatically
+ $script = init_script_full_uri(); // Init automatically
+ // Set $script to support old versions
}
/////////////////////////////////////////////////
diff -ru pukiwiki.orig/pukiwiki.ini.php pukiwiki.path-re...
--- pukiwiki.orig/pukiwiki.ini.php 2008-01-08 08:50:24.9...
+++ pukiwiki.path-reference/pukiwiki.ini.php 2008-01-08 ...
@@ -118,6 +118,10 @@
// Shorten $script: Cut its file name (default: not cut)
//$script_directory_index = 'index.php';
+// Use absolute (full) uri or absolute path-reference o...
+// Experimental function [[dev:BugTrack2/213]]
+//$script_path_reference = 'rel'; // 'full' or 'abs' or...
+
// Site admin's name (CHANGE THIS)
$modifier = 'anonymous';
**コメント [#le5bb87f]
- 最終目標(まとめ)について。[[現状の修正案>./lib/get_sc...
-- いいえ。です。部分的には利用できると思いますがアイデア...
- https:// などはそのままで、でも絶対パスで指定したい場合...
- さて、大分仕様は固まりつつありそうなので、現在の「まと...
-- [[関数設置パッチ>#p82c0bf9]]も作成しました。この仕様で...
- 今まであった pukiwiki.ini.php での絶対URI設定項目である...
- get_page_uri()のような関数は欲しいな、と思っていました...
#comment
* 案C by umorigu [#p02fb3f6]
- 同Wiki内のリンクはすべて相対パスでのリンクとする。 (./?...
- グローバル変数 $script: 絶対URIをマニュアル指定する役割...
-- $script をマニュアル指定する場合は必ず http: //example...
-- Deprecated プラグインから直接この変数を使うことは禁止...
- グローバル変数 $script_directory_index: URIが推測される...
- get_script_uri(): 必ず絶対URIを返す (互換性のため)。 ge...
-- Deprecated 今後は使わない
- get_base_uri(): 自身を示す、コンテキストに応じて適切なU...
-- get_base_uri(PKWK_URI_RELATIVE): 相対URIを返す ( ex: ....
-- get_base_uri(PKWK_URI_ROOT): ルート相対URIを返す ( ex:...
-- get_base_uri(PKWK_URI_ABSOLUTE): 絶対URIを返す ( ex: h...
- get_page_uri($page): ページを示すURIを返す
-- get_page_uri($page, PKWK_URI_RELATIVE): 相対URIを返す ...
-- get_page_uri($page, PKWK_URI_ROOT)
-- get_page_uri($page, PKWK_URI_ABSOLUTE)
- pkwk_base_uri_type_stack_push(PKWK_URI_ABSOLUTE) : get_...
- pkwk_base_uri_type_stack_pop() : pkwk_base_uri_type_sta...
** 互換性 [#b86b0e03]
- $script はこれまで通り、絶対URIを示すが、利用しないのが...
-- 利用しているプラグインは、get_base_uri() を使うように...
- get_script_uri() はこれまで通り、絶対URIを示すが、利用...
-- 利用しているプラグインは、get_base_uri() を使うように...
** 実装 [#q305af99]
- commit:7bad7de4c1 get_base_uri(), get_page_uri() の追加
- commit:82ae29696c get_script_uri()利用箇所のうち、ルー...
- commit:2019096e9d get_script_uri()利用箇所をget_base_ur...
- commit:d4fd351122 グローバル変数$script利用箇所をget_ba...
- commit:1c21a00bd5 Context - pkwk_base_uri_type_stack_pu...
- commit:42880ef94a Canonical URIを絶対パスに設定
** コメント [#l3e072c2]
- これまでの議論を踏まえて案Cで対応しました。だいたい要件...
#comment
終了行:
* 相対/絶対 URI について($script, get_script_uri, get_bas...
- ページ: [[BugTrack]]
- 投稿者: [[ぃぉぃぉ]]
- 優先順位: 普通
- 状態: 完了
- カテゴリー: その他
- 投稿日: 2007-03-08 (木) 20:37:49
- バージョン: 1.4.7
- リリース予定バージョン: 1.5.2
#contents
** 関連 [#u4243420]
- [[BugTrack2/101]] サイト内のページへのリンクにもhost名...
- [[BugTrack/341]] SERVER_PORTが443だとリンクが必ず https...
-- [[BugTrack2/124]] 他のポート(443 以外)でのhttps使用
-- [[BugTrack2/299]] SSLのPortが443ではない場合、すべての...
** メッセージ [#ff7b6db9]
[[cvs:lib/func.php]]で、get_script_uri()は
// Get absolute-URI of this script
とコメントがあるように、絶対URIを出力するための関数と思わ...
get_script_uri()をgrepしてみましたが、24ファイルほどヒッ...
~これらの修正を行って動作確認でもして、変更箇所を示したら...
もともと相対URIで使用したかったのは、当方の環境ではDeleGa...
で、相対URIならいけるかな、と。試しにget_script_uriで$scr...
** 現状の修正案 [#m2fe00a8]
-[[ぃぉぃぉ]]案
--[[lib/get_script_uri>BugTrack2/213/lib/get_script_uri]]
--[[lib/make_link.php>BugTrack2/213/lib/make_link.php]]
-名無しさん案
--[[#p82c0bf9]]
** 求められている状態 [#n450c028]
それぞれ、DirectoryIndex(例えばindex.php)を削ったものと、...
*** 絶対URI (absolute URI) [#j61eb657]
http://example.com/
http://example.com/path?query=value
など、相対 URI に加えてスキーム、ホスト名、ポート番号を含...
相対URIにすると正常な動作を妨げるものがある
-RSS出力 -- 絶対URIでないと、購読者がリンクにたどり着けな...
- 自分自身のURIをコンテンツの中に表示させる場合 -- 例: NA...
-HTTP Location ヘッダで使用するURI -- http://www.studying...
-リンクは絶対URIと同様の働きをする。
-$link['reload']の出力が変わっている、ということは、get_s...
- get_script_uri() から 例えば http://pukiwiki.sourceforg...
-- これに対してはむしろ index.php のあるディレクトリURLを...
--- このコメントは逆の事を言われているように思います。デ...
--- そうでしたか。確認はしていなかったので。とにかく、デ...
- 関連: [[BugTrack/554]] [携帯電話] HTTPのLocation ヘッダ...
//#comment
*** 絶対パスによる相対URI (absolute-path reference) [#te9...
/path?query#fragment
/path/file?query#fragment
必ず ''/'' で始まる
//#comment
*** 相対パスによる相対URI (relative-path reference)[#x869...
./path/file
../path/file?query
- 絶対URIに比べ転送量が小さい
- %%get_script_uri()を呼ばずにすむ(空の文字列に置き換えれ...
*** 求められている状態のコメント [#n0c4f321]
- 相対URIでかまわない部分はget_script_uri()を'./'に置き換...
- <a href="?hoge"> は Another HTML-lint で怒られたと思い...
-- そうすると今度は index.php を省略した URL を使用できな...
-- <a href="./?hoge">なら通りそうですた。$script = './'で...
- ./ におきかえようとしているようですが、index.php とは限...
-- おーっと、そうでした。index.phpを省略できるかどうか、...
-- デフォルトは index.php などのスクリプト名、pukiwiki.in...
- 指摘があったようにindex.phpの省略/非省略がありうるので...
- いっそのこと[[静的コンテンツに偽装>cubic9.com:PukiWiki/...
- <a href="?hoge"> は Another HTML-lint で怒られるとして...
-- 結局、[[BugTrack2/213/lib/get_script_uri]] では相対ス...
-- それはなぜ -- &new{2008-01-01 (火) 14:33:03};
-- 「結局」とつなげているのでその上の文章が理由となります...
- 文字列に書き換えようとしていたのが失敗だなぁ。使用箇所...
#comment
--------
** コメント [#i542f783]
*** コメント: 従来までの推移 [#hb0abc89]
- お疲れ様です。細かく拝見していませんが・・・相対パスで...
-そもそもget_script_uri()を呼んでいるのがおかしいですよね...
-- get_script_uri() と $scriptの関係を補足します。$script...
*** コメント: 実現方法 (グローバル変数か関数か) [#vd021d1d]
-以下の仕様でいかがでしょ。 -- [[ぃぉぃぉ]] &new{2007-03-...
++ $script_rel(相対URI)、$script_abs(絶対URI)をlib/init.p...
++ 現状の$script、init.php以外で呼んでいるget_script_uri(...
- 互換性を考慮した場合、グローバル変数 $script は(従来通...
-- できれば関数を呼び出す回数を減らしたいので、$scriptを...
-- ニーズとして求められているURIは二つではないので、その...
-- セキュリティ、およびメンテナンスの観点から、グローバル...
-- クラスで作るのはどうか、といった話題もあると思います。...
- [[ぃぉぃぉ]]さんも「やっぱり関数を呼ぶか式を入れるかが...
- グローバル変数はなしだと思います。現在の $script は get...
-- なるほど、$scriptの現状が分かってきました。「下位互換...
- ずいぶんかかりましたが、get_script_uriに引数を与えて出...
-- [[./lib/get_script_uri]] -- &new{2007-04-20 (金) 03:2...
//#comment
*** コメント [#j92644bd]
- 絶対URL の取得に失敗して、質問箱にくる人もよくいますよ...
-- 絶対パスが必要なものはそういう対応をする必要があると思...
- contents を追加し、関連ページのリンクを追加し、とても大...
- henohenoさん、整理お疲れ様です。検討しやすくなりました...
- [[BugTrack2/260]] -- &new{2007-07-18 (水) 22:29:58};
- [[official:質問箱4/212]] -- &new{2007-12-30 (日) 19:46:...
- HTTP RedirectでのLocationヘッダについて、[[RFC2616>RFC:...
- bugtrack_2213_relative_script_uriブランチで仮対応しまし...
-- (1) commit:8e51d1f113 get_script_uri() のデフォルト動...
-- (2) commit:f88edebdd1 get_script_uri() を使っている個...
-- (3) commit:8e51d1f113 グローバル変数 $script を使って...
- 実質的な効果を考えるとget_script_uri()の標準状態(引数...
#comment
----
*名無しさんのまとめ案 [#zc226003]
叩き台。関数名、仕様も決めてみます。
-pukiwiki.ini.php にて絶対URIか絶対パスか相対パスのうちど...
-- $script_path_reference は以下の何れかの値を取る
--- 'full' - 絶対(Full)URI (absolute URI)
--- 'abs' - 絶対パス (absolute path-reference)
--- 'rel' - 相対パス (relative path-reference)
- 絶対URIの初期化用関数として init_script_full_uri($full)...
-- 旧 get_script_uri($init_uri = "") の動作。中々 $init_u...
- グローバル変数に従って get_script_uri() は絶対URIか絶対...
-- また get_script_uri($path_reference) の形式で 'full', ...
- 必ず絶対URI、絶対パス、相対パス、のいづれかでなければな...
get_script_uri($path_reference) の形式を使用するように''...
-- 例えば必ず絶対URIでなければならないものとして
--- RSS出力 -- 絶対URIでないと、購読者がリンクにたどり着...
--- HTTP Location ヘッダで使用するURI -- http://www.study...
--
などがある。
-- 必ず相対URIでなければならない、というものはない、むし...
--- よって実質的に get_script_uri('rel') が使用されること...
--- ちなみに get_script_uri('rel') は $script_directory_i...
-get_pkwk_baseuri 関数の設置
-- PukiWiki を設置したディレクトリへの絶対URI(index.php ...
-- get_script_uri() と同様に $path_reference 引数を持つ。...
-- 絶対パスの値から index.php を除いて、クッキーの有効パ...
-get_page_uri($page) 関数の設置 (ついでに)
-- ページ参照へのリンクURIを返す。get_script_uri() . '?' ...
-- mod_rewrite や PHP_INFO を使用して html 偽装させたい場...
-- http://www.revulo.com/PukiWiki/Plugin/RewriteMap.html ...
-- これも同様に $path_reference 引数を持つ。同様にデフォ...
**とりあえずの対応をする場合 [#o2bd77f7]
-pukiwiki.ini.php にて絶対URIを使用するか相対URIを使用す...
-init_script_full_uri($init_uri) の用意。get_script_uri($...
-get_script_uri() の変更
-get_pkwk_baseuri() 関数の設置
-get_page_uri($page) 関数の設置 (ついでに)
その後ちくちく変更していく。
絶対URIが必須な自作プラグインなどは、
$script = function_exists('init_script_full_uri') ? get_...
のように対応していってもらう。
**パッチ [#p82c0bf9]
関数設置パッチ。
diff -ru pukiwiki.orig/lib/func.php pukiwiki.path-refere...
--- pukiwiki.orig/lib/func.php 2008-01-08 08:50:30.65625...
+++ pukiwiki.path-reference/lib/func.php 2008-01-08 10:0...
@@ -709,8 +709,54 @@
}
}
-// Get absolute-URI of this script
-function get_script_uri($init_uri = '')
+// Get Page URI (would be modified to use mod_rewrite, ...
+function get_page_uri($page, $path_reference = '')
+{
+ $script = get_script_uri($path_reference);
+ $pageuri = $script . '?' . rawurlencode($page);
+ return $pageuri;
+}
+
+// Get PukiWiki base URI (no index.php)
+function get_pkwk_baseuri($path_reference = '')
+{
+ $script = get_script_uri($path_reference);
+ if (($pos = strrpos($script, '/')) !== FALSE) {
+ $baseuri = substr($script, 0, $pos + 1);
+ }
+ return $baseuri;
+}
+
+// Get script URI
+function get_script_uri($path_reference = '')
+{
+ static $script_full, $script_abs, $script_rel;
+ global $script_path_reference;
+ $path_reference = ($path_reference !== '') ? $path_ref...
+ (isset($script_path_reference) ? $script_path_referen...
+ switch ($path_reference) {
+ case 'rel':
+ if (isset($script_rel)) return $script_rel;
+ $script_rel = '';
+ return $script_rel;
+ break;
+ case 'abs':
+ if (isset($script_abs)) return $script_abs;
+ $script = init_script_full_uri();
+ $parsed = parse_url($script);
+ $script_abs = $parsed['path'];
+ return $script_abs;
+ break;
+ default: // case 'full':
+ if (isset($script_full)) return $script_full;
+ $script_full = init_script_full_uri();
+ return $script_full;
+ break;
+ }
+}
+
+// Init absolute-URI of this script and return it (old ...
+function init_script_full_uri($init_uri = '')
{
global $script_directory_index;
static $script;
diff -ru pukiwiki.orig/lib/init.php pukiwiki.path-refere...
--- pukiwiki.orig/lib/init.php 2008-01-08 08:50:30.67187...
+++ pukiwiki.path-reference/lib/init.php 2008-01-08 09:4...
@@ -129,9 +129,10 @@
// INI_FILE: Init $script
if (isset($script)) {
- get_script_uri($script); // Init manually
+ init_script_full_uri($script); // Init manually
} else {
- $script = get_script_uri(); // Init automatically
+ $script = init_script_full_uri(); // Init automatically
+ // Set $script to support old versions
}
/////////////////////////////////////////////////
diff -ru pukiwiki.orig/pukiwiki.ini.php pukiwiki.path-re...
--- pukiwiki.orig/pukiwiki.ini.php 2008-01-08 08:50:24.9...
+++ pukiwiki.path-reference/pukiwiki.ini.php 2008-01-08 ...
@@ -118,6 +118,10 @@
// Shorten $script: Cut its file name (default: not cut)
//$script_directory_index = 'index.php';
+// Use absolute (full) uri or absolute path-reference o...
+// Experimental function [[dev:BugTrack2/213]]
+//$script_path_reference = 'rel'; // 'full' or 'abs' or...
+
// Site admin's name (CHANGE THIS)
$modifier = 'anonymous';
**コメント [#le5bb87f]
- 最終目標(まとめ)について。[[現状の修正案>./lib/get_sc...
-- いいえ。です。部分的には利用できると思いますがアイデア...
- https:// などはそのままで、でも絶対パスで指定したい場合...
- さて、大分仕様は固まりつつありそうなので、現在の「まと...
-- [[関数設置パッチ>#p82c0bf9]]も作成しました。この仕様で...
- 今まであった pukiwiki.ini.php での絶対URI設定項目である...
- get_page_uri()のような関数は欲しいな、と思っていました...
#comment
* 案C by umorigu [#p02fb3f6]
- 同Wiki内のリンクはすべて相対パスでのリンクとする。 (./?...
- グローバル変数 $script: 絶対URIをマニュアル指定する役割...
-- $script をマニュアル指定する場合は必ず http: //example...
-- Deprecated プラグインから直接この変数を使うことは禁止...
- グローバル変数 $script_directory_index: URIが推測される...
- get_script_uri(): 必ず絶対URIを返す (互換性のため)。 ge...
-- Deprecated 今後は使わない
- get_base_uri(): 自身を示す、コンテキストに応じて適切なU...
-- get_base_uri(PKWK_URI_RELATIVE): 相対URIを返す ( ex: ....
-- get_base_uri(PKWK_URI_ROOT): ルート相対URIを返す ( ex:...
-- get_base_uri(PKWK_URI_ABSOLUTE): 絶対URIを返す ( ex: h...
- get_page_uri($page): ページを示すURIを返す
-- get_page_uri($page, PKWK_URI_RELATIVE): 相対URIを返す ...
-- get_page_uri($page, PKWK_URI_ROOT)
-- get_page_uri($page, PKWK_URI_ABSOLUTE)
- pkwk_base_uri_type_stack_push(PKWK_URI_ABSOLUTE) : get_...
- pkwk_base_uri_type_stack_pop() : pkwk_base_uri_type_sta...
** 互換性 [#b86b0e03]
- $script はこれまで通り、絶対URIを示すが、利用しないのが...
-- 利用しているプラグインは、get_base_uri() を使うように...
- get_script_uri() はこれまで通り、絶対URIを示すが、利用...
-- 利用しているプラグインは、get_base_uri() を使うように...
** 実装 [#q305af99]
- commit:7bad7de4c1 get_base_uri(), get_page_uri() の追加
- commit:82ae29696c get_script_uri()利用箇所のうち、ルー...
- commit:2019096e9d get_script_uri()利用箇所をget_base_ur...
- commit:d4fd351122 グローバル変数$script利用箇所をget_ba...
- commit:1c21a00bd5 Context - pkwk_base_uri_type_stack_pu...
- commit:42880ef94a Canonical URIを絶対パスに設定
** コメント [#l3e072c2]
- これまでの議論を踏まえて案Cで対応しました。だいたい要件...
#comment
ページ名: