This repository has been archived by the owner on Aug 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstart.php
99 lines (79 loc) · 3.75 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
/**
* Improved embedding experience
*
* @author Ismayil Khayredinov <[email protected]>
*/
require __DIR__ . '/autoloader.php';
use hypeJunction\Embed\Lists;
use hypeJunction\Embed\Menus;
use hypeJunction\Embed\Router;
use hypeJunction\Embed\Shortcodes;
use hypeJunction\Embed\Uploads;
use hypeJunction\Embed\Views;
elgg_register_event_handler('init', 'system', function() {
elgg_unregister_plugin_hook_handler('register', 'menu:longtext', 'embed_longtext_menu');
elgg_register_plugin_hook_handler('register', 'menu:embed', [Menus::class, 'setupEmbedMenu'], 800);
elgg_register_plugin_hook_handler('filter_options', 'object', [Lists::class, 'addFileSimpletypeOptions']);
elgg_register_ajax_view('embed/safe/entity');
elgg_register_ajax_view('embed/safe/player');
elgg_register_action('embed/player', __DIR__ . '/actions/embed/player.php');
elgg_register_action('embed/buttons', __DIR__ . '/actions/embed/buttons.php', 'admin');
elgg_register_action('embed/code', __DIR__ . '/actions/embed/code.php', 'admin');
elgg_register_plugin_hook_handler('view_vars', 'output/plaintext', [Shortcodes::class, 'filterLongtextOutputVars'], 9999);
elgg_register_plugin_hook_handler('view_vars', 'output/longtext', [Shortcodes::class, 'filterLongtextOutputVars'], 9999);
elgg_register_plugin_hook_handler('view_vars', 'output/excerpt', [Shortcodes::class, 'filterExcerptVars'], 9999);
elgg_register_plugin_hook_handler('view_vars', 'river/elements/layout', [Shortcodes::class, 'addRiverPreview'], 999);
elgg_register_plugin_hook_handler('view_vars', 'object/elements/summary/content', [Shortcodes::class, 'addSummaryPreview'], 999);
elgg_extend_view('forms/file/upload', 'embed/forms/upload', 100);
elgg_register_plugin_hook_handler('action', 'file/upload', [Uploads::class, 'handleUpload'], 100);
elgg_register_plugin_hook_handler('entity:icon:sizes', 'object', [Uploads::class, 'setIconSizes']);
elgg_register_plugin_hook_handler('entity:icon:file', 'object', [Uploads::class, 'setIconFile']);
elgg_register_plugin_hook_handler('route', 'embed', [Router::class, 'routeEmbed']);
elgg_extend_view('input/longtext', 'embed/toolbar');
elgg_extend_view('elgg.css', 'embed/toolbar.css');
// Legacy ckeditor_addons
elgg_register_page_handler('ckeditor', [Router::class, 'handleCKEditor']);
elgg_register_action('upgrade/embed/ckeditor_file', __DIR__ . '/actions/upgrade/embed/ckeditor_file.php');
elgg_register_plugin_hook_handler('view_vars', 'input/plaintext', [Router::class, 'rewriteLegacyURLs']);
elgg_register_plugin_hook_handler('view_vars', 'input/longtext', [Router::class, 'rewriteLegacyURLs']);
elgg_extend_view('elgg.css', 'embed/tab/assets.css');
elgg_extend_view('admin.css', 'embed/tab/assets.css');
elgg_register_plugin_hook_handler('layout', 'page', [Views::class, 'filterLightboxLayout']);
elgg_register_plugin_hook_handler('shell', 'page', [Views::class, 'filterLightboxShell']);
elgg_register_plugin_hook_handler('public_pages', 'walled_garden', [Router::class, 'setPublicPages']);
});
elgg_register_event_handler('upgrade', 'system', function() {
if (!elgg_is_admin_logged_in()) {
return;
}
require_once __DIR__ . '/lib/upgrades.php';
});
/**
* Expand shortcodes
*
* @param string $value Text
* @return string
*/
function hypeapps_expand_embed_shortcodes($value) {
return Shortcodes::expandShortcodes($value);
}
/**
* Strip shortcodes
*
* @param string $value Text
* @return string
*/
function hypeapps_strip_embed_shortcodes($value) {
return Shortcodes::stripShortcodes($value);
}
/**
* Prepares a shortcode tag
*
* @param string $shortcode Shortcode name
* @param array $attrs Attributes
* @return string
*/
function hypeapps_get_shortcode_embed_tag($shortcode, array $attrs = []) {
return Shortcodes::getShortcodeTag($shortcode, $attrs);
}