aboutsummaryrefslogtreecommitdiff
path: root/mod/externalpages/start.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-04-05 01:13:41 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-04-05 01:13:41 +0000
commit3c5df5af393830e8286d42c609b941cc11a4b5b9 (patch)
tree6eb4008660cd585ece94629b8b6798d1d5e7924f /mod/externalpages/start.php
parent5b1dd341173a44984315cfade6dd1c26bef8efb7 (diff)
downloadelgg-3c5df5af393830e8286d42c609b941cc11a4b5b9.tar.gz
elgg-3c5df5af393830e8286d42c609b941cc11a4b5b9.tar.bz2
Fixes #3235 integrated Kishanthan's commits for cleaner site pages urls
git-svn-id: http://code.elgg.org/elgg/trunk@8943 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/externalpages/start.php')
-rw-r--r--mod/externalpages/start.php36
1 files changed, 27 insertions, 9 deletions
diff --git a/mod/externalpages/start.php b/mod/externalpages/start.php
index 696b617da..051da183a 100644
--- a/mod/externalpages/start.php
+++ b/mod/externalpages/start.php
@@ -8,6 +8,9 @@ register_elgg_event_handler('init', 'system', 'expages_init');
function expages_init() {
// Register a page handler, so we can have nice URLs
+ elgg_register_page_handler('about', 'expages_page_handler');
+ elgg_register_page_handler('terms', 'expages_page_handler');
+ elgg_register_page_handler('privacy', 'expages_page_handler');
elgg_register_page_handler('expages', 'expages_page_handler');
// add a menu item for the admin edit page
@@ -25,21 +28,25 @@ function expages_init() {
* Setup the links to site pages
*/
function expages_setup_footer_menu() {
- $pages = array('about', 'terms', 'privacy');
- foreach ($pages as $page) {
- $url = "expages/read/$page";
- $item = new ElggMenuItem($page, elgg_echo("expages:$page"), $url);
- elgg_register_menu_item('footer', $item);
- }
+ $pages = array('about', 'terms', 'privacy');
+ foreach ($pages as $page) {
+ $url = "$page";
+ $item = new ElggMenuItem($page, elgg_echo("expages:$page"), $url);
+ elgg_register_menu_item('footer', $item);
+ }
}
/**
* External pages page handler
*
- * @param array $page
+ * @param array $page URL segements
+ * @param string $handler Handler identifier
*/
-function expages_page_handler($page) {
- $type = strtolower($page[1]);
+function expages_page_handler($page, $handler) {
+ if ($handler == 'expages') {
+ expages_url_forwarder($page[1]);
+ }
+ $type = strtolower($handler);
$title = elgg_echo("expages:$type");
$content = elgg_view_title($title);
@@ -58,3 +65,14 @@ function expages_page_handler($page) {
$body = elgg_view_layout("one_sidebar", array('content' => $content));
echo elgg_view_page($title, $body);
}
+
+/**
+ * Forward to the new style of URLs
+ *
+ * @param string $page
+ */
+function expages_url_forwarder($page) {
+ global $CONFIG;
+ $url = "{$CONFIG->wwwroot}{$page}";
+ forward($url);
+}