## GeSHi

Description

The GeSHi class

This class provides the public interface. The actual highligting is offloaded to elsewhere.

- todo: [blocking 1.1.9] Better documentation for this class
- since: 1.0.0
- version: $Revision: 1.65 $
- author: Nigel McNie <nigel@geshi.org>

Located in /class.geshi.php (line 170)

Method Summary
static string getHumanLanguageName (string $language)
static string getHumanThemeName (string $theme)
static array getSupportedThemes ([bool $return_human = false])
static string getVersion ()
static array languagesSupportedBy (string $theme)
static array themesSupportedBy (string $language, [boolean $return_human = false])
static boolean themeSupportsLanguage (string $theme, string $language)
GeSHi GeSHi (mixed $source, mixed $language_name, [mixed $path = ''])
false error ()
void getSupportedLanguages ([ $return_human = false])
mixed getTime ([mixed $type = 'total'])
string parseCode ()
void setLanguage (mixed $language_name)
void setSource (mixed $source)
void setStyles (mixed $selector, mixed $styles)
void setTheme (mixed $themes)
void set_language (mixed $language_name)
void set_source (mixed $source)
Methods
static getHumanLanguageName (line 556)

Given a language name, return a human version of it

- return: The human language name, or `false` if the language does not exist
- since: 1.1.2
- todo: actually implement this function

string getHumanLanguageName (string $language)

- string $language: The language name to get the human version of

static getHumanThemeName (line 575)

Given a theme name, return a human version of it

- return: The human theme name, or `false` if the theme does not exist
- since: 1.1.1

string getHumanThemeName (string $theme)

- string $theme: The theme name to get the human version of

static getSupportedThemes (line 435)

Returns every theme supported by this installation of GeSHi

- return: A list of themes supported by GeSHi
- todo: This is expensive, possibly cache?
- since: 1.1.1

array getSupportedThemes ([bool $return_human = false])

- bool $return_human: If `true`, the array returned is of the form `theme_name => human name`, otherwise it is an array of `theme_name`s

static getVersion (line 616)

Returns the version of this GeSHi

- return: The version of this GeSHi
- since: 1.1.0

string getVersion ()
static languagesSupportedBy (line 529)

Returns the languages supported by the given theme

- return: A list of languages supported by the theme, in the form:

       array(
            'language' => array('dialect', 'dialect', ...),
            'language' => array('dialect', ...)
       );

- since: 1.1.1

array languagesSupportedBy (string $theme)

- string $theme: The theme to get supported languages for

static themesSupportedBy (line 474)

Returns the themes supported by the given language

The names returned are in the form that GeSHi reads them, i.e. they are not nice human strings. If you want the human form, use GeSHi::getHumanThemeName() on each name returned.

- return: A list of themes supported by the language. Note that they are _not_ in preferred order
- todo: Make them in preferred order?
- todo: Expensive, maybe cache?
- since: 1.1.1

array themesSupportedBy (string $language, [boolean $return_human = false])

- string $language: The language to get supported themes for
- boolean $return_human: If `true`, returns an array of theme name => human-readable name. Otherwise, just return an array of theme names.

static themeSupportsLanguage (line 600)

Given a theme and language, returns whether the them supports that language

- return: Whether the language supports the theme
- since: 1.1.1

boolean themeSupportsLanguage (string $theme, string $language)

- string $theme: The name of the theme to check
- string $language: The name of the language to check

Constructor GeSHi (line 253)

Sets the source and language name of the source to parse

Also sets up other defaults, such as the default encoding

USAGE:

1. $geshi =& new GeSHi($source, $language);
2. // Various API calls... (todo: better examples)
3. $code = $geshi->parseCode();

- since: 1.0.0

GeSHi GeSHi (mixed $source, mixed $language_name, [mixed $path = ''])
error (line 841)

From 1.2.0, this method always returns false. This method is deprecated and will disappear in the next major version of GeSHi.

- return: Always
- deprecated:
- since: 1.0.0

false error ()
getSupportedLanguages (line 393)

- todo: document this function
- todo: This and other methods share a lot of directory traversal functionality, which could be split out somehow.
- todo: actually, this should be implemented using a registry

void getSupportedLanguages ([ $return_human = false])

- $return_human

getTime (line 329)

Returns various timings related to this object.

For example, how long it took to load a specific context, or parse the source code.

You can pass a string to this method, it will return various timings based on what string you pass:

- If you pass 'total' (default), you will get the time it took to load, parse and post-process the last call to GeSHi::parseCode().
- If you pass 'pre', you will get the time it took to load the last language. If caching of the root context is enabled, then this time will likely be close to zero if you are calling this method after second and subsequent calls to GeSHi::parseCode().
- If you pass 'parse', you will get the time it took to parse the last time GeSHi::parseCode() was called.

- return: The time if there is a time, else false if there was an error
- since: 1.1.0

mixed getTime ([mixed $type = 'total'])
parseCode (line 630)

Syntax-highlights the source code

- return: The source code, highlighted
- since: 1.0.0

string parseCode ()
setLanguage (line 295)

Sets the language to use for highlighting

- since: 1.0.0

void setLanguage (mixed $language_name)
setSource (line 281)

Sets the source code to highlight

- since: 1.0.0

void setSource (mixed $source)
setStyles (line 352)

Sets styles of contexts in the source code

- since: 1.1.1

void setStyles (mixed $selector, mixed $styles)
setTheme (line 376)

Sets the theme to use

This method can take a list of themes as well as an array or just one theme, e.g.:

1. $geshi->setTheme('theme');
2. $geshi->setTheme(array('theme1', 'theme2'));
3. $geshi->setTheme('theme1', 'theme2');

(note the difference between the second and third calls)

- since: 1.1.1

void setTheme (mixed $themes)
set_language (line 873)

Sets the language to use for highlighting. This method is deprecated, and will be removed in the next major version of GeSHi.

- deprecated: In favour of setLanguage()
- since: 1.0.0

void set_language (mixed $language_name)
set_source (line 857)

Sets the source code to highlight. This method is deprecated, and will be removed in 1.4/2.0.

- deprecated: In favour of setSource()
- since: 1.0.0

void set_source (mixed $source)

Documentation generated on Sun, 17 Sep 2006 23:57:54 +1200 by phpDocumentor 1.3.0RC6