aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to 'views')
-rw-r--r--views/default/core/avatar/upload.php7
-rw-r--r--views/default/forms/avatar/crop.php17
-rw-r--r--views/default/icon/default.php7
-rw-r--r--views/default/icon/user/default.php12
-rw-r--r--views/default/output/img.php12
5 files changed, 44 insertions, 11 deletions
diff --git a/views/default/core/avatar/upload.php b/views/default/core/avatar/upload.php
index 11902cf4a..4aa86373a 100644
--- a/views/default/core/avatar/upload.php
+++ b/views/default/core/avatar/upload.php
@@ -5,7 +5,10 @@
* @uses $vars['entity']
*/
-$user_avatar = $vars['entity']->getIconUrl('medium');
+$user_avatar = elgg_view('output/img', array(
+ 'src' => $vars['entity']->getIconUrl('medium'),
+ 'alt' => elgg_echo('avatar'),
+));
$current_label = elgg_echo('avatar:current');
@@ -23,7 +26,7 @@ $upload_form = elgg_view_form('avatar/upload', $form_params, $vars);
$image = <<<HTML
<div id="current-user-avatar" class="mrl prl">
<label>$current_label</label><br />
- <img src="$user_avatar" alt="avatar" />
+ $user_avatar
</div>
HTML;
diff --git a/views/default/forms/avatar/crop.php b/views/default/forms/avatar/crop.php
index f622fd60f..3e798cb27 100644
--- a/views/default/forms/avatar/crop.php
+++ b/views/default/forms/avatar/crop.php
@@ -9,14 +9,23 @@ elgg_load_js('jquery.imgareaselect');
elgg_load_js('elgg.avatar_cropper');
elgg_load_css('jquery.imgareaselect');
-$master_image = $vars['entity']->getIconUrl('master');
+$master_img = elgg_view('output/img', array(
+ 'src' => $vars['entity']->getIconUrl('master'),
+ 'alt' => elgg_echo('avatar'),
+ 'class' => 'mrl',
+ 'id' => 'user-avatar-cropper',
+));
+
+$preview_img = elgg_view('output/img', array(
+ 'src' => $vars['entity']->getIconUrl('master'),
+ 'alt' => elgg_echo('avatar'),
+));
?>
<div class="clearfix">
- <img id="user-avatar-cropper" class="mrl" src="<?php echo $master_image; ?>" alt="<?php echo elgg_echo('avatar'); ?>" />
+ <?php echo $master_img; ?>
<div id="user-avatar-preview-title"><label><?php echo elgg_echo('avatar:preview'); ?></label></div>
- <div id="user-avatar-preview"><img src="<?php echo $master_image; ?>" /></div>
-
+ <div id="user-avatar-preview"><?php echo $preview_img; ?></div>
</div>
<div class="elgg-foot">
<?php
diff --git a/views/default/icon/default.php b/views/default/icon/default.php
index ec39e59f2..22c20b3a7 100644
--- a/views/default/icon/default.php
+++ b/views/default/icon/default.php
@@ -34,8 +34,11 @@ if (isset($vars['href'])) {
$url = $vars['href'];
}
-$img_src = $entity->getIconURL($vars['size']);
-$img = "<img $class src=\"$img_src\" alt=\"$title\" />";
+$img = elgg_view('output/img', array(
+ 'src' => $entity->getIconURL($vars['size']),
+ 'alt' => $title,
+ 'class' => $class,
+));
if ($url) {
$params = array(
diff --git a/views/default/icon/user/default.php b/views/default/icon/user/default.php
index a208ec41a..c0b0e7483 100644
--- a/views/default/icon/user/default.php
+++ b/views/default/icon/user/default.php
@@ -47,7 +47,7 @@ if ($js) {
$img_class = '';
if (isset($vars['img_class'])) {
- $img_class = "class=\"{$vars['img_class']}\"";
+ $img_class = $vars['img_class'];
}
$use_hover = elgg_extract('use_hover', $vars, true);
@@ -62,8 +62,14 @@ if (isset($vars['hover'])) {
$spacer_url = elgg_get_site_url() . '_graphics/spacer.gif';
-$icon_url = $user->getIconURL($size);
-$icon = "<img src=\"$spacer_url\" alt=\"$name\" title=\"$name\" $img_class $js style=\"background: url($icon_url) no-repeat;\" />";
+$icon_url = elgg_format_url($user->getIconURL($size));
+$icon = elgg_view('output/img', array(
+ 'src' => $spacer_url,
+ 'alt' => $name,
+ 'title' => $name,
+ 'class' => $img_class,
+ 'style' => "background: url($icon_url) no-repeat;",
+));
$show_menu = $use_hover && (elgg_is_admin_logged_in() || !$user->isBanned());
diff --git a/views/default/output/img.php b/views/default/output/img.php
new file mode 100644
index 000000000..d3f596801
--- /dev/null
+++ b/views/default/output/img.php
@@ -0,0 +1,12 @@
+<?php
+/**
+ * Elgg image view
+ *
+ * @uses string $vars['src'] The image src url.
+ */
+
+$vars['src'] = elgg_normalize_url($vars['src']);
+$vars['src'] = elgg_format_url($vars['src']);
+
+$attributes = elgg_format_attributes($vars);
+echo "<img $attributes/>";