\
GeSHi
The GeSHi Class.

Please refer to the documentation for GeSHi 1.0.X that is available at http://qbnz.com/highlighter/documentation.php for more information about how to use this class.

Tags

Package

geshi

Author

Nigel McNie , Benny Baumann

Copyright

© 2004 – 2007 Nigel McNie, © 2007 – 2008 Benny Baumann

Summary
Methods Properties Constants
hsc
No constants
Properties
$_hmr_after
$_hmr_after
$_hmr_before
$_hmr_before
some "callback parameters" for handle_multiline_regexps

Tags

Since

1.0.8

Access

private

$_hmr_key
$_hmr_key
$_hmr_replace
$_hmr_replace
$_kw_replace_group
$_kw_replace_group
Work around for Suhosin Patch with disabled /e modifier

Note from suhosins author in config file:

The /e modifier inside preg_replace() allows code execution. Often it is the cause for remote code execution exploits. It is wise to deactivate this feature and test where in the application it is used. The developer using the /e modifier should be made aware that he should use preg_replace_callback() instead

Tags

Since

1.0.8

$_rx_key
$_rx_key
$add_ids
$add_ids
Whether CSS IDs should be added to the code
$allow_multiline_span
$allow_multiline_span
Flag to decide if multi line spans are allowed. Set it to false to make sure

each tag is closed before and reopened after each linefeed.

$code_style
$code_style
The style for the actual code
$enable_important_blocks
$enable_important_blocks
Whether important blocks should be recognised or not

Tags

Deprecated
Todo

REMOVE THIS FUNCTIONALITY!

$encoding
$encoding
The encoding to use for entity encoding

NOTE: Used with Escape Char Sequences to fix UTF-8 handling (cf. SF#2037598)

$error
$error
The error message associated with an error

Tags

Todo

check err reporting works

$error_messages
$error_messages
Possible error messages
$footer_content
$footer_content
The content of the footer block
$footer_content_style
$footer_content_style
The style of the footer block
$force_code_block
$force_code_block
Tells if a block around the highlighted source should be forced

if not using line numbering

$header_content
$header_content
The content of the header block
$header_content_style
$header_content_style
The style of the header block
$header_type
$header_type
The type of header to use. Can be one of the following

values:

- GESHI_HEADER_PRE: Source is outputted in a “pre” HTML element. - GESHI_HEADER_DIV: Source is outputted in a “div” HTML element. - GESHI_HEADER_NONE: No header is outputted.

$highlight_extra_lines
$highlight_extra_lines
Lines that should be highlighted extra
$highlight_extra_lines_style
$highlight_extra_lines_style
Styles of extra-highlighted lines
$highlight_extra_lines_styles
$highlight_extra_lines_styles
Styles of lines that should be highlighted extra
$important_styles
$important_styles
Styles for important parts of the code

Tags

Deprecated
Todo

As above – rethink the whole idea of important blocks as it is buggy and will be hard to implement in 1.2

$keyword_links
$keyword_links
Should keywords be linked?
$language
$language
The language to use when highlighting
$language_data
$language_data
The data for the language used
$language_path
$language_path
The path to the language files
$lexic_permissions
$lexic_permissions
Array of permissions for which lexics should be highlighted
$line_ending
$line_ending
The line ending

If null, nl2br() will be used on the result string. Otherwise, all instances of \n will be replaced with $line_ending

$line_nth_row
$line_nth_row
The "nth" value for fancy line highlighting
$line_numbers
$line_numbers
Flag for how line numbers are displayed
$line_numbers_start
$line_numbers_start
Number at which line numbers should start at
$line_style1
$line_style1
Line number styles
$line_style2
$line_style2
Line number styles for fancy lines
$link_styles
$link_styles
The styles for hyperlinks in the code
$link_target
$link_target
Default target for keyword links
$loaded_language
$loaded_language
Currently loaded language file

Tags

Since

1.0.7.22

$overall_class
$overall_class
The overall class for this code block
$overall_id
$overall_id
The overall ID for this code block
$overall_style
$overall_style
The overall style for this code block
$parse_cache_built
$parse_cache_built
Wether the caches needed for parsing are built or not

Tags

Since

1.0.8

$source
$source
The source code to highlight
$strict_mode
$strict_mode
Whether highlighting is strict or not
$tab_width
$tab_width
The size of tab stops
$table_linenumber_style
$table_linenumber_style
Style for line numbers when GESHI_HEADER_PRE_TABLE is chosen
$time
$time
The time it took to parse the code
$use_classes
$use_classes
Whether to use CSS classes in output
$use_language_tab_width
$use_language_tab_width
Should we use language-defined tab stop widths?
Methods
GeSHi()
GeSHi($source = '', $language = '', $path = '')
Creates a new GeSHi object, with source and language

Tags

Since

1.0.0

Parameters

$source

No description

$language

No description

$path

No description

_genCSSName()
_genCSSName($name)

Parameters

$name

No description

_optimize_regexp_list_tokens_to_string()
_optimize_regexp_list_tokens_to_string($tokens, $recursed = false) : string
this function creates the appropriate regexp string of an token array

you should not call this function directly, @see $this->optimize_regexp_list().

Tags

Author

Milian Wolff

Since

1.0.8

Access

private

Parameters

$tokens

No description

$recursed

No description

Returns

string
add_keyword()
add_keyword($key, $word)
Adds a keyword to a keyword group for highlighting

Tags

Since

1.0.0

Parameters

$key

No description

$word

No description

add_keyword_group()
add_keyword_group($key, $styles, $case_sensitive = true, $words = Array ( ) )
Creates a new keyword group

Tags

Since

1.0.0

Parameters

$key

No description

$styles

No description

$case_sensitive

No description

$words

No description

build_parse_cache()
build_parse_cache()
Setup caches needed for parsing. This is automatically called in parse_code() when appropriate.

This function makes stylesheet generators much faster as they do not need these caches.

Tags

Since

1.0.8

Access

private

build_style_cache()
build_style_cache()
Setup caches needed for styling. This is automatically called in

parse_code() and get_stylesheet() when appropriate. This function helps stylesheet generators as they rely on some style information being preprocessed

Tags

Since

1.0.8

Access

private

change_case()
change_case($instr) : string
Changes the case of a keyword for those languages where a change is asked for

Tags

Since

1.0.0

Access

private

Parameters

$instr

No description

Returns

string

The keyword with its case changed

disable_highlighting()
disable_highlighting()
Disables all highlighting

Tags

Since

1.0.0

Todo

Rewrite with array traversal

Deprecated

In favour of enable_highlighting

enable_classes()
enable_classes($flag = true)
Sets whether CSS classes should be used to highlight the source. Default

is off, calling this method with no arguments will turn it on

Tags

Since

1.0.0

Parameters

$flag

No description

enable_highlighting()
enable_highlighting($flag = true)
Enables all highlighting

The optional flag parameter was added in version 1.0.7.21 and can be used to enable (true) or disable (false) all highlighting.

Tags

Since

1.0.0

Todo

Rewrite with array traversal

Parameters

$flag

No description

enable_ids()
enable_ids($flag = true)
Whether CSS IDs should be added to each line

Tags

Since

1.0.2

Parameters

$flag

No description

enable_important_blocks()
enable_important_blocks($flag)
Sets whether context-important blocks are highlighted

Tags

Todo

REMOVE THIS SHIZ FROM GESHI!

Deprecated
Since

1.0.2

Parameters

$flag

No description

enable_inner_code_block()
enable_inner_code_block($flag)
Sets whether to force a surrounding block around

the highlighted code or not

Tags

Since

1.0.7.20

Parameters

$flag

No description

enable_keyword_links()
enable_keyword_links($enable = true)
Turns linking of keywords on or off.

Tags

Since

1.0.2

Parameters

$enable

No description

enable_line_numbers()
enable_line_numbers($flag, $nth_row = 5)
Sets whether line numbers should be displayed.

Valid values for the first parameter are:

GESHI_NO_LINE_NUMBERS: Line numbers will not be displayed – GESHI_NORMAL_LINE_NUMBERS: Line numbers will be displayed – GESHI_FANCY_LINE_NUMBERS: Fancy line numbers will be displayed

For fancy line numbers, the second parameter is used to signal which lines are to be fancy. For example, if the value of this parameter is 5 then every 5th line will be fancy.

Tags

Since

1.0.0

Parameters

$flag

No description

$nth_row

No description

enable_multiline_span()
enable_multiline_span($flag)
Sets wether spans and other HTML markup generated by GeSHi can

span over multiple lines or not. Defaults to true to reduce overhead. Set it to false if you want to manipulate the output or manually display the code in an ordered list.

Tags

Since

1.0.7.22

Parameters

$flag

No description

enable_strict_mode()
enable_strict_mode($mode = true)
Enables/disables strict highlighting. Default is off, calling this

method without parameters will turn it on. See documentation for more details on strict mode and where to use it.

Tags

Since

1.0.0

Parameters

$mode

No description

error()
error() : string|false
Returns an error message associated with the last GeSHi operation,

or false if no error has occured

Tags

Since

1.0.0

Returns

\string|false

An error message if there has been an error, else false

finalise()
finalise($parsed_code)
Takes the parsed code and various options, and creates the HTML

surrounding it to make it look nice.

Tags

Since

1.0.0

Access

private

Parameters

$parsed_code

No description

footer()
footer() : string
Returns the footer for the code block.

Tags

Since

1.0.0

Access

private

Returns

string

The footer for the code block

get_language_fullname()
get_language_fullname($language) : mixed
Get full_name for a lang or false.

Parameters

$languagestring

short langname (html4strict for example)

Returns

mixed
get_language_name()
get_language_name() : string
Gets a human-readable language name (thanks to Simon Patterson

for the idea :))

Tags

Since

1.0.2

Returns

string

The name for the current language

get_language_name_from_extension()
get_language_name_from_extension($extension, $lookup = Array ( ) )
Given a file extension, this method returns either a valid geshi language

name, or the empty string if it couldn’t be found

Tags

Since

1.0.5

Todo

Re-think about how this method works (maybe make it private and/or make it a extension->lang lookup?)

Todo

static?

Parameters

$extension

No description

$lookup

No description

get_line_style()
get_line_style($line)
Get's the style that is used for the specified line

Tags

Access

private

Since

1.0.7.21

Parameters

$line

No description

get_multiline_span()
get_multiline_span() : bool
Get current setting for multiline spans, see GeSHi->enable_multiline_span().

Tags

See

enable_multiline_span

Returns

\bool
get_real_tab_width()
get_real_tab_width() : int
Returns the tab width to use, based on the current language and user

preference

Tags

Since

1.0.7.20

Returns

int

Tab width

get_stylesheet()
get_stylesheet($economy_mode = true) : string
Returns a stylesheet for the highlighted code. If $economy mode

is true, we only return the stylesheet declarations that matter for this code block instead of the whole thing

Tags

Since

1.0.0

Parameters

$economy_mode

No description

Returns

string

A stylesheet built on the data for the current language

get_supported_languages()
get_supported_languages($full_names = false) : array
Get supported langs or an associative array lang=>full_name.

Parameters

$full_names

No description

Returns

array
get_time()
get_time() : double
Gets the time taken to parse the code

Tags

Since

1.0.2

Returns

double

The time taken to parse the code

get_version()
get_version() : string
Returns the version of GeSHi

Tags

Since

1 0.8.11

Returns

string
handle_keyword_replace()
handle_keyword_replace($match) : The
Handles replacements of keywords to include markup and links if requested

Tags

Since

1.0.8

Access

private

Todo

Get rid of ender in keyword links

Parameters

$match

No description

Returns

\The

HTML for the match found

handle_multiline_regexps()
handle_multiline_regexps($matches) : string
handles newlines in REGEXPS matches. Set the _hmr_* vars before calling this

Tags

Note

this is a callback, don’t use it directly

Since

1.0.8

Access

private

Parameters

$matches

No description

Returns

string
handle_regexps_callback()
handle_regexps_callback($matches) : The
handles regular expressions highlighting-definitions with callback functions

Tags

Note

this is a callback, don’t use it directly

Since

1.0.8

Access

private

Parameters

$matches

No description

Returns

\The

highlighted string

header()
header() : string
Creates the header for the code block (with correct attributes)

Tags

Since

1.0.0

Access

private

Returns

string

The header for the code block

highlight_lines_extra()
highlight_lines_extra($lines, $style = null)
Specifies which lines to highlight extra

The extra style parameter was added in 1.0.7.21.

Tags

Since

1.0.2

Todo

Some data replication here that could be cut down on

Parameters

$lines

No description

$style

No description

hsc()
hsc($string, $quote_style = 'ent_compat') : string
Secure replacement for PHP built-in function htmlspecialchars().

See ticket #427 (http://wush.net/trac/wikka/ticket/427) for the rationale for this replacement function.

The INTERFACE for this function is almost the same as that for htmlspecialchars(), with the same default for quote style; however, there is no ‘charset’ parameter. The reason for this is as follows:

The PHP docs say: “The third argument charset defines character set used in conversion.”

I suspect PHP’s htmlspecialchars() is working at the byte-value level and thus needs to know (or asssume) a character set because the special characters to be replaced could exist at different code points in different character sets. (If indeed htmlspecialchars() works at byte-value level that goes some way towards explaining why the vulnerability would exist in this function, too, and not only in htmlentities() which certainly is working at byte-value level.)

This replacement function however works at character level and should therefore be “immune” to character set differences – so no charset parameter is needed or provided. If a third parameter is passed, it will be silently ignored.

In the OUTPUT there is a minor difference in that we use ‘'’ instead of PHP’s ‘'’ for a single quote: this provides compatibility with get_html_translation_table(HTML_SPECIALCHARS, ENT_QUOTES) (see comment by mikiwoz at yahoo dot co dot uk on http://php.net/htmlspecialchars); it also matches the entity definition for XML 1.0 (http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_Special_characters). Like PHP we use a numeric character reference instead of ‘'’ for the single quote. For the other special characters we use the named entity references, as PHP is doing.

Tags

Author

[email protected] http://wikkawiki.org/JavaWoman Marjolein Katsma}

License

http://www.gnu.org/copyleft/lgpl.html GNU Lesser General Public License

Copyright

Copyright 2007, [email protected] http://wikkawiki.org/CreditsPage Wikka Development Team}

Access

private

Since

1.0.7.18

Parameters

$stringstring

string to be converted

$quote_styleinteger

- ENT_COMPAT: escapes &, <, > and double quote (default) – ENT_NOQUOTES: escapes only &, < and > – ENT_QUOTES: escapes &, <, >, double and single quotes

Returns

string

converted string

indent()
indent($result)
Swaps out spaces and tabs for HTML indentation. Not needed if

the code is in a pre block…

Tags

Since

1.0.0

Access

private

Parameters

$result

No description

load_from_file()
load_from_file($file_name, $lookup = Array ( ) )
Given a file name, this method loads its contents in, and attempts

to set the language automatically. An optional lookup table can be passed for looking up the language name. If not specified a default table is used

The language table is in the form

array(
  'lang_name' => array('extension', 'extension', ...),
  'lang_name' ...
);

Tags

Todo

Complete rethink of this and above method

Since

1.0.5

Parameters

$file_name

No description

$lookup

No description

load_language()
load_language($file_name)
Gets language information and stores it for later use

Tags

Since

1.0.0

Access

private

Todo

Needs to load keys for lexic permissions for keywords, regexps etc

Parameters

$file_name

No description

merge_arrays()
merge_arrays()
Merges arrays recursively, overwriting values of the first array with values of later arrays

Tags

Since

1.0.8

Access

private

optimize_keyword_group()
optimize_keyword_group($key)
compile optimized regexp list for keyword group

Tags

Since

1.0.8

Parameters

$key

No description

optimize_regexp_list()
optimize_regexp_list($list, $regexp_delimiter = '/') : string
this functions creates an optimized regular expression list

of an array of strings.

Example: $list = array('faa', 'foo', 'foobar'); => string 'f(aa|oo(bar)?)'

Tags

Author

Milian Wolff

Since

1.0.8

Access

private

Parameters

$list

No description

$regexp_delimiter

No description

Returns

string

for regular expression

parse_code()
parse_code()
Returns the code in $this->source, highlighted and surrounded by the

nessecary HTML.

This should only be called ONCE, cos it’s SLOW! If you want to highlight the same source multiple times, you’re better off doing a whole lot of str_replaces to replace the <span>s

Tags

Since

1.0.0

parse_non_string_part()
parse_non_string_part($stuff_to_parse)
Takes a string that has no strings or comments in it, and highlights

stuff like keywords, numbers and methods.

Tags

Since

1.0.0

Access

private

Todo

BUGGY! Why? Why not build string and return?

Parameters

$stuff_to_parse

No description

remove_keyword()
remove_keyword($key, $word, $recompile = true)
Removes a keyword from a keyword group

Tags

Since

1.0.0

Parameters

$key

No description

$word

No description

$recompile

No description

remove_keyword_group()
remove_keyword_group($key)
Removes a keyword group

Tags

Since

1.0.0

Parameters

$key

No description

replace_keywords()
replace_keywords($instr) : string
Replaces certain keywords in the header and footer with

certain configuration values

Tags

Since

1.0.2

Access

private

Parameters

$instr

No description

Returns

string

The header or footer with replaced keywords

set_brackets_highlighting()
set_brackets_highlighting($flag)
Turns highlighting on/off for brackets

This method is DEPRECATED: use set_symbols_highlighting instead. This method will be remove in 1.2.X

Tags

Since

1.0.0

Deprecated

In favour of set_symbols_highlighting

Parameters

$flag

No description

set_brackets_style()
set_brackets_style($style, $preserve_defaults = false)
Sets the styles for brackets. If $preserve_defaults is

true, then styles are merged with the default styles, with the user defined styles having priority

This method is DEPRECATED: use set_symbols_style instead. This method will be removed in 1.2.X

Tags

Since

1.0.0

Deprecated

In favour of set_symbols_style

Parameters

$style

No description

$preserve_defaults

No description

set_case_keywords()
set_case_keywords($case)
Sets the case that keywords should use when found. Use the constants:

- GESHI_CAPS_NO_CHANGE: leave keywords as-is – GESHI_CAPS_UPPER: convert all keywords to uppercase where found – GESHI_CAPS_LOWER: convert all keywords to lowercase where found

Tags

Since

1.0.1

Parameters

$case

No description

set_case_sensitivity()
set_case_sensitivity($key, $case)
Sets whether a set of keywords are checked for in a case sensitive manner

Tags

Since

1.0.0

Parameters

$key

No description

$case

No description

set_code_style()
set_code_style($style, $preserve_defaults = false)
Sets the style for the actual code. This should be a string

containing valid stylesheet declarations. If $preserve_defaults is true, then styles are merged with the default styles, with the user defined styles having priority

Note: Use this method to override any style changes you made to the line numbers if you are using line numbers, else the line of code will have the same style as the line number! Consult the GeSHi documentation for more information about this.

Tags

Since

1.0.2

Parameters

$style

No description

$preserve_defaults

No description

set_comments_highlighting()
set_comments_highlighting($key, $flag = true)
Turns highlighting on/off for comment groups

Tags

Since

1.0.0

Parameters

$key

No description

$flag

No description

set_comments_style()
set_comments_style($key, $style, $preserve_defaults = false)
Sets the styles for comment groups. If $preserve_defaults is

true, then styles are merged with the default styles, with the user defined styles having priority

Tags

Since

1.0.0

Parameters

$key

No description

$style

No description

$preserve_defaults

No description

set_encoding()
set_encoding($encoding)
Sets the encoding used for htmlspecialchars(), for international

support.

NOTE: This is not needed for now because htmlspecialchars() is not being used (it has a security hole in PHP4 that has not been patched). Maybe in a future version it may make a return for speed reasons, but I doubt it.

Tags

Since

1.0.3

Parameters

$encoding

No description

set_escape_characters_highlighting()
set_escape_characters_highlighting($flag = true)
Turns highlighting on/off for escaped characters

Tags

Since

1.0.0

Parameters

$flag

No description

set_escape_characters_style()
set_escape_characters_style($style, $preserve_defaults = false, $group = 0)
Sets the styles for escaped characters. If $preserve_defaults is

true, then styles are merged with the default styles, with the user defined styles having priority

Tags

Since

1.0.0

Parameters

$style

No description

$preserve_defaults

No description

$group

No description

set_footer_content()
set_footer_content($content)
Sets the content of the footer block

Tags

Since

1.0.2

Parameters

$content

No description

set_footer_content_style()
set_footer_content_style($style)
Sets the style for the footer content

Tags

Since

1.0.2

Parameters

$style

No description

set_header_content()
set_header_content($content)
Sets the content of the header block

Tags

Since

1.0.2

Parameters

$content

No description

set_header_content_style()
set_header_content_style($style)
Sets the style for the header content

Tags

Since

1.0.2

Parameters

$style

No description

set_header_type()
set_header_type($type)
Sets the type of header to be used.

If GESHI_HEADER_DIV is used, the code is surrounded in a “div”.This means more source code but more control over tab width and line-wrapping. GESHI_HEADER_PRE means that a “pre” is used – less source, but less control. Default is GESHI_HEADER_PRE.

From 1.0.7.2, you can use GESHI_HEADER_NONE to specify that no header code should be outputted.

Tags

Since

1.0.0

Parameters

$type

No description

set_highlight_lines_extra_style()
set_highlight_lines_extra_style($styles)
Sets the style for extra-highlighted lines

Tags

Since

1.0.2

Parameters

$styles

No description

set_important_styles()
set_important_styles($styles)
Sets styles for important parts of the code

Tags

Since

1.0.2

Parameters

$styles

No description

set_keyword_group_highlighting()
set_keyword_group_highlighting($key, $flag = true)
Turns highlighting on/off for a keyword group

Tags

Since

1.0.0

Parameters

$key

No description

$flag

No description

set_keyword_group_style()
set_keyword_group_style($key, $style, $preserve_defaults = false)
Sets the style for a keyword group. If $preserve_defaults is

true, then styles are merged with the default styles, with the user defined styles having priority

Tags

Since

1.0.0

Parameters

$key

No description

$style

No description

$preserve_defaults

No description

set_language()
set_language($language, $force_reset = false)
Sets the language for this object

Tags

Note

since 1.0.8 this function won’t reset language-settings by default anymore! if you need this set $force_reset = true

Since

1.0.0

Parameters

$language

No description

$force_reset

No description

set_language_path()
set_language_path($path)
Sets the path to the directory containing the language files. Note

that this path is relative to the directory of the script that included geshi.php, NOT geshi.php itself.

Tags

Since

1.0.0

Deprecated

The path to the language files should now be automatically detected, so this method should no longer be needed. The 1.1.X branch handles manual setting of the path differently so this method will disappear in 1.2.0.

Parameters

$path

No description

set_line_ending()
set_line_ending($line_ending)
Sets the line-ending

Tags

Since

1.0.2

Parameters

$line_ending

No description

set_line_style()
set_line_style($style1, $style2 = '', $preserve_defaults = false)
Sets the styles for the line numbers.

Tags

Since

1.0.2

Parameters

$style1

No description

$style2

No description

$preserve_defaults

No description

set_link_styles()
set_link_styles($type, $styles)
Sets styles for links in code

Tags

Since

1.0.2

Parameters

$type

No description

$styles

No description

set_link_target()
set_link_target($target)
Sets the target for links in code

Tags

Since

1.0.3

Parameters

$target

No description

set_methods_highlighting()
set_methods_highlighting($flag)
Turns highlighting on/off for methods

Tags

Since

1.0.0

Parameters

$flag

No description

set_methods_style()
set_methods_style($key, $style, $preserve_defaults = false)
Sets the styles for methods. $key is a number that references the

appropriate “object splitter” – see the language file for the language you are highlighting to get this number. If $preserve_defaults is true, then styles are merged with the default styles, with the user defined styles having priority

Tags

Since

1.0.0

Parameters

$key

No description

$style

No description

$preserve_defaults

No description

set_numbers_highlighting()
set_numbers_highlighting($flag)
Turns highlighting on/off for numbers

Tags

Since

1.0.0

Parameters

$flag

No description

set_numbers_style()
set_numbers_style($style, $preserve_defaults = false, $group = 0)
Sets the styles for numbers. If $preserve_defaults is

true, then styles are merged with the default styles, with the user defined styles having priority

Tags

Since

1.0.0

Parameters

$style

No description

$preserve_defaults

No description

$group

No description

set_overall_class()
set_overall_class($class)
Sets the overall classname for this block of code. This

class can then be used in a stylesheet to style this object’s output

Tags

Since

1.0.0

Parameters

$class

No description

set_overall_id()
set_overall_id($id)
Sets the overall id for this block of code. This id can then

be used in a stylesheet to style this object’s output

Tags

Since

1.0.0

Parameters

$id

No description

set_overall_style()
set_overall_style($style, $preserve_defaults = false)
Sets the styles for the code that will be outputted

when this object is parsed. The style should be a string of valid stylesheet declarations

Tags

Since

1.0.0

Parameters

$style

No description

$preserve_defaults

No description

set_regexps_highlighting()
set_regexps_highlighting($key, $flag)
Turns highlighting on/off for regexps

Tags

Since

1.0.0

Parameters

$key

No description

$flag

No description

set_regexps_style()
set_regexps_style($key, $style, $preserve_defaults = false)
Sets the styles for regexps. If $preserve_defaults is

true, then styles are merged with the default styles, with the user defined styles having priority

Tags

Since

1.0.0

Parameters

$key

No description

$style

No description

$preserve_defaults

No description

set_script_style()
set_script_style($style, $preserve_defaults = false, $group = 0)
Sets the styles for strict code blocks. If $preserve_defaults is

true, then styles are merged with the default styles, with the user defined styles having priority

Tags

Since

1.0.8.4

Parameters

$style

No description

$preserve_defaults

No description

$group

No description

set_source()
set_source($source)
Sets the source code for this object

Tags

Since

1.0.0

Parameters

$source

No description

set_strings_highlighting()
set_strings_highlighting($flag)
Turns highlighting on/off for strings

Tags

Since

1.0.0

Parameters

$flag

No description

set_strings_style()
set_strings_style($style, $preserve_defaults = false, $group = 0)
Sets the styles for strings. If $preserve_defaults is

true, then styles are merged with the default styles, with the user defined styles having priority

Tags

Since

1.0.0

Parameters

$style

No description

$preserve_defaults

No description

$group

No description

set_symbols_highlighting()
set_symbols_highlighting($flag)
Turns highlighting on/off for symbols

Tags

Since

1.0.0

Parameters

$flag

No description

set_symbols_style()
set_symbols_style($style, $preserve_defaults = false, $group = 0)
Sets the styles for symbols. If $preserve_defaults is

true, then styles are merged with the default styles, with the user defined styles having priority

Tags

Since

1.0.1

Parameters

$style

No description

$preserve_defaults

No description

$group

No description

set_tab_width()
set_tab_width($width)
Sets how many spaces a tab is substituted for

Widths below zero are ignored

Tags

Since

1.0.0

Parameters

$width

No description

set_time()
set_time($start_time, $end_time)
Sets the time taken to parse the code

Tags

Since

1.0.2

Access

private

Parameters

$start_time

No description

$end_time

No description

set_url_for_keyword_group()
set_url_for_keyword_group($group, $url)
Sets the base URL to be used for keywords

Tags

Since

1.0.2

Parameters

$group

No description

$url

No description

set_use_language_tab_width()
set_use_language_tab_width($use)
Sets whether or not to use tab-stop width specifed by language

Tags

Since

1.0.7.20

Parameters

$use

No description

start_line_numbers_at()
start_line_numbers_at($number)
Sets what number line numbers should start at. Should

be a positive integer, and will be converted to one.

Warning: Using this method will add the “start” attribute to the <ol> that is used for line numbering. This is not valid XHTML strict, so if that’s what you care about then don’t use this method. Firefox is getting support for the CSS method of doing this in 1.1 and Opera has support for the CSS method, but (of course) IE doesn’t so it’s not worth doing it the CSS way yet.

Tags

Since

1.0.2

Parameters

$number

No description