📄 geshi.php
字号:
* method: set_escape_characters_style * ----------------------------------- * 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 */ function set_escape_characters_style ( $style, $preserve_defaults = false ) { if ( $preserve_defaults ) { $this->language_data['STYLES']['ESCAPE_CHAR'][0] .= $style; } else { $this->language_data['STYLES']['ESCAPE_CHAR'][0] = $style; } } /** * method: set_escape_characters_highlighting * ------------------------------------------ * Turns highlighting on/off for escaped characters */ function set_escape_characters_highlighting ( $flag = true ) { $this->lexic_permissions['ESCAPE_CHAR'] = ( $flag ) ? true : false; } /** * method: set_brackets_style * -------------------------- * 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 */ function set_brackets_style ( $style, $preserve_defaults = false ) { if ( $preserve_defaults ) { $this->language_data['STYLES']['BRACKETS'][0] .= $style; } else { $this->language_data['STYLES']['BRACKETS'][0] = $style; } } /** * method: set_brackets_highlighting * --------------------------------- * Turns highlighting on/off for brackets * * This method is DEPRECATED: use set_symbols_highlighting instead. * This method will be remove in 1.2.X */ function set_brackets_highlighting ( $flag ) { $this->lexic_permissions['BRACKETS'] = ( $flag ) ? true : false; } /** * method: set_symbols_style * -------------------------- * 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 */ function set_symbols_style ( $style, $preserve_defaults = false ) { if ( $preserve_defaults ) { $this->language_data['STYLES']['SYMBOLS'][0] .= $style; } else { $this->language_data['STYLES']['SYMBOLS'][0] = $style; } // For backward compatibility $this->set_brackets_style ( $style, $preserve_defaults ); } /** * method: set_symbols_highlighting * --------------------------------- * Turns highlighting on/off for symbols */ function set_symbols_highlighting ( $flag ) { $this->lexic_permissions['SYMBOLS'] = ( $flag ) ? true : false; // For backward compatibility $this->set_brackets_highlighting ( $flag ); } /** * method: set_strings_style * ------------------------- * 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 */ function set_strings_style ( $style, $preserve_defaults = false ) { if ( $preserve_defaults ) { $this->language_data['STYLES']['STRINGS'][0] .= $style; } else { $this->language_data['STYLES']['STRINGS'][0] = $style; } } /** * method: set_strings_highlighting * -------------------------------- * Turns highlighting on/off for strings */ function set_strings_highlighting ( $flag ) { $this->lexic_permissions['STRINGS'] = ( $flag ) ? true : false; } /** * method: set_numbers_style * ------------------------- * 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 */ function set_numbers_style ( $style, $preserve_defaults = false ) { if ( $preserve_defaults ) { $this->language_data['STYLES']['NUMBERS'][0] .= $style; } else { $this->language_data['STYLES']['NUMBERS'][0] = $style; } } /** * method: set_numbers_highlighting * -------------------------------- * Turns highlighting on/off for numbers */ function set_numbers_highlighting ( $flag ) { $this->lexic_permissions['NUMBERS'] = ( $flag ) ? true : false; } /** * method: set_methods_style * ------------------------- * 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 */ function set_methods_style ( $key, $style, $preserve_defaults = false ) { if ( $preserve_defaults ) { $this->language_data['STYLES']['METHODS'][$key] .= $style; } else { $this->language_data['STYLES']['METHODS'][$key] = $style; } } /** * method: set_methods_highlighting * -------------------------------- * Turns highlighting on/off for methods */ function set_methods_highlighting ( $flag ) { $this->lexic_permissions['METHODS'] = ( $flag ) ? true : false; } /** * method: set_regexps_style * ------------------------- * 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 */ function set_regexps_style ( $key, $style, $preserve_defaults = false ) { if ( $preserve_defaults ) { $this->language_data['STYLES']['REGEXPS'][$key] .= $style; } else { $this->language_data['STYLES']['REGEXPS'][$key] = $style; } } /** * method: set_regexps_highlighting * -------------------------------- * Turns highlighting on/off for regexps */ function set_regexps_highlighting ( $key, $flag ) { $this->lexic_permissions['REGEXPS'][$key] = ( $flag ) ? true : false; } /** * method: set_case_sensitivity * ---------------------------- * Sets whether a set of keywords are checked for in a case sensitive manner */ function set_case_sensitivity ( $key, $case ) { $this->language_data['CASE_SENSITIVE'][$key] = ( $case ) ? true : false; } /** * method: set_case_keywords * ------------------------- * 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 * Method added in 1.0.1 */ function set_case_keywords ( $case ) { $this->language_data['CASE_KEYWORDS'] = $case; } /** * method: set_tab_width * --------------------- * Sets how many spaces a tab is substituted for * This method will probably be re-engineered later to allow customisability * in the maximum and minimum number of tabs without mutulating data fields. */ function set_tab_width ( $width ) { if ( $width > $this->max_tabs ) $width = $this->max_tabs; if ( $width < $this->min_tabs ) $width = $this->min_tabs; $this->tab_width = $width; } /** * method: enable_strict_mode * -------------------------- * 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 */ function enable_strict_mode ( $mode = true ) { $this->strict_mode = ( $mode ) ? true : false; // Turn on strict mode no matter what if language should always // be in strict mode if ( $this->language_data['STRICT_MODE_APPLIES'] == GESHI_ALWAYS ) { $this->strict_mode = true; } // Turn off strict mode no matter what if language should never // be in strict mode elseif ( $this->language_data['STRICT_MODE_APPLIES'] == GESHI_NEVER ) { $this->strict_mode = false; } } /** * method: disable_highlighting * ---------------------------- * Disables all highlighting */ function disable_highlighting () { foreach ( $this->language_data['KEYWORDS'] as $key => $words ) { $this->lexic_permissions['KEYWORDS'][$key] = false; } foreach ( $this->language_data['COMMENT_SINGLE'] as $key => $comment ) { $this->lexic_permissions['COMMENTS'][$key] = false; } // Multiline comments $this->lexic_permissions['COMMENTS']['MULTI'] = false; // Escape characters $this->lexic_permissions['ESCAPE_CHAR'] = false; // Brackets $this->lexic_permissions['BRACKETS'] = false; // Strings $this->lexic_permissions['STRINGS'] = false; // Numbers $this->lexic_permissions['NUMBERS'] = false; // Methods $this->lexic_permissions['METHODS'] = false; // Symbols $this->lexic_permissions['SYMBOLS'] = false; // Script $this->lexic_permissions['SCRIPT'] = false; // Regexps foreach ( $this->language_data['REGEXPS'] as $key => $regexp ) { $this->lexic_permissions['REGEXPS'][$key] = false; } // Context blocks $this->enable_important_blocks = false; } /** * method: enable_highlighting * --------------------------- * Enables all highlighting */ function enable_highlighting () { foreach ( $this->language_data['KEYWORDS'] as $key => $words ) { $this->lexic_permissions['KEYWORDS'][$key] = true; } foreach ( $this->language_data['COMMENT_SINGLE'] as $key => $comment ) { $this->lexic_permissions['COMMENTS'][$key] = true; } // Multiline comments $this->lexic_permissions['COMMENTS']['MULTI'] = true; // Escape characters $this->lexic_permissions['ESCAPE_CHAR'] = true; // Brackets $this->lexic_permissions['BRACKETS'] = true; // Strings $this->lexic_permissions['STRINGS'] = true; // Numbers $this->lexic_permissions['NUMBERS'] = true; // Methods $this->lexic_permissions['METHODS'] = true; // Symbols $this->lexic_permissions['SYMBOLS'] = true; // Script $this->lexic_permissions['SCRIPT'] = true; // Regexps foreach ( $this->language_data['REGEXPS'] as $key => $regexp ) { $this->lexic_permissions['REGEXPS'][$key] = true; } // Context blocks $this->enable_important_blocks = true; } /** * method: add_keyword * ------------------- * Adds a keyword to a keyword group for highlighting */ function add_keyword( $key, $word ) { $this->language_data['KEYWORDS'][$key][] = $word; } /** * method: remove_keyword * ---------------------- * Removes a keyword from a keyword group */ function remove_keyword ( $key, $word ) { $this->language_data['KEYWORDS'][$key] = array_diff($this->language_data['KEYWORDS'][$key], array($word)); } /** * method: add_keyword_group * ------------------------- * Creates a new keyword group */ function add_keyword_group ( $key, $styles, $case_sensitive = true, $words = array() ) { if ( !is_array($words) ) { $words = array($words); } $this->language_data['KEYWORDS'][$key] = $words; $this->lexic_permissions['KEYWORDS'][$key] = true; $this->language_data['CASE_SENSITIVE'][$key] = $case_sensitive; $this->language_data['STYLES']['KEYWORDS'][$key] = $styles; } /** * method: remove_keyword_group * ---------------------------- * Removes a keyword group */ function remove_keyword_group ( $key ) { unset($this->language_data['KEYWORDS'][$key]); unset($this->lexic_permissions['KEYWORDS'][$key]); unset($this->language_data['CASE_SENSITIVE'][$key]); unset($this->language_data['STYLES']['KEYWORDS'][$key]); } /** * method: set_header_content * -------------------------- * Sets the content of the header block */ function set_header_content ( $content ) { $this->header_content = $content; } /** * method: set_footer_content * -------------------------- * Sets the content of the footer block */ function set_footer_content ( $content ) { $this->footer_content = $content; } /** * method: set_header_content_style * -------------------------------- * Sets the style for the header content */ function set_header_content_style ( $style ) { $this->header_content_style = $style; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -