本文整理汇总了PHP中subsite_manager_on_subsite函数的典型用法代码示例。如果您正苦于以下问题:PHP subsite_manager_on_subsite函数的具体用法?PHP subsite_manager_on_subsite怎么用?PHP subsite_manager_on_subsite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了subsite_manager_on_subsite函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elgg_modifications_create_user_event_handler
function elgg_modifications_create_user_event_handler($event, $object_type, $object)
{
if (elgg_instanceof($object, "user")) {
if (subsite_manager_on_subsite()) {
$object->setPrivateSetting("digest_" . elgg_get_site_entity()->getOwnerGUID(), "none");
}
}
}
示例2: subsite_manager_fix_piwik_settings
function subsite_manager_fix_piwik_settings()
{
global $SUBSITE_MANAGER_IGNORE_WRITE_ACCESS;
if (subsite_manager_on_subsite()) {
$site = elgg_get_site_entity();
if ($piwik_settings = $site->phloor_analytics_piwik_settings) {
$SUBSITE_MANAGER_IGNORE_WRITE_ACCESS = true;
if ($site->canEdit()) {
// log to the error log that we did something
error_log("PIWIK saving settings for " . $site->name . " (" . $site->getGUID() . ")");
error_log("PIWIK settings: " . $piwik_settings);
if ($piwik_settings = json_decode($piwik_settings, true)) {
if (!empty($piwik_settings) && is_array($piwik_settings)) {
$enabled = elgg_extract("enable_tracking", $piwik_settings);
$piwik_url = elgg_extract("path_to_piwik", $piwik_settings);
$piwik_site_id = elgg_extract("site_guid", $piwik_settings);
if ($enabled == "true") {
if (!empty($piwik_url) && !empty($piwik_site_id)) {
// check if analytics is enabled
if (!elgg_is_active_plugin("analytics")) {
// not active so enable
if ($plugin = elgg_get_plugin_from_id("analytics")) {
$plugin->activate();
elgg_invalidate_simplecache();
elgg_reset_system_cache();
}
}
// save settings, if not exists
if (!elgg_get_plugin_setting("piwik_url", "analytics") && !elgg_get_plugin_setting("piwik_site_id", "analytics")) {
elgg_set_plugin_setting("piwik_url", $piwik_url, "analytics");
elgg_set_plugin_setting("piwik_site_id", $piwik_site_id, "analytics");
}
}
}
}
}
// remove the settings so we don't do this again
unset($site->phloor_analytics_piwik_settings);
}
// unset write access
$SUBSITE_MANAGER_IGNORE_WRITE_ACCESS = false;
}
}
}
示例3: subsite_manager_boot_system_plugins_event_handler
function subsite_manager_boot_system_plugins_event_handler($event, $type, $object)
{
global $CONFIG;
global $SUBSITE_MANAGER_PLUGINS_BOOT;
// needs to be set for links in html head
$viewtype = get_input('view', 'default');
$site_guid = elgg_get_site_entity()->getGUID();
$lastcached = datalist_get("sc_lastcached_" . $viewtype . "_" . $site_guid);
$CONFIG->lastcache = $lastcached;
// skip non-subsites
if (!subsite_manager_on_subsite()) {
return true;
}
$site = elgg_get_site_entity();
$to_activate = $site->getPrivateSetting('subsite_manager_plugins_activate');
if ($to_activate) {
$SUBSITE_MANAGER_PLUGINS_BOOT = true;
$site->removePrivateSetting('subsite_manager_plugins_activate');
$to_activate = unserialize($to_activate);
set_time_limit(0);
elgg_generate_plugin_entities();
$old_ia = elgg_set_ignore_access(true);
$plugins = elgg_get_plugins('any');
foreach ($plugins as $plugin) {
if (in_array($plugin->getID(), $to_activate)) {
try {
$plugin->activate();
} catch (Exception $e) {
}
}
}
elgg_set_ignore_access($old_ia);
$SUBSITE_MANAGER_PLUGINS_BOOT = false;
elgg_register_event_handler("ready", "system", "subsite_manager_ready_system_handler", 100);
}
}
示例4: subsite_manager_pagesetup
function subsite_manager_pagesetup()
{
// validate the page_owner
$page_owner = elgg_get_page_owner_entity();
if (!empty($page_owner) && elgg_instanceof($page_owner, "group")) {
$site = elgg_get_site_entity();
if ($page_owner->site_guid != $site->getGUID()) {
// you're viewing a group of a different (sub)site
system_message(elgg_echo("changebookmark"));
forward($page_owner->getURL());
}
}
// Display a message for non-subsite users
subsite_manager_check_subsite_user();
$context = elgg_get_context();
// handle menu items
if (elgg_is_admin_logged_in()) {
// add to admin menu
if (subsite_manager_is_superadmin_logged_in()) {
//only for super admins
elgg_register_admin_menu_item("administer", "import", "users", 150);
elgg_register_admin_menu_item("administer", "bulk_remove", "users", 160);
}
// list subsite administrators
elgg_register_admin_menu_item("administer", "admins", "users", 110);
elgg_register_admin_menu_item("administer", "move_group", "administer_utilities");
if (!subsite_manager_on_subsite()) {
elgg_register_admin_menu_item("administer", "new", "subsites", 20);
elgg_register_admin_menu_item("administer", "plugins", "subsites", 30);
elgg_register_admin_menu_item("administer", "admins", "subsites", 40);
elgg_register_menu_item("page", array("name" => "subsites", "href" => "subsites", "text" => elgg_echo("subsite_manager:menu:admin:manage"), "context" => "admin", "section" => "administer", "parent_name" => "subsites", "priority" => 10, "target" => "_blank"));
} else {
// remove add user menu item
if (!subsite_manager_is_superadmin_logged_in()) {
elgg_unregister_menu_item("page", "users:add");
}
// list membership requests
elgg_register_admin_menu_item("administer", "membership", "users", 120);
// invite members
elgg_register_admin_menu_item("administer", "invite", "users", 130);
// view invitations
elgg_register_admin_menu_item("administer", "invitations", "users", 140);
}
}
if (elgg_is_logged_in() && !subsite_manager_on_subsite()) {
// site menu
elgg_register_menu_item("site", array("name" => "subsites", "href" => "subsites", "text" => elgg_echo("subsite_manager:menu:subsites")));
}
// disable search engine indexing
elgg_extend_view("page/elements/head", "metatags/noindex");
elgg_extend_view("page/elements/head", "subsite_manager/remove_rss", 499);
elgg_unextend_view("page/elements/head", "profile/metatags");
if (in_array($context, array("profile", "friends", "friendsof"))) {
elgg_unregister_plugin_hook_handler("output:before", "layout", "elgg_views_add_rss_link");
}
// do we need to disable htmlawed for admins
if (elgg_get_config("disable_htmlawed")) {
if (elgg_is_admin_logged_in() || elgg_in_context("static")) {
elgg_unregister_plugin_hook_handler("validate", "input", "htmlawed_filter_tags");
}
}
}
示例5: subsite_manager_simplesaml_check_auto_create_account
function subsite_manager_simplesaml_check_auto_create_account($source, $auth_attributes)
{
$result = false;
if (!empty($source) && !empty($auth_attributes) && is_array($auth_attributes)) {
// is the source enabled
if (!subsite_manager_on_subsite() || simplesaml_is_enabled_source($source)) {
// check if auto create is enabled for this source
if (!subsite_manager_on_subsite() || elgg_get_plugin_setting($source . "_auto_create_accounts", "simplesaml")) {
// do we have all the require information
$email = elgg_extract("elgg:email", $auth_attributes);
$firstname = elgg_extract("elgg:firstname", $auth_attributes);
$lastname = elgg_extract("elgg:lastname", $auth_attributes);
$external_id = elgg_extract("elgg:external_id", $auth_attributes);
if (!empty($email) && (!empty($firstname) || !empty($lastname)) && !empty($external_id)) {
$result = true;
} else {
error_log("SAML: fail 5");
}
} else {
error_log("SAML: fail 4");
}
} else {
error_log("SAML: fail 3");
}
} else {
error_log("SAML: fail 2");
}
return $result;
}
示例6: elgg_extract
*
* Shows a list of plugins that can be sorted and filtered.
*
* @package Elgg.Core
* @subpackage Admin.Plugins
*/
$plugin_list = elgg_extract("installed_plugins", $vars);
// Get a list of the all categories
// and trim down the plugin list if we're not viewing all categories.
// @todo this could be cached somewhere after have the manifest loaded
// foreach ($installed_plugins as $id => $plugin) {
// if (!$plugin->isValid()) {
// if ($plugin->isActive()) {
// // force disable and warn
// elgg_add_admin_notice('invalid_and_deactivated_' . $plugin->getID(),
// elgg_echo('ElggPlugin:InvalidAndDeactivated', array($plugin->getId())));
// $plugin->deactivate();
// }
// continue;
// }
// }
// construct page header
$url = elgg_view("output/url", array("href" => "admin/plugins", "text" => elgg_echo("subsite_manager:plugins:advanced:switch")));
echo elgg_view_module("info", "", elgg_echo("subsite_manager:plugins:description") . "<br />" . $url);
?>
<div id="elgg-plugin-list">
<?php
$options = array('limit' => 0, 'full_view' => true, 'list_type_toggle' => false, 'pagination' => false, 'display_reordering' => !subsite_manager_on_subsite());
echo elgg_view_entity_list($plugin_list, $options);
?>
</div>
示例7: elgg_list_entities_from_relationship
$body = elgg_list_entities_from_relationship($options);
break;
}
// search box
if ($search_box) {
$search = elgg_view("subsite_manager/subsites/forms/search", array("filter" => $filter, "text" => $text, "category" => $category));
}
// tabbed nav
elgg_register_menu_item("filter", $filter_all);
elgg_register_menu_item("filter", $filter_featured);
elgg_register_menu_item("filter", $filter_closed);
elgg_register_menu_item("filter", $filter_open);
elgg_register_menu_item("filter", $filter_mine);
elgg_register_menu_item("filter", $filter_popular);
if ($membership_count > 0) {
elgg_register_menu_item("filter", $filter_membership);
}
$tabbed_nav = elgg_view_menu("filter", array("sort_by" => "priority"));
if (empty($body)) {
$body = elgg_echo("notfound");
}
if (!subsite_manager_on_subsite() && elgg_is_admin_logged_in()) {
// title menu
elgg_register_menu_item("title", array("name" => "new", "href" => "admin/subsites/new", "text" => elgg_echo("admin:subsites:new"), "link_class" => "elgg-button elgg-button-action"));
}
// title menu
elgg_register_menu_item("title", array("name" => "request", "href" => "deelsiteaanvragen", "text" => elgg_echo("subsite_manager:menu:subsites:request"), "link_class" => "elgg-button elgg-button-action"));
$header = elgg_view('page/layouts/content/header', array("title" => $title_text));
// make layout
$body = elgg_view_layout("one_column", array("content" => $header . $search . $tabbed_nav . $body, "filter" => ""));
echo elgg_view_page($title_text, $body);
示例8: elgg_get_site_entity
<?php
$site = elgg_get_site_entity();
$user_guid = (int) get_input("user_guid");
if (!empty($user_guid) && elgg_is_admin_logged_in() && subsite_manager_on_subsite()) {
if ($site->isAdmin($user_guid)) {
$site->removeAdmin($user_guid);
system_message(elgg_echo("admin:user:removeadmin:yes"));
} else {
$site->makeAdmin($user_guid);
system_message(elgg_echo("admin:user:makeadmin:yes"));
}
} else {
register_error(elgg_echo("InvalidParameterException:NoEntityFound"));
}
forward(REFERER);
示例9: elgg_get_page_owner_entity
<?php
$user = elgg_get_page_owner_entity();
$plugin = elgg_extract("entity", $vars);
$noyes_options = array("no" => elgg_echo("option:no"), "yes" => elgg_echo("option:yes"));
if (($user->isAdmin() || subsite_manager_on_subsite() && elgg_get_site_entity()->isAdmin($user->getGUID())) && $user->canEdit()) {
echo "<div>";
echo elgg_echo("elgg_modifications:usersettings:reportedcontent:notify:description");
echo " " . elgg_view("input/dropdown", array("name" => "params[notify]", "options_values" => $noyes_options, "value" => $plugin->getUserSetting("notify", $user->getGUID())));
echo "</div>";
}
示例10: elgg_get_config
<?php
$indexingEnabled = elgg_get_config("enable_frontpage_indexing");
if (subsite_manager_on_subsite() && !$indexingEnabled) {
http_response_code(404);
exit;
}
header('Content-type: text/xml');
$base = elgg_get_site_url();
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?>' . PHP_EOL . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />');
// Start page
$url = $xml->addChild('url');
$url->addChild('loc', $base);
$url->addChild('lastmod', date("Y-m-d", time()));
$url->addChild('priority', '0.5');
// Widget manager, extra pages
$extra_contexts = elgg_get_plugin_setting("extra_contexts", "widget_manager");
if ($extra_contexts) {
$contexts = string_to_tag_array($extra_contexts);
foreach ($contexts as $context) {
$url = $xml->addChild('url');
$url->addChild('loc', $base . $context);
$url->addChild('lastmod', date("Y-m-d", time()));
$url->addChild('priority', '0.5');
}
}
// Entity pages of blogs and static pages
$batch = new ElggBatch('elgg_get_entities', array('type' => 'object', 'subtypes' => array('blog', 'static', 'page_top', 'page'), 'limit' => 2000));
foreach ($batch as $object) {
$url = $xml->addChild('url');
$url->addChild('loc', $object->getURL());
示例11: elgg_echo
echo elgg_echo('river:widget:type');
?>
:
<?php
echo $type_dropdown;
?>
</div>
<?php
}
// set default value for number to display
if (!isset($vars['entity']->num_display)) {
$vars['entity']->num_display = 8;
}
$params = array('name' => 'params[num_display]', 'value' => $vars['entity']->num_display, 'options' => array(5, 8, 10, 12, 15, 20));
$num_dropdown = elgg_view('input/dropdown', $params);
if (elgg_in_context('dashboard') && !subsite_manager_on_subsite()) {
$sites = subsite_manager_get_user_subsites(page_owner_entity()->guid);
if ($sites) {
$pulldown_options = array("0" => elgg_echo("widget:river_widget:edit:site_selection:current"), "all" => elgg_echo("widget:river_widget:edit:site_selection:all"));
foreach ($sites as $site) {
$pulldown_options[$site->guid] = $site->name;
}
echo "<div>";
echo elgg_echo("widget:river_widget:edit:site_selection") . ": ";
echo elgg_view("input/dropdown", array("name" => "params[activity_site_guid]", "value" => $vars['entity']->activity_site_guid, "options_values" => $pulldown_options, "style" => "width: 100px"));
echo "</div>";
}
}
?>
<div>
<?php
示例12: subsite_manager_group_join_action_hook
/**
* Do not allow non-subsite members to join an open group if the subsite is closed
*
* @return bool false if write is not allowed
*/
function subsite_manager_group_join_action_hook($hook, $type, $returnvalue, $params)
{
if (!subsite_manager_on_subsite()) {
return;
}
$site = elgg_get_site_entity();
if ($site->getMembership() == Subsite::MEMBERSHIP_OPEN) {
return;
// site is open, so everyone can become member of the group
}
$group_guid = get_input('group_guid');
$group = get_entity($group_guid);
if ($group->canEdit()) {
return;
// user is admin of the group of subsite, so let the default permission handler do its work
}
if (!$group->isPublicMembership()) {
return;
// group is closed, so let the default group permission handler do its work
}
if (!$site->isUser()) {
register_error(elgg_echo('subsite_manager:group:could_not_join'));
return false;
}
}
示例13: elgg_extract
/**
* Used to show plugin settings for both users and admins.
*
* @package Elgg.Core
* @subpackage Plugins
*/
$plugin = $vars['entity'];
$plugin_id = $plugin->getID();
$user_guid = elgg_extract('user_guid', $vars, elgg_get_logged_in_user_guid());
// Do we want to show admin settings or user settings
$type = elgg_extract('type', $vars, '');
if ($type != 'user') {
$type = '';
}
if (elgg_view_exists("{$type}settings/{$plugin_id}/edit")) {
elgg_deprecated_notice("{$type}settings/{$plugin_id}/edit was deprecated in favor of plugins/{$plugin_id}/{$type}settings", 1.8);
$settings = elgg_view("{$type}settings/{$plugin_id}/edit", $vars);
} else {
$settings = elgg_view("plugins/{$plugin_id}/{$type}settings", $vars);
}
if (!empty($settings)) {
echo $settings;
echo '<div class="elgg-foot">';
echo elgg_view('input/hidden', array('name' => 'plugin_id', 'value' => $plugin_id));
echo elgg_view('input/hidden', array('name' => 'user_guid', 'value' => $user_guid));
echo elgg_view('input/submit', array('value' => elgg_echo('save')));
if (empty($type) && subsite_manager_on_subsite() && subsite_manager_check_global_plugin_setting($plugin_id, "fallback_to_main_settings")) {
echo " " . elgg_view("output/confirmlink", array("text" => elgg_echo("subsite_manager:plugins:subsite:fallback"), "confirm" => elgg_echo("subsite_manager:plugins:subsite:fallback:confirm"), "href" => $vars["url"] . "action/plugins/fallback?guid=" . $plugin->getGUID()));
}
echo '</div>';
}
示例14: elgg_get_site_entity
<?php
$site = elgg_get_site_entity();
$annotation_id = (int) get_input("annotation_id");
if (subsite_manager_on_subsite() && !empty($annotation_id)) {
if ($site->approveMembershipRequest($annotation_id)) {
system_message(elgg_echo("subsite_manager:action:subsite:membership:approve:success"));
} else {
register_error(elgg_echo("subsite_manager:action:subsite:membership:approve:error"));
}
} else {
register_error(elgg_echo("subsite_manager:action:error:subsite_only"));
}
forward(REFERER);
示例15: array
<?php
/**
* Change the plugin categories for Plugin Manager
* because some plugin will not always be displayed
*
*/
// restrict the displayed plugin for subsite admins (on subsites)
if (subsite_manager_on_subsite() && !subsite_manager_is_superadmin_logged_in()) {
$plugins = elgg_get_plugins("any");
$categories = array();
foreach ($plugins as $id => $plugin) {
$show_plugin = subsite_manager_show_plugin($plugin);
if ($show_plugin) {
$plugin_categories = $plugin->getManifest()->getCategories();
if (isset($plugin_categories)) {
foreach ($plugin_categories as $category) {
if (!array_key_exists($category, $categories)) {
$categories[$category] = ElggPluginManifest::getFriendlyCategory($category);
}
}
}
}
}
asort($categories);
// we want bundled/nonbundled pulled to be at the top of the list
unset($categories['bundled']);
unset($categories['nonbundled']);
$common_categories = array('all' => elgg_echo('admin:plugins:category:all'), 'active' => elgg_echo('admin:plugins:category:active'), 'inactive' => elgg_echo('admin:plugins:category:inactive'), 'bundled' => elgg_echo('admin:plugins:category:bundled'), 'nonbundled' => elgg_echo('admin:plugins:category:nonbundled'));
$categories = array_merge($common_categories, $categories);
$vars["category_options"] = $categories;