本文整理汇总了PHP中elgg_get_root_path函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_get_root_path函数的具体用法?PHP elgg_get_root_path怎么用?PHP elgg_get_root_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_get_root_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: profile_page_handler
/**
* Profile page handler
*
* @param array $page Array of URL segments passed by the page handling mechanism
* @return bool
*/
function profile_page_handler($page)
{
if (isset($page[0])) {
$username = $page[0];
$user = get_user_by_username($username);
elgg_set_page_owner_guid($user->guid);
} elseif (elgg_is_logged_in()) {
forward(elgg_get_logged_in_user_entity()->getURL());
}
// short circuit if invalid or banned username
if (!$user || $user->isBanned() && !elgg_is_admin_logged_in()) {
register_error(elgg_echo('profile:notfound'));
forward();
}
$action = NULL;
if (isset($page[1])) {
$action = $page[1];
}
if ($action == 'edit') {
// use the core profile edit page
$base_dir = elgg_get_root_path();
require "{$base_dir}pages/profile/edit.php";
return true;
}
$content = elgg_view('profile/layout', array('entity' => $user));
$body = elgg_view_layout('one_column', array('content' => $content));
echo elgg_view_page($user->name, $body);
return true;
}
示例2: profile_page_handler
/**
* Profile page handler
*
* @param array $page Array of page elements, forwarded by the page handling mechanism
*/
function profile_page_handler($page)
{
if (isset($page[0])) {
$username = $page[0];
$user = get_user_by_username($username);
elgg_set_page_owner_guid($user->guid);
}
// short circuit if invalid or banned username
if (!$user || $user->isBanned() && !elgg_is_admin_logged_in()) {
register_error(elgg_echo('profile:notfound'));
forward();
}
$action = NULL;
if (isset($page[1])) {
$action = $page[1];
}
if ($action == 'edit') {
// use the core profile edit page
$base_dir = elgg_get_root_path();
require "{$base_dir}pages/profile/edit.php";
return;
}
// main profile page
$params = array('content' => elgg_view('profile/wrapper'), 'num_columns' => 3);
$content = elgg_view_layout('widgets', $params);
$body = elgg_view_layout('one_column', array('content' => $content));
echo elgg_view_page($title, $body);
}
示例3: elgg_get_upgrade_files
/**
* Returns a list of upgrade files relative to the $upgrade_path dir.
*
* @param string $upgrade_path The directory that has upgrade scripts
* @return array|false
* @access private
*
* @todo the wire and groups plugins and the installer are using this
*/
function elgg_get_upgrade_files($upgrade_path = null)
{
if (!$upgrade_path) {
$upgrade_path = elgg_get_root_path() . 'engine/lib/upgrades/';
}
$upgrade_path = sanitise_filepath($upgrade_path);
$handle = opendir($upgrade_path);
if (!$handle) {
return false;
}
$upgrade_files = array();
while ($upgrade_file = readdir($handle)) {
// make sure this is a well formed upgrade.
if (is_dir($upgrade_path . '$upgrade_file')) {
continue;
}
$upgrade_version = elgg_get_upgrade_file_version($upgrade_file);
if (!$upgrade_version) {
continue;
}
$upgrade_files[] = $upgrade_file;
}
sort($upgrade_files);
return $upgrade_files;
}
示例4: hj_framework_init
function hj_framework_init()
{
$path_libraries = elgg_get_root_path() . 'mod/hypeFramework/lib/';
elgg_register_library('framework:base', $path_libraries . 'base.php');
elgg_load_library('framework:base');
hj_framework_check_release('hypeFramework', HYPEFRAMEWORK_RELEASE);
// Classes
elgg_register_classes(elgg_get_root_path() . 'mod/hypeFramework/classes/');
// Libraries
$libraries = array('forms', 'page_handlers', 'actions', 'assets', 'views', 'ajax', 'menus', 'files', 'lists', 'hierarchies', 'location', 'knowledge', 'deprecated');
foreach ($libraries as $lib) {
$path = "{$path_libraries}{$lib}.php";
if (file_exists($path)) {
elgg_register_library("framework:library:{$lib}", $path);
elgg_load_library("framework:library:{$lib}");
}
}
// Vendor Libraries
// DomPDF library is not included by default
// Download and unzip to vendors/dompdf
$dompdf = elgg_get_root_path() . 'mod/hypeFramework/vendors/dompdf/dompdf_config.inc.php';
if (file_exists($dompdf)) {
elgg_register_library('framework:dompdf', $dompdf);
}
}
示例5: hj_framework_page_handlers
/**
* Page handlers for hypeFramework
*
*
* @param type $page
* @return type
*/
function hj_framework_page_handlers($page)
{
if (!isset($page[0])) {
forward();
}
$path_pages = elgg_get_root_path() . 'mod/hypeFramework/pages/';
switch ($page[0]) {
case 'edit':
set_input('guid', $page[1]);
include $path_pages . 'edit/object.php';
break;
case 'icon':
set_input('guid', $page[1]);
set_input('size', $page[2]);
include $path_pages . "icon/icon.php";
break;
case 'download':
set_input('guid', $page[1]);
include $path_pages . "file/download.php";
break;
case 'file':
switch ($page[1]) {
case 'create':
gatekeeper();
$container_guid = elgg_extract(2, $page, false);
if (!$container_guid) {
$container_guid = elgg_get_logged_in_user_guid();
}
elgg_set_page_owner_guid($container_guid);
set_input('container_guid', $container_guid);
include "{$path_pages}create/file.php";
break;
case 'edit':
gatekeeper();
set_input('guid', $page[2]);
include "{$path_pages}edit/object.php";
break;
case 'view':
if (!isset($page[2])) {
return false;
}
$entity = get_entity($page[2]);
if (!$entity) {
return false;
}
$sidebar = elgg_view('framework/file/dashboard/sidebar', array('entity' => $entity));
echo elgg_view_page($entity->title, elgg_view_layout('framework/entity', array('entity' => $entity, 'sidebar' => $sidebar)));
break;
}
break;
default:
return false;
break;
}
return true;
}
示例6: fontawesome_init
/**
* Gets called when the Elgg system initializes
*
* @return void
*/
function fontawesome_init()
{
// add CSS / JS
elgg_extend_view("css/elements/forms", "css/fontawesome/forms");
elgg_extend_view("css/admin", "css/fontawesome/admin");
// register css
$root_path = elgg_get_root_path();
$plugins_path = elgg_get_plugins_path();
if (file_exists("{$root_path}/vendor/fortawesome/font-awesome/css/font-awesome.min.css")) {
// this plugin was installed as a composer dependency
elgg_register_css("fontawesome", "vendor/fortawesome/font-awesome/css/font-awesome.min.css");
} elseif (file_exists("{$plugins_path}/fontawesome/vendor/fortawesome/font-awesome/css/font-awesome.min.css")) {
// this plugin was installed stand-alone
elgg_register_css("fontawesome", "mod/fontawesome/vendor/fortawesome/font-awesome/css/font-awesome.min.css");
}
elgg_load_css("fontawesome");
}
示例7: theme_haarlem_intranet_profile_page_handler
/**
* The profile page handler
*
* @param array $page page elements
*
* @return bool
*/
function theme_haarlem_intranet_profile_page_handler($page)
{
$user = false;
if (isset($page[0])) {
$username = $page[0];
$user = get_user_by_username($username);
if (!empty($user)) {
elgg_set_page_owner_guid($user->getGUID());
}
}
if (empty($user) && elgg_is_logged_in()) {
forward(elgg_get_logged_in_user_entity()->getURL());
}
// short circuit if invalid or banned username
if (empty($user) || $user->isBanned() && !elgg_is_admin_logged_in()) {
register_error(elgg_echo("profile:notfound"));
forward();
}
$action = false;
if (isset($page[1])) {
$action = $page[1];
}
if ($action == "edit") {
// use the core profile edit page
$base_dir = elgg_get_root_path();
require $base_dir . "pages/profile/edit.php";
return true;
}
$menu = elgg_trigger_plugin_hook('register', "menu:user_hover", array('entity' => $user), array());
$builder = new ElggMenuBuilder($menu);
$menu = $builder->getMenu();
$content = '<table id="theme-haarlem-intranet-profile"><tr><td>' . elgg_view("profile/owner_block", array("entity" => $user, 'menu' => $menu));
$content .= '</td><td>';
if (!theme_haarlem_is_extranet()) {
$content .= elgg_view("profile/details", array("entity" => $user, 'menu' => $menu));
} else {
$content .= elgg_view("profile/extranet", array("entity" => $user, 'menu' => $menu));
}
$content .= '</td></tr></table>';
$sidebar = elgg_view('theme_haarlem_intranet/profile/group_membership', array('entity' => $user));
// view profile
$body = elgg_view_layout("one_sidebar", array("content" => $content, 'menu' => $menu, 'layout' => 'content', 'sidebar' => $sidebar));
echo elgg_view_page($user->name, $body);
return true;
}
示例8: getSuggestions
/**
* Returns array of suggestions of plugin keys that could probably be replaced with core keys
*/
public function getSuggestions()
{
$suggestions = [];
$plugin_translations = $this->plugin_language_keys;
$plugin_translations = array_map('strtolower', $plugin_translations);
$core_translations = (include elgg_get_root_path() . 'languages/en.php');
$core_translations = array_map('strtolower', $core_translations);
foreach ($plugin_translations as $plugin_key => $plugin_value) {
foreach ($core_translations as $core_key => $core_value) {
similar_text($plugin_value, $core_value, $similarity);
if ($similarity > 90) {
$suggestions[$plugin_key] = $core_key;
break;
}
}
}
return $suggestions;
}
示例9: fontawesome_get_css_location
/**
* Return the url to the FontAwesome CSS
*
* @param bool $realpath return the file location
*
* @return false|string
*/
function fontawesome_get_css_location($realpath = false)
{
$realpath = (bool) $realpath;
$externals = elgg_get_config('externals_map');
if (empty($externals) || !is_array($externals)) {
return false;
}
$css = elgg_extract('css', $externals);
if (empty($css) || !is_array($css)) {
return false;
}
$fa = elgg_extract('fontawesome', $css);
if (empty($fa)) {
return false;
}
$result = elgg_normalize_url($fa->url);
if ($realpath) {
$result = str_ireplace(elgg_get_site_url(), elgg_get_root_path(), $result);
}
return $result;
}
示例10: theme_eersel_profile_page_handler
function theme_eersel_profile_page_handler($page)
{
$user = false;
if (isset($page[0])) {
$username = $page[0];
$user = get_user_by_username($username);
if (!empty($user)) {
elgg_set_page_owner_guid($user->getGUID());
}
}
if (empty($user) && elgg_is_logged_in()) {
forward(elgg_get_logged_in_user_entity()->getURL());
}
// short circuit if invalid or banned username
if (empty($user) || $user->isBanned() && !elgg_is_admin_logged_in()) {
register_error(elgg_echo("profile:notfound"));
forward();
}
$action = false;
if (isset($page[1])) {
$action = $page[1];
}
if ($action == "edit") {
// use the core profile edit page
$base_dir = elgg_get_root_path();
require $base_dir . "pages/profile/edit.php";
return true;
}
// view profile
$sidebar = "";
$content = elgg_view("profile/details", array("entity" => $user));
$title = $user->name;
if (elgg_is_logged_in()) {
$sidebar = elgg_view("profile/owner_block");
$content .= elgg_view_layout('widgets', array('num_columns' => 2));
}
$body = elgg_view_layout("two_sidebar", array("title" => $title, "content" => $content, "sidebar" => $sidebar, "filter" => false, "class" => "theme-eersel-profile-page"));
echo elgg_view_page($user->name, $body);
return true;
}
示例11: profile_sync_init
/**
* Init function for Profile Sync
*
* @return void
*/
function profile_sync_init()
{
elgg_extend_view('css/admin', 'css/profile_sync/admin');
// register ajax views
elgg_register_ajax_view('profile_sync/forms/datasource');
elgg_register_ajax_view('profile_sync/forms/sync_config');
elgg_register_ajax_view('profile_sync/sync_logs');
elgg_register_ajax_view('profile_sync/view_log');
elgg_register_ajax_view('profile_sync/sync_config/run');
elgg_register_admin_menu_item('configure', 'profile_sync', 'configure_utilities');
// register hooks
elgg_register_plugin_hook_handler('register', 'menu:entity', '\\ColdTrick\\ProfileSync\\EntityMenu::addDataSourceMenus');
elgg_register_plugin_hook_handler('register', 'menu:entity', '\\ColdTrick\\ProfileSync\\EntityMenu::addSyncConfigMenus');
elgg_register_plugin_hook_handler('cron', 'all', '\\ColdTrick\\ProfileSync\\Cron::runSyncs');
elgg_register_plugin_hook_handler('permissions_check:comment', 'object', '\\ColdTrick\\ProfileSync\\Comments::disallowComments');
// register actions
elgg_register_action('profile_sync/datasource/edit', dirname(__FILE__) . '/actions/datasource/edit.php', 'admin');
elgg_register_action('profile_sync/datasource/delete', elgg_get_root_path() . '/actions/entities/delete.php', 'admin');
elgg_register_action('profile_sync/sync_config', dirname(__FILE__) . '/actions/sync_config/edit.php', 'admin');
elgg_register_action('profile_sync/sync_config/delete', elgg_get_root_path() . '/actions/entities/delete.php', 'admin');
elgg_register_action('profile_sync/sync_config/run', dirname(__FILE__) . '/actions/sync_config/run.php', 'admin');
}
示例12: inviteonly_page_handler
/**
* Page handler for register and invite-only page
*
* @param array $page_elements Page elements
* @param string $handler The handler string
*
* @return bool
*/
function inviteonly_page_handler($page_elements, $handler)
{
if ($handler == 'invite-only') {
require_once elgg_get_plugins_path() . 'inviteonly/pages/inviteonly.php';
return true;
}
if ($handler == 'register') {
if (get_input('invitecode') && get_input('friend_guid')) {
$friend = get_user(get_input('friend_guid'));
if (!elgg_instanceof($friend, 'user')) {
return inviteonly_redirect();
}
$friend_invitecode = generate_invite_code($friend->username);
if ($friend_invitecode !== get_input('invitecode')) {
return inviteonly_redirect();
}
require_once elgg_get_root_path() . 'pages/account/register.php';
return true;
}
return inviteonly_redirect();
}
return false;
}
示例13: setupViews
/**
* Setup views for a given role
*
* @param ElggRole $role Role
* @return void
*/
public function setupViews(\ElggRole $role)
{
$role_perms = $this->getPermissions($role, 'views');
foreach ($role_perms as $view => $perm_details) {
switch ($perm_details['rule']) {
case self::DENY:
elgg_register_plugin_hook_handler('view', $view, array($this, 'supressView'));
break;
case self::EXTEND:
$params = $perm_details['view_extension'];
$view_extension = $this->replaceDynamicPaths($params['view']);
$priority = isset($params['priority']) ? $params['priority'] : 501;
$viewtype = isset($params['viewtype']) ? $params['viewtype'] : '';
elgg_extend_view($view, $view_extension, $priority, $viewtype);
break;
case self::REPLACE:
$params = $perm_details['view_replacement'];
$location = elgg_get_root_path() . $this->replaceDynamicPaths($params['location']);
$viewtype = isset($params['viewtype']) ? $params['viewtype'] : '';
elgg_set_view_location($view, $location, $viewtype);
break;
case self::ALLOW:
elgg_unregister_plugin_hook_handler('view', $view, array($this, 'supressView'));
break;
}
}
}
示例14: elgg_extract
<?php
$data = elgg_extract("data", $vars);
if (empty($data)) {
return;
}
$views = elgg_extract('views', $data);
$global_hooks = elgg_extract('global_hooks', $data);
$filtered_views = elgg_extract('filtered_views', $data);
$input_filtered_views = (array) elgg_extract('input_filtered_views', $data);
$root = elgg_get_root_path();
$strip = function ($file) use($root) {
return 0 === strpos($file, $root) ? substr($file, strlen($root)) : $file;
};
$make_id = function ($view) {
return "z" . md5($view);
};
$viewtype = elgg_extract("viewtype", $vars);
$viewtypes = elgg_extract("viewtypes", $vars);
foreach ($viewtypes as $type) {
$href = "admin/develop_tools/inspect?inspect_type=Views";
if ($type !== "default") {
$href .= "&type={$type}";
}
elgg_register_menu_item('developers_inspect_viewtype', array('name' => $type, 'text' => $type, 'href' => $href));
}
echo elgg_view_menu('developers_inspect_viewtype', array('class' => 'elgg-tabs mbm'));
if ($global_hooks) {
array_walk($global_hooks, function (&$hook) {
$id = "z" . md5($hook);
$hook = "<a href='?inspect_type=Plugin%20Hooks#{$id}'>{$hook}</a>";
示例15: elgg_user_account_page_handler
/**
* Page handler for account related pages
*
* @param array $page_elements Page elements
* @param string $handler The handler string
*
* @return bool
* @access private
*/
function elgg_user_account_page_handler($page_elements, $handler)
{
$base_dir = elgg_get_root_path() . 'pages/account';
switch ($handler) {
case 'login':
require_once "{$base_dir}/login.php";
break;
case 'forgotpassword':
require_once "{$base_dir}/forgotten_password.php";
break;
case 'resetpassword':
require_once "{$base_dir}/reset_password.php";
break;
case 'register':
require_once "{$base_dir}/register.php";
break;
default:
return false;
}
return true;
}