/** * Initializes the plugin * * @return void */ function search_advanced_init() { // page handler for search actions and results elgg_register_page_handler("search_advanced", "search_advanced_page_handler"); elgg_register_page_handler("search", "search_advanced_search_page_handler"); // search hooks search_advanced_unregister_default_search_hooks(); search_advanced_register_search_hooks(); // unregister object:page from search elgg_unregister_entity_type("object", "page_top"); // views elgg_extend_view("css/elgg", "css/search_advanced/site"); elgg_extend_view("js/elgg", "js/search_advanced/site"); // widgets elgg_register_widget_type("search", elgg_echo("search"), elgg_echo("search"), array("profile", "dashboard", "index", "groups"), true); elgg_register_widget_type("search_user", elgg_echo("search_advanced:widgets:search_user:title"), elgg_echo("search_advanced:widgets:search_user:description"), array("dashboard", "index")); if (elgg_is_active_plugin("categories")) { // make universal categories searchable add_translation(get_current_language(), array("tag_names:universal_categories" => elgg_echo("categories"))); elgg_register_tag_metadata_name("universal_categories"); } // hooks and events to clear cache // register hooks elgg_register_plugin_hook_handler("action", "admin/plugins/activate", "search_advanced_clear_keywords_cache"); elgg_register_plugin_hook_handler("action", "admin/plugins/deactivate", "search_advanced_clear_keywords_cache"); elgg_register_plugin_hook_handler("action", "admin/plugins/activate_all", "search_advanced_clear_keywords_cache"); elgg_register_plugin_hook_handler("action", "admin/plugins/deactivate_all", "search_advanced_clear_keywords_cache"); elgg_register_plugin_hook_handler("action", "plugins/settings/save", "search_advanced_clear_keywords_cache"); elgg_register_plugin_hook_handler("register", "menu:search_type_selection", "search_advanced_register_menu_type_selection"); // register events elgg_register_event_handler("upgrade", "system", "search_advanced_clear_keywords_cache"); // actions elgg_register_action("search_advanced/settings/save", dirname(__FILE__) . "/actions/plugins/settings/save.php", "admin"); }
function init() { /** * Handle pages and URLs */ elgg_register_page_handler(PAGEHANDLER, __NAMESPACE__ . '\\page_handler'); elgg_register_plugin_hook_handler('entity:url', 'object', __NAMESPACE__ . '\\url_handler'); /** * Add places to search */ elgg_register_entity_type('object', 'hjplace'); elgg_register_tag_metadata_name('specialties'); /** * JS, CSS and Views */ elgg_extend_view('css/elgg', 'css/framework/places/css'); elgg_extend_view('js/elgg', 'js/framework/places/interface'); /** * Register actions */ $actions_path = __DIR__ . '/actions/'; elgg_register_action('places/edit', $actions_path . 'places/edit.php'); elgg_register_action('places/delete', $actions_path . 'places/delete.php'); elgg_register_action('places/feature', $actions_path . 'places/feature.php', 'admin'); elgg_register_action('places/unfeature', $actions_path . 'places/unfeature.php', 'admin'); elgg_register_action('places/bookmark', $actions_path . 'places/bookmark.php'); elgg_register_action('places/unbookmark', $actions_path . 'places/unbookmark.php'); elgg_register_action('places/checkin', $actions_path . 'places/checkin.php'); elgg_register_action('places/checkout', $actions_path . 'places/checkout.php'); /** * Register hooks */ elgg_register_plugin_hook_handler('permissions_check', 'widget_layout', __NAMESPACE__ . '\\widget_layout_permissions_check'); elgg_register_plugin_hook_handler('register', 'menu:entity', __NAMESPACE__ . '\\entity_menu_setup'); elgg_register_plugin_hook_handler('register', 'menu:entity', __NAMESPACE__ . '\\interactions_menu_setup'); elgg_register_plugin_hook_handler('register', 'menu:owner_block', __NAMESPACE__ . '\\owner_block_menu_setup'); elgg_register_widget_type('places', elgg_echo('places'), elgg_echo('places:widget:description')); elgg_register_plugin_hook_handler('search:site', 'maps', __NAMESPACE__ . '\\setup_site_search_maps'); // Icons elgg_register_plugin_hook_handler('entity:icon:url', 'object', __NAMESPACE__ . '\\entity_icon_url'); elgg_register_plugin_hook_handler('entity:icon:sizes', 'object', __NAMESPACE__ . '\\entity_icon_sizes'); // Add group option if (HYPEMAPS_GROUP_PLACES) { add_group_tool_option('places', elgg_echo('places:groupoption:enable'), true); elgg_extend_view('groups/tool_latest', 'framework/places/group_module'); } elgg_register_widget_type('places_about', elgg_echo('places:widgets:about'), elgg_echo('places:widgets:about:desc'), array('places')); elgg_register_widget_type('places_activity', elgg_echo('places:widgets:activity'), elgg_echo('places:widgets:activity:desc'), array('places')); elgg_register_widget_type('places_comments', elgg_echo('places:widgets:comments'), elgg_echo('places:widgets:comments:desc'), array('places')); }
function init() { /** * JS and CSS */ elgg_register_js('jquery.nestedsortable.js', '/mod/hypeCategories/vendors/nestedSortable/jquery.mjs.nestedSortable.js'); elgg_register_simplecache_view('js/framework/categories/manage'); elgg_register_js('categories.manage.js', elgg_get_simplecache_url('js', 'framework/categories/manage')); elgg_register_simplecache_view('js/framework/categories/tree'); elgg_register_js('categories.tree.js', elgg_get_simplecache_url('js', 'framework/categories/tree')); elgg_extend_view('css/elgg', 'css/framework/categories/base'); elgg_extend_view('css/admin', 'css/framework/categories/base'); /** * Actions */ elgg_register_action('categories/manage', __DIR__ . '/actions/categories/manage.php'); elgg_register_action(PLUGIN_ID . '/settings/save', __DIR__ . '/actions/settings/save.php', 'admin'); /** * URL and Page handlers */ elgg_register_page_handler(PAGEHANDLER, __NAMESPACE__ . '\\page_handler'); elgg_register_page_handler('category', __NAMESPACE__ . '\\page_handler'); // alias elgg_register_entity_url_handler('object', HYPECATEGORIES_SUBTYPE, __NAMESPACE__ . '\\category_url_handler'); elgg_register_plugin_hook_handler('entity:icon:url', 'object', __NAMESPACE__ . '\\category_icon_url'); /** * Widget */ elgg_register_widget_type('hypeCategories', elgg_echo('categories'), elgg_echo('categories:group_module'), "groups"); /** * Menus */ elgg_register_plugin_hook_handler('register', 'menu:entity', __NAMESPACE__ . '\\entity_menu_setup'); elgg_register_plugin_hook_handler('register', 'menu:categories', __NAMESPACE__ . '\\tree_menu_setup'); /** * Search */ elgg_register_entity_type('object', HYPECATEGORIES_SUBTYPE); // Register universal_categories metadata for search elgg_register_tag_metadata_name('universal_categories'); /** * Views Groups */ elgg_extend_view('page/elements/sidebar', 'framework/categories/sidebar'); elgg_extend_view('groups/tool_latest', 'framework/categories/group_module'); // Load fonts elgg_extend_view('page/elements/head', 'framework/fonts/font-awesome'); elgg_extend_view('page/elements/head', 'framework/fonts/open-sans'); }
function zhgroups_fields_setup() { $profile_defaults = array('description' => 'longtext', 'interests' => 'tags', 'country' => 'dropdown', 'state' => 'dropdown', 'city' => 'text'); $profile_defaults = elgg_trigger_plugin_hook('profile:fields', 'group', NULL, $profile_defaults); elgg_set_config('group', $profile_defaults); // register any tag metadata names foreach ($profile_defaults as $name => $type) { if ($type == 'tags') { elgg_register_tag_metadata_name($name); // only shows up in search but why not just set this in en.php as doing it here // means you cannot override it in a plugin add_translation(get_current_language(), array("tag_names:{$name}" => elgg_echo("groups:{$name}"))); } } }
function init() { // add settings for tools elgg_extend_view('groups/edit', 'au_group_tag_menu/tagmenu_settings'); //add the tag menu at the bottom of the sidebar elgg_extend_view('page/elements/sidebar', 'au_group_tag_menu/sidebar/tagmenu'); // register group option to show tag menu add_group_tool_option("tag_menu", elgg_echo("au_group_tag_menu:enable"), true); //register action to save settings elgg_register_action("au_group_tag_menu/groups/save_tagmenu", __DIR__ . "/actions/groups/save_tagmenu.php"); //register the tag type for menu tags elgg_register_tag_metadata_name('menu_tags'); //register the page to show results elgg_register_page_handler('group_tag_menu', __NAMESPACE__ . '\\group_tag_menu_page_handler'); }
function event_calendar_init() { elgg_register_library('elgg:event_calendar', elgg_get_plugins_path() . 'event_calendar/models/model.php'); elgg_register_plugin_hook_handler('cron', 'fiveminute', 'event_calendar_handle_reminders_cron', 400); // Register a page handler, so we can have nice URLs elgg_register_page_handler('event_calendar', 'event_calendar_page_handler'); // Register URL handler elgg_register_entity_url_handler('object', 'event_calendar', 'event_calendar_url'); // Register granular notification for this type register_notification_object('object', 'event_calendar', elgg_echo('event_calendar:new_event')); // Set up site menu $site_calendar = elgg_get_plugin_setting('site_calendar', 'event_calendar'); if (!$site_calendar || $site_calendar != 'no') { // add a site navigation item $item = new ElggMenuItem('event_calendar', elgg_echo('item:object:event_calendar'), 'event_calendar/list/'); elgg_register_menu_item('site', $item); } // make event calendar title and description searchable elgg_register_entity_type('object', 'event_calendar'); // make legacy tags searchable if (function_exists('elgg_register_tag_metadata_name')) { elgg_register_tag_metadata_name('event_tags'); } // register the plugin's JavaScript $plugin_js = elgg_get_simplecache_url('js', 'event_calendar/event_calendar'); elgg_register_simplecache_view('js/event_calendar/event_calendar'); elgg_register_js('elgg.event_calendar', $plugin_js); //add to group profile page // TODO - are the left and right values still relevant for Elgg 1.8? $group_calendar = elgg_get_plugin_setting('group_calendar', 'event_calendar'); if (!$group_calendar || $group_calendar != 'no') { elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'event_calendar_owner_block_menu'); $group_profile_display = elgg_get_plugin_setting('group_profile_display', 'event_calendar'); if (!$group_profile_display || $group_profile_display == 'right') { //elgg_extend_view('groups/right_column', 'event_calendar/groupprofile_calendar'); elgg_extend_view('groups/tool_latest', 'event_calendar/group_module'); } else { if ($group_profile_display == 'left') { elgg_extend_view('groups/tool_latest', 'event_calendar/group_module'); //elgg_extend_view('groups/left_column', 'event_calendar/groupprofile_calendar'); } } } //add to the css elgg_extend_view('css/elgg', 'event_calendar/css'); $event_calendar_listing_format = elgg_get_plugin_setting('listing_format', 'event_calendar'); if (elgg_is_active_plugin('event_poll') || $event_calendar_listing_format == 'full') { elgg_extend_view('css/elgg', 'fullcalendar/css'); $plugin_js = elgg_get_simplecache_url('js', 'event_calendar/fullcalendar'); elgg_register_simplecache_view('js/event_calendar/fullcalendar'); elgg_register_js('elgg.full_calendar', $plugin_js); } //add a widget elgg_register_widget_type('event_calendar', elgg_echo("event_calendar:widget_title"), elgg_echo('event_calendar:widget:description'), 'all,groups'); // add the event calendar group tool option $event_calendar_group_default = elgg_get_plugin_setting('group_default', 'event_calendar'); if (!$event_calendar_group_default || $event_calendar_group_default == 'yes') { add_group_tool_option('event_calendar', elgg_echo('event_calendar:enable_event_calendar'), true); } else { add_group_tool_option('event_calendar', elgg_echo('event_calendar:enable_event_calendar'), false); } // if autogroup is set, listen and respond to join/leave events if (elgg_get_plugin_setting('autogroup', 'event_calendar') == 'yes') { elgg_register_event_handler('join', 'group', 'event_calendar_handle_join'); elgg_register_event_handler('leave', 'group', 'event_calendar_handle_leave'); } // entity menu elgg_register_plugin_hook_handler('register', 'menu:entity', 'event_calendar_entity_menu_setup'); elgg_register_plugin_hook_handler('prepare', 'menu:entity', 'event_calendar_entity_menu_prepare'); // register actions $action_path = elgg_get_plugins_path() . 'event_calendar/actions/event_calendar'; elgg_register_action("event_calendar/edit", "{$action_path}/edit.php"); elgg_register_action("event_calendar/delete", "{$action_path}/delete.php"); elgg_register_action("event_calendar/add_personal", "{$action_path}/add_personal.php"); elgg_register_action("event_calendar/remove_personal", "{$action_path}/remove_personal.php"); elgg_register_action("event_calendar/request_personal_calendar", "{$action_path}/request_personal_calendar.php"); elgg_register_action("event_calendar/toggle_personal_calendar", "{$action_path}/toggle_personal_calendar.php"); elgg_register_action("event_calendar/killrequest", "{$action_path}/killrequest.php"); elgg_register_action("event_calendar/addtocalendar", "{$action_path}/addtocalendar.php"); elgg_register_action("event_calendar/add_to_group", "{$action_path}/add_to_group.php"); elgg_register_action("event_calendar/remove_from_group", "{$action_path}/remove_from_group.php"); elgg_register_action("event_calendar/add_to_group_members", "{$action_path}/add_to_group_members.php"); elgg_register_action("event_calendar/remove_from_group_members", "{$action_path}/remove_from_group_members.php"); elgg_register_action("event_calendar/manage_subscribers", "{$action_path}/manage_subscribers.php"); elgg_register_action("event_calendar/modify_full_calendar", "{$action_path}/modify_full_calendar.php"); elgg_register_action("event_calendar/join_conference", "{$action_path}/join_conference.php"); }
/** * This function loads a set of default fields into the profile, then triggers a hook letting other plugins to edit * add and delete fields. * * Note: This is a secondary system:init call and is run at a super low priority to guarantee that it is called after all * other plugins have initialised. * @access private */ function elgg_profile_fields_setup() { global $CONFIG; $profile_defaults = array('description' => 'longtext', 'briefdescription' => 'text', 'location' => 'location', 'interests' => 'tags', 'skills' => 'tags', 'contactemail' => 'email', 'phone' => 'text', 'mobile' => 'text', 'website' => 'url', 'twitter' => 'text'); $loaded_defaults = array(); if ($fieldlist = elgg_get_config('profile_custom_fields')) { if (!empty($fieldlist)) { $fieldlistarray = explode(',', $fieldlist); foreach ($fieldlistarray as $listitem) { if ($translation = elgg_get_config("admin_defined_profile_{$listitem}")) { $type = elgg_get_config("admin_defined_profile_type_{$listitem}"); $loaded_defaults["admin_defined_profile_{$listitem}"] = $type; add_translation(get_current_language(), array("profile:admin_defined_profile_{$listitem}" => $translation)); } } } } if (count($loaded_defaults)) { $CONFIG->profile_using_custom = true; $profile_defaults = $loaded_defaults; } $CONFIG->profile_fields = elgg_trigger_plugin_hook('profile:fields', 'profile', NULL, $profile_defaults); // register any tag metadata names foreach ($CONFIG->profile_fields as $name => $type) { if ($type == 'tags' || $type == 'location' || $type == 'tag') { elgg_register_tag_metadata_name($name); // register a tag name translation add_translation(get_current_language(), array("tag_names:{$name}" => elgg_echo("profile:{$name}"))); } } }
/** * @access private */ function _elgg_tags_init() { // register the standard tags metadata name elgg_register_tag_metadata_name('tags'); }
/** * This function loads a set of default fields into the profile, then triggers a hook letting other plugins to edit * add and delete fields. * * Note: This is a secondary system:init call and is run at a super low priority to guarantee that it is called after all * other plugins have initialised. */ function profile_fields_setup() { global $CONFIG; $profile_defaults = array('description' => 'longtext', 'briefdescription' => 'text', 'location' => 'tags', 'interests' => 'tags', 'skills' => 'tags', 'contactemail' => 'email', 'phone' => 'text', 'mobile' => 'text', 'website' => 'url', 'twitter' => 'text'); // TODO: Have an admin interface for this $n = 0; $loaded_defaults = array(); while ($translation = get_plugin_setting("admin_defined_profile_{$n}", 'profile')) { // Add a translation add_translation(get_current_language(), array("profile:admin_defined_profile_{$n}" => $translation)); // Detect type $type = get_plugin_setting("admin_defined_profile_type_{$n}", 'profile'); if (!$type) { $type = 'text'; } // Set array $loaded_defaults["admin_defined_profile_{$n}"] = $type; $n++; } if (count($loaded_defaults)) { $CONFIG->profile_using_custom = true; $profile_defaults = $loaded_defaults; } $CONFIG->profile = trigger_plugin_hook('profile:fields', 'profile', NULL, $profile_defaults); // register any tag metadata names foreach ($CONFIG->profile as $name => $type) { if ($type == 'tags') { elgg_register_tag_metadata_name($name); // register a tag name translation add_translation(get_current_language(), array("tag_names:{$name}" => elgg_echo("profile:{$name}"))); } } }
/** * Initialize the community plugin repository plugin */ function init() { elgg_register_library('plugins:upgrades', __DIR__ . '/lib/upgrades.php'); register_js(); // Set up menu for logged in users elgg_register_menu_item('site', array('href' => "/plugins", 'name' => 'plugins', 'text' => elgg_echo('plugins'))); elgg_register_menu_item('site', array('href' => '/plugins/category/themes', 'name' => 'themes', 'text' => elgg_echo('plugins:type:theme'))); /** * Extend views */ // Extend CSS and JS elgg_extend_view('elgg.css', 'plugins/css'); elgg_extend_view('css/admin', 'plugins/admin_css'); // Extend hover-over and profile menu elgg_extend_view('profile/menu/links', 'plugins/profile_menu'); elgg_extend_view('groups/left_column', 'plugins/groupprofile_files'); // Register a page handler, so we can have nice URLs elgg_register_page_handler('plugins', __NAMESPACE__ . '\\plugins_page_handler'); // Tell core to send notifications when new projects and releases are created elgg_register_notification_event('object', 'plugin_project', array('create')); elgg_register_notification_event('object', 'plugin_release', array('create')); /** * Register Hooks */ // The notifications for projects and releases are almost identical so we can use the same handler for both elgg_register_plugin_hook_handler('prepare', 'notification:create:object:plugin_project', __NAMESPACE__ . '\\prepare_notification'); elgg_register_plugin_hook_handler('prepare', 'notification:create:object:plugin_release', __NAMESPACE__ . '\\prepare_notification'); // Releases are contained by a project so we need to get the notification subscriptions manually elgg_register_plugin_hook_handler('get', 'subscriptions', __NAMESPACE__ . '\\get_release_subscriptions'); // Make sure Releases are editable elgg_register_plugin_hook_handler('permissions_check', 'object', __NAMESPACE__ . '\\release_permissions_check'); // make projects non-commentable in the river elgg_register_plugin_hook_handler('permissions_check:comment', 'object', __NAMESPACE__ . '\\project_comments'); // manage owner block menu elgg_register_plugin_hook_handler('register', 'menu:owner_block', __NAMESPACE__ . '\\owner_block_menu'); // register url handlers for the 2 object subtypes elgg_register_plugin_hook_handler('entity:url', 'object', __NAMESPACE__ . '\\release_url_handler'); elgg_register_plugin_hook_handler('entity:url', 'object', __NAMESPACE__ . '\\project_url_handler'); elgg_register_plugin_hook_handler('register', 'menu:annotation', __NAMESPACE__ . '\\ownership_request_menu'); // Special hook for searching against metadata (category) elgg_register_plugin_hook_handler('search', 'object:plugin_project', __NAMESPACE__ . '\\search_hook'); elgg_register_plugin_hook_handler('cron', 'daily', __NAMESPACE__ . '\\update_download_counts'); /** * Register Events */ elgg_register_event_handler('pagesetup', 'system', __NAMESPACE__ . '\\add_submenus'); elgg_register_event_handler('upgrade', 'system', __NAMESPACE__ . '\\upgrades'); elgg_register_event_handler('create', 'object', __NAMESPACE__ . '\\release_comment_notification'); elgg_register_event_handler('update', 'object', __NAMESPACE__ . '\\project_update'); //register a widget elgg_register_widget_type('plugins', elgg_echo('plugins'), elgg_echo('plugins'), array('profile')); // Only projects should show up in search elgg_register_entity_type('object', 'plugin_project'); // Elgg versions (The forms expect this to be an associative array) elgg_set_config('elgg_versions', array('2.0' => '2.0', '1.12' => '1.12', '1.11' => '1.11', '1.10' => '1.10', '1.9' => '1.9', '1.8' => '1.8', '1.7' => '1.7', '1.6' => '1.6', '1.5' => '1.5', '1.2' => '1.2', '1.0' => '1.0')); // GPL-compatible licenses elgg_set_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 elgg_set_config('plugincats', array('admin' => 'Site admin', 'user' => 'User admin', 'authentication' => 'Authentication', 'tools' => 'Tools', 'spam' => 'Spam', 'communication' => 'Communication', 'events' => 'Events', 'media' => 'Media', 'photos' => 'Photos and Images', 'tpintegrations' => 'Third Party integrations', 'clients' => 'Clients', 'widgets' => 'Widgets', 'games' => 'Games', 'ecommerce' => 'eCommerce', 'languages' => 'Language packs', 'themes' => 'Themes', 'misc' => 'Misc', 'uncategorized' => 'Uncategorized')); /** * Register actions */ $action_base = dirname(__FILE__) . "/actions/plugins"; elgg_register_action("plugins/create_project", "{$action_base}/create_project.php"); elgg_register_action("plugins/create_release", "{$action_base}/create_release.php"); elgg_register_action("plugins/save_project", "{$action_base}/save_project.php"); elgg_register_action("plugins/save_release", "{$action_base}/save_release.php"); elgg_register_action("plugins/delete_project", "{$action_base}/delete_project.php"); elgg_register_action("plugins/delete_release", "{$action_base}/delete_release.php"); elgg_register_action("plugins/delete_project_image", "{$action_base}/delete_project_image.php"); elgg_register_action("plugins/recommend", "{$action_base}/recommend.php"); elgg_register_action("plugins/add_contributors", "{$action_base}/add_contributors.php"); elgg_register_action("plugins/delete_contributor", "{$action_base}/delete_contributor.php"); elgg_register_action("plugins/request_ownership", "{$action_base}/request_ownership.php"); elgg_register_action("plugins/admin/upgrade", "{$action_base}/admin/upgrade.php", 'admin'); elgg_register_action("plugins/admin/combine", "{$action_base}/admin/combine.php", 'admin'); elgg_register_action("plugins/admin/normalize", "{$action_base}/admin/normalize.php", 'admin'); elgg_register_action("plugins/admin/search", "{$action_base}/admin/search.php", 'admin'); elgg_register_action("plugins/admin/transfer", "{$action_base}/admin/transfer.php", 'admin'); elgg_register_tag_metadata_name('plugin_type'); elgg_register_ajax_view('object/plugin_project/release_table'); }
* * @param string $name * @return TRUE */ function elgg_register_tag_metadata_name($name) { global $CONFIG; if (!isset($CONFIG->registered_tag_metadata_names)) { $CONFIG->registered_tag_metadata_names = array(); } if (!in_array($name, $CONFIG->registered_tag_metadata_names)) { $CONFIG->registered_tag_metadata_names[] = $name; } return TRUE; } /** * Returns an array of valid metadata names for tags. * * @since 1.7 * * @return array */ function elgg_get_registered_tag_metadata_names() { global $CONFIG; $names = isset($CONFIG->registered_tag_metadata_names) ? $CONFIG->registered_tag_metadata_names : array(); return $names; } // register the standard tags metadata name elgg_register_tag_metadata_name('tags');
<?php namespace hypeJunction\Embed; $query = elgg_extract('query', $vars); $simpletype = elgg_extract('simpletype', $vars); $body .= '<div class="elgg-col elgg-col-1of2">'; $body .= '<div class="elgg-inner">'; $body .= '<label>' . elgg_echo('embed:tab:file:search:query') . '</label>'; $body .= elgg_view('input/text', array('value' => $query, 'name' => 'query')); $body .= '</div>'; $body .= '</div>'; elgg_register_tag_metadata_name('simpletype'); $types = elgg_get_tags(array('type' => 'object', 'subtype' => 'file', 'threshold' => 1, 'limit' => 20, 'tag_names' => array('simpletype'))); $type_options = array('' => elgg_echo('file:type:all')); foreach ($types as $type) { $type_options[$type->tag] = elgg_echo("file:type:{$type->tag}"); } $body .= '<div class="elgg-col elgg-col-1of2">'; $body .= '<div class="elgg-inner">'; $body .= '<label>' . elgg_echo('embed:tab:file:search:type') . '</label>'; $body .= elgg_view('input/dropdown', array('value' => $simpletype, 'name' => 'simpletype', 'options_values' => $type_options)); $body .= '</div>'; $body .= '</div>'; $body = '<fieldset>' . $body . '</fieldset>'; $body .= '<fieldset class="elgg-foot">'; $body .= elgg_view('input/submit', array('value' => elgg_echo('search'), 'class' => 'elgg-button-submit')); $body .= '</fieldset>'; echo $body;
function plugin_index($h, $t, $doc, $p) { if (!$doc) { return $doc; // something else prevented this index } if (!elgg_instanceof($p['entity'], 'object', 'plugin_project')) { return $doc; } $entity = $p['entity']; // add brief description to the full description $description = trim($entity->summary . ' ' . $entity->description); $doc->description = $description; // use generic fields for some filter queries // eg. $releases = $entity->getReleases(array('limit' => false)); $elgg_versions = array(); if ($releases) { foreach ($releases as $release) { if (is_array($release->elgg_version)) { foreach ($release->elgg_version as $version) { $elgg_versions[] = $version; } } else { $elgg_versions[] = $release->elgg_version; } } } $screenshots = $entity->getScreenshots(); $doc->version_ss = array_unique($elgg_versions); $doc->plugin_type_s = $entity->plugin_type; $doc->plugincat_s = $entity->plugincat; $doc->license_s = $entity->license; $doc->screenshots_i = $screenshots ? 1 : 0; // store category with the tags $categoryname = 'plugincat'; $tag_registered = false; $md = elgg_get_registered_tag_metadata_names(); if ($md && in_array($categoryname, $md)) { $tag_registered = true; } if (!$tag_registered) { elgg_register_tag_metadata_name($categoryname); } $doc->tags = elgg_solr_get_tags_array($entity); if (!$tag_registered) { // we should unregister it now in case anything else // wants to use registered tag names elgg_set_config('registered_tag_metadata_names', $md); } return $doc; }
function event_calendar_init() { elgg_register_library('elgg:event_calendar', elgg_get_plugins_path() . 'event_calendar/models/model.php'); elgg_register_library('event_calendar:ical', elgg_get_plugins_path() . 'event_calendar/vendors/iCalcreator.class.php'); elgg_register_plugin_hook_handler('cron', 'fiveminute', 'event_calendar_handle_reminders_cron', 400); elgg_register_plugin_hook_handler('entity:url', 'object', 'event_calendar_url'); elgg_register_plugin_hook_handler('prepare', 'notification:create:object:event_calendar', 'event_calendar_prepare_notification'); // Register a page handler, so we can have nice URLs elgg_register_page_handler('event_calendar', 'event_calendar_page_handler'); // Register granular notification elgg_register_notification_event('object', 'event_calendar', array('create')); // Set up site menu $site_calendar = elgg_get_plugin_setting('site_calendar', 'event_calendar'); if (!$site_calendar || $site_calendar != 'no') { // add a site navigation item $item = new ElggMenuItem('event_calendar', elgg_echo('item:object:event_calendar'), 'event_calendar/list/'); elgg_register_menu_item('site', $item); } // make event calendar title and description searchable elgg_register_entity_type('object', 'event_calendar'); // make legacy tags searchable elgg_register_tag_metadata_name('event_tags'); // ajax event summary popup elgg_register_ajax_view('event_calendar/popup'); // add to group profile page $group_calendar = elgg_get_plugin_setting('group_calendar', 'event_calendar'); if (!$group_calendar || $group_calendar != 'no') { elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'event_calendar_owner_block_menu'); elgg_extend_view('groups/tool_latest', 'event_calendar/group_module'); // add the event calendar group tool option $event_calendar_group_default = elgg_get_plugin_setting('group_default', 'event_calendar'); if (!$event_calendar_group_default || $event_calendar_group_default == 'yes') { add_group_tool_option('event_calendar', elgg_echo('event_calendar:enable_event_calendar'), true); } else { add_group_tool_option('event_calendar', elgg_echo('event_calendar:enable_event_calendar'), false); } } // add to the css elgg_extend_view('css/elgg', 'event_calendar/css'); $event_calendar_listing_format = elgg_get_plugin_setting('listing_format', 'event_calendar'); if (elgg_is_active_plugin('event_poll') || $event_calendar_listing_format == 'full') { elgg_extend_view('css/elgg', 'fullcalendar/css'); } // add a widget elgg_register_widget_type('event_calendar', elgg_echo("event_calendar:widget_title"), elgg_echo('event_calendar:widget:description')); // Index page and group profile page widgets and widget title urls if Widget Manager plugin is available if (elgg_is_active_plugin('widget_manager')) { // add index widget for Widget Manager plugin elgg_register_widget_type('index_event_calendar', elgg_echo("event_calendar:widget_title"), elgg_echo('event_calendar:widget:description'), array("index")); if (!$group_calendar || $group_calendar != 'no') { elgg_register_widget_type('groups_event_calendar', elgg_echo("event_calendar:widget_title"), elgg_echo('event_calendar:widget:description'), array("groups")); } // register title urls for widgets elgg_register_plugin_hook_handler("entity:url", "object", "event_calendar_widget_urls"); // handle the availability of the Event Calendar group widget elgg_register_plugin_hook_handler("group_tool_widgets", "widget_manager", "event_calendar_tool_widgets_handler"); } // if autogroup is set, listen and respond to join/leave events if (elgg_get_plugin_setting('autogroup', 'event_calendar') == 'yes') { elgg_register_event_handler('join', 'group', 'event_calendar_handle_join'); elgg_register_event_handler('leave', 'group', 'event_calendar_handle_leave'); } // entity menu elgg_register_plugin_hook_handler('register', 'menu:entity', 'event_calendar_entity_menu_setup'); elgg_register_plugin_hook_handler('prepare', 'menu:entity', 'event_calendar_entity_menu_prepare'); // Add page in Administer - Utilities section (this page offers cleanup of past event entries) elgg_register_admin_menu_item('administer', 'event_calendar', 'administer_utilities'); // allow for liking of events elgg_register_plugin_hook_handler('likes:is_likable', 'object:event_calendar', 'Elgg\\Values::getTrue'); // register actions $action_path = elgg_get_plugins_path() . 'event_calendar/actions/event_calendar'; elgg_register_action("event_calendar/edit", "{$action_path}/edit.php"); elgg_register_action("event_calendar/delete", "{$action_path}/delete.php"); elgg_register_action("event_calendar/add_personal", "{$action_path}/add_personal.php"); elgg_register_action("event_calendar/remove_personal", "{$action_path}/remove_personal.php"); elgg_register_action("event_calendar/request_personal_calendar", "{$action_path}/request_personal_calendar.php"); elgg_register_action("event_calendar/toggle_personal_calendar", "{$action_path}/toggle_personal_calendar.php"); elgg_register_action("event_calendar/killrequest", "{$action_path}/killrequest.php"); elgg_register_action("event_calendar/addtocalendar", "{$action_path}/addtocalendar.php"); elgg_register_action("event_calendar/add_to_group", "{$action_path}/add_to_group.php"); elgg_register_action("event_calendar/remove_from_group", "{$action_path}/remove_from_group.php"); elgg_register_action("event_calendar/add_to_group_members", "{$action_path}/add_to_group_members.php"); elgg_register_action("event_calendar/remove_from_group_members", "{$action_path}/remove_from_group_members.php"); elgg_register_action("event_calendar/manage_subscribers", "{$action_path}/manage_subscribers.php"); elgg_register_action("event_calendar/modify_full_calendar", "{$action_path}/modify_full_calendar.php"); elgg_register_action("event_calendar/join_conference", "{$action_path}/join_conference.php"); elgg_register_action("event_calendar/upgrade", "{$action_path}/upgrade.php", 'admin'); elgg_register_action("event_calendar/delete_past_events", "{$action_path}/delete_past_events.php", 'admin'); elgg_register_action("event_calendar/import", "{$action_path}/import.php"); elgg_register_action('event_calendar/export', "{$action_path}/export.php"); // check for pending event_calendar upgrades when a site upgrade is made elgg_register_event_handler('upgrade', 'system', 'event_calendar_check_pending_upgrades'); if (elgg_get_plugin_setting('ical_import_export', 'event_calendar') == "yes") { elgg_register_event_handler('pagesetup', 'system', 'ec_ical_pagesetup'); } }
/** * Returns a list of filetypes * * @param int $container_guid The GUID of the container of the files * @param bool $friends Whether we're looking at the container or the container's friends * @return string The typecloud */ function file_get_type_cloud($container_guid = "", $friends = false) { $container_guids = $container_guid; if ($friends) { // tags interface does not support pulling tags on friends' content so // we need to grab all friends $friend_entities = get_user_friends($container_guid, "", 999999, 0); if ($friend_entities) { $friend_guids = array(); foreach ($friend_entities as $friend) { $friend_guids[] = $friend->getGUID(); } } $container_guids = $friend_guids; } elgg_register_tag_metadata_name('simpletype'); $options = array('type' => 'object', 'subtype' => 'file', 'container_guids' => $container_guids, 'threshold' => 0, 'limit' => 10, 'tag_names' => array('simpletype')); $types = elgg_get_tags($options); $params = array('friends' => $friends, 'types' => $types); return elgg_view('file/typecloud', $params); }
/** * Registers page menu items for file type filtering and returns a view * * @param int $container_guid The GUID of the container of the files * @param bool $friends Whether we're looking at the container or the container's friends * * @return string The typecloud */ function file_get_type_cloud($container_guid = "", $friends = false) { $container_guids = $container_guid; $container = get_entity($container_guid); if ($friends && $container) { // tags interface does not support pulling tags on friends' content so // we need to grab all friends $friend_entities = $container->getFriends(array('limit' => 0)); if ($friend_entities) { $friend_guids = array(); foreach ($friend_entities as $friend) { $friend_guids[] = $friend->getGUID(); } } $container_guids = $friend_guids; } elgg_register_tag_metadata_name('simpletype'); $options = array('type' => 'object', 'subtype' => 'file', 'container_guids' => $container_guids, 'threshold' => 0, 'limit' => 10, 'tag_names' => array('simpletype')); $types = elgg_get_tags($options); if ($types) { $all = new stdClass(); $all->tag = 'all'; elgg_register_menu_item('page', array('name' => 'file:all', 'text' => elgg_echo('all'), 'href' => file_type_cloud_get_url($all, $friends))); foreach ($types as $type) { elgg_register_menu_item('page', array('name' => "file:{$type->tag}", 'text' => elgg_echo("file:type:{$type->tag}"), 'href' => file_type_cloud_get_url($type, $friends))); } } // returning the view is needed for BC $params = array('friends' => $friends, 'types' => $types); return elgg_view('file/typecloud', $params); }
/** * This function loads a set of default fields into the profile, then triggers a hook letting other plugins to edit * add and delete fields. * * Note: This is a secondary system:init call and is run at a super low priority to guarantee that it is called after all * other plugins have initialised. */ function groups_fields_setup() { global $CONFIG; $profile_defaults = array('name' => 'text', 'description' => 'longtext', 'briefdescription' => 'text', 'interests' => 'tags', 'website' => 'url'); $CONFIG->group = trigger_plugin_hook('profile:fields', 'group', NULL, $profile_defaults); // register any tag metadata names foreach ($CONFIG->group as $name => $type) { if ($type == 'tags') { elgg_register_tag_metadata_name($name); // register a tag name translation add_translation(get_current_language(), array("tag_names:{$name}" => elgg_echo("groups:{$name}"))); } } }
/** * @access private */ function _elgg_tags_init() { // register the standard tags metadata name elgg_register_tag_metadata_name('tags'); elgg_register_page_handler('tags', '_elgg_tagcloud_page_handler'); }
function zh_profile_fields_setup() { global $CONFIG; $profile_defaults = array('description' => 'longtext', 'gender' => 'dropdown', 'interests' => 'tags', 'birthYear' => 'dropdown', 'birthMonth' => 'dropdown', 'birthDay' => 'dropdown', 'country' => 'dropdown', 'state' => 'dropdown', 'city' => 'text', 'address' => 'text', 'zip' => 'text', 'contactemail' => 'email', 'phone' => 'text', 'website' => 'url', 'QQ' => 'text'); $CONFIG->profile_fields = elgg_trigger_plugin_hook('profile:fields', 'profile', NULL, $profile_defaults); // register any tag metadata names foreach ($CONFIG->profile_fields as $name => $type) { if ($type == 'tags' || $type == 'location' || $type == 'tag') { elgg_register_tag_metadata_name($name); // register a tag name translation add_translation(get_current_language(), array("tag_names:{$name}" => elgg_echo("profile:{$name}"))); } } }