com gtk/php-gtk: Highlight only if tokenizer is available.: demos/phpgtk2-demo.php
[email protected] (David Soria Parra)
| Newsgroups | php.gtk.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: 991123cbc9ba8ae681da6e142bf8c6cad7878862 Author: Andrei Zmievski <[email protected]> Sat, 15 Jul 2006 07:31:31 +0000 Parents: 6e9e5027000e7ed7756051ef2c0444da78a2d3a6 Branches: master Link: http://git.php.net/?p=gtk/php-gtk.git;a=commitdiff;h=991123cbc9ba8ae681da6e142bf8c6cad7878862 Log: Highlight only if tokenizer is available. Changed paths: M demos/phpgtk2-demo.php Diff: 991123cbc9ba8ae681da6e142bf8c6cad7878862 diff --git a/demos/phpgtk2-demo.php b/demos/phpgtk2-demo.php index f106511..e5190b8 100644 --- a/demos/phpgtk2-demo.php +++ b/demos/phpgtk2-demo.php @@ -203,12 +203,13 @@ class PHPGtk2Demo extends GtkWindow protected function highlightSource($filename, $highlight) { $filecontents = file_get_contents($filename); - $tokens = token_get_all($filecontents); $highlighted = ''; $color_codes = array(); - if ($highlight) { + if ($highlight && extension_loaded('tokenizer')) { + $tokens = token_get_all($filecontents); + // this would be much easier if we had functions which supported varargs (like insert_with_tags_by_name), but improvised solution works in the meantime. foreach ($tokens as $token) {