• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP GeSHi类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中GeSHi的典型用法代码示例。如果您正苦于以下问题:PHP GeSHi类的具体用法?PHP GeSHi怎么用?PHP GeSHi使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了GeSHi类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: bb_syntax_highlight

function bb_syntax_highlight($match)
{
    global $bb_syntax_matches;
    $i = intval($match[1]);
    $match = $bb_syntax_matches[$i];
    $language = strtolower(trim($match[1]));
    $line = trim($match[2]);
    $escaped = trim($match[3]);
    $code = bb_syntax_code_trim($match[4]);
    //if ($escaped == "true") $code = htmlspecialchars_decode($code);
    $code = htmlspecialchars_decode($code);
    //$code = str_replace("&lt;", "<", $code);
    //$code = str_replace("&gt;", ">", $code);
    $geshi = new GeSHi($code, $language);
    $geshi->enable_keyword_links(false);
    do_action_ref_array('bb_syntax_init_geshi', array(&$geshi));
    $output = "\n<div class=\"bb_syntax\">";
    if ($line) {
        $output .= "<table><tr><td class=\"line_numbers\">";
        $output .= bb_syntax_line_numbers($code, $line);
        $output .= "</td><td class=\"code\">";
        $output .= $geshi->parse_code();
        $output .= "</td></tr></table>";
    } else {
        $output .= "<div class=\"code\">";
        $output .= $geshi->parse_code();
        $output .= "</div>";
    }
    $output .= "</div>\n";
    return $output;
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:31,代码来源:bb-syntax.php


示例2: _highlight_code

 function _highlight_code($contents, $language, $line_number, $inline_code)
 {
     $contents = htmlspecialchars_decode($contents);
     if (strtolower($language) == 'bbcode') {
         import('content/parser/bbcode_highlighter');
         $bbcode_highlighter = new BBCodeHighlighter();
         $bbcode_highlighter->set_content($contents, PARSER_DO_NOT_STRIP_SLASHES);
         $bbcode_highlighter->parse($inline_code);
         $contents = $bbcode_highlighter->get_content(DO_NOT_ADD_SLASHES);
     } elseif (strtolower($language) == 'tpl' || strtolower($language) == 'template') {
         import('content/parser/template_highlighter');
         require_once PATH_TO_ROOT . '/kernel/framework/content/geshi/geshi.php';
         $template_highlighter = new TemplateHighlighter();
         $template_highlighter->set_content($contents, PARSER_DO_NOT_STRIP_SLASHES);
         $template_highlighter->parse($line_number ? GESHI_NORMAL_LINE_NUMBERS : GESHI_NO_LINE_NUMBERS, $inline_code);
         $contents = $template_highlighter->get_content(DO_NOT_ADD_SLASHES);
     } elseif ($language != '') {
         require_once PATH_TO_ROOT . '/kernel/framework/content/geshi/geshi.php';
         $Geshi = new GeSHi($contents, $language);
         if ($line_number) {
             $Geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
         }
         if ($inline_code) {
             $Geshi->set_header_type(GESHI_HEADER_NONE);
         }
         $contents = '<pre style="display:inline;">' . $Geshi->parse_code() . '</pre>';
     } else {
         $highlight = highlight_string($contents, true);
         $font_replace = str_replace(array('<font ', '</font>'), array('<span ', '</span>'), $highlight);
         $contents = preg_replace('`color="(.*?)"`', 'style="color:$1"', $font_replace);
     }
     return $contents;
 }
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:33,代码来源:content_second_parser.class.php


示例3: execute

 public function execute()
 {
     if (false === Common::isFile(GWF_GESHI_PATH)) {
         return '';
         // FIXME: {gizmore} log it? GESHI_PATH is may not readable
     }
     require_once GWF_GESHI_PATH;
     $geshi = new GeSHi();
     $langs = $geshi->get_supported_languages(false);
     $key = htmlspecialchars(Common::getGetString('key', ''), ENT_QUOTES);
     sort($langs);
     //		$this->niceArray($langs, false, '-------')
     $this->niceArray($langs, 'python', 'Python');
     $this->niceArray($langs, 'perl', 'Perl');
     $this->niceArray($langs, 'cpp', 'CPP');
     $this->niceArray($langs, 'php', 'PHP');
     $back = $this->module->lang('th_lang') . ':' . PHP_EOL;
     $back .= '<select id="bb_code_lang_sel_' . $key . '">' . PHP_EOL;
     $back .= '<option value="0">' . $this->module->lang('th_lang') . '</option>' . PHP_EOL;
     foreach ($langs as $lang) {
         $back .= sprintf('<option value="%s">%s</option>', $lang, $lang) . PHP_EOL;
     }
     $back .= '</select>' . PHP_EOL;
     $back .= $this->module->lang('th_title') . ': <input type="text" id="bb_code_title_' . $key . '" size="20" value="" />' . PHP_EOL;
     $back .= '<input type="submit" value="' . $this->module->lang('btn_code') . '" onclick="return bbInsertCodeNow(\'' . $key . '\');" />' . PHP_EOL;
     return $back;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:27,代码来源:CodeLangs.php


示例4: code

function code($source, $language)
{
    $code = new GeSHi($source, $language);
    $parse = $code->parse_code();
    $resultat = '<div>' . '<br/>' . $parse . '</div>';
    return $resultat;
}
开发者ID:jordangauthier,项目名称:isietudiants,代码行数:7,代码来源:zcode.php


示例5: onExtra

 function onExtra($name)
 {
     $output = NULL;
     if ($name == "header") {
         if (!$this->yellow->config->get("highlightStylesheetDefault")) {
             $locationStylesheet = $this->yellow->config->get("serverBase") . $this->yellow->config->get("pluginLocation") . "highlight.css";
             $fileNameStylesheet = $this->yellow->config->get("pluginDir") . "highlight.css";
             if (is_file($fileNameStylesheet)) {
                 $output = "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"{$locationStylesheet}\" />\n";
             }
         } else {
             $geshi = new GeSHi();
             $geshi->set_language_path($this->yellow->config->get("pluginDir") . "/highlight/");
             foreach ($geshi->get_supported_languages() as $language) {
                 if ($language == "geshi") {
                     continue;
                 }
                 $geshi->set_language($language);
                 $output .= $geshi->get_stylesheet(false);
             }
             $output = "<style type=\"text/css\">\n{$output}</style>";
         }
     }
     return $output;
 }
开发者ID:nogginfuel,项目名称:yellow-extensions,代码行数:25,代码来源:highlight.php


示例6: highlight

 /**
  * Highlight a given piece of source code.
  * Works for xhtml only. Falls back to original highlighter for
  * other formats.
  *
  * @param string $text   Text to highlight
  * @param string $role   Source code role to use (php, xml, html, ...)
  * @param string $format Output format (pdf, xhtml, troff, ...)
  *
  * @return string Highlighted code
  */
 public function highlight($text, $role, $format)
 {
     $geshi = new \GeSHi($text, $role);
     $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
     $geshi->set_header_type(GESHI_HEADER_DIV);
     return $geshi->parse_code();
 }
开发者ID:marczych,项目名称:hack-hhvm-docs,代码行数:18,代码来源:GeSHi.php


示例7: formatCodeBlocks

	protected function formatCodeBlocks($source){
		return preg_replace_callback('/<code>([\s\S]*?)<\/code>/', function($matches){
			$geshi = new GeSHi($matches[1], 'javascript');
			$geshi->enable_classes();
			return $geshi->parse_code();
		}, $source);
	}
开发者ID:GCheung55,项目名称:mootools-website,代码行数:7,代码来源:docsparser.php


示例8: getSyntaxHighlightedContent

 public function getSyntaxHighlightedContent($content, $type)
 {
     //$content = ;
     //return array('<pre>' . $content . '</pre>', 'none');
     //error_log("content len=" . strlen($content));
     // サイズがでかすぎたら syntax highlight ナシ
     if (strlen($content) > 1 << 15) {
         error_log($content);
         return array('<pre>' . htmlspecialchars($content, ENT_QUOTES) . '</pre>', 'none');
     }
     if ($type == '__pastit_type_none__') {
         $type = 'none';
         // auto detect
         $first_line = explode(PHP_EOL, $content);
         $first_line = $first_line[0];
         if (preg_match('@#!.+bin/(\\w+)@', $first_line, $m)) {
             $type = $m[1];
         }
         if (preg_match('@#!.+bin/env\\s+(\\w+)@', $first_line, $m)) {
             $type = $m[1];
         }
         if (preg_match('@\\+\\+\\+@', $content) && preg_match('@\\-\\-\\-@', $content)) {
             $type = 'diff';
         }
     }
     require_once 'geshi/geshi.php';
     $geshi = new GeSHi($content, $type);
     $geshi->set_overall_style('font-family: menlo, monaco, \'courier new\', mono-space;');
     $content = $geshi->parse_code();
     //return '<pre class=" superpre">' . PHP_EOL . $body . '</pre>';
     return array($content, $type);
 }
开发者ID:riaf,项目名称:pastit,代码行数:32,代码来源:Pastit_PasteManager.php


示例9: JHP_Geshi_replacer

function JHP_Geshi_replacer(&$matches)
{
    //	print_r($matches);
    //// 	die();
    jimport('geshi.geshi');
    jimport('domit.xml_saxy_shared');
    $args = SAXY_Parser_Base::parseAttributes($matches[1]);
    // 	print_r($args);
    $text = $matches[2];
    $lang = JArrayHelper::getValue($args, 'lang', 'phpz');
    $lines = JArrayHelper::getValue($args, 'lines', 'true');
    $html_entities_match = array("|\\<br \\/\\>|", "#<#", "#>#", "|&#39;|", '#&quot;#', '#&nbsp;#');
    $html_entities_replace = array("\n", '&lt;', '&gt;', "'", '"', ' ');
    $text = preg_replace($html_entities_match, $html_entities_replace, $text);
    $text = str_replace('&lt;', '<', $text);
    $text = str_replace('&gt;', '>', $text);
    $text = str_replace("\t", '  ', $text);
    $geshi = new GeSHi($text, $lang);
    if ($lines == 'true') {
        $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);
    }
    $text = $geshi->parse_code();
    $text = '???' . $text . '???';
    return $text;
}
开发者ID:phpsa,项目名称:jhproject,代码行数:25,代码来源:plgbbcode.php


示例10: plgContentGeshi_replacer

/**
* Replaces the matched tags an image
* @param array An array of matches (see preg_match_all)
* @return string
*/
function plgContentGeshi_replacer(&$matches)
{
    $params =& $GLOBALS['_MAMBOT_GESHI_PARAMS'];
    jimport('geshi.geshi');
    jimport('domit.xml_saxy_shared');
    $args = SAXY_Parser_Base::parseAttributes($matches[1]);
    $text = $matches[2];
    $lang = JArrayHelper::getValue($args, 'lang', 'php');
    $lines = JArrayHelper::getValue($args, 'lines', 'false');
    $html_entities_match = array("|\\<br \\/\\>|", "#<#", "#>#", "|&#39;|", '#&quot;#', '#&nbsp;#');
    $html_entities_replace = array("\n", '&lt;', '&gt;', "'", '"', ' ');
    $text = preg_replace($html_entities_match, $html_entities_replace, $text);
    $text = str_replace('&lt;', '<', $text);
    $text = str_replace('&gt;', '>', $text);
    /*
    	// Replace 2 spaces with "&nbsp; " so non-tabbed code indents without making huge long lines.
    	$text = str_replace("  ", "&nbsp; ", $text);
    	// now Replace 2 spaces with " &nbsp;" to catch odd #s of spaces.
    	$text = str_replace("  ", " &nbsp;", $text);
    */
    // Replace tabs with "&nbsp; &nbsp;" so tabbed code indents sorta right without making huge long lines.
    //$text = str_replace("\t", "&nbsp; &nbsp;", $text);
    $text = str_replace("\t", '  ', $text);
    $geshi = new GeSHi($text, $lang);
    if ($lines == 'true') {
        $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
    }
    $text = $geshi->parse_code();
    return $text;
}
开发者ID:kwizera05,项目名称:police,代码行数:35,代码来源:geshi.php


示例11: wp_syntax_highlight

function wp_syntax_highlight($match)
{
    global $wp_syntax_matches;
    $i = intval($match[1]);
    $match = $wp_syntax_matches[$i];
    $language = strtolower(trim($match[1]));
    $line = trim($match[2]);
    $code = wp_syntax_code_trim($match[3]);
    $geshi = new GeSHi($code, $language);
    $geshi->enable_keyword_links(false);
    do_action_ref_array('wp_syntax_init_geshi', array(&$geshi));
    $output = "\n<div class=\"wp_syntax\">";
    if ($line) {
        $output .= "<table><tr><td class=\"line_numbers\">";
        $output .= wp_syntax_line_numbers($code, $line);
        $output .= "</td><td class=\"code\">";
        $output .= $geshi->parse_code();
        $output .= "</td></tr></table>";
    } else {
        $output .= "<div class=\"code\">";
        $output .= $geshi->parse_code();
        $output .= "</div>";
    }
    return $output .= "</div>\n";
    return $output;
}
开发者ID:jeremyboles,项目名称:cappuccino-website,代码行数:26,代码来源:wp-syntax.php


示例12: DoGeshi

function DoGeshi($code)
{
    $geshi = new GeSHi(trim($code), "html4strict", null);
    $geshi->set_header_type(GESHI_HEADER_NONE);
    $geshi->enable_classes();
    return "<span class=\"geshi\">" . str_replace("\n", "", $geshi->parse_code()) . "</span>";
}
开发者ID:RoadrunnerWMC,项目名称:ABXD-legacy,代码行数:7,代码来源:faq.php


示例13: parse

 /**
  * @desc Highlights the code. It uses the geshi HTML syntax highlighter and then it highlights the specific template syntax.
  * @param int $line_number GESHI_NO_LINE_NUMBERS => no line numbers, GESHI_NORMAL_LINE_NUMBERS line numbers.
  * @param bool $inline_code true if it's a sigle line code, otherwise false.
  */
 public function parse($line_number = GESHI_NO_LINE_NUMBERS, $inline_code = false)
 {
     //The template language of PHPBoost contains HTML. We first ask to highlight the html code.
     require_once PATH_TO_ROOT . '/kernel/lib/php/geshi/geshi.php';
     $geshi = new GeSHi($this->content, 'html');
     if ($line_number) {
         $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
     }
     //GeSHi must not put any div or pre tag before and after the content
     if ($inline_code) {
         $geshi->set_header_type(GESHI_HEADER_NONE);
     }
     $this->content = $geshi->parse_code();
     //Now we highlight the specific syntax of PHPBoost templates
     //Conditionnal block
     $this->content = preg_replace('`# IF ( NOT)? ((?:\\w+\\.)*)(\\w+) #`i', '<span style="' . self::TPL_SHARP_STYLE . '">#</span> <span style="' . self::TPL_KEYWORD_STYLE . '">IF$1</span> <span style="' . self::TPL_NESTED_VARIABLE_STYLE . '">$2</span><span style="' . self::TPL_VARIABLE_STYLE . '">$3</span> <span style="' . self::TPL_SHARP_STYLE . '">#</span>', $this->content);
     $this->content = preg_replace('`# ELSEIF ( NOT)? ((?:\\w+\\.)*)(\\w+) #`i', '<span style="' . self::TPL_SHARP_STYLE . '">#</span> <span style="' . self::TPL_KEYWORD_STYLE . '">ELSEIF$1</span> <span style="' . self::TPL_NESTED_VARIABLE_STYLE . '">$2</span><span style="' . self::TPL_VARIABLE_STYLE . '">$3</span> <span style="' . self::TPL_SHARP_STYLE . '">#</span>', $this->content);
     $this->content = str_replace('# ELSE #', '<span style="' . self::TPL_SHARP_STYLE . '">#</span> <span style="' . self::TPL_KEYWORD_STYLE . '">ELSE</span> <span style="' . self::TPL_SHARP_STYLE . '">#</span>', $this->content);
     $this->content = str_replace('# ENDIF #', '<span style="' . self::TPL_SHARP_STYLE . '">#</span> <span style="' . self::TPL_KEYWORD_STYLE . '">ENDIF</span> <span style="' . self::TPL_SHARP_STYLE . '">#</span>', $this->content);
     //Loops
     $this->content = preg_replace('`# START ((?:\\w+\\.)*)(\\w+) #`i', '<span style="' . self::TPL_SHARP_STYLE . '">#</span> <span style="' . self::TPL_KEYWORD_STYLE . '">START</span> <span style="' . self::TPL_NESTED_VARIABLE_STYLE . '">$1</span><span style="' . self::TPL_VARIABLE_STYLE . '">$2</span> <span style="' . self::TPL_SHARP_STYLE . '">#</span>', $this->content);
     $this->content = preg_replace('`# END ((?:\\w+\\.)*)(\\w+) #`i', '<span style="' . self::TPL_SHARP_STYLE . '">#</span> <span style="' . self::TPL_KEYWORD_STYLE . '">END</span> <span style="' . self::TPL_NESTED_VARIABLE_STYLE . '">$1</span><span style="' . self::TPL_VARIABLE_STYLE . '">$2</span> <span style="' . self::TPL_SHARP_STYLE . '">#</span>', $this->content);
     //Inclusions
     $this->content = preg_replace('`# INCLUDE ((?:\\w+\\.)*)([\\w]+) #`', '<span style="' . self::TPL_SHARP_STYLE . '">#</span> <span style="' . self::TPL_KEYWORD_STYLE . '">INCLUDE </span> <span style="' . self::TPL_NESTED_VARIABLE_STYLE . '">$1</span><span style="' . self::TPL_VARIABLE_STYLE . '">$2</span> <span style="' . self::TPL_SHARP_STYLE . '">#</span>', $this->content);
     //Simple variable
     $this->content = preg_replace('`{([\\w]+)}`i', '<span style="' . self::TPL_BRACES_STYLE . '">{</span><span style="' . self::TPL_VARIABLE_STYLE . '">$1</span><span style="' . self::TPL_BRACES_STYLE . '">}</span>', $this->content);
     //Loop variable
     $this->content = preg_replace('`{((?:[\\w]+\\.)+)([\\w]+)}`i', '<span style="' . self::TPL_BRACES_STYLE . '">{</span><span style="' . self::TPL_NESTED_VARIABLE_STYLE . '">$1</span><span style="' . self::TPL_VARIABLE_STYLE . '">$2</span><span style="' . self::TPL_BRACES_STYLE . '">}</span>', $this->content);
     if ($inline_code) {
         $this->content = '<pre style="display:inline; font-color:courier new;">' . $this->content . '</pre>';
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:37,代码来源:TemplateHighlighter.class.php


示例14: _doGeshi

 function _doGeshi($shebangMatch)
 {
     $language = $shebangMatch['lang'];
     $line = (int) ($shebangMatch['linenumber'] > 1 ? $shebangMatch['linenumber'] : 0);
     $codeblock = $shebangMatch['code'];
     $highlighter = new GeSHi($this->outdent(trim($codeblock)), $language);
     $highlighted = $highlighter->parse_code();
     if ($line) {
         preg_match('!^(\\s*<pre[^>]+>)(.*)(</pre>)!s', $highlighted, $m);
         $ret = '<ol';
         if ($line) {
             $ret .= ' start="' . $line . '"';
         }
         $ret .= '>';
         $ret .= preg_replace('/.+(\\n|$)/', '<li>$0</li>', $m[2]);
         $ret .= '</ol>';
         $ret = $m[1] . $ret . $m[3];
     } else {
         $ret = $highlighted;
     }
     if ($shebangMatch['params']) {
         $ret = $this->_processGeshiParams($ret, $shebangMatch['params']);
     }
     return "\n\n" . $this->hashBlock($ret) . "\n\n";
 }
开发者ID:derekdreery,项目名称:Markdown_Geshi,代码行数:25,代码来源:markdown-geshi.php


示例15: smarty_block_code

function smarty_block_code($params, $content, Smarty_Internal_Template $template, $open)
{
    if ($open) {
        return '';
    } else {
        $language = isset($params['language']) ? (string) $params['language'] : null;
        $classes = array();
        if ($language) {
            $classes[] = $language;
        }
        if (!empty($params['class'])) {
            $classes[] = $params['class'];
        }
        $content = trim($content, "\n\r");
        $content = rtrim($content);
        $rows = preg_split("#[\n\r]#", $content);
        preg_match('#^\\s+#', reset($rows), $matches);
        if ($matches) {
            $whitespace = $matches[0];
            foreach ($rows as &$row) {
                $row = preg_replace('#^' . $whitespace . '#', '', $row);
            }
        }
        $content = implode(PHP_EOL, $rows);
        $content = trim($content, "\n\r");
        $geshi = new GeSHi($content, $language);
        $geshi->keyword_links = false;
        $geshi->set_tab_width(4);
        $geshi->set_header_type(GESHI_HEADER_NONE);
        return '<code class="' . implode(' ', $classes) . '">' . $geshi->parse_code() . '</code>';
    }
}
开发者ID:cargomedia,项目名称:cm,代码行数:32,代码来源:block.code.php


示例16: _codeBlockHighlighter

 function _codeBlockHighlighter($codeblock, &$clear)
 {
     $split = preg_split('/[\\r\\n]/', $codeblock, 2, PREG_SPLIT_NO_EMPTY);
     if (count($split) == 2 && preg_match('/^\\s*((\\\\){0,2}\\[([a-zA-Z0-9\\-_]+)\\]\\s*)/', $split[0], $matches)) {
         if ($matches[2] == '\\') {
             $codeblock = substr($codeblock, 1);
             return $codeblock;
         }
         $strlen = strlen($matches[0]);
         $parser = strtolower($matches[3]);
         $codeblock = $split[1];
         if ($strlen > 0) {
             if ($parser == 'console') {
                 $codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
                 $codeblock = preg_replace_callback('/^\\n+/', array($this, '_doFencedCodeBlocks_newlines'), $codeblock);
                 $codeblock = "<pre class=\"console\"><code>{$codeblock}</code></pre>";
             } else {
                 $codeblock = preg_replace('/\\n+$/', '', $codeblock);
                 $geshi = new GeSHi($codeblock, $parser);
                 $geshi->set_overall_style('');
                 $codeblock = $geshi->parse_code();
             }
             $clear = false;
         }
     }
     return $codeblock;
 }
开发者ID:TypeFriendly,项目名称:TypeFriendly,代码行数:27,代码来源:markdown.php


示例17: highlightCode

 /**
  * Highlight code with style
  *
  * @param string $value Full source text
  *
  * @return string
  */
 public function highlightCode($value)
 {
     $text = preg_replace_callback(self::$pattern, function ($data) {
         $geshi = new \GeSHi($data[2], $data[1]);
         return $geshi->parse_code();
     }, $value);
     return $text;
 }
开发者ID:alienpham,项目名称:portfolio,代码行数:15,代码来源:HighlightCodeTwigExtension.php


示例18: codeShortcode

 public static function codeShortcode($options, $content)
 {
     include_once __DIR__ . '/vendor/geshi-1.0.8.15/geshi.php';
     $name = empty($options[0]) ? 'text' : $options[0];
     $geshi = new GeSHi(trim($content), $name);
     #$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);
     return sprintf('<div class="highlight highlight-%s">%s</div>', $name, $geshi->parse_code());
 }
开发者ID:getherbie,项目名称:plugin-highlight,代码行数:8,代码来源:highlight.php


示例19: parseGeshi

 /**
  * @param string $sContent
  * @param string $sLanguage
  * @return string
  */
 public function parseGeshi($sContent, $sLanguage, $bUseClasses = false)
 {
     $oGeshi = new \GeSHi($sContent, $sLanguage);
     if ($bUseClasses) {
         $oGeshi->enable_classes();
     }
     return $oGeshi->parse_code();
 }
开发者ID:neilime,项目名称:geshi-twig-extension,代码行数:13,代码来源:GeshiExtension.php


示例20: getFormatedCode

	public function getFormatedCode(){
		$content=$this->content();
	
		$content=str_replace(array("&lt;", "&gt;", '&amp;', '&#039;', '&quot;','&lt;', '&gt;'), array("<", ">",'&','\'','"','<','>'), htmlspecialchars_decode($content, ENT_NOQUOTES)); 		
		$geshi = new GeSHi($content, $this->codeLanguage);
		$value=  $geshi->parse_code();
		return ($value);
	}
开发者ID:rawthang,项目名称:dbx,代码行数:8,代码来源:Exploit.php



注:本文中的GeSHi类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP GearmanClient类代码示例发布时间:2022-05-23
下一篇:
PHP Gdn_Validation类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap