ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
geshi.php File Reference

Go to the source code of this file.

Data Structures

class  GeSHi
 

Namespaces

 geshi
 A simple script which outputs the CSS classes for all languages supported by GeSHi.
 

Variables

const GESHI_VERSION '1.0.8.12'
 The version of this GeSHi file. More...
 
const GESHI_LANG_ROOT (!defined('GESHI_ROOT')) GESHI_ROOT . 'geshi' . DIRECTORY_SEPARATOR
 The language file directory for GeSHi private. More...
 
const GESHI_NO_LINE_NUMBERS (!defined('GESHI_SECURITY_PARANOID')) 0
 Use no line numbers when building the result. More...
 
const GESHI_NORMAL_LINE_NUMBERS 1
 Use normal line numbers when building the result. More...
 
const GESHI_FANCY_LINE_NUMBERS 2
 Use fancy line numbers when building the result. More...
 
const GESHI_HEADER_NONE 0
 Use nothing to surround the source. More...
 
const GESHI_HEADER_DIV 1
 Use a "div" to surround the source. More...
 
const GESHI_HEADER_PRE 2
 Use a "pre" to surround the source. More...
 
const GESHI_HEADER_PRE_VALID 3
 Use a pre to wrap lines when line numbers are enabled or to wrap the whole code. More...
 
const GESHI_HEADER_PRE_TABLE 4
 Use a "table" to surround the source: More...
 
const GESHI_CAPS_NO_CHANGE 0
 Lowercase keywords found. More...
 
const GESHI_CAPS_UPPER 1
 Uppercase keywords found. More...
 
const GESHI_CAPS_LOWER 2
 Leave keywords found as the case that they are. More...
 
const GESHI_LINK 0
 Links in the source in the :link state. More...
 
const GESHI_HOVER 1
 Links in the source in the :hover state. More...
 
const GESHI_ACTIVE 2
 Links in the source in the :active state. More...
 
const GESHI_VISITED 3
 Links in the source in the :visited state. More...
 
const GESHI_START_IMPORTANT '<BEGIN GeSHi>'
 The starter for important parts of the source. More...
 
const GESHI_END_IMPORTANT '<END GeSHi>'
 The ender for important parts of the source. More...
 
const GESHI_NEVER 0
 #+ private More...
 
const GESHI_MAYBE 1
 Strict mode might apply, and can be enabled or disabled by GeSHi->enable_strict_mode(). More...
 
const GESHI_ALWAYS 2
 Strict mode always applies. More...
 
const GESHI_SEARCH 0
 The key of the regex array defining what to search for. More...
 
const GESHI_REPLACE 1
 The key of the regex array defining what bracket group in a matched search to use as a replacement. More...
 
const GESHI_MODIFIERS 2
 The key of the regex array defining any modifiers to the regular expression. More...
 
const GESHI_BEFORE 3
 The key of the regex array defining what bracket group in a matched search to put before the replacement. More...
 
const GESHI_AFTER 4
 The key of the regex array defining what bracket group in a matched search to put after the replacement. More...
 
const GESHI_CLASS 5
 The key of the regex array defining a custom keyword to use for this regexp's html tag class. More...
 
const GESHI_COMMENTS 0
 Used in language files to mark comments. More...
 
const GESHI_PHP_PRE_433 !(version_compare(PHP_VERSION, '4.3.3') === 1)
 Used to work around missing PHP features. More...
 
const GESHI_MAX_PCRE_SUBPATTERNS (!function_exists('stripos')) 500
 make sure we can call stripos More...
 
const GESHI_MAX_PCRE_LENGTH 12288
 it's also important not to generate too long regular expressions be generous here... More...
 
const GESHI_NUMBER_INT_BASIC 1
 Basic number format for integers. More...
 
const GESHI_NUMBER_INT_CSTYLE 2
 Enhanced number format for integers like seen in C. More...
 
const GESHI_NUMBER_BIN_SUFFIX 16
 Number format to highlight binary numbers with a suffix "b". More...
 
const GESHI_NUMBER_BIN_PREFIX_PERCENT 32
 Number format to highlight binary numbers with a prefix %. More...
 
const GESHI_NUMBER_BIN_PREFIX_0B 64
 Number format to highlight binary numbers with a prefix 0b (C) More...
 
const GESHI_NUMBER_OCT_PREFIX 256
 Number format to highlight octal numbers with a leading zero. More...
 
const GESHI_NUMBER_OCT_PREFIX_0O 512
 Number format to highlight octal numbers with a prefix 0o (logtalk) More...
 
const GESHI_NUMBER_OCT_PREFIX_AT 1024
 Number format to highlight octal numbers with a leading @ (Used in HiSofts Devpac series). More...
 
const GESHI_NUMBER_OCT_SUFFIX 2048
 Number format to highlight octal numbers with a suffix of o. More...
 
const GESHI_NUMBER_HEX_PREFIX 4096
 Number format to highlight hex numbers with a prefix 0x. More...
 
const GESHI_NUMBER_HEX_PREFIX_DOLLAR 8192
 Number format to highlight hex numbers with a prefix $. More...
 
const GESHI_NUMBER_HEX_SUFFIX 16384
 Number format to highlight hex numbers with a suffix of h. More...
 
const GESHI_NUMBER_FLT_NONSCI 65536
 Number format to highlight floating-point numbers without support for scientific notation. More...
 
const GESHI_NUMBER_FLT_NONSCI_F 131072
 Number format to highlight floating-point numbers without support for scientific notation. More...
 
const GESHI_NUMBER_FLT_SCI_SHORT 262144
 Number format to highlight floating-point numbers with support for scientific notation (E) and optional leading zero. More...
 
const GESHI_NUMBER_FLT_SCI_ZERO 524288
 Number format to highlight floating-point numbers with support for scientific notation (E) and required leading digit. More...
 
const GESHI_ERROR_NO_INPUT 1
 No sourcecode to highlight was specified. More...
 
const GESHI_ERROR_NO_SUCH_LANG 2
 The language specified does not exist. More...
 
const GESHI_ERROR_FILE_NOT_READABLE 3
 GeSHi could not open a file for reading (generally a language file) More...
 
const GESHI_ERROR_INVALID_HEADER_TYPE 4
 The header type passed to GeSHi->set_header_type() was invalid. More...
 
const GESHI_ERROR_INVALID_LINE_NUMBER_TYPE 5
 The line number type passed to GeSHi->enable_line_numbers() was invalid. More...
 

Variable Documentation

◆ GESHI_ACTIVE

const GESHI_ACTIVE 2

Links in the source in the :active state.

Definition at line 107 of file geshi.php.

Referenced by GeSHi\get_stylesheet().

◆ GESHI_AFTER

const GESHI_AFTER 4

The key of the regex array defining what bracket group in a matched search to put after the replacement.

Definition at line 144 of file geshi.php.

Referenced by GeSHi\parse_non_string_part().

◆ GESHI_ALWAYS

const GESHI_ALWAYS 2

Strict mode always applies.

Definition at line 129 of file geshi.php.

Referenced by GeSHi\enable_strict_mode().

◆ GESHI_BEFORE

const GESHI_BEFORE 3

The key of the regex array defining what bracket group in a matched search to put before the replacement.

Definition at line 141 of file geshi.php.

Referenced by GeSHi\parse_non_string_part().

◆ GESHI_CAPS_LOWER

const GESHI_CAPS_LOWER 2

Leave keywords found as the case that they are.

Definition at line 99 of file geshi.php.

Referenced by GeSHi\change_case(), and GeSHi\set_case_keywords().

◆ GESHI_CAPS_NO_CHANGE

const GESHI_CAPS_NO_CHANGE 0

Lowercase keywords found.

Definition at line 95 of file geshi.php.

Referenced by GeSHi\set_case_keywords().

◆ GESHI_CAPS_UPPER

const GESHI_CAPS_UPPER 1

Uppercase keywords found.

Definition at line 97 of file geshi.php.

Referenced by GeSHi\change_case(), and GeSHi\set_case_keywords().

◆ GESHI_CLASS

const GESHI_CLASS 5

The key of the regex array defining a custom keyword to use for this regexp's html tag class.

Definition at line 147 of file geshi.php.

Referenced by GeSHi\get_stylesheet(), and GeSHi\parse_non_string_part().

◆ GESHI_COMMENTS

const GESHI_COMMENTS 0

Used in language files to mark comments.

Definition at line 150 of file geshi.php.

Referenced by GeSHi\parse_code().

◆ GESHI_END_IMPORTANT

const GESHI_END_IMPORTANT '<END GeSHi>'

The ender for important parts of the source.

Definition at line 117 of file geshi.php.

Referenced by GeSHi\finalise(), and GeSHi\parse_code().

◆ GESHI_ERROR_FILE_NOT_READABLE

const GESHI_ERROR_FILE_NOT_READABLE 3

GeSHi could not open a file for reading (generally a language file)

Definition at line 240 of file geshi.php.

Referenced by GeSHi\load_from_file().

◆ GESHI_ERROR_INVALID_HEADER_TYPE

const GESHI_ERROR_INVALID_HEADER_TYPE 4

The header type passed to GeSHi->set_header_type() was invalid.

Definition at line 242 of file geshi.php.

Referenced by GeSHi\set_header_type().

◆ GESHI_ERROR_INVALID_LINE_NUMBER_TYPE

const GESHI_ERROR_INVALID_LINE_NUMBER_TYPE 5

The line number type passed to GeSHi->enable_line_numbers() was invalid.

Definition at line 244 of file geshi.php.

Referenced by GeSHi\enable_line_numbers().

◆ GESHI_ERROR_NO_INPUT

const GESHI_ERROR_NO_INPUT 1

No sourcecode to highlight was specified.

Deprecated:

Definition at line 236 of file geshi.php.

◆ GESHI_ERROR_NO_SUCH_LANG

const GESHI_ERROR_NO_SUCH_LANG 2

The language specified does not exist.

Definition at line 238 of file geshi.php.

Referenced by GeSHi\get_language_name(), and GeSHi\set_language().

◆ GESHI_FANCY_LINE_NUMBERS

const GESHI_FANCY_LINE_NUMBERS 2

Use fancy line numbers when building the result.

Definition at line 67 of file geshi.php.

Referenced by GeSHi\enable_line_numbers(), GeSHi\finalise(), and GeSHi\get_stylesheet().

◆ GESHI_HEADER_DIV

const GESHI_HEADER_DIV 1

Use a "div" to surround the source.

Definition at line 73 of file geshi.php.

Referenced by GeSHi\footer(), GeSHi\header(), and GeSHi\set_header_type().

◆ GESHI_HEADER_NONE

const GESHI_HEADER_NONE 0

Use nothing to surround the source.

Definition at line 71 of file geshi.php.

Referenced by GeSHi\_optimize_regexp_list_tokens_to_string(), GeSHi\footer(), GeSHi\header(), and GeSHi\set_header_type().

◆ GESHI_HEADER_PRE

const GESHI_HEADER_PRE 2

Use a "pre" to surround the source.

Definition at line 75 of file geshi.php.

Referenced by GeSHi\finalise(), GeSHi\footer(), GeSHi\header(), and GeSHi\set_header_type().

◆ GESHI_HEADER_PRE_TABLE

const GESHI_HEADER_PRE_TABLE 4

Use a "table" to surround the source:

$header</thead> <tbody>

$linenumbers
$code>

</tbody> <tfooter>

$footer</tfoot>

this is essentially only a workaround for Firefox, see sf#1651996 or take a look at https://bugzilla.mozilla.org/show_bug.cgi?id=365805

Note
when linenumbers are disabled this is essentially the same as GESHI_HEADER_PRE

Definition at line 91 of file geshi.php.

Referenced by GeSHi\finalise(), GeSHi\footer(), GeSHi\header(), GeSHi\indent(), and GeSHi\set_header_type().

◆ GESHI_HEADER_PRE_VALID

const GESHI_HEADER_PRE_VALID 3

Use a pre to wrap lines when line numbers are enabled or to wrap the whole code.

Definition at line 77 of file geshi.php.

Referenced by GeSHi\finalise(), GeSHi\footer(), GeSHi\header(), and GeSHi\set_header_type().

◆ GESHI_HOVER

const GESHI_HOVER 1

Links in the source in the :hover state.

Definition at line 105 of file geshi.php.

Referenced by GeSHi\get_stylesheet().

◆ GESHI_LANG_ROOT

const GESHI_LANG_ROOT(!defined( 'GESHI_ROOT')) GESHI_ROOT . 'geshi' . DIRECTORY_SEPARATOR

The language file directory for GeSHi private.

Definition at line 53 of file geshi.php.

◆ GESHI_LINK

const GESHI_LINK 0

Links in the source in the :link state.

Definition at line 103 of file geshi.php.

Referenced by GeSHi\get_stylesheet(), and GeSHi\parse_non_string_part().

◆ GESHI_MAX_PCRE_LENGTH

const GESHI_MAX_PCRE_LENGTH 12288

it's also important not to generate too long regular expressions be generous here...

but keep in mind, that when reaching this limit we still have to close open patterns. 12k should do just fine on a 16k limit.

See also
GeSHi->optimize_regexp_list()

Definition at line 195 of file geshi.php.

Referenced by GeSHi\optimize_regexp_list().

◆ GESHI_MAX_PCRE_SUBPATTERNS

const GESHI_MAX_PCRE_SUBPATTERNS(!function_exists( 'stripos')) 500

make sure we can call stripos

some old PHP / PCRE subpatterns only support up to xxx subpatterns in regular expressions. Set this to false if your PCRE lib is up to date

See also
GeSHi->optimize_regexp_list()

Definition at line 189 of file geshi.php.

Referenced by GeSHi\optimize_regexp_list().

◆ GESHI_MAYBE

const GESHI_MAYBE 1

Strict mode might apply, and can be enabled or disabled by GeSHi->enable_strict_mode().

Definition at line 127 of file geshi.php.

Referenced by GeSHi\enable_strict_mode(), and GeSHi\parse_code().

◆ GESHI_MODIFIERS

const GESHI_MODIFIERS 2

The key of the regex array defining any modifiers to the regular expression.

Definition at line 138 of file geshi.php.

Referenced by GeSHi\parse_non_string_part().

◆ GESHI_NEVER

const GESHI_NEVER 0

#+ private

Strict mode never applies (this is the most common)

Definition at line 124 of file geshi.php.

Referenced by GeSHi\enable_strict_mode(), GeSHi\load_language(), and GeSHi\set_language().

◆ GESHI_NO_LINE_NUMBERS

const GESHI_NO_LINE_NUMBERS(!defined( 'GESHI_SECURITY_PARANOID')) 0

Use no line numbers when building the result.

Definition at line 63 of file geshi.php.

Referenced by GeSHi\enable_line_numbers(), GeSHi\finalise(), GeSHi\footer(), GeSHi\get_stylesheet(), GeSHi\header(), GeSHi\indent(), GeSHi\parse_code(), and GeSHi\parse_non_string_part().

◆ GESHI_NORMAL_LINE_NUMBERS

const GESHI_NORMAL_LINE_NUMBERS 1

Use normal line numbers when building the result.

Definition at line 65 of file geshi.php.

Referenced by GeSHi\enable_line_numbers().

◆ GESHI_NUMBER_BIN_PREFIX_0B

const GESHI_NUMBER_BIN_PREFIX_0B 64

Number format to highlight binary numbers with a prefix 0b (C)

Definition at line 207 of file geshi.php.

Referenced by GeSHi\build_parse_cache().

◆ GESHI_NUMBER_BIN_PREFIX_PERCENT

const GESHI_NUMBER_BIN_PREFIX_PERCENT 32

Number format to highlight binary numbers with a prefix %.

Definition at line 205 of file geshi.php.

Referenced by GeSHi\build_parse_cache().

◆ GESHI_NUMBER_BIN_SUFFIX

const GESHI_NUMBER_BIN_SUFFIX 16

Number format to highlight binary numbers with a suffix "b".

Definition at line 203 of file geshi.php.

Referenced by GeSHi\build_parse_cache().

◆ GESHI_NUMBER_FLT_NONSCI

const GESHI_NUMBER_FLT_NONSCI 65536

Number format to highlight floating-point numbers without support for scientific notation.

Definition at line 223 of file geshi.php.

Referenced by GeSHi\build_parse_cache(), and GeSHi\build_style_cache().

◆ GESHI_NUMBER_FLT_NONSCI_F

const GESHI_NUMBER_FLT_NONSCI_F 131072

Number format to highlight floating-point numbers without support for scientific notation.

Definition at line 225 of file geshi.php.

Referenced by GeSHi\build_parse_cache().

◆ GESHI_NUMBER_FLT_SCI_SHORT

const GESHI_NUMBER_FLT_SCI_SHORT 262144

Number format to highlight floating-point numbers with support for scientific notation (E) and optional leading zero.

Definition at line 227 of file geshi.php.

Referenced by GeSHi\build_parse_cache().

◆ GESHI_NUMBER_FLT_SCI_ZERO

const GESHI_NUMBER_FLT_SCI_ZERO 524288

Number format to highlight floating-point numbers with support for scientific notation (E) and required leading digit.

Definition at line 229 of file geshi.php.

Referenced by GeSHi\build_parse_cache().

◆ GESHI_NUMBER_HEX_PREFIX

const GESHI_NUMBER_HEX_PREFIX 4096

Number format to highlight hex numbers with a prefix 0x.

Definition at line 217 of file geshi.php.

Referenced by GeSHi\build_parse_cache().

◆ GESHI_NUMBER_HEX_PREFIX_DOLLAR

const GESHI_NUMBER_HEX_PREFIX_DOLLAR 8192

Number format to highlight hex numbers with a prefix $.

Definition at line 219 of file geshi.php.

Referenced by GeSHi\build_parse_cache().

◆ GESHI_NUMBER_HEX_SUFFIX

const GESHI_NUMBER_HEX_SUFFIX 16384

Number format to highlight hex numbers with a suffix of h.

Definition at line 221 of file geshi.php.

Referenced by GeSHi\build_parse_cache().

◆ GESHI_NUMBER_INT_BASIC

const GESHI_NUMBER_INT_BASIC 1

Basic number format for integers.

Definition at line 199 of file geshi.php.

Referenced by GeSHi\build_parse_cache(), and GeSHi\build_style_cache().

◆ GESHI_NUMBER_INT_CSTYLE

const GESHI_NUMBER_INT_CSTYLE 2

Enhanced number format for integers like seen in C.

Definition at line 201 of file geshi.php.

Referenced by GeSHi\build_parse_cache().

◆ GESHI_NUMBER_OCT_PREFIX

const GESHI_NUMBER_OCT_PREFIX 256

Number format to highlight octal numbers with a leading zero.

Definition at line 209 of file geshi.php.

Referenced by GeSHi\build_parse_cache().

◆ GESHI_NUMBER_OCT_PREFIX_0O

const GESHI_NUMBER_OCT_PREFIX_0O 512

Number format to highlight octal numbers with a prefix 0o (logtalk)

Definition at line 211 of file geshi.php.

Referenced by GeSHi\build_parse_cache().

◆ GESHI_NUMBER_OCT_PREFIX_AT

const GESHI_NUMBER_OCT_PREFIX_AT 1024

Number format to highlight octal numbers with a leading @ (Used in HiSofts Devpac series).

Definition at line 213 of file geshi.php.

Referenced by GeSHi\build_parse_cache().

◆ GESHI_NUMBER_OCT_SUFFIX

const GESHI_NUMBER_OCT_SUFFIX 2048

Number format to highlight octal numbers with a suffix of o.

Definition at line 215 of file geshi.php.

Referenced by GeSHi\build_parse_cache().

◆ GESHI_PHP_PRE_433

const GESHI_PHP_PRE_433 !(version_compare(PHP_VERSION, '4.3.3') === 1)

Used to work around missing PHP features.

Definition at line 153 of file geshi.php.

Referenced by GeSHi\parse_code().

◆ GESHI_REPLACE

const GESHI_REPLACE 1

The key of the regex array defining what bracket group in a matched search to use as a replacement.

Definition at line 136 of file geshi.php.

Referenced by GeSHi\parse_non_string_part().

◆ GESHI_SEARCH

const GESHI_SEARCH 0

The key of the regex array defining what to search for.

Definition at line 133 of file geshi.php.

Referenced by GeSHi\parse_non_string_part().

◆ GESHI_START_IMPORTANT

const GESHI_START_IMPORTANT '<BEGIN GeSHi>'

The starter for important parts of the source.

Definition at line 115 of file geshi.php.

Referenced by GeSHi\finalise(), and GeSHi\parse_code().

◆ GESHI_VERSION

const GESHI_VERSION '1.0.8.12'

The version of this GeSHi file.

Definition at line 44 of file geshi.php.

Referenced by GeSHi\get_version(), and GeSHi\replace_keywords().

◆ GESHI_VISITED

const GESHI_VISITED 3

Links in the source in the :visited state.

Definition at line 109 of file geshi.php.

Referenced by GeSHi\get_stylesheet().