diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6f00709e960..fd276cd11c0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7971,7 +7971,7 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = ' $TCompiledAttr[] = $key.'="'.$value.'"'; } - $compiledAttributes = !empty($TCompiledAttr)?implode(' ',$TCompiledAttr):''; + $compiledAttributes = !empty($TCompiledAttr)?implode(' ', $TCompiledAttr):''; $tag = !empty($url)?'a':'span'; @@ -8043,14 +8043,12 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st else{ // $displayMode >= 6 $return = $htmlLabel .' '. $htmlImg; } - } // Use new badge elseif(!empty($conf->global->MAIN_STATUS_USES_CSS) && !empty($displayMode)){ $statusLabelShort = !empty($statusLabelShort)?$statusLabelShort:$statusLabel; - if($displayMode == 3){ $return = dolGetBadge($statusLabel, '', $statusType, 'dot'); } @@ -8060,7 +8058,6 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st else{ $return = dolGetBadge($statusLabel, $html, $statusType); } - } return $return; @@ -8128,7 +8125,7 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = $TCompiledAttr[] = $key.'="'.$value.'"'; } - $compiledAttributes = !empty($TCompiledAttr)?implode(' ',$TCompiledAttr):''; + $compiledAttributes = !empty($TCompiledAttr)?implode(' ', $TCompiledAttr):''; $tag = !empty($attr['href'])?'a':'span'; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 9ab2b2c1aca..785481e310a 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2200,11 +2200,11 @@ function colorStringToArray($stringcolor, $colorifnotfound = array(88,88,88)) } /** - * @param string $color - * @param boolean $allow_white + * @param string $color the color you need to valid + * @param boolean $allow_white in case of white isn't valid * @return boolean */ -function colorValidateHex($color, $allow_white = false) +function colorValidateHex($color, $allow_white = true) { if(!$allow_white && ($color === '#fff' || $color === '#ffffff') ) return false; @@ -2218,8 +2218,8 @@ function colorValidateHex($color, $allow_white = false) /** - * @param string $hex - * @param integer $steps + * @param string $hex color in hex + * @param integer $steps Steps should be between -255 and 255. Negative = darker, positive = lighter * @return string */ function colorAdjustBrightness($hex, $steps) @@ -2230,7 +2230,7 @@ function colorAdjustBrightness($hex, $steps) // Normalize into a six character long hex string $hex = str_replace('#', '', $hex); if (strlen($hex) == 3) { - $hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2); + $hex = str_repeat(substr($hex, 0, 1), 2).str_repeat(substr($hex, 1, 1), 2).str_repeat(substr($hex, 2, 1), 2); } // Split into three parts: R, G and B @@ -2239,7 +2239,7 @@ function colorAdjustBrightness($hex, $steps) foreach ($color_parts as $color) { $color = hexdec($color); // Convert to decimal - $color = max(0,min(255,$color + $steps)); // Adjust color + $color = max(0, min(255, $color + $steps)); // Adjust color $return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code } @@ -2247,7 +2247,7 @@ function colorAdjustBrightness($hex, $steps) } /** - * @param string $hex + * @param string $hex color in hex * @param integer $percent 0 to 100 * @return string */ @@ -2258,7 +2258,7 @@ function colorDarker($hex, $percent) } /** - * @param string $hex + * @param string $hex color in hex * @param integer $percent 0 to 100 * @return string */ @@ -2270,9 +2270,9 @@ function colorLighten($hex, $percent) /** - * @param string $hex + * @param string $hex color in hex * @param float $alpha 0 to 1 - * @param bool $returnArray : + * @param bool $returnArray * @return string */ function colorHexToRgb($hex, $alpha = false, $returnArray = false) @@ -2286,10 +2286,10 @@ function colorHexToRgb($hex, $alpha = false, $returnArray = false) $rgb['b'] = hexdec($length == 6 ? substr($hex, 4, 2) : ($length == 3 ? str_repeat(substr($hex, 2, 1), 2) : 0)); if ( $alpha !== false ) { $rgb['a'] = floatval($alpha); - $string = 'rgba('.implode(',', $rgb ).')'; + $string = 'rgba('.implode(',', $rgb).')'; } else{ - $string = 'rgb('.implode(',', $rgb ).')'; + $string = 'rgb('.implode(',', $rgb).')'; } if($returnArray){ diff --git a/htdocs/theme/eldy/doc/badges.php b/htdocs/theme/eldy/doc/badges.php index 8057ce7ffae..97cc8edb461 100644 --- a/htdocs/theme/eldy/doc/badges.php +++ b/htdocs/theme/eldy/doc/badges.php @@ -1,4 +1,4 @@ -Use status helper function
Using the dolGetStatus function provide in core/lib/functions.lib.php. This function is recommended for code uniformisation and easy maintain
- global->MAIN_STATUS_USES_CSS; $conf->global->MAIN_STATUS_USES_CSS = 1; ?>with html', 'status4') ?>
-with html', 'status4',1) ?>
-with html', 'status4',2) ?>
-with html', 'status4',3) ?>
-with html', 'status4',4) ?>
-with html', 'status4',5) ?>
-with html', 'status4',6) ?>
+with html', 'status4', 1) ?>
+with html', 'status4', 2) ?>
+with html', 'status4', 3) ?>
+with html', 'status4', 4) ?>
+with html', 'status4', 5) ?>
+with html', 'status4', 6) ?>
global->MAIN_STATUS_USES_CSS = 0; ?>with html', 'status4',1) ?>
-with html', 'status4',2) ?>
-with html', 'status4',3) ?>
-with html', 'status4',4) ?>
-with html', 'status4',5) ?>
-with html', 'status4',6) ?>
+with html', 'status4', 1) ?>
+with html', 'status4', 2) ?>
+with html', 'status4', 3) ?>
+with html', 'status4', 4) ?>
+with html', 'status4', 5) ?>
+with html', 'status4', 6) ?>
global->MAIN_STATUS_USES_CSS = $saveGlobalConf; ?> diff --git a/htdocs/theme/eldy/theme_vars.php b/htdocs/theme/eldy/theme_vars.php index 0844c92177d..c03f6b28027 100644 --- a/htdocs/theme/eldy/theme_vars.php +++ b/htdocs/theme/eldy/theme_vars.php @@ -76,5 +76,3 @@ $badgeStatus6='#cad2d2'; $badgeStatus7='#baa32b'; $badgeStatus8='#be3013'; $badgeStatus9='#e7f0f0'; - -