<?php
/**
- * Laconica, the distributed open-source microblogging tool
+ * StatusNet, the distributed open-source microblogging tool
*
* Base class for deleting things
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Personal
- * @package Laconica
- * @author Zach Copley <zach@controlyourself.ca>
- * @copyright 2009 Control Yourself, Inc.
+ * @package StatusNet
+ * @author Zach Copley <zach@status.net>
+ * @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
*
* @return nothing
*/
-
function __construct($color = null)
{
if (isset($color)) {
*
* @return nothing
*/
-
function parseColor($color) {
if (is_numeric($color)) {
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));
}
}
*
* @return nothing
*/
-
function setNamedColor($name)
{
// XXX Implement this
}
-
/**
* Sets the RGB color values from a a hex tuple
*
*
* @return nothing
*/
-
function setHexColor($hexcolor) {
if ($hexcolor[0] == '#') {
$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));
}
*
* @return nothing
*/
-
function setIntColor($intcolor)
{
// We could do 32 bit and have an alpha channel because
*
* @return string
*/
-
function hexValue() {
$hexcolor = (strlen(dechex($this->red)) < 2 ? '0' : '' ) .
dechex($this->blue);
return strtoupper($hexcolor);
-
}
/**
*
* @return int
*/
-
function intValue()
{
$intcolor = 256 * 256 * $this->red + 256 * $this->green + $this->blue;
class WebColorException extends Exception
{
}
-
-?>
\ No newline at end of file