OSDN Git Service

BugTrack/2213 Use relative path for internal link - get_base_uri()
authorumorigu <umorigu@gmail.com>
Sat, 2 Sep 2017 03:50:22 +0000 (12:50 +0900)
committerumorigu <umorigu@gmail.com>
Sat, 2 Sep 2017 03:50:22 +0000 (12:50 +0900)
commit7bad7de4c15128249e5d36a2677569ae0e185733
tree59ae8a27050f9494c6a26fada4eb3bfcd566557a
parent6785d8bbd555898fc1c03775ed608492cff3e8b0
BugTrack/2213 Use relative path for internal link - get_base_uri()

Add URI type enum.

* PKWK_URI_RELATIVE : relative path (ex: ./, index.php )
* PKWK_URI_ROOT : Root relative path (ex: /wiki/)
* PKWK_URI_ABSOLUTE : Absolute URI (ex: http://example.com/wiki/)

We will use get_base_uri() to make internal link.

get_base_uri(): returns simple URL that indicates this script(PukiWiki)

For example for 'http://example.com/wiki/' site,

* `get_base_uri()` returns './'
* `get_base_uri(PKWK_URI_ROOT)` returns '/wiki/'
* `get_base_uri(PKWK_URI_ABSOLUTE)` returns 'http://example.com/wiki/'

get_page_uri($page) returns simple URL that indicates specific page.

For example,

* `get_page_uri('News')` returns './?News'
* `get_page_uri('News', PKWK_URI_ROOT)` returns '/wiki/?News'
* `get_page_uri('News', PKWK_URI_ABSOLUTE)` returns
  'https://example.com/wiki/?News'
lib/func.php
lib/init.php