27 elgg.nullFunction =
function() {};
38 elgg.abstractMethod =
function() {
39 throw new Error(
"Oops... you forgot to implement an abstract method!");
97 elgg.isString =
function(val) {
98 return typeof val ===
'string';
110 elgg.isNumber =
function(val) {
111 return typeof val ===
'number';
126 elgg.isObject =
function(val) {
127 return typeof val ===
'object';
139 elgg.isUndefined =
function(val) {
140 return val === undefined;
165 elgg.isNullOrUndefined =
function(val) {
177 elgg.assertTypeOf(
'string', pkg);
179 var parts = pkg.split(
'.'),
183 for (i = 0; i < parts.length; i += 1) {
186 if (cur === undefined) {
187 throw new Error(
"Missing package: " + pkg);
226 elgg.provide =
function(pkg, opt_context) {
228 context = opt_context ||
elgg.global,
231 if (Array.isArray(pkg)) {
234 elgg.assertTypeOf(
'string', pkg);
235 parts = pkg.split(
'.');
238 for (i = 0; i < parts.length; i += 1) {
240 context[part] = context[part] || {};
241 context = context[part];
246 elgg.provide(
'elgg.config');
247 elgg.provide(
'elgg.session');
248 elgg.provide(
'elgg.ui');
249 elgg.provide(
'elgg.security.token');
250 elgg.provide(
'elgg.config.translations');
251 elgg.provide(
'elgg.config.hooks');
252 elgg.provide(
'elgg.config.instant_hooks');
253 elgg.provide(
'elgg.config.triggered_hooks');
271 var cookies = [],
cookie = [], i = 0, date, valid =
true;
274 if (
name === undefined) {
275 return document.cookie;
279 if (
value === undefined) {
280 if (document.cookie && document.cookie !==
'') {
281 cookies = document.cookie.split(
';');
282 for (i = 0; i < cookies.length; i += 1) {
285 return decodeURIComponent(
cookie[1]);
293 options = options || {};
295 if (
value === null) {
297 options.expires = -1;
302 if (options.expires) {
303 if (typeof options.expires ===
'number') {
305 date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
306 }
else if (options.expires.toUTCString) {
307 date = options.expires;
311 cookies.push(
'expires=' + date.toUTCString());
319 cookies.push(
'path=' + (options.path));
322 if (options.domain) {
323 cookies.push(
'domain=' + (options.domain));
326 if (options.secure) {
327 cookies.push(
'secure');
330 document.cookie = cookies.join(
'; ');
342 elgg.system_messages =
function(msgs, delay, type) {
343 require([
'elgg/system_messages'],
function(messages) {
344 messages.showMessage(msgs, delay, type);
352 elgg.clear_system_messages =
function() {
353 require([
'elgg/system_messages'],
function(messages) {
364 elgg.system_message =
function(msgs, delay) {
365 require([
'elgg/system_messages'],
function(messages) {
366 messages.success(msgs, delay);
376 elgg.register_error =
function(errors, delay) {
377 require([
'elgg/system_messages'],
function(messages) {
378 messages.error(errors, delay);
389 elgg.security.addToken =
function (data) {
390 var security =
require(
'elgg/security');
391 return security.addToken(data);
418 elgg.inherit =
function(Child, Parent) {
419 Child.prototype =
new Parent();
420 Child.prototype.constructor = Child;
437 elgg.ElggEntity =
function(o) {
454 elgg.ElggEntity.call(
this, o);
468 elgg.ElggUser.prototype.isAdmin =
function() {
475 elgg.session.user =
new elgg.ElggUser(
elgg.session.user);
484 elgg.get_logged_in_user_entity =
function() {
485 return elgg.session.user;
492 elgg.get_page_owner_guid =
function() {
493 return elgg.page_owner ?
elgg.page_owner.guid : 0;
501 elgg.add_translation =
function(lang, translations) {
502 var i18n =
require(
'elgg/i18n');
503 i18n.addTranslation(lang, translations);
511 elgg.get_language =
function() {
512 return elgg.config.current_language;
531 var i18n =
require(
'elgg/i18n');
532 return i18n.echo(key, argv,
language);
543 elgg.ui.registerTogglableMenuItems =
function(menuItemNameA, menuItemNameB) {
544 require([
'navigation/menu/elements/item_toggle'],
function() {
545 menuItemNameA = menuItemNameA.replace(
'_',
'-');
546 menuItemNameB = menuItemNameB.replace(
'_',
'-');
548 $(
'.elgg-menu-item-' + menuItemNameA +
' a').not(
'[data-toggle]').attr(
'data-toggle', menuItemNameB);
549 $(
'.elgg-menu-item-' + menuItemNameB +
' a').not(
'[data-toggle]').attr(
'data-toggle', menuItemNameA);
elgg session cookie
Helper function for setting cookies.
elgg require
Throw an error if the required package isn't present.
Bundled plugins(the contents of the"/mod"directory) are available only under the GPLv2 license.The remainder of the project is available under either MIT or GPLv2.Both licenses can be found below.More info and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of either verbatim or with modifications and or translated into another language(Hereinafter, translation is included without limitation in the term"modification".) Each licensee is addressed as"you".Activities other than copying