Joomla CMS  2.5.24 (avec JPlatform 11.4 inclus)
Documentation des API du CMS Joomla en version 2.5 et du framework Joomla Platform intégré
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
Référence de la classe GeSHi

Liste de tous les membres

Fonctions membres publiques

 GeSHi ($source= '', $language= '', $path= '')
 error ()
 get_language_name ()
 set_source ($source)
 set_language ($language, $force_reset=false)
 set_language_path ($path)
 get_supported_languages ($full_names=false)
 get_language_fullname ($language)
 set_header_type ($type)
 set_overall_style ($style, $preserve_defaults=false)
 set_overall_class ($class)
 set_overall_id ($id)
 enable_classes ($flag=true)
 set_code_style ($style, $preserve_defaults=false)
 set_line_style ($style1, $style2= '', $preserve_defaults=false)
 enable_line_numbers ($flag, $nth_row=5)
 enable_multiline_span ($flag)
 get_multiline_span ()
 set_keyword_group_style ($key, $style, $preserve_defaults=false)
 set_keyword_group_highlighting ($key, $flag=true)
 set_comments_style ($key, $style, $preserve_defaults=false)
 set_comments_highlighting ($key, $flag=true)
 set_escape_characters_style ($style, $preserve_defaults=false, $group=0)
 set_escape_characters_highlighting ($flag=true)
 set_brackets_style ($style, $preserve_defaults=false)
 set_brackets_highlighting ($flag)
 set_symbols_style ($style, $preserve_defaults=false, $group=0)
 set_symbols_highlighting ($flag)
 set_strings_style ($style, $preserve_defaults=false, $group=0)
 set_strings_highlighting ($flag)
 set_script_style ($style, $preserve_defaults=false, $group=0)
 set_numbers_style ($style, $preserve_defaults=false, $group=0)
 set_numbers_highlighting ($flag)
 set_methods_style ($key, $style, $preserve_defaults=false)
 set_methods_highlighting ($flag)
 set_regexps_style ($key, $style, $preserve_defaults=false)
 set_regexps_highlighting ($key, $flag)
 set_case_sensitivity ($key, $case)
 set_case_keywords ($case)
 set_tab_width ($width)
 set_use_language_tab_width ($use)
 get_real_tab_width ()
 enable_strict_mode ($mode=true)
 disable_highlighting ()
 enable_highlighting ($flag=true)
 get_language_name_from_extension ($extension, $lookup=array())
 load_from_file ($file_name, $lookup=array())
 add_keyword ($key, $word)
 remove_keyword ($key, $word, $recompile=true)
 add_keyword_group ($key, $styles, $case_sensitive=true, $words=array())
 remove_keyword_group ($key)
 optimize_keyword_group ($key)
 set_header_content ($content)
 set_footer_content ($content)
 set_header_content_style ($style)
 set_footer_content_style ($style)
 enable_inner_code_block ($flag)
 set_url_for_keyword_group ($group, $url)
 set_link_styles ($type, $styles)
 set_link_target ($target)
 set_important_styles ($styles)
 enable_important_blocks ($flag)
 enable_ids ($flag=true)
 highlight_lines_extra ($lines, $style=null)
 set_highlight_lines_extra_style ($styles)
 set_line_ending ($line_ending)
 start_line_numbers_at ($number)
 set_encoding ($encoding)
 enable_keyword_links ($enable=true)
 build_style_cache ()
 build_parse_cache ()
 parse_code ()
 indent (&$result)
 change_case ($instr)
 handle_keyword_replace ($match)
 handle_regexps_callback ($matches)
 handle_multiline_regexps ($matches)
 parse_non_string_part ($stuff_to_parse)
 set_time ($start_time, $end_time)
 get_time ()
 merge_arrays ()
 load_language ($file_name)
 finalise (&$parsed_code)
 header ()
 footer ()
 replace_keywords ($instr)
 hsc ($string, $quote_style=ENT_COMPAT)
 _genCSSName ($name)
 get_stylesheet ($economy_mode=true)
 get_line_style ($line)
 optimize_regexp_list ($list, $regexp_delimiter= '/')
 _optimize_regexp_list_tokens_to_string (&$tokens, $recursed=false)

Attributs publics

 $source = ''
 $language = ''
 $language_data = array()
 $language_path = GESHI_LANG_ROOT
 $error = false
 $error_messages
 $strict_mode = false
 $use_classes = false
 $header_type = GESHI_HEADER_PRE
 $lexic_permissions
 $time = 0
 $header_content = ''
 $footer_content = ''
 $header_content_style = ''
 $footer_content_style = ''
 $force_code_block = false
 $link_styles = array()
 $enable_important_blocks = false
 $important_styles = 'font-weight: bold; color: red;'
 $add_ids = false
 $highlight_extra_lines = array()
 $highlight_extra_lines_styles = array()
 $highlight_extra_lines_style = 'background-color: #ffc;'
 $line_ending = null
 $line_numbers_start = 1
 $overall_style = 'font-family:monospace;'
 $code_style = 'font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;'
 $overall_class = ''
 $overall_id = ''
 $line_style1 = 'font-weight: normal; vertical-align:top;'
 $line_style2 = 'font-weight: bold; vertical-align:top;'
 $table_linenumber_style = 'width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;'
 $line_numbers = GESHI_NO_LINE_NUMBERS
 $allow_multiline_span = true
 $line_nth_row = 0
 $tab_width = 8
 $use_language_tab_width = false
 $link_target = ''
 $encoding = 'utf-8'
 $keyword_links = true
 $loaded_language = ''
 $parse_cache_built = false
 $_kw_replace_group = 0
 $_rx_key = 0
 $_hmr_before = ''
 $_hmr_replace = ''
 $_hmr_after = ''
 $_hmr_key = 0

Documentation des fonctions membres

GeSHi::_genCSSName (   $name)

Références $name.

Référencé par get_stylesheet(), et header().

+ Voici le graphe des appelants de cette fonction :

GeSHi::_optimize_regexp_list_tokens_to_string ( $tokens,
  $recursed = false 
)

this function creates the appropriate regexp string of an token array you should not call this function directly,

Voir également:
$this->optimize_regexp_list().
Paramètres:
&$tokensarray of tokens
$recursedbool to know wether we recursed or not
Renvoie:
string
Auteur:
Milian Wolff mail@.nosp@m.mili.nosp@m.anw.d.nosp@m.e
Depuis:
1.0.8 private

Références $list.

Référencé par optimize_regexp_list().

+ Voici le graphe des appelants de cette fonction :

GeSHi::add_keyword (   $key,
  $word 
)

Adds a keyword to a keyword group for highlighting

Paramètres:
intThe key of the keyword group to add the keyword to
stringThe word to add to the keyword group
Depuis:
1.0.0

Références $key.

GeSHi::add_keyword_group (   $key,
  $styles,
  $case_sensitive = true,
  $words = array() 
)

Creates a new keyword group

Paramètres:
intThe key of the keyword group to create
stringThe styles for the keyword group
booleanWhether the keyword group is case sensitive ornot
arrayThe words to use for the keyword group
Depuis:
1.0.0

Références $key, et optimize_keyword_group().

+ Voici le graphe d'appel pour cette fonction :

GeSHi::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.

Depuis:
1.0.8 private

Références $i, $key, build_style_cache(), elseif, GESHI_NUMBER_BIN_PREFIX_0B, GESHI_NUMBER_BIN_PREFIX_PERCENT, GESHI_NUMBER_BIN_SUFFIX, GESHI_NUMBER_FLT_NONSCI, GESHI_NUMBER_FLT_NONSCI_F, GESHI_NUMBER_FLT_SCI_SHORT, GESHI_NUMBER_FLT_SCI_ZERO, GESHI_NUMBER_HEX_PREFIX, GESHI_NUMBER_HEX_PREFIX_DOLLAR, GESHI_NUMBER_HEX_SUFFIX, GESHI_NUMBER_INT_BASIC, GESHI_NUMBER_INT_CSTYLE, GESHI_NUMBER_OCT_PREFIX, GESHI_NUMBER_OCT_PREFIX_0O, GESHI_NUMBER_OCT_PREFIX_AT, GESHI_NUMBER_OCT_SUFFIX, hsc(), et optimize_keyword_group().

Référencé par parse_code().

+ Voici le graphe d'appel pour cette fonction :

+ Voici le graphe des appelants de cette fonction :

GeSHi::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

Depuis:
1.0.8 private

Références $i, GESHI_NUMBER_FLT_NONSCI, et GESHI_NUMBER_INT_BASIC.

Référencé par build_parse_cache(), et get_stylesheet().

+ Voici le graphe des appelants de cette fonction :

GeSHi::change_case (   $instr)

Changes the case of a keyword for those languages where a change is asked for

Paramètres:
stringThe keyword to change the case of
Renvoie:
string The keyword with its case changed
Depuis:
1.0.0 private

Références GESHI_CAPS_LOWER, et GESHI_CAPS_UPPER.

Référencé par handle_keyword_replace(), et parse_code().

+ Voici le graphe des appelants de cette fonction :

GeSHi::disable_highlighting ( )

Disables all highlighting

Depuis:
1.0.0
Obsolète:
In favour of enable_highlighting

Références enable_highlighting().

+ Voici le graphe d'appel pour cette fonction :

GeSHi::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

Paramètres:
booleanWhether to turn classes on or not
Depuis:
1.0.0
GeSHi::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.

Depuis:
1.0.0
Paramètres:
booleanA flag specifying whether to enable or disable all highlighting

Références $key, et enable_important_blocks().

Référencé par disable_highlighting(), et load_language().

+ Voici le graphe d'appel pour cette fonction :

+ Voici le graphe des appelants de cette fonction :

GeSHi::enable_ids (   $flag = true)

Whether CSS IDs should be added to each line

Paramètres:
booleanIf true, IDs will be added to each line.
Depuis:
1.0.2
GeSHi::enable_important_blocks (   $flag)

Sets whether context-important blocks are highlighted

Paramètres:
booleanTells whether to enable or disable highlighting of important blocks
Obsolète:
Depuis:
1.0.2

Référencé par enable_highlighting(), finalise(), et parse_code().

+ Voici le graphe des appelants de cette fonction :

GeSHi::enable_inner_code_block (   $flag)

Sets whether to force a surrounding block around the highlighted code or not

Paramètres:
booleanTells whether to enable or disable this feature
Depuis:
1.0.7.20
GeSHi::enable_keyword_links (   $enable = true)

Turns linking of keywords on or off.

Paramètres:
booleanIf true, links will be added to keywords
Depuis:
1.0.2
GeSHi::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.

Paramètres:
intHow line numbers should be displayed
intDefines which lines are fancy
Depuis:
1.0.0

Références error(), GESHI_ERROR_INVALID_LINE_NUMBER_TYPE, GESHI_FANCY_LINE_NUMBERS, GESHI_NO_LINE_NUMBERS, et GESHI_NORMAL_LINE_NUMBERS.

+ Voici le graphe d'appel pour cette fonction :

GeSHi::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.

Paramètres:
booleanWether multiline spans are allowed or not
Depuis:
1.0.7.22
GeSHi::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.

Paramètres:
booleanWhether to enable strict mode or not
Depuis:
1.0.0

Références $mode, GESHI_ALWAYS, GESHI_MAYBE, et GESHI_NEVER.

GeSHi::error ( )

Returns an error message associated with the last GeSHi operation, or false if no error has occured

Renvoie:
string|false An error message if there has been an error, else false
Depuis:
1.0.0

Références language.

Référencé par enable_line_numbers(), get_language_fullname(), get_language_name(), get_stylesheet(), load_from_file(), parse_code(), set_header_type(), et set_language().

+ Voici le graphe des appelants de cette fonction :

GeSHi::finalise ( $parsed_code)

Takes the parsed code and various options, and creates the HTML surrounding it to make it look nice.

Paramètres:
stringThe code already parsed (reference!)
Depuis:
1.0.0 private

NOTE: memorypeak #1

NOTE: memorypeak #2

Références $i, $key, $line_style1, $line_style2, $n, elseif, enable_important_blocks(), footer(), GESHI_END_IMPORTANT, GESHI_FANCY_LINE_NUMBERS, GESHI_HEADER_PRE, GESHI_HEADER_PRE_TABLE, GESHI_HEADER_PRE_VALID, GESHI_NO_LINE_NUMBERS, GESHI_START_IMPORTANT, get_line_style(), header(), hsc(), et indent().

Référencé par parse_code().

+ Voici le graphe d'appel pour cette fonction :

+ Voici le graphe des appelants de cette fonction :

GeSHi::footer ( )

Returns the footer for the code block.

Renvoie:
string The footer for the code block
Depuis:
1.0.0 private

Références $footer_content, elseif, GESHI_HEADER_DIV, GESHI_HEADER_NONE, GESHI_HEADER_PRE, GESHI_HEADER_PRE_TABLE, GESHI_HEADER_PRE_VALID, GESHI_NO_LINE_NUMBERS, et replace_keywords().

Référencé par finalise().

+ Voici le graphe d'appel pour cette fonction :

+ Voici le graphe des appelants de cette fonction :

GeSHi::GeSHi (   $source = '',
  $language = '',
  $path = '' 
)

#@- Creates a new GeSHi object, with source and language

Paramètres:
stringThe source code to highlight
stringThe language to highlight the source with
stringThe path to the language file directory. This is deprecated! I've backported the auto path detection from the 1.1.X dev branch, so now it should be automatically set correctly. If you have renamed the language directory however, you will still need to set the path using this parameter or GeSHi->set_language_path()
Depuis:
1.0.0

Références $language, $path, $source, set_language(), set_language_path(), et set_source().

+ Voici le graphe d'appel pour cette fonction :

GeSHi::get_language_fullname (   $language)

Get full_name for a lang or false.

Paramètres:
string$languageshort langname (html4strict for example)
Renvoie:
mixed

Références $data, $language, et error().

Référencé par get_supported_languages().

+ Voici le graphe d'appel pour cette fonction :

+ Voici le graphe des appelants de cette fonction :

GeSHi::get_language_name ( )

Gets a human-readable language name (thanks to Simon Patterson for the idea :))

Renvoie:
string The name for the current language
Depuis:
1.0.2

Références error(), et GESHI_ERROR_NO_SUCH_LANG.

+ Voici le graphe d'appel pour cette fonction :

GeSHi::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

Paramètres:
stringThe extension to get a language name for
arrayA lookup array to use instead of the default one
Depuis:
1.0.5

Références $extension, et $lang.

Référencé par load_from_file().

+ Voici le graphe des appelants de cette fonction :

GeSHi::get_line_style (   $line)

Get's the style that is used for the specified line

Paramètres:
intThe line number information is requested for private
Depuis:
1.0.7.21

Références $highlight_extra_lines_style, $style, et null.

Référencé par finalise().

+ Voici le graphe des appelants de cette fonction :

GeSHi::get_multiline_span ( )

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

Voir également:
enable_multiline_span
Renvoie:
bool

Références $allow_multiline_span.

GeSHi::get_real_tab_width ( )

Returns the tab width to use, based on the current language and user preference

Renvoie:
int Tab width
Depuis:
1.0.7.20

Références $tab_width.

Référencé par indent().

+ Voici le graphe des appelants de cette fonction :

GeSHi::get_stylesheet (   $economy_mode = true)

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

Paramètres:
booleanWhether to use economy mode or not
Renvoie:
string A stylesheet built on the data for the current language
Depuis:
1.0.0

Références $key, $style, _genCSSName(), build_style_cache(), error(), GESHI_ACTIVE, GESHI_CLASS, GESHI_FANCY_LINE_NUMBERS, GESHI_HOVER, GESHI_LINK, GESHI_NO_LINE_NUMBERS, GESHI_VISITED, et language.

+ Voici le graphe d'appel pour cette fonction :

GeSHi::get_supported_languages (   $full_names = false)

Get supported langs or an associative array lang=>full_name.

Paramètres:
boolean$longnames
Renvoie:
array

Références get_language_fullname().

+ Voici le graphe d'appel pour cette fonction :

GeSHi::get_time ( )

Gets the time taken to parse the code

Renvoie:
double The time taken to parse the code
Depuis:
1.0.2

Références $time.

Référencé par replace_keywords().

+ Voici le graphe des appelants de cette fonction :

GeSHi::handle_keyword_replace (   $match)

Handles replacements of keywords to include markup and links if requested

Paramètres:
stringThe keyword to add the Markup to
Renvoie:
The HTML for the match found
Depuis:
1.0.8 private

Références $_kw_replace_group, change_case(), et hsc().

+ Voici le graphe d'appel pour cette fonction :

GeSHi::handle_multiline_regexps (   $matches)

handles newlines in REGEXPS matches. Set the hmr* vars before calling this

Note:
this is a callback, don't use it directly
Paramètres:
arraythe matches array
Renvoie:
string
Depuis:
1.0.8 private

Références $_hmr_after, $_hmr_before, et $_hmr_replace.

GeSHi::handle_regexps_callback (   $matches)

handles regular expressions highlighting-definitions with callback functions

Note:
this is a callback, don't use it directly
Paramètres:
arraythe matches array
Renvoie:
The highlighted string
Depuis:
1.0.8 private
GeSHi::header ( )

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

Renvoie:
string The header for the code block
Depuis:
1.0.0 private

Références $header_content, _genCSSName(), elseif, GESHI_HEADER_DIV, GESHI_HEADER_NONE, GESHI_HEADER_PRE, GESHI_HEADER_PRE_TABLE, GESHI_HEADER_PRE_VALID, GESHI_NO_LINE_NUMBERS, language, et replace_keywords().

Référencé par finalise().

+ Voici le graphe d'appel pour cette fonction :

+ Voici le graphe des appelants de cette fonction :

GeSHi::highlight_lines_extra (   $lines,
  $style = null 
)

Specifies which lines to highlight extra

The extra style parameter was added in 1.0.7.21.

Paramètres:
mixedAn array of line numbers to highlight, or just a line number on its own.
stringA string specifying the style to use for this line. If null is specified, the default style is used. If false is specified, the line will be removed from special highlighting
Depuis:
1.0.2

Références $style, elseif, et null.

GeSHi::hsc (   $string,
  $quote_style = ENT_COMPAT 
)

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.

Auteur:
Marjolein Katsma

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

private

Paramètres:
string$stringstring to be converted
integer$quote_style
  • ENT_COMPAT: escapes &, <, > and double quote (default)
  • ENT_NOQUOTES: escapes only &, < and >
  • ENT_QUOTES: escapes &, <, >, double and single quotes
Renvoie:
string converted string
Depuis:
1.0.7.18

Références ENT_QUOTES.

Référencé par build_parse_cache(), finalise(), handle_keyword_replace(), parse_code(), et parse_non_string_part().

+ Voici le graphe des appelants de cette fonction :

GeSHi::indent ( $result)

Swaps out spaces and tabs for HTML indentation. Not needed if the code is in a pre block...

Paramètres:
stringThe source to indent (reference!)
Depuis:
1.0.0 private

Replace tabs with the correct number of spaces

Références $i, $key, $n, $tab_width, elseif, GESHI_HEADER_PRE_TABLE, GESHI_NO_LINE_NUMBERS, get_real_tab_width(), et null.

Référencé par finalise().

+ Voici le graphe d'appel pour cette fonction :

+ Voici le graphe des appelants de cette fonction :

GeSHi::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' ...
 );
Paramètres:
stringThe filename to load the source from
arrayA lookup array to use instead of the default one
Depuis:
1.0.5

Références error(), GESHI_ERROR_FILE_NOT_READABLE, get_language_name_from_extension(), set_language(), et set_source().

+ Voici le graphe d'appel pour cette fonction :

GeSHi::load_language (   $file_name)

Gets language information and stores it for later use

Paramètres:
stringThe filename of the language file you want to load
Depuis:
1.0.0 private

Références $key, $language_data, enable_highlighting(), GESHI_NEVER, et merge_arrays().

Référencé par set_language().

+ Voici le graphe d'appel pour cette fonction :

+ Voici le graphe des appelants de cette fonction :

GeSHi::merge_arrays ( )

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

Depuis:
1.0.8 private

Références $i, et $key.

Référencé par load_language().

+ Voici le graphe des appelants de cette fonction :

GeSHi::optimize_keyword_group (   $key)

compile optimized regexp list for keyword group

Paramètres:
intThe key of the keyword group to compile & optimize
Depuis:
1.0.8

Références $key, et optimize_regexp_list().

Référencé par add_keyword_group(), build_parse_cache(), et remove_keyword().

+ Voici le graphe d'appel pour cette fonction :

+ Voici le graphe des appelants de cette fonction :

GeSHi::optimize_regexp_list (   $list,
  $regexp_delimiter = '/' 
)

this functions creates an optimized regular expression list of an array of strings.

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

Paramètres:
$listarray of (unquoted) strings
$regexp_delimiteryour regular expression delimiter,
Voir également:
preg_quote()
Renvoie:
string for regular expression
Auteur:
Milian Wolff mail@.nosp@m.mili.nosp@m.anw.d.nosp@m.e
Depuis:
1.0.8 private

Références $i, $list, _optimize_regexp_list_tokens_to_string(), GESHI_MAX_PCRE_LENGTH, et GESHI_MAX_PCRE_SUBPATTERNS.

Référencé par optimize_keyword_group().

+ Voici le graphe d'appel pour cette fonction :

+ Voici le graphe des appelants de cette fonction :

GeSHi::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

Depuis:
1.0.0

The value in $delimiters is expected to be an RegExp containing exactly 2 matching groups:

  • Group 1 is the opener
  • Group 2 is the closer

NOTE: memorypeak #3

Références $allow_multiline_span, $i, $key, $parts, build_parse_cache(), change_case(), elseif, enable_important_blocks(), error(), finalise(), GESHI_COMMENTS, GESHI_END_IMPORTANT, GESHI_MAYBE, GESHI_NO_LINE_NUMBERS, GESHI_PHP_PRE_433, GESHI_START_IMPORTANT, hsc(), null, parse_non_string_part(), et set_time().

+ Voici le graphe d'appel pour cette fonction :

GeSHi::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.

Paramètres:
stringThe string to parse for keyword, numbers etc.
Depuis:
1.0.0 private

Références $id, $key, GESHI_AFTER, GESHI_BEFORE, GESHI_CLASS, GESHI_LINK, GESHI_MODIFIERS, GESHI_NO_LINE_NUMBERS, GESHI_REPLACE, GESHI_SEARCH, et hsc().

Référencé par parse_code().

+ Voici le graphe d'appel pour cette fonction :

+ Voici le graphe des appelants de cette fonction :

GeSHi::remove_keyword (   $key,
  $word,
  $recompile = true 
)

Removes a keyword from a keyword group

Paramètres:
intThe key of the keyword group to remove the keyword from
stringThe word to remove from the keyword group
boolWether to automatically recompile the optimized regexp list or not. Note: if you set this to false and
Voir également:
GeSHi->parse_code() was already called once, for the current language, you have to manually call
GeSHi->optimize_keyword_group() or the removed keyword will stay in cache and still be highlighted! On the other hand it might be too expensive to recompile the regexp list for every removal if you want to remove a lot of keywords.
Depuis:
1.0.0

Références $key, et optimize_keyword_group().

+ Voici le graphe d'appel pour cette fonction :

GeSHi::remove_keyword_group (   $key)

Removes a keyword group

Paramètres:
intThe key of the keyword group to remove
Depuis:
1.0.0

Références $key.

GeSHi::replace_keywords (   $instr)

Replaces certain keywords in the header and footer with certain configuration values

Paramètres:
stringThe header or footer content to do replacement on
Renvoie:
string The header or footer with replaced keywords
Depuis:
1.0.2 private

Références $time, GESHI_VERSION, et get_time().

Référencé par footer(), et header().

+ Voici le graphe d'appel pour cette fonction :

+ Voici le graphe des appelants de cette fonction :

GeSHi::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

Paramètres:
booleanWhether to turn highlighting for brackets on or off
Depuis:
1.0.0
Obsolète:
In favour of set_symbols_highlighting

Référencé par set_symbols_highlighting().

+ Voici le graphe des appelants de cette fonction :

GeSHi::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

Paramètres:
stringThe style to make the brackets
booleanWhether to merge the new styles with the old or just to overwrite them
Depuis:
1.0.0
Obsolète:
In favour of set_symbols_style

Références $style.

Référencé par set_symbols_style().

+ Voici le graphe des appelants de cette fonction :

GeSHi::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
Paramètres:
intA constant specifying what to do with matched keywords
Depuis:
1.0.1

Références GESHI_CAPS_LOWER, GESHI_CAPS_NO_CHANGE, et GESHI_CAPS_UPPER.

GeSHi::set_case_sensitivity (   $key,
  $case 
)

Sets whether a set of keywords are checked for in a case sensitive manner

Paramètres:
intThe key of the keyword group to change the case sensitivity of
booleanWhether to check in a case sensitive manner or not
Depuis:
1.0.0

Références $key.

GeSHi::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.

Paramètres:
stringThe style to use for actual code
booleanWhether to merge the current styles with the new styles
Depuis:
1.0.2

Références $style.

GeSHi::set_comments_highlighting (   $key,
  $flag = true 
)

Turns highlighting on/off for comment groups

Paramètres:
intThe key of the comment group to turn on or off
booleanWhether to turn highlighting for that group on or off
Depuis:
1.0.0

Références $key.

GeSHi::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

Paramètres:
intThe key of the comment group to change the styles of
stringThe style to make the comments
booleanWhether to merge the new styles with the old or just to overwrite them
Depuis:
1.0.0

Références $key, et $style.

GeSHi::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.

Paramètres:
stringThe encoding to use for the source
Depuis:
1.0.3

Références $encoding.

GeSHi::set_escape_characters_highlighting (   $flag = true)

Turns highlighting on/off for escaped characters

Paramètres:
booleanWhether to turn highlighting for escape characters on or off
Depuis:
1.0.0
GeSHi::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

Paramètres:
stringThe style to make the escape characters
booleanWhether to merge the new styles with the old or just to overwrite them
Depuis:
1.0.0

Références $style.

GeSHi::set_footer_content (   $content)

Sets the content of the footer block

Paramètres:
stringThe content of the footer block
Depuis:
1.0.2
GeSHi::set_footer_content_style (   $style)

Sets the style for the footer content

Paramètres:
stringThe style for the footer content
Depuis:
1.0.2

Références $style.

GeSHi::set_header_content (   $content)

Sets the content of the header block

Paramètres:
stringThe content of the header block
Depuis:
1.0.2
GeSHi::set_header_content_style (   $style)

Sets the style for the header content

Paramètres:
stringThe style for the header content
Depuis:
1.0.2

Références $style.

GeSHi::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.

Paramètres:
intThe type of header to be used
Depuis:
1.0.0

Références $type, error(), GESHI_ERROR_INVALID_HEADER_TYPE, GESHI_HEADER_DIV, GESHI_HEADER_NONE, GESHI_HEADER_PRE, GESHI_HEADER_PRE_TABLE, et GESHI_HEADER_PRE_VALID.

+ Voici le graphe d'appel pour cette fonction :

GeSHi::set_highlight_lines_extra_style (   $styles)

Sets the style for extra-highlighted lines

Paramètres:
stringThe style for extra-highlighted lines
Depuis:
1.0.2
GeSHi::set_important_styles (   $styles)

Sets styles for important parts of the code

Paramètres:
stringThe styles to use on important parts of the code
Depuis:
1.0.2
GeSHi::set_keyword_group_highlighting (   $key,
  $flag = true 
)

Turns highlighting on/off for a keyword group

Paramètres:
intThe key of the keyword group to turn on or off
booleanWhether to turn highlighting for that group on or off
Depuis:
1.0.0

Références $key.

GeSHi::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

Paramètres:
intThe key of the keyword group to change the styles of
stringThe style to make the keywords
booleanWhether to merge the new styles with the old or just to overwrite them
Depuis:
1.0.0

Références $key, et $style.

GeSHi::set_language (   $language,
  $force_reset = false 
)

Sets the language for this object

Note:
since 1.0.8 this function won't reset language-settings by default anymore! if you need this set $force_reset = true
Paramètres:
stringThe name of the language to use
Depuis:
1.0.0

Références $language, error(), GESHI_ERROR_NO_SUCH_LANG, GESHI_NEVER, language, et load_language().

Référencé par GeSHi(), load_from_file(), et set_language_path().

+ Voici le graphe d'appel pour cette fonction :

+ Voici le graphe des appelants de cette fonction :

GeSHi::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.

Paramètres:
stringThe path to the language directory
Depuis:
1.0.0
Obsolète:
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.

Références $path, DIRECTORY_SEPARATOR, language, et set_language().

Référencé par GeSHi().

+ Voici le graphe d'appel pour cette fonction :

+ Voici le graphe des appelants de cette fonction :

GeSHi::set_line_ending (   $line_ending)

Sets the line-ending

Paramètres:
stringThe new line-ending
Depuis:
1.0.2

Références $line_ending.

GeSHi::set_line_style (   $style1,
  $style2 = '',
  $preserve_defaults = false 
)

Sets the styles for the line numbers.

Paramètres:
stringThe style for the line numbers that are "normal"
string|booleanIf a string, this is the style of the line numbers that are "fancy", otherwise if boolean then this defines whether the normal styles should be merged with the new normal styles or not
booleanIf set, is the flag for whether to merge the "fancy" styles with the current styles or not
Depuis:
1.0.2
GeSHi::set_link_styles (   $type,
  $styles 
)

Sets styles for links in code

Paramètres:
intA constant that specifies what state the style is being set for - e.g. :hover or :visited
stringThe styles to use for that state
Depuis:
1.0.2

Références $type.

GeSHi::set_link_target (   $target)

Sets the target for links in code

Paramètres:
stringThe target for links in the code, e.g. _blank
Depuis:
1.0.3

Références $target.

GeSHi::set_methods_highlighting (   $flag)

Turns highlighting on/off for methods

Paramètres:
booleanWhether to turn highlighting for methods on or off
Depuis:
1.0.0
GeSHi::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

Paramètres:
intThe key of the object splitter to change the styles of
stringThe style to make the methods
booleanWhether to merge the new styles with the old or just to overwrite them
Depuis:
1.0.0

Références $key, et $style.

GeSHi::set_numbers_highlighting (   $flag)

Turns highlighting on/off for numbers

Paramètres:
booleanWhether to turn highlighting for numbers on or off
Depuis:
1.0.0
GeSHi::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

Paramètres:
stringThe style to make the numbers
booleanWhether to merge the new styles with the old or just to overwrite them
intTells the group of numbers for which style should be set.
Depuis:
1.0.0

Références $style.

GeSHi::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

Paramètres:
stringThe class name to use for this block of code
Depuis:
1.0.0

Références $class.

GeSHi::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

Paramètres:
stringThe ID to use for this block of code
Depuis:
1.0.0

Références $id.

GeSHi::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

Paramètres:
stringThe overall style for the outputted code block
booleanWhether to merge the styles with the current styles or not
Depuis:
1.0.0

Références $style.

GeSHi::set_regexps_highlighting (   $key,
  $flag 
)

Turns highlighting on/off for regexps

Paramètres:
intThe key of the regular expression group to turn on or off
booleanWhether to turn highlighting for the regular expression group on or off
Depuis:
1.0.0

Références $key.

GeSHi::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

Paramètres:
stringThe style to make the regular expression matches
booleanWhether to merge the new styles with the old or just to overwrite them
Depuis:
1.0.0

Références $key, et $style.

GeSHi::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

Paramètres:
stringThe style to make the script blocks
booleanWhether to merge the new styles with the old or just to overwrite them
intTells the group of script blocks for which style should be set.
Depuis:
1.0.8.4

Références $style.

GeSHi::set_source (   $source)

Sets the source code for this object

Paramètres:
stringThe source code to highlight
Depuis:
1.0.0

Références $source.

Référencé par GeSHi(), et load_from_file().

+ Voici le graphe des appelants de cette fonction :

GeSHi::set_strings_highlighting (   $flag)

Turns highlighting on/off for strings

Paramètres:
booleanWhether to turn highlighting for strings on or off
Depuis:
1.0.0
GeSHi::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

Paramètres:
stringThe style to make the escape characters
booleanWhether to merge the new styles with the old or just to overwrite them
intTells the group of strings for which style should be set.
Depuis:
1.0.0

Références $style.

GeSHi::set_symbols_highlighting (   $flag)

Turns highlighting on/off for symbols

Paramètres:
booleanWhether to turn highlighting for symbols on or off
Depuis:
1.0.0

Références set_brackets_highlighting().

+ Voici le graphe d'appel pour cette fonction :

GeSHi::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

Paramètres:
stringThe style to make the symbols
booleanWhether to merge the new styles with the old or just to overwrite them
intTells the group of symbols for which style should be set.
Depuis:
1.0.1

Références $style, et set_brackets_style().

+ Voici le graphe d'appel pour cette fonction :

GeSHi::set_tab_width (   $width)

Sets how many spaces a tab is substituted for

Widths below zero are ignored

Paramètres:
intThe tab width
Depuis:
1.0.0

Références $width.

GeSHi::set_time (   $start_time,
  $end_time 
)

Sets the time taken to parse the code

Paramètres:
microtimeThe time when parsing started
microtimeThe time when parsing ended
Depuis:
1.0.2 private

Référencé par parse_code().

+ Voici le graphe des appelants de cette fonction :

GeSHi::set_url_for_keyword_group (   $group,
  $url 
)

Sets the base URL to be used for keywords

Paramètres:
intThe key of the keyword group to set the URL for
stringThe URL to set for the group. If {FNAME} is in the url somewhere, it is replaced by the keyword that the URL is being made for
Depuis:
1.0.2

Références $url.

GeSHi::set_use_language_tab_width (   $use)

Sets whether or not to use tab-stop width specifed by language

Paramètres:
booleanWhether to use language-specific tab-stop widths
Depuis:
1.0.7.20
GeSHi::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.

Paramètres:
intThe number to start line numbers at
Depuis:
1.0.2

Documentation des données membres

GeSHi::$_hmr_after = ''

Référencé par handle_multiline_regexps().

GeSHi::$_hmr_before = ''

Référencé par handle_multiline_regexps().

GeSHi::$_hmr_key = 0
GeSHi::$_hmr_replace = ''

Référencé par handle_multiline_regexps().

GeSHi::$_kw_replace_group = 0

Référencé par handle_keyword_replace().

GeSHi::$_rx_key = 0
GeSHi::$add_ids = false
GeSHi::$allow_multiline_span = true

Référencé par get_multiline_span(), et parse_code().

GeSHi::$code_style = 'font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;'
GeSHi::$enable_important_blocks = false
GeSHi::$encoding = 'utf-8'

Référencé par set_encoding().

GeSHi::$error = false
GeSHi::$error_messages
Valeur initiale :
array(
GESHI_ERROR_NO_SUCH_LANG => 'GeSHi could not find the language {LANGUAGE} (using path {PATH})',
GESHI_ERROR_FILE_NOT_READABLE => 'The file specified for load_from_file was not readable',
GESHI_ERROR_INVALID_HEADER_TYPE => 'The header type specified is invalid',
GESHI_ERROR_INVALID_LINE_NUMBER_TYPE => 'The line number type specified is invalid'
)
GeSHi::$footer_content = ''

Référencé par footer().

GeSHi::$footer_content_style = ''
GeSHi::$force_code_block = false
GeSHi::$header_content = ''

Référencé par header().

GeSHi::$header_content_style = ''
GeSHi::$header_type = GESHI_HEADER_PRE
GeSHi::$highlight_extra_lines = array()
GeSHi::$highlight_extra_lines_style = 'background-color: #ffc;'

Référencé par get_line_style().

GeSHi::$highlight_extra_lines_styles = array()
GeSHi::$important_styles = 'font-weight: bold; color: red;'
GeSHi::$keyword_links = true
GeSHi::$language = ''
GeSHi::$language_data = array()

Référencé par load_language().

GeSHi::$language_path = GESHI_LANG_ROOT
GeSHi::$lexic_permissions
Valeur initiale :
array(
'KEYWORDS' => array(),
'COMMENTS' => array('MULTI' => true),
'REGEXPS' => array(),
'ESCAPE_CHAR' => true,
'BRACKETS' => true,
'SYMBOLS' => false,
'STRINGS' => true,
'NUMBERS' => true,
'METHODS' => true,
'SCRIPT' => true
)
GeSHi::$line_ending = null

Référencé par set_line_ending().

GeSHi::$line_nth_row = 0
GeSHi::$line_numbers = GESHI_NO_LINE_NUMBERS
GeSHi::$line_numbers_start = 1
GeSHi::$line_style1 = 'font-weight: normal; vertical-align:top;'

Référencé par finalise().

GeSHi::$line_style2 = 'font-weight: bold; vertical-align:top;'

Référencé par finalise().

GeSHi::$link_styles = array()
GeSHi::$link_target = ''
GeSHi::$loaded_language = ''
GeSHi::$overall_class = ''
GeSHi::$overall_id = ''
GeSHi::$overall_style = 'font-family:monospace;'
GeSHi::$parse_cache_built = false
GeSHi::$source = ''

Référencé par GeSHi(), et set_source().

GeSHi::$strict_mode = false
GeSHi::$tab_width = 8

Référencé par get_real_tab_width(), et indent().

GeSHi::$table_linenumber_style = 'width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;'
GeSHi::$time = 0

Référencé par get_time(), et replace_keywords().

GeSHi::$use_classes = false
GeSHi::$use_language_tab_width = false

La documentation de cette classe a été générée à partir du fichier suivant :