Permalink
Browse files

Merge pull request #361 from scnakandala/Bug_3919

Bug #3919 PropertiesIconic not honored fixed
  • Loading branch information...
2 parents 3f2c946 + 01c57f7 commit a1e711b919fb2f71500a4deafd0f5ce74282adb2 @nijel nijel committed May 13, 2013
Showing with 12 additions and 8 deletions.
  1. +9 −7 libraries/Util.class.php
  2. +3 −1 test/libraries/common/PMA_getIcon_test.php
View
16 libraries/Util.class.php
@@ -95,20 +95,23 @@ public static function pow($base, $exp, $use_function = false)
* @param string $icon name of icon file
* @param string $alternate alternate text
* @param boolean $force_text whether to force alternate text to be displayed
+ * @param boolean $menu_icon whether this icon is for the menu bar or not
*
* @return string an html snippet
*/
- public static function getIcon($icon, $alternate = '', $force_text = false)
- {
+ public static function getIcon($icon, $alternate = '', $force_text = false,
+ $menu_icon = false
+ ) {
// $cfg['PropertiesIconic'] is true or both
$include_icon = ($GLOBALS['cfg']['PropertiesIconic'] !== false);
// $cfg['PropertiesIconic'] is false or both
// OR we have no $include_icon
$include_text = ($force_text
|| ($GLOBALS['cfg']['PropertiesIconic'] !== true));
- // Always use a span (we rely on this in js/sql.js)
- $button = '<span class="nowrap">';
+ // Sometimes use a span (we rely on this in js/sql.js). But for menu bar
+ // we don't need a span
+ $button = $menu_icon ? '' : '<span class="nowrap">';
if ($include_icon) {
$button .= self::getImage($icon, $alternate);
}
@@ -118,7 +121,7 @@ public static function getIcon($icon, $alternate = '', $force_text = false)
if ($include_text) {
$button .= $alternate;
}
- $button .= '</span>';
+ $button .= $menu_icon ? '' : '</span>';
return $button;
}
@@ -1797,8 +1800,7 @@ public static function getHtmlTab($tab, $url_params = array())
// avoid generating an alt tag, because it only illustrates
// the text that follows and if browser does not display
// images, the text is duplicated
- $tab['text'] = self::getImage(htmlentities($tab['icon']))
- . $tab['text'];
+ $tab['text'] = self::getIcon($tab['icon'], $tab['text'], false, true);
} elseif (empty($tab['text'])) {
// check to not display an empty link-text
View
4 test/libraries/common/PMA_getIcon_test.php
@@ -57,10 +57,12 @@ function testGetIconWithForceText()
$GLOBALS['cfg']['PropertiesIconic'] = true;
$alternate_text = 'alt_str';
+ // Here we are checking for an icon embeded inside a span (i.e not a menu
+ // bar icon
$this->assertEquals(
'<span class="nowrap"><img src="themes/dot.gif" title="' . $alternate_text . '" alt="' . $alternate_text
. '" class="icon ic_b_comment" /> ' . $alternate_text . '</span>',
- PMA_Util::getIcon('b_comment.png', $alternate_text, true)
+ PMA_Util::getIcon('b_comment.png', $alternate_text, true, false)
);
}

0 comments on commit a1e711b

Please sign in to comment.