Elgg
Version 1.11
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
views
default
js
initialize_elgg.php
Go to the documentation of this file.
1
<?php
6
$elgg
= array(
7
'config'
=> array(
8
'lastcache'
=> (
int
)
elgg_get_config
(
'lastcache'
),
9
'viewtype'
=>
elgg_get_viewtype
(),
10
'simplecache_enabled'
=> (
int
)
elgg_is_simplecache_enabled
(),
11
),
12
'security'
=> array(
13
'token'
=> array(
14
'__elgg_ts'
=>
$ts
= time(),
15
'__elgg_token'
=>
generate_action_token
(
$ts
),
16
),
17
),
18
'session'
=> array(
19
'user'
=> null,
20
'token'
=>
_elgg_services
()->session->get(
'__elgg_session'
),
21
),
22
);
23
24
$page_owner
=
elgg_get_page_owner_entity
();
25
if
(
$page_owner
instanceof
ElggEntity
) {
26
$elgg
[
'page_owner'
] =
$page_owner
->toObject();
27
}
28
29
$user
=
elgg_get_logged_in_user_entity
();
30
if
(
$user
instanceof
ElggUser
) {
31
$user_object =
$user
->
toObject
();
32
$user_object->admin =
$user
->isAdmin();
33
$elgg
[
'session'
][
'user'
] = $user_object;
34
}
35
36
?>
37
38
var
elgg
= <?php
echo
json_encode(
$elgg
); ?>;
39
<?php
40
// note: elgg.session.user needs to be wrapped with elgg.ElggUser, but this class isn't
41
// defined yet. So this is delayed until after the classes are defined, in js/lib/session.js
elgg
elgg
Definition:
install.js:23
elgg_get_config
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
Definition:
configuration.php:71
$elgg
$elgg
Initialize Elgg's js lib with the uncacheable data.
Definition:
initialize_elgg.php:6
ElggEntity
$page_owner
$page_owner
Definition:
initialize_elgg.php:24
generate_action_token
generate_action_token($timestamp)
Generate an action token.
Definition:
actions.php:167
elgg_get_viewtype
elgg_get_viewtype()
Return the current view type.
Definition:
views.php:91
ElggEntity\toObject
toObject()
{}
Definition:
ElggEntity.php:2144
$user
if($page_owner instanceof ElggEntity) $user
Definition:
initialize_elgg.php:29
_elgg_services
_elgg_services()
Definition:
autoloader.php:14
echo
elgg echo
Translates a string.
Definition:
languages.js:43
elgg_get_page_owner_entity
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
Definition:
pageowner.php:53
$ts
$ts
Definition:
securitytoken.php:11
elgg_is_simplecache_enabled
elgg_is_simplecache_enabled()
Is simple cache enabled.
Definition:
cache.php:162
elgg_get_logged_in_user_entity
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
Definition:
sessions.php:32
ElggUser
Definition:
ElggUser.php:20
Generated on Sat Dec 21 2024 00:00:50 for Elgg by
1.8.11