本文整理汇总了PHP中elgg_is_active_plugin函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_is_active_plugin函数的具体用法?PHP elgg_is_active_plugin怎么用?PHP elgg_is_active_plugin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_is_active_plugin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: au_subgroups_clone_layout
/**
* Clones the custom layout of a parent group, for a newly created subgroup
* @param type $group
* @param type $parent
*/
function au_subgroups_clone_layout($group, $parent)
{
if (!elgg_is_active_plugin('group_custom_layout') || !group_custom_layout_allow($parent)) {
return false;
}
// get the layout object for the parent
if ($parent->countEntitiesFromRelationship(GROUP_CUSTOM_LAYOUT_RELATION) <= 0) {
return false;
}
$parentlayout = $parent->getEntitiesFromRelationship(GROUP_CUSTOM_LAYOUT_RELATION);
$parentlayout = $parentlayout[0];
$layout = new ElggObject();
$layout->subtype = GROUP_CUSTOM_LAYOUT_SUBTYPE;
$layout->owner_guid = $group->getGUID();
$layout->container_guid = $group->getGUID();
$layout->access_id = ACCESS_PUBLIC;
$layout->save();
// background image
$layout->enable_background = $parentlayout->enable_background;
$parentimg = elgg_get_config('dataroot') . 'group_custom_layout/backgrounds/' . $parent->getGUID() . '.jpg';
$groupimg = elgg_get_config('dataroot') . 'group_custom_layout/backgrounds/' . $group->getGUID() . '.jpg';
if (file_exists($parentimg)) {
copy($parentimg, $groupimg);
}
$layout->enable_colors = $parentlayout->enable_colors;
$layout->background_color = $parentlayout->background_color;
$layout->border_color = $parentlayout->border_color;
$layout->title_color = $parentlayout->title_color;
$group->addRelationship($layout->getGUID(), GROUP_CUSTOM_LAYOUT_RELATION);
}
示例2: basic_pagesetup_handler
function basic_pagesetup_handler()
{
elgg_unextend_view('page/elements/header', 'search/header');
elgg_unregister_menu_item('topbar', 'dashboard');
elgg_unregister_menu_item('topbar', 'elgg_logo');
// Extend footer with copyright
$year = date('Y');
$href = "http://www.perjensen-online.dk";
elgg_register_menu_item('footer', array('name' => 'copyright_this', 'href' => $href, 'title' => elgg_echo('basic_light:tooltip'), 'text' => elgg_echo('basic_light:copyright') . $year . elgg_echo(' Elggzone'), 'priority' => 1, 'section' => 'alt'));
// Extend footer with elgg link
$href = "http://elgg.org";
elgg_register_menu_item('footer', array('name' => 'elgg', 'href' => $href, 'text' => elgg_echo('basic_light:elgg'), 'priority' => 2, 'section' => 'alt'));
if (elgg_is_logged_in()) {
$user = elgg_get_logged_in_user_entity();
if (elgg_is_active_plugin('dashboard')) {
elgg_register_menu_item('topbar', array('name' => 'dashboard', 'href' => 'dashboard', 'text' => elgg_view_icon('home') . elgg_echo('dashboard'), 'priority' => 1000, 'section' => 'alt'));
}
if (elgg_is_active_plugin('reportedcontent')) {
elgg_unregister_menu_item('footer', 'report_this');
$href = "javascript:elgg.forward('reportedcontent/add'";
$href .= "+'?address='+encodeURIComponent(location.href)";
$href .= "+'&title='+encodeURIComponent(document.title));";
elgg_register_menu_item('extras', array('name' => 'report_this', 'href' => $href, 'text' => elgg_view_icon('report-this') . elgg_echo(''), 'title' => elgg_echo('reportedcontent:this:tooltip'), 'priority' => 100));
}
}
}
示例3: proposals_init
/**
* Init proposals plugin.
*/
function proposals_init()
{
if (!elgg_is_active_plugin('crud')) {
return;
}
// register proposals library
elgg_register_library('elgg:proposals', elgg_get_plugins_path() . 'proposals/lib/proposals.php');
// add to the main css
elgg_extend_view('css/elgg', 'proposals/css');
// Add group option
add_group_tool_option('proposals', elgg_echo('proposals:enableproposals'), false);
elgg_extend_view('groups/tool_latest', 'proposals/group_module');
//
$action_path = elgg_get_plugins_path() . 'proposals/actions/proposals';
elgg_register_action("proposals/vote", "{$action_path}/vote.php");
elgg_register_plugin_hook_handler('permissions_check:annotate', 'object', 'proposals_user_can_vote');
// data types
$variables = array('title' => 'text', 'description' => 'longtext', 'access_id' => 'access');
$crud = crud_register_type('decision', $variables);
$crud->children_type = 'proposal';
// the following is to not overwrite module if assemblies set it
// before, since we don't need explicit module.
if ($crud->module == 'decision') {
$crud->module = 'proposals';
}
//$crud->module = 'proposals';
$crud->owner_menu = 'group';
$variables = array('title' => 'text', 'description' => 'longtext', 'tags' => 'tags', 'access_id' => 'access', 'improves_guid' => array('type' => 'url', 'input_view' => 'hidden', 'output_view' => 'proposal', 'default_value' => get_input('improves')));
$crud = crud_register_type('proposal', $variables);
#$crud->children_type = 'agenda_point';
$crud->module = 'proposals';
}
示例4: interactionsMenuSetup
/**
* Setups entity interactions menu
*
* @param string $hook "register"
* @param string $type "menu:interactions"
* @param array $menu Menu
* @param array $params Hook parameters
* @uses $params['entity'] An entity that we are interacting with
* @uses $params['active_tab'] Currently active tab, default to 'comments'
* @return array
*/
public static function interactionsMenuSetup($hook, $type, $menu, $params)
{
$entity = elgg_extract('entity', $params, false);
/* @var ElggEntity $entity */
if (!elgg_instanceof($entity)) {
return $menu;
}
$active_tab = elgg_extract('active_tab', $params);
// Commenting
$comments_count = $entity->countComments();
$can_comment = $entity->canComment();
if ($can_comment) {
$menu[] = ElggMenuItem::factory(array('name' => 'comments', 'text' => $entity instanceof Comment ? elgg_echo('interactions:reply:create') : elgg_echo('interactions:comment:create'), 'href' => "stream/comments/{$entity->guid}", 'priority' => 200, 'data-trait' => 'comments', 'item_class' => 'interactions-action'));
}
if ($can_comment || $comments_count) {
$menu[] = ElggMenuItem::factory(array('name' => 'comments:badge', 'text' => elgg_view('framework/interactions/elements/badge', array('entity' => $entity, 'icon' => 'comments', 'type' => 'comments', 'count' => $comments_count)), 'href' => "stream/comments/{$entity->guid}", 'selected' => $active_tab == 'comments', 'priority' => 100, 'data-trait' => 'comments', 'item_class' => 'interactions-tab'));
}
if (elgg_is_active_plugin('likes')) {
// Liking and unliking
$likes_count = $entity->countAnnotations('likes');
$can_like = $entity->canAnnotate(0, 'likes');
$does_like = elgg_annotation_exists($entity->guid, 'likes');
if ($can_like) {
$before_text = elgg_echo('interactions:likes:before');
$after_text = elgg_echo('interactions:likes:after');
$menu[] = ElggMenuItem::factory(array('name' => 'likes', 'text' => $does_like ? $after_text : $before_text, 'href' => "action/stream/like?guid={$entity->guid}", 'is_action' => true, 'priority' => 400, 'link_class' => 'interactions-state-toggler', 'item_class' => 'interactions-action', 'data-guid' => $entity->guid, 'data-trait' => 'likes', 'data-state' => $does_like ? 'after' : 'before'));
}
if ($can_like || $likes_count) {
$menu[] = ElggMenuItem::factory(array('name' => 'likes:badge', 'text' => elgg_view('framework/interactions/elements/badge', array('entity' => $entity, 'icon' => 'likes', 'type' => 'likes', 'count' => $likes_count)), 'href' => "stream/likes/{$entity->guid}", 'selected' => $active_tab == 'likes', 'data-trait' => 'likes', 'priority' => 300, 'item_class' => 'interactions-tab'));
}
}
return $menu;
}
示例5: canAttachFiles
/**
* Check if attachments are enabled
* @return bool
*/
public static function canAttachFiles()
{
if (!elgg_is_active_plugin('hypeAttachments')) {
return false;
}
return (bool) elgg_get_plugin_setting('enable_attachments', 'hypeInteractions', true);
}
示例6: language_selector_plugins_boot
function language_selector_plugins_boot()
{
global $CONFIG;
if (!elgg_is_logged_in()) {
if (!empty($_COOKIE['client_language'])) {
// switched with language selector
$new_lang = $_COOKIE['client_language'];
} else {
$browserlang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
if (!empty($browserlang)) {
// autodetect language
if (elgg_get_plugin_setting("autodetect", "language_selector") == "yes") {
$new_lang = $browserlang;
}
}
}
if (!empty($new_lang) && $new_lang !== $CONFIG->language) {
// set new language
$CONFIG->language = $new_lang;
// language has been change; reload language keys
if (elgg_is_active_plugin("translation_editor")) {
translation_editor_load_translations();
} else {
reload_all_translations();
}
}
}
elgg_extend_view("css/elgg", "language_selector/css/site");
}
示例7: aalborg_theme_pagesetup
function aalborg_theme_pagesetup()
{
elgg_unextend_view('page/elements/header', 'search/header');
if (elgg_is_logged_in()) {
elgg_extend_view('page/elements/sidebar', 'search/header', 0);
}
elgg_unregister_menu_item('topbar', 'dashboard');
if (elgg_is_active_plugin('dashboard')) {
elgg_register_menu_item('site', array('name' => 'dashboard', 'href' => 'dashboard', 'text' => elgg_echo('dashboard')));
}
if (elgg_is_logged_in()) {
$user = elgg_get_logged_in_user_entity();
elgg_register_menu_item('topbar', array('name' => 'account', 'text' => elgg_echo('account'), 'href' => "#", 'priority' => 100, 'section' => 'alt', 'link_class' => 'elgg-topbar-dropdown'));
elgg_unregister_menu_item('topbar', 'usersettings');
elgg_register_menu_item('topbar', array('name' => 'usersettings', 'parent_name' => 'account', 'href' => "/settings/user/{$user->username}", 'text' => elgg_echo('settings'), 'priority' => 103, 'section' => 'alt'));
elgg_unregister_menu_item('topbar', 'logout');
elgg_register_menu_item('topbar', array('name' => 'logout', 'parent_name' => 'account', 'href' => '/action/logout', 'is_action' => TRUE, 'text' => elgg_echo('logout'), 'priority' => 104, 'section' => 'alt'));
elgg_unregister_menu_item('topbar', 'administration');
if (elgg_is_admin_logged_in()) {
elgg_register_menu_item('topbar', array('name' => 'administration', 'parent_name' => 'account', 'href' => 'admin', 'text' => elgg_echo('admin'), 'priority' => 101, 'section' => 'alt'));
}
elgg_unregister_menu_item('footer', 'report_this');
if (elgg_is_active_plugin('reportedcontent')) {
$href = "javascript:elgg.forward('reportedcontent/add'";
$href .= "+'?address='+encodeURIComponent(location.href)";
$href .= "+'&title='+encodeURIComponent(document.title));";
elgg_register_menu_item('extras', array('name' => 'report_this', 'href' => $href, 'title' => elgg_echo('reportedcontent:this:tooltip'), 'text' => elgg_view_icon('report-this'), 'priority' => 500));
}
}
}
示例8: language_selector_get_allowed_translations
function language_selector_get_allowed_translations()
{
$configured_allowed = elgg_get_plugin_setting("allowed_languages", "language_selector");
if (empty($configured_allowed)) {
$allowed = array("en");
$installed_languages = get_installed_translations();
$min_completeness = (int) elgg_get_plugin_setting("min_completeness", "language_selector");
if ($min_completeness > 0) {
$update_completeness = false;
if (elgg_is_active_plugin("translation_editor")) {
if (elgg_is_admin_logged_in()) {
$update_completeness = true;
}
$completeness_function = "translation_editor_get_language_completeness";
} else {
$completeness_function = "get_language_completeness";
}
foreach ($installed_languages as $lang_id => $lang_description) {
if ($lang_id != "en") {
if (($completeness = $completeness_function($lang_id)) >= $min_completeness) {
$allowed[] = $lang_id;
}
}
}
}
elgg_set_plugin_setting("allowed_languages", implode(",", $allowed), "language_selector");
} else {
$allowed = string_to_tag_array($configured_allowed);
}
return $allowed;
}
示例9: widget_group_files_init
function widget_group_files_init()
{
if (elgg_is_active_plugin("file")) {
elgg_register_widget_type("group_files", elgg_echo("file:group"), elgg_echo("widgets:group_files:description"), "groups");
elgg_register_plugin_hook_handler('widget_url', 'widget_manager', "widget_group_files_url");
}
}
示例10: celebrations_init
function celebrations_init()
{
elgg_register_library('celebrations_lib', elgg_get_plugins_path() . 'celebrations/lib/celebrations_lib.php');
elgg_load_library('celebrations_lib');
if (elgg_get_plugin_setting("ViewReminder", "celebrations") == 'yes') {
elgg_register_event_handler('login:after', 'user', 'show_next_celebrations');
}
elgg_register_plugin_hook_handler('profile:fields', 'profile', 'celebrations_profile_fields_plugin_handler');
if (elgg_is_logged_in()) {
elgg_register_menu_item('site', array('name' => 'celebrations', 'text' => elgg_echo('celebrations:shorttitle'), 'href' => "celebrations/celebrations"));
}
// Extend system CSS
elgg_extend_view('css/elgg', 'celebrations/css');
// Register a page handler, so we can have nice URLs
elgg_register_page_handler('celebrations', 'celebrations_page_handler');
//add widgets
elgg_register_widget_type('today_celebrations', elgg_echo("today_celebrations:title"), elgg_echo("today_celebrations:description"));
elgg_register_widget_type('next_celebrations', elgg_echo("next_celebrations:title"), elgg_echo("next_celebrations:description"));
//add index widgets for Widget Manager plugin
elgg_register_widget_type('index_today_celebrations', elgg_echo('today_celebrations:title'), elgg_echo('today_celebrations:description'), array("index"));
elgg_register_widget_type('index_next_celebrations', elgg_echo('next_celebrations:title'), elgg_echo('next_celebrations:description'), array("index"));
elgg_register_plugin_hook_handler("entity:url", "object", "celebrations_widget_urls");
elgg_register_action('celebrations/settings/save', elgg_get_plugins_path() . "celebrations/actions/celebrations/settings.php", 'admin');
if (elgg_is_active_plugin('profile_manager')) {
$profile_options = array("show_on_register" => "no", "mandatory" => "no", "user_editable" => "yes", "output_as_tags" => "no", "admin_only" => "no", "count_for_completeness" => "yes");
profile_manager_add_custom_field_type("custom_profile_field_types", "day_anniversary", "day_anniversary", $profile_options);
profile_manager_add_custom_field_type("custom_profile_field_types", "yearly", "day_anniversary", $profile_options);
}
}
示例11: widget_index_file_init
function widget_index_file_init()
{
if (elgg_is_active_plugin("file")) {
elgg_register_widget_type("index_file", elgg_echo("file"), elgg_echo("widget_manager:widgets:index_file:description"), "index", true);
elgg_register_plugin_hook_handler('widget_url', 'widget_manager', "widget_index_file_url");
}
}
示例12: search_advanced_init
/**
* 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");
}
示例13: embed_extender_init
function embed_extender_init()
{
global $CONFIG;
if (elgg_is_active_plugin('embedvideo')) {
include_once $CONFIG->pluginspath . 'embedvideo/lib/embedvideo.php';
//die('embed');
} else {
include_once $CONFIG->pluginspath . 'embed_extender/lib/embedvideo.php';
//die('extender');
}
include_once $CONFIG->pluginspath . 'embed_extender/lib/custom.php';
include_once $CONFIG->pluginspath . 'embed_extender/lib/embed_extender.php';
//Check where embed code - The wire
$wire_show = elgg_get_plugin_setting('wire_show', 'embed_extender');
if ($wire_show == 'yes') {
elgg_register_plugin_hook_handler('view', 'object/thewire', 'embed_extender_rewrite');
}
//Check where embed code - Blog posts
$blog_show = elgg_get_plugin_setting('blog_show', 'embed_extender');
if ($blog_show == 'yes') {
elgg_register_plugin_hook_handler('view', 'object/blog', 'embed_extender_rewrite');
}
//Check where embed code - Comments
$comment_show = elgg_get_plugin_setting('comment_show', 'embed_extender');
if ($comment_show == 'yes') {
elgg_register_plugin_hook_handler('view', 'annotation/generic_comment', 'embed_extender_rewrite');
elgg_register_plugin_hook_handler('view', 'annotation/default', 'embed_extender_rewrite');
}
//Check where embed code - Group topics
$topicposts_show = elgg_get_plugin_setting('topicposts_show', 'embed_extender');
if ($topicposts_show == 'yes') {
elgg_register_plugin_hook_handler('view', 'object/groupforumtopic', 'embed_extender_rewrite');
}
//Check where embed code - Messageboard
$messageboard_show = elgg_get_plugin_setting('messageboard_show', 'embed_extender');
if ($messageboard_show == 'yes') {
elgg_register_plugin_hook_handler('view', 'annotation/default', 'embed_extender_rewrite');
}
//Check where embed code - Pages
$page_show = elgg_get_plugin_setting('page_show', 'embed_extender');
if ($page_show == 'yes') {
elgg_register_plugin_hook_handler('view', 'object/page_top', 'embed_extender_rewrite');
}
//Check where embed code - Pages
$page_show = elgg_get_plugin_setting('bookmark_show', 'embed_extender');
if ($page_show == 'yes') {
elgg_register_plugin_hook_handler('view', 'object/bookmarks', 'embed_extender_rewrite');
}
// Check embed code for custom views
$viewslist = elgg_get_plugin_setting('custom_views', 'embed_extender');
$views = explode("\n", $viewslist);
foreach ($views as $view) {
elgg_register_plugin_hook_handler('view', $view, 'embed_extender_rewrite');
}
elgg_extend_view('css', 'embed_extender/css');
// register example hook handler
// for providing custom video handler (yahoo)
elgg_register_plugin_hook_handler('embed_extender', 'custom_patterns', 'embed_extender_yahoo_pattern');
elgg_register_plugin_hook_handler('embed_extender', 'custom_embed', 'embed_extender_yahoo_embed');
}
示例14: group_tools_join_group_event
function group_tools_join_group_event($event, $type, $params)
{
static $auto_notification;
// only load plugin setting once
if (!isset($auto_notification)) {
$auto_notification = false;
if (elgg_get_plugin_setting("auto_notification", "group_tools") == "yes") {
$auto_notification = true;
}
}
if (!empty($params) && is_array($params)) {
$group = elgg_extract("group", $params);
$user = elgg_extract("user", $params);
if ($user instanceof ElggUser && $group instanceof ElggGroup) {
if ($auto_notification) {
// enable email notification
add_entity_relationship($user->getGUID(), "notifyemail", $group->getGUID());
if (elgg_is_active_plugin("messages")) {
// enable site/messages notification
add_entity_relationship($user->getGUID(), "notifysite", $group->getGUID());
}
}
// cleanup invites
if (check_entity_relationship($group->getGUID(), "invited", $user->getGUID())) {
remove_entity_relationship($group->getGUID(), "invited", $user->getGUID());
}
// and requests
if (check_entity_relationship($user->getGUID(), "membership_request", $group->getGUID())) {
remove_entity_relationship($user->getGUID(), "membership_request", $group->getGUID());
}
}
}
}
示例15: widget_content_by_tag_init
function widget_content_by_tag_init()
{
if (elgg_is_active_plugin("blog") || elgg_is_active_plugin("file") || elgg_is_active_plugin("pages")) {
elgg_register_widget_type("content_by_tag", elgg_echo("widgets:content_by_tag:name"), elgg_echo("widgets:content_by_tag:description"), "profile,dashboard,index,groups", true);
}
elgg_extend_view("css/elgg", "widgets/content_by_tag/css");
}