77 $CURRENT_SYSTEM_VIEWTYPE = $viewtype;
98 if (empty($CURRENT_SYSTEM_VIEWTYPE)) {
115 $viewtype =
get_input(
'view',
'',
false);
121 return $CONFIG->view;
135 $GLOBALS[
'_ELGG']->view_types = array();
138 if (!in_array($viewtype, $GLOBALS[
'_ELGG']->
view_types)) {
139 $GLOBALS[
'_ELGG']->view_types[] = $viewtype;
158 return in_array($viewtype, $GLOBALS[
'_ELGG']->
view_types);
172 if (!is_string($viewtype) || $viewtype ===
'') {
176 if (preg_match(
'/\W/', $viewtype)) {
425 return Minify_CSS_UriRewriter::prepend(
$css,
$path);
449 if (!$timer->hasEnded([
'build page'])) {
450 $timer->end([
'build page']);
452 $timer->begin([__FUNCTION__]);
457 array_shift(
$params[
'segments']);
464 if ($system_messages->count()) {
465 $messages = $system_messages->dumpRegister();
491 $vars[
'page_shell'] = $page_shell;
496 $timer->end([__FUNCTION__]);
511 $view =
"resources/$name";
551 $params[
'metas'][
'content-type'] = array(
552 'http-equiv' =>
'Content-Type',
553 'content' =>
'text/html; charset=utf-8',
556 $params[
'metas'][
'description'] = array(
557 'name' =>
'description',
562 $params[
'metas'][
'viewport'] = array(
563 'name' =>
'viewport',
564 'content' =>
'width=device-width',
566 $params[
'metas'][
'mobile-web-app-capable'] = array(
567 'name' =>
'mobile-web-app-capable',
570 $params[
'metas'][
'apple-mobile-web-app-capable'] = array(
571 'name' =>
'apple-mobile-web-app-capable',
578 if (substr_count(
$url,
'?')) {
583 $params[
'links'][
'rss'] = array(
584 'rel' =>
'alternative',
585 'type' =>
'application/rss+xml',
613 $head_params[
'links'][
'apple-touch-icon'] = array(
614 'rel' =>
'apple-touch-icon',
619 $head_params[
'links'][
'icon-ico'] = array(
623 $head_params[
'links'][
'icon-vector'] = array(
625 'sizes' =>
'16x16 32x32 48x48 64x64 128x128',
626 'type' =>
'image/svg+xml',
629 $head_params[
'links'][
'icon-16'] = array(
632 'type' =>
'image/png',
635 $head_params[
'links'][
'icon-32'] = array(
638 'type' =>
'image/png',
641 $head_params[
'links'][
'icon-64'] = array(
644 'type' =>
'image/png',
647 $head_params[
'links'][
'icon-128'] = array(
649 'sizes' =>
'128x128',
650 'type' =>
'image/png',
691 if (!$timer->hasEnded([
'build page'])) {
692 $timer->end([
'build page']);
694 $timer->begin([__FUNCTION__]);
699 array_shift(
$params[
'segments']);
702 $param_array =
$vars;
704 $param_array[
'layout'] = $layout_name;
716 $timer->end([__FUNCTION__]);
778 unset(
$vars[
'menu_view']);
780 if (is_string(
$menu)) {
788 throw new \InvalidArgumentException(
'$menu must be a menu name, a Menu, or UnpreparedMenu');
796 "navigation/menu/$name",
797 'navigation/menu/default',
800 foreach ($views as
$view) {
816 if (!isset(
$vars[
'class'])) {
817 $vars[
'class'] =
'elgg-menu-content';
830 if (preg_match(
'~<[a-z]~',
$text)) {
837 if (!isset(
$vars[
'rel']) && !isset(
$vars[
'is_trusted'])) {
838 $vars[
'is_trusted'] =
true;
876 if (!$entity || !($entity instanceof \
ElggEntity)) {
890 $entity_type = $entity->
getType();
892 if (empty($entity_subtype)) {
893 $entity_subtype =
'default';
896 $entity_views = array(
898 "$entity_type/$entity_subtype",
899 "$entity_type/default",
903 foreach ($entity_views as
$view) {
911 if (
$vars[
'full_view']) {
939 if (!$entity || !($entity instanceof \
ElggEntity)) {
946 $entity_type = $entity->
getType();
997 $name = $annotation->name;
1002 $annotation_views = array(
1005 "annotation/default",
1009 foreach ($annotation_views as
$view) {
1052 $list_type =
get_input(
'list_type',
'list');
1055 'items' => $entities,
1056 'list_class' =>
'elgg-list-entity',
1057 'full_view' =>
true,
1058 'pagination' =>
true,
1059 'list_type' => $list_type,
1060 'list_type_toggle' =>
false,
1069 $vars[
"pagination"] =
false;
1072 if (
$vars[
'list_type'] ==
'table') {
1074 } elseif (
$vars[
'list_type'] ==
'list') {
1104 'list_class' =>
'elgg-list-annotation elgg-annotation-list',
1105 'full_view' =>
true,
1106 'offset_key' =>
'annoff',
1113 $vars[
"pagination"] =
false;
1138 $entity_type = $entity->
getType();
1142 'entity' => $entity,
1177 $view =
'output/friendlytime';
1178 $vars = [
'time' => $time];
1203 $vars[
'show_add_form'] = $add_comment;
1270 $view = $item->getView();
1275 $subject = $item->getSubjectEntity();
1276 $object = $item->getObjectEntity();
1295 $river_views = array(
1301 foreach ($river_views as
$view) {
1393 unset(
$vars[
'label']);
1395 if (isset(
$vars[
'help'])) {
1397 unset(
$vars[
'help']);
1399 if (isset(
$vars[
'field_class'])) {
1401 unset(
$vars[
'field_class']);
1426 if (empty(
$params[
'#type'])) {
1427 _elgg_services()->logger->error(__FUNCTION__ .
'(): $params["#type"] is required.');
1436 $hidden_types = [
'hidden',
'securitytoken'];
1447 $id =
"elgg-field-" . base_convert(mt_rand(), 10, 36);
1457 $make_special_checkbox_label =
false;
1470 $make_special_checkbox_label =
true;
1476 if (
$key[0] !==
'#') {
1488 unset($element_vars[
'class']);
1489 if (isset(
$params[
'#class'])) {
1490 $element_vars[
'class'] =
$params[
'#class'];
1492 unset($element_vars[
'help']);
1493 if (isset(
$params[
'#help'])) {
1494 $element_vars[
'help'] =
$params[
'#help'];
1496 unset($element_vars[
'label']);
1497 if (isset(
$params[
'#label'])) {
1498 $element_vars[
'label'] =
$params[
'#label'];
1502 $element_vars[
'label'] =
elgg_view(
'elements/forms/label', $element_vars);
1503 $element_vars[
'help'] =
elgg_view(
'elements/forms/help', $element_vars);
1505 if ($make_special_checkbox_label) {
1508 unset($element_vars[
'label']);
1512 return elgg_view(
'elements/forms/field', $element_vars);
1540 return elgg_view(
"output/tagcloud", array(
1541 'value' => $tag_data,
1587 if (
$vars ===
true) {
1589 $vars = array(
'class' =>
'float');
1592 if (is_string(
$vars)) {
1596 if (!is_array(
$vars)) {
1597 throw new \InvalidArgumentException(
'$vars needs to be a string or an array');
1600 if (!array_key_exists(
'class',
$vars)) {
1601 $vars[
'class'] = array();
1604 if (!is_array(
$vars[
'class'])) {
1608 $vars[
'class'][] =
"elgg-icon-$name";
1638 if (isset($GLOBALS[
'autofeed']) && is_bool($GLOBALS[
'autofeed'])) {
1640 return $GLOBALS[
'autofeed'];
1642 return (
bool)
_elgg_services()->config->getVolatile(
'_elgg_autofeed');
1658 $entities =
$user->getFriends(array(
'limit' => 0));
1660 $entities = array();
1665 $collections[
$key]->entities = $entities;
1669 return elgg_view(
'core/friends/collections', array(
'collections' => $collections));
1690 return _elgg_services()->views->autoregisterViews($view_base, $folder, $viewtype);
1705 if (preg_match(
'~[\.-]min\.~',
$params[
'view'])) {
1710 if (
$type ==
'js') {
1714 } elseif (
$type ==
'css') {
1716 $cssmin =
new CSSmin();
1735 $filter = new \Elgg\Amd\ViewFilter();
1748 if (substr_count(
$url,
'?')) {
1749 $url .=
"&view=rss";
1751 $url .=
"?view=rss";
1770 header(
'X-Frame-Options: SAMEORIGIN');
1803 if ($views->viewIsExtended(
$view) || $views->viewHasHookHandlers(
$view)) {
1810 if (0 === strpos(
$path,
'/') || preg_match(
'~^([A-Za-z]\:)?\\\\~',
$path)) {
1812 $expected_path =
$path;
1815 $root = dirname(dirname(__DIR__));
1816 $expected_path =
"$root/views/$viewtype/" . ltrim(
$path,
'/\\');
1819 $view_path = $views->findViewFile(
$view, $viewtype);
1821 return realpath($view_path) !== realpath($expected_path);
1837 _elgg_services()->views->registerPluginViews(realpath(__DIR__ .
'/../../'));
1840 $file = dirname(__DIR__) .
'/views.php';
1841 if (is_file(
$file)) {
1842 $spec = Includer::includeFile(
$file);
1843 if (is_array($spec)) {
1885 'deps' => [
'jquery-ui'],
1912 $viewtype_dirs = scandir($view_path);
1913 foreach ($viewtype_dirs as $viewtype) {
1920 if (!isset($CONFIG->icon_sizes)) {
1922 'topbar' => array(
'w' => 16,
'h' => 16,
'square' =>
true,
'upscale' =>
true),
1923 'tiny' => array(
'w' => 25,
'h' => 25,
'square' =>
true,
'upscale' =>
true),
1924 'small' => array(
'w' => 40,
'h' => 40,
'square' =>
true,
'upscale' =>
true),
1925 'medium' => array(
'w' => 100,
'h' => 100,
'square' =>
true,
'upscale' =>
true),
1926 'large' => array(
'w' => 200,
'h' => 200,
'square' =>
false,
'upscale' =>
false),
1927 'master' => array(
'w' => 550,
'h' => 550,
'square' =>
false,
'upscale' =>
false),
1960 static $allow_delay_pagesetup =
true;
1962 if (isset($GLOBALS[
'_ELGG']->pagesetupdone) || empty($CONFIG->boot_complete)) {
1967 $allow_delay = $allow_delay_pagesetup;
1968 $allow_delay_pagesetup =
false;
1970 if ($allow_delay && (0 === strpos(
$view,
'resources/'))) {
1974 $GLOBALS[
'_ELGG']->pagesetupdone =
true;
1977 _elgg_services()->hooks->unregisterHandler(
'view_vars',
'all',
'_elgg_manage_pagesetup');
2003 'elgg.security.interval' => (int)
_elgg_services()->actions->getActionTokenTimeout() * 333,
2016 if (!is_array(
$data)) {
2017 elgg_log(
'"elgg.data" plugin hook handlers must return an array. Returned ' . gettype(
$data) .
'.',
'ERROR');
2027 'security' => array(
2037 '_data' => (
object)
$data,
2041 $elgg[
'config'][
'load_sync_code'] =
true;
2051 $user_object =
$user->toObject();
2052 $user_object->admin =
$user->isAdmin();
2053 $elgg[
'session'][
'user'] = $user_object;
2086 $events->registerHandler(
'boot',
'system',
'elgg_views_boot');
2087 $hooks->registerHandler(
'view_vars',
'all',
'_elgg_manage_pagesetup', 1000);
_elgg_get_initial_viewtype()
Get the initial viewtype.
_elgg_views_amd($hook, $type, $content, $params)
Inserts module names into anonymous modules by handling the "simplecache:generate" hook...
elgg_view_exists($view, $viewtype= '', $recurse=true)
Returns whether the specified view exists.
$object
These two snippets demonstrates triggering an event and how to register for that event.
elgg_views_boot()
Initialize viewtypes on system boot event This ensures simplecache is cleared during upgrades...
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
elgg_view_icon($name, $vars=array())
View one of the icons.
getSubtype()
Get the entity subtype.
elgg_get_view_extensions($view)
Get the views (and priorities) that extend a view.
elgg_unregister_ajax_view($view)
Unregister a view for ajax calls.
if(!array_key_exists($filename, $text_files)) $file
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
_elgg_views_prepare_head($title)
Prepare the variables for the html head.
global $CURRENT_SYSTEM_VIEWTYPE
The viewtype override.
$annotation
Elgg default annotation view.
elgg_view_access_collections($owner_guid)
Displays a user's access collections, using the core/friends/collections view.
elgg_view_annotation(\ElggAnnotation $annotation, array $vars=array(), $bypass=false, $debug=false)
Returns a string of a rendered annotation.
elgg_view_entity_annotations(\ElggEntity $entity, $full_view=true)
Display a plugin-specified rendered list of annotations for an entity.
if($guid==elgg_get_logged_in_user_guid()) $name
elgg_define_js($name, $config)
Defines a JS lib as an AMD module.
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
elgg_view_form($action, $form_vars=array(), $body_vars=array())
elgg_view_resource($name, array $vars=[])
Render a resource view.
autoregister_views($view_base, $folder, $ignored, $viewtype)
Auto-registers views from a location.
elgg_register_simplecache_view($view_name)
Registers a view to simple cache.
elgg_does_viewtype_fallback($viewtype)
Checks if a viewtype falls back to default.
elgg_get_simplecache_url($view, $subview= '')
Get the URL for the cached view.
elgg_views_add_rss_link()
Add the RSS link to the extras when if needed.
_elgg_view_may_be_altered($view, $path)
Is there a chance a plugin is altering this view?
elgg_register_css($name, $url, $priority=null)
Register a CSS file for inclusion in the HTML head.
elgg_view_layout($layout_name, $vars=array())
Displays a layout with optional parameters.
elgg_is_registered_viewtype($viewtype)
Checks if $viewtype is registered.
_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 forward
Meant to mimic the php forward() function by simply redirecting the user to another page...
elgg_list_views($viewtype= 'default')
List all views in a viewtype.
elgg_register_plugin_hook_handler($hook, $type, $callback, $priority=500)
elgg_view_deprecated($view, array $vars, $suggestion, $version)
Display a view with a deprecation notice.
elgg_register_viewtype_fallback($viewtype)
Register a viewtype to fall back to a default view if a view isn't found for that viewtype...
get_members_of_access_collection($collection_id, $guids_only=false)
Get all of members of an access collection.
elgg_view_river_item($item, array $vars=array())
Renders a human-readable representation of a river item.
_elgg_get_js_site_data()
Get the site data to be merged into "elgg" in elgg.js.
elgg_view_tagcloud(array $options=array())
Create a tagcloud for viewing.
elgg_set_form_footer($footer= '')
Sets form footer and defers its rendering until the form view and extensions have been rendered...
elgg_format_element($tag_name, array $attributes=array(), $text= '', array $options=array())
Format an HTML element.
elgg_get_viewtype()
Return the current view type.
elgg_register_external_view($view, $cacheable=false)
Registers a view as being available externally (i.e.
_elgg_has_rss_link()
Should the RSS view of this URL be linked to?
$_ELGG view_types
A list of valid view types as discovered.
elgg_view_input($input_type, array $vars=array())
Renders a form field.
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_get_js_page_data()
Get the initial contents of "elgg" client side.
elgg_view_image_block($image, $body, $vars=array())
Wrapper function for the image block display pattern.
elgg_load_css($name)
Load a CSS file for this page.
elgg_view_list_item($item, array $vars=array())
View an item in a list.
elgg_register_js($name, $url, $location= 'head', $priority=null)
Register a JavaScript file for inclusion.
generate_action_token($timestamp)
Generate an action token.
elgg_view_comments($entity, $add_comment=true, array $vars=array())
Returns rendered comments and a comment form for an entity.
_elgg_views_send_header_x_frame_options()
Sends X-Frame-Options header on page requests.
elgg_set_view_location($view, $location, $viewtype= '')
Set an alternative base location for a view.
get_user($guid)
Get a user object from a GUID.
elgg_view_entity(\ElggEntity $entity, array $vars=array(), $bypass=false, $debug=false)
Returns a string of a rendered entity.
elgg_set_config($name, $value)
Set an Elgg configuration value.
if(!$vars['title']&&$vars['title']!==false) if(isset($vars['filter_override'])) if(!isset($vars['filter'])&&elgg_is_logged_in()&&$context) $filter
elgg_set_viewtype($viewtype="")
Manually set the viewtype.
_elgg_views_prepare_favicon_links($hook, $type, $head_params, $params)
Add favicon link tags to HTML head.
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
elgg global
Pointer to the global context.
elgg_get_site_url($site_guid=0)
Get the URL for the current (or specified) site.
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
clearfix elgg elgg elgg elgg page header
elgg_register_ajax_view($view)
Register a view to be available for ajax calls.
elgg_view_menu_item(\ElggMenuItem $item, array $vars=array())
Render a menu item (usually as a link)
elgg_extend_view($view, $view_extension, $priority=501)
Extends a view with another view.
_elgg_services(\Elgg\Di\ServiceProvider $services=null)
Get the global service provider.
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
elgg_view_module($type, $title, $body, array $vars=array())
Wrapper function for the module display pattern.
elgg_log($message, $level= 'NOTICE')
Display or log a message.
elgg_view_entity_list($entities, array $vars=array())
Returns a rendered list of entities with pagination.
elgg_view_menu($menu, array $vars=array())
Render a menu.
elgg_register_menu_item($menu_name, $menu_item)
Register an item for an Elgg menu.
elgg_get_version($human_readable=false)
Get the current Elgg version information.
_elgg_views_minify($hook, $type, $content, $params)
Minifies simplecache CSS and JS views by handling the "simplecache:generate" hook.
elgg register_error
Wrapper function for system_messages.
elgg_is_simplecache_enabled()
Is simple cache enabled.
$label
Elgg profile plugin edit default profile action.
elgg_load_js($name)
Load a JavaScript resource on this page.
getType()
Returns the entity type.
$content
Set robots.txt action.
_elgg_manage_pagesetup($hook, $view, $value, $params)
Handle triggering the pagesetup event at the right time.
elgg_format_url($url)
Handles formatting of ampersands in urls.
elgg_view_entity_icon(\ElggEntity $entity, $size= 'medium', $vars=array())
View the icon of an entity.
elgg_register_viewtype($viewtype)
Register a viewtype.
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
elgg_unregister_external_view($view)
Unregister a view for ajax calls.
elgg_unregister_rss_link()
Remove the RSS icon link and link element from the head.
_elgg_view_under_viewtype($view, $vars, $viewtype)
Render a view while the global viewtype is temporarily changed.
if(!$collection_name) $id
elgg_view_annotation_list($annotations, array $vars=array())
Returns a rendered list of annotations, plus pagination.
http free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
elgg_view_friendly_time($time)
Displays a UNIX timestamp in a friendly way.
elgg_view_title($title, array $vars=array())
Renders a title.
elgg_get_form_footer()
Returns currently set footer, or false if not in the form rendering stack.
elgg_view_page($title, $body, $page_shell= 'default', $vars=array())
Assembles and outputs a full page.
elgg_register_rss_link()
Include the RSS icon link and link element in the head.
elgg_unextend_view($view, $view_extension)
Unextends a view.