Convenience function for generating a form from a view in a standard location.This function assumes that the body of the form is located at "forms/$action" and sets the action by default to "action/$action". Automatically wraps the forms/$action view with a <form> tag and inserts the anti-csrf security tokens.
@tip This automatically appends elgg-form-action-name to the form's class. It replaces any slashes with dashes (blog/save becomes elgg-form-blog-save)
This would assume a "login" form body to be at "forms/login" and would set the action of the form to "http://yoursite.com/action/login".
If elgg_view('forms/login') is: <input type="text" name="username" > <input type="password" name="password" >
Then elgg_view_form('login') generates: <form action="http://yoursite.com/action/login" method="post"> ...security tokens... <input type="text" name="username" > <input type="password" name="password" > </form>
<?php
return true;
}
}
}
return $viewtype;
}
}
return 'default';
}
$GLOBALS['_ELGG']->view_types = array();
}
if (!in_array($viewtype, $GLOBALS[
'_ELGG']->
view_types)) {
$GLOBALS['_ELGG']->view_types[] = $viewtype;
}
return true;
}
return false;
}
return in_array($viewtype, $GLOBALS[
'_ELGG']->
view_types);
}
if (!is_string($viewtype) || $viewtype === '') {
return false;
}
if (preg_match('/\W/', $viewtype)) {
return false;
}
return true;
}
}
}
}
}
if ($cacheable) {
}
}
}
}
}
}
function elgg_view(
$view,
$vars = array(), $ignore1 =
false, $ignore2 =
false, $viewtype =
'') {
}
}
}
}
}
return Minify_CSS_UriRewriter::prepend(
$css,
$path);
}
if (!$timer->hasEnded(['build page'])) {
$timer->end(['build page']);
}
$timer->begin([__FUNCTION__]);
if ($system_messages->count()) {
$messages = $system_messages->dumpRegister();
$errors = array(
);
}
}
$vars[
'page_shell'] = $page_shell;
$timer->end([__FUNCTION__]);
}
$view =
"resources/$name";
}
}
} else {
}
}
'links' => array(),
'metas' => array(),
);
} else {
}
$params[
'metas'][
'content-type'] = array(
'http-equiv' => 'Content-Type',
'content' => 'text/html; charset=utf-8',
);
$params[
'metas'][
'description'] = array(
'name' => 'description',
);
$params[
'metas'][
'viewport'] = array(
'name' => 'viewport',
'content' => 'width=device-width',
);
$params[
'metas'][
'mobile-web-app-capable'] = array(
'name' => 'mobile-web-app-capable',
'content' => 'yes',
);
$params[
'metas'][
'apple-mobile-web-app-capable'] = array(
'name' => 'apple-mobile-web-app-capable',
'content' => 'yes',
);
if (substr_count(
$url,
'?')) {
} else {
}
'rel' => 'alternative',
'type' => 'application/rss+xml',
'title' => 'RSS',
);
}
}
$head_params['links']['apple-touch-icon'] = array(
'rel' => 'apple-touch-icon',
);
$head_params['links']['icon-ico'] = array(
'rel' => 'icon',
);
$head_params['links']['icon-vector'] = array(
'rel' => 'icon',
'sizes' => '16x16 32x32 48x48 64x64 128x128',
'type' => 'image/svg+xml',
);
$head_params['links']['icon-16'] = array(
'rel' => 'icon',
'sizes' => '16x16',
'type' => 'image/png',
);
$head_params['links']['icon-32'] = array(
'rel' => 'icon',
'sizes' => '32x32',
'type' => 'image/png',
);
$head_params['links']['icon-64'] = array(
'rel' => 'icon',
'sizes' => '64x64',
'type' => 'image/png',
);
$head_params['links']['icon-128'] = array(
'rel' => 'icon',
'sizes' => '128x128',
'type' => 'image/png',
);
return $head_params;
}
if (!$timer->hasEnded(['build page'])) {
$timer->end(['build page']);
}
$timer->begin([__FUNCTION__]);
$param_array['layout'] = $layout_name;
} else {
}
$timer->end([__FUNCTION__]);
}
unset(
$vars[
'menu_view']);
} elseif (
$menu instanceof UnpreparedMenu) {
}
if (!
$menu instanceof Menu) {
throw new \InvalidArgumentException('$menu must be a menu name, a Menu, or UnpreparedMenu');
}
$views = [
$menu_view,
"navigation/menu/$name",
'navigation/menu/default',
];
foreach ($views as
$view) {
}
}
}
if (!isset(
$vars[
'class'])) {
$vars[
'class'] =
'elgg-menu-content';
}
if (
$item->getLinkClass()) {
}
if (
$item->getHref() ===
false ||
$item->getHref() ===
null) {
if (preg_match(
'~<[a-z]~',
$text)) {
} else {
}
}
if (!isset(
$vars[
'rel']) && !isset(
$vars[
'is_trusted'])) {
$vars[
'is_trusted'] =
true;
}
if (
$item->getConfirmText()) {
}
}
return false;
}
'full_view' => true,
);
$entity_subtype =
$entity->getSubtype();
if (empty($entity_subtype)) {
$entity_subtype = 'default';
}
$entity_views = array(
"$entity_type/$entity_subtype",
"$entity_type/default",
);
foreach ($entity_views as
$view) {
break;
}
}
if (
$vars[
'full_view']) {
}
}
}
return false;
}
}
}
}
}
}
'full_view' => true,
);
return false;
}
$annotation_views = array(
"annotation/$name",
"annotation/default",
);
foreach ($annotation_views as
$view) {
break;
}
}
}
'items' => $entities,
'list_class' => 'elgg-list-entity',
'full_view' => true,
'pagination' => true,
'list_type' => $list_type,
'list_type_toggle' => false,
'limit' => null,
);
$vars[
"pagination"] =
false;
}
if (
$vars[
'list_type'] ==
'table') {
} elseif (
$vars[
'list_type'] ==
'list') {
} else {
}
}
'offset' => null,
'limit' => null,
'list_class' => 'elgg-list-annotation elgg-annotation-list',
'full_view' => true,
'offset_key' => 'annoff',
);
$vars[
"pagination"] =
false;
}
}
return false;
}
array(
)
);
}
}
$view =
'output/friendlytime';
$vars = [
'time' => $time];
}
return false;
}
$vars[
'show_add_form'] = $add_comment;
} else {
}
}
}
}
return '';
}
return '';
}
return '';
}
$river_views = array(
"river/item",
);
foreach ($river_views as
$view) {
break;
}
}
}
}
}
}
}
if (isset(
$vars[
'help'])) {
}
if (isset(
$vars[
'field_class'])) {
unset(
$vars[
'field_class']);
}
}
_elgg_services()->logger->error(__FUNCTION__ .
'(): $params["#type"] is required.');
return '';
}
return '';
}
$hidden_types = ['hidden', 'securitytoken'];
}
$id =
"elgg-field-" . base_convert(mt_rand(), 10, 36);
}
$element_vars = [];
$make_special_checkbox_label = false;
} else {
$make_special_checkbox_label = true;
}
}
}
}
unset($element_vars['class']);
$element_vars[
'class'] =
$params[
'#class'];
}
unset($element_vars['help']);
$element_vars[
'help'] =
$params[
'#help'];
}
unset($element_vars['label']);
$element_vars[
'label'] =
$params[
'#label'];
}
$element_vars[
'label'] =
elgg_view(
'elements/forms/label', $element_vars);
$element_vars[
'help'] =
elgg_view(
'elements/forms/help', $element_vars);
if ($make_special_checkbox_label) {
unset($element_vars['label']);
}
return elgg_view(
'elements/forms/field', $element_vars);
}
}
}
'value' => $tag_data,
));
}
}
return '';
}
}
$vars = array(
'class' =>
'float');
}
}
throw new \InvalidArgumentException('$vars needs to be a string or an array');
}
if (!array_key_exists(
'class',
$vars)) {
$vars[
'class'] = array();
}
if (!is_array(
$vars[
'class'])) {
}
$vars[
'class'][] =
"elgg-icon-$name";
}
}
}
if (isset($GLOBALS['autofeed']) && is_bool($GLOBALS['autofeed'])) {
return $GLOBALS['autofeed'];
}
}
$entities =
$user->getFriends(array(
'limit' => 0));
} else {
$entities = array();
}
$collections[
$key]->entities = $entities;
}
}
return elgg_view(
'core/friends/collections', array(
'collections' => $collections));
}
return _elgg_services()->views->autoregisterViews($view_base, $folder, $viewtype);
}
if (preg_match(
'~[\.-]min\.~',
$params[
'view'])) {
return;
}
}
} elseif (
$type ==
'css') {
$cssmin = new CSSmin();
}
}
}
$filter = new \Elgg\Amd\ViewFilter();
}
if (substr_count(
$url,
'?')) {
} else {
}
'name' => 'rss',
));
}
}
header(
'X-Frame-Options: SAMEORIGIN');
}
if ($views->viewIsExtended(
$view) || $views->viewHasHookHandlers(
$view)) {
return true;
}
if (0 === strpos(
$path,
'/') || preg_match(
'~^([A-Za-z]\:)?\\\\~',
$path)) {
} else {
$root = dirname(dirname(__DIR__));
$expected_path =
"$root/views/$viewtype/" . ltrim(
$path,
'/\\');
}
$view_path = $views->findViewFile(
$view, $viewtype);
return realpath($view_path) !== realpath($expected_path);
}
_elgg_services()->views->registerPluginViews(realpath(__DIR__ .
'/../../'));
$file = dirname(__DIR__) .
'/views.php';
$spec = Includer::includeFile(
$file);
if (is_array($spec)) {
}
}
}
'deps' => ['jquery-ui'],
]);
$viewtype_dirs = scandir($view_path);
foreach ($viewtype_dirs as $viewtype) {
}
}
'topbar' => array('w' => 16, 'h' => 16, 'square' => true, 'upscale' => true),
'tiny' => array('w' => 25, 'h' => 25, 'square' => true, 'upscale' => true),
'small' => array('w' => 40, 'h' => 40, 'square' => true, 'upscale' => true),
'medium' => array('w' => 100, 'h' => 100, 'square' => true, 'upscale' => true),
'large' => array('w' => 200, 'h' => 200, 'square' => false, 'upscale' => false),
'master' => array('w' => 550, 'h' => 550, 'square' => false, 'upscale' => false),
);
}
}
static $allow_delay_pagesetup = true;
if (isset($GLOBALS[
'_ELGG']->pagesetupdone) || empty(
$CONFIG->boot_complete)) {
return;
}
$allow_delay = $allow_delay_pagesetup;
$allow_delay_pagesetup = false;
if ($allow_delay && (0 === strpos(
$view,
'resources/'))) {
return;
}
$GLOBALS['_ELGG']->pagesetupdone = true;
_elgg_services()->hooks->unregisterHandler(
'view_vars',
'all',
'_elgg_manage_pagesetup');
}
}
return [
'elgg.security.interval' => (int)
_elgg_services()->actions->getActionTokenTimeout() * 333,
];
}
elgg_log(
'"elgg.data" plugin hook handlers must return an array. Returned ' . gettype(
$data) .
'.',
'ERROR');
}
$elgg = array(
'config' => array(
),
'security' => array(
'token' => array(
),
),
'session' => array(
'user' => null,
),
'_data' => (
object)
$data,
);
$elgg['config']['load_sync_code'] = true;
}
}
$user_object =
$user->toObject();
$user_object->admin =
$user->isAdmin();
$elgg['session']['user'] = $user_object;
}
return $elgg;
}
if ($viewtype) {
}
if ($viewtype) {
}
return $ret;
}
$events->registerHandler('boot', 'system', 'elgg_views_boot');
$hooks->registerHandler('view_vars', 'all', '_elgg_manage_pagesetup', 1000);
};
$content
Set robots.txt action.
if(! $collection_name) $id
$label
Elgg profile plugin edit default profile action.
generate_action_token($timestamp)
Generate an action token.
if($guid==elgg_get_logged_in_user_guid()) $name
clearfix elgg elgg elgg elgg page header
elgg_is_simplecache_enabled()
Is simple cache enabled.
elgg_register_simplecache_view($view_name)
Registers a view to simple cache.
elgg_get_simplecache_url($view, $subview='')
Get the URL for the cached view.
Allow executing scripts without $this context or local vars.
$_ELGG view_types
A list of valid view types as discovered.
elgg_set_config($name, $value)
Set an Elgg configuration value.
elgg_get_site_url($site_guid=0)
Get the URL for the current (or specified) site.
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
$annotation
Elgg default annotation view.
register_error($error)
Display an error on next page load.
elgg_define_js($name, $config)
Defines a JS lib as an AMD module.
elgg_log($message, $level='NOTICE')
Display or log a message.
elgg_register_css($name, $url, $priority=null)
Register a CSS file for inclusion in the HTML head.
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
elgg_load_css($name)
Load a CSS file for this page.
elgg_register_plugin_hook_handler($hook, $type, $callback, $priority=500)
elgg_register_js($name, $url, $location='head', $priority=null)
Register a JavaScript file for inclusion.
elgg_get_version($human_readable=false)
Get the current Elgg version information.
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
elgg_load_js($name)
Load a JavaScript resource on this page.
forward($location="", $reason='system')
Forward to $location.
get_members_of_access_collection($collection_id, $guids_only=false)
Get all of members of an access collection.
get_user_access_collections($owner_guid, $site_guid=0)
Returns an array of database row objects of the access collections owned by $owner_guid.
_elgg_services(\Elgg\Di\ServiceProvider $services=null)
Get the global service provider.
if(! $display_name) $type
$object
These two snippets demonstrates triggering an event and how to register for that event.
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
elgg_view_resource($name, array $vars=[])
Render a resource view.
elgg_set_form_footer($footer='')
Sets form footer and defers its rendering until the form view and extensions have been rendered.
elgg_view_friendly_time($time)
Displays a UNIX timestamp in a friendly way.
elgg_view_comments($entity, $add_comment=true, array $vars=array())
Returns rendered comments and a comment form for an entity.
elgg_view_annotation_list($annotations, array $vars=array())
Returns a rendered list of annotations, plus pagination.
elgg_get_viewtype()
Return the current view type.
elgg_register_viewtype_fallback($viewtype)
Register a viewtype to fall back to a default view if a view isn't found for that viewtype.
elgg_is_registered_viewtype($viewtype)
Checks if $viewtype is registered.
elgg_view_input($input_type, array $vars=array())
Renders a form field.
_elgg_get_js_page_data()
Get the initial contents of "elgg" client side.
_elgg_has_rss_link()
Should the RSS view of this URL be linked to?
elgg_view_menu_item(\ElggMenuItem $item, array $vars=array())
Render a menu item (usually as a link)
elgg_list_views($viewtype='default')
List all views in a viewtype.
elgg_does_viewtype_fallback($viewtype)
Checks if a viewtype falls back to default.
elgg_unregister_ajax_view($view)
Unregister a view for ajax calls.
elgg_unregister_rss_link()
Remove the RSS icon link and link element from the head.
elgg_register_viewtype($viewtype)
Register a viewtype.
elgg_view_title($title, array $vars=array())
Renders a title.
elgg_view_layout($layout_name, $vars=array())
Displays a layout with optional parameters.
_elgg_manage_pagesetup($hook, $view, $value, $params)
Handle triggering the pagesetup event at the right time.
_elgg_views_amd($hook, $type, $content, $params)
Inserts module names into anonymous modules by handling the "simplecache:generate" hook.
elgg_unextend_view($view, $view_extension)
Unextends a view.
_elgg_views_send_header_x_frame_options()
Sends X-Frame-Options header on page requests.
_elgg_views_minify($hook, $type, $content, $params)
Minifies simplecache CSS and JS views by handling the "simplecache:generate" hook.
elgg_set_view_location($view, $location, $viewtype='')
Set an alternative base location for a view.
_elgg_get_initial_viewtype()
Get the initial viewtype.
elgg_view_river_item($item, array $vars=array())
Renders a human-readable representation of a river item.
_elgg_view_under_viewtype($view, $vars, $viewtype)
Render a view while the global viewtype is temporarily changed.
elgg_view_entity_icon(\ElggEntity $entity, $size='medium', $vars=array())
View the icon of an entity.
elgg_view_access_collections($owner_guid)
Displays a user's access collections, using the core/friends/collections view.
elgg_views_add_rss_link()
Add the RSS link to the extras when if needed.
elgg_view_list_item($item, array $vars=array())
View an item in a list.
elgg_view_image_block($image, $body, $vars=array())
Wrapper function for the image block display pattern.
elgg_unregister_external_view($view)
Unregister a view for ajax calls.
_elgg_views_prepare_favicon_links($hook, $type, $head_params, $params)
Add favicon link tags to HTML head.
elgg_register_ajax_view($view)
Register a view to be available for ajax calls.
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
elgg_views_boot()
Initialize viewtypes on system boot event This ensures simplecache is cleared during upgrades.
elgg_view_page($title, $body, $page_shell='default', $vars=array())
Assembles and outputs a full page.
elgg_view_annotation(\ElggAnnotation $annotation, array $vars=array(), $bypass=false, $debug=false)
Returns a string of a rendered annotation.
elgg_view_form($action, $form_vars=array(), $body_vars=array())
elgg_view_entity(\ElggEntity $entity, array $vars=array(), $bypass=false, $debug=false)
Returns a string of a rendered entity.
elgg_get_form_footer()
Returns currently set footer, or false if not in the form rendering stack.
autoregister_views($view_base, $folder, $ignored, $viewtype)
Auto-registers views from a location.
_elgg_get_js_site_data()
Get the site data to be merged into "elgg" in elgg.js.
global $CURRENT_SYSTEM_VIEWTYPE
The viewtype override.
elgg_view_icon($name, $vars=array())
View one of the icons.
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype='')
Return a parsed view.
elgg_set_viewtype($viewtype="")
Manually set the viewtype.
elgg_extend_view($view, $view_extension, $priority=501)
Extends a view with another view.
elgg_view_deprecated($view, array $vars, $suggestion, $version)
Display a view with a deprecation notice.
elgg_view_entity_annotations(\ElggEntity $entity, $full_view=true)
Display a plugin-specified rendered list of annotations for an entity.
elgg_view_entity_list($entities, array $vars=array())
Returns a rendered list of entities with pagination.
_elgg_is_valid_viewtype($viewtype)
Checks if $viewtype is a string suitable for use as a viewtype name.
elgg_prepend_css_urls($css, $path)
In CSS content, prepend a path to relative URLs.
_elgg_view_may_be_altered($view, $path)
Is there a chance a plugin is altering this view?
elgg_view_module($type, $title, $body, array $vars=array())
Wrapper function for the module display pattern.
elgg_view_exists($view, $viewtype='', $recurse=true)
Returns whether the specified view exists.
elgg_register_rss_link()
Include the RSS icon link and link element in the head.
elgg_get_view_extensions($view)
Get the views (and priorities) that extend a view.
_elgg_views_prepare_head($title)
Prepare the variables for the html head.
elgg_view_menu($menu, array $vars=array())
Render a menu.
elgg_register_external_view($view, $cacheable=false)
Registers a view as being available externally (i.e.
elgg_view_tagcloud(array $options=array())
Create a tagcloud for viewing.
elgg_register_menu_item($menu_name, $menu_item)
Register an item for an Elgg menu.
elgg_format_url($url)
Handles formatting of ampersands in urls.
elgg_format_element($tag_name, array $attributes=array(), $text='', array $options=array())
Format an HTML element.
if(! $vars['title'] && $vars['title'] !==false) if(isset($vars['filter_override'])) if(!isset($vars['filter']) &&elgg_is_logged_in() && $context) $filter
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
if(!array_key_exists($filename, $text_files)) $file
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
get_user($guid)
Get a user object from a GUID.