forked from Daltonstudio/hypeWall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.php
160 lines (125 loc) · 5.19 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
/**
* User Walls
*
* @package hypeJunction
* @subpackage Wall
*
* @author Ismayil Khayredinov <[email protected]>
*/
namespace hypeJunction\Wall;
const PLUGIN_ID = 'hypeWall';
const PAGEHANDLER = 'wall';
define('WALL_MODEL', elgg_get_plugin_setting('model', PLUGIN_ID));
define('WALL_MODEL_WALL', 1);
define('WALL_MODEL_WIRE', 2);
define('WALL_SUBTYPE', (WALL_MODEL == WALL_MODEL_WIRE) ? 'thewire' : 'hjwall');
define('WALL_GEOPOSITIONING', elgg_get_plugin_setting('geopositioning', PLUGIN_ID));
define('WALL_TAG_FRIENDS', elgg_get_plugin_setting('tag_friends', PLUGIN_ID));
require_once __DIR__ . '/vendors/autoload.php';
require_once __DIR__ . '/lib/functions.php';
require_once __DIR__ . '/lib/events.php';
require_once __DIR__ . '/lib/hooks.php';
require_once __DIR__ . '/lib/page_handlers.php';
elgg_register_event_handler('init', 'system', __NAMESPACE__ . '\\init');
elgg_register_event_handler('upgrade', 'system', __NAMESPACE__ . '\\upgrade');
/**
* Initialize the plugin
*
* @return void
*/
function init() {
/**
* Handle pages and URLs
*/
elgg_register_page_handler(PAGEHANDLER, __NAMESPACE__ . '\\page_handler');
elgg_register_plugin_hook_handler('entity:url', 'object', __NAMESPACE__ . '\\url_handler');
/**
* Add wall posts to search
*/
elgg_register_entity_type('object', 'hjwall');
/**
* JS, CSS and Views
*/
elgg_extend_view('css/elgg', 'css/framework/wall/stylesheet.css');
elgg_extend_view('js/elgg', 'js/framework/wall/elgg.js');
// Load fonts
elgg_register_css('fonts.font-awesome', '/mod/' . PLUGIN_ID . '/vendors/fonts/font-awesome.css');
elgg_register_css('fonts.open-sans', '/mod/' . PLUGIN_ID . '/vendors/fonts/open-sans.css');
// Add User Location to config
elgg_extend_view('js/initialize_elgg', 'js/framework/wall/config');
/**
* Views
*/
// Display wall form
elgg_extend_view('page/layouts/elements/filter', 'framework/wall/container', 100);
// AJAX view to load URL previews
elgg_register_ajax_view('output/wall/url');
/**
* Register actions
*/
$actions_path = __DIR__ . '/actions/';
elgg_register_action('wall/status', $actions_path . 'wall/status.php');
elgg_register_action('wall/photo', $actions_path . 'wall/photo.php');
elgg_register_action('wall/file', $actions_path . 'wall/file.php');
elgg_register_action('wall/content', $actions_path . 'wall/content.php');
elgg_register_action('wall/url', $actions_path . 'wall/url.php');
elgg_register_action('wall/upload', $actions_path . 'wall/upload.php');
elgg_register_action('wall/delete', $actions_path . 'wall/delete.php');
elgg_register_action('wall/remove_tag', $actions_path . 'wall/remove_tag.php');
elgg_register_action('wall/geopositioning/update', $actions_path . 'wall/geopositioning/update.php', 'public');
/**
* Register hooks
*/
//elgg_register_plugin_hook_handler('permissions_check', 'object', __NAMESPACE__ . '\\permissions_check');
elgg_register_plugin_hook_handler('container_permissions_check', 'object', __NAMESPACE__ . '\\container_permissions_check');
elgg_register_plugin_hook_handler('register', 'menu:river', __NAMESPACE__ . '\\river_menu_setup');
elgg_register_plugin_hook_handler('register', 'menu:entity', __NAMESPACE__ . '\\entity_menu_setup');
elgg_register_plugin_hook_handler('register', 'menu:owner_block', __NAMESPACE__ . '\\owner_block_menu_setup');
elgg_register_plugin_hook_handler('register', 'menu:user_hover', __NAMESPACE__ . '\\user_hover_menu_setup');
elgg_register_widget_type('wall', elgg_echo('wall'), elgg_echo('wall:widget:description'));
elgg_register_plugin_hook_handler('get_views', 'ecml', __NAMESPACE__ . '\\get_ecml_views');
elgg_register_plugin_hook_handler('view', 'object/thewire', __NAMESPACE__ . '\\hijack_wire');
elgg_register_plugin_hook_handler('view', 'river/object/thewire/create', __NAMESPACE__ . '\\hijack_wire_river');
/**
* Notifications
*/
elgg_register_event_handler('publish', 'object', __NAMESPACE__ . '\\send_custom_notifications');
elgg_register_notification_event('object', 'hjwall', array('publish'));
elgg_register_plugin_hook_handler('prepare', 'notification:publish:object:hjwall', __NAMESPACE__ . '\\prepare_notification_message');
elgg_register_notification_event('object', 'thewire', array('publish'));
elgg_register_plugin_hook_handler('prepare', 'notification:publish:object:thewire', __NAMESPACE__ . '\\prepare_notification_message');
/**
* Group tools
*/
add_group_tool_option('wall', elgg_echo('wall:groups:enable'), false);
elgg_extend_view('groups/tool_latest', 'framework/wall/group_module');
/**
* Tests
*/
elgg_register_plugin_hook_handler('unit_test', 'system', __NAMESPACE__ . '\\unit_test');
}
/**
* Run upgrade scripts
*
* @return void
*/
function upgrade() {
if (elgg_is_admin_logged_in()) {
include_once __DIR__ . '/lib/upgrades.php';
}
}
/**
* Run unit tests
*
* @param string $hook Equals 'unit_test'
* @param string $type Equals 'system'
* @param array $value An array of unit test locations
* @param array $params Additional params
* @return array Updated array of unit test locations
*/
function unit_test($hook, $type, $value, $params) {
$path = elgg_get_plugins_path();
//$value[] = $path . PLUGIN_ID . '/tests/permissions.php';
return $value;
}