当前位置: 首页>>代码示例>>PHP>>正文


PHP GeSHi::set_line_style方法代码示例

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


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

示例1: print_highlighted

function print_highlighted($lang)
{
    //The GeSHI syntax highlighter is included.
    include_once 'geshi/geshi.php';
    //The string returned is stored in a variable.
    $filename = get_id($_SERVER['REQUEST_URI']);
    //If file does not exist then it redirects the user to the home page.
    $file = fopen("data/{$filename}", "r") or header("Location: /");
    $source = '';
    while (!feof($file)) {
        $source = $source . fgets($file);
    }
    //The object created is passed two arguments for syntax highlighting.
    $geshi = new GeSHi($source, $lang);
    $geshi->set_overall_style('background-color: #f2f2f2; margin: 0px 35px; border: 1px dotted;', true);
    //$geshi->set_header_type(GESHI_HEADER_PRE_VALID);
    $geshi->set_header_type(GESHI_HEADER_DIV);
    //The flag below shows the line numbers. See GeSHI docs for more options.
    $flag = GESHI_FANCY_LINE_NUMBERS;
    $geshi->enable_line_numbers($flag);
    $geshi->set_line_style(' padding: 0px 15px;');
    //The <pre> tags are included for maintaining the indentation.
    // echo "<pre>";
    echo $geshi->parse_code();
    // echo "</pre></div>";
    return 0;
}
开发者ID:vrnkalra,项目名称:glupaste,代码行数:27,代码来源:libpaste1.php

示例2: source_highlighter

function source_highlighter($code)
{
    $source = str_replace(array("&gt;", "&lt;", "&quot;", "&amp;"), array(">", "<", "\"", "&"), $code[1]);
    if (false !== stristr($code[0], "[php]")) {
        $lang2geshi = "php";
    } elseif (false !== stristr($code[0], "[sql]")) {
        $lang2geshi = "sql";
    } elseif (false !== stristr($code[0], "[html]")) {
        $lang2geshi = "html4strict";
    } else {
        $lang2geshi = "txt";
    }
    $geshi = new GeSHi($source, $lang2geshi);
    $geshi->set_header_type(GESHI_HEADER_PRE_VALID);
    $geshi->set_overall_style('font: normal normal 100% monospace; color: #000066;', false);
    $geshi->set_line_style('color: #003030;', 'font-weight: bold; color: #006060;', true);
    $geshi->set_code_style('color: #000020;font-family:monospace; font-size:12px;line-height:6px;', true);
    //$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
    $geshi->enable_classes(false);
    $geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
    $geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
    $return = "<div class=\"codetop\">CODE</div><div class=\"codemain\">\n";
    $return .= $geshi->parse_code();
    $return .= "\n</div>\n";
    return $return;
}
开发者ID:ZenoX2012,项目名称:CyBerFuN-CoDeX,代码行数:26,代码来源:bbcode_functions.php

示例3: handle_geshi

function handle_geshi($content, $language)
{
    $g = new GeSHi($content, $language);
    $g->enable_classes();
    $g->set_header_type(GESHI_HEADER_DIV);
    $g->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 5);
    #$g->set_overall_style('color:black');
    $g->set_overall_id('source');
    $g->set_code_style('color:black;', "'Courier New', Courier, monospace");
    $g->set_line_style('color:#838383;', '', true);
    return $g->parse_code();
}
开发者ID:slepp,项目名称:pastebin.ca,代码行数:12,代码来源:handler.inc.php

示例4: highlight_syntax

function highlight_syntax($code, $langid)
{
    $value = get_record('problemstatement_programming_language', 'id', $langid);
    if ($value) {
        $syntax = $value->geshi;
    } else {
        $syntax = '';
    }
    /*
    	switch ($langid) {
    		case '0': $syntax='cpp'; break;
    		case '1': $syntax='delphi'; break;
    		case '2': $syntax='java'; break;
    		case '3': $syntax='python'; break;
    		case '4': $syntax='csharp'; break;
    	}*/
    $geshi = new GeSHi($code, $syntax);
    $geshi->set_header_type(GESHI_HEADER_DIV);
    //   $geshi->enable_classes(true);
    $geshi->set_overall_style('font-family: monospace;');
    $linenumbers = 1;
    if ($linenumbers) {
        $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 5);
        $geshi->set_line_style('color:#222;', 'color:#888;');
        $geshi->set_overall_style('font-size: 14px;font-family: monospace;', true);
    }
    $urls = FALSE;
    $indentsize = FALSE;
    $inline = FALSE;
    if (!$urls) {
        for ($i = 0; $i < 5; $i++) {
            $geshi->set_url_for_keyword_group($i, '');
        }
    }
    if ($indentsize) {
        $geshi->set_tab_width($indentsize);
    }
    $parsed = $geshi->parse_code();
    if ($inline) {
        $parsed = preg_replace('/^<div/', '<span', $parsed);
        $parsed = preg_replace('/<\\/div>$/', '</span>', $parsed);
    }
    //return $geshi->parse_code().$syntax;
    $lang = get_record('problemstatement_programming_language', 'id', $langid);
    if (!$lang) {
        $lang = '';
    }
    $comment = get_string("programwritten", "problemstatement") . $lang->language_name;
    //get_string("lang_".$langid, "problemstatement");
    return $parsed . $comment;
}
开发者ID:Anna-Sentyakova,项目名称:runningcat,代码行数:51,代码来源:problemstatement.class.php

示例5: getCode

 public function getCode($data)
 {
     $code = array();
     foreach ($data as $part => $options) {
         $data = file_get_contents($options['file']);
         $geshi = new \GeSHi($data, $options['type']);
         //             $geshi->set_header_type(GESHI_HEADER_NONE);
         $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
         $geshi->set_line_style('background: #fcfcfc;', 'background: #fcfcfc;');
         if (array_key_exists('highlight', $options)) {
             $geshi->highlight_lines_extra($options['highlight']);
         }
         $title = sprintf('%s: %s', $part, basename($options['file']));
         $code[$title] = $geshi->parse_code();
     }
     return $code;
 }
开发者ID:bf13,项目名称:sandbox,代码行数:17,代码来源:DemoExtension.php

示例6: source_highlighter

function source_highlighter($source, $lang2geshi)
{
    require_once 'geshi/geshi.php';
    $source = str_replace(array("&#039;", "&gt;", "&lt;", "&quot;", "&amp;"), array("'", ">", "<", "\"", "&"), $source);
    $lang2geshi = $lang2geshi == 'html' ? 'html4strict' : $lang2geshi;
    $geshi = new GeSHi($source, $lang2geshi);
    $geshi->set_header_type(GESHI_HEADER_PRE_VALID);
    $geshi->set_overall_style('font: normal normal 100% monospace; color: #000066;', false);
    $geshi->set_line_style('color: #003030;', 'font-weight: bold; color: #006060;', true);
    $geshi->set_code_style('color: #000020;font-family:monospace; font-size:12px;line-height:13px;', true);
    $geshi->enable_classes(false);
    $geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
    $geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
    $return = "<div class=\"codetop\">Code</div><div class=\"codemain\">\n";
    $return .= $geshi->parse_code();
    $return .= "\n</div>\n";
    return $return;
}
开发者ID:CharlieHD,项目名称:U-232-V3,代码行数:18,代码来源:bbcode_functions.php

示例7: AffichageSource

function AffichageSource($type, $lang, $nom)
{
    if (preg_match("#^../#", $nom) == TRUE) {
        $result = "Erreur lors du chargement du script";
    } else {
        $language = str_replace('.', '', strstr($nom, '.'));
        $source = '';
        $script = 'fichiers/' . $type . '/' . $lang . '/' . $nom;
        if (file_exists($script)) {
            $contenu = file($script);
            while (list($cle, $val) = each($contenu)) {
                $source .= $val;
            }
        }
        $geshi = new GeSHi($source, $language);
        $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 2);
        $geshi->set_overall_style('font-size:11px;width:580px;', true);
        $geshi->set_line_style('background: #fcfcfc;', 'background: #f0f0f0;');
        $result = $geshi->parse_code();
    }
    $result .= '<div align=center><a href="?page=' . $type . '">Retour</a></div>';
    return $result;
}
开发者ID:bobibox,项目名称:Bobiscript,代码行数:23,代码来源:fonctions_affichage.php

示例8: blockHandler

/**
 * User handler for code block
 *
 * @param TexyHandlerInvocation  handler invocation
 * @param string  block type
 * @param string  text to highlight
 * @param string  language
 * @param TexyModifier modifier
 * @return TexyHtml
 */
function blockHandler($invocation, $blocktype, $content, $lang, $modifier)
{
    if ($blocktype !== 'block/code') {
        return $invocation->proceed();
    }
    $texy = $invocation->getTexy();
    global $geshiPath;
    if ($lang == 'html') {
        $lang = 'html4strict';
    }
    $content = Texy::outdent($content);
    $geshi = new GeSHi($content, $lang, $geshiPath . 'geshi/');
    // GeSHi could not find the language
    if ($geshi->error) {
        return $invocation->proceed();
    }
    // do syntax-highlighting
    $geshi->set_encoding('UTF-8');
    $geshi->set_header_type(GESHI_HEADER_PRE);
    $geshi->enable_classes();
    $geshi->set_overall_style('color: #000066; border: 1px solid #d0d0d0; background-color: #f0f0f0;', true);
    $geshi->set_line_style('font: normal normal 95% \'Courier New\', Courier, monospace; color: #003030;', 'font-weight: bold; color: #006060;', true);
    $geshi->set_code_style('color: #000020;', 'color: #000020;');
    $geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
    $geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
    // save generated stylesheet
    $texy->styleSheet .= $geshi->get_stylesheet();
    $content = $geshi->parse_code();
    // check buggy GESHI, it sometimes produce not UTF-8 valid code :-((
    $content = iconv('UTF-8', 'UTF-8//IGNORE', $content);
    // protect output is in HTML
    $content = $texy->protect($content, Texy::CONTENT_BLOCK);
    $el = TexyHtml::el();
    $el->setText($content);
    return $el;
}
开发者ID:eduardobenito10,项目名称:jenkins-php-quickstart,代码行数:46,代码来源:demo-geshi.php

示例9: exit

if (strncmp($real_path, SOURCE_ROOT, $base_path_len)) {
    exit("Access outside acceptable path.");
}
// Check file exists
if (!file_exists($path)) {
    exit("File not found ({$path}).");
}
// Prepare GeSHi instance
$geshi = new GeSHi();
$geshi->set_language('text');
$geshi->load_from_file($path);
$geshi->set_header_type(GESHI_HEADER_PRE);
$geshi->enable_classes();
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 10);
$geshi->set_overall_style('color: #000066; border: 1px solid #d0d0d0; background-color: #f0f0f0;', true);
$geshi->set_line_style('font: normal normal 95% \'Courier New\', Courier, monospace; color: #003030;', 'font-weight: bold; color: #006060;', true);
$geshi->set_code_style('color: #000020;', 'color: #000020;');
$geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
$geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
$geshi->set_header_content('Source code viewer - ' . $path . ' - ' . $geshi->get_language_name());
$geshi->set_header_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;');
$geshi->set_footer_content('Parsed in <TIME> seconds,  using GeSHi <VERSION>');
$geshi->set_footer_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-top: 1px solid #d0d0d0; padding: 2px;');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Source code viewer - <?php 
echo $path;
?>
开发者ID:LanceSandino,项目名称:Stikked,代码行数:31,代码来源:aliased.php

示例10: switch

 /**
  * Style language
  *
  * @param array $subjects
  */
 function _styleSubjects($subjects)
 {
     // set overall style
     if (isset($subjects['view'])) {
         $this->geshi->set_overall_style($subjects['view'], $this->_invertOverwrite($subjects['view.']['overwrite']));
     }
     if (isset($subjects['view.']['container'])) {
         switch ($subjects['view.']['container']) {
             case 'none':
             case 'NONE':
             case 'None':
                 $this->geshi->set_header_type(GESHI_HEADER_NONE);
                 break;
             case 'div':
             case 'Div':
             case 'DIV':
                 $this->geshi->set_header_type(GESHI_HEADER_DIV);
                 break;
             case 'pre':
             case 'Pre':
             case 'PRE':
             default:
                 $this->geshi->set_header_type(GESHI_HEADER_PRE);
                 break;
         }
     }
     if (isset($subjects['view.']['tabwidth'])) {
         $this->geshi->set_tab_width(intval($subjects['view.']['tabwidth']));
     }
     // configure linenumbers
     if (isset($subjects['linenumbers'])) {
         $this->geshi->set_line_style($subjects['linenumbers'], isset($subjects['linenumbers.']['fancy']) ? $subjects['linenumbers.']['fancy'] : '', $this->_invertOverwrite($subjects['linenumbers.']['overwrite']));
     }
     // enable / disable linenumbers
     if (isset($subjects['linenumbers.']['enable'])) {
         $this->geshi->enable_line_numbers($subjects['linenumbers.']['enable']);
     }
     // configure code style
     if (isset($subjects['code'])) {
         $this->geshi->set_code_style($subjects['code'], $this->_invertOverwrite($subjects['code.']['overwrite']));
     }
     // configure escape
     if (isset($subjects['escape'])) {
         $this->geshi->set_escape_characters_style($subjects['escape'], $this->_invertOverwrite($subjects['escape.']['overwrite']));
     }
     // configure symbols
     if (isset($subjects['symbols'])) {
         $this->geshi->set_symbols_style($subjects['symbols'], $this->_invertOverwrite($subjects['symbols.']['overwrite']));
     }
     // configure strings
     if (isset($subjects['strings'])) {
         $this->geshi->set_strings_style($subjects['strings'], $this->_invertOverwrite($subjects['strings.']['overwrite']));
     }
     // configure numbers
     if (isset($subjects['numbers'])) {
         $this->geshi->set_numbers_style($subjects['numbers'], $this->_invertOverwrite($subjects['numbers.']['overwrite']));
     }
     // configure comment style
     if (isset($subjects['comments.'])) {
         foreach ($subjects['comments.'] as $key => $value) {
             if (strstr($key, '.') == false) {
                 $this->geshi->set_comments_style($key, $value, $this->_invertOverwrite($subjects['comments.'][$key . '.']['overwrite']));
             }
         }
     }
     // configure keywords style
     if (isset($subjects['keywords.'])) {
         foreach ($subjects['keywords.'] as $key => $value) {
             if (strstr($key, '.') == false) {
                 $this->geshi->set_keyword_group_style($key, $value, $this->_invertOverwrite($subjects['keywords.'][$key . '.']['overwrite']));
             }
         }
     }
     // enable / disable keyword links
     if (isset($subjects['keyword.']['links.']['enable'])) {
         $this->geshi->enable_keyword_links($subjects['keyword.']['links.']['enable']);
     }
     // configure keyword link styles
     if (isset($subjects['keyword.']['links'])) {
         $this->geshi->set_link_styles(GESHI_LINK, $subjects['keyword.']['links']);
     }
     if (isset($subjects['keyword.']['links.']['hover'])) {
         $this->geshi->set_link_styles(GESHI_HOVER, $subjects['keyword.']['links.']['hover']);
     }
     if (isset($subjects['keyword.']['links.']['active'])) {
         $this->geshi->set_link_styles(GESHI_ACTIVE, $subjects['keyword.']['links.']['active']);
     }
     if (isset($subjects['keyword.']['links.']['visited'])) {
         $this->geshi->set_link_styles(GESHI_VISITED, $subjects['keyword.']['links.']['visited']);
     }
     // configure keyword link target
     if (isset($subjects['keyword.']['links.']['target'])) {
         $this->geshi->set_link_target($subjects['keyword.']['links.']['target']);
     }
     // configure method styles
//.........这里部分代码省略.........
开发者ID:sema,项目名称:typo3-source-code-highlighter,代码行数:101,代码来源:class.tx_semasourcecode_pi1.php

示例11: getPaste

 function getPaste($pid)
 {
     $post = $this->db->getPaste($pid);
     if ($post) {
         // Show a quick reference url, title and parents.
         $expires = is_null($post['expires']) ? " (Never Expires) " : " - Expires on " . date("D, F jS @ g:ia", strtotime($post['expires']));
         $post['posttitle'] = "<b>{$post['title']}</b> - Posted on {$post['postdate']} {$expires}";
         if ($post['parent_pid'] > 0) {
             $parent_pid = $post['parent_pid'];
             $parent = $this->db->getPaste($parent_pid);
             if ($parent) {
                 $post['parent_title'] = $parent['title'];
                 $post['parent_url'] = $this->getPasteUrl($parent_pid);
                 $post['parent_postdate'] = $parent['postdate'];
                 $post['parent_diffurl'] = $this->conf['diff_url'] . "{$pid}";
             }
         }
         // Amendments
         $post['followups'] = $this->db->getFollowupPosts($pid);
         foreach ($post['followups'] as $idx => $followup) {
             $post['followups'][$idx]['followup_url'] = $this->getPasteUrl($followup['pid']);
         }
         if ($post['password'] != 'EMPTY') {
             $post['downloadurl'] = $this->conf['url'] . "?dl={$pid}&pass=" . $post['password'];
         } else {
             $post['downloadurl'] = $this->conf['url'] . "?dl={$pid}";
         }
         // Store the code for later editing
         $post['editcode'] = $post['code'];
         // Preprocess
         $highlight = array();
         $prefix_size = strlen($this->conf['highlight_prefix']);
         if ($prefix_size) {
             $lines = explode("\n", $post['editcode']);
             $post['editcode'] = "";
             foreach ($lines as $idx => $line) {
                 if (substr($line, 0, $prefix_size) == $this->conf['highlight_prefix']) {
                     $highlight[] = $idx + 1;
                     $line = substr($line, $prefix_size);
                 }
                 $post['editcode'] .= $line . "\n";
             }
             $post['editcode'] = rtrim($post['editcode']);
         }
         // Get formatted version of code
         if (strlen($post['codefmt']) == 0) {
             $geshi = new GeSHi($post['editcode'], $post['format']);
             $geshi->enable_classes();
             $geshi->set_header_type(GESHI_HEADER_DIV);
             $geshi->set_line_style('background: #ffffff;', 'background: #f4f4f4;');
             if (count($highlight)) {
                 $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
                 $geshi->highlight_lines_extra($highlight);
                 $geshi->set_highlight_lines_extra_style('color:black;background:#FFFF88;');
             } else {
                 $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 2);
             }
             $post['codefmt'] = $geshi->parse_code();
             $post['codecss'] = $geshi->get_stylesheet();
             // Save it!
             $this->db->saveFormatting($pid, $post['codefmt'], $post['codecss']);
         }
         $post['pid'] = $pid;
     } else {
         $post['codefmt'] = "<b>Unknown post ID, it probably expired.</b><br />";
     }
     return $post;
 }
开发者ID:KingNoosh,项目名称:Teknik,代码行数:68,代码来源:paste.php

示例12: main


//.........这里部分代码省略.........



		$content[]= '
			  <br />
		      <table>
			    	<tr>
				  		<td>
				    		<input type="hidden" name="fname" value="'.$item.'">
				  		</td>
		          		<td>
				    		<input type="submit" name="savenow" value="'.$LANG->getLL("message.btnsave").'" >
				  		</td>
				  		<td>
		            <input type="button" value="'.$LANG->getLL("message.btnclose").'" onclick="closeDoc()">
				  		</td></tr></table><br />';





			$fileT3s = $fname;
			if(@is_file($fileT3s)){
			require_once (t3lib_extMgm::extPath("t3quixplorer")."mod1/geshi.php");

			  $inputCode = file_get_contents($fileT3s);



				switch($ext){
					case 'php':
					case 'php3':
					case 'inc':
						$hl = 'php';
						break;

					case 'html':
					case 'htm':
					case 'tmpl':
						$hl = 'html4strict';
						break;

					case 'js':
						$hl = 'javascript';
						break;

					case 'pl':
						$hl = 'perl';
						break;

					default:
						$hl = $ext;
						break;
				}

            if($item == 'setup.txt' || $item == 'config.txt'|| $item == 'constants.txt'){
            	$hl = 'ts';
            }
			switch($hl){
				case 'php':
				case 'xml':
				case 'sql':
				case 'html4strict':
				case 'javascript':
				case 'perl':
				case 'css':
				case 'smarty':
					$geshi = new GeSHi($inputCode,$hl,'geshi/');
					$geshi->use_classes = true;
					$geshi->set_tab_width(4);
					$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
					$geshi->set_link_target('_blank');
					$geshi->set_line_style("font-family:'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font-size:12px;");

					$content[] = '
					<style type="text/css">

					.'.$hl.' *{font-size:11px;}

					'.$geshi->get_stylesheet().'
					</style>
					';

					$content[] = '<strong>T3S-File: '.$fileT3s.'</strong></br><hr />'.$geshi->parse_code();

					break;
				case 'ts':
					require_once(PATH_t3lib.'class.t3lib_tsparser.php');
					$tsparser = t3lib_div::makeInstance("t3lib_TSparser");
					$tsparser->lineNumberOffset=1;
					$formattedContent = $tsparser->doSyntaxHighlight($inputCode, array($tsparser->lineNumberOffset), 0);
					$content[]='<strong>T3S-File: '.$fileT3s.'</strong></br><hr />'.$formattedContent;
					break;
				default:
					break;
			}
			}

		return implode("",$content);
	}
开发者ID:blumenbach,项目名称:blumenbach-online.de,代码行数:101,代码来源:ux_t3quixplorer_edit.php

示例13: array

$triggersList = array();
$i = 0;
foreach ($aTriggers as $aTrigger) {
    if ($aTrigger['NUM_TRIGGERS'] != 0) {
        foreach ($aTrigger['TRIGGERS_NAMES'] as $index => $name) {
            $triggersList[$i]['name'] = $name;
            $triggersList[$i]['execution_time'] = strtolower($aTrigger['TIME']);
            //$t_code = $aTrigger['TRIGGERS_VALUES'][$index]['TRI_WEBBOT'];
            //$t_code = str_replace('"', '\'',$t_code);
            //$t_code = addslashes($t_code);
            //$t_code = Only1br($t_code);
            //highlighting the trigger code using the geshi third party library
            G::LoadThirdParty('geshi', 'geshi');
            $geshi = new GeSHi($aTrigger['TRIGGERS_VALUES'][$index]['TRI_WEBBOT'], 'php');
            $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 2);
            $geshi->set_line_style('background: #f0f0f0;');
            $triggersList[$i]['code'] = $geshi->parse_code();
            //$aTrigger['TRIGGERS_VALUES'][$index]['TRI_WEBBOT'];
            $i++;
        }
    } else {
    }
}
//print_r($_SESSION['TRIGGER_DEBUG']['ERRORS']); die;
$DEBUG_ERRORS = array_unique($_SESSION['TRIGGER_DEBUG']['ERRORS']);
foreach ($DEBUG_ERRORS as $error) {
    if (isset($error['ERROR']) and $error['ERROR'] != '') {
        $triggersList[$i]['name'] = 'Error';
        $triggersList[$i]['execution_time'] = 'error';
        $triggersList[$i]['code'] = $error['ERROR'];
        $i++;
开发者ID:nshong,项目名称:processmaker,代码行数:31,代码来源:debug_triggers.php

示例14: array

    array('name' => 'style', 'type' => 'text',   'description' => 'CSS style'),
    array('name' => 'lang',  'type' => 'select', 'options' => array('php', 'sql', 'html'), 'description' => 'language type'),
    array('name' => 'lines', 'type' => 'text',   'description' => 'lines to be highlighted')
);
**/
if (isset($p['style'])) {
    $p['style'] = ' style="' . $p['style'] . '"';
} else {
    $p['style'] = '';
}
if (!$p['lang']) {
    $p['lang'] = 'php-brief';
} else {
    $p['lang'] = $p['lang'];
}
@(list($type, $body) = explode(':', $body, 2));
if ($type == 'file') {
    $geshi = new GeSHi(trim(file_get_contents("{$g['base_path']}/codes/{$body}")), $p['lang']);
    $geshi->set_header_content('Filename: ' . $body);
} elseif ($type == 'code') {
    $geshi = new GeSHi(trim($body), $p['lang']);
}
if (@count($p['lines'])) {
    $geshi->highlight_lines_extra(explode(',', $p['lines']));
    $geshi->set_highlight_lines_extra_style('background: #330');
}
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
$geshi->set_line_style('margin: 3px 0;');
$geshi->set_header_content_style('font-size: 0.8em; color: #333');
$geshi->set_header_type(GESHI_HEADER_DIV);
@($g['slide'] .= '<div class="code">' . $geshi->parse_code() . '</div>');
开发者ID:NabiKAZ,项目名称:PHPresentation,代码行数:31,代码来源:code.php

示例15: View

    public function View($ID, $lang)
    {
        $this->id = intval($ID);
        if (empty($this->id)) {
            die("ID not valid!");
        }
        //Elimino tutti i sorgenti che hanno una durata inferiore a time();
        $this->sql->sendQuery("DELETE FROM " . __PREFIX__ . "pastes WHERE expire_date > 0 AND expire_date < " . time());
        $this->my_is_numeric($this->id);
        $this->check_id_exists($this->id);
        require_once "lib/geshi/geshi.php";
        $this->info = mysql_fetch_array($this->sql->sendQuery("SELECT * FROM `" . __PREFIX__ . "pastes` WHERE id = '" . $this->id . "' LIMIT 1;"));
        $geshi = new GeSHi($this->info['text'], $lang);
        $geshi->set_header_type(GESHI_HEADER_PRE_VALID);
        if (!empty($lang)) {
            $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 2);
        }
        $geshi->set_line_style('font: normal normal 95% \'Courier New\', Courier, monospace; color: #003030;', 'font-weight: bold; color: #006060;', true);
        $geshi->set_line_style('background: #fcfcfc;', 'background: #f0f0f0;', true);
        $geshi->set_header_content_style('font-family: Verdana, Arial, sans-serif;  
										 font-size: 90%; 
										 border-bottom: 2px dotted black;
										 padding: 5px;');
        $this->PrintHeader();
        print "<br />\n" . $geshi->parse_code();
    }
开发者ID:KinG-InFeT,项目名称:0xPaste,代码行数:26,代码来源:terminal.class.php


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