Revision history for ColorAction


Revision [23093]

Last edited on 2016-05-20 07:38:45 by NilsLindenberg [Replaces old-style internal links with new pipe-split links.]
Additions:
[[Docs:ColorActionInfo | Documentation page]]
Deletions:
[[Docs:ColorActionInfo Documentation page]]


Revision [18807]

Edited on 2008-01-28 00:12:51 by NilsLindenberg [Modified links pointing to docs server]
Additions:
[[Docs:ColorActionInfo Documentation page]]
Deletions:
[[ColorActionInfo Documentation page]]


Revision [13639]

Edited on 2006-03-28 04:42:29 by NilsLindenberg [update]
Additions:
''Update 28/03/2006: Regexp for hex-values works now. Error-messages wraped in class.''
* @version 1.3
$hex_color_regexp = '/^\#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/';
$text = '<em class="error">'.ERROR_NO_TEXT_GIVEN.'</em>';
else $output = $text.' <em class="error">'.ERROR_NO_COLOR_SPECIFIED.'</em>';
Deletions:
* @version 1.2
$hex_color_regexp = '/^\#[0-9A-Fa-f]{3|6}$/';
$text = ERROR_NO_TEXT_GIVEN;
else $output = $text.' '.ERROR_NO_COLOR_SPECIFIED;


Revision [13625]

Edited on 2006-03-27 10:29:36 by NilsLindenberg [small update]
Additions:
* @version 1.2
* @input string $c mandatory: (html)name or hex-value of the color for the text;
* @input string $hex optional: (html)name or hex-value of the color for the text,
* keept for backwards-compatibility;
$hex_color_regexp = '/^\#[0-9A-Fa-f]{3|6}$/';
Deletions:
* @input string $c/ $hex mandatory: (html)name or hex-value of the color for the text;
$hex_color_regexp = '/^\#[0-9A-F]{3|6}$/';


Revision [13623]

Edited on 2006-03-27 08:18:00 by NilsLindenberg [+ sentence for background-color]
Additions:
* (with the former one takinge precedency). Same for the background-color.
Deletions:
* (with the former one takinge precedency).


Revision [13622]

Edited on 2006-03-27 08:10:03 by NilsLindenberg [new version]
Additions:
''Update 27/03/2006: new version which (hopefully) addresses the issues raised by jw in the comments. Please test.''
* You can specifiy either one of htmls defined names or hex-values
* (with the former one takinge precedency).
*
* @package Actions
* @name Color
*
* @author ?, probably Hendrik Mans
* @author {@link http://www.wikkawiki.org/NilsLindenberg NilsLindenberg} (modifications)
* @since ?
*
* @input string $text mandatory: the text which should be colored.
* @input string $c/ $hex mandatory: (html)name or hex-value of the color for the text;
* @input string $bg optional: (html)name or hex-value for the backgroundcolor;
* @output colored text
* @todo make it part of the formatter instead of using an action
// *** Constant section ***
define('ERROR_NO_TEXT_GIVEN','There is no text to highlight!');
define('ERROR_NO_COLOR_SPECIFIED', 'Sorry, but you did not specify a color for highlighting!');
$hex_color_regexp = '/^\#[0-9A-F]{3|6}$/';
// initialization
$text = ERROR_NO_TEXT_GIVEN;
$style = $colorcode = $backgroundcolor = $output = '';
// *** User input section ***
{
case 'text':
$text = $this->htmlspecialchars_ent($value);
case 'c':
case 'hex':
case 'bg':
}
}
// *** prepare the output ***
if ($colorcode !== '') $style .= 'color:'.$colorcode.';';
if ($backgroundcolor !== '') $style .= 'background-color:'.$backgroundcolor.';';
if ($style !== '') $output .= '<span style="'.$style.'">'.$text.'</span>';
else $output = $text.' '.ERROR_NO_COLOR_SPECIFIED;
// *** Output section ***
print ($output);
Deletions:
* @package Actions
* @name Color
* @author ?, probably Hendrik Mans
* @author {@link http://wikka.jsnx.com/NilsLindenberg NilsLindenberg} (modifications)
* @input string $c/$color/$colour (mandatory): (html)name of the color for the text;
* @input string $h/$hex (mandatory): color for the text as a hex-value;
* @input string $b/$bg (mandatory): (html)name or hex-value for the backgroundcolor;
* @output colored text
* @todo integrate it into the formatter
$hex_color_regexp = '/^\#[0-9A-F]{6}$/';
{
case 'text':
$mytext = $this->htmlspecialchars_ent($value);
case 'c':
case 'color':
case 'colour':
case 'h':
case 'hex':
case 'b':
case 'bg':
}
$style = '';
if (isset($colorcode)) $style .= 'color:'.$colorcode.';';
if (isset($backgroundcolor)) $style .= 'background-color:'.$backgroundcolor.';';
if (isset($mytext) && ($style !== '')) echo '<span style="'.$style.'">'.$mytext.'</span>';
}


Revision [12050]

The oldest known version of this page was created on 2005-11-29 13:56:24 by NilsLindenberg [new version]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki