From 21b0e8ce890d9617c9c3073d3cc3988e135f3d0c 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. --- Doxyfile | 2 +- base.xmi | 8 ++++++-- examples/dir/index.xbf | 8 ++++++++ examples/dir/subdir/index.xbf | 11 +++++++++++ examples/index.xbf | 4 ++++ examples/otherdir/index.xbf | 11 +++++++++++ package.xml | 2 +- src/BIFE/Link.php | 31 ++++++++++++++++++++++++++++++- 8 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 examples/dir/index.xbf create mode 100644 examples/dir/subdir/index.xbf create mode 100644 examples/otherdir/index.xbf diff --git a/Doxyfile b/Doxyfile index d217b67..1707af6 100644 --- a/Doxyfile +++ b/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.xmi b/base.xmi index 3581fde..56d770e 100644 --- a/base.xmi +++ b/base.xmi @@ -9,7 +9,7 @@ - + @@ -28,6 +28,8 @@ + + @@ -38,7 +40,7 @@ - + @@ -74,7 +76,9 @@ + + diff --git a/examples/dir/index.xbf b/examples/dir/index.xbf new file mode 100644 index 0000000..b214ba8 --- /dev/null +++ b/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/examples/dir/subdir/index.xbf b/examples/dir/subdir/index.xbf new file mode 100644 index 0000000..af93cdf --- /dev/null +++ b/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/examples/index.xbf b/examples/index.xbf index 87606e8..3e846c1 100644 --- a/examples/index.xbf +++ b/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/examples/otherdir/index.xbf b/examples/otherdir/index.xbf new file mode 100644 index 0000000..e818393 --- /dev/null +++ b/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/package.xml b/package.xml index 0e671ca..a90058f 100644 --- a/package.xml +++ b/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/src/BIFE/Link.php b/src/BIFE/Link.php index 65a134b..0929c3f 100644 --- a/src/BIFE/Link.php +++ b/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