/** * Blog initialisation * * These parameters are required for the event API, but we won't use them: * * @param unknown_type $event * @param unknown_type $object_type * @param unknown_type $object */ function blog_init() { // Load system configuration global $CONFIG; // Set up menu for logged in users if (isloggedin()) { add_menu(elgg_echo('blogs'), $CONFIG->wwwroot . "pg/blog/" . $_SESSION['user']->username); // And for logged out users } else { add_menu(elgg_echo('blog'), $CONFIG->wwwroot . "mod/blog/everyone.php", array()); } // Extend system CSS with our own styles, which are defined in the blog/css view extend_view('css', 'blog/css'); // Extend hover-over menu extend_view('profile/menu/links', 'blog/menu'); // Register a page handler, so we can have nice URLs register_page_handler('blog', 'blog_page_handler'); // Register a URL handler for blog posts register_entity_url_handler('blog_url', 'object', 'blog'); // Register this plugin's object for sending pingbacks register_plugin_hook('pingback:object:subtypes', 'object', 'blog_pingback_subtypes'); // Register granular notification for this type if (is_callable('register_notification_object')) { register_notification_object('object', 'blog', elgg_echo('blog:newpost')); } // Listen to notification events and supply a more useful message register_plugin_hook('notify:entity:message', 'object', 'blog_notify_message'); // Listen for new pingbacks register_elgg_event_handler('create', 'object', 'blog_incoming_ping'); // Register entity type register_entity_type('object', 'blog'); }
/** * thewire initialisation * * These parameters are required for the event API, but we won't use them: * * @param unknown_type $event * @param unknown_type $object_type * @param unknown_type $object */ function thewire_init() { // Load system configuration global $CONFIG; // Set up menu for logged in users if (isloggedin()) { add_menu(elgg_echo('thewire'), $CONFIG->wwwroot . "mod/thewire/everyone.php"); } // Extend system CSS with our own styles, which are defined in the thewire/css view extend_view('css', 'thewire/css'); //extend views extend_view('activity/thewire', 'thewire/activity_view'); extend_view('profile/status', 'thewire/profile_status'); // Register a page handler, so we can have nice URLs register_page_handler('thewire', 'thewire_page_handler'); // Register a URL handler for thewire posts register_entity_url_handler('thewire_url', 'object', 'thewire'); // Your thewire widget add_widget_type('thewire', elgg_echo("thewire:read"), elgg_echo("thewire:yourdesc")); // Register entity type register_entity_type('object', 'thewire'); // Listen for SMS create event register_elgg_event_handler('create', 'object', 'thewire_incoming_sms'); // Register granular notification for this type if (is_callable('register_notification_object')) { register_notification_object('object', 'thewire', elgg_echo('thewire:newpost')); } // Listen to notification events and supply a more useful message for SMS' register_plugin_hook('notify:entity:message', 'object', 'thewire_notify_message'); }
/** * Blog extended initialization * * Register css extensions, contentes view for groups, widgets and event handlers */ function blogextended_init() { global $CONFIG; extend_view("css", "blogextended/css"); extend_view("blog/fields_before", "blog/forms/type"); extend_view("blog/fields_before", "groups/groupselector"); //extend_view('groups/left_column', 'groups/groupcontents',1); add_widget_type('blog', elgg_echo('blog:widget:title'), elgg_echo('blog:widget:description')); register_elgg_event_handler("create", "object", "blog_type_handler"); register_elgg_event_handler("update", "object", "blog_type_handler"); register_elgg_event_handler("create", "object", "group_selector_handler"); register_elgg_event_handler("update", "object", "group_selector_handler"); register_page_handler('gblog', 'gblog_page_handler'); if (is_plugin_enabled("itemicon")) { if (!isset($CONFIG->itemicon)) { $CONFIG->itemicon[] = array(); } $CONFIG->itemicon[] = "blog"; extend_view("blog/fields_after", "itemicon/add"); } $options = array("" => "All", "WorkStories" => "Work Stories", "HowTo" => "How To's", "GroupGuides" => "Group Guides", "ManagingProjects" => "Managing a Project", "TellingYourStory" => "Telling your Story"); $CONFIG->BLOG_TYPES = $options; if (file_exists(dirname(__FILE__) . "/config.php")) { @(require_once dirname(__FILE__) . "/config.php"); } $CONFIG->blogextended = $options; }
function westorElggMan_register_elgg_event_handler($event, $object, $funct) { if (function_exists("elgg_register_event_handler")) { elgg_register_event_handler($event, $object, $funct); } else { register_elgg_event_handler($event, $object, $funct); } }
/** * Email user validation plugin. * Non-admin or admin created accounts are invalid until their email address is confirmed. * * @package ElggUserValidationByEmail * @author Curverider Ltd * @link http://elgg.com/ */ function uservalidationbyemail_init() { global $CONFIG; // Register actions register_action("email/confirm", true, $CONFIG->pluginspath . "uservalidationbyemail/actions/email/confirm.php"); // Register hook listening to new users. register_elgg_event_handler('validate', 'user', 'uservalidationbyemail_email_validation'); }
/** * Email user validation plugin. * Non-admin or admin created accounts are invalid until their email address is confirmed. * * @package ElggUserValidationByEmail * @author Curverider Ltd * @link http://elgg.com/ */ function uservalidationbyemail_init() { global $CONFIG; // Register page handler to validate users // This isn't an action because security is handled by the validation codes. register_page_handler('uservalidationbyemail', 'uservalidationbyemail_page_handler'); // Register hook listening to new users. register_elgg_event_handler('validate', 'user', 'uservalidationbyemail_email_validation'); }
function groups_from_members_init() { global $CONFIG; add_group_tool_option('members_invite', elgg_echo('groupsfrommembers:members-invite'), false); if (get_plugin_setting('maxusers') == 0) { set_plugin_setting('maxusers', 20); } register_plugin_hook('permissions_check', 'group', 'groups_from_members_member_can_invite'); register_elgg_event_handler('pagesetup', 'system', 'groups_from_members_submenus'); register_plugin_hook('action', 'groups/invite', 'groups_from_members_member_invited_action'); register_action('groupsfrommembers/search', false, $CONFIG->pluginspath . 'groupsfrommembers/actions/search.php'); }
/** * Default widgets initialisation * * These parameters are required for the event API, but we won't use them: * * @param unknown_type $event * @param unknown_type $object_type * @param unknown_type $object */ function defaultwidgets_init() { // Load system configuration register_page_handler('defaultwidgets', 'defaultwidgets_page_handler'); // register create user event hook register_elgg_event_handler('create', 'user', 'defaultwidgets_newusers'); // set the widget access to the default access on validation if this is not an admin-created user if (!isadminloggedin()) { register_elgg_event_handler('validate', 'user', 'defaultwidgets_reset_access'); } // Override metadata permissions //register_plugin_hook ( 'permissions_check:metadata', 'object', 'defaultwidgets_can_edit_metadata' ); }
/** * Initialise the plugin. * */ function uncaptcha_init() { global $CONFIG; //override the default register.php action register_action('register', true, $CONFIG->pluginspath . "uncaptcha/actions/register.php"); // inserts form-mangling JS on the registration page. extend_view('account/forms/register', 'uncaptcha/register'); // css to hide the trick field extend_view('css', 'uncaptcha/register_css'); // allow us to catch validation events and enable / validate users immediately // as per config. register_elgg_event_handler('validate', 'user', 'uncaptcha_validate_user'); register_plugin_hook('uncaptcha:register_user', 'user', 'uncaptcha_register_user'); return true; }
/** * Launcher executes functionality on plugin init * * Launcher is responsible for querying the settings and running anything * that is demanded to run initially. */ public static function launcher() { $displayerrors = get_plugin_setting('displayerrors', 'elgg_developer_tools'); if ($displayerrors) { ini_set('display_errors', 1); } $errorlog = get_plugin_setting('errorlog', 'elgg_developer_tools'); if ($errorlog) { ini_set('error_log', datalist_get('dataroot') . "debug.log"); } $exceptionhandler = get_plugin_setting('exceptionhandler', 'elgg_developer_tools'); if ($exceptionhandler) { restore_exception_handler(); } $errorhandler = get_plugin_setting('errorhandler', 'elgg_developer_tools'); if ($errorhandler) { restore_error_handler(); } /** include firePHP if need be **/ $firephp = get_plugin_setting('enablefirephp', 'elgg_developer_tools'); if ($firephp) { require_once dirname(__FILE__) . '/firephp/FirePHP.class.php'; require_once dirname(__FILE__) . '/firephp/fb.php'; } else { require_once dirname(__FILE__) . '/FirePHPDisabled.php'; } $timing = get_plugin_setting('timing', 'elgg_developer_tools'); if ($timing) { register_elgg_event_handler('shutdown', 'system', 'elgg_dev_tools_shutdown_hook'); } $showviews = get_plugin_setting('showviews', 'elgg_developer_tools'); if ($showviews) { register_plugin_hook('display', 'view', 'elgg_dev_tools_outline_views'); } $showstrings = get_plugin_setting('showstrings', 'elgg_developer_tools'); if ($showstrings) { // first and last in case a plugin registers a translation in an init method register_elgg_event_handler('init', 'system', 'elgg_dev_clear_strings', 1000); register_elgg_event_handler('init', 'system', 'elgg_dev_clear_strings', 1); } $logevents = get_plugin_setting('logevents', 'elgg_developer_tools'); if ($logevents) { register_plugin_hook('all', 'all', 'elgg_dev_log_events'); register_elgg_event_handler('all', 'all', 'elgg_dev_log_events'); } }
/** * Initialize the community plugin repository plugin */ function plugins_init() { global $CONFIG; run_function_once('plugins_run_once'); // Set up menu for logged in users add_menu(elgg_echo('plugins'), "{$CONFIG->wwwroot}pg/plugins/all/"); // Extend CSS extend_view('css', 'plugins/css'); // Extend hover-over and profile menu extend_view('profile/menu/links', 'plugins/profile_menu'); extend_view('groups/left_column', 'plugins/groupprofile_files'); // Register a page handler, so we can have nice URLs register_page_handler('plugins', 'plugins_page_handler'); // Image handler register_page_handler('plugins_image', 'plugins_image_page_handler'); register_notification_object('object', 'plugins', elgg_echo('plugins:new')); //register a widget add_widget_type('plugins', elgg_echo('plugins'), elgg_echo('plugins'), 'profile'); // register url handlers for the 2 object subtypes register_entity_url_handler('plugins_release_url_handler', 'object', 'plugin_release'); register_entity_url_handler('plugins_project_url_handler', 'object', 'plugin_project'); register_elgg_event_handler('pagesetup', 'system', 'plugins_add_submenus'); // Only projects should show up in search register_entity_type('object', 'plugin_project'); // Special hook for searching against metadata (category) register_plugin_hook('search', 'object:plugin_project', 'plugins_search_hook'); // Elgg versions $CONFIG->elgg_versions = array('1.8', '1.7', '1.6', '1.5', '1.2', '1.0'); // GPL-compatible licenses $CONFIG->gpllicenses = array('none' => 'No license selected', 'gpl2' => 'GNU General Public License (GPL) version 2', 'lgpl2.1' => 'GNU Lesser General Public License (LGPL) version 2.1', 'berkeleydb' => 'Berkeley Database License (aka the Sleepycat Software Product License)', 'mbsd' => 'Modified BSD license', 'cbsd' => 'The Clear BSD License', 'expat' => 'Expat (MIT) License', 'freebsd' => 'FreeBSD license', 'intel' => 'Intel Open Source License', 'openbsd' => 'ISC (OpenBSD) License', 'ncsa' => 'NCSA/University of Illinois Open Source License', 'w3c' => 'W3C Software Notice and License', 'x11' => 'X11 License', 'zope' => 'Zope Public License, versions 2.0 and 2.1'); // Defined plugin categories $CONFIG->plugincats = array('admin' => 'Site admin', 'user' => 'User admin', 'events' => 'Events', 'authentication' => 'Authentication', 'clients' => 'Clients', 'photos' => 'Photos and Images', 'tpintegrations' => 'Third Party integrations', 'tools' => 'Tools', 'media' => 'Media', 'communication' => 'Communication', 'widgets' => 'Widgets', 'games' => 'Games', 'ecommerce' => 'eCommerce', 'languages' => 'Languages', 'themes' => 'Themes', 'misc' => 'Misc', 'uncategorized' => 'Uncategorized'); $action_base = "{$CONFIG->pluginspath}community_plugins/actions/plugins"; register_action("plugins/create_project", FALSE, "{$action_base}/create_project.php"); register_action("plugins/create_release", FALSE, "{$action_base}/create_release.php"); register_action("plugins/save_project", FALSE, "{$action_base}/save_project.php"); register_action("plugins/save_release", FALSE, "{$action_base}/save_release.php"); register_action("plugins/delete_project", FALSE, "{$action_base}/delete_project.php"); register_action("plugins/delete_release", FALSE, "{$action_base}/delete_release.php"); register_action("plugins/delete_project_image", FALSE, "{$action_base}/delete_project_image.php"); register_action("plugins/digg", FALSE, "{$action_base}/digg.php"); register_action("plugins/upgrade", FALSE, "{$action_base}/admin/upgrade.php", TRUE); register_action("plugins/combine", FALSE, "{$action_base}/admin/combine.php", TRUE); register_action("plugins/normalize", FALSE, "{$action_base}/admin/normalize.php", TRUE); }
/** * @package Elgg * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Roger Curry, Grid Research Centre [curry@cpsc.ucalgary.ca] * @author Tingxi Tan, Grid Research Centre [txtan@cpsc.ucalgary.ca] * @link http://grc.ucalgary.ca/ */ function publication_init() { // Load system configuration global $CONFIG; // Set up menu for logged in users if (isloggedin()) { add_menu(elgg_echo('publications'), $CONFIG->wwwroot . "pg/publications/" . $_SESSION['user']->username); // And for logged out users } else { add_menu(elgg_echo('publications'), $CONFIG->wwwroot . "mod/publications/everyone.php", array()); } if (!$CONFIG->publication) { $CONFIG->publication['source'] = 'text'; $CONFIG->publication['year'] = 'text'; $CONFIG->publication['volume'] = 'text'; $CONFIG->publication['issue'] = 'text'; $CONFIG->publication['pages'] = 'text'; } // Extend system CSS with our own styles, which are defined in the publication/css view extend_view('css', 'publication/css'); extend_view('metatags', 'publication/metatags'); // Extend hover-over menu // extend_view('profile/menu/links','publication/menu'); extend_view('account/forms/register', 'publication/register'); // Register a page handler, so we can have nice URLs register_page_handler('publications', 'publication_page_handler'); // Register a URL handler for publication posts register_entity_url_handler('publication_url', 'object', 'publication'); // Register this plugin's object for sending pingbacks register_plugin_hook('pingback:object:subtypes', 'object', 'publication_pingback_subtypes'); // Add a new widget add_widget_type('publications', elgg_echo("publications:widget"), elgg_echo("publications:widget:description")); // Register granular notification for this type if (is_callable('register_notification_object')) { register_notification_object('object', 'publication', elgg_echo('publication:newpost')); } // Listen to notification events and supply a more useful message register_plugin_hook('notify:entity:message', 'object', 'publication_notify_message'); // Listen for new pingbacks register_elgg_event_handler('create', 'object', 'publication_incoming_ping'); // Register entity type register_entity_type('object', 'publication'); // Register an annotation handler for comments etc register_plugin_hook('entity:annotate', 'object', 'publication_annotate_comments'); }
/** * Dev Tools initialization */ function elgg_dev_tools_init() { global $CONFIG; // if enabled, we include this for every user require_once dirname(__FILE__) . '/includes/ElggDevTools.php'; ElggDevTools::launcher(); // this can be removed in Elgg 1.8 (still won't be avilable until plugins load require_once dirname(__FILE__) . '/classes/ElggDevTimer.php'; require_once dirname(__FILE__) . '/classes/ElggDevTimerManager.php'; elgg_extend_view('css', 'elgg_dev_tools/css'); register_elgg_event_handler('pagesetup', 'system', 'elgg_dev_tools_pagesetup'); register_page_handler('elgg_dev_tools', 'elgg_dev_tools_page_handler'); register_action("elgg_dev_tools/updatesettings", FALSE, $CONFIG->pluginspath . "elgg_dev_tools/actions/updatesettings.php", TRUE); register_action("elgg_dev_tools/buildplugin", FALSE, $CONFIG->pluginspath . "elgg_dev_tools/actions/buildplugin.php", TRUE); // this should only run when HTML is produced and Elgg makes this difficult to determine //if ((int)get_plugin_setting('htmllog', 'elgg_developer_tools') != 0) { // elgg_dev_setup_html_debugging(); //} }
/** * cclite initialisation * * These parameters are required for the event API, but we won't use them: * * @param unknown_type $event * @param unknown_type $object_type * @param unknown_type $object */ function cclite_init() { // Load system configuration global $CONFIG; // require libraries require_once "{$CONFIG->pluginspath}cclite/cclite-oauth/oauthservice_lib.php"; if (!class_exists('LinkedinOAuth')) { require_once "{$CONFIG->pluginspath}cclite/cclite-oauth/ccliteoauth.php"; } // Set up menu for logged in users if (isloggedin()) { add_menu(elgg_echo('cclite'), $CONFIG->wwwroot . "pg/cclite/" . $_SESSION['user']->username); // And for logged out users } else { add_menu(elgg_echo('cclite'), $CONFIG->wwwroot . "mod/cclite/everyone.php", array()); } // Extend system CSS with our own styles, which are defined in the cclite/css view extend_view('css', 'cclite/css'); // Extend hover-over menu, not sure that this is needed extend_view('profile/menu/links', 'cclite/menu'); // Register a page handler, so we can have nice URLs register_page_handler('cclite', 'cclite_page_handler'); // Register a URL handler for cclite posts register_entity_url_handler('cclite_url', 'object', 'cclite'); // Register this plugin's object for sending pingbacks register_plugin_hook('pingback:object:subtypes', 'object', 'cclite_pingback_subtypes'); // Register granular notification for this type if (is_callable('register_notification_object')) { register_notification_object('object', 'cclite', elgg_echo('cclite:newpost')); } // Listen to notification events and supply a more useful message register_plugin_hook('notify:entity:message', 'object', 'cclite_notify_message'); // Listen for new pingbacks register_elgg_event_handler('create', 'object', 'cclite_incoming_ping'); // Register entity type register_entity_type('object', 'cclite'); // widget created data is metadata, mainly to be posted to remote cclite instance // this is a little ugly but I haven't found better... register_elgg_event_handler('create', 'metadata', 'cclite_post_data', 1000); register_elgg_event_handler('create', 'user', 'post_create_update_handler', 501); }
function siteaccess_init() { global $CONFIG; $CONFIG->disable_registration = false; if (siteaccess_walledgarden_enabled()) { if (!isloggedin()) { siteaccess_allowed_pages(); } } register_plugin_hook('action', 'register', 'siteaccess_register_hook'); register_plugin_hook('action', 'login', 'siteaccess_login_hook'); register_plugin_hook('usersettings:save', 'user', 'siteaccess_user_settings_hook', 25); $period = get_plugin_setting('period', 'siteaccess'); switch ($period) { case 'hourly': case 'daily': case 'weekly': case 'monthly': break; default: $period = 'weekly'; } register_plugin_hook('cron', $period, 'siteaccess_cron_hook'); if (issuperadminloggedin()) { register_page_handler('siteaccess', 'siteaccess_page_handler'); // Add siteaccess/index.php extend_view('profile/menu/adminlinks', 'siteaccess/menu/siteaccess_adminlinks'); // Add links to user profile register_action("siteaccess/activate", false, $CONFIG->pluginspath . "siteaccess/actions/activate.php", true); // Enable validate action register_action("siteaccess/email/save", false, $CONFIG->pluginspath . "siteaccess/actions/siteaccess/email/save.php", true); register_action("siteaccess/email/delete", false, $CONFIG->pluginspath . "siteaccess/actions/siteaccess/email/delete.php", true); } extend_view('css', 'siteaccess/css'); register_action("siteaccess/confirm", true, $CONFIG->pluginspath . "siteaccess/actions/confirm.php"); register_action("siteaccess/code", true, $CONFIG->pluginspath . "siteaccess/actions/code.php"); register_elgg_event_handler('validate', 'user', 'siteaccess_validate_user'); register_elgg_event_handler('create', 'user', 'siteaccess_create_user'); }
function beechat_init() { global $CONFIG; register_translations($CONFIG->pluginspath . "beechat/languages/"); register_elgg_event_handler('pagesetup', 'system', 'beechat_pagesetup'); register_action('beechat/get_statuses', false, $CONFIG->pluginspath . 'beechat/actions/get_statuses.php'); register_action('beechat/get_icons', false, $CONFIG->pluginspath . 'beechat/actions/get_icons.php'); register_action('beechat/get_details', false, $CONFIG->pluginspath . 'beechat/actions/get_details.php'); register_action('beechat/get_connection', false, $CONFIG->pluginspath . 'beechat/actions/get_connection.php'); register_action('beechat/get_state', false, $CONFIG->pluginspath . 'beechat/actions/get_state.php'); register_action('beechat/save_state', false, $CONFIG->pluginspath . 'beechat/actions/save_state.php'); register_plugin_hook('action', 'friends/add', 'beechat_xmpp_add_friend'); register_plugin_hook('action', 'friends/remove', 'beechat_xmpp_remove_friend'); extend_view('js/initialise_elgg', 'js/json2.js'); extend_view('js/initialise_elgg', 'js/jquery.cookie.min.js'); extend_view('js/initialise_elgg', 'js/jquery.scrollTo-min.js'); extend_view('js/initialise_elgg', 'js/jquery.serialScroll-min.js'); extend_view('js/initialise_elgg', 'js/b64.js'); extend_view('js/initialise_elgg', 'js/sha1.js'); extend_view('js/initialise_elgg', 'js/md5.js'); extend_view('js/initialise_elgg', 'js/strophe.min.js'); extend_view('js/initialise_elgg', 'js/jquery.tools.min.js'); extend_view('css', 'beechat/screen.css'); extend_view('js/initialise_elgg', 'beechat/beechat.js'); extend_view('metatags', 'beechat/beechat.userjs'); extend_view('footer/analytics', 'beechat/beechat'); $domain = get_plugin_setting("domain", "beechat"); $dbname = get_plugin_setting("dbname", "beechat"); $dbhost = get_plugin_setting("dbhost", "beechat"); $dbuser = get_plugin_setting("dbuser", "beechat"); $dbpassword = get_plugin_setting("dbpassword", "beechat"); $CONFIG->chatsettings['domain'] = $domain; $CONFIG->chatsettings['dbname'] = $dbname; $CONFIG->chatsettings['dbhost'] = $dbhost; $CONFIG->chatsettings['dbuser'] = $dbuser; $CONFIG->chatsettings['dbpassword'] = $dbpassword; }
/** * Init blog plugin. * * @return TRUE */ function blog_init() { global $CONFIG; require_once dirname(__FILE__) . '/blog_lib.php'; add_menu(elgg_echo('blog'), "{$CONFIG->wwwroot}pg/blog/", array()); elgg_extend_view('css', 'blog/css'); register_elgg_event_handler('pagesetup', 'system', 'blog_page_setup'); register_page_handler('blog', 'blog_page_handler'); register_entity_url_handler('blog_url_handler', 'object', 'blog'); // notifications register_notification_object('object', 'blog', elgg_echo('blog:newpost')); register_plugin_hook('notify:entity:message', 'object', 'blog_notify_message'); // pingbacks //register_elgg_event_handler('create', 'object', 'blog_incoming_ping'); //register_plugin_hook('pingback:object:subtypes', 'object', 'blog_pingback_subtypes'); // Register for search. register_entity_type('object', 'blog'); add_group_tool_option('blog', elgg_echo('blog:enableblog'), true); //add_widget_type('blog', elgg_echo('blog'), elgg_echo('blog:widget:description'), 'profile, dashboard'); $action_path = dirname(__FILE__) . '/actions/blog'; register_action('blog/save', FALSE, "{$action_path}/save.php"); register_action('blog/auto_save_revision', FALSE, "{$action_path}/auto_save_revision.php"); register_action('blog/delete', FALSE, "{$action_path}/delete.php"); }
return (bool) delete_data("DELETE from {$DB_PREFIX}users_sessions where session='{$id}'"); } catch (DatabaseException $e) { // Fall back to file store in this case, since this likely means that the database hasn't been upgraded global $sess_save_path; $sess_file = "{$sess_save_path}/sess_{$id}"; return @unlink($sess_file); } return false; } /** * DB Based session handling code. */ function __elgg_session_gc($maxlifetime) { global $DB_PREFIX; $life = time() - $maxlifetime; try { return (bool) delete_data("DELETE from {$DB_PREFIX}users_sessions where ts<'{$life}'"); } catch (DatabaseException $e) { // Fall back to file store in this case, since this likely means that the database hasn't been upgraded global $sess_save_path; foreach (glob("{$sess_save_path}/sess_*") as $filename) { if (filemtime($filename) < $life) { @unlink($filename); } } } return true; } register_elgg_event_handler("boot", "system", "session_init", 20);
if (is_array($num_messages)) { $counter = sizeof($num_messages); } else { $counter = 0; } return $counter; } function messages_site_notify_handler(ElggEntity $from, ElggUser $to, $subject, $message, array $params = NULL) { global $CONFIG; if (!$from) { throw new NotificationException(sprintf(elgg_echo('NotificationException:MissingParameter'), 'from')); } if (!$to) { throw new NotificationException(sprintf(elgg_echo('NotificationException:MissingParameter'), 'to')); } global $messages_pm; if (!$messages_pm) { return messages_send($subject, $message, $to->guid, $from->guid, 0, false, false); } else { return true; } } // Make sure the messages initialisation function is called on initialisation register_elgg_event_handler('init', 'system', 'messages_init'); register_plugin_hook('permissions_check', 'object', 'messages_can_edit'); register_plugin_hook('container_permissions_check', 'object', 'messages_can_edit_container'); // Register actions global $CONFIG; register_action("messages/send", false, $CONFIG->pluginspath . "messages/actions/send.php"); register_action("messages/delete", false, $CONFIG->pluginspath . "messages/actions/delete.php");
{ global $CONFIG; register_action('CKEditor/upload', false, $CONFIG->pluginspath . "CKEditor/actions/upload.php"); register_plugin_hook('delete', 'user', 'Remove_files_when_user_isDel'); extend_view('metatags', 'CKEditor/js/javascript'); } function ckeditor_pagesetup() { if (get_context() == 'admin' && isadminloggedin()) { global $CONFIG; add_submenu_item(elgg_echo('ckeditor:admin_title'), $CONFIG->wwwroot . 'mod/CKEditor/admin.php'); } } function Remove_files_when_user_isDel($hook, $entity_type, $returnvalue, $params) { global $CONFIG; delete_orphaned_metastrings(); $tables = get_db_tables(); foreach ($tables as $table) { echo sprintf(elgg_echo('garbagecollector:optimize'), $table); if (optimize_table($table) !== false) { echo elgg_echo('garbagecollector:ok'); } else { echo elgg_echo('garbagecollector:error'); } echo "\n"; } } register_elgg_event_handler('init', 'system', 'ckeditor_init'); register_elgg_event_handler('pagesetup', 'system', 'ckeditor_pagesetup');
<?php /** * fisheye menu * * @fisheye menu * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Bubu <*****@*****.**> * @link http://elgg.in.th/ */ function fisheye_menu_init() { extend_view('css', 'fisheye_menu/css'); } // Make sure the register_elgg_event_handler('init', 'system', 'fisheye_menu_init');
return md5($site_secret . $timestamp . $session_id . $ua . $st); } return false; } /** * Initialise the site secret. * */ function init_site_secret() { $secret = md5(rand() . microtime()); if (datalist_set('__site_secret__', $secret)) { return $secret; } return false; } /** * Retrieve the site secret. * */ function get_site_secret() { $secret = datalist_get('__site_secret__'); if (!$secret) { $secret = init_site_secret(); } return $secret; } // Register some actions *************************************************** register_elgg_event_handler("init", "system", "actions_init");
} } $friendofguid = $owner_guid; $owner_guid = $friendguids; } else { $friendofguid = false; } return elgg_view('file/typecloud', array('owner_guid' => $owner_guid, 'friend_guid' => $friendofguid, 'types' => get_tags(0, 10, 'simpletype', 'object', 'file', $owner_guid))); } /** * Populates the ->getUrl() method for file objects * * @param ElggEntity $entity File entity * @return string File URL */ function file_url($entity) { global $CONFIG; $title = $entity->title; $title = friendly_title($title); return $CONFIG->url . "pg/file/" . $entity->getOwnerEntity()->username . "/read/" . $entity->getGUID() . "/" . $title; } // Make sure test_init is called on initialisation register_elgg_event_handler('init', 'system', 'file_init'); register_elgg_event_handler('pagesetup', 'system', 'file_submenus'); // Register actions register_action("file/upload", false, $CONFIG->pluginspath . "file/actions/upload.php"); register_action("file/save", false, $CONFIG->pluginspath . "file/actions/save.php"); register_action("file/download", true, $CONFIG->pluginspath . "file/actions/download.php"); register_action("file/icon", true, $CONFIG->pluginspath . "file/actions/icon.php"); register_action("file/delete", false, $CONFIG->pluginspath . "file/actions/delete.php");
*/ function search_list_users_by_name($hook, $user, $returnvalue, $tag) { // Change this to set the number of users that display on the search page $threshold = 4; $object = get_input('object'); if (!get_input('offset') && (empty($object) || $object == 'user')) { if ($users = search_for_user($tag, $threshold)) { $countusers = search_for_user($tag, 0, 0, "", true); $return = elgg_view('user/search/startblurb', array('count' => $countusers, 'tag' => $tag)); foreach ($users as $user) { $return .= elgg_view_entity($user); } $return .= elgg_view('user/search/finishblurb', array('count' => $countusers, 'threshold' => $threshold, 'tag' => $tag)); return $return; } } } function users_settings_save() { global $CONFIG; @(include $CONFIG->path . "actions/user/name.php"); @(include $CONFIG->path . "actions/user/password.php"); @(include $CONFIG->path . "actions/email/save.php"); @(include $CONFIG->path . "actions/user/language.php"); @(include $CONFIG->path . "actions/user/default_access.php"); } //register actions ************************************************************* register_elgg_event_handler('init', 'system', 'users_init', 0); register_elgg_event_handler('pagesetup', 'system', 'users_pagesetup', 0);
<?php function tidypicsExt_init() { // Load system configuration global $CONFIG; // Extend View elgg_extend_view('tidypics/forms/upload', 'tidypicsExt/forms/upload'); } // Make sure the status initialisation function is called on initialisation register_elgg_event_handler('init', 'system', 'tidypicsExt_init', 9999); register_action("tidypics/upload", false, $CONFIG->pluginspath . "tidypicsExt/actions/upload.php");
} function flexprofile_pagesetup() { global $CONFIG; if (get_context() == 'profile') { $form = flexprofile_get_profile_form(); if (!$form->profile_format || $form->profile_format == 'default') { extend_view("profile/menu/actions", "flexprofile/menu/actions"); } } } /* Flexprofile page handler; allows the use of fancy URLs * * @param array $page From the page_handler function * @return true|false Depending on success */ function flexprofile_page_handler($page) { // The first component of a flexprofile URL is the username if (isset($page[0])) { set_input('username', $page[0]); } @(include dirname(__FILE__) . "/extended.php"); return true; } register_elgg_event_handler('pagesetup', 'system', 'flexprofile_pagesetup'); // Make sure the profile initialisation function is called on initialisation register_elgg_event_handler('init', 'system', 'flexprofile_init', 2); // Register actions global $CONFIG; register_action("flexprofile/edit", false, $CONFIG->pluginspath . "flexprofile/actions/edit.php");
<?php function dietaryrequirements_init() { register_plugin_hook("profile:fields", "profile", "dietaryrequirements_fields"); } function dietaryrequirements_fields($hook, $entity_type, $returnvalue, $params) { $options = array(elgg_echo("diet:omnivore") => "diet:omnivore", elgg_echo("diet:pescetarian") => "diet:pescetarian", elgg_echo("diet:veggie") => "diet:veggie", elgg_echo("diet:freegan") => "diet:freegan", elgg_echo("diet:vegan") => "diet:vegan", elgg_echo("diet:fruit") => "diet:fruit"); $returnvalue['diet'] = array("radio", $options); $returnvalue['dietextra'] = 'text'; return $returnvalue; } register_elgg_event_handler('init', 'system', 'dietaryrequirements_init', 1);
<?php /** * Elgg members plugin * * @package Elggmembers * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Curverider Ltd <*****@*****.**> * @copyright Curverider Ltd 2008-2010 * @link http://elgg.com/ */ function members_init() { global $CONFIG; elgg_extend_view('css', 'members/css'); } // @todo - use page handler for members index register_elgg_event_handler('pagesetup', 'system', 'members_pagesetup'); register_elgg_event_handler('init', 'system', 'members_init');
* Elgg diapos plugin * * @package Diapos * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author O. de Lannoy * @copyright 2012 */ /** * init function; * */ function diapos_init() { // Get config global $CONFIG; register_page_handler('diapos', 'diapos_page_handler'); // Add menu link add_menu(elgg_echo('diapos'), $CONFIG->wwwroot . "pg/diapos/"); } function diapos_page_handler($page) { global $CONFIG; switch ($page[0]) { default: include $CONFIG->pluginspath . 'diapos/index.php'; break; } exit; } register_elgg_event_handler('init', 'system', 'diapos_init');
global $CONFIG; if (get_context() == "friends" || get_context() == "friendsof" || get_context() == "collections") { add_submenu_item(elgg_echo('friendsoffriends'), $CONFIG->wwwroot . "pg/friendsoffriends/" . page_owner_entity()->username); } if (get_context() == "friendsoffriends") { add_submenu_item(elgg_echo('friends'), $CONFIG->wwwroot . "pg/friends/" . page_owner_entity()->username); add_submenu_item(elgg_echo('friends:of'), $CONFIG->wwwroot . "pg/friendsof/" . page_owner_entity()->username); add_submenu_item(elgg_echo('friendsoffriends'), $CONFIG->wwwroot . "pg/friendsoffriends/" . page_owner_entity()->username); } //try delete menu item friendsof if ($CONFIG->mod->friends_of_friends->config->hidefriendsof) { if (isset($CONFIG->submenu['a'])) { foreach ($CONFIG->submenu['a'] as $key => $item) { if (preg_match('/friendsof\\//', $item->value)) { unset($CONFIG->submenu['a'][$key]); } } } } } function friends_of_friends_page_handler($page) { global $CONFIG; if (isset($page[0]) && !empty($page[0])) { set_input('username', $page[0]); } include $CONFIG->pluginspath . "friends_of_friends/index.php"; } register_elgg_event_handler('init', 'system', 'friends_of_friends_init'); register_elgg_event_handler('pagesetup', 'system', 'friends_of_friends_pagesetup');