aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/pagehandler.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-28 19:17:36 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-28 19:17:36 +0000
commit7ddd9521b3f3a397da3b0a6b56238d31414eb4be (patch)
tree6eb6a9a51db5fa0f5d3cc2ec6de29b9e258b12a1 /engine/lib/pagehandler.php
parentbd3484417d170e62bc94e9db81d4ad37e8ddee6a (diff)
downloadelgg-7ddd9521b3f3a397da3b0a6b56238d31414eb4be.tar.gz
elgg-7ddd9521b3f3a397da3b0a6b56238d31414eb4be.tar.bz2
Standardized code in all of core, not including language files, tests, or core mods.
git-svn-id: http://code.elgg.org/elgg/trunk@7124 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/pagehandler.php')
-rw-r--r--engine/lib/pagehandler.php25
1 files changed, 15 insertions, 10 deletions
diff --git a/engine/lib/pagehandler.php b/engine/lib/pagehandler.php
index 53f68630b..5685ecd9f 100644
--- a/engine/lib/pagehandler.php
+++ b/engine/lib/pagehandler.php
@@ -2,8 +2,8 @@
/**
* Elgg page handler functions
*
- * @package Elgg
- * @subpackage Core
+ * @package Elgg.Core
+ * @subpackage Routing
*/
/**
@@ -12,7 +12,8 @@
* If a page handler returns FALSE, the request is handed over to the default_page_handler.
*
* @param string $handler The name of the handler type (eg 'blog')
- * @param array $page The parameters to the page, as an array (exploded by '/' slashes)
+ * @param array $page The parameters to the page, as an array (exploded by '/' slashes)
+ *
* @return true|false Depending on whether a registered page handler was found
*/
function page_handler($handler, $page) {
@@ -20,7 +21,7 @@ function page_handler($handler, $page) {
set_context($handler);
- $page = explode('/',$page);
+ $page = explode('/', $page);
// remove empty array element when page url ends in a / (see #1480)
if ($page[count($page) - 1] === '') {
array_pop($page);
@@ -52,7 +53,7 @@ function page_handler($handler, $page) {
* Registers a page handler for a particular identifier
*
* For example, you can register a function called 'blog_page_handler' for handler type 'blog'
- * Now for all URLs of type http://yoururl/pg/blog/*, the blog_page_handler() function will be called.
+ * For all URLs http://yoururl/pg/blog/*, the blog_page_handler() function will be called.
* The part of the URL marked with * above will be exploded on '/' characters and passed as an
* array to that function.
* For example, the URL http://yoururl/blog/username/friends/ would result in the call:
@@ -66,8 +67,9 @@ function page_handler($handler, $page) {
* The context is set to the page handler identifier before the registered
* page handler function is called. For the above example, the context is set to 'blog'.
*
- * @param string $handler The page type to handle
+ * @param string $handler The page type to handle
* @param string $function Your function name
+ *
* @return true|false Depending on success
*/
function register_page_handler($handler, $function) {
@@ -87,13 +89,15 @@ function register_page_handler($handler, $function) {
* Unregister a page handler for an identifier
*
* Note: to replace a page handler, call register_page_handler()
- *
+ *
* @param string $handler The page type identifier
+ *
* @since 1.7.2
+ * @return void
*/
function unregister_page_handler($handler) {
global $CONFIG;
-
+
if (!isset($CONFIG->pagehandler)) {
return;
}
@@ -105,8 +109,9 @@ function unregister_page_handler($handler) {
* A default page handler
* Tries to locate a suitable file to include. Only works for core pages, not plugins.
*
- * @param array $page The page URL elements
+ * @param array $page The page URL elements
* @param string $handler The base handler
+ *
* @return true|false Depending on success
*/
function default_page_handler($page, $handler) {
@@ -116,7 +121,7 @@ function default_page_handler($page, $handler) {
// protect against including arbitary files
$page = str_replace("..", "", $page);
-
+
$callpath = $CONFIG->path . $handler . "/" . $page;
if (is_dir($callpath)) {
$callpath = sanitise_filepath($callpath);