aboutsummaryrefslogtreecommitdiff
path: root/mod/embed/start.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-01 22:33:58 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-01 22:33:58 +0000
commit60fd7ad6ce1c2fbd140edf1a6185649e47735bbc (patch)
tree855de166802e76b0a0f7eb1865381c774eb941a4 /mod/embed/start.php
parent14ef2df751f2e507751d76505d978cf77027b545 (diff)
downloadelgg-60fd7ad6ce1c2fbd140edf1a6185649e47735bbc.tar.gz
elgg-60fd7ad6ce1c2fbd140edf1a6185649e47735bbc.tar.bz2
First pass at a loosely couple embed plugin using ECML.
git-svn-id: http://code.elgg.org/elgg/trunk@6315 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/embed/start.php')
-rw-r--r--mod/embed/start.php75
1 files changed, 46 insertions, 29 deletions
diff --git a/mod/embed/start.php b/mod/embed/start.php
index f98c21245..eb6f6d4a6 100644
--- a/mod/embed/start.php
+++ b/mod/embed/start.php
@@ -1,7 +1,7 @@
<?php
/**
* Elgg media embed plugin
- *
+ *
* @package ElggEmbed
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Curverider Ltd <info@elgg.com>
@@ -13,37 +13,54 @@
* Init function
*
*/
- function embed_init() {
-
- // Extend useful views with stuff we need for our embed modal
- elgg_extend_view('css','embed/css');
- elgg_extend_view('js/initialise_elgg','embed/js');
- elgg_extend_view('metatags','embed/metatags');
- elgg_extend_view('input/longtext','embed/link',1);
-
- // Page handler for the modal media embed
- register_page_handler('embed','embed_page_handler');
-
- }
-
+function embed_init() {
+ elgg_extend_view('css', 'embed/css');
+ elgg_extend_view('js/initialise_elgg', 'embed/js');
+ elgg_extend_view('metatags', 'embed/metatags');
+ elgg_extend_view('input/longtext', 'embed/link', 1);
+
+ // Page handler for the modal media embed
+ register_page_handler('embed', 'embed_page_handler');
+}
+
/**
- * Runs the 'embed' script
+ * Serves pages for upload and embed.
*
+ * @param $page
*/
- function embed_page_handler($page) {
-
- switch($page[0]) {
- case 'upload': require_once(dirname(__FILE__) . '/upload.php');
- exit;
- break;
- default: require_once(dirname(__FILE__) . '/embed.php');
- exit;
- break;
- }
-
+function embed_page_handler($page) {
+ if (!isset($page[0])) {
+ $page[0] = 'embed';
+ }
+
+ switch($page[0]) {
+ case 'upload':
+ echo elgg_view('embed/upload');
+
+ break;
+
+ case 'embed':
+ default:
+ // trigger hook to get section tabs
+ // use views for embed/section/
+ // listing
+ // item
+ // default to embed/listing | item if not found.
+ // @todo trigger for all right now. If we categorize these later we can trigger
+ // for certain categories.
+ $sections = trigger_plugin_hook('embed_get_sections', 'all', NULL, array());
+ asort($sections, SORT_LOCALE_STRING);
+ $active_section = get_input('active_section', NULL);
+
+ echo elgg_view('embed/embed', array(
+ 'sections' => $sections,
+ 'active_section' => $active_section
+ ));
+
+ break;
}
-// Register the init action
- register_elgg_event_handler('init','system','embed_init',10);
+ exit;
+}
-?>
+register_elgg_event_handler('init', 'system', 'embed_init'); \ No newline at end of file