Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
<?php
include_once 'geshi.php';
function highlightString( $string, $language )
{
if( !empty($language) ) {
$geshi =& new GeSHi($string, $language);
$return = '<code class="'.$language.'">'.$geshi->parse_code().'</code>';
} else {
$return = '<code>'.htmlspecialchars($string).'</code>';
}
return '<pre>'.$return.'</pre>';
}
preg_replace('<\[blockcode(?::([^\x5D]+))?\]((?s).*?)\[/blockcode\]>ei', '"<pre>".highlightString("\2", "\1")."</pre>"', $string);
?>
preg_replace('<\[ C\]((?s).*?)\[ /C\]>ei', '"<pre>".highlightString("\2", "\1")."</pre>"', $string);
[ C] [ /C]
<?php
include_once 'geshi.php';
function highlightString( $string, $language )
{
if( !empty($language) ) {
$geshi =& new GeSHi($string, $language);
$return = '<code class="'.$language.'">'.$geshi->parse_code().'</code>';
} else {
$return = '<code>'.htmlspecialchars($string).'</code>';
}
return '<pre>'.$return.'</pre>';
}
preg_replace('<\[blockcode(?::([^\x5D]+))?\]((?s).*?)\[/blockcode\]>ei', '"<pre>".highlightString("\2", "\1")."</pre>"', $string);
?>
$string = preg_replace('<\[blockcode(?::([^\x5D]+))?\]((?s).*?)\[/blockcode\]>ei', '"<pre>".highlightString("\2", "\1")."</pre>"', $string);
echo $string;
<?php
require_once 'geshi.php';
function highlightString( $string, $language )
{
if( !empty($language) ) {
$geshi =& new GeSHi($string, $language);
if( $geshi->error() === false ) {
$return = '<code class="'.$language.'">'.preg_replace('/<pre[^>]*>(.*?)<\/pre>/s', '\1', $geshi->parse_code()).'</code>';
} else {
$return = '[blockcode:'.$language.']'.$string.'[/blockcode]';
}
} else {
$return = '<code>'.htmlspecialchars($string).'</code>';
}
return '<pre>'.$return.'</pre>';
}
$string = '[blockcode:php]<?php echo "Hello World!"; ?>[/blockcode] [blockcode:foobar]foobar[/blockcode]';
echo preg_replace('<\[blockcode(?::([^\x5D]+))?\]((?s).*?)\[/blockcode\]>ei', 'highlightString("\2", "\1")', $string);
?>
<?php
if(isset($_POST['show_src'])) {
include('geshi.php');
$source = stripslashes($_POST['src']);
$language = 'php';
$path = 'geshi/';
$geshi = new GeSHi($source, $language, $path);
echo $geshi->parse_code()."\n";
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<textarea cols="50" rows="10" name="src"></textarea>
<br>
<input type="submit" name="show_src" value="Highlight">
</form>