This repository has been archived by the owner on Apr 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.php
99 lines (79 loc) · 2.43 KB
/
start.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
/**
* start.php
*
* This mod adds some javascript to thewire/all page on the elgg site. It works with the GCAPI mod to check if there are new wire posts and adds the new posts directly to the DOM through ajax
*
* @author Nick github.com/piet0024
* @author Ilia github.com/phanoix
**/
elgg_register_event_handler('init', 'system', 'gc_streaming_init');
function gc_streaming_init(){
elgg_require_js("stream_wire");
elgg_require_js("stream_newsfeed");
elgg_extend_view('css/elgg', 'css/css');
elgg_register_ajax_view('ajax/wire_posts');
elgg_register_ajax_view('ajax/newsfeed_items');
elgg_register_ajax_view('ajax/newsfeed_check');
elgg_register_page_handler('thewire', 'streaming_wire_page');
// live stream wire widget
elgg_register_widget_type('stream_wire_index',elgg_echo ('custom_index_widgets:stream_wire_index'),elgg_echo ('custom_index_widgets:stream_wire_index'), array("custom_index_widgets"), true);
if(elgg_is_logged_in()){
$newsfeed_title = elgg_echo('newsfeed:title');
}else{
$newsfeed_title = elgg_echo('newsfeed:titlenolog');
}
elgg_register_widget_type('stream_newsfeed_index', $newsfeed_title, elgg_echo ('custom_index_widgets:stream_newsfeed_index'), array("custom_index_widgets"), true);
}
function streaming_wire_page($page){
$base_dir = elgg_get_plugins_path() . 'thewire/pages/thewire';
//The wire/all page is overwritten in this theme
$stream_dir = elgg_get_plugins_path() .'gc_streaming_content/pages/thewire';
if (!isset($page[0])) {
$page = array('all');
}
switch ($page[0]) {
case "all":
include "$stream_dir/everyone.php";
break;
case "friends":
include "$base_dir/friends.php";
break;
case "owner":
include "$base_dir/owner.php";
break;
case "view":
if (isset($page[1])) {
set_input('guid', $page[1]);
}
include "$base_dir/view.php";
break;
case "thread":
if (isset($page[1])) {
set_input('thread_id', $page[1]);
}
include "$base_dir/thread.php";
break;
case "reply":
if (isset($page[1])) {
set_input('guid', $page[1]);
}
include "$base_dir/reply.php";
break;
case "tag":
if (isset($page[1])) {
set_input('tag', $page[1]);
}
include "$base_dir/tag.php";
break;
case "previous":
if (isset($page[1])) {
set_input('guid', $page[1]);
}
include "$base_dir/previous.php";
break;
default:
return false;
}
return true;
}