From 29089cb8d01a4748b84995178051d39e3e960ae9 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Thu, 10 Jul 2003 04:02:26 +0000 Subject: [PATCH] - Added a new feature to Link. Now if the URL is a directory (finishes with '/'), index.xbf is automaticly appended. - Added two new functions to deal with subdirectories and Apaches 'PATH_INFO': getWebPath() and getFsPath(). Both returns a string to prepend to a path to fix it, one for URL paths and the other for Filesystem paths. - Added subdirectory support examples. - Updated UML diagram and version numbers. --- base/Doxyfile | 2 +- base/base.xmi | 8 ++++++-- base/examples/dir/index.xbf | 8 ++++++++ base/examples/dir/subdir/index.xbf | 11 +++++++++++ base/examples/index.xbf | 4 ++++ base/examples/otherdir/index.xbf | 11 +++++++++++ base/package.xml | 2 +- base/src/BIFE/Link.php | 31 +++++++++++++++++++++++++++++- 8 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 base/examples/dir/index.xbf create mode 100644 base/examples/dir/subdir/index.xbf create mode 100644 base/examples/otherdir/index.xbf diff --git a/base/Doxyfile b/base/Doxyfile index d217b67..1707af6 100644 --- a/base/Doxyfile +++ b/base/Doxyfile @@ -4,7 +4,7 @@ # General configuration options #--------------------------------------------------------------------------- PROJECT_NAME = "BIFE Base" -PROJECT_NUMBER = 1.0.0beta1 +PROJECT_NUMBER = 1.0.0beta2 OUTPUT_DIRECTORY = api OUTPUT_LANGUAGE = English USE_WINDOWS_ENCODING = NO diff --git a/base/base.xmi b/base/base.xmi index 3581fde..56d770e 100644 --- a/base/base.xmi +++ b/base/base.xmi @@ -9,7 +9,7 @@ - + @@ -28,6 +28,8 @@ + + @@ -38,7 +40,7 @@ - + @@ -74,7 +76,9 @@ + + diff --git a/base/examples/dir/index.xbf b/base/examples/dir/index.xbf new file mode 100644 index 0000000..b214ba8 --- /dev/null +++ b/base/examples/dir/index.xbf @@ -0,0 +1,8 @@ + + + It worked! +

You're now in a directory. You can go back.

+
+ View BIFE (xbf) source | + View PHP source +
diff --git a/base/examples/dir/subdir/index.xbf b/base/examples/dir/subdir/index.xbf new file mode 100644 index 0000000..af93cdf --- /dev/null +++ b/base/examples/dir/subdir/index.xbf @@ -0,0 +1,11 @@ + + + It worked! +

+ You're now in a subdirectory. You can go + back. +

+
+ View BIFE (xbf) source | + View PHP source +
diff --git a/base/examples/index.xbf b/base/examples/index.xbf index 87606e8..3e846c1 100644 --- a/base/examples/index.xbf +++ b/base/examples/index.xbf @@ -5,6 +5,10 @@

This is a very bad use for BIFE, because I'm writing HTML :-P

A little of 'real' use

Here's a link to another BIFE file

+ Links to subdirectories +

Here's a file in a directory.

+

And a file in a subdirectory.

+

Finally a file in a another directory.


View BIFE (xbf) source | View PHP source diff --git a/base/examples/otherdir/index.xbf b/base/examples/otherdir/index.xbf new file mode 100644 index 0000000..e818393 --- /dev/null +++ b/base/examples/otherdir/index.xbf @@ -0,0 +1,11 @@ + + + It worked! +

+ You're now in a another directory. You can go + back. +

+
+ View BIFE (xbf) source | + View PHP source +
diff --git a/base/package.xml b/base/package.xml index 0e671ca..a90058f 100644 --- a/base/package.xml +++ b/base/package.xml @@ -16,7 +16,7 @@ - 1.0.0beta1 + 1.0.0beta2 2003-06-29 beta Check http://bife.llucax.hn.org/ for details. diff --git a/base/src/BIFE/Link.php b/base/src/BIFE/Link.php index 65a134b..0929c3f 100644 --- a/base/src/BIFE/Link.php +++ b/base/src/BIFE/Link.php @@ -85,6 +85,9 @@ class BIFE_Link extends BIFE_Container { function getURL($attrs) // ~X2C { $url = @$attrs['URL']; + if (substr($url, strlen($url)-1) == '/') { + $url .= 'index.xbf'; // TODO - add a configuration option for this. + } unset($attrs['URL']); $query = array(); foreach($attrs as $name => $value) { @@ -101,6 +104,32 @@ class BIFE_Link extends BIFE_Container { } // -X2C + // +X2C Operation 160 + /** + * Gets the relative path of the current BIFE file for web (URL) usage. + * + * @return string + * @access public + */ + function getWebPath() // ~X2C + { + return (@$_SERVER['PATH_INFO']) ? '../' : './'; + } + // -X2C + + // +X2C Operation 161 + /** + * Gets the relative path of the current BIFE file for filesystem usage. + * + * @return string + * @access public + */ + function getFsPath() // ~X2C + { + return dirname('.' . @$_SERVER['PATH_INFO']) . '/'; + } + // -X2C + // +X2C Operation 157 /** * Renders the widget. @@ -119,4 +148,4 @@ class BIFE_Link extends BIFE_Container { } // -X2C Class :Link -?> +?> \ No newline at end of file -- 2.43.0