diff options
author | dave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-08 15:51:52 +0000 |
---|---|---|
committer | dave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-08 15:51:52 +0000 |
commit | 1336b9e8ed9cc3f9b9b9c4427f1e0f8bccc96f7d (patch) | |
tree | 9779e38d0f11257f764217d4312020920d425dd2 /mod/sitepages/start.php | |
parent | 21e4f3681d9f936af24e6a44868628ceeb53ddf9 (diff) | |
download | elgg-1336b9e8ed9cc3f9b9b9c4427f1e0f8bccc96f7d.tar.gz elgg-1336b9e8ed9cc3f9b9b9c4427f1e0f8bccc96f7d.tar.bz2 |
Site pages will eventually replace the external pages and custom index plugins as well as introduce a new keywords system to enable dynamic content to be displayed without needing to know php or Elgg. This will be handy for frontpage layout/design.
git-svn-id: http://code.elgg.org/elgg/trunk@5303 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/sitepages/start.php')
-rw-r--r-- | mod/sitepages/start.php | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/mod/sitepages/start.php b/mod/sitepages/start.php new file mode 100644 index 000000000..c6e119959 --- /dev/null +++ b/mod/sitepages/start.php @@ -0,0 +1,72 @@ +<?php +/** + * Elgg external pages editor + */ + +require_once(dirname(__FILE__) . '/sitepages_functions.php'); + +function sitepages_init() { + global $CONFIG; + // Register a page handler, so we can have nice URLs + register_page_handler('sitepages','sitepages_page_handler'); + + // Register a URL handler for external pages + register_entity_url_handler('sitepages_url','object','sitepages'); + + // extend views + elgg_extend_view('footer/links', 'sitepages/footer_menu'); + elgg_extend_view('metatags', 'sitepages/metatags'); + + // Replace the default index page if user has requested + if (get_plugin_setting('ownfrontpage', 'externalpages') == 'yes'){ + register_plugin_hook('index','system','custom_index'); + } + +} + +function custom_index() { + if (!@include_once(dirname(__FILE__) . "/frontpage.php")) return false; + return true; +} + +/** + * Page setup. Adds admin controls to the admin panel. + * + */ +function sitepages_pagesetup(){ + if (get_context() == 'admin' && isadminloggedin()) { + global $CONFIG; + add_submenu_item(elgg_echo('sitepages'), $CONFIG->wwwroot . 'pg/sitepages/'); + } +} + +function sitepages_url($expage) { + global $CONFIG; + return $CONFIG->url . "pg/sitepages/"; +} + +function sitepages_page_handler($page) { + global $CONFIG; + if ($page[0]){ + switch ($page[0]){ + case "read": set_input('sitepages',$page[1]); + include(dirname(__FILE__) . "/read.php"); + break; + default : include($CONFIG->pluginspath . "sitepages/index.php"); + } + }else{ + include($CONFIG->pluginspath . "sitepages/index.php"); + } +} + +// Initialise log browser +register_elgg_event_handler('init','system','sitepages_init'); +register_elgg_event_handler('pagesetup','system','sitepages_pagesetup'); + +// Register actions +global $CONFIG; +register_action("sitepages/add",false,$CONFIG->pluginspath . "sitepages/actions/add.php"); +register_action("sitepages/addfront",false,$CONFIG->pluginspath . "sitepages/actions/addfront.php"); +register_action("sitepages/addmeta",false,$CONFIG->pluginspath . "sitepages/actions/addmeta.php"); +register_action("sitepages/edit",false,$CONFIG->pluginspath . "sitepages/actions/edit.php"); +register_action("sitepages/delete",false,$CONFIG->pluginspath . "sitepages/actions/delete.php");
\ No newline at end of file |