X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fwebcolor.php;h=bf791bf794e98438d4a14b3f3ff8b1cce373df23;hb=5167b1fa408aa486ad75c8ddd3c71cb568dc84a3;hp=6fa603fa2ac89286b47e2b00924808be40577f4f;hpb=9d87313eaebe8240393ac300a435f3b1332c8849;p=quix0rs-gnu-social.git diff --git a/lib/webcolor.php b/lib/webcolor.php index 6fa603fa2a..bf791bf794 100644 --- a/lib/webcolor.php +++ b/lib/webcolor.php @@ -32,7 +32,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { } class WebColor { - // XXX: Maybe make getters and setters for r,g,b values and tuples, // e.g.: to support this kinda CSS representation: rgb(255,0,0) // http://www.w3.org/TR/CSS21/syndata.html#color-units @@ -46,7 +45,6 @@ class WebColor { * * @return nothing */ - function __construct($color = null) { if (isset($color)) { @@ -65,7 +63,6 @@ class WebColor { * * @return nothing */ - function parseColor($color) { if (is_numeric($color)) { @@ -79,7 +76,9 @@ class WebColor { if (preg_match('/(#([0-9A-Fa-f]{3,6})\b)/u', $color) > 0) { $this->setHexColor($color); } else { - $errmsg = _('%s is not a valid color!'); + // TRANS: Web color exception thrown when a hexadecimal color code does not validate. + // TRANS: %s is the provided (invalid) color code. + $errmsg = _('%s is not a valid color! Use 3 or 6 hex characters.'); throw new WebColorException(sprintf($errmsg, $color)); } } @@ -90,13 +89,11 @@ class WebColor { * * @return nothing */ - function setNamedColor($name) { // XXX Implement this } - /** * Sets the RGB color values from a a hex tuple * @@ -104,7 +101,6 @@ class WebColor { * * @return nothing */ - function setHexColor($hexcolor) { if ($hexcolor[0] == '#') { @@ -120,7 +116,9 @@ class WebColor { $hexcolor[1].$hexcolor[1], $hexcolor[2].$hexcolor[2]); } else { - $errmsg = _('%s is not a valid color! Use 3 or 6 hex chars.'); + // TRANS: Web color exception thrown when a hexadecimal color code does not validate. + // TRANS: %s is the provided (invalid) color code. + $errmsg = _('%s is not a valid color! Use 3 or 6 hex characters.'); throw new WebColorException(sprintf($errmsg, $hexcolor)); } @@ -137,7 +135,6 @@ class WebColor { * * @return nothing */ - function setIntColor($intcolor) { // We could do 32 bit and have an alpha channel because @@ -154,7 +151,6 @@ class WebColor { * * @return string */ - function hexValue() { $hexcolor = (strlen(dechex($this->red)) < 2 ? '0' : '' ) . @@ -165,7 +161,6 @@ class WebColor { dechex($this->blue); return strtoupper($hexcolor); - } /** @@ -176,7 +171,6 @@ class WebColor { * * @return int */ - function intValue() { $intcolor = 256 * 256 * $this->red + 256 * $this->green + $this->blue; @@ -188,5 +182,3 @@ class WebColor { class WebColorException extends Exception { } - -?> \ No newline at end of file