/include/sitepath.php

Description

Site URL manipulation functions.

$Id: sitepath.php 562 2005-12-02 13:41:38Z stijn $

Functions
getBacklink (line 365)

Compute the link to one directory level up for an URL

  • return: the URL to the directory above the last
string getBacklink (string $url)
  • string $url: the URL to calculate the backlink for
getIndex (line 392)

Return the (topic, title) array for the given directory index

  • return: the (topic, title) array for the given directory
array getIndex (string $url)
  • string $url: the URL to get the title for
getPathInfo (line 126)

Return an array with breadcrumb info.

This function walks the path to the current file and return an array in the form of (href, title) pairs. This array is in order of the tree (so getPathInfo("/bla/bla2") would return an array

 (
     array("bla", "titel for bla"),
     array("bla2", "titel for bla2")
 )

  • return: the array of breadcrumbs
array getPathInfo (string $url)
  • string $url: the URL for the page
getTopics (line 194)

Returns all topics based on the current URL.

Topics are:

  • subdirectories with a file index.php in them
  • files that end in .php in the current directory
  • explicitly included files/directories by listing them in the 'include' page option, separated by comma's. External URLs can be included by using the form 'Title|http://some/url'.
Topics are returned in an array, sorted by title in natural order. A page can override this by specifying the 'topicorder' page option, also separated by comma's.

Topics can be excluded by being listed in the 'exclude' page option, again separated by comma's if necessary.

The array returned is in the same format as getPathInfo, each element being a (href, title) tuple.

  • return: the topics array.
array getTopics (string $url)
  • string $url: the URL to generate the topics array for.
getURLTitle (line 50)

Return the title for an URL.

Returns the last element of the url (minus / or .php) if the URL was not found in the database.

  • return: the title for the URL
string getURLTitle (string $url)
  • string $url: the URL to get the title for
normalizeURL (line 32)

Normalize the given URL to an URL used in the database.

In practice, this means adding 'index.php' to directories, and stripping double slashes from the URL.

  • return: the normalized URL
string normalizeURL (string $url)
  • string $url: the URL to normalize
setURLTitle (line 82)

Set or update the title of a given URL in the database.

void setURLTitle (string $url, string $title, bool $inindex)
  • string $url: the URL to set the title for
  • string $title: the title for the URL
  • bool $inindex: whether this page should be listed in an index
stripDoubleSlashes (line 19)

Strip double slashes from an URL.

Although Apache 2.0.* doesn't seem to allow them in URLs, Apache 1.3.* does, and we don't want them in the database. Other environments (IIS?) might allow them too, but that is untested.

  • return: the URL without '//' in it
string stripDoubleSlashes (string $str)
  • string $str: the URL to strip double slashes from

Documentation generated on Fri, 30 Jun 2006 10:31:38 +0200 by phpDocumentor 1.3.0RC3