]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #4082 adds output/img
authorCash Costello <cash.costello@gmail.com>
Sun, 13 Nov 2011 21:22:57 +0000 (16:22 -0500)
committercash <cash.costello@gmail.com>
Thu, 17 Nov 2011 00:53:04 +0000 (19:53 -0500)
engine/lib/users.php
mod/bookmarks/views/default/bookmarks/bookmarklet.php
views/default/core/avatar/upload.php
views/default/forms/avatar/crop.php
views/default/icon/default.php
views/default/icon/user/default.php
views/default/output/img.php [new file with mode: 0644]

index 4072740f9be4ecd24a28bec4248e6adad1665337..9cb8ddfa72519a9dbbaaec82e9d1d720ae016d6a 100644 (file)
@@ -1476,14 +1476,15 @@ function users_pagesetup() {
 
        // topbar
        if ($viewer) {
-
-               $icon_url = $viewer->getIconURL('topbar');
-               $class = 'elgg-border-plain elgg-transition';
-               $title = elgg_echo('profile');
                elgg_register_menu_item('topbar', array(
                        'name' => 'profile',
                        'href' =>  $viewer->getURL(),
-                       'text' => "<img src=\"$icon_url\" alt=\"$viewer->name\" title=\"$title\" class=\"$class\" />",
+                       'text' => elgg_view('output/img', array(
+                               'src' => $viewer->getIconURL('topbar'),
+                               'alt' => $viewer->name,
+                               'title' => elgg_echo('profile'),
+                               'class' => 'elgg-border-plain elgg-transition',
+                       )),
                        'priority' => 100,
                        'link_class' => 'elgg-topbar-avatar',
                ));
index 1d0b25498c3fe437b18ddc27e0f892fce4980945..b3e9737feba86509bd09e4633a9ec524146dd983 100644 (file)
@@ -20,13 +20,16 @@ if (!$name && ($user = elgg_get_logged_in_user_entity())) {
 }
 
 $url = elgg_get_site_url();
-
+$img = elgg_view('output/img', array(
+       'src' => 'mod/bookmarks/graphics/bookmarklet.gif',
+       'alt' => $title,
+));
 $bookmarklet = "<a href=\"javascript:location.href='{$url}bookmarks/add/$guid?address='"
        . "+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)\">"
-       . "<img src=\"{$url}mod/bookmarks/graphics/bookmarklet.gif\" alt=\"$title\" /> </a>";
+       . $img . "</a>";
 
 ?>
 <p><?php echo elgg_echo("bookmarks:bookmarklet:description"); ?></p>
 <p><?php echo $bookmarklet; ?></p>
 <p><?php echo elgg_echo("bookmarks:bookmarklet:descriptionie"); ?></p>
-<p><?php echo elgg_echo("bookmarks:bookmarklet:description:conclusion"); ?></p>
\ No newline at end of file
+<p><?php echo elgg_echo("bookmarks:bookmarklet:description:conclusion"); ?></p>
index 11902cf4aa9f6dd564d5c3c6c2b87d5fedd0ba01..4aa86373a33ed53928caefd8554dd023492fb95f 100644 (file)
@@ -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;
 
index f622fd60fcd39371fe9eb85e087f3ac2108a5702..3e798cb27826879e76bb316416e7f88ad93fcf1a 100644 (file)
@@ -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
index ec39e59f26353ccbc1af72d62abd603a66357957..22c20b3a7ffa6450f418d52579fadf98dbbd96f2 100644 (file)
@@ -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(
index a208ec41add7c135c2604eff74af293cffbffeb2..c0b0e7483619e79b0b33ace52d84898d21004d8d 100644 (file)
@@ -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 (file)
index 0000000..d3f5968
--- /dev/null
@@ -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/>";