本文整理汇总了PHP中elgg_set_view_location函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_set_view_location函数的具体用法?PHP elgg_set_view_location怎么用?PHP elgg_set_view_location使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_set_view_location函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCrumbLinksAreNormalized
public function testCrumbLinksAreNormalized()
{
$this->markTestIncomplete('Needs DB');
// TODO make this unnecessary
elgg_set_view_location('output/url', __DIR__ . '/../../../views/');
elgg_set_view_location('navigation/breadcrumbs', __DIR__ . '/../../../views/');
elgg_push_breadcrumb('test', 'link');
$html = elgg_view('navigation/breadcrumbs');
$this->assertNotFalse(strpos($html, '"http://localhost/link"'));
}
示例2: testTrailingNonLinkIsRemoved
public function testTrailingNonLinkIsRemoved()
{
$this->markTestIncomplete('Needs DB');
// TODO make this unnecessary
elgg_set_view_location('output/url', __DIR__ . '/../../../views/');
elgg_set_view_location('navigation/breadcrumbs', __DIR__ . '/../../../views/');
elgg_push_breadcrumb('Foo', 'foo');
elgg_push_breadcrumb('Bar');
$html = elgg_view('navigation/breadcrumbs');
$this->assertFalse(strpos($html, 'Bar'));
}
示例3: openid_server_init
function openid_server_init()
{
global $CONFIG;
elgg_register_event_handler('login', 'user', 'openid_server_handle_login');
elgg_register_event_handler('logout', 'user', 'openid_server_handle_logout');
elgg_set_view_location("openid_server/forms/trust", $CONFIG->path . 'mod/openid_server/views/');
$base = elgg_get_plugins_path() . 'openid_server/actions';
elgg_register_action('openid_server/trust', "{$base}/trust.php", 'public');
elgg_extend_view("page/elements/head", "openid_server/metatags");
elgg_extend_view("xrds/services", "openid_server/service");
elgg_extend_view("user/default", "openid_server/profile");
}
示例4: set_view_location
/**
* Set an alternative base location for a view (as opposed to the default of $CONFIG->viewpath)
*
* @param string $view The name of the view
* @param string $location The base location path
*
* @deprecated 1.8 Use elgg_set_view_location()
*/
function set_view_location($view, $location, $viewtype = '')
{
elgg_deprecated_notice("set_view_location() was deprecated by elgg_set_view_location()", 1.8);
return elgg_set_view_location($view, $location, $viewtype);
}
示例5: roles_register_views
/**
*
* Processes view permissions from the role configuration array. This is called after the 'ready', 'system' event.
*
* For view extension and replacements the function simply calls the corresponding {@link elgg_extend_view()} and
* {@link elgg_set_view_location()} functions, to post-register views after all plugins have been initalized.
*
* For suppressing views (by using the "deny" rule), it registers a specific handler for the given view,
* to return an empty string instead of the view's original output. This is to conserve resources -
* there are hundreds of views contributing to any elgg page. Listening for all "views", "all" hooks would
* be quite a waste.
*
* @param string $event Equals 'ready'
* @param string $event_type Equals 'system'
* @param mixed $object Not in use for this specific listener
*/
function roles_register_views($event, $type, $object)
{
$role = roles_get_role();
if (elgg_instanceof($role, 'object', 'role')) {
$role_perms = roles_get_role_permissions($role, 'views');
if (is_array($role_perms) && !empty($role_perms)) {
foreach ($role_perms as $view => $perm_details) {
switch ($perm_details['rule']) {
case 'deny':
elgg_register_plugin_hook_handler('view', $view, 'roles_views_permissions');
break;
case 'extend':
$params = $perm_details['view_extension'];
$view_extension = roles_replace_dynamic_paths($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 'replace':
$params = $perm_details['view_replacement'];
$location = elgg_get_root_path() . roles_replace_dynamic_paths($params['location']);
$viewtype = isset($params['viewtype']) ? $params['viewtype'] : '';
elgg_set_view_location($view, $location, $viewtype);
break;
case 'allow':
default:
break;
}
}
}
}
}
示例6: autoregister_views
/**
* Auto-registers views from a location.
*
* @note Views in plugin/views/ are automatically registered for active plugins.
* Plugin authors would only need to call this if optionally including
* an entire views structure.
*
* @param string $view_base Optional The base of the view name without the view type.
* @param string $folder Required The folder to begin looking in
* @param string $base_location_path The base views directory to use with elgg_set_view_location()
* @param string $viewtype The type of view we're looking at (default, rss, etc)
*
* @return void
* @since 1.7.0
* @see elgg_set_view_location()
* @todo This seems overly complicated.
*/
function autoregister_views($view_base, $folder, $base_location_path, $viewtype)
{
if (!isset($i)) {
$i = 0;
}
if ($handle = opendir($folder)) {
while ($view = readdir($handle)) {
if (!in_array($view, array('.', '..', '.svn', 'CVS')) && !is_dir($folder . "/" . $view)) {
// this includes png files because some icons are stored within view directories.
// See commit [1705]
if (substr_count($view, ".php") > 0 || substr_count($view, ".png") > 0) {
if (!empty($view_base)) {
$view_base_new = $view_base . "/";
} else {
$view_base_new = "";
}
elgg_set_view_location($view_base_new . str_replace('.php', '', $view), $base_location_path, $viewtype);
}
} else {
if (!in_array($view, array('.', '..', '.svn', 'CVS')) && is_dir($folder . "/" . $view)) {
if (!empty($view_base)) {
$view_base_new = $view_base . "/";
} else {
$view_base_new = "";
}
autoregister_views($view_base_new . $view, $folder . "/" . $view, $base_location_path, $viewtype);
}
}
}
return TRUE;
}
return FALSE;
}
示例7: 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;
}
}
}
示例8: digest_prepare_run
/**
* Undo some extension to view by other plugins
*
* @param bool $refresh
*/
function digest_prepare_run($refresh = false)
{
global $CONFIG;
static $run_once;
if (!isset($run_once) || $refresh === true) {
// add views and css to digest handling
digest_message_css();
// let other plugins know they need to add their views/css
elgg_trigger_event("prepare", "digest");
// undo likes extension
elgg_unregister_event_handler("pagesetup", "system", "likes_setup");
// undo river_comments extensions
elgg_unregister_event_handler("pagesetup", "system", "river_comments_setup");
// undo more extensions
// trigger pagesetup
elgg_view_title("dummy");
// check for more extensions
if (isset($CONFIG->views->extensions)) {
foreach ($CONFIG->views->extensions as $view => $extensions) {
if (stristr($view, "river/")) {
unset($CONFIG->views->extensions[$view]);
}
}
}
// undo registrations on menu hooks
if (isset($CONFIG->hooks["register"])) {
if (isset($CONFIG->hooks["register"]["menu:user_hover"])) {
$CONFIG->hooks["register"]["menu:user_hover"] = array();
}
if (isset($CONFIG->hooks["register"]["menu:river"])) {
$CONFIG->hooks["register"]["menu:river"] = array();
}
if (isset($CONFIG->hooks["register"]["menu:entity"])) {
$CONFIG->hooks["register"]["menu:entity"] = array();
}
}
if (isset($CONFIG->hooks["prepare"])) {
if (isset($CONFIG->hooks["prepare"]["menu:user_hover"])) {
$CONFIG->hooks["prepare"]["menu:user_hover"] = array();
}
if (isset($CONFIG->hooks["prepare"]["menu:river"])) {
$CONFIG->hooks["prepare"]["menu:river"] = array();
}
if (isset($CONFIG->hooks["prepare"]["menu:entity"])) {
$CONFIG->hooks["prepare"]["menu:entity"] = array();
}
}
// set alternate view location for some views
elgg_set_view_location("icon/user/default", dirname(dirname(__FILE__)) . "/views_alt/", "default");
elgg_set_view_location("river/elements/body", dirname(dirname(__FILE__)) . "/views_alt/", "default");
// only let this happen once
$run_once = true;
}
}
示例9: 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');
elgg_register_admin_menu_item('administer', 'widgets', 'statistics');
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/");
}
}
}
示例10: theme_haarlem_intranet_init
/**
* Called during system init
*
* @return void
*/
function theme_haarlem_intranet_init()
{
// theme specific CSS
elgg_register_css("sourcesanspro", "//fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700");
elgg_load_css("sourcesanspro");
elgg_register_css("slickmap", elgg_get_site_url() . 'mod/theme_haarlem_intranet/vendors/slickmap/slickmap.css');
elgg_load_css("slickmap");
elgg_register_js('tinymce', 'mod/theme_haarlem_intranet/vendors/tinymce/js/tinymce/tinymce.min.js');
elgg_register_js('placeholders', elgg_get_site_url() . 'mod/theme_haarlem_intranet/vendors/placeholders/placeholders.jquery.min.js', 'footer');
elgg_load_js('placeholders');
$userpicker_js = elgg_get_simplecache_url('js', 'theme_haarlem_intranet/ui.userpicker');
elgg_register_js('elgg.userpicker', $userpicker_js);
elgg_extend_view('css/elgg', 'css/theme_haarlem_intranet/site');
elgg_extend_view('css/elgg', 'css/theme_haarlem_intranet/responsive');
elgg_extend_view('css/elgg', 'css/theme_haarlem_intranet/print');
elgg_extend_view('js/elgg', 'js/bfa_plugin');
elgg_extend_view('js/elgg', 'js/theme_haarlem_intranet/site');
elgg_extend_view('page/elements/foot', 'js/theme_haarlem_intranet/accordion');
elgg_extend_view('page/layouts/widgets', 'theme_haarlem_intranet/widgets_fix');
elgg_extend_view('widgets/free_html/edit', 'theme_haarlem_intranet/longtext_disclaimer');
elgg_extend_view('widgets/promo_widget/edit', 'theme_haarlem_intranet/longtext_disclaimer');
elgg_extend_view('river/elements/body', 'theme_haarlem_intranet/river/elements/body', 400);
elgg_extend_view('page/elements/header', 'theme_haarlem_intranet/mobile_forward');
elgg_extend_view('output/longtext', 'theme_haarlem_intranet/shortcodes', 100);
elgg_extend_view('profile_manager/profile_completeness/content', 'theme_haarlem_intranet/profile/completeness/push', 400);
elgg_extend_view('profile_manager/profile_completeness/content', 'theme_haarlem_intranet/profile/completeness/pop', 900);
elgg_register_plugin_hook_handler('categorized_profile_fields', 'profile_manager', 'theme_haarlem_profile_completeness_fields', 99999);
// unextend views
elgg_unextend_view('page/elements/header', 'search/header');
if (!theme_haarlem_is_extranet()) {
define('THEME_BLUE', '00ADEF');
elgg_extend_view('page/elements/header', 'search/header');
} else {
define('THEME_BLUE', 'A60F0F');
elgg_extend_view('css/elgg', 'css/theme_haarlem_intranet/extranet');
}
elgg_unextend_view("page/elements/owner_block/extend", "group_tools/owner_block");
elgg_unextend_view("groups/sidebar/members", "group_tools/group_admins");
elgg_set_view_location('plugins/simplesaml/usersettings', 'nonexisting');
// events
elgg_register_event_handler('pagesetup', 'system', 'theme_haarlem_intranet_pagesetup', 600);
elgg_register_event_handler('create', 'member_of_site', 'theme_haarlem_intranet_site_join_event');
elgg_register_event_handler('delete', 'member_of_site', 'theme_haarlem_intranet_site_leave_event');
elgg_register_event_handler('update_user', 'profile_sync', 'theme_haarlem_intranet_profile_sync_site_membership');
elgg_register_event_handler('update_user', 'profile_sync', 'theme_haarlem_intranet_profile_sync_zakelijkemail');
elgg_register_event_handler('update_user', 'profile_sync', 'theme_haarlem_intranet_profile_sync_profile_icon');
// plugin hooks
elgg_register_plugin_hook_handler("register", "menu:personal", "theme_haarlem_intranet_personal_menu");
elgg_register_plugin_hook_handler("register", "menu:entity", "theme_haarlem_intranet_entity_menu_icons");
elgg_register_plugin_hook_handler("register", "menu:entity", "theme_haarlem_intranet_thewire_entity_menu");
elgg_register_plugin_hook_handler("register", "menu:user_hover", "theme_haarlem_intranet_user_hover_menu");
elgg_register_plugin_hook_handler("register", "menu:quick_nav", "theme_haarlem_intranet_quick_nav_menu");
elgg_register_plugin_hook_handler("register", "menu:file_tools_folder_sidebar_tree", "theme_haarlem_intranet_folder_tree_menu");
elgg_register_plugin_hook_handler("prepare", "menu:page", "theme_haarlem_intranet_prepare_page_menu_static");
elgg_register_plugin_hook_handler("prepare", "menu:page", "theme_haarlem_intranet_prepare_menu_icons");
elgg_register_plugin_hook_handler("prepare", "menu:owner_block", "theme_haarlem_intranet_prepare_menu_icons");
elgg_register_plugin_hook_handler("prepare", "menu:site", "theme_haarlem_intranet_prepare_site_menu", 99999);
elgg_register_plugin_hook_handler("prepare", "menu:site", "theme_haarlem_intranet_responsive_toggle_links", 99999);
elgg_register_plugin_hook_handler('route', 'all', 'theme_haarlem_intranet_route_static_handler');
elgg_register_plugin_hook_handler('route', 'settings', 'theme_haarlem_intranet_route_settings_handler');
elgg_register_plugin_hook_handler('route', 'avatar', 'theme_haarlem_intranet_route_avatar_handler');
elgg_unregister_plugin_hook_handler("route", "file", "file_tools_file_route_hook");
elgg_register_plugin_hook_handler("route", "file", "theme_haarlem_intranet_file_route_handler");
elgg_register_plugin_hook_handler("route", "file", "file_tools_file_route_hook");
elgg_register_plugin_hook_handler("route", "groups", "theme_haarlem_intranet_groups_route_handler");
elgg_register_plugin_hook_handler('route', 'pages', 'theme_haarlem_intranet_pages_route_handler');
elgg_register_plugin_hook_handler("route", "livesearch", "theme_haarlem_intranet_livesearch_route_handler");
elgg_register_plugin_hook_handler('config', 'htmlawed', 'theme_haarlem_intranet_htmlawed_config');
elgg_register_plugin_hook_handler("register", "menu:page", "theme_haarlem_intranet_cleanup_menu");
elgg_register_plugin_hook_handler('register', 'menu:longtext', 'theme_haarlem_intranet_cleanup_menu');
elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'theme_haarlem_intranet_cleanup_menu');
elgg_unregister_plugin_hook_handler("search_multisite", "search", "subsite_manager_search_multisite_search_hook");
elgg_register_plugin_hook_handler('entity:icon:url', 'user', 'theme_haarlem_intranet_profile_icon', 2000);
// high prio to overrule subsite_manager
elgg_register_plugin_hook_handler("action", "logout", "theme_haarlem_intranet_logout_action_hook");
elgg_register_plugin_hook_handler("access:default", "user", "theme_haarlem_intranet_access_default");
// page handlers
elgg_register_page_handler('profile', 'theme_haarlem_intranet_profile_page_handler');
elgg_register_page_handler('dashboard', 'theme_haarlem_intranet_dashboard_page_handler');
elgg_register_page_handler('haarlem_avatar', 'theme_haarlem_intranet_avatar_page_handler');
// quick nav
elgg_register_ajax_view('theme_haarlem_intranet/forms/quick_nav');
$js = elgg_get_simplecache_url('js', 'theme_haarlem_intranet/quick_nav');
elgg_register_js('theme_haarlem_intranet_quick_nav', $js);
elgg_register_widget_type('quick_nav', elgg_echo('theme_haarlem_intranet:quick_nav:widget:title'), elgg_echo('theme_haarlem_intranet:quick_nav:widget:description'), 'index', true);
elgg_register_widget_type('pages', elgg_echo('pages'), elgg_echo('pages:widget:description'), 'all', true);
elgg_register_action('theme_haarlem_intranet/quick_nav', dirname(__FILE__) . '/actions/quick_nav.php');
elgg_register_action('theme_haarlem_intranet/admin/reset_mentions', dirname(__FILE__) . '/actions/admin/reset_mentions.php', 'admin');
// izine
elgg_register_widget_type('izine', elgg_echo('theme_haarlem_intranet:izine:widget:title'), elgg_echo('theme_haarlem_intranet:izine:widget:description'), 'index', true);
elgg_register_widget_type('haarlem_news', elgg_echo('theme_haarlem_intranet:haarlem_news:widget:title'), elgg_echo('theme_haarlem_intranet:haarlem_news:widget:description'), 'index', true);
// increase master icon sizes
$icon_sizes = elgg_get_config('icon_sizes');
$icon_sizes['master']['h'] = 1024;
$icon_sizes['master']['w'] = 1024;
//.........这里部分代码省略.........