Given a language name, return a human version of it
string
getHumanLanguageName
(string $language)
-
string
$language: The language name to get the human version of
Given a theme name, return a human version of it
string
getHumanThemeName
(string $theme)
-
string
$theme: The theme name to get the human version of
Returns every theme supported by this installation of GeSHi
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_names
Returns the version of this GeSHi
string
getVersion
()
Returns the languages supported by the given theme
array
languagesSupportedBy
(string $theme)
-
string
$theme: The theme to get supported languages for
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.
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.
Given a theme and language, returns whether the them supports that language
boolean
themeSupportsLanguage
(string $theme, string $language)
-
string
$theme: The name of the theme to check
-
string
$language: The name of the language to check
Sets the source and language name of the source to parse
Also sets up other defaults, such as the default encoding
USAGE:
$geshi =
& new GeSHi($source, $language);
// Various API calls... (todo: better examples)
GeSHi
GeSHi
(mixed $source, mixed $language_name, [mixed $path = ''])
From 1.2.0, this method always returns false. This method is deprecated and will disappear in the next major version of GeSHi.
false
error
()
void
getSupportedLanguages
([ $return_human = false])
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.
mixed
getTime
([mixed $type = 'total'])
Syntax-highlights the source code
string
parseCode
()
Sets the language to use for highlighting
void
setLanguage
(mixed $language_name)
Sets the source code to highlight
void
setSource
(mixed $source)
Sets styles of contexts in the source code
void
setStyles
(mixed $selector, mixed $styles)
Sets the theme to use
This method can take a list of themes as well as an array or just one theme, e.g.:
$geshi->setTheme(array('theme1', 'theme2'));
(note the difference between the second and third calls)
void
setTheme
(mixed $themes)
Sets the language to use for highlighting. This method is deprecated, and will be removed in the next major version of GeSHi.
void
set_language
(mixed $language_name)
Sets the source code to highlight. This method is deprecated, and will be removed in 1.4/2.0.
void
set_source
(mixed $source)