本文整理汇总了PHP中elgg_get_site_url函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_get_site_url函数的具体用法?PHP elgg_get_site_url怎么用?PHP elgg_get_site_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_get_site_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: vouchers_init
/**
* Vouchers plugin initialization functions.
*/
function vouchers_init()
{
// register a library of helper functions
elgg_register_library('elgg:vouchers', elgg_get_plugins_path() . 'vouchers/lib/vouchers.php');
// Register subtype
run_function_once('vouchers_manager_run_once_subtypes');
// Register entity_type for search
elgg_register_entity_type('object', Voucher::SUBTYPE);
// Site navigation
$item = new ElggMenuItem('vouchers', elgg_echo('vouchers:menu'), 'vouchers/all');
elgg_register_menu_item('site', $item);
// Extend CSS
elgg_extend_view('css/elgg', 'vouchers/css');
elgg_register_css('vouchers_tooltip_css', '//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css');
// Extend js
elgg_register_js('vouchersjs', elgg_get_site_url() . 'mod/vouchers/assets/vouchers.js');
elgg_register_js('vouchers_tooltip_js', '//code.jquery.com/ui/1.11.1/jquery-ui.js');
// Register a page handler, so we can have nice URLs
elgg_register_page_handler('vouchers', 'vouchers_page_handler');
// Register a URL handler for voucher
$release = get_version(true);
// Register a URL handler for agora
if ($release < 1.9) {
// version 1.8
elgg_register_entity_url_handler('object', 'vouchers', 'voucher_url');
} else {
// use this since Elgg 1.9
elgg_register_plugin_hook_handler('entity:url', 'object', 'vouchers_set_url');
}
// Register menu item to an ownerblock
elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'vouchers_owner_block_menu');
// Register admin transaction log menu under "Utilities"
elgg_register_admin_menu_item('administer', 'vouchers_transactions_log', 'administer_utilities');
// register plugin hooks
elgg_register_plugin_hook_handler("public_pages", "walled_garden", "vouchers_walled_garden_hook");
// Register actions
$action_path = elgg_get_plugins_path() . 'vouchers/actions';
elgg_register_action("vouchers/addvoucher", "{$action_path}/addvoucher.php");
elgg_register_action("vouchers/delete", "{$action_path}/delvoucher.php");
elgg_register_action("vouchers/set_featured", "{$action_path}/vouchers/set_featured.php");
// set a voucher post as featured
elgg_register_action("vouchers/unset_featured", "{$action_path}/vouchers/unset_featured.php");
// unset a voucher post from featured
elgg_register_action("vouchers/get_with_points", "{$action_path}/vouchers/get_with_points.php");
// voucher purchase with points only
elgg_register_action('vouchers/be_interested', "{$action_path}/be_interested.php");
// send interest
elgg_register_action("vouchers/usersettings", "{$action_path}/usersettings.php");
// save user settings
// extend group main page
elgg_extend_view('groups/tool_latest', 'vouchers/group_module');
//elgg_extend_view("print", "printpreview/pageshell/pageshell");
// add the group vouchers tool option
add_group_tool_option('vouchers', elgg_echo('vouchers:group:enablevouchers'), true);
// Add vouchers widgets
elgg_register_widget_type('vouchers', elgg_echo('vouchers:widget'), elgg_echo('vouchers:widget:description'), 'profile,groups,dashboard');
// member's voucher posts
elgg_register_widget_type('vouchers_featured', elgg_echo('vouchers:widget:featured'), elgg_echo('vouchers:widget:featured:description'), 'dashboard');
// featured vouchers for dashboard
}
示例2: add_submenus
/**
* Sets up submenus. Triggered on pagesetup.
*
*/
function add_submenus()
{
$plugins_base = elgg_get_site_url() . "plugins";
if (elgg_get_context() == 'admin') {
elgg_register_admin_menu_item('administer', 'statistics', 'community_plugins');
elgg_register_admin_menu_item('administer', 'utilities', 'community_plugins');
elgg_register_admin_menu_item('configure', 'community_plugins', 'settings');
return;
}
if (elgg_get_context() != "plugins") {
return;
}
$page_owner = elgg_get_page_owner_entity();
if (elgg_is_logged_in() && elgg_get_page_owner_guid() == elgg_get_logged_in_user_guid()) {
elgg_register_menu_item('page', array('href' => "{$plugins_base}/developer/{$page_owner->username}", 'name' => 'plugins:yours', 'text' => elgg_echo("plugins:yours", array(elgg_echo('plugins:types:')))));
} else {
if (elgg_get_page_owner_guid()) {
$title = elgg_echo("plugins:user", array($page_owner->name, elgg_echo('plugins:types:')));
elgg_register_menu_item('page', array('href' => "{$plugins_base}/developer/{$page_owner->username}", 'name' => 'plugins:user', 'text' => $title));
}
}
elgg_register_menu_item('page', array('href' => '/plugins', 'name' => 'plugins:all', 'text' => elgg_echo('plugins:all')));
// add upload link when viewing own plugin page
if (elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) {
elgg_register_menu_item('page', array('href' => "{$plugins_base}/new/project/{$page_owner->username}", 'name' => 'plugins:upload', 'text' => elgg_echo('plugins:upload')));
}
}
示例3: views_counter_pagesetup
/**
* Set some views_counter links on elgg system
*/
function views_counter_pagesetup()
{
if (elgg_is_admin_logged_in() && elgg_get_context() == 'admin' || elgg_get_context() == 'views_counter') {
$item = new ElggMenuItem('views_counter_admin', elgg_echo('views_counter:admin_page'), elgg_get_site_url() . 'views_counter/list_entities/user');
elgg_register_menu_item('page', $item);
}
}
示例4: wet4_theme_init
function wet4_theme_init()
{
//reload groups library to have our sidebar changes
elgg_register_library('elgg:groups', elgg_get_plugins_path() . 'wet4/lib/groups.php');
elgg_register_event_handler('pagesetup', 'system', 'wet4_theme_pagesetup', 1000);
elgg_register_event_handler('pagesetup', 'system', 'wet4_riverItem_remove');
elgg_register_event_handler('pagesetup', 'system', 'messages_notifier');
elgg_register_plugin_hook_handler('register', 'menu:entity', 'wet4_elgg_entity_menu_setup');
elgg_register_plugin_hook_handler('register', 'menu:river', 'wet4_elgg_river_menu_setup');
elgg_register_plugin_hook_handler('register', 'menu:entity', 'wet4_likes_entity_menu_setup', 400);
//elgg_register_plugin_hook_handler('register', 'menu:entity', 'wet4_delete_entity_menu', 400);
// theme specific CSS
elgg_extend_view('css/elgg', 'wet4_theme/css');
//elgg_unextend_view('page/elements/header', 'search/header');
//elgg_extend_view('page/elements/sidebar', 'search/header', 0);
elgg_register_plugin_hook_handler('head', 'page', 'wet4_theme_setup_head');
elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'my_owner_block_handler');
//replace files lost while removing require.js
elgg_register_js('elgg/dev', elgg_get_site_url() . 'mod/wet4/views/default/js/elgg/dev.js', 'footer');
elgg_register_js('elgg/reportedcontent', elgg_get_site_url() . 'mod/wet4/views/default/js/elgg/reportedcontent.js', 'footer');
// non-members do not get visible links to RSS feeds
if (!elgg_is_logged_in()) {
elgg_unregister_plugin_hook_handler('output:before', 'layout', 'elgg_views_add_rss_link');
}
}
示例5: view_hook
/**
* replace any http images with https urls
*
* @param type $h
* @param type $t
* @param type $r
* @param type $p
* @return type
*/
function view_hook($h, $t, $r, $p)
{
$http_url = str_replace('https://', 'http://', elgg_get_site_url());
if (preg_match_all('/<img[^>]+src\\s*=\\s*["\']?([^"\' ]+)[^>]*>/', $r, $extracted_image)) {
foreach ($extracted_image[0] as $key => $i) {
if (strpos($extracted_image[1][$key], elgg_get_site_url()) !== false) {
continue;
// already one of our links
}
// check if this is our url being requested over http, and rewrite to https
if (strpos($extracted_image[1][$key], $http_url) === 0) {
$https_image = str_replace('http://', 'https://', $extracted_image[1][$key]);
$replacement_image = str_replace($extracted_image[1][$key], $https_image, $i);
$r = str_replace($i, $replacement_image, $r);
continue;
}
if (!is_https($extracted_image[1][$key])) {
// replace this url
$url = urlencode($extracted_image[1][$key]);
if (strpos($url, 'http') === 0) {
$token = get_token($extracted_image[1][$key]);
$new_url = elgg_normalize_url('mod/image_proxy/image.php?url=' . $url . '&token=' . $token);
$replacement_image = str_replace($extracted_image[1][$key], $new_url, $i);
$r = str_replace($i, $replacement_image, $r);
}
}
}
}
return $r;
}
示例6: event_manager_init
function event_manager_init()
{
// Register subtype
run_function_once("event_manager_run_once_subtypes");
// Register entity_type for search
elgg_register_entity_type("object", Event::SUBTYPE);
elgg_extend_view("css/elgg", "event_manager/css/site");
elgg_extend_view("js/elgg", "js/event_manager/site");
elgg_extend_view("page/elements/head", "event_manager/metatags");
elgg_register_page_handler("events", "event_manager_page_handler");
// Register granular notification for this type
register_notification_object("object", Event::SUBTYPE, elgg_echo("event_manager:notification:subject"));
// Listen to notification events and supply a more useful message
elgg_register_plugin_hook_handler("notify:entity:message", "object", "event_manager_notify_message");
// add site menu item
elgg_register_menu_item("site", array("name" => "event_manager", "text" => elgg_echo("event_manager:menu:title"), "href" => "/events"));
// add group tool option
add_group_tool_option("event_manager", elgg_echo("groups:enableevents"), true);
// add to group profile
elgg_extend_view("groups/tool_latest", "event_manager/group_module");
// add widgets
elgg_register_widget_type("events", elgg_echo("event_manager:widgets:events:title"), elgg_echo("event_manager:widgets:events:description"), "index,dashboard,profile,groups");
elgg_register_plugin_hook_handler("widget_url", "widget_manager", "event_manager_widget_events_url");
// register js libraries
$maps_key = elgg_get_plugin_setting("google_api_key", "event_manager");
elgg_register_simplecache_view("js/event_manager/googlemaps");
$em_maps_js = elgg_get_simplecache_url("js", "event_manager/googlemaps");
elgg_register_js("event_manager.maps.helper", $em_maps_js);
elgg_register_js("event_manager.maps.base", "//maps.googleapis.com/maps/api/js?key=" . $maps_key . "&sensor=true");
elgg_register_js("addthisevent", elgg_get_site_url() . "mod/event_manager/vendors/addthisevent/atemay.js");
}
示例7: uservalidationbyemail_generate_code
/**
* Generate an email activation code.
*
* @param int $user_guid The guid of the user
* @param string $email_address Email address
* @return string
* @deprecated 2.3
*/
function uservalidationbyemail_generate_code($user_guid, $email_address)
{
elgg_deprecated_notice(__FUNCTION__ . ' has been deprecated. Validation now relies on signed URL API', '2.3');
// Note: binding to site URL for multisite.
$site_url = elgg_get_site_url();
return elgg_build_hmac([(int) $user_guid, $email_address, $site_url])->getToken();
}
示例8: questions_notify_message_handler
function questions_notify_message_handler($hook, $entity_type, $returnvalue, $params)
{
$entity = $params['entity'];
$to_entity = $params['to_entity'];
$method = $params['method'];
if (elgg_instanceof($entity, 'object', 'question')) {
$descr = $entity->description;
$title = $entity->title;
$url = $entity->getURL();
$owner = $entity->getOwnerEntity();
$via = elgg_echo("questions:via");
if ($method == 'sms') {
//shortening the url for sms
$url = elgg_get_site_url() . "view/{$entity->guid}";
return "{$owner->name} {$via}: {$url} ({$title})";
}
if ($method == 'email') {
return "{$owner->name} {$via}: {$title} \n\n {$descr} \n\n {$url}";
}
if ($method == 'web') {
return "{$owner->name} {$via}: {$title} \n\n {$descr} \n\n {$url}";
}
}
return null;
}
示例9: is_uuid_this_domain
/**
* Test to see if a given uuid is for this domain, returning true if so.
*
* @param string $uuid A unique ID
*
* @return bool
*/
function is_uuid_this_domain($uuid)
{
if (strpos($uuid, elgg_get_site_url()) === 0) {
return true;
}
return false;
}
示例10: addMenuItem
/**
* Adds a new menu item
*
* @param array $params parameters of the menu item
*
* @return void
*/
public function addMenuItem($params = [])
{
if (empty($params)) {
return;
}
$defaults = ['access_id' => ACCESS_PUBLIC, 'is_action' => false, 'priority' => time()];
$menu_item = array_merge($defaults, $params);
$current_config = $this->getMenuConfig();
$name = elgg_extract('name', $menu_item);
if (empty($name)) {
$time = time();
$name = "menu_name_{$time}";
while (array_key_exists($name, $current_config)) {
$time++;
$name = "menu_name_{$time}";
}
$menu_item['name'] = $name;
}
if (isset($menu_item['href'])) {
if (strpos($menu_item['href'], elgg_get_site_url()) === 0) {
$menu_item['href'] = substr($menu_item['href'], strlen(elgg_get_site_url()));
}
}
$current_config[$name] = $menu_item;
$this->setMenuConfig($current_config);
}
示例11: views_parse
/**
* parse allowable views and set classes on links for video rendering
*
* @staticvar type $allowable_views
* @param type $hook
* @param type $type
* @param type $return
* @param type $params
* @return type
*/
function views_parse($hook, $type, $return, $params)
{
static $allowable_views, $allow_internal;
if (!is_array($allowable_views)) {
$allowable_views = get_allowable_views();
}
if (!in_array($type, $allowable_views)) {
return $return;
}
if (is_null($allow_internal)) {
$allow_internal = elgg_get_plugin_setting('internal_urls', PLUGIN_ID, 0);
}
// we're potentially adding items
elgg_require_js('embedly_cards/embedly_cards');
// mark all links as embedly-video and let embedly sort it out
libxml_use_internal_errors(true);
$doc = new \DOMDocument();
$doc->loadHTML($return);
foreach ($doc->getElementsByTagName('a') as $tag) {
$href = $tag->hasAttribute('href') ? $tag->getAttribute('href') : null;
if (!$href || strpos($href, 'http') !== 0) {
continue;
}
if (strpos($href, elgg_get_site_url()) === 0 && !$allow_internal) {
continue;
}
$tag->setAttribute('class', ($tag->hasAttribute('class') ? $tag->getAttribute('class') . ' ' : '') . 'embedly-video');
}
libxml_clear_errors();
return $doc->saveHTML();
}
示例12: au_group_tag_menu_page_handler
function au_group_tag_menu_page_handler($page, $identifier)
{
//show the page of search results
// assumes url of group/guid/tag
// if the tag is 'all' then will display a tagcloud
switch ($page[0]) {
case 'group':
$entity = get_entity($page[1]);
if (!elgg_instanceof($entity, 'group') || $entity->au_group_tag_menu_enable == 'no') {
return false;
}
elgg_push_breadcrumb($entity->name, $entity->getURL());
//should be OK if this is empty
$tag = $page[2];
elgg_push_breadcrumb($tag);
if ($tag == "all") {
//show a tag cloud for all group tags
//arbitrarily set to a max of 640 tags - should be enough for anyone :-)
$title = elgg_echo("au_group_tag_menu:tagcloud");
$options = array('container_guid' => $entity->getGUID(), 'type' => 'object', 'threshold' => 0, 'limit' => 640, 'tag_names' => array('tags'));
$thetags = elgg_get_tags($options);
//make it an alphabetical tag cloud, not with most popular first
sort($thetags);
//find the highest tag count for scaling the font
$max = 0;
foreach ($thetags as $key) {
if ($key->total > $max) {
$max = $key->total;
}
}
$content = " ";
//loop through and generate tags so they display nicely
//in the group, not as a dumb search page
foreach ($thetags as $key) {
$url = elgg_get_site_url() . "group_tag_menu/group/" . $entity->getGUID() . "/" . urlencode($key->tag);
$taglink = elgg_view('output/url', array('text' => ' ' . $key->tag, 'href' => $url, 'title' => "{$key->tag} ({$key->total})", 'rel' => 'tag'));
// get the font size for the tag (taken from elgg's own tagcloud code - not sure I love this)
$size = round(log($key->total) / log($max + 0.0001) * 100) + 30;
if ($size < 100) {
$size = 100;
}
// generate the link
$content .= " <a href='{$url}' style='font-size:{$size}%'>" . $key->tag . "</a> ";
}
} else {
//show the results for the selected tag
$title = elgg_echo("au_group_tag_menu:title") . "{$tag}";
$options = array('type' => 'object', 'metadata_name' => 'tags', 'metadata_value' => $tag, 'container_guid' => $entity->guid, 'full_view' => false);
$content = elgg_list_entities_from_metadata($options);
}
//display the page
if (!$content) {
$content = elgg_echo('au_group_tag_menu:noresults');
}
$layout = elgg_view_layout('content', array('title' => elgg_view_title($title), 'content' => $content, 'filter' => false));
echo elgg_view_page($title, $layout);
break;
}
return true;
}
示例13: handle
/**
* {@inheritdoc}
*/
protected function handle()
{
$uri = '/' . ltrim($this->argument('uri'), '/');
$method = $this->argument('method') ?: 'GET';
$add_csrf_tokens = $this->option('tokens');
$site_url = elgg_get_site_url();
$uri = substr(elgg_normalize_url($uri), strlen($site_url));
$path_key = Application::GET_PATH_KEY;
$parameters = [];
$query = trim((string) $this->option('query'), '?');
parse_str($query, $parameters);
if ($add_csrf_tokens) {
$ts = time();
$parameters['__elgg_ts'] = $ts;
$parameters['__elgg_token'] = _elgg_services()->actions->generateActionToken($ts);
}
$request = Request::create("?{$path_key}=" . urlencode($uri), $method, $parameters);
$cookie_name = _elgg_services()->config->getCookieConfig()['session']['name'];
$session_id = _elgg_services()->session->getId();
$request->cookies->set($cookie_name, $session_id);
$request->headers->set('Referer', elgg_normalize_url());
if ($this->option('export')) {
elgg_set_viewtype('json');
$request->headers->set('X-Elgg-Ajax-API', '2');
}
_elgg_services()->setValue('request', $request);
Application::index();
}
示例14: widget_manager_pagesetup
function widget_manager_pagesetup()
{
$context = elgg_get_context();
if (elgg_is_admin_logged_in() && $context == "admin") {
// move defaultwidgets menu item
elgg_unregister_menu_item("page", "appearance:default_widgets");
elgg_register_menu_item('page', array('name' => "appearance:default_widgets", 'href' => "admin/appearance/default_widgets", 'text' => elgg_echo("admin:appearance:default_widgets"), 'context' => 'admin', 'parent_name' => "widgets", 'section' => "configure"));
// add own menu items
elgg_register_admin_menu_item('configure', 'manage', 'widgets');
if (elgg_get_plugin_setting("custom_index", "widget_manager") == "1|0") {
// a special link to manage homepages that are only available if logged out
elgg_register_menu_item('page', array('name' => "admin:widgets:manage:index", 'href' => elgg_get_site_url() . "?override=true", 'text' => elgg_echo("admin:widgets:manage:index"), 'context' => 'admin', 'parent_name' => "widgets", 'section' => "configure"));
}
}
// update fixed widgets if needed
if (in_array($context, array("profile", "dashboard")) && ($page_owner_guid = elgg_get_page_owner_guid())) {
// only check things if you are viewing a profile or dashboard page
$fixed_ts = elgg_get_plugin_setting($context . "_fixed_ts", "widget_manager");
if (empty($fixed_ts)) {
// there should always be a fixed ts, so fix it now. This situation only occurs after activating widget_manager the first time.
$fixed_ts = time();
elgg_set_plugin_setting($context . "_fixed_ts", $fixed_ts, "widget_manager");
}
// get the ts of the profile/dashboard you are viewing
$user_fixed_ts = elgg_get_plugin_user_setting($context . "_fixed_ts", $page_owner_guid, "widget_manager");
if ($user_fixed_ts < $fixed_ts) {
widget_manager_update_fixed_widgets($context, $page_owner_guid);
}
}
if (widget_manager_multi_dashboard_enabled()) {
if (get_input("internal_dashboard") == "yes") {
elgg_set_view_location("page/default", dirname(__FILE__) . "/views_alt/");
}
}
}
示例15: event_manager_entity_menu
function event_manager_entity_menu($hook, $entity_type, $returnvalue, $params)
{
$result = $returnvalue;
if (elgg_in_context("widgets")) {
return $result;
}
if (($entity = elgg_extract("entity", $params)) && elgg_instanceof($entity, "object", Event::SUBTYPE)) {
$attendee_menu_options = array("name" => "attendee_count", "priority" => 50, "text" => elgg_echo("event_manager:event:relationship:event_attending:entity_menu", array($entity->countAttendees())), "href" => false);
$result[] = ElggMenuItem::factory($attendee_menu_options);
// change some of the basic menus
if (!empty($result) && is_array($result)) {
foreach ($result as &$item) {
switch ($item->getName()) {
case "edit":
$item->setHref("events/event/edit/" . $entity->getGUID());
break;
case "delete":
$href = elgg_get_site_url() . "action/event_manager/event/delete?guid=" . $entity->getGUID();
$href = elgg_add_action_tokens_to_url($href);
$item->setHref($href);
$item->setConfirmText(elgg_echo("deleteconfirm"));
break;
}
}
}
// show an unregister link for non logged in users
if (!elgg_is_logged_in() && $entity->register_nologin) {
$result[] = ElggMenuItem::factory(array("name" => "unsubscribe", "text" => elgg_echo("event_manager:menu:unsubscribe"), "href" => "events/unsubscribe/" . $entity->getGUID() . "/" . elgg_get_friendly_title($entity->title), "priority" => 300));
}
}
return $result;
}