本文整理汇总了PHP中elgg_get_plugins_path函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_get_plugins_path函数的具体用法?PHP elgg_get_plugins_path怎么用?PHP elgg_get_plugins_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_get_plugins_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: faq_init
function faq_init()
{
// Extend CSS
elgg_extend_view("css/elgg", "faq/css");
if (elgg_get_plugin_setting("publicAvailable", "faq") == "yes" || elgg_is_admin_logged_in()) {
// Register a page handler, so we can have nice URLs
elgg_register_page_handler('faq', 'faq_page_handler');
if (elgg_get_plugin_setting("publicAvailable_sitemenu", "faq") == "yes" || elgg_is_logged_in()) {
// Add menu item
elgg_register_menu_item('site', array('name' => elgg_echo("faq:shorttitle"), 'text' => elgg_echo("faq:shorttitle"), 'href' => elgg_get_site_url() . "faq/"));
}
if (elgg_get_plugin_setting("publicAvailable_footerlink", "faq") == "yes" || elgg_is_logged_in()) {
// Add footer link
faq_setup_footer_menu();
}
// Register faq pages as public pages for walled-garden
elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'faq_public');
// Register Actions
$base_dir = elgg_get_plugins_path() . 'faq/actions/faq/';
elgg_register_action("faq/add", $base_dir . "add.php", "admin");
elgg_register_action("faq/delete", $base_dir . "delete.php", "admin");
elgg_register_action("faq/edit", $base_dir . "edit.php", "admin");
elgg_register_action("faq/search", $base_dir . "search.php", "public");
elgg_register_action("faq/changeCategory", $base_dir . "changeCategory.php", "admin");
if (elgg_get_plugin_setting("userQuestions", "faq") == "yes") {
elgg_register_action("faq/ask", $base_dir . "ask.php", "logged_in");
elgg_register_action("faq/answer", $base_dir . "answer.php", "admin");
}
// Register FAQs for site search
elgg_register_entity_type("object", "faq");
elgg_register_plugin_hook_handler('search', 'object:faq', 'faq_search_hook');
}
}
示例2: roles_init
/**
*
* Initializes the Roles plugin
*/
function roles_init($event, $type, $object)
{
elgg_register_library('roles', elgg_get_plugins_path() . 'roles/lib/roles.php');
elgg_register_library('roles_config', elgg_get_plugins_path() . 'roles/lib/config.php');
elgg_load_library('roles');
elgg_load_library('roles_config');
// Provides default roles by own handler. This should be extended by site specific handlers
elgg_register_plugin_hook_handler('roles:config', 'role', 'roles_get_roles_config');
// Catch all actions and page route requests
elgg_register_plugin_hook_handler('action', 'all', 'roles_actions_permissions');
elgg_register_plugin_hook_handler('route', 'all', 'roles_pages_permissions');
// Due to dynamically created (or extended) menus, we need to catch all 'register' hooks _after_ other modules added/removed their menu items
elgg_register_plugin_hook_handler('register', 'all', 'roles_menus_permissions', 9999);
// Set up roles based hooks and event listener, after all plugin is initialized
elgg_register_event_handler('ready', 'system', 'roles_hooks_permissions');
elgg_register_event_handler('ready', 'system', 'roles_events_permissions');
// Check for role configuration updates
if (elgg_is_admin_logged_in()) {
// @TODO think through if this should rather be a role-based permission
run_function_once('roles_update_100_to_101');
elgg_register_event_handler('ready', 'system', 'roles_check_update');
}
// Set up roles based view management
elgg_register_event_handler('ready', 'system', 'roles_register_views');
}
示例3: river_comments_init
/**
* river_comments
*
* @author Pedro Prez (modificado por mariano tomasini forosdroid.com)
* @link http://community.elgg.org/pg/profile/pedroprez
* @copyright (c) Keetup 2010
* @link http://www.keetup.com/
* @license GNU General Public License (GPL) version 2
*/
function river_comments_init()
{
global $CONFIG;
elgg_register_js('ui.widgets', $CONFIG->wwwroot . "mod/river_comments/js/lib/ui.widgets.js");
//Page Handler
elgg_register_page_handler('river_comments', 'river_comments_page_handler');
//Extend css view
elgg_extend_view('css/elgg', 'river_comments/css');
//Elastic Plugin
elgg_extend_view('page/elements/footer', 'river_comments/footer', 400);
//Extend js view on riverdashboard
elgg_extend_view('page/elements/footer', 'river_comments/js', 450);
elgg_extend_view('riverdashboard/js', 'river_comments/riverdashboardjs');
elgg_extend_view('page/elements/comments', 'river_comments/comments');
//View for river actions
elgg_extend_view('river/item/actions', 'river_comments/item_action');
elgg_extend_view('river/elements/responses', 'river/responses');
//Print the plugin version
elgg_extend_view('head', 'river_comments/version');
if (elgg_is_admin_logged_in()) {
elgg_extend_view('page_elements/header_contents', 'river_comments/comments');
}
//Actions
$actions_path = elgg_get_plugins_path() . "river_comments/actions/river_comments";
elgg_register_action("river_comments/add", "{$actions_path}/add.php");
elgg_register_action("river_comments/delete", "{$actions_path}/delete.php");
}
示例4: notifier_init
/**
* Initialize the plugin
*
* @return void
*/
function notifier_init()
{
notifier_set_view_listener();
// Add hidden popup module to topbar
elgg_extend_view('page/elements/topbar', 'notifier/popup');
elgg_require_js('notifier/notifier');
elgg_register_page_handler('notifier', 'notifier_page_handler');
// Add css
elgg_extend_view('elgg.css', 'notifier/notifier.css');
elgg_register_notification_method('notifier');
elgg_register_plugin_hook_handler('send', 'notification:notifier', 'notifier_notification_send');
elgg_register_plugin_hook_handler('route', 'friendsof', 'notifier_read_friends_notification');
elgg_register_event_handler('create', 'relationship', 'notifier_relationship_notifications');
elgg_register_event_handler('delete', 'relationship', 'notifier_read_group_invitation_notification');
// Hook handler for cron that removes old messages
elgg_register_plugin_hook_handler('cron', 'daily', 'notifier_cron');
elgg_register_plugin_hook_handler('register', 'menu:topbar', 'notifier_topbar_menu_setup');
elgg_register_event_handler('create', 'user', 'notifier_enable_for_new_user');
elgg_register_event_handler('join', 'group', 'notifier_enable_for_new_group_member');
$action_path = elgg_get_plugins_path() . 'notifier/actions/notifier/';
elgg_register_action('notifier/dismiss', $action_path . 'dismiss.php');
elgg_register_action('notifier/dismiss_one', $action_path . 'dismiss_one.php');
elgg_register_action('notifier/clear', $action_path . 'clear.php');
elgg_register_action('notifier/delete', $action_path . 'delete.php');
}
示例5: notifications_page_handler
/**
* Route page requests
*
* @param array $page Array of url parameters
* @return bool
*/
function notifications_page_handler($page)
{
gatekeeper();
$current_user = elgg_get_logged_in_user_entity();
// default to personal notifications
if (!isset($page[0])) {
$page[0] = 'personal';
}
if (!isset($page[1])) {
forward("notifications/{$page[0]}/{$current_user->username}");
}
$user = get_user_by_username($page[1]);
if ($user->guid != $current_user->guid && !$current_user->isAdmin()) {
forward();
}
$base = elgg_get_plugins_path() . 'notifications';
// note: $user passed in
switch ($page[0]) {
case 'group':
require "{$base}/groups.php";
break;
case 'personal':
require "{$base}/index.php";
break;
default:
return false;
}
return true;
}
示例6: elggchat_init
function elggchat_init()
{
elgg_extend_view('css/admin', 'elggchat/admin_css');
elgg_extend_view('css/elgg', 'elggchat/css');
$js_elggchat_sound = elgg_get_simplecache_url('js', 'elggchat/buzz.js');
elgg_register_simplecache_view('js/elggchat/buzz.js');
elgg_register_js('elggchat_sound', $js_elggchat_sound, 'head', 400);
elgg_define_js('elggchat_scroll', array('src' => elgg_get_site_url() . 'mod/elggchat/views/default/js/elggchat/jquery.scrollTo.js'));
if (elgg_is_logged_in()) {
if (elgg_get_plugin_user_setting("enableChat", 0, "elggchat") != "no") {
elgg_extend_view('page/elements/footer', 'elggchat/session_monitor');
}
}
elgg_register_admin_menu_item('administer', 'elggchat', 'administer_utilities');
// Extend avatar hover menu
elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'elggchat_user_hover_menu');
// Register cron job
$keepsessions = elgg_get_plugin_setting("keepsessions", "elggchat");
if (elgg_get_plugin_setting("keepsessions", "elggchat") != "yes") {
elgg_register_plugin_hook_handler('cron', 'hourly', 'elggchat_session_cleanup');
}
// Actions
$action_path = elgg_get_plugins_path() . 'elggchat/actions';
elgg_register_action("elggchat/create", "{$action_path}/create.php", "logged_in");
elgg_register_action("elggchat/post_message", "{$action_path}/post_message.php", "logged_in");
elgg_register_action("elggchat/poll", "{$action_path}/poll.php", "logged_in");
elgg_register_action("elggchat/invite", "{$action_path}/invite.php", "logged_in");
elgg_register_action("elggchat/leave", "{$action_path}/leave.php", "logged_in");
elgg_register_action("elggchat/get_smiley", "{$action_path}/get_smiley.php", "logged_in");
elgg_register_action("elggchat/admin_message", "{$action_path}/admin_message.php", "admin");
elgg_register_action("elggchat/delete_session", "{$action_path}/delete_session.php", "admin");
// Logout event handler
elgg_register_event_handler('logout:before', 'user', 'elggchat_logout_handler');
}
示例7: twitter_api_init
function twitter_api_init()
{
// require libraries
$base = elgg_get_plugins_path() . 'twitter_api';
elgg_register_class('TwitterOAuth', "{$base}/vendors/twitteroauth/twitterOAuth.php");
elgg_register_library('twitter_api', "{$base}/lib/twitter_api.php");
elgg_load_library('twitter_api');
// extend site views
//elgg_extend_view('metatags', 'twitter_api/metatags');
elgg_extend_view('css/elgg', 'twitter_api/css');
elgg_extend_view('css/admin', 'twitter_api/css');
// sign on with twitter
if (twitter_api_allow_sign_on_with_twitter()) {
elgg_extend_view('login/extend', 'twitter_api/login');
}
// register page handler
elgg_register_page_handler('twitter_api', 'twitter_api_pagehandler');
// backward compatibility
elgg_register_page_handler('twitterservice', 'twitter_api_pagehandler_deprecated');
// register Walled Garden public pages
elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'twitter_api_public_pages');
// push status messages to twitter
elgg_register_plugin_hook_handler('status', 'user', 'twitter_api_tweet');
$actions = dirname(__FILE__) . '/actions/twitter_api';
elgg_register_action('twitter_api/interstitial_settings', "{$actions}/interstitial_settings.php", 'logged_in');
}
示例8: gvgroups_init
/**
* Initialize the GV groups plugin.
*/
function gvgroups_init()
{
// override the groups library
elgg_register_library('elgg:groups', elgg_get_plugins_path() . "gvgroups/lib/groups.php");
elgg_register_library('elgg:discussion', elgg_get_plugins_path() . 'gvgroups/lib/discussion.php');
// add admin menu
elgg_register_admin_menu_item('administer', 'createlocal', 'groups');
elgg_register_admin_menu_item('administer', 'deletelocal', 'groups');
// unregister the sidebar menu (my groups, group that I own, ...)
elgg_unregister_event_handler('pagesetup', 'system', 'groups_setup_sidebar_menus');
// add some page handler
elgg_register_plugin_hook_handler("route", "groups", "gvgroups_route_groups_handler");
elgg_register_plugin_hook_handler("route", "discussion", "gvgroups_route_discussion_handler");
// override some actions
$action_base = elgg_get_plugins_path() . 'gvgroups/actions';
elgg_register_action("gvgroups/edit", "{$action_base}/gvgroups/edit.php");
// register some new actions
elgg_register_action("admin/createlocal", "{$action_base}/admin/createlocal.php");
elgg_register_action("admin/deletelocal", "{$action_base}/admin/deletelocal.php");
// add a hook to transform group menu item in a dropdown menu
elgg_register_plugin_hook_handler('register', 'menu:site', 'gvgroups_custom_sitemenu_setup');
// add an event handler to add the user in local groups, according to his profile
elgg_register_event_handler('profileupdate', 'user', 'gvgroups_profileupdate');
// manage some specific subscribing (town groups)
elgg_register_event_handler('create', 'member', 'gvgroups_join_group');
// add "my groups" menu to the topbar
elgg_register_menu_item('topbar', array('name' => 'mygroups', 'href' => "groups/member/{$user->username}", 'text' => elgg_echo('gvgroups:mygroups'), 'section' => 'alt'));
// extend CSS view
elgg_extend_view('css/elgg', 'gvgroups/css');
elgg_register_plugin_hook_handler('register', 'menu:entity', 'gvgroups_entity_menu_setup');
// check groups subscription at login
elgg_register_event_handler('login', 'user', 'gvgroups_profileupdate');
}
示例9: facebook_api_init
function facebook_api_init()
{
global $CONFIG;
$base = elgg_get_plugins_path() . 'facebook_api';
elgg_register_library('facebook', "{$base}/vendors/facebookoauth/src/facebook.php");
elgg_register_library('facebook_api', "{$base}/lib/facebook_api.php");
elgg_load_library('facebook_api');
elgg_extend_view('css/elgg', 'facebook_api/css');
// sign on with facebook
if (facebook_api_allow_sign_on_with_facebook()) {
elgg_extend_view('login/extend', 'facebook_api/login');
}
// register page handler
elgg_register_page_handler('facebook_api', 'facebook_api_pagehandler');
// allow plugin authors to hook into this service
elgg_register_plugin_hook_handler('post', 'facebook_service', 'facebookservice_post');
elgg_register_plugin_hook_handler('viewnote', 'facebook_service', 'facebookservice_viewnote');
elgg_register_plugin_hook_handler('postnote', 'facebook_service', 'facebookservice_postnote');
elgg_register_plugin_hook_handler('viewwall', 'facebook_service', 'facebookservice_viewwall');
elgg_register_plugin_hook_handler('viewstatus', 'facebook_service', 'facebookservice_viewstatus');
elgg_register_plugin_hook_handler('viewfeed', 'facebook_service', 'facebookservice_viewfeed');
elgg_register_plugin_hook_handler('viewfeedgraph', 'facebook_service', 'facebookservice_viewfeedgraph');
elgg_register_plugin_hook_handler('viewcomment', 'facebook_service', 'facebookservice_viewcomment');
elgg_register_plugin_hook_handler('viewusername', 'facebook_service', 'facebookservice_viewusername');
elgg_register_plugin_hook_handler('viewlike', 'facebook_service', 'facebookservice_viewlike');
elgg_register_plugin_hook_handler('postcomment', 'facebook_service', 'facebookservice_postcomment');
elgg_register_plugin_hook_handler('postlike', 'facebook_service', 'facebookservice_postlike');
elgg_register_plugin_hook_handler('friendrequest', 'facebook_service', 'facebookservice_friendrequest');
}
示例10: messages_init
function messages_init()
{
// register a library of helper functions
elgg_register_library('elgg:messages', elgg_get_plugins_path() . 'messages/lib/messages.php');
// add page menu items
if (elgg_is_logged_in()) {
elgg_register_menu_item('page', array('name' => 'messages:inbox', 'text' => elgg_echo('messages:inbox'), 'href' => "messages/inbox/" . elgg_get_logged_in_user_entity()->username, 'context' => 'messages'));
elgg_register_menu_item('page', array('name' => 'messages:sentmessages', 'text' => elgg_echo('messages:sentmessages'), 'href' => "messages/sent/" . elgg_get_logged_in_user_entity()->username, 'context' => 'messages'));
}
elgg_register_event_handler('pagesetup', 'system', 'messages_notifier');
// Extend system CSS with our own styles, which are defined in the messages/css view
elgg_extend_view('elgg.css', 'messages/css');
elgg_extend_view('elgg.js', 'messages/js');
// Register a page handler, so we can have nice URLs
elgg_register_page_handler('messages', 'messages_page_handler');
// Register a URL handler
elgg_register_plugin_hook_handler('entity:url', 'object', 'messages_set_url');
// Extend avatar hover menu
elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'messages_user_hover_menu');
// delete messages sent by a user when user is deleted
elgg_register_event_handler('delete', 'user', 'messages_purge');
// ecml
elgg_register_plugin_hook_handler('get_views', 'ecml', 'messages_ecml_views_hook');
// permission overrides
elgg_register_plugin_hook_handler('permissions_check:metadata', 'object', 'messages_can_edit_metadata');
elgg_register_plugin_hook_handler('permissions_check', 'object', 'messages_can_edit');
elgg_register_plugin_hook_handler('container_permissions_check', 'object', 'messages_can_edit_container');
// Register actions
$action_path = elgg_get_plugins_path() . 'messages/actions/messages';
elgg_register_action("messages/send", "{$action_path}/send.php");
elgg_register_action("messages/delete", "{$action_path}/delete.php");
elgg_register_action("messages/process", "{$action_path}/process.php");
}
示例11: odt_editor_page_handler
/**
* Dispatches odt_editor pages.
* URLs take the form of
* Save as: odt_editor/saveas/<guid>
*
* @param array $page
* @return bool
*/
function odt_editor_page_handler($page)
{
$odt_editor_pages_dir = elgg_get_plugins_path() . 'odt_editor/pages';
$page_type = $page[0];
switch ($page_type) {
case 'saveas':
set_input('guid', $page[1]);
include "{$odt_editor_pages_dir}/odt_editor/saveas.php";
break;
case 'create':
$container = get_entity($page[1]);
if (!$container) {
$container = get_loggedin_userid();
}
// show new document in WebODF editor page
// 0 as indicator for new document
set_input('guid', 0);
set_input('container_guid', $page[1]);
include "{$odt_editor_pages_dir}/file/odt_editor.php";
$result = false;
break;
case 'gettemplate':
include "{$odt_editor_pages_dir}/odt_editor/gettemplate.php";
break;
default:
return false;
}
return true;
}
示例12: elgg_file_viewer_init
function elgg_file_viewer_init()
{
// Registering a new viewtype for output buffer
elgg_register_viewtype('ob');
elgg_register_viewtype_fallback('ob');
// Exposing a function for remote access to non-public files
expose_function('efv.download', 'elgg_file_viewer_download', array('guid' => array('type' => 'int', 'required' => true)), 'Access a non-public file from a remote location', 'GET', false, true);
// Projekktor for Video/Audio support
elgg_register_js('projekktor', '/mod/elgg_file_viewer/vendors/projekktor-1.2.38r332/projekktor-1.2.38r332.min.js');
elgg_register_simplecache_view('js/elgg_file_viewer/projekktor');
elgg_register_js('elgg.projekktor', elgg_get_simplecache_url('js', 'elgg_file_viewer/projekktor'), 'footer');
elgg_register_css('projekktor', '/mod/elgg_file_viewer/vendors/projekktor-1.2.38r332/theme/maccaco/projekktor.style.css');
// Syntax highlighter / text support
elgg_register_js('syntaxhighlighter', '/mod/elgg_file_viewer/vendors/syntaxhighlighter_3.0.83/scripts/shCore.js', 'footer');
elgg_register_js('syntaxhighlighter.css', '/mod/elgg_file_viewer/vendors/syntaxhighlighter_3.0.83/scripts/shBrushCss.js', 'footer');
elgg_register_js('syntaxhighlighter.xml', '/mod/elgg_file_viewer/vendors/syntaxhighlighter_3.0.83/scripts/shBrushXml.js', 'footer');
elgg_register_js('syntaxhighlighter.plain', '/mod/elgg_file_viewer/vendors/syntaxhighlighter_3.0.83/scripts/shBrushPlain.js', 'footer');
elgg_register_js('syntaxhighlighter.js', '/mod/elgg_file_viewer/vendors/syntaxhighlighter_3.0.83/scripts/shBrushJScript.js', 'footer');
elgg_register_js('syntaxhighlighter.php', '/mod/elgg_file_viewer/vendors/syntaxhighlighter_3.0.83/scripts/shBrushPhp.js', 'footer');
elgg_register_simplecache_view('js/elgg_file_viewer/syntaxhighlighter');
elgg_register_js('elgg.syntaxhighlighter', elgg_get_simplecache_url('js', 'elgg_file_viewer/syntaxhighlighter'), 'footer');
elgg_register_css('syntaxhighlighter.core', '/mod/elgg_file_viewer/vendors/syntaxhighlighter_3.0.83/styles/shCore.css');
elgg_register_css('syntaxhighlighter.theme', '/mod/elgg_file_viewer/vendors/syntaxhighlighter_3.0.83/styles/shThemeDefault.css');
// FFmpeg class
elgg_register_class('FFmpeg', elgg_get_plugins_path() . 'elgg_file_viewer/vendors/ffmpeg/src/ffmpeg.class.php');
elgg_register_page_handler('projekktor', 'elgg_file_viewer_projekktor_video');
}
示例13: spotlight_page_handler
function spotlight_page_handler($page)
{
// We only serve one page at the moment
$page_file = elgg_get_plugins_path() . 'spotlight/pages/spotlight/source_code.php';
require_once $page_file;
return TRUE;
}
示例14: __construct
/**
* Load a plugin package from mod/$id or by full path.
*
* @param string $plugin The ID (directory name) or full path of the plugin.
* @param bool $validate Automatically run isValid()?
*
* @throws PluginException
*/
public function __construct($plugin, $validate = true)
{
$plugin_path = elgg_get_plugins_path();
// @todo wanted to avoid another is_dir() call here.
// should do some profiling to see how much it affects
if (strpos($plugin, $plugin_path) === 0 || is_dir($plugin)) {
// this is a path
$path = sanitise_filepath($plugin);
// the id is the last element of the array
$path_array = explode('/', trim($path, '/'));
$id = array_pop($path_array);
} else {
// this is a plugin id
// strict plugin names
if (preg_match('/[^a-z0-9\\.\\-_]/i', $plugin)) {
throw new PluginException(elgg_echo('PluginException:InvalidID', array($plugin)));
}
$path = "{$plugin_path}{$plugin}/";
$id = $plugin;
}
if (!is_dir($path)) {
throw new PluginException(elgg_echo('PluginException:InvalidPath', array($path)));
}
$this->path = $path;
$this->id = $id;
if ($validate && !$this->isValid()) {
if ($this->errorMsg) {
throw new PluginException(elgg_echo('PluginException:InvalidPlugin:Details', array($plugin, $this->errorMsg)));
} else {
throw new PluginException(elgg_echo('PluginException:InvalidPlugin', array($plugin)));
}
}
}
示例15: subgroups_page_handler
/**
* Dispatches subgroups pages.
* URLs take the form of
*
* Group view subgroups: subgroups/owner/<group_guid>
* Group manage subgroups: subgroups/manage/<group_guid>
*
* @param array $page
* @return NULL
*/
function subgroups_page_handler($page)
{
$pages_path = elgg_get_plugins_path() . "subgroups/pages";
switch ($page[0]) {
case 'add':
case 'edit':
elgg_set_page_owner_guid($page[1]);
include $pages_path . "/subgroups/edit.php";
break;
case 'owner':
elgg_set_page_owner_guid($page[1]);
include $pages_path . "/subgroups/owner.php";
break;
case 'new':
$group = new ElggGroup((int) $page[1]);
if (!$group->guid) {
register_error(elgg_echo('error:default'));
return false;
}
elgg_load_library('elgg:groups');
$title = elgg_echo('subgroups:new:of', array($group->name));
elgg_push_breadcrumb(elgg_echo('groups'), "groups/all");
elgg_push_breadcrumb($group->name, $group->getURL());
elgg_push_breadcrumb(elgg_echo('subgroups:new'));
set_input('container_guid', $group->guid);
$body = elgg_view_layout('content', array('content' => elgg_view('groups/edit'), 'title' => $title, 'filter' => ''));
echo elgg_view_page($title, $body);
break;
default:
return false;
}
return true;
}