⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 geshi.php

📁 Joomla!是一套获得过多个奖项的内容管理系统(Content Management System, CMS)。Joomla!采用PHP+MySQL数据库开发
💻 PHP
📖 第 1 页 / 共 5 页
字号:
            $this->language_data['STYLES']['COMMENTS'][$key] = $style;        }        else {            $this->language_data['STYLES']['COMMENTS'][$key] .= $style;        }    }    /**     * Turns highlighting on/off for comment groups     *     * @param int     The key of the comment group to turn on or off     * @param boolean Whether to turn highlighting for that group on or off     * @since 1.0.0     */    function set_comments_highlighting($key, $flag = true) {        $this->lexic_permissions['COMMENTS'][$key] = ($flag) ? true : false;    }    /**     * 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 string  The style to make the escape characters     * @param boolean Whether to merge the new styles with the old or just     *                to overwrite them     * @since 1.0.0     */    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;        }    }    /**     * Turns highlighting on/off for escaped characters     *     * @param boolean Whether to turn highlighting for escape characters on or off     * @since 1.0.0     */    function set_escape_characters_highlighting($flag = true) {        $this->lexic_permissions['ESCAPE_CHAR'] = ($flag) ? true : 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 string  The style to make the brackets     * @param boolean Whether to merge the new styles with the old or just     *                to overwrite them     * @since 1.0.0     * @deprecated In favour of set_symbols_style     */    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;        }    }    /**     * 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 boolean Whether to turn highlighting for brackets on or off     * @since 1.0.0     * @deprecated In favour of set_symbols_highlighting     */    function set_brackets_highlighting($flag) {        $this->lexic_permissions['BRACKETS'] = ($flag) ? true : false;    }    /**     * 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 string  The style to make the symbols     * @param boolean Whether to merge the new styles with the old or just     *                to overwrite them     * @since 1.0.1     */    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);    }    /**     * Turns highlighting on/off for symbols     *     * @param boolean Whether to turn highlighting for symbols on or off     * @since 1.0.0     */    function set_symbols_highlighting($flag) {        $this->lexic_permissions['SYMBOLS'] = ($flag) ? true : false;        // For backward compatibility        $this->set_brackets_highlighting ($flag);    }    /**     * 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 string  The style to make the escape characters     * @param boolean Whether to merge the new styles with the old or just     *                to overwrite them     * @since 1.0.0     */    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;        }    }    /**     * Turns highlighting on/off for strings     *     * @param boolean Whether to turn highlighting for strings on or off     * @since 1.0.0     */    function set_strings_highlighting($flag) {        $this->lexic_permissions['STRINGS'] = ($flag) ? true : false;    }    /**     * 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 string  The style to make the numbers     * @param boolean Whether to merge the new styles with the old or just     *                to overwrite them     * @since 1.0.0     */    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;        }    }    /**     * Turns highlighting on/off for numbers     *     * @param boolean Whether to turn highlighting for numbers on or off     * @since 1.0.0     */    function set_numbers_highlighting($flag) {        $this->lexic_permissions['NUMBERS'] = ($flag) ? true : 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 int     The key of the object splitter to change the styles of     * @param string  The style to make the methods     * @param boolean Whether to merge the new styles with the old or just     *                to overwrite them     * @since 1.0.0     */    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;        }    }    /**     * Turns highlighting on/off for methods     *     * @param boolean Whether to turn highlighting for methods on or off     * @since 1.0.0     */    function set_methods_highlighting($flag) {        $this->lexic_permissions['METHODS'] = ($flag) ? true : 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 string  The style to make the regular expression matches     * @param boolean Whether to merge the new styles with the old or just     *                to overwrite them     * @since 1.0.0     */    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;        }    }    /**     * Turns highlighting on/off for regexps     *     * @param int     The key of the regular expression group to turn on or off     * @param boolean Whether to turn highlighting for the regular expression group on or off     * @since 1.0.0     */    function set_regexps_highlighting($key, $flag) {        $this->lexic_permissions['REGEXPS'][$key] = ($flag) ? true : false;    }    /**     * Sets whether a set of keywords are checked for in a case sensitive manner     *     * @param int The key of the keyword group to change the case sensitivity of     * @param boolean Whether to check in a case sensitive manner or not     * @since 1.0.0     */    function set_case_sensitivity($key, $case) {        $this->language_data['CASE_SENSITIVE'][$key] = ($case) ? true : false;    }    /**     * 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 int A constant specifying what to do with matched keywords     * @since 1.0.1     * @todo  Error check the passed value     */    function set_case_keywords($case) {        $this->language_data['CASE_KEYWORDS'] = $case;    }    /**     * Sets how many spaces a tab is substituted for     *     * Widths below zero are ignored     *     * @param int The tab width     * @since 1.0.0     */    function set_tab_width($width) {        $this->tab_width = intval($width);    }    /**     * 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 boolean Whether to enable strict mode or not     * @since 1.0.0     */    function enable_strict_mode($mode = true) {        if (GESHI_MAYBE == $this->language_data['STRICT_MODE_APPLIES']) {          $this->strict_mode = ($mode) ? true : false;        }    }    /**     * Disables all highlighting     *     * @since 1.0.0     * @todo Rewrite with an array traversal     */    function disable_highlighting() {        foreach ($this->lexic_permissions as $key => $value) {            if (is_array($value)) {                foreach ($value as $k => $v) {                    $this->lexic_permissions[$key][$k] = false;                }            }            else {                $this->lexic_permissions[$key] = false;            }        }        // Context blocks        $this->enable_important_blocks = false;    }    /**     * Enables all highlighting     *     * @since 1.0.0     * @todo  Rewrite with array traversal     */    function enable_highlighting() {        foreach ($this->lexic_permissions as $key => $value) {            if (is_array($value)) {                foreach ($value as $k => $v) {                    $this->lexic_permissions[$key][$k] = true;                }            }            else {                $this->lexic_permissions[$key] = true;            }        }        // Context blocks        $this->enable_important_blocks = true;    }    /**     * Given a file extension, this method returns either a valid geshi language     * name, or the empty string if it couldn't be found     *     * @param string The extension to get a language name for     * @param array  A lookup array to use instead of the default     * @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?     */    function get_language_name_from_extension( $extension, $lookup = array() ) {        if ( !$lookup ) {            $lookup = array(                'actionscript' => array('as'),                'ada' => array('a', 'ada', 'adb', 'ads'),                'apache' => array('conf'),                'asm' => array('ash', 'asm'),                'asp' => array('asp'),                'bash' => array('sh'),

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -