php-highlight-scriptje

Gesponsorde koppelingen

PHP script bestanden

  1. php-highlight-scriptje

« Lees de omschrijving en reacties

index.php:

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
include_once 'init.inc.php';

if (!empty($_POST['text'])){
    
    echo '<div style="border: solid 1px orange; padding: 20px; margin: 20px">';
    highlight_string($_POST['text']);
    echo '</div>';
    exit;
}

?>


<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
    <textarea name="text" style="width: 300px; height: 200px"></textarea>
    <br />
    <input type="submit" />
</form>




init.inc.php:

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php

// figure out the if ":" or ";" should be used for ini separators
if (strpos(strtoupper(PHP_OS), "WIN") !== false) {
    define("INI_PATH_SEPARATOR", ";");
}
else {
    define("INI_PATH_SEPARATOR", ":");
}



// add PEAR to the path
ini_set(
        "include_path",
        ini_get("include_path") . INI_PATH_SEPARATOR .
        realpath("PEAR")
       );

      

// stripslashes as shown on http://php.net/get_magic_quotes_gpc
if (get_magic_quotes_gpc()) {
   function
stripslashes_deep($value)
   {

       $value = is_array($value) ?
                   array_map('stripslashes_deep', $value) :
                   stripslashes($value);

       return $value;
   }


   $_POST = array_map('stripslashes_deep', $_POST);
   $_GET = array_map('stripslashes_deep', $_GET);
   $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}



?>




hilight.css:

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
.hl-default {
    color: Black;
}
.hl-code {
    color: Gray;
}
.hl-brackets {
    color: Olive;
}
.hl-comment {
    color: Orange;
}
.hl-quotes {
    color: Darkred;
}
.hl-string {
    color: Red;
}
.hl-identifier {
    color: Blue;
}
.hl-builtin {
    color: Teal;
}
.hl-reserved {
    color: Green;
}
.hl-inlinedoc {
    color: Blue;
}
.hl-var {
    color: Darkblue;
}
.hl-url {
    color: Blue;
}
.hl-special {
    color: Navy;
}
.hl-number {
    color: Maroon;
}
.hl-inlinetags {
    color: Blue;
}
.hl-main {
    background-color: White;
}
.hl-gutter {
    background-color: #999999;
    color: White
}
.hl-table {
    font-family: courier;
    font-size: 12px;
    border: solid 1px Lightgrey;
}

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.