Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
view.php
Go to the documentation of this file.
1 <?php
2 
8 elgg_deprecated_notice("/avatar/view resource view has been deprecated and will be removed. Use elgg_get_inline_url() instead.", '2.2');
9 
10 // page owner library sets this based on URL
12 
13 // Get the size
14 $size = strtolower(elgg_extract('size', $vars));
15 if (!in_array($size, array('master', 'large', 'medium', 'small', 'tiny', 'topbar'))) {
16  $size = 'medium';
17 }
18 
19 $avatar_url = false;
20 
21 if ($user) {
22  $filehandler = new ElggFile();
23  $filehandler->owner_guid = $user->guid;
24  $filehandler->setFilename("profile/{$user->guid}{$size}.jpg");
25  $avatar_url = elgg_get_inline_url($filehandler);
26 }
27 
28 if (!$avatar_url) {
29  $avatar_url = elgg_get_simplecache_url("icons/user/default{$size}.gif");
30 }
31 
$size
Definition: view.php:14
if(!in_array($size, array('master', 'large', 'medium', 'small', 'tiny', 'topbar'))) $avatar_url
Definition: view.php:19
elgg_get_simplecache_url($view, $subview= '')
Get the URL for the cached view.
Definition: cache.php:136
$vars['entity']
elgg_get_inline_url(\ElggFile $file, $use_cookie=false, $expires= '')
Returns file's URL for inline display Suitable for displaying cacheable resources, such as user avatars.
Definition: filestore.php:613
$user
Definition: view.php:11
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
Definition: elgglib.php:1070
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
Definition: pageowner.php:56
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1310
forward($location="", $reason= 'system')
Forward to $location.
Definition: elgglib.php:93