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


PHP GeSHi::set_header_content方法代码示例

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


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

示例1: getLiveInfo

<br><br>
<h2 id="Live_Info">Get Live Info - The 'Hello World' of Samesub</h2>
&nbsp;<p>Let's go right away with an example using Html and Javascript. Just 
copy the following code, save it in a .html file and then open it from a Web 
Browser. The example prints the current title and the time remaining.</p>
<?php 
$source = "<html>\n\t<head>\n\t\t<script type=\"text/javascript\" src=\"http://code.jquery.com/jquery-latest.js\"></script>\n\t\t<script type=\"text/javascript\">\n\t\tfunction getLiveInfo(){\n\t\t\t\$.getJSON('http://samesub.com/api/v1/live/getall?callback=?',\n\t\t\t\t{},\n\t\t\t\tfunction(data) {\n\t\t\t\t\t//If everything is ok(response_code == 200), let's print some LIVE information\n\t\t\t\t\tif(data.response_code == 200){\n\t\t\t\t\t\t\$('#title').html(data.title);\n\t\t\t\t\t\t\$('#time_remaining').html(data.time_remaining + ' seconds.');\n\t\t\t\t\t}else{\n\t\t\t\t\t\t//Otherwise alert data.response_message\t\t\t\t\n\t\t\t\t\t\talert(data.response_message);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t\t\n\t\t//When the page has loaded, we call our function\n\t\t\$(document).ready(function() {\n\t\t\tgetLiveInfo();\n\t\t});\n\t\t</script>\n\t</head>\n\t<body>\n\t\t<h1>My First Samesub API example</h1>\n\t\t<p>Current Title: <span id=\"title\"></span></p>\n\t\t<p>Time remaining: <span id=\"time_remaining\"></span></p>\n\t</body>\n</html>";
$language = 'Javascript';
$geshi = new GeSHi($source, $language);
$geshi->enable_classes();
$geshi->set_overall_class('myjs_lines');
$geshi->set_header_type(GESHI_HEADER_PRE_TABLE);
$geshi->set_overall_style("padding:0 0 5px 0;border:1px solid #999999");
$geshi->set_tab_width(2);
$geshi->set_header_content("(<LANGUAGE>) Example - Getting current subject info in homepage(LIVE) using Jquery");
$geshi->set_header_content_style("background-color: #DFDFFF;font-size:14px;font-weight:bold;");
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
$geshi->set_line_style('background: #fcfcfc;', true);
Yii::app()->clientScript->registerCss('highlightcode', $geshi->get_stylesheet());
echo $geshi->parse_code();
?>

<p>&nbsp;</p>
<p>Let's analyze the code step by step:</p>
<ol>
	<li>We include the <a href="http://jquery.com/">Jquery Javascript Framework</a> 
	to make our work more easy.</li>
<li>We use the 
<a href="api#live/getall">live/getall</a> API resource to get the information in live(homepage).</li>
	<li>For this example we have added a callback parameter to the url (notice
开发者ID:jjsub,项目名称:samesub,代码行数:30,代码来源:quickguide.php

示例2: rgb

	$geshi->set_methods_style(1, "color: black;", false);
	
	//for multi-line comments /**/
	$geshi->set_comments_style('MULTI','color: rgb(63,127,95); font-style: code;', false);

	//for 'import' keyword
//	$geshi->set_comments_style(2,'color: rgb(127,0,85); font-weight: bold;', false);

	//for string constants
	$geshi->set_strings_style('color: rgb(42,0,255);', true);

	//for links (standard classes, etc.)
	$geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
	$geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');

	//for keywords
	$geshi->set_keyword_group_style(1,'color: rgb(127,0,85); font-weight: bold;', false);
	$geshi->set_keyword_group_style(2,'color: rgb(127,0,85); font-weight: bold;', false); 
	$geshi->set_keyword_group_style(4,'color: rgb(127,0,85); font-weight: bold;', false); 
	
	//new keyword group for 'package'
//	$geshi->add_keyword_group(5, 'color: rgb(127,0,85); font-weight: bold;', true, array('package', 'import'));

	$geshi->set_header_content('SVNKit API examlpe: '.$fileName);
	$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_symbols_highlighting(false);
	$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;');
	$geshi->set_url_for_keyword_group(3,"http://java.sun.com/j2se/1.4.2/docs/api/");
	$code = $geshi->parse_code();
	echo "<html><body><h1 >".$fileName."</h1>".$code."<div style=\"max-width: 800px; width: 800px;\"><center><small style=\"color: #669999; font-size: 100%; margin: 0px; padding: 0px; margin-top: 0.5em; font-weight: normal;\"><span style=\"font-size: 80%;\">(c) 2004-2007 TMate Software. All rights reserved.</span></small></center></div></body></html>";
?>
开发者ID:hudson,项目名称:svnkit,代码行数:31,代码来源:display_example.php

示例3: exit

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;
?>
 - <?php 
$geshi->get_language_name();
?>
</title>
开发者ID:LanceSandino,项目名称:Stikked,代码行数:31,代码来源:aliased.php

示例4:

    // So the source output looks like this:
    //
    // <pre style="[set_overall_style styles]"><ol>
    // <li style="[set_line_style styles]"><div style="[set_code_style styles]>...</div></li>
    // ...
    // </ol></pre>
    $geshi->set_line_style('color: #003030;', 'font-weight: bold; color: #006060;', true);
    $geshi->set_code_style('color: #000020;', true);
    // Styles for hyperlinks in the code. GESHI_LINK for default styles, GESHI_HOVER for hover style etc...
    // note that classes must be enabled for this to work.
    $geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
    $geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
    // Use the header/footer functionality. This puts a div with content within the PRE element, so it is
    // affected by the styles set by set_overall_style. So if the PRE has a border then the header/footer will
    // appear inside it.
    $geshi->set_header_content('<SPEED> <TIME> GeSHi &copy; 2004-2007, Nigel McNie, 2007-2008 Benny Baumann. View source of example.php for example of using GeSHi');
    $geshi->set_header_content_style('font-family: sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;');
    // You can use <TIME> and <VERSION> as placeholders
    $geshi->set_footer_content('Parsed in <TIME> seconds at <SPEED>, using GeSHi <VERSION>');
    $geshi->set_footer_content_style('font-family: sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-top: 1px solid #d0d0d0; padding: 2px;');
} else {
    // make sure we don't preselect any language
    $_POST['language'] = null;
}
?>
<!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>GeSHi examples</title>
<style type="text/css">
开发者ID:CarlosOVillanueva,项目名称:BIFROST,代码行数:31,代码来源:example.php

示例5: implode

    }
    if (!strlen(trim($_POST['source']))) {
        $_POST['source'] = implode('', @file('../geshi/' . $_POST['language'] . '.php'));
        $_POST['language'] = 'php';
    }
    $geshi = new GeSHi($_POST['source'], $_POST['language'], '../geshi/');
    $geshi->set_header_type(GESHI_HEADER_PRE);
    $geshi->enable_classes();
    $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 5);
    $geshi->set_overall_style('color: #000066; border: 1px solid #d0d0d0; background-color: #f0f0f0;', true);
    // Note the use of set_code_style to revert colours...
    $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('GeSHi &copy; 2004, Nigel McNie. View source of example.php for example of using GeSHi');
    $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>GeSHi examples</title>
	<style type="text/css">
	<!--
	<?php 
if (isset($_POST['submit'])) {
    echo $geshi->get_stylesheet();
开发者ID:mmr,项目名称:b1n,代码行数:31,代码来源:example.php

示例6: substr

$geshi->set_highlight_lines_extra_style('background:#FFFF88;');
$geshi->enable_keyword_links(false);
//geshi line numbers
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
$geshi->set_header_type(GESHI_HEADER_DIV);
//geshi styling for syntax box
$geshi->set_overall_style('color: #000066; border: 1px solid #d0d0d0; background-color: #fdfdf6; line-height:1.3em;', true);
$geshi->set_line_style('font: normal normal \'Courier New\', Courier, monospace; color: #003030;', 'font-weight: bold; color: #006060; padding-right: 5px;', true);
$geshi->set_code_style('color: #000020;', 'color: #000020;');
if ($drop['editable'] == 1) {
    if (!isset($_GET['passkey'])) {
        $editable = ' You may <a href="' . $DROP_CONF_siteURL . '/' . $drop['id'] . '/edit">edit this</a> drop.';
    } else {
        $editable = ' You may <a href="' . substr($_SERVER['REQUEST_URI'], 0, -30) . '/edit?pkey=' . $_GET['passkey'] . '">edit this</a> drop.';
    }
} else {
    if ($drop['editable'] == 0) {
        $editable = '';
    } else {
        die("WOAH! WE HAVE AN ERROR IN THE HOUSE!!! CONTACT THE AUTHORITIES!");
    }
}
$geshi->set_header_content('You are viewing Drop #' . $drop['id'] . ' and it is being highlighted with the ' . $drop['lang'] . ' syntax.' . $editable);
$geshi->set_header_content_style('font-family: Verdana, Arial, sans-serif; color: #414141; background-color: #d2d2c8; border-bottom: 1px solid #d0d0d0; padding: 2px;');
if (!isset($drops[1])) {
    $geshi->set_footer_content('Parsed in <TIME> seconds');
}
$geshi->set_footer_content_style('font-family: Verdana, Arial, sans-serif; color: #414141; background-color: #d2d2c8; border-top: 1px solid #d0d0d0; padding: 2px;');
//geshi results
echo $geshi->parse_code();
//echo $drop['text'];
开发者ID:jakedahn,项目名称:dropbin,代码行数:31,代码来源:highlighting.php

示例7: View

    public function View($ID, $line, $lang)
    {
        $this->id = intval($ID);
        if (empty($this->id)) {
            die("<div id=\"error\">ID not valid!</div>");
        }
        //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);
        //Thanks sPaste and Stoner
        $this->url = "http://" . $_SERVER["HTTP_HOST"] . substr($_SERVER["PHP_SELF"], 0, strpos($_SERVER["PHP_SELF"], "/", strlen($_SERVER["PHP_SELF"]) - strlen(basename($_SERVER["PHP_SELF"])) - 1));
        if ($line == 'no') {
            $this->line = "<input type=\"button\" value=\"Visual Lines\" onClick=\"location.href='" . $this->url . "/view.php?id=" . $this->id . "&line=yes'\">\n";
        } else {
            if ($line == NULL || $line == 'yes') {
                $this->line = "<input type=\"button\" value=\"No Visual Lines\" onClick=\"location.href='" . $this->url . "/view.php?id=" . $this->id . "&line=no'\">\n";
            } else {
                if ($line != 'yes' && $line != 'no' && $line != NULL) {
                    die("Hacking Attemp!");
                }
            }
        }
        require_once "lib/geshi/geshi.php";
        $this->info = mysql_fetch_array($this->sql->sendQuery("SELECT * FROM `" . __PREFIX__ . "pastes` WHERE id = '" . $this->id . "' LIMIT 1;"));
        if (!empty($lang)) {
            $geshi = new GeSHi($this->info['text'], $lang);
        } else {
            $geshi = new GeSHi($this->info['text'], $this->info['language']);
        }
        $geshi->set_header_type(GESHI_HEADER_PRE_VALID);
        if ($line == 'yes' || $line == NULL) {
            $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("<font size=\"3\" >\n\n\t\t\t\t\t\t\t\t\tTitle: <b>" . $this->info['title'] . "</b><br />\n\n\t\t\t\t\t\t\t\t\tAuthor: <b>" . $this->info['author'] . "</b><br />\n\n\t\t\t\t\t\t\t\t\tDate: <b>" . $this->info['data'] . "</b> <br />\n\n\t\t\t\t\t\t\t\t\tLanguage: <b>" . $this->info['language'] . "</b>\n\n\t\t\t\t\t\t\t\t\t<br />\n\n\t\t\t\t\t\t\t\t\t<p style=\"float: left;\">Line: <b>" . $this->line . "</b>\n\n\t\t\t\t\t\t\t\t\t<p style=\"float: right;\"><b><a href=\"view.php?mode=raw&id=" . $this->id . "\" target=\"_blank\" >RAW</a> | <a href=\"view.php?mode=embed&id=" . $this->id . "\">EMBED</a></p></b><br /><br />\n\n\t\t\t\t\t\t\t\t\t</font>\n");
        $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();
        $this->PrintFooter();
    }
开发者ID:KinG-InFeT,项目名称:0xPaste,代码行数:45,代码来源:core.class.php

示例8: 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


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