localistation, chart view and added some functions
Dieser Commit ist enthalten in:
Ursprung
c658ad64fd
Commit
7a4793f2fa
2 geänderte Dateien mit 177 neuen und 73 gelöschten Zeilen
|
|
@ -415,5 +415,59 @@ function semr_i18np($sSingular, $sPlural, $iNumber, $sDomain = "semmelstatzR") {
|
|||
return _n($sSingular, $sPlural, $iNumber, $sDomain);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @author anyexample.com
|
||||
* @license http://www.anyexample.com/license/
|
||||
* @link http://www.anyexample.com/programming/php/php_convert_rgb_from_to_html_hex_color.xml
|
||||
*
|
||||
* @param string $color
|
||||
* @return array
|
||||
*/
|
||||
function semr_hex2rgb($color) {
|
||||
if ($color[0] == '#')
|
||||
$color = substr($color, 1);
|
||||
|
||||
if (strlen($color) == 6)
|
||||
list($r, $g, $b) = array($color[0].$color[1],
|
||||
$color[2].$color[3],
|
||||
$color[4].$color[5]);
|
||||
elseif (strlen($color) == 3)
|
||||
list($r, $g, $b) = array($color[0].$color[0], $color[1].$color[1], $color[2].$color[2]);
|
||||
else
|
||||
return false;
|
||||
|
||||
$r = hexdec($r); $g = hexdec($g); $b = hexdec($b);
|
||||
|
||||
return array($r, $g, $b);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @author anyexample.com
|
||||
* @license http://www.anyexample.com/license/
|
||||
* @link http://www.anyexample.com/programming/php/php_convert_rgb_from_to_html_hex_color.xml
|
||||
*
|
||||
* @param int $r
|
||||
* @param int $g
|
||||
* @param int $b
|
||||
* @return string
|
||||
*/
|
||||
function semr_rgb2hex($r, $g=-1, $b=-1) {
|
||||
if (is_array($r) && sizeof($r) == 3)
|
||||
list($r, $g, $b) = $r;
|
||||
|
||||
$r = intval($r); $g = intval($g);
|
||||
$b = intval($b);
|
||||
|
||||
$r = dechex($r<0?0:($r>255?255:$r));
|
||||
$g = dechex($g<0?0:($g>255?255:$g));
|
||||
$b = dechex($b<0?0:($b>255?255:$b));
|
||||
|
||||
$color = (strlen($r) < 2?'0':'').$r;
|
||||
$color .= (strlen($g) < 2?'0':'').$g;
|
||||
$color .= (strlen($b) < 2?'0':'').$b;
|
||||
return '#'.$color;
|
||||
}
|
||||
############################################## Ende SEMMELSTATZ-interne Funktionen
|
||||
?>
|
||||
Laden …
Tabelle hinzufügen
Einen Link hinzufügen
In neuem Issue referenzieren