Настройка Π²ΠΎ врСмя выполнСния

ПовСдСниС Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΉ зависит ΠΎΡ‚ установок Π² Ρ„Π°ΠΉΠ»Π΅ php.ini.

ΠŸΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Ρ‹ ΠΊΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΠΈ ΠΏΡ€ΠΎΡ‡ΠΈΡ… Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΉ
Имя По ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽ ΠœΠ΅ΡΡ‚ΠΎ измСнСния Бписок ΠΈΠ·ΠΌΠ΅Π½Π΅Π½ΠΈΠΉ
ignore_user_abort "0" INI_ALL Β 
highlight.string "#DD0000" INI_ALL Β 
highlight.comment "#FF8000" INI_ALL Β 
highlight.keyword "#007700" INI_ALL Β 
highlight.default "#0000BB" INI_ALL Β 
highlight.html "#000000" INI_ALL Β 
browscap NULL INI_SYSTEM Β 
Π”ΠΎΠΏΠΎΠ»Π½ΠΈΡ‚Π΅Π»ΡŒΠ½ΡƒΡŽ ΠΈΠ½Ρ„ΠΎΡ€ΠΌΠ°Ρ†ΠΈΡŽ ΠΈ опрСдСлСния Ρ€Π΅ΠΆΠΈΠΌΠΎΠ² INI_* Π΄Π°Ρ‘Ρ‚ Ρ€Π°Π·Π΄Π΅Π» Β«ΠœΠ΅ΡΡ‚Π° установки ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ΠΎΠ² ΠΊΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΠΈΒ».

ΠšΡ€Π°Ρ‚ΠΊΠΎΠ΅ Ρ€Π°Π·ΡŠΡΡΠ½Π΅Π½ΠΈΠ΅ ΠΊΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΠΎΠ½Π½Ρ‹Ρ… Π΄ΠΈΡ€Π΅ΠΊΡ‚ΠΈΠ².

ignore_user_abort bool

false ΠΏΠΎ ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽ. Если измСняСтся Π½Π° true, Ρ‚ΠΎ скрипты Π½Π΅ Π±ΡƒΠ΄ΡƒΡ‚ ΠΏΡ€Π΅Ρ€Π²Π°Π½Ρ‹ послС Ρ‚ΠΎΠ³ΠΎ, ΠΊΠ°ΠΊ ΠΊΠ»ΠΈΠ΅Π½Ρ‚ Ρ€Π°Π·ΠΎΡ€Π²Ρ‘Ρ‚ соСдинСниС.

Π‘ΠΌΠΎΡ‚Ρ€ΠΈΡ‚Π΅ Ρ‚Π°ΠΊΠΆΠ΅ ignore_user_abort().

highlight.bg string
highlight.comment string
highlight.default string
highlight.html string
highlight.keyword string
highlight.string string

Π¦Π²Π΅Ρ‚Π° для Ρ€Π΅ΠΆΠΈΠΌΠ° подсвСчивания (Syntax Highlighting). Всё, Ρ‡Ρ‚ΠΎ ΠΏΡ€ΠΈΠ΅ΠΌΠ»Π΅ΠΌΠΎ Π² <font color="??????">, Π±ΡƒΠ΄Π΅Ρ‚ Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ.

browscap string

Имя (Π½Π°ΠΏΡ€ΠΈΠΌΠ΅Ρ€, browscap.ini) ΠΈ располоТСниС Ρ„Π°ΠΉΠ»Π° характСристик Π±Ρ€Π°ΡƒΠ·Π΅Ρ€Π°. Π‘ΠΌΠΎΡ‚Ρ€ΠΈΡ‚Π΅ Ρ‚Π°ΠΊΠΆΠ΅ описаниС Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΈ get_browser().

οΌ‹Π”ΠΎΠ±Π°Π²ΠΈΡ‚ΡŒ

ΠŸΡ€ΠΈΠΌΠ΅Ρ‡Π°Π½ΠΈΡ ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»Π΅ΠΉ 3 notes

up
3
Nico ΒΆ
8 years ago
To pass more than one css rule, but also a class, an id, or any html attribute to highlighted element, we can escape a quote to close the inline styling:

    ini_set('highlight.string', '#F8F8F8 ; font-size:1.4em\" class=\'string\' ');
up
-1
Eric ΒΆ
5 years ago
*** Additions to the previous message ***

To change the style directly from a CSS file, it is recommended to only go through classes instead of hard-coding it.

<?php

    // Create an array with default php functions

    $functions = array("default", "html", "keyword", "string", "comment");

    // Replace color code (ex: #FF8000) with class name (ex:"highlight-comment")

    foreach ($functions as $value) {
        ini_set("highlight.$value", "highlight-$value;");
    }

    $content = highlight_file($filename, true);
    // or
    $content = highlight_string($string, true);

    // Convert style="color: highlight-function" into class="highlight-function" into $content
    // It allows you to modify only the default functions

    foreach ($functions as $value) {
        $content = preg_replace("/style=\"color: highlight-$value;\"/", "class=\"highlight-$value\"", $content);
    }

?>

And in the CSS file (for example) :

.highlight-html { color: #000000; }
.highlight-default { color: #0000bb; }
.highlight-keyword { color: #007700; font-weight: bold; }
.highlight-string { color: #dd0000; }
.highlight-comment { color: #ff8000; }
up
-3
Eric ΒΆ
5 years ago
To change the style directly from a CSS file, it is recommended to only go through classes instead of hard-coding it.

<?php

    $functions = array("default", "html", "keyword", "string", "comment");

    foreach ($functions as $value) {
        ini_set("highlight.$value", "highlight-$value;");
    }

?>

And in the CSS file (for example) :

.highlight-html { color: #000000; }
.highlight-default { color: #0000bb; }
.highlight-keyword { color: #007700; font-weight: bold; }
.highlight-string { color: #dd0000; }
.highlight-comment { color: #ff8000; }