X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fwebcolor.php;h=bf791bf794e98438d4a14b3f3ff8b1cce373df23;hb=5167b1fa408aa486ad75c8ddd3c71cb568dc84a3;hp=f3ca6e94a8bfd4154cc1690339c2cdc1ba8f1443;hpb=bafa1ab1c532118e2230df50ed18a1b4573692b7;p=quix0rs-gnu-social.git diff --git a/lib/webcolor.php b/lib/webcolor.php index f3ca6e94a8..bf791bf794 100644 --- a/lib/webcolor.php +++ b/lib/webcolor.php @@ -1,6 +1,6 @@ . * * @category Personal - * @package Laconica - * @author Zach Copley - * @copyright 2009 Control Yourself, Inc. + * @package StatusNet + * @author Zach Copley + * @copyright 2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } 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