Erebot  latest
A modular IRC bot for PHP 5.3+
Erebot\StylingInterface Interface Reference

Interface for styling (formatting) capabilities. More...

+ Inheritance diagram for Erebot\StylingInterface:

Public Member Functions

 _ ($template, array $vars=array())
 
 __construct (\Erebot\IntlInterface $translator)
 
 getTranslator ()
 
 render ($template, array $vars=array())
 

Public Attributes

const CODE_BOLD = "\002"
 Mark the following text as being bold.
 
const CODE_COLOR = "\003"
 Change the color of the following text.
 
const CODE_RESET = "\017"
 Reset the styles.
 
const CODE_REVERSE = "\026"
 Swao the foreground & background colors.
 
const CODE_UNDERLINE = "\037"
 Underline the text that follows.
 
const COLOR_AQUA_LIGHT = 11
 Alias for Erebot::StylingInterface::COLOR_LIGHT_CYAN.
 
const COLOR_BLACK = 1
 Black.
 
const COLOR_BLUE = 2
 Blue.
 
const COLOR_BROWN = 5
 Brown.
 
const COLOR_CYAN = 10
 Cyan.
 
const COLOR_DARK_BLUE = 2
 Alias for Erebot::StylingInterface::COLOR_DARK_BLUE.
 
const COLOR_DARK_CYAN = 10
 Alias for Erebot::StylingInterface::COLOR_CYAN.
 
const COLOR_DARK_GRAY = 14
 Alias for Erebot::StylingInterface::COLOR_GRAY.
 
const COLOR_DARK_GREEN = 3
 Alias for Erebot::StylingInterface::COLOR_DARK_GREEN.
 
const COLOR_DARK_GREY = 14
 Alias for Erebot::StylingInterface::COLOR_GRAY.
 
const COLOR_GRAY = 14
 Gray.
 
const COLOR_GREEN = 3
 Green.
 
const COLOR_GREY = 14
 Alias for Erebot::StylingInterface::COLOR_GRAY.
 
const COLOR_HOT_PINK = 13
 Alias for Erebot::StylingInterface::COLOR_HOT_PINK.
 
const COLOR_LIGHT_BLUE = 12
 Light blue.
 
const COLOR_LIGHT_CYAN = 11
 Light cyan.
 
const COLOR_LIGHT_GRAY = 15
 Light gray.
 
const COLOR_LIGHT_GREEN = 9
 Light green.
 
const COLOR_LIGHT_GREY = 15
 Alias for Erebot::StylingInterface::COLOR_LIGHT_GRAY.
 
const COLOR_LIME_GREEN = 9
 Alias for Erebot::StylingInterface::COLOR_LIGHT_GREEN.
 
const COLOR_NAVY_BLUE = 2
 Alias for Erebot::StylingInterface::COLOR_NAVY_BLUE.
 
const COLOR_OLIVE = 7
 Alias for Erebot::StylingInterface::COLOR_ORANGE.
 
const COLOR_ORANGE = 7
 Orange.
 
const COLOR_PINK = 13
 Pink.
 
const COLOR_PURPLE = 6
 Purple.
 
const COLOR_RED = 4
 Red.
 
const COLOR_ROYAL_BLUE = 12
 Alias for Erebot::StylingInterface::COLOR_LIGHT_BLUE.
 
const COLOR_TEAL = 10
 Alias for Erebot::StylingInterface::COLOR_CYAN.
 
const COLOR_WHITE = 0
 White.
 
const COLOR_YELLOW = 8
 Yellow.
 

Detailed Description

Interface for styling (formatting) capabilities.

This interface provides constants to format messages before they can be sent. It also provides a method to render templates easily.

Definition at line 31 of file StylingInterface.php.

Constructor & Destructor Documentation

Erebot\StylingInterface::__construct ( \Erebot\IntlInterface  $translator)

Constructs a new renderer.

Parameters
Erebot::IntlInterface$translatorA translator that can be used to improve the rendering process.

Implemented in Erebot\Styling.

Member Function Documentation

Erebot\StylingInterface::_ (   $template,
array  $vars = array() 
)

Alias for Erebot::StylingInterface::render(), compatible with internationalization tools such as xgettext.

Parameters
string$templateA template to render.
array$vars(optional) An array of variables that can be used to change the way the template will be rendered.
Return values
stringThe formatted result for this template.
Note
The name of this method was chosen so that tools such as xgettext can mark the template as being some message to translate. If you DO NOT want this behaviour, use Erebot::StylingInterface::render() instead.

Implemented in Erebot\Styling.

Erebot\StylingInterface::getTranslator ( )

Returns the translator associated with this formatter.

Return values
Erebot::IntlInterfaceTranslator associated with this formatter.

Implemented in Erebot\Styling.

Erebot\StylingInterface::render (   $template,
array  $vars = array() 
)

Renders a template using the given variables.

Parameters
string$templateA template to render.
array$vars(optional) An array of variables that can be used to change the way the template will be rendered.
Return values
stringThe formatted result for this template.
Note
Erebot::StylingInterface::_() is preferred as it makes external tools such as xgettext add the template to the list of messages to translate.

Implemented in Erebot\Styling.


The documentation for this interface was generated from the following file: