-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathactivate.php
45 lines (39 loc) · 1.07 KB
/
activate.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
<?php
/**
* Anypage
*
* Set version
* Register classes
* Add example pages
* Add admin notice
*/
if (!elgg_get_plugin_setting('version', 'anypage')) {
elgg_set_plugin_setting('version', '2012083000', 'anypage');
}
if (get_subtype_id('object', 'anypage')) {
update_subtype('object', 'anypage', 'AnyPage');
} else {
add_subtype('object', 'anypage', 'AnyPage');
}
// add example if no pages
$count = elgg_get_entities(array(
'type' => 'object',
'subtype' => 'anypage',
'count' => true
));
if (!$count) {
$page = new AnyPage();
$page->title = elgg_echo('anypage:example:view:title');
$page->setPagePath('/example/test_view');
$page->setRenderType('view');
$page->save();
$page = new AnyPage();
$page->title = elgg_echo('anypage:example:title');
$page->setPagePath('/anypage/example');
$page->description = elgg_echo('anypage:example_page:description');
$page->setRenderType('html');
$page->setLayout('one_column');
$page->save();
elgg_add_admin_notice('anypage', elgg_echo('anypage:activate:admin_notice',
array(elgg_normalize_url('admin/appearance/anypage'))));
}