Version 1.0.8.6
This is the documentation for GeSHi - Generic Syntax Highlighter.
The most modern version of this document is available on the web - go to http://qbnz.com/highlighter/documentation.php to view it.
Any comments, questions, confusing points? Please get in contact with the developers! We need all the information we can get to make the use of GeSHi and everything related to it (including this documentation) a breeze.
GeSHi is exactly what the acronym stands for: a Generic Syntax Highlighter. As long as you have a language file for almost any computer language - whether it be a scripting language, object orientated, markup or anything in between - GeSHi can highlight it! GeSHi is extremely customisable - the same source can be highlighted multiple times in multiple ways - the same source even with a different language. GeSHi outputs XHTML strict compliant code1, and can make use of CSS to save on the amount of output. And what is the cost for all of this? You need PHP. That’s all!
Here are some of the standout features of GeSHi:
This is just a taste of what you get with GeSHi - the best syntax highlighter for the web in the world!
GeSHi started as a mod for the phpBB forum system, to enable highlighting of more languages than the available (which can be roughly estimated to exactly 0 ;)). However, it quickly spawned into an entire project on its own. But now it has been released, work continues on a mod for phpBB3 - and hopefully for many forum systems, blogs and other web-based systems.
Several systems are using GeSHi now, including:
GeSHi is the original work of Nigel McNie. The project was later handed over to Benny Baumann.
Others have helped with aspects of GeSHi also, they’re mentioned in the THANKS
file.
Many people have helped out with GeSHi, whether by creating language files, submitting bug
reports, suggesting new ideas or simply pointing out a new idea or something I’d missed. All
of these people have helped to build a better GeSHi, you can see them in the THANKS
file.
Do you want your name on this list? Why not make a language file, or submit a valid bug? Or perhaps help me with an added feature I can’t get my head around, or suggest a new feature, or even port GeSHi to anothe language? There’s lots you can do to help out, and I need it all :)
I need your feedback! ANYthing you have to say is fine, whether it be a query, congratulations, a bug report or complaint, I don’t care! I want to make this software the best it can be, and I need your help! You can contact me in the following ways:
Remember, any help I am grateful for :)
In this section, you’ll learn a bit about GeSHi, how it works and what it uses, how to install it and how to use it to perform basic highlighting.
If you’re reading this and don’t have GeSHi, that’s a problem ;). So, how do you get your hands on it?
GeSHi requires the following to be installable:
docs/
or contrib/
directory, and you may want to leave out any language files that don’t
take your fancy either.As you can see, the requirements are very small. If GeSHi does NOT work for you in a particular version of PHP, let me know why and I’ll fix it.
There are several ways to get a copy of GeSHi. The first and easiest way of all is visiting http://qbnz.com/highlighter/downloads.php to obtain the latest version. This is suitable especially when you plan on using GeSHi on an production website or otherwise need a stable copy for flawless operation.
If you are somewhat more sophisticated or need a feature just recently implemented you might consider getting GeSHi by downloading via SVN. There are multiple ways for doing so and each one has its own advantages and disadvantages. Let’s cover the various locations in the SVN you might download from:
If you have choosen the right SVN directory for you do a quick
svn co $SVNPATH geshi
where $SVNPATH
is one of the above paths and your desired version of GeSHi will be
downloaded into an subdirectory called “geshi”. If you got a version of GeSHi
you can go on installing as shown below.
Packages come in .zip
, .tar.gz
and .tar.bz2
format, so there’s no complaining about whether it’s available for
you. *nix users probably want .tar.gz
or .tar.bz2
and windows users probably want .zip
.
And those lucky to download it directly from SVN don’t even need to bother extracting GeSHi.
To extract GeSHi in Linux (.tar.gz
):
cd
to the directory where the archive liestar -xzvf [filename]
where [filename]
is the name of the archive (typically GeSHi-1.X.X.tar.gz
)To extract GeSHi in Windows (.zip
):
To extract from .zip
you’ll need an unzipping program - unzip
in Linux, or 7-Zip, WinZip, WinRAR or similar for Windows.
Installing GeSHi is a snap, even for those most new to PHP. There’s no tricks involved. Honest!
GeSHi is nothing more than a PHP class with related language support files. Those of you familiar with PHP can then guess how easy the installation will be: simply copy it into your include path somewhere. You can put it wherever you like in this include path. I recommend that you put the language files in a subdirectory of your include path too - perhaps the same subdirectory that geshi.php is in. Remember this path for later.
If you don’t know what an include path is, don’t worry. Simply copy GeSHi to your webserver. So for example, say your
site is at http://mysite.com/myfolder
, you can copy GeSHi to your site so the directory structure is like this:
http://mysite.com/myfolder/geshi/[language files]
http://mysite.com/myfolder/geshi.php
Or you can put it in any subdirectory you like:
http://mysite.com/myfolder/includes/geshi/[language files]
http://mysite.com/myfolder/includes/geshi.php
When using GeSHi on a live site, the only directory required is the geshi/
subdirectory. Both contrib/
and docs/
are
worthless, and furthermore, as some people discovered, one of the files in contrib had a security hole (fixed as of 1.0.7.3).
I suggest you delete these directories from any live site they are on.
Use of GeSHi is very easy. Here’s a simple example:
PHP code | |
1 23 45 67 89 1011 1213 1415 1617 1819 2021 2223 2425 2627 28 | // // Include the GeSHi library// include_once 'geshi.php'; //// Define some source to highlight, a language to use // and the path to the language files// $source = '$foo = 45; for ( $i = 1; $i < $foo; $i++ ){ echo "$foo\n"; --$foo; }';$language = 'php'; // // Create a GeSHi object// $geshi = new GeSHi($source, $language); // // And echo the result!// echo $geshi->parse_code(); |
As you can see, there’s only three really important lines:
include_once('geshi.php')
This line includes the GeSHi class for use
$geshi = new GeSHi($source, $language);
This line creates a new GeSHi object, holding the source and the language you want to use for highlighting.
echo $geshi->parse_code();
This line spits out the result :)
So as you can see, simple usage of GeSHi is really easy. Just create a new GeSHi object and get the code!
Since version 1.0.2, there is a function included with GeSHi called geshi_highlight
. This behaves exactly as the php
function highlight_string()
behaves - all you do is pass it the language you want to use to highlight and the
path to the language files as well as the source. Here are some examples:
PHP code | |
1 23 45 67 89 1011 1213 1415 1617 1819 2021 | // Simply echo the highlighted code geshi_highlight($source, 'php', $path); // Get the code back, for use later$code = geshi_highlight($source, 'java', $path, true); // Check if there is an error with parsing this code ob_start(); $result = geshi_highlight($source, 'perl', $path);$code = ob_get_contents(); ob_end_clean(); if ( !$result ){ // There was an error with highlighting...} else{ // All OK :)} |
However, these are really simple examples and doesn’t even begin to cover all the advanced features of GeSHi. If you want to learn more, continue on to section 3: Advanced Features.
This section documents the advanced features of GeSHi - strict mode, using CSS classes, changing styles on the fly, disabling highlighting of some things and more.
In this section there are many code snippets. For all of these, you should assume that the GeSHi library has been
included, and a GeSHi object has been created and is referenced by the variable $geshi
. Normally, the
source, language and path used are arbitary.
The Code Container has a fundamental effect on the layout of your code before you even begin to style. What is the
Code Container? It’s the bit of markup that goes around your code to contain it. By default your code is surrounded
by a <pre>
, but you can also specify a <div>
.
The <pre>
header is the default. If you’re familiar with HTML you’ll know that whitespace is rendered
“as is” by a <pre>
element. The advantage for you is that if you use <pre>
the whitespace
you use will appear pretty much exactly how it is in the source, and what’s more GeSHi won’t have to add a whole
lot of <br />
’s and non-breaking spaces (
) to your code to indent it. This saves
you source code (and your valuable visitors waiting time and your bandwidth).
But if you don’t like <pre>
or it looks stupid in your browser no matter what styles you try to
apply to it or something similar, you might want to use a <div>
instead. A <div>
will
result in more source - GeSHi will have to insert whitespace markup - but in return you can wrap long lines of code
that would otherwise have your browser’s horizontal scrollbar appear. Of course with <div>
you can
not wrap lines if you please. The highlighter demo at the GeSHi home page uses the <div>
approach for this reason.
At this stage there isn’t an option to wrap the code in <code>
tags (unless you use the function
geshi_highlight
), partly because of the inconsistent and unexpected ways stuff in <code>
tags is
highlighted. Besides, <code>
is an inline element. But this may become an option in future versions.
As of GeSHi 1.0.7.2 there is a new header type, that specifies that the code should not be wrapped in anything at all.
Another requested addition has been made in GeSHi 1.0.7.20 to force GeSHi to create a block around the highlighted source even if this wasn’t necessary, thus styles that are applied to the output of GeSHi can directly influence the code only even if headers and footers are present.
To change/set the header to use, you call the set_header_type()
method. It has one required argument which
defines the container type. Available are:
$geshi->set_header_type(GESHI_HEADER_DIV);
Puts a <div>
around both, code and linenumbers. Whitespace is converted to
sequences (i.e. one whitespace and the html entity of a non-breaking whitespace) to keep your indendation level
in tact. Tabs are converted as well and you can manually define the tab-width. Lines are automatically wrapped.
Linenumbers are created using an ordered list.
$geshi->set_header_type(GESHI_HEADER_PRE);
Wraps code and linenumbers in a <pre>
container. This way whitespace is kept as-is and thus
this header produces less overhead then the GESHI_HEADER_DIV
header type. Since linenumbers are still
created using an ordered list this header type produces invalid HTML.
$geshi->set_header_type(GESHI_HEADER_PRE_VALID);
When linenumbers are disabled, this behaves just like GESHI_HEADER_PRE
. In the other case though, a
<div>
is used to wrap the code and linenumbers and the <pre>
is put inside the list
items (<li>
). This means slightly larger HTML output compared to GESHI_HEADER_PRE
, but the
output is valid HTML.
$geshi->set_header_type(GESHI_HEADER_PRE_TABLE);
Once again a <div>
tag wraps the output. This time though no ordered list is used to create an ordered list,
but instead we use a table with two cells in a single row. The left cell contains a <pre>
tag which holds all
linenumbers. The second cell holds the highlighted code, also wrapped in a <pre>
tag, just like with
GESHI_HEADER_PRE
.
This produces valid HTML and works around the nasty selection behaviour of Firefox and other Gecko based browsers, see SF#1651996 for more information.
$geshi->set_header_type(GESHI_HEADER_NONE);
No wrapper is added.
Those are the only arguments you should pass to set_header_type
. Passing anything else may cause inconsistencies
in what is used as the Code Container (although it should simply use a <pre>
). Better not to risk it.
GESHI_HEADER_DIV, GESHI_HEADER_PRE, etc. are constants, so don’t put them in strings!
The default styles for the <pre>
and <div>
will be different, especially if you use
line numbers!
I have found that a <pre>
results in code that is smaller than for that of a <div>
, you
should rectify this difference by using set_overall_style()
if you need to. But be aware of this
difference for if you are changing the header type!
GeSHi has the ability to add line numbers to your code (see the demo available at http://qbnz.com/highlighter/demo.php to see what can be achieved). Line numbers are a great way to make your code look professional, especially if you use the fancy line numbers feature.
There are multiple methods for highlighting line numbers, but none of them is perfect. Of the various ways to highlight line numbers GeSHi itself implements 2 different approaches, but allows you by the way it generates the code to do the line numbers yourself if necessary - but more on this case later.
The easiest approach is using the <ol>
-tag for generating the line numbers, but
even though this is the easiest one there’s a big drawback with this one when
using Gecko-engine based browsers like Firefox or Konqueror. In these browsers
this approach will select the line numbers along with the code or will include extra markup in the selection.
The other approach has been implemented in the 1.0.8 release of GeSHi with the GESHI_HEADER_PRE_TABLE
header type.
When using this header type the line numbers are rendered apart from the source
in a table cell while the actual source is formatted as if the GESHI_HEADER_PRE
header had been used.
This approach works with Firefox and other Gecko-based browsers so far although extreme care
has to be taken when applying styles to your source as Windows has some fonts
where bold font is of different height than normal or italic text of the same fontface.
To highlight a source with line numbers, you call the enable_line_numbers()
method:
$geshi->enable_line_numbers($flag);
Where $flag
is one of the following:
GESHI_NORMAL_LINE_NUMBERS
- Use normal line numberingGESHI_FANCY_LINE_NUMBERS
- Use fancy line numberingGESHI_NO_LINE_NUMBERS
- Disable line numbers (default)Normal line numbers means you specify a style for them, and that style gets applied to all of them. Fancy line numbers means that you can specify a different style for each nth line number. You change the value of n (default 5):
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 37);
The second parameter is not used in any other mode. Setting it to 0
is the same as simply using normal line numbers.
Setting it to 1
applies the fancy style to every line number.
The values above are CONSTANTS - so don’t put them in strings!
As of GeSHi 1.0.2, line numbers are added by the use of ordered lists. This solves the old issues of line number styles inheriting from styles meant for the code. Also, this solves an important issue about selecting code. For example, line numbers look nice, but when you go to select the code in your browser to copy it? You got the line numbers too! Not such a good thing, but thankfully this issue is now solved. What is the price? Unfortunately the whole way that styles are inherited/used has changed for those of you who were familiar with 1.0.1, and there is quite a bit more HTML involved. So think carefully about these things before you enable line numbers.
Now, onto how to style line numbers:
Styles are set for line numbers using the set_line_style()
method:
$geshi->set_line_style('background: #fcfcfc;');
If you’re using Fancy Line Numbers mode, you pass a second string for the style of the nth line number:
$geshi->set_line_style('background: #fcfcfc;', 'background: #f0f0f0;');
The second style will have no effect if you’re not using Fancy Line Numbers mode.
By default, the styles you pass overwrite the current styles. Add a boolean “true” after the styles you specify to combine them with the current styles:
PHP code | |
1 23 4 | $geshi->set_line_style('background: red;', true); // or, for fancy line numbers $geshi->set_line_style('background: red;', 'background: blue;', true); |
Due to a bug with Firefox the issue that should have been fixed with 1.0.2 has reappeared in another form as Firefox includes extra text\markup into plaintext versions of webpage copies. This can sometimes be useful (actually it’s used to get the plaintext version of this documentation), but more often is quite annoying. Best practice so far is to either not use line numbers, or offer the visitor of your page a plaintext version of your source. To learn more have a look at the SF.net BugTracker Issue #1651996. This will hopefully be fixed in GeSHi version 1.2 or as soon as Firefox provides webdevelopers with adequate ways to control this feature - whichever comes first!
When you set line number styles, the code will inherit those styles! This is the main issue to come out of the 1.0.2
release. If you want your code to be styled in a predictable manner, you’ll have to call the set_code_style()
method to rectify this problem.
Note also that you cannot apply background colours to line numbers unless you use set_overall_style()
.
Here’s how you’d style:
Use set_overall_style()
to style the overall code block. For example, you can set the border
style/colour, any margins and padding etc. using this method. In addition: set the background colour for
all the line numbers using this method.
Use set_line_style()
to style the foreground of the line numbers. For example, you can set the colour,
weight, font, padding etc. of the line numbers using this method.
Use set_code_style()
to explicitly override the styles you set for line numbers using
set_line_style
. For example, if you’d set the line numbers to be bold (or even if you’d only set
the fancy line number style to be bold), and you didn’t actually want your code to be bold, you’d make sure
that font-weight: normal;
was in the stylesheet rule you passed to set_code_style()
.
This is the one major change from GeSHi 1.0.1 - make sure you become familiar with this, and make sure that you check any code you have already styled with 1.0.1 when you upgrade to make sure nothing bad happens to it.
As of GeSHi 1.0.2, you can now make the line numbers start at any number, rather than just 1. This feature is useful
if you’re highlighting code from a file from around a certain line number in that file, as an additional guide to
those who will view the code. You set the line numbers by calling the start_line_numbers_at()
method:
$geshi->start_line_numbers_at($number);
$number
must be a positive integer (or zero). If it is not, GeSHi will convert it anyway.
If you have not enabled line numbers, this will have no effect.
Although I’d like GeSHi to have XHTML strict compliance, this feature will break compliancy (however transitional
compliancy remains). This is because the only widely supported way to change the start value for line numbers is
by using the start=”number” attribute of the <ol>
tag. Although CSS does provide a mechanism for
doing this, it is only supported in Opera versions 7.5 and above (not even Firefox supports this).
Using CSS to highlight your code instead of in-lining the styles is a definate bonus. Not only is it more compliant (the w3c is deprecating the style attribute in XHTML 2.0) but it results in far less outputted code - up to a whopping 90% saving - which makes a *huge* difference to those unlucky of us on modems!
By default, GeSHi doesn’t use the classes, so it’s easy just to whack out some highlighted code if you need without
worrying about stylesheets. However, if you’re a bit more organised about it, you should use the classes ;). To turn
the use of classes on, you call the enable_classes()
method:
$geshi->enable_classes();
If you want to turn classes OFF for some reason later:
$geshi->enable_classes(false);
If classes are enabled when parse_code()
is called, then the resultant source will use CSS classes in the
output, otherwise it will in-line the styles. The advantages of using classes are great - the reduction in source will
be very noticeable, and what’s more you can use one stylesheet for several different highlights on the same page. In
fact, you can even use an external stylesheet and link to that, saving even more time and source (because stylesheets
are cached by browsers).
There have been problems with inline styles and the Symbol Highlighting added in 1.0.7.21. If you can you should therefore turn CSS classes ON to avoid those issues. Although latest reworks in 1.0.8 should fix most of those issues.
This should be the very first method you call after creating a new GeSHi object! That way, various other methods can act upon your choice to use classes correctly. In theory, you could call this method just before parsing the code, but this may result in unexpected behaviour.
You can set an overall CSS class and id for the code. This is a good feature that allows you to use the same
stylesheet for many different snippets of code. You call set_overall_class()
and set_overall_id
to accomplish this:
PHP code | |
1
2 | $geshi->set_overall_class('mycode'); $geshi->set_overall_id('dk48ck'); |
The default classname is the name of the language being used. This means you can use just the one stylesheet for all sources that use the same language, and incidentally means that you probably won’t have to call these methods too often.
CSS IDs are supposed to be unique, and you should use them as such. Basically, you can specify an ID for your code and then use that ID to highlight that code in a unique way. You’d do this for a block of code that you expressly wanted to be highlighted in a different way (see the section below on gettting the stylesheet for your code for an example).
As of GeSHi 1.0.8 the class name will always include the language name used for highlighting.
The other half of using CSS classes is getting the stylesheet for use with the classes. GeSHi makes it very easy to get a stylesheet for your code, with one easy method call:
PHP code | |
1 23 45 67 89 1011 1213 1415 1617 | $geshi->enable_classes(); // Here we have code that will spit out a header for // a stylesheet. For example: echo '<html><head><title>Code</title> <style type="text/css"><!--'; // Echo out the stylesheet for this code blockecho $geshi->get_stylesheet(); // And continue echoing the page echo '--> </style></head><body>'; |
The get_stylesheet()
method gets the stylesheet for your code in one easy call. All you need to do
is output it in the correct place. As you can also see, you don’t even have to enable class usage to get the
stylesheet nessecary either - however not enabling classes but using the stylesheet may result in problems later.
By default, get_stylesheet()
tries to echo the least amount of code possible. Although currently it doesn’t
check to see if a certain lexic is even in the source, you can expect this feature in the future. At least for the
present however, if you explicitly disable the highlighting of a certain lexic, or disable line numbers, the related
CSS will not be outputted. This may be a bad thing for you perhaps you’re going to use the stylesheet for many blocks
of code, some with line numbers, others with some lexic enabled where this source has it disabled. Or perhaps you’re
building an external stylesheet and want all lexics included. So to get around this problem, you do this:
$geshi->get_stylesheet(false);
This turns economy mode off, and all of the stylesheet will be outputted regardless.
Now lets say you have several snippets of code, using the same language. In most of them you don’t mind if they’re highlighted the same way (in fact, that’s exactly what you want) but in one of them you’d like the source to be highlighted differently. Here’s how you can do that:
PHP code | |
1 23 45 67 89 1011 1213 1415 1617 1819 2021 2223 2425 2627 2829 3031 3233 3435 3637 3839 4041 4243 4445 4647 48 | // assume path is the default "geshi/" relative to the current directory $geshi1 = new GeSHi($source1, $lang); $geshi2 = new GeSHi($source2, $lang); $geshi3 = new GeSHi($source3, $lang); // Turn classes on for all sources$geshi1->enable_classes(); $geshi2->enable_classes(); $geshi3->enable_classes(); // Make $geshi3 unique$geshi3->set_overall_id('different'); //// Methods are called on $geshi3 to change styles... // echo '<html><head><title>Code</title> <style type="text/css"> <!--'; // Get the nessecary stylesheets echo $geshi1->get_stylesheet(); echo $geshi3->get_stylesheet(); echo '--></style></head> <body>'; echo 'Code snippet 1:'; echo $geshi1->parse_code();echo 'Code snippet 2 (same highlighting as 1):'; echo $geshi2->parse_code(); echo 'Code snippet 3 (DIFFERENT highlighting):';echo $geshi3->parse_code(); echo '</body></html>'; |
Before version 1.0.2, you needed to set the class of the code you wanted to be unique to the empty string. This limitation has been removed in version 1.0.2 - if you set the ID of a block of code, all styling will be done based on that ID alone.
An external stylesheet can reduce even more the amount of code needed to highlight some source. However there are some drawbacks with this. To use an external stylesheet, it’s up to you to link it in to your document, normally with the following HTML:
HTML code | |
1
23
| <html> <head><link rel="stylesheet" type="text/css" href="url_to_stylesheet.css" /> |
In your external stylesheet you put CSS declarations for your code. Then just make sure you’re using the correct class (use
set_overall_class()
to ensure this) and this should work fine.
This method is great if you don’t mind the source always being highlighted the same (in particular, if you’re making a plugin for a forum/wiki/other system, using an external stylesheet is a good idea!). It saves a small amount of code and your bandwidth, and it’s relatively easy to just change the stylesheet should you need to. However, using this will render the methods that change the styles of the code useless, because of course the stylesheet is no longer being dynamically generated. You can still disable highlighting of certain lexics dynamically, however.
As of version 1.0.2, GeSHi comes with a contrib/
directory, which in it contains a “wizard” script for creating
a stylesheet. Although this script is by no means a complete solution, it will create the necessary rules for the
basic lexics - comments, strings for example. Things not included in the wizard include regular expressions for any
language that uses them (PHP and XML are two languages that use them), and keyword-link styles. However, this script
should take some of the tedium out of the job of making an external stylesheet. Expect a much better version of this
script in version 1.2!
One of the more powerful features of GeSHi is the ability to change the style of the output dynamically. Why be chained to the boring styles the language authors make up? You can change almost every single aspect of highlighted code - and can even say whether something is to be highlighted at all.
If you’re confused about “styles”, you probably want to have a quick tutorial in them so you know what you can do with them. Checkout the homepage of CSS at http://www.w3.org/Style/CSS.
The code outputted by GeSHi is either in a <div>
or a <pre>
(see the section entitled “The
Code Container”), and this can be styled.
$geshi->set_overall_style('... styles ...');
Where styles is a string containing valid CSS declarations. By default, these styles overwrite the current styles, but you can change this by adding a second parameter:
$geshi->set_overall_style('color: blue;', true);
The default styles “shine through” wherever anything isn’t highlighted. Also, you can apply more advanced styles, like position: (fixed|relative) etc, because a <div>
/<pre>
is a block level element.
Remember that a <div>
will by default have a larger font size than a <pre>
, as discussed in the section “The Code Container”.
You may wish to refer to the section [Styling Line Numbers][1] before reading this section.
As of version 1.0.2, the way line numbers are generated is different, so therefore the way that they are styled is different. In particular, now you cannot set the background style of the fancy line numbers to be different from that of the normal line numbers.
Line number styles are set by using the method set_line_style
:
$geshi->set_line_style($style1, $style2);
$style1
is the style of the line numbers by default, and $style2
is the style of the fancy line numbers.
Things have changed since 1.0.1! This note is very important - please make sure you check this twice before complaining about line numbers!
Because of the way that ordered lists are done in HTML, there really isn’t normally a way to style the actual
numbers in the list. I’ve cheated somewhat with GeSHi - I’ve made it possible to use CSS to style the foreground of
the line numbers. So therefore, you can change the color, font size and type, and padding on them. If you want to
have a pretty background, you must use set_overall_style()
to do this, and use set_code_style()
to style the actual code! This is explained in the section above: Styling Line Numbers.
In addition, the styles for fancy line numbers is now the difference between the normal styles and the styles you want to achieve. For example, in GeSHi prior to 1.0.2 you may have done this to style line numbers:
$geshi->set_line_style('color: red; font-weight: bold;', 'color: green; font-weight: bold');
Now you instead can do this:
$geshi->set_line_style('color: red; font-weight: bold;', 'color: green;');
The font-weight: bold;
will automatically carry through to the fancy styles. This is actually a small
saving in code - but the difference may be confusing for anyone using 1.0.1 at first.
Perhaps the most regular change you will make will be to the styles of a keyword set. In order to change the styles for
a particular set, you’ll have to know what the set is called first. Sets are numbered from 1 up. Typically, set 1
contains keywords like if
, while
, do
, for
, switch
etc, set 2 contains null
, false
, true
etc, set 3
contains function inbuilt into the language (echo
, htmlspecialchars
etc. in PHP) and set 4 contains data types and
similar variable modifiers: int
, double
, real
, static
etc. However these things are not fixed, and you should
check the language file to see what key you want. Having a familiarity with a language file is definately a plus for
using it.
To change the styles for a keyword set, call the set_keyword_group_style()
method:
$geshi->set_keyword_group_style($group, $styles);
Where $group
is the group to change the styles for and $styles
is a string containing the styles
to apply to that group.
By default, the styles you pass overwrite the current styles. Add a boolean true
after the styles you specify to
combine them with the current styles:
$geshi->set_keyword_group_style(3, 'color: white;', true);
To change the styles for a comment group, call the set_comments_style()
method:
$geshi->set_comments_style($group, $styles);
Where $group
is either a number corresponding to a single-line comment, or the string 'MULTI'
to
specify multiline comments:
PHP code | |
1
2 | $geshi->set_comments_style(1, 'font-style: italic;'); $geshi->set_comments_style('MULTI', 'display: hidden;'); |
By default, the styles you pass overwrite the current styles. Add a boolean true
after the styles you specify to
combine them with the current styles:
$geshi->set_comments_style(1, 'font-weight: 100;', true);
In 1.0.7.22 a new kind of Comments called “COMMENT_REGEXP” has been added. Those are handled by setting single line comment styles.
GeSHi can highlight many other aspects of your source other than just keywords and comments. Strings, Numbers, Methods and Brackets among other things can all also be highlighted. Here are the related methods:
PHP code | |
1 23 45 67 | $geshi->set_escape_characters_style($styles[, $preserve_defaults]); $geshi->set_symbols_style($styles[, $preserve_defaults]); $geshi->set_strings_style($styles[, $preserve_defaults]);$geshi->set_numbers_style($styles[, $preserve_defaults]); $geshi->set_methods_style($key, $styles[, $preserve_defaults]);$geshi->set_regexps_style($key, $styles[, $preserve_defaults]); |
$styles
is a string containing valid stylesheet declarations, while $preserve_defaults
should be set
to true
if you want your styles to be merged with the previous styles. In the case of set_methods_style()
,
you should select a group to set the styles of, check the language files for the number used for each “object splitter”.
Like this was possible for set_method_style
a new parameter has been introduced for
set_symbols_style
too which allows you to select the group of symbols for which you’d like to change your
style. $geshi->set_symbols_style($styles[, $preserve_defaults[, $group]]);
If the third parameter is not
given, group 0 is assumed. Furthermore you should note that any changes to group 0 are also reflected in the bracket
style, i.e. a pass-through call to set_bracket_style
is made.
Since GeSHi 1.0.8 multiple styles for strings and numbers are supported, though the API doesn’t provide full access yet.
Controlling the case of the outputted source is an easy job with GeSHi. You can control which keywords are converted in case, and also control whether keywords are checked in a case sensitive manner.
Auto-Caps/NoCaps is a nifty little feature that capitalises or lowercases automatically certain lexics when they are styled. I dabble in QuickBASIC, a dialect of BASIC which is well known for it’s capatalisation, and SQL is another language well known for using caps for readability.
To change what case lexics are rendered in, you call the set_case_keywords()
method:
$geshi->set_case_keywords($caps_modifier);
The valid values to pass to this method are:
GESHI_CAPS_NO_CHANGE
- Don’t change the case of any lexics, leave as they are foundGESHI_CAPS_UPPER
- Uppercase all lexics foundGESHI_CAPS_LOWER
- Lowercase all lexics foundWhen I say “lexic”, I mean “keywords”. Any keyword in any keyword array will be modified using this option! This is one small area of inflexibility I hope to fix in 1.2.X.
I suspect this will only be used to specify GESHI_CAPS_NO_CHANGE
to turn off autocaps for languages like SQL
and BASIC variants, like so:
PHP code | |
1
2 | $geshi = new GeSHi($source, 'sql'); $geshi->set_case_keywords(GESHI_CAPS_NO_CHANGE); // don't want keywords capatalised |
All the same, it can be used for some interesting effects:
PHP code | |
1 23 4 | $geshi = new GeSHi($source, 'java'); // Anyone who's used java knows how picky it is about CapitalLetters...$geshi->set_case_keywords(GESHI_CAPS_LOWER); // No *way* the source will look right now ;) |
Some languages, like PHP, don’t mind what case function names and keywords are in, while others, like Java, depend on
such pickiness to maintain their bad reputations ;). In any event, you can use the set_case_sensitivity()
to change the case sensitiveness of a particular keyword group from the default:
$geshi->set_case_sensitivity($key, $sensitivity);
Where $key
is the key of the group for which you wish to change case sensitivness for (see the language file
for that language), and $sensitivity
is a boolean value - true
if the keyword is case sensitive, and
false
if not.
What happens if you want to change the source to be highlighted on the fly, or the language. Or if you want to specify any of those basic fields after you’ve created a GeSHi object? Well, that’s where these methods come in.
To change the source code, you call the set_source()
method:
$geshi->set_source($newsource);
Example:
PHP code | |
1 23 45 67 8 | $geshi = new GeSHi($source1, 'php'); // Method calls to specify various options... $code1 = $geshi->parse_code(); $geshi->set_source($source2); $code2 = $geshi->parse_code(); |
What happens if you want to change the language used for highlighting? Just call set_language()
:
$geshi->set_language('newlanguage');
Example:
PHP code | |
1 23 45 67 89 10 | $geshi = new GeSHi($source, 'php'); $code = $geshi->parse_code(); // Highlight GeSHi's output $geshi->set_source($code); $geshi->set_language('html4strict');$geshi->enable_classes(false); echo $geshi->parse_code(); |
As of GeSHi 1.0.5, you can use the method load_from_file()
to load the source code and language from a file.
Simply pass this method a file name and it will attempt to load the source and set the language.
$geshi->load_from_file($file_name, $lookup);
$file_name
is the file name to use, and $lookup
is an optional parameter that contains a lookup
array to use for deciding which language to choose. You can use this to override GeSHi’s default lookup array, which
may not contain the extension of the file you’re after, or perhaps does have your extension but under a different
language. The lookup array is of the form:
PHP code | |
1 23 4 | array( 'lang_name' => array('extension', 'extension', ...), 'lang_name' ... ); |
Also, you can use the method get_language_name_from_extension()
if you need to convert a file extension
to a valid language name. This method will return the empty string if it could not find a match in the lookup, and
like load_from_file
it accepts an optional second parameter that contains a lookup array.
Names are case-insensitive - they will be converted to lower case to match a language file however. So if you’re making a language file, remember it should have a name in lower case.
What you pass to this method is the name of a language file, minus the .php extension. If you’re writing a plugin for a particular application, it’s up to you to somehow convert user input into a valid language name.
Since GeSHi 1.0.8 this function does not reset language settings for an already loaded language. If you want
to highlight code in the same language with different settings add the optional
$force_reset parameter
:
$geshi->set_language('language', true);
GeSHi include()
s the language file, so be careful to make sure that users can’t pass some wierd
language name to include any old script! GeSHi tries to strip non-valid characters out of a language name, but
you should always do this your self anyway. In particular, language files are always lower-case, with either
alphanumeric characters, dashes or underscores in their name.
At the very least, strip “/” characters out of a language name.
What happens if all of a sudden you want to use language files from a different directory from the current
language file location? You call the set_language_path()
method:
$geshi->set_language_path($newpath);
It doesn’t matter whether the path has a trailing slash after it or not - only that it points to a valid folder. If it doesn’t, that’s your tough luck ;)
Although GeSHi itself does not require to know the exact charset of your source you
will need to set this option when processing sources where multi-byte characters can occur.
As of GeSHi 1.0.7.18 internally a rewrite of htmlspecialchars
is used
due to a security flaw in that function that is unpatched in even the most recent PHP4 versions and in PHP5 < 5.2.
Although this does no longer explicitely require the charset it is required again
as of GeSHi 1.0.8 to properly handle multi-byte characters (e.g. after an escape char).
As of GeSHi 1.0.8 the default charset has been changed to UTF-8.
As of version 1.0.3, you can use the method set_encoding()
to specify the character set that your source
is in. Valid names are those names that are valid for the PHP mbstring library:
$geshi->set_encoding($encoding);
There is a table of valid strings for $encoding
at the php.net manual linked to above. If you do not
specify an encoding, or specify an invalid encoding, the character set used is ISO-8859-1.
What happens if you try to highlight using a language that doesn’t exist? Or if GeSHi can’t read a required file?
The results you get may be confusing. You may check your code over and over, and never find anything wrong. GeSHi
provides ways of finding out if GeSHi itself found anything wrong with what you tried to do. After highlighting,
you can call the error()
method:
$geshi = new GeSHi('hi', 'thisLangIsNotSupported');
echo $geshi->error(); // echoes error message
The error message you will get will look like this:
GeSHi Error: GeSHi could not find the language thisLangIsNotSupported (using path geshi/) (code 2)
The error outputted will be the last error GeSHi came across, just like how mysql_error()
works.
One disadvantage of GeSHi is that for large source files using complex languages, it can be quite slow with
every option turned on. Although future releases will concentrate on the speed/resource side of highlighting,
you can gain speed by disabling some of the highlighting options. This is done by using a
series of set_*_highlighting
methods:
set_keyword_group_highlighting($group, $flag):
$group
of keywords is to be highlighted or not. Consult the necessary
language file(s) to see what $group
should be for each group (typically a positive integer).
$flag
is false
if you want to disable highlighting of this group, and true
if you want
to re-enable higlighting of this group. If you disable a keyword group then even if the keyword group has a
related URL one will not be generated for that keyword.set_comments_highlighting($group, $flag):
$group
of comments is to be highlighted or not. Consult the necessary
language file(s) to see what $group
should be for each group (typically a positive integer, or th
string 'MULTI'
for multiline comments. $flag
is false
if you want to disable
highlighting of this group, and true
if you want to re-enable highlighting of this group.set_regexps_highlighting($regexp, $flag):
$regexp
is to be highlighted or not. Consult the necessary language file(s)
to see what $regexp
should be for each regexp (typically a positive integer, or the string 'MULTI'
for multiline comments. $flag
is false
if you want to disable highlighting of this group,
and true
if you want to re-enable highlighting of this group.The following methods:
set_escape_characters_highlighting($flag)
set_symbols_highlighting($flag)
set_strings_highlighting($flag)
set_numbers_highlighting($flag)
set_methods_highlighting($flag)
Work on their respective lexics (e.g. set_methods_highlighting()
will disable/enable highlighting of methods).
For each method, if $flag
is false
then the related lexics will not be highlighted at all (this
means no HTML will surround the lexic like usual, saving on time and bandwidth.
In case all highlighting should be disabled or reenabled GeSHi provides two methods called disable_highlighting()
and enable_highlighting($flag)
. The optional paramter $flag
has been added in 1.0.7.21 and specifies
the desired state, i.e. true
(default) to turn all highlighting on, or false
to turn all
highlighting off. Since 1.0.7.21 the method disnable_highlighting()
has become deprecated.
If you’re using the <pre>
header, tabs are handled automatically by your browser, and in general you can
count on good results. However, if you’re using the <div>
header, you may want to specify a tab
width explicitly.
Note that tabs created in this fashion won’t be like normal tabs - there won’t be “tab-stops” as such, instead tabs will be replaced with the specified number of spaces - just like most editors do.
To change the tab width, you call the set_tab_width()
method:
$geshi->set_tab_width($width);
Where $width
is the width in spaces that you’d like tabs to be.
Some languages like to get tricky, and jump in and out of the file that they’re in. For example, the vast
majority of you reading this will have used a PHP file. And you know that PHP code is only executed if it’s
within delimiters like <?php
and ?>
(there are others of course…). So what happens if you do the
following in a php file?
<img src="<?php echo rand(1, 100) ?>" />
When using GeSHi without strict mode, or using a bad highlighter, you’ll end up with scrambled crap,
especially if you’re being slack about where you’re putting your quotes, you could end up with the rest
of your file as bright blue. Fortunately, you can tell GeSHi to be “strict” about just when it highlights
and when it does not, using the enable_strict_mode()
method:
$geshi->enable_strict_mode($mode);
Where $mode
is true
or not specified to enable strict mode, or false
to disable
strict mode if you’ve already turned it and don’t want it now.
As of GeSHi 1.0.8 there is a new way to tell GeSHi when to use Strict Mode
which is somewhat more intelligent than in previous releases. GeSHi now also
allows GESHI_MAYBE
, GESHI_NEVER
and GESHI_ALWAYS
instead of true
and false
.
Basically GESHI_ALWAYS
(true
) always enables strict mode,
whereas GESHI_NEVER
(false
) completely disables strict mode. The new thing is
GESHI_MAYBE
which enables strict mode if it finds any sequences of code
that look like strict block delimiters.
By the way: That’s why this section had to be changed, as the new documentation tool we now use, applies this feature and thus auto-detects when strict mode has to be used…
Lets say that you’re working on a large project, with many files, many classes and many functions. Perhaps also you have the source code on the web and highlighted by GeSHi, perhaps as a front end to CVS, as a learning tool, something to refer to, whatever. Well, why not highlight the names of the functions and classes your project uses, as well as the standard functions and classes? Or perhaps you’re not interested in highlighting certain functions, and would like to remove them? Or maybe you don’t mind if an entire function group goes west in the interest of speed? GeSHi can handle all of this!
If you want to add a keyword to an existing keyword group, you use the add_keyword
method:
$geshi->add_keyword($key, $word);
Where $key
is the index of the group of keywords you want to add this keyword to, and $word
is
the word to add.
This implies knowledge of the language file to know the correct index.
Perhaps you want to remove a keyword from an existing group. Maybe you don’t use it and want to save yourself some time. Whatever the reason, you can remove it using the remove_keyword
method:
$geshi->remove_keyword($key, $word);
Where $key
is the index of the group of keywords that you want to remove this keyword from, and
$word
is the word to remove.
This implies knowledge of the language file to know the correct index - most of the time the keywords you’ll want to remove will be in group 3, but this is not guaranteed and you should check the language file first.
This function is silent - if the keyword is not in the group you specified, nothing awful will happen ;)
Lets say for your big project you have several main functions and classes that you’d like highlighted. Why not add them as their own group instead of having them highlighted the same way as other keywords? Then you can make them stand out, and people can instantly see which functions and classes are user defined or inbuilt. Furthermore, you could set the URL for this group to point at the API documentation of your project.
You add a keyword group by using the add_keyword_group
method:
$geshi->add_keyword_group($key, $styles, $case_sensitive, $words);
Where $key
is the key that you want to use to refer to this group, $styles
is the styles that
you want to use to style this group, $case_sensitive
is true or false depending on whether you want
this group of keywords to be case sensitive or not and $words
is an array of words (or a string) of which
words to add to this group. For example:
$geshi->add_keyword_group(10, 'color: #600000;', false, array('myfunc_1', 'myfunc_2', 'myfunc_3'));
Adds a keyword group referenced by index 10, of which all keywords in the group will be dark red, each keyword can be in any case and which contains the keywords “myfunc_1”, “myfunc_2” and “myfunc_3”.
After creating such a keyword group, you may call other GeSHi methods on it, just as you would for any other keyword group.
If you specify a $key
for which there is already a keyword group, the old keyword group will be
overwritten! Most language files don’t use numbers larger than 5, so I recommend you play it safe and use a number
like 10 or 42.
Perhaps you really need speed? Why not just remove an entire keyword group? GeSHi won’t have to loop through
each keyword checking for its existance, saving much time. You remove a keyword group by using the
remove_keyword_group
method:
$geshi->remove_keyword_group($key);
Where $key
is the key of the group you wish to remove. This implies knowleged of the language file.
So you want to add some special information to the highlighted source? GeSHi can do that too! You can specify headers and footers for your code, style them, and insert information from the highlighted source into your header or footer.
In your header and footer, you can put special keywords that will be replaced with actual configuration values for this GeSHi object. The keywords you can use are:
<TIME>
or {TIME}
: Is replaced by the time it took for the parse_code()
method - i.e.,
how long it took for your code to be highlighted. The time is returned to three decimal places.<LANGUAGE>
or {LANGUAGE}
: Is replaced by a nice, friendly version of the language name used to
highlight this code.<SPEED>
or {SPEED}
: Is replaced by the speed at which your source has been processed.<VERSION>
or {VERSION}
: The GeSHi version used to highlight the code.The header for your code is a <div>
, which is inside the containing block. Therefore, it is affected by
the method set_overall_style
, and should contain the sort of HTML that belongs in a <div>
.
You may use any HTML you like, and format it as an HTML document. You should use valid HTML - convert to entities
any quotemarks or angle brackets you want displayed. You set the header content using the method
set_header_content()
:
$geshi->set_header_content($content);
Where $content
is the HTML you want to use for the header.
The footer for your code is a <div>
, which is inside the containing block. Therefore, it is affected by
the method set_overall_style
, and should contain the sort of HTML that belongs in a <div>
.
You may use any HTML you like, and format it as an HTML document. You should use valid HTML - convert to entities
any quotemarks or angle brackets you want displayed. You set the footer content using the method
set_footer_content()
:
$geshi->set_footer_content($content);
Where $content
is the HTML you want to use for the footer.
You can apply styles to the header content you have set with the set_header_content_style
:
$geshi->set_header_content_style($styles);
Where $styles
is the stylesheet declarations you want to use to style the header content.
You can apply styles to the footer content you have set with the set_footer_content_style
:
$geshi->set_footer_content_style($styles);
Where $styles
is the stylesheet declarations you want to use to style the footer content.
As of version 1.0.2, GeSHi allows you to specify a URL for keyword groups. This URL is used by GeSHi to convert
the keywords in that group into URLs to appropriate documentation. And using add_keyword_group
you
can add functions and classes from your own projects and use the URL functionality to provide a link to your
own API documentation.
To set the URL to be used for a keyword group, you use the set_url_for_keyword_group()
method:
$geshi->set_url_for_keyword_group($group, $url);
Where $group
is the keyword group you want to assign the URL for, and $url
is the URL for
this group of keywords.
You may be wondering how to make each keyword in the group point to the correct URL. You do this by putting
{FNAME}
in the URL at the correct place. For example, PHP makes it easy by linking www.php.net/function-name
to the documentation for that function, so the URL used is http://www.php.net/{FNAME}
.
Of course, when you get to a language like Java, that puts its class documentation in related folders, it gets a little trickier to work out an appropriate URL (see the Java language file!). I hope to provide some kind of redirection service at the GeSHi website in the future.
As of Version 1.0.7.21 there have been added two more symbols you can use to link to functions. {FNAMEL}
will generate the lowercase version of the keyword, {FNAMEU}
will generate the uppercase version. {FNAME}
will provide the keyword as specified in the language file. Use one of these more specific placeholders
if possible, as they result in less overhead while linking for case insensitive languages.
It’s easy to disable a URL for a keyword group: Simply use the method set_url_for_keyword_group()
to pass
an empty string as the URL:
$geshi->set_url_for_keyword_group($group, '');
As of GeSHi 1.0.7.18, you can disable all URL linking for keywords:
$geshi->enable_keyword_links(false);
You can also style the function links. You can style their default status, hovered, active and visited status.
All of this is controlled by one method, set_link_styles()
:
$geshi->set_link_styles($mode, $styles);
Where $mode
is one of four values:
GESHI_LINK
: The default style of the links.GESHI_HOVER
: The style of the links when they have focus (the mouse is hovering over them).GESHI_ACTIVE
: The style of the links when they are being clicked.GESHI_VISITED
: The style of links that the user has already visited.And $styles
is the stylesheet declarations to apply to the links.
The names GESHI_LINK
, GESHI_HOVER
… are constants. Don’t put them in quotes!
Perhaps you want to set the target of link attributes, so the manual pages open in a new window? Use the
set_link_target()
method:
$geshi->set_link_target($target, $styles);
Where $target
is any valid (X)HTML target value - _blank
or _top
for example.
This functionality is not only buggy, but is proving very hard to implement in 1.1.X. Therefore, this functionality may well be removed in 1.2.0. You are hereby warned!
This feature allows you to mark a part of your source as important. But as the implementation its use is deprecated and you should consider using the “Highlight Lines Extra” feature described below.
An alternative (and more stable) method of highlighting code that is important is to use extra highlighting by line. Although you may not know what line numbers contain the important lines, if you do this method is a much more flexible way of making important lines stand out.
To specify which lines to highlight extra, you pass an array containing the line numbers to highlight_lines_extra()
:
$geshi->highlight_lines_extra($array);
The array could be in the form array(2, 3, 4, 7, 12, 344, 4242)
, made from a DB query, generated
from looking through the source for certain important things and working out what line those things are…
However you get the line numbers, the array should simply be an array of integers.
Here’s an example, using the same source as before:
PHP code | |
1 23 45 67 89 1011 1213 1415 1617 1819 2021 | // // Here we go again! This time we'll simply highlight the 8th line// $source = 'public int[][] product ( n, m ){ int [][] ans = new int[n][m]; for ( int i = 0; i < n; i++ ) { for ( int j = 0; i < m; j++ ) { ans[i][j] = i * j; } } return ans;}'; $geshi = new GeSHi($source, 'java'); $geshi->highlight_lines_extra(array(8)); echo $geshi->parse_code(); |
Which produces:
Java code | |
1 23 45 67 89 1011 12 | public int[][] product ( n, m ) { int [][] ans = new int[n][m]; for ( int i = 0; i < n; i++ ) { for ( int j = 0; i < m; j++ ) { ans[i][j] = i * j; } } return ans; } |
What’s more, as you can see the code on a highlighted line is still actually highlighted itself.
Again as with contextual importance, you’re not chained to the yellow theme that is the default. You can
use the set_highlight_lines_extra_style
method:
$geshi->set_highlight_lines_extra_style($styles);
Where $styles
is the stylesheet declarations that you want to apply to highlighted lines.
Perhaps you’re a javascript junkie? GeSHi provides a way to give each line an ID so you can access that line with
javascript, or perhaps just by plain CSS (though if you want to access lines by CSS you should use the method
in the previous section). To enable IDs you call the enable_ids()
method:
$geshi->enable_ids($flag);
Where $flag
is true
or not present to enable IDs, and false
to disable them again if you need.
The ID generated is in the form {overall-css-id}-{line-number}
. So for example, if you set the overall CSS id to
be “mycode”, then the IDs for each line would by “mycode-1”, “mycode-2” etc. If there is no CSS ID set, then one is
made up in the form geshi-[4 random characters]
, but this is not so useful for if you want to do javascript manipulation.
Once you’ve called parse_code()
, you can get the time it took to run the highlighting by calling the
get_time()
method:
PHP code | |
1 23 45 67 | $geshi = new GeSHi($source, $language, $path); $code = mysql_real_escape_string($geshi->parse_code()); $time = $geshi->get_time(); // do something with itmysql_query("INSERT INTO code VALUES ('$code', '$time')"); |
So now you know what features GeSHi offers, and perhaps you’ve even meddled with the source. Or perhaps you’d like a language file for language X but it doesn’t seem to be supported? Rubbish! GeSHi will highlight anything, what do you think I coded this for? ^_^ You’ll just have to learn how to make a language file yourself. And I promise it’s not too hard - and if you’re here you’re in the right place!
Let’s begin by looking at an example language file - the language file for the first language ever supported, PHP:
PHP code | |
1 23 45 67 89 1011 1213 1415 1617 1819 2021 2223 2425 2627 2829 3031 3233 3435 3637 3839 4041 4243 4445 4647 4849 5051 5253 5455 5657 5859 6061 6263 6465 6667 6869 7071 7273 7475 7677 7879 8081 8283 8485 8687 8889 9091 9293 9495 9697 9899 100101 102103 104105 106107 108109 110111 112113 114115 116117 118119 120121 122123 124125 126127 128129 130131 132133 134135 136137 138139 140141 142143 144145 146147 148149 150151 152153 154155 156157 158159 160161 162163 164165 166167 168169 170171 172173 174175 176177 178179 180181 182183 184185 186187 188189 190191 192193 194195 196197 198199 200201 202203 204205 206207 208209 210211 212213 214215 216217 218219 220221 222223 224225 226227 228229 230231 232233 234235 236237 238239 240241 242243 244245 246247 248249 250251 252253 254255 256257 258259 260261 262263 264265 266267 268269 270271 272273 274275 276277 278279 280281 282283 284285 286287 288289 290291 292293 294295 296297 298299 300301 302303 304305 306307 308309 310311 312313 314315 316317 318319 320321 322323 324325 326327 328329 330331 332333 334335 336337 338339 340341 342343 344345 346347 348349 350351 352353 354355 356357 358359 360361 362363 364365 366367 368369 370371 372373 374375 376377 378379 380381 382383 384385 386387 388389 390391 392393 394395 396397 398399 400401 402403 404405 406407 408409 410411 412413 414415 416417 418419 420421 422423 424425 426427 428429 430431 432433 434435 436437 438439 440441 442443 444445 446447 448449 450451 452453 454455 456457 458459 460461 462463 464465 466467 468469 470471 472473 474475 476477 478479 480481 482483 484485 486487 488489 490491 492493 494495 496497 498499 500501 502503 504505 506507 508509 510511 512513 514515 516517 518519 520521 522523 524525 526527 528529 530531 532533 534535 536537 538539 540541 542543 544545 546547 548549 550551 552553 554555 556557 558559 560561 562563 564565 566567 568569 570571 572573 574575 576577 578579 580581 582583 584585 586587 588589 590591 592593 594595 596597 598599 600601 602603 604605 606607 608609 610611 612613 614615 616617 618619 620621 622623 624625 626627 628629 630631 632633 634635 636637 638639 640641 642643 644645 646647 648649 650651 652653 654655 656657 658659 660661 662663 664665 666667 668669 670671 672673 674675 676677 678679 680681 682683 684685 686687 688689 690691 692693 694695 696697 698699 700701 702703 704705 706707 708709 710711 712713 714715 716717 718719 720721 722723 724725 726727 728729 730731 732733 734735 736737 738739 740741 742743 744745 746747 748749 750751 752753 754755 756757 758759 760761 762763 764765 766767 768769 770771 772773 774775 776777 778779 780781 782783 784785 786787 788789 790791 792793 794795 796797 798799 800801 802803 804805 806807 808809 810811 812813 814815 816817 818819 820821 822823 824825 826827 828829 830831 832833 834835 836837 838839 840841 842843 844845 846847 848849 850851 852853 854855 856857 858859 860861 862863 864865 866867 868869 870871 872873 874875 876877 878879 880881 882883 884885 886887 888889 890891 892893 894895 896897 898899 900901 902903 904905 906907 908909 910911 912913 914915 916917 918919 920921 922923 924925 926927 928929 930931 932933 934935 936937 938939 940941 942943 944945 946947 948949 950951 952953 954955 956957 958959 960961 962963 964965 966967 968969 970971 972973 974975 976977 978979 980981 982983 984985 986987 988989 990991 992993 994995 996997 998999 10001001 10021003 10041005 10061007 10081009 10101011 10121013 10141015 10161017 10181019 10201021 10221023 10241025 10261027 10281029 10301031 10321033 10341035 10361037 10381039 10401041 10421043 10441045 10461047 10481049 10501051 10521053 10541055 10561057 10581059 10601061 10621063 10641065 10661067 10681069 10701071 10721073 10741075 10761077 10781079 10801081 10821083 10841085 10861087 10881089 10901091 10921093 10941095 10961097 1098 | <?php /************************************************************************************* * php.php * -------- * Author: Nigel McNie (nigel@geshi.org) * Copyright: (c) 2004 Nigel McNie (http://qbnz.com/highlighter/) * Release Version: 1.0.8.6 * Date Started: 2004/06/20 * * PHP language file for GeSHi. * * CHANGES * ------- * 2008/05/23 (1.0.7.22) * - Added description of extra language features (SF#1970248) * 2004/11/25 (1.0.3) * - Added support for multiple object splitters * - Fixed &new problem * 2004/10/27 (1.0.2) * - Added URL support * - Added extra constants * 2004/08/05 (1.0.1) * - Added support for symbols * 2004/07/14 (1.0.0) * - First Release * * TODO (updated 2004/07/14) * ------------------------- * * Make sure the last few function I may have missed * (like eval()) are included for highlighting * * Split to several files - php4, php5 etc * ************************************************************************************* * * This file is part of GeSHi. * * GeSHi is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * GeSHi is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GeSHi; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ************************************************************************************/ $language_data = array( 'LANG_NAME' => 'PHP', 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'), 'COMMENT_MULTI' => array('/*' => '*/'), 'COMMENT_REGEXP' => array( //Heredoc and Nowdoc syntax 3 => '/<<<\s*?(\'?)([a-zA-Z0-9]+?)\1[^\n]*?\\n.*\\n\\2(?![a-zA-Z0-9])/siU', // phpdoc comments 4 => '#/\*\*(?![\*\/]).*\*/#sU', // Advanced # handling 2 => "/#.*?(?:(?=\?\>)|^)/smi" ), 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, 'QUOTEMARKS' => array('"'), 'ESCAPE_CHAR' => '', 'ESCAPE_REGEXP' => array( //Simple Single Char Escapes 1 => "#\\\\[nfrtv\$\"\n\\\\]#i", //Hexadecimal Char Specs 2 => "#\\\\x[\da-fA-F]{1,2}#i", //Octal Char Specs 3 => "#\\\\[0-7]{1,3}#", //String Parsing of Variable Names 4 => "#\\$[a-z0-9_]+(?:\\[[a-z0-9_]+\\]|->[a-z0-9_]+)?|(?:\\{\\$|\\$\\{)[a-z0-9_]+(?:\\[('?)[a-z0-9_]*\\1\\]|->[a-z0-9_]+)*\\}#i", //Experimental extension supporting cascaded {${$var}} syntax 5 => "#\$[a-z0-9_]+(?:\[[a-z0-9_]+\]|->[a-z0-9_]+)?|(?:\{\$|\$\{)[a-z0-9_]+(?:\[('?)[a-z0-9_]*\\1\]|->[a-z0-9_]+)*\}|\{\$(?R)\}#i", //Format String support in ""-Strings 6 => "#%(?:%|(?:\d+\\\\\\\$)?\\+?(?:\x20|0|'.)?-?(?:\d+|\\*)?(?:\.\d+)?[bcdefFosuxX])#" ), 'HARDQUOTE' => array("'", "'"), 'HARDESCAPE' => array("'", "\\"), 'HARDCHAR' => "\\", 'NUMBERS' => GESHI_NUMBER_INT_BASIC | GESHI_NUMBER_OCT_PREFIX | GESHI_NUMBER_HEX_PREFIX | GESHI_NUMBER_FLT_SCI_ZERO, 'KEYWORDS' => array( 1 => array( 'as','break','case','continue','default','do','else','elseif', 'endfor','endforeach','endif','endswitch','endwhile','for', 'foreach','if','include','include_once','require','require_once', 'return','switch','throw','while', 'echo','print' ), 2 => array( '&new','</script>','<?php','<script language', 'class','const','declare','extends','function','global','interface', 'namespace','new','private','protected','public','self','use','var' ), 3 => array( 'abs','acos','acosh','addcslashes','addslashes','aggregate', 'aggregate_methods','aggregate_methods_by_list', 'aggregate_methods_by_regexp','aggregate_properties', 'aggregate_properties_by_list','aggregate_properties_by_regexp', 'aggregation_info','apache_child_terminate','apache_get_modules', 'apache_get_version','apache_getenv','apache_lookup_uri', 'apache_note','apache_request_headers','apache_response_headers', 'apache_setenv','array','array_change_key_case','array_chunk', 'array_combine','array_count_values','array_diff', 'array_diff_assoc','array_diff_key','array_diff_uassoc', 'array_diff_ukey','array_fill','array_fill_keys','array_filter', 'array_flip','array_intersect','array_intersect_assoc', 'array_intersect_key','array_intersect_uassoc', 'array_intersect_ukey','array_key_exists','array_keys','array_map', 'array_merge','array_merge_recursive','array_multisort','array_pad', 'array_pop','array_product','array_push','array_rand', 'array_reduce','array_reverse','array_search','array_shift', 'array_slice','array_splice','array_sum','array_udiff', 'array_udiff_assoc','array_udiff_uassoc','array_uintersect', 'array_uintersect_assoc','array_uintersect_uassoc','array_unique', 'array_unshift','array_values','array_walk','array_walk_recursive', 'arsort','asin','asinh','asort','assert','assert_options','atan', 'atan2','atanh','base_convert','base64_decode','base64_encode', 'basename','bcadd','bccomp','bcdiv','bcmod','bcmul', 'bcompiler_load','bcompiler_load_exe','bcompiler_parse_class', 'bcompiler_read','bcompiler_write_class','bcompiler_write_constant', 'bcompiler_write_exe_footer','bcompiler_write_file', 'bcompiler_write_footer','bcompiler_write_function', 'bcompiler_write_functions_from_file','bcompiler_write_header', 'bcompiler_write_included_filename','bcpow','bcpowmod','bcscale', 'bcsqrt','bcsub','bin2hex','bindec','bindtextdomain', 'bind_textdomain_codeset','bitset_empty','bitset_equal', 'bitset_excl','bitset_fill','bitset_from_array','bitset_from_hash', 'bitset_from_string','bitset_in','bitset_incl', 'bitset_intersection','bitset_invert','bitset_is_empty', 'bitset_subset','bitset_to_array','bitset_to_hash', 'bitset_to_string','bitset_union','blenc_encrypt','bzclose', 'bzcompress','bzdecompress','bzerrno','bzerror','bzerrstr', 'bzflush','bzopen','bzread','bzwrite','cal_days_in_month', 'cal_from_jd','cal_info','cal_to_jd','call_user_func', 'call_user_func_array','call_user_method','call_user_method_array', 'ceil','chdir','checkdate','checkdnsrr','chgrp','chmod','chop', 'chown','chr','chunk_split','class_exists','class_implements', 'class_parents','classkit_aggregate_methods', 'classkit_doc_comments','classkit_import','classkit_method_add', 'classkit_method_copy','classkit_method_redefine', 'classkit_method_remove','classkit_method_rename','clearstatcache', 'closedir','closelog','com_create_guid','com_event_sink', 'com_get_active_object','com_load_typelib','com_message_pump', 'com_print_typeinfo','compact','confirm_phpdoc_compiled', 'connection_aborted','connection_status','constant', 'convert_cyr_string','convert_uudecode','convert_uuencode','copy', 'cos','cosh','count','count_chars','cpdf_add_annotation', 'cpdf_add_outline','cpdf_arc','cpdf_begin_text','cpdf_circle', 'cpdf_clip','cpdf_close','cpdf_closepath', 'cpdf_closepath_fill_stroke','cpdf_closepath_stroke', 'cpdf_continue_text','cpdf_curveto','cpdf_end_text','cpdf_fill', 'cpdf_fill_stroke','cpdf_finalize','cpdf_finalize_page', 'cpdf_global_set_document_limits','cpdf_import_jpeg','cpdf_lineto', 'cpdf_moveto','cpdf_newpath','cpdf_open','cpdf_output_buffer', 'cpdf_page_init','cpdf_rect','cpdf_restore','cpdf_rlineto', 'cpdf_rmoveto','cpdf_rotate','cpdf_rotate_text','cpdf_save', 'cpdf_save_to_file','cpdf_scale','cpdf_set_action_url', 'cpdf_set_char_spacing','cpdf_set_creator','cpdf_set_current_page', 'cpdf_set_font','cpdf_set_font_directories', 'cpdf_set_font_map_file','cpdf_set_horiz_scaling', 'cpdf_set_keywords','cpdf_set_leading','cpdf_set_page_animation', 'cpdf_set_subject','cpdf_set_text_matrix','cpdf_set_text_pos', 'cpdf_set_text_rendering','cpdf_set_text_rise','cpdf_set_title', 'cpdf_set_viewer_preferences','cpdf_set_word_spacing', 'cpdf_setdash','cpdf_setflat','cpdf_setgray','cpdf_setgray_fill', 'cpdf_setgray_stroke','cpdf_setlinecap','cpdf_setlinejoin', 'cpdf_setlinewidth','cpdf_setmiterlimit','cpdf_setrgbcolor', 'cpdf_setrgbcolor_fill','cpdf_setrgbcolor_stroke','cpdf_show', 'cpdf_show_xy','cpdf_stringwidth','cpdf_stroke','cpdf_text', 'cpdf_translate','crack_check','crack_closedict', 'crack_getlastmessage','crack_opendict','crc32','create_function', 'crypt','ctype_alnum','ctype_alpha','ctype_cntrl','ctype_digit', 'ctype_graph','ctype_lower','ctype_print','ctype_punct', 'ctype_space','ctype_upper','ctype_xdigit','curl_close', 'curl_copy_handle','curl_errno','curl_error','curl_exec', 'curl_getinfo','curl_init','curl_multi_add_handle', 'curl_multi_close','curl_multi_exec','curl_multi_getcontent', 'curl_multi_info_read','curl_multi_init','curl_multi_remove_handle', 'curl_multi_select','curl_setopt','curl_setopt_array', 'curl_version','current','cvsclient_connect','cvsclient_log', 'cvsclient_login','cvsclient_retrieve','date','date_create', 'date_date_set','date_default_timezone_get', 'date_default_timezone_set','date_format','date_isodate_set', 'date_modify','date_offset_get','date_parse','date_sun_info', 'date_sunrise','date_sunset','date_time_set','date_timezone_get', 'date_timezone_set','db_id_list','dba_close','dba_delete', 'dba_exists','dba_fetch','dba_firstkey','dba_handlers','dba_insert', 'dba_key_split','dba_list','dba_nextkey','dba_open','dba_optimize', 'dba_popen','dba_replace','dba_sync','dbase_add_record', 'dbase_close','dbase_create','dbase_delete_record', 'dbase_get_header_info','dbase_get_record', 'dbase_get_record_with_names','dbase_numfields','dbase_numrecords', 'dbase_open','dbase_pack','dbase_replace_record', 'dbg_get_all_contexts','dbg_get_all_module_names', 'dbg_get_all_source_lines','dbg_get_context_name', 'dbg_get_module_name','dbg_get_profiler_results', 'dbg_get_source_context','dblist','dbmclose','dbmdelete', 'dbmexists','dbmfetch','dbmfirstkey','dbminsert','dbmnextkey', 'dbmopen','dbmreplace','dbx_close','dbx_compare','dbx_connect', 'dbx_error','dbx_escape_string','dbx_fetch_row','dbx_query', 'dbx_sort','dcgettext','dcngettext','deaggregate','debug_backtrace', 'debug_zval_dump','debugbreak','decbin','dechex','decoct','define', 'defined','define_syslog_variables','deg2rad','dgettext','die', 'dio_close','dio_open','dio_read','dio_seek','dio_stat','dio_write', 'dir','dirname','disk_free_space','disk_total_space', 'diskfreespace','dl','dngettext','docblock_token_name', 'docblock_tokenize','dom_import_simplexml','domxml_add_root', 'domxml_attributes','domxml_children','domxml_doc_add_root', 'domxml_doc_document_element','domxml_doc_get_element_by_id', 'domxml_doc_get_elements_by_tagname','domxml_doc_get_root', 'domxml_doc_set_root','domxml_doc_validate','domxml_doc_xinclude', 'domxml_dump_mem','domxml_dump_mem_file','domxml_dump_node', 'domxml_dumpmem','domxml_elem_get_attribute', 'domxml_elem_set_attribute','domxml_get_attribute','domxml_getattr', 'domxml_html_dump_mem','domxml_new_child','domxml_new_doc', 'domxml_new_xmldoc','domxml_node','domxml_node_add_namespace', 'domxml_node_attributes','domxml_node_children', 'domxml_node_get_content','domxml_node_has_attributes', 'domxml_node_new_child','domxml_node_set_content', 'domxml_node_set_namespace','domxml_node_unlink_node', 'domxml_open_file','domxml_open_mem','domxml_parser', 'domxml_parser_add_chunk','domxml_parser_cdata_section', 'domxml_parser_characters','domxml_parser_comment', 'domxml_parser_end','domxml_parser_end_document', 'domxml_parser_end_element','domxml_parser_entity_reference', 'domxml_parser_get_document','domxml_parser_namespace_decl', 'domxml_parser_processing_instruction', 'domxml_parser_start_document','domxml_parser_start_element', 'domxml_root','domxml_set_attribute','domxml_setattr', 'domxml_substitute_entities_default','domxml_unlink_node', 'domxml_version','domxml_xmltree','doubleval','each','easter_date', 'easter_days','empty','end','ereg','ereg_replace','eregi', 'eregi_replace','error_get_last','error_log','error_reporting', 'escapeshellarg','escapeshellcmd','eval','event_deschedule', 'event_dispatch','event_free','event_handle_signal', 'event_have_events','event_init','event_new','event_pending', 'event_priority_set','event_schedule','event_set','event_timeout', 'exec','exif_imagetype','exif_read_data','exif_tagname', 'exif_thumbnail','exit','exp','explode','expm1','extension_loaded', 'extract','ezmlm_hash','fbird_add_user','fbird_affected_rows', 'fbird_backup','fbird_blob_add','fbird_blob_cancel', 'fbird_blob_close','fbird_blob_create','fbird_blob_echo', 'fbird_blob_get','fbird_blob_import','fbird_blob_info', 'fbird_blob_open','fbird_close','fbird_commit','fbird_commit_ret', 'fbird_connect','fbird_db_info','fbird_delete_user','fbird_drop_db', 'fbird_errcode','fbird_errmsg','fbird_execute','fbird_fetch_assoc', 'fbird_fetch_object','fbird_fetch_row','fbird_field_info', 'fbird_free_event_handler','fbird_free_query','fbird_free_result', 'fbird_gen_id','fbird_maintain_db','fbird_modify_user', 'fbird_name_result','fbird_num_fields','fbird_num_params', 'fbird_param_info','fbird_pconnect','fbird_prepare','fbird_query', 'fbird_restore','fbird_rollback','fbird_rollback_ret', 'fbird_server_info','fbird_service_attach','fbird_service_detach', 'fbird_set_event_handler','fbird_trans','fbird_wait_event','fclose', 'fdf_add_doc_javascript','fdf_add_template','fdf_close', 'fdf_create','fdf_enum_values','fdf_errno','fdf_error','fdf_get_ap', 'fdf_get_attachment','fdf_get_encoding','fdf_get_file', 'fdf_get_flags','fdf_get_opt','fdf_get_status','fdf_get_value', 'fdf_get_version','fdf_header','fdf_next_field_name','fdf_open', 'fdf_open_string','fdf_remove_item','fdf_save','fdf_save_string', 'fdf_set_ap','fdf_set_encoding','fdf_set_file','fdf_set_flags', 'fdf_set_javascript_action','fdf_set_on_import_javascript', 'fdf_set_opt','fdf_set_status','fdf_set_submit_form_action', 'fdf_set_target_frame','fdf_set_value','fdf_set_version','feof', 'fflush','fgetc','fgetcsv','fgets','fgetss','file','file_exists', 'file_get_contents','file_put_contents','fileatime','filectime', 'filegroup','fileinode','filemtime','fileowner','fileperms', 'filepro','filepro_fieldcount','filepro_fieldname', 'filepro_fieldtype','filepro_fieldwidth','filepro_retrieve', 'filepro_rowcount','filesize','filetype','filter_has_var', 'filter_id','filter_input','filter_input_array','filter_list', 'filter_var','filter_var_array','finfo_buffer','finfo_close', 'finfo_file','finfo_open','finfo_set_flags','floatval','flock', 'floor','flush','fmod','fnmatch','fopen','fpassthru','fprintf', 'fputcsv','fputs','fread','frenchtojd','fribidi_charset_info', 'fribidi_get_charsets','fribidi_log2vis','fscanf','fseek', 'fsockopen','fstat','ftell','ftok','ftp_alloc','ftp_cdup', 'ftp_chdir','ftp_chmod','ftp_close','ftp_connect','ftp_delete', 'ftp_exec','ftp_fget','ftp_fput','ftp_get','ftp_get_option', 'ftp_login','ftp_mdtm','ftp_mkdir','ftp_nb_continue','ftp_nb_fget', 'ftp_nb_fput','ftp_nb_get','ftp_nb_put','ftp_nlist','ftp_pasv', 'ftp_put','ftp_pwd','ftp_quit','ftp_raw','ftp_rawlist','ftp_rename', 'ftp_rmdir','ftp_set_option','ftp_site','ftp_size', 'ftp_ssl_connect','ftp_systype','ftruncate','function_exists', 'func_get_arg','func_get_args','func_num_args','fwrite','gd_info', 'getallheaders','getcwd','getdate','getenv','gethostbyaddr', 'gethostbyname','gethostbynamel','getimagesize','getlastmod', 'getmxrr','getmygid','getmyinode','getmypid','getmyuid','getopt', 'getprotobyname','getprotobynumber','getrandmax','getrusage', 'getservbyname','getservbyport','gettext','gettimeofday','gettype', 'get_browser','get_cfg_var','get_class','get_class_methods', 'get_class_vars','get_current_user','get_declared_classes', 'get_defined_constants','get_defined_functions','get_defined_vars', 'get_extension_funcs','get_headers','get_html_translation_table', 'get_included_files','get_include_path','get_loaded_extensions', 'get_magic_quotes_gpc','get_magic_quotes_runtime','get_meta_tags', 'get_object_vars','get_parent_class','get_required_files', 'get_resource_type','glob','gmdate','gmmktime','gmp_abs','gmp_add', 'gmp_and','gmp_clrbit','gmp_cmp','gmp_com','gmp_div','gmp_div_q', 'gmp_div_qr','gmp_div_r','gmp_divexact','gmp_fact','gmp_gcd', 'gmp_gcdext','gmp_hamdist','gmp_init','gmp_intval','gmp_invert', 'gmp_jacobi','gmp_legendre','gmp_mod','gmp_mul','gmp_neg', 'gmp_nextprime','gmp_or','gmp_perfect_square','gmp_popcount', 'gmp_pow','gmp_powm','gmp_prob_prime','gmp_random','gmp_scan0', 'gmp_scan1','gmp_setbit','gmp_sign','gmp_sqrt','gmp_sqrtrem', 'gmp_strval','gmp_sub','gmp_xor','gmstrftime','gopher_parsedir', 'gregoriantojd','gzclose','gzcompress','gzdeflate','gzencode', 'gzeof','gzfile','gzgetc','gzgets','gzgetss','gzinflate','gzopen', 'gzpassthru','gzputs','gzread','gzrewind','gzseek','gztell', 'gzuncompress','gzwrite','hash','hash_algos','hash_file', 'hash_final','hash_hmac','hash_hmac_file','hash_init','hash_update', 'hash_update_file','hash_update_stream','header','headers_list', 'headers_sent','hebrev','hebrevc','hexdec','highlight_file', 'highlight_string','html_doc','html_doc_file','html_entity_decode', 'htmlentities','htmlspecialchars','htmlspecialchars_decode', 'http_build_cookie','http_build_query','http_build_str', 'http_build_url','http_cache_etag','http_cache_last_modified', 'http_chunked_decode','http_date','http_deflate','http_get', 'http_get_request_body','http_get_request_body_stream', 'http_get_request_headers','http_head','http_inflate', 'http_match_etag','http_match_modified','http_match_request_header', 'http_negotiate_charset','http_negotiate_content_type', 'http_negotiate_language','http_parse_cookie','http_parse_headers', 'http_parse_message','http_parse_params', 'http_persistent_handles_clean','http_persistent_handles_count', 'http_persistent_handles_ident','http_post_data','http_post_fields', 'http_put_data','http_put_file','http_put_stream','http_redirect', 'http_request','http_request_body_encode', 'http_request_method_exists','http_request_method_name', 'http_request_method_register','http_request_method_unregister', 'http_send_content_disposition','http_send_content_type', 'http_send_data','http_send_file','http_send_last_modified', 'http_send_status','http_send_stream','http_support', 'http_throttle','hypot','i18n_convert','i18n_discover_encoding', 'i18n_http_input','i18n_http_output','i18n_internal_encoding', 'i18n_ja_jp_hantozen','i18n_mime_header_decode', 'i18n_mime_header_encode','ibase_add_user','ibase_affected_rows', 'ibase_backup','ibase_blob_add','ibase_blob_cancel', 'ibase_blob_close','ibase_blob_create','ibase_blob_echo', 'ibase_blob_get','ibase_blob_import','ibase_blob_info', 'ibase_blob_open','ibase_close','ibase_commit','ibase_commit_ret', 'ibase_connect','ibase_db_info','ibase_delete_user','ibase_drop_db', 'ibase_errcode','ibase_errmsg','ibase_execute','ibase_fetch_assoc', 'ibase_fetch_object','ibase_fetch_row','ibase_field_info', 'ibase_free_event_handler','ibase_free_query','ibase_free_result', 'ibase_gen_id','ibase_maintain_db','ibase_modify_user', 'ibase_name_result','ibase_num_fields','ibase_num_params', 'ibase_param_info','ibase_pconnect','ibase_prepare','ibase_query', 'ibase_restore','ibase_rollback','ibase_rollback_ret', 'ibase_server_info','ibase_service_attach','ibase_service_detach', 'ibase_set_event_handler','ibase_trans','ibase_wait_event','iconv', 'iconv_get_encoding','iconv_mime_decode', 'iconv_mime_decode_headers','iconv_mime_encode', 'iconv_set_encoding','iconv_strlen','iconv_strpos','iconv_strrpos', 'iconv_substr','id3_get_frame_long_name','id3_get_frame_short_name', 'id3_get_genre_id','id3_get_genre_list','id3_get_genre_name', 'id3_get_tag','id3_get_version','id3_remove_tag','id3_set_tag', 'idate','ignore_user_abort','image_type_to_extension', 'image_type_to_mime_type','image2wbmp','imagealphablending', 'imageantialias','imagearc','imagechar','imagecharup', 'imagecolorallocate','imagecolorallocatealpha','imagecolorat', 'imagecolorclosest','imagecolorclosestalpha','imagecolordeallocate', 'imagecolorexact','imagecolorexactalpha','imagecolormatch', 'imagecolorresolve','imagecolorresolvealpha','imagecolorset', 'imagecolorsforindex','imagecolorstotal','imagecolortransparent', 'imageconvolution','imagecopy','imagecopymerge', 'imagecopymergegray','imagecopyresampled','imagecopyresized', 'imagecreate','imagecreatefromgd','imagecreatefromgd2', 'imagecreatefromgd2part','imagecreatefromgif','imagecreatefromjpeg', 'imagecreatefrompng','imagecreatefromstring','imagecreatefromwbmp', 'imagecreatefromxbm','imagecreatetruecolor','imagedashedline', 'imagedestroy','imageellipse','imagefill','imagefilledarc', 'imagefilledellipse','imagefilledpolygon','imagefilledrectangle', 'imagefilltoborder','imagefilter','imagefontheight', 'imagefontwidth','imageftbbox','imagefttext','imagegammacorrect', 'imagegd','imagegd2','imagegif','imagegrabscreen','imagegrabwindow', 'imageinterlace','imageistruecolor','imagejpeg','imagelayereffect', 'imageline','imageloadfont','imagepalettecopy','imagepng', 'imagepolygon','imagepsbbox','imagepsencodefont', 'imagepsextendfont','imagepsfreefont','imagepsloadfont', 'imagepsslantfont','imagepstext','imagerectangle','imagerotate', 'imagesavealpha','imagesetbrush','imagesetpixel','imagesetstyle', 'imagesetthickness','imagesettile','imagestring','imagestringup', 'imagesx','imagesy','imagetruecolortopalette','imagettfbbox', 'imagettftext','imagetypes','imagewbmp','imagexbm','imap_8bit', 'imap_alerts','imap_append','imap_base64','imap_binary','imap_body', 'imap_bodystruct','imap_check','imap_clearflag_full','imap_close', 'imap_create','imap_createmailbox','imap_delete', 'imap_deletemailbox','imap_errors','imap_expunge', 'imap_fetch_overview','imap_fetchbody','imap_fetchheader', 'imap_fetchstructure','imap_fetchtext','imap_get_quota', 'imap_get_quotaroot','imap_getacl','imap_getmailboxes', 'imap_getsubscribed','imap_header','imap_headerinfo','imap_headers', 'imap_last_error','imap_list','imap_listmailbox', 'imap_listsubscribed','imap_lsub','imap_mail','imap_mail_compose', 'imap_mail_copy','imap_mail_move','imap_mailboxmsginfo', 'imap_mime_header_decode','imap_msgno','imap_num_msg', 'imap_num_recent','imap_open','imap_ping','imap_qprint', 'imap_rename','imap_renamemailbox','imap_reopen', 'imap_rfc822_parse_adrlist','imap_rfc822_parse_headers', 'imap_rfc822_write_address','imap_savebody','imap_scan', 'imap_scanmailbox','imap_search','imap_set_quota','imap_setacl', 'imap_setflag_full','imap_sort','imap_status','imap_subscribe', 'imap_thread','imap_timeout','imap_uid','imap_undelete', 'imap_unsubscribe','imap_utf7_decode','imap_utf7_encode', 'imap_utf8','implode','import_request_variables','in_array', 'ini_alter','ini_get','ini_get_all','ini_restore','ini_set', 'intval','ip2long','iptcembed','iptcparse','isset','is_a', 'is_array','is_bool','is_callable','is_dir','is_double', 'is_executable','is_file','is_finite','is_float','is_infinite', 'is_int','is_integer','is_link','is_long','is_nan','is_null', 'is_numeric','is_object','is_readable','is_real','is_resource', 'is_scalar','is_soap_fault','is_string','is_subclass_of', 'is_uploaded_file','is_writable','is_writeable','iterator_apply', 'iterator_count','iterator_to_array','java_last_exception_clear', 'java_last_exception_get','jddayofweek','jdmonthname','jdtofrench', 'jdtogregorian','jdtojewish','jdtojulian','jdtounix','jewishtojd', 'join','jpeg2wbmp','json_decode','json_encode','juliantojd','key', 'key_exists','krsort','ksort','lcg_value','ldap_add','ldap_bind', 'ldap_close','ldap_compare','ldap_connect','ldap_count_entries', 'ldap_delete','ldap_dn2ufn','ldap_err2str','ldap_errno', 'ldap_error','ldap_explode_dn','ldap_first_attribute', 'ldap_first_entry','ldap_first_reference','ldap_free_result', 'ldap_get_attributes','ldap_get_dn','ldap_get_entries', 'ldap_get_option','ldap_get_values','ldap_get_values_len', 'ldap_list','ldap_mod_add','ldap_mod_del','ldap_mod_replace', 'ldap_modify','ldap_next_attribute','ldap_next_entry', 'ldap_next_reference','ldap_parse_reference','ldap_parse_result', 'ldap_read','ldap_rename','ldap_search','ldap_set_option', 'ldap_sort','ldap_start_tls','ldap_unbind','levenshtein', 'libxml_clear_errors','libxml_get_errors','libxml_get_last_error', 'libxml_set_streams_context','libxml_use_internal_errors','link', 'linkinfo','list','localeconv','localtime','log','log1p','log10', 'long2ip','lstat','ltrim','lzf_compress','lzf_decompress', 'lzf_optimized_for','magic_quotes_runtime','mail','max','mbereg', 'mberegi','mberegi_replace','mbereg_match','mbereg_replace', 'mbereg_search','mbereg_search_getpos','mbereg_search_getregs', 'mbereg_search_init','mbereg_search_pos','mbereg_search_regs', 'mbereg_search_setpos','mbregex_encoding','mbsplit','mbstrcut', 'mbstrlen','mbstrpos','mbstrrpos','mbsubstr','mb_check_encoding', 'mb_convert_case','mb_convert_encoding','mb_convert_kana', 'mb_convert_variables','mb_decode_mimeheader', 'mb_decode_numericentity','mb_detect_encoding','mb_detect_order', 'mb_encode_mimeheader','mb_encode_numericentity','mb_ereg', 'mb_eregi','mb_eregi_replace','mb_ereg_match','mb_ereg_replace', 'mb_ereg_search','mb_ereg_search_getpos','mb_ereg_search_getregs', 'mb_ereg_search_init','mb_ereg_search_pos','mb_ereg_search_regs', 'mb_ereg_search_setpos','mb_get_info','mb_http_input', 'mb_http_output','mb_internal_encoding','mb_language', 'mb_list_encodings','mb_output_handler','mb_parse_str', 'mb_preferred_mime_name','mb_regex_encoding','mb_regex_set_options', 'mb_send_mail','mb_split','mb_strcut','mb_strimwidth','mb_stripos', 'mb_stristr','mb_strlen','mb_strpos','mb_strrchr','mb_strrichr', 'mb_strripos','mb_strrpos','mb_strstr','mb_strtolower', 'mb_strtoupper','mb_strwidth','mb_substitute_character','mb_substr', 'mb_substr_count','mcrypt_cbc','mcrypt_cfb','mcrypt_create_iv', 'mcrypt_decrypt','mcrypt_ecb','mcrypt_enc_get_algorithms_name', 'mcrypt_enc_get_block_size','mcrypt_enc_get_iv_size', 'mcrypt_enc_get_key_size','mcrypt_enc_get_modes_name', 'mcrypt_enc_get_supported_key_sizes', 'mcrypt_enc_is_block_algorithm', 'mcrypt_enc_is_block_algorithm_mode','mcrypt_enc_is_block_mode', 'mcrypt_enc_self_test','mcrypt_encrypt','mcrypt_generic', 'mcrypt_generic_deinit','mcrypt_generic_end','mcrypt_generic_init', 'mcrypt_get_block_size','mcrypt_get_cipher_name', 'mcrypt_get_iv_size','mcrypt_get_key_size','mcrypt_list_algorithms', 'mcrypt_list_modes','mcrypt_module_close', 'mcrypt_module_get_algo_block_size', 'mcrypt_module_get_algo_key_size', 'mcrypt_module_get_supported_key_sizes', 'mcrypt_module_is_block_algorithm', 'mcrypt_module_is_block_algorithm_mode', 'mcrypt_module_is_block_mode','mcrypt_module_open', 'mcrypt_module_self_test','mcrypt_ofb','md5','md5_file', 'mdecrypt_generic','memcache_add','memcache_add_server', 'memcache_close','memcache_connect','memcache_debug', 'memcache_decrement','memcache_delete','memcache_flush', 'memcache_get','memcache_get_extended_stats', 'memcache_get_server_status','memcache_get_stats', 'memcache_get_version','memcache_increment','memcache_pconnect', 'memcache_replace','memcache_set','memcache_set_compress_threshold', 'memcache_set_server_params','memory_get_peak_usage', 'memory_get_usage','metaphone','mhash','mhash_count', 'mhash_get_block_size','mhash_get_hash_name','mhash_keygen_s2k', 'method_exists','microtime','mime_content_type','min', 'ming_keypress','ming_setcubicthreshold','ming_setscale', 'ming_useconstants','ming_useswfversion','mkdir','mktime', 'money_format','move_uploaded_file','msql','msql_affected_rows', 'msql_close','msql_connect','msql_create_db','msql_createdb', 'msql_data_seek','msql_db_query','msql_dbname','msql_drop_db', 'msql_dropdb','msql_error','msql_fetch_array','msql_fetch_field', 'msql_fetch_object','msql_fetch_row','msql_field_flags', 'msql_field_len','msql_field_name','msql_field_seek', 'msql_field_table','msql_field_type','msql_fieldflags', 'msql_fieldlen','msql_fieldname','msql_fieldtable','msql_fieldtype', 'msql_free_result','msql_freeresult','msql_list_dbs', 'msql_list_fields','msql_list_tables','msql_listdbs', 'msql_listfields','msql_listtables','msql_num_fields', 'msql_num_rows','msql_numfields','msql_numrows','msql_pconnect', 'msql_query','msql_regcase','msql_result','msql_select_db', 'msql_selectdb','msql_tablename','mssql_bind','mssql_close', 'mssql_connect','mssql_data_seek','mssql_execute', 'mssql_fetch_array','mssql_fetch_assoc','mssql_fetch_batch', 'mssql_fetch_field','mssql_fetch_object','mssql_fetch_row', 'mssql_field_length','mssql_field_name','mssql_field_seek', 'mssql_field_type','mssql_free_result','mssql_free_statement', 'mssql_get_last_message','mssql_guid_string','mssql_init', 'mssql_min_error_severity','mssql_min_message_severity', 'mssql_next_result','mssql_num_fields','mssql_num_rows', 'mssql_pconnect','mssql_query','mssql_result','mssql_rows_affected', 'mssql_select_db','mt_getrandmax','mt_rand','mt_srand','mysql', 'mysql_affected_rows','mysql_client_encoding','mysql_close', 'mysql_connect','mysql_createdb','mysql_create_db', 'mysql_data_seek','mysql_dbname','mysql_db_name','mysql_db_query', 'mysql_dropdb','mysql_drop_db','mysql_errno','mysql_error', 'mysql_escape_string','mysql_fetch_array','mysql_fetch_assoc', 'mysql_fetch_field','mysql_fetch_lengths','mysql_fetch_object', 'mysql_fetch_row','mysql_fieldflags','mysql_fieldlen', 'mysql_fieldname','mysql_fieldtable','mysql_fieldtype', 'mysql_field_flags','mysql_field_len','mysql_field_name', 'mysql_field_seek','mysql_field_table','mysql_field_type', 'mysql_freeresult','mysql_free_result','mysql_get_client_info', 'mysql_get_host_info','mysql_get_proto_info', 'mysql_get_server_info','mysql_info','mysql_insert_id', 'mysql_listdbs','mysql_listfields','mysql_listtables', 'mysql_list_dbs','mysql_list_fields','mysql_list_processes', 'mysql_list_tables','mysql_numfields','mysql_numrows', 'mysql_num_fields','mysql_num_rows','mysql_pconnect','mysql_ping', 'mysql_query','mysql_real_escape_string','mysql_result', 'mysql_selectdb','mysql_select_db','mysql_set_charset','mysql_stat', 'mysql_tablename','mysql_table_name','mysql_thread_id', 'mysql_unbuffered_query','mysqli_affected_rows','mysqli_autocommit', 'mysqli_bind_param','mysqli_bind_result','mysqli_change_user', 'mysqli_character_set_name','mysqli_client_encoding','mysqli_close', 'mysqli_commit','mysqli_connect','mysqli_connect_errno', 'mysqli_connect_error','mysqli_data_seek','mysqli_debug', 'mysqli_disable_reads_from_master','mysqli_disable_rpl_parse', 'mysqli_dump_debug_info','mysqli_embedded_server_end', 'mysqli_embedded_server_start','mysqli_enable_reads_from_master', 'mysqli_enable_rpl_parse','mysqli_errno','mysqli_error', 'mysqli_escape_string','mysqli_execute','mysqli_fetch', 'mysqli_fetch_array','mysqli_fetch_assoc','mysqli_fetch_field', 'mysqli_fetch_field_direct','mysqli_fetch_fields', 'mysqli_fetch_lengths','mysqli_fetch_object','mysqli_fetch_row', 'mysqli_field_count','mysqli_field_seek','mysqli_field_tell', 'mysqli_free_result','mysqli_get_charset','mysqli_get_client_info', 'mysqli_get_client_version','mysqli_get_host_info', 'mysqli_get_metadata','mysqli_get_proto_info', 'mysqli_get_server_info','mysqli_get_server_version', 'mysqli_get_warnings','mysqli_info','mysqli_init', 'mysqli_insert_id','mysqli_kill','mysqli_master_query', 'mysqli_more_results','mysqli_multi_query','mysqli_next_result', 'mysqli_num_fields','mysqli_num_rows','mysqli_options', 'mysqli_param_count','mysqli_ping','mysqli_prepare','mysqli_query', 'mysqli_real_connect','mysqli_real_escape_string', 'mysqli_real_query','mysqli_report','mysqli_rollback', 'mysqli_rpl_parse_enabled','mysqli_rpl_probe', 'mysqli_rpl_query_type','mysqli_select_db','mysqli_send_long_data', 'mysqli_send_query','mysqli_set_charset', 'mysqli_set_local_infile_default','mysqli_set_local_infile_handler', 'mysqli_set_opt','mysqli_slave_query','mysqli_sqlstate', 'mysqli_ssl_set','mysqli_stat','mysqli_stmt_affected_rows', 'mysqli_stmt_attr_get','mysqli_stmt_attr_set', 'mysqli_stmt_bind_param','mysqli_stmt_bind_result', 'mysqli_stmt_close','mysqli_stmt_data_seek','mysqli_stmt_errno', 'mysqli_stmt_error','mysqli_stmt_execute','mysqli_stmt_fetch', 'mysqli_stmt_field_count','mysqli_stmt_free_result', 'mysqli_stmt_get_warnings','mysqli_stmt_init', 'mysqli_stmt_insert_id','mysqli_stmt_num_rows', 'mysqli_stmt_param_count','mysqli_stmt_prepare','mysqli_stmt_reset', 'mysqli_stmt_result_metadata','mysqli_stmt_send_long_data', 'mysqli_stmt_sqlstate','mysqli_stmt_store_result', 'mysqli_store_result','mysqli_thread_id','mysqli_thread_safe', 'mysqli_use_result','mysqli_warning_count','natcasesort','natsort', 'new_xmldoc','next','ngettext','nl2br','nl_langinfo', 'ntuser_getdomaincontroller','ntuser_getusergroups', 'ntuser_getuserinfo','ntuser_getuserlist','number_format', 'ob_clean','ob_deflatehandler','ob_end_clean','ob_end_flush', 'ob_etaghandler','ob_flush','ob_get_clean','ob_get_contents', 'ob_get_flush','ob_get_length','ob_get_level','ob_get_status', 'ob_gzhandler','ob_iconv_handler','ob_implicit_flush', 'ob_inflatehandler','ob_list_handlers','ob_start','ob_tidyhandler', 'octdec','odbc_autocommit','odbc_binmode','odbc_close', 'odbc_close_all','odbc_columnprivileges','odbc_columns', 'odbc_commit','odbc_connect','odbc_cursor','odbc_data_source', 'odbc_do','odbc_error','odbc_errormsg','odbc_exec','odbc_execute', 'odbc_fetch_array','odbc_fetch_into','odbc_fetch_object', 'odbc_fetch_row','odbc_field_len','odbc_field_name', 'odbc_field_num','odbc_field_precision','odbc_field_scale', 'odbc_field_type','odbc_foreignkeys','odbc_free_result', 'odbc_gettypeinfo','odbc_longreadlen','odbc_next_result', 'odbc_num_fields','odbc_num_rows','odbc_pconnect','odbc_prepare', 'odbc_primarykeys','odbc_procedurecolumns','odbc_procedures', 'odbc_result','odbc_result_all','odbc_rollback','odbc_setoption', 'odbc_specialcolumns','odbc_statistics','odbc_tableprivileges', 'odbc_tables','opendir','openlog','openssl_csr_export', 'openssl_csr_export_to_file','openssl_csr_get_public_key', 'openssl_csr_get_subject','openssl_csr_new','openssl_csr_sign', 'openssl_error_string','openssl_free_key','openssl_get_privatekey', 'openssl_get_publickey','openssl_open','openssl_pkcs12_export', 'openssl_pkcs12_export_to_file','openssl_pkcs12_read', 'openssl_pkcs7_decrypt','openssl_pkcs7_encrypt', 'openssl_pkcs7_sign','openssl_pkcs7_verify','openssl_pkey_export', 'openssl_pkey_export_to_file','openssl_pkey_free', 'openssl_pkey_get_details','openssl_pkey_get_private', 'openssl_pkey_get_public','openssl_pkey_new', 'openssl_private_decrypt','openssl_private_encrypt', 'openssl_public_decrypt','openssl_public_encrypt','openssl_seal', 'openssl_sign','openssl_verify','openssl_x509_checkpurpose', 'openssl_x509_check_private_key','openssl_x509_export', 'openssl_x509_export_to_file','openssl_x509_free', 'openssl_x509_parse','openssl_x509_read','ord', 'output_add_rewrite_var','output_reset_rewrite_vars','overload', 'outputdebugstring','pack','parse_ini_file','parse_str','parse_url', 'parsekit_compile_file','parsekit_compile_string', 'parsekit_func_arginfo','parsekit_opcode_flags', 'parsekit_opcode_name','passthru','pathinfo','pclose', 'pdf_add_bookmark','pdf_add_launchlink','pdf_add_locallink', 'pdf_add_nameddest','pdf_add_note','pdf_add_pdflink', 'pdf_add_thumbnail','pdf_add_weblink','pdf_arc','pdf_arcn', 'pdf_attach_file','pdf_begin_font','pdf_begin_glyph', 'pdf_begin_page','pdf_begin_pattern','pdf_begin_template', 'pdf_circle','pdf_clip','pdf_close','pdf_close_image', 'pdf_close_pdi','pdf_close_pdi_page','pdf_closepath', 'pdf_closepath_fill_stroke','pdf_closepath_stroke','pdf_concat', 'pdf_continue_text','pdf_create_gstate','pdf_create_pvf', 'pdf_curveto','pdf_delete','pdf_delete_pvf','pdf_encoding_set_char', 'pdf_end_font','pdf_end_glyph','pdf_end_page','pdf_end_pattern', 'pdf_end_template','pdf_endpath','pdf_fill','pdf_fill_imageblock', 'pdf_fill_pdfblock','pdf_fill_stroke','pdf_fill_textblock', 'pdf_findfont','pdf_fit_image','pdf_fit_pdi_page', 'pdf_fit_textline','pdf_get_apiname','pdf_get_buffer', 'pdf_get_errmsg','pdf_get_errnum','pdf_get_parameter', 'pdf_get_pdi_parameter','pdf_get_pdi_value','pdf_get_value', 'pdf_initgraphics','pdf_lineto','pdf_load_font', 'pdf_load_iccprofile','pdf_load_image','pdf_makespotcolor', 'pdf_moveto','pdf_new','pdf_open_ccitt','pdf_open_file', 'pdf_open_image','pdf_open_image_file','pdf_open_pdi', 'pdf_open_pdi_page','pdf_place_image','pdf_place_pdi_page', 'pdf_process_pdi','pdf_rect','pdf_restore','pdf_rotate','pdf_save', 'pdf_scale','pdf_set_border_color','pdf_set_border_dash', 'pdf_set_border_style','pdf_set_gstate','pdf_set_info', 'pdf_set_parameter','pdf_set_text_pos','pdf_set_value', 'pdf_setcolor','pdf_setdash','pdf_setdashpattern','pdf_setflat', 'pdf_setfont','pdf_setlinecap','pdf_setlinejoin','pdf_setlinewidth', 'pdf_setmatrix','pdf_setmiterlimit','pdf_setpolydash','pdf_shading', 'pdf_shading_pattern','pdf_shfill','pdf_show','pdf_show_boxed', 'pdf_show_xy','pdf_skew','pdf_stringwidth','pdf_stroke', 'pdf_translate','pdo_drivers','pfsockopen','pg_affected_rows', 'pg_cancel_query','pg_clientencoding','pg_client_encoding', 'pg_close','pg_cmdtuples','pg_connect','pg_connection_busy', 'pg_connection_reset','pg_connection_status','pg_convert', 'pg_copy_from','pg_copy_to','pg_dbname','pg_delete','pg_end_copy', 'pg_errormessage','pg_escape_bytea','pg_escape_string','pg_exec', 'pg_execute','pg_fetch_all','pg_fetch_all_columns','pg_fetch_array', 'pg_fetch_assoc','pg_fetch_object','pg_fetch_result','pg_fetch_row', 'pg_fieldisnull','pg_fieldname','pg_fieldnum','pg_fieldprtlen', 'pg_fieldsize','pg_fieldtype','pg_field_is_null','pg_field_name', 'pg_field_num','pg_field_prtlen','pg_field_size','pg_field_table', 'pg_field_type','pg_field_type_oid','pg_free_result', 'pg_freeresult','pg_get_notify','pg_get_pid','pg_get_result', 'pg_getlastoid','pg_host','pg_insert','pg_last_error', 'pg_last_notice','pg_last_oid','pg_loclose','pg_locreate', 'pg_loexport','pg_loimport','pg_loopen','pg_loread','pg_loreadall', 'pg_lounlink','pg_lowrite','pg_lo_close','pg_lo_create', 'pg_lo_export','pg_lo_import','pg_lo_open','pg_lo_read', 'pg_lo_read_all','pg_lo_seek','pg_lo_tell','pg_lo_unlink', 'pg_lo_write','pg_meta_data','pg_numfields','pg_numrows', 'pg_num_fields','pg_num_rows','pg_options','pg_parameter_status', 'pg_pconnect','pg_ping','pg_port','pg_prepare','pg_put_line', 'pg_query','pg_query_params','pg_result','pg_result_error', 'pg_result_error_field','pg_result_seek','pg_result_status', 'pg_select','pg_send_execute','pg_send_prepare','pg_send_query', 'pg_send_query_params','pg_set_client_encoding', 'pg_set_error_verbosity','pg_setclientencoding','pg_trace', 'pg_transaction_status','pg_tty','pg_unescape_bytea','pg_untrace', 'pg_update','pg_version','php_egg_logo_guid','php_ini_loaded_file', 'php_ini_scanned_files','php_logo_guid','php_real_logo_guid', 'php_sapi_name','php_strip_whitespace','php_uname','phpcredits', 'phpdoc_xml_from_string','phpinfo','phpversion','pi','png2wbmp', 'pop3_close','pop3_delete_message','pop3_get_account_size', 'pop3_get_message','pop3_get_message_count', 'pop3_get_message_header','pop3_get_message_ids', 'pop3_get_message_size','pop3_get_message_sizes','pop3_open', 'pop3_undelete','popen','pos','posix_ctermid','posix_errno', 'posix_getcwd','posix_getegid','posix_geteuid','posix_getgid', 'posix_getgrgid','posix_getgrnam','posix_getgroups', 'posix_getlogin','posix_getpgid','posix_getpgrp','posix_getpid', 'posix_getppid','posix_getpwnam','posix_getpwuid','posix_getrlimit', 'posix_getsid','posix_getuid','posix_get_last_error','posix_isatty', 'posix_kill','posix_mkfifo','posix_setegid','posix_seteuid', 'posix_setgid','posix_setpgid','posix_setsid','posix_setuid', 'posix_strerror','posix_times','posix_ttyname','posix_uname','pow', 'preg_grep','preg_last_error','preg_match','preg_match_all', 'preg_quote','preg_replace','preg_replace_callback','preg_split', 'prev','print_r','printf','proc_close','proc_get_status', 'proc_open','proc_terminate','putenv','quoted_printable_decode', 'quotemeta','rad2deg','radius_acct_open','radius_add_server', 'radius_auth_open','radius_close','radius_config', 'radius_create_request','radius_cvt_addr','radius_cvt_int', 'radius_cvt_string','radius_demangle','radius_demangle_mppe_key', 'radius_get_attr','radius_get_vendor_attr','radius_put_addr', 'radius_put_attr','radius_put_int','radius_put_string', 'radius_put_vendor_addr','radius_put_vendor_attr', 'radius_put_vendor_int','radius_put_vendor_string', 'radius_request_authenticator','radius_send_request', 'radius_server_secret','radius_strerror','rand','range', 'rawurldecode','rawurlencode','read_exif_data','readdir','readfile', 'readgzfile','readlink','realpath','reg_close_key','reg_create_key', 'reg_enum_key','reg_enum_value','reg_get_value','reg_open_key', 'reg_set_value','register_shutdown_function', 'register_tick_function','rename','res_close','res_get','res_list', 'res_list_type','res_open','res_set','reset', 'restore_error_handler','restore_include_path','rewind','rewinddir', 'rmdir','round','rsort','rtrim','runkit_class_adopt', 'runkit_class_emancipate','runkit_constant_add', 'runkit_constant_redefine','runkit_constant_remove', 'runkit_default_property_add','runkit_function_add', 'runkit_function_copy','runkit_function_redefine', 'runkit_function_remove','runkit_function_rename','runkit_import', 'runkit_lint','runkit_lint_file','runkit_method_add', 'runkit_method_copy','runkit_method_redefine', 'runkit_method_remove','runkit_method_rename','runkit_object_id', 'runkit_return_value_used','runkit_sandbox_output_handler', 'runkit_superglobals','runkit_zval_inspect','scandir','sem_acquire', 'sem_get','sem_release','sem_remove','serialize', 'session_cache_expire','session_cache_limiter','session_commit', 'session_decode','session_destroy','session_encode', 'session_get_cookie_params','session_id','session_is_registered', 'session_module_name','session_name','session_regenerate_id', 'session_register','session_save_path','session_set_cookie_params', 'session_set_save_handler','session_start','session_unregister', 'session_unset','session_write_close','set_content', 'set_error_handler','set_file_buffer','set_include_path', 'set_magic_quotes_runtime','set_socket_blocking','set_time_limit', 'setcookie','setlocale','setrawcookie','settype','sha1','sha1_file', 'shell_exec','shmop_close','shmop_delete','shmop_open','shmop_read', 'shmop_size','shmop_write','shm_attach','shm_detach','shm_get_var', 'shm_put_var','shm_remove','shm_remove_var','show_source','shuffle', 'similar_text','simplexml_import_dom','simplexml_load_file', 'simplexml_load_string','sin','sinh','sizeof','sleep','smtp_close', 'smtp_cmd_data','smtp_cmd_mail','smtp_cmd_rcpt','smtp_connect', 'snmp_get_quick_print','snmp_get_valueretrieval','snmp_read_mib', 'snmp_set_quick_print','snmp_set_valueretrieval','snmp2_get', 'snmp2_getnext','snmp2_real_walk','snmp2_set','snmp2_walk', 'snmp3_get','snmp3_getnext','snmp3_real_walk','snmp3_set', 'snmp3_walk','snmpget','snmpgetnext','snmprealwalk','snmpset', 'snmpwalk','snmpwalkoid','socket_accept','socket_bind', 'socket_clear_error','socket_close','socket_connect', 'socket_create','socket_create_listen','socket_create_pair', 'socket_getopt','socket_getpeername','socket_getsockname', 'socket_get_option','socket_get_status','socket_iovec_add', 'socket_iovec_alloc','socket_iovec_delete','socket_iovec_fetch', 'socket_iovec_free','socket_iovec_set','socket_last_error', 'socket_listen','socket_read','socket_readv','socket_recv', 'socket_recvfrom','socket_recvmsg','socket_select','socket_send', 'socket_sendmsg','socket_sendto','socket_setopt','socket_set_block', 'socket_set_blocking','socket_set_nonblock','socket_set_option', 'socket_set_timeout','socket_shutdown','socket_strerror', 'socket_write','socket_writev','sort','soundex','spl_autoload', 'spl_autoload_call','spl_autoload_extensions', 'spl_autoload_functions','spl_autoload_register', 'spl_autoload_unregister','spl_classes','spl_object_hash','split', 'spliti','sprintf','sql_regcase','sqlite_array_query', 'sqlite_busy_timeout','sqlite_changes','sqlite_close', 'sqlite_column','sqlite_create_aggregate','sqlite_create_function', 'sqlite_current','sqlite_error_string','sqlite_escape_string', 'sqlite_exec','sqlite_factory','sqlite_fetch_all', 'sqlite_fetch_array','sqlite_fetch_column_types', 'sqlite_fetch_object','sqlite_fetch_single','sqlite_fetch_string', 'sqlite_field_name','sqlite_has_more','sqlite_has_prev', 'sqlite_last_error','sqlite_last_insert_rowid','sqlite_libencoding', 'sqlite_libversion','sqlite_next','sqlite_num_fields', 'sqlite_num_rows','sqlite_open','sqlite_popen','sqlite_prev', 'sqlite_query','sqlite_rewind','sqlite_seek','sqlite_single_query', 'sqlite_udf_decode_binary','sqlite_udf_encode_binary', 'sqlite_unbuffered_query','sqlite_valid','sqrt','srand','sscanf', 'ssh2_auth_hostbased_file','ssh2_auth_none','ssh2_auth_password', 'ssh2_auth_pubkey_file','ssh2_connect','ssh2_exec', 'ssh2_fetch_stream','ssh2_fingerprint','ssh2_forward_accept', 'ssh2_forward_listen','ssh2_methods_negotiated','ssh2_poll', 'ssh2_publickey_add','ssh2_publickey_init','ssh2_publickey_list', 'ssh2_publickey_remove','ssh2_scp_recv','ssh2_scp_send','ssh2_sftp', 'ssh2_sftp_lstat','ssh2_sftp_mkdir','ssh2_sftp_readlink', 'ssh2_sftp_realpath','ssh2_sftp_rename','ssh2_sftp_rmdir', 'ssh2_sftp_stat','ssh2_sftp_symlink','ssh2_sftp_unlink', 'ssh2_shell','ssh2_tunnel','stat','stats_absolute_deviation', 'stats_cdf_beta','stats_cdf_binomial','stats_cdf_cauchy', 'stats_cdf_chisquare','stats_cdf_exponential','stats_cdf_f', 'stats_cdf_gamma','stats_cdf_laplace','stats_cdf_logistic', 'stats_cdf_negative_binomial','stats_cdf_noncentral_chisquare', 'stats_cdf_noncentral_f','stats_cdf_noncentral_t', 'stats_cdf_normal','stats_cdf_poisson','stats_cdf_t', 'stats_cdf_uniform','stats_cdf_weibull','stats_covariance', 'stats_dens_beta','stats_dens_cauchy','stats_dens_chisquare', 'stats_dens_exponential','stats_dens_f','stats_dens_gamma', 'stats_dens_laplace','stats_dens_logistic','stats_dens_normal', 'stats_dens_pmf_binomial','stats_dens_pmf_hypergeometric', 'stats_dens_pmf_negative_binomial','stats_dens_pmf_poisson', 'stats_dens_t','stats_dens_uniform','stats_dens_weibull', 'stats_harmonic_mean','stats_kurtosis','stats_rand_gen_beta', 'stats_rand_gen_chisquare','stats_rand_gen_exponential', 'stats_rand_gen_f','stats_rand_gen_funiform','stats_rand_gen_gamma', 'stats_rand_gen_ipoisson','stats_rand_gen_iuniform', 'stats_rand_gen_noncenral_f','stats_rand_gen_noncentral_chisquare', 'stats_rand_gen_noncentral_t','stats_rand_gen_normal', 'stats_rand_gen_t','stats_rand_getsd','stats_rand_ibinomial', 'stats_rand_ibinomial_negative','stats_rand_ignlgi', 'stats_rand_phrase_to_seeds','stats_rand_ranf','stats_rand_setall', 'stats_skew','stats_standard_deviation','stats_stat_binomial_coef', 'stats_stat_correlation','stats_stat_factorial', 'stats_stat_independent_t','stats_stat_innerproduct', 'stats_stat_paired_t','stats_stat_percentile','stats_stat_powersum', 'stats_variance','strcasecmp','strchr','strcmp','strcoll','strcspn', 'stream_bucket_append','stream_bucket_make_writeable', 'stream_bucket_new','stream_bucket_prepend','stream_context_create', 'stream_context_get_default','stream_context_get_options', 'stream_context_set_default','stream_context_set_option', 'stream_context_set_params','stream_copy_to_stream', 'stream_encoding','stream_filter_append','stream_filter_prepend', 'stream_filter_register','stream_filter_remove', 'stream_get_contents','stream_get_filters','stream_get_line', 'stream_get_meta_data','stream_get_transports', 'stream_get_wrappers','stream_is_local', 'stream_notification_callback','stream_register_wrapper', 'stream_resolve_include_path','stream_select','stream_set_blocking', 'stream_set_timeout','stream_set_write_buffer', 'stream_socket_accept','stream_socket_client', 'stream_socket_enable_crypto','stream_socket_get_name', 'stream_socket_pair','stream_socket_recvfrom', 'stream_socket_sendto','stream_socket_server', 'stream_socket_shutdown','stream_supports_lock', 'stream_wrapper_register','stream_wrapper_restore', 'stream_wrapper_unregister','strftime','stripcslashes','stripos', 'stripslashes','strip_tags','stristr','strlen','strnatcasecmp', 'strnatcmp','strpbrk','strncasecmp','strncmp','strpos','strrchr', 'strrev','strripos','strrpos','strspn','strstr','strtok', 'strtolower','strtotime','strtoupper','strtr','strval', 'str_ireplace','str_pad','str_repeat','str_replace','str_rot13', 'str_split','str_shuffle','str_word_count','substr', 'substr_compare','substr_count','substr_replace','svn_add', 'svn_auth_get_parameter','svn_auth_set_parameter','svn_cat', 'svn_checkout','svn_cleanup','svn_client_version','svn_commit', 'svn_diff','svn_export','svn_fs_abort_txn','svn_fs_apply_text', 'svn_fs_begin_txn2','svn_fs_change_node_prop','svn_fs_check_path', 'svn_fs_contents_changed','svn_fs_copy','svn_fs_delete', 'svn_fs_dir_entries','svn_fs_file_contents','svn_fs_file_length', 'svn_fs_is_dir','svn_fs_is_file','svn_fs_make_dir', 'svn_fs_make_file','svn_fs_node_created_rev','svn_fs_node_prop', 'svn_fs_props_changed','svn_fs_revision_prop', 'svn_fs_revision_root','svn_fs_txn_root','svn_fs_youngest_rev', 'svn_import','svn_info','svn_log','svn_ls','svn_repos_create', 'svn_repos_fs','svn_repos_fs_begin_txn_for_commit', 'svn_repos_fs_commit_txn','svn_repos_hotcopy','svn_repos_open', 'svn_repos_recover','svn_status','svn_update','symlink', 'sys_get_temp_dir','syslog','system','tan','tanh','tempnam', 'textdomain','thread_get','thread_include','thread_lock', 'thread_lock_try','thread_mutex_destroy','thread_mutex_init', 'thread_set','thread_start','thread_unlock','tidy_access_count', 'tidy_clean_repair','tidy_config_count','tidy_diagnose', 'tidy_error_count','tidy_get_body','tidy_get_config', 'tidy_get_error_buffer','tidy_get_head','tidy_get_html', 'tidy_get_html_ver','tidy_get_output','tidy_get_release', 'tidy_get_root','tidy_get_status','tidy_getopt','tidy_is_xhtml', 'tidy_is_xml','tidy_parse_file','tidy_parse_string', 'tidy_repair_file','tidy_repair_string','tidy_warning_count','time', 'timezone_abbreviations_list','timezone_identifiers_list', 'timezone_name_from_abbr','timezone_name_get','timezone_offset_get', 'timezone_open','timezone_transitions_get','tmpfile', 'token_get_all','token_name','touch','trigger_error', 'transliterate','transliterate_filters_get','trim','uasort', 'ucfirst','ucwords','uksort','umask','uniqid','unixtojd','unlink', 'unpack','unregister_tick_function','unserialize','unset', 'urldecode','urlencode','user_error','use_soap_error_handler', 'usleep','usort','utf8_decode','utf8_encode','var_dump', 'var_export','variant_abs','variant_add','variant_and', 'variant_cast','variant_cat','variant_cmp', 'variant_date_from_timestamp','variant_date_to_timestamp', 'variant_div','variant_eqv','variant_fix','variant_get_type', 'variant_idiv','variant_imp','variant_int','variant_mod', 'variant_mul','variant_neg','variant_not','variant_or', 'variant_pow','variant_round','variant_set','variant_set_type', 'variant_sub','variant_xor','version_compare','virtual','vfprintf', 'vprintf','vsprintf','wddx_add_vars','wddx_deserialize', 'wddx_packet_end','wddx_packet_start','wddx_serialize_value', 'wddx_serialize_vars','win_beep','win_browse_file', 'win_browse_folder','win_create_link','win_message_box', 'win_play_wav','win_shell_execute','win32_create_service', 'win32_delete_service','win32_get_last_control_message', 'win32_ps_list_procs','win32_ps_stat_mem','win32_ps_stat_proc', 'win32_query_service_status','win32_scheduler_delete_task', 'win32_scheduler_enum_tasks','win32_scheduler_get_task_info', 'win32_scheduler_run','win32_scheduler_set_task_info', 'win32_set_service_status','win32_start_service', 'win32_start_service_ctrl_dispatcher','win32_stop_service', 'wordwrap','xml_error_string','xml_get_current_byte_index', 'xml_get_current_column_number','xml_get_current_line_number', 'xml_get_error_code','xml_parse','xml_parser_create', 'xml_parser_create_ns','xml_parser_free','xml_parser_get_option', 'xml_parser_set_option','xml_parse_into_struct', 'xml_set_character_data_handler','xml_set_default_handler', 'xml_set_element_handler','xml_set_end_namespace_decl_handler', 'xml_set_external_entity_ref_handler', 'xml_set_notation_decl_handler','xml_set_object', 'xml_set_processing_instruction_handler', 'xml_set_start_namespace_decl_handler', 'xml_set_unparsed_entity_decl_handler','xmldoc','xmldocfile', 'xmlrpc_decode','xmlrpc_decode_request','xmlrpc_encode', 'xmlrpc_encode_request','xmlrpc_get_type','xmlrpc_is_fault', 'xmlrpc_parse_method_descriptions', 'xmlrpc_server_add_introspection_data','xmlrpc_server_call_method', 'xmlrpc_server_create','xmlrpc_server_destroy', 'xmlrpc_server_register_introspection_callback', 'xmlrpc_server_register_method','xmlrpc_set_type','xmltree', 'xmlwriter_end_attribute','xmlwriter_end_cdata', 'xmlwriter_end_comment','xmlwriter_end_document', 'xmlwriter_end_dtd','xmlwriter_end_dtd_attlist', 'xmlwriter_end_dtd_element','xmlwriter_end_dtd_entity', 'xmlwriter_end_element','xmlwriter_end_pi','xmlwriter_flush', 'xmlwriter_full_end_element','xmlwriter_open_memory', 'xmlwriter_open_uri','xmlwriter_output_memory', 'xmlwriter_set_indent','xmlwriter_set_indent_string', 'xmlwriter_start_attribute','xmlwriter_start_attribute_ns', 'xmlwriter_start_cdata','xmlwriter_start_comment', 'xmlwriter_start_document','xmlwriter_start_dtd', 'xmlwriter_start_dtd_attlist','xmlwriter_start_dtd_element', 'xmlwriter_start_dtd_entity','xmlwriter_start_element', 'xmlwriter_start_element_ns','xmlwriter_start_pi','xmlwriter_text', 'xmlwriter_write_attribute','xmlwriter_write_attribute_ns', 'xmlwriter_write_cdata','xmlwriter_write_comment', 'xmlwriter_write_dtd','xmlwriter_write_dtd_attlist', 'xmlwriter_write_dtd_element','xmlwriter_write_dtd_entity', 'xmlwriter_write_element','xmlwriter_write_element_ns', 'xmlwriter_write_pi','xmlwriter_write_raw','xpath_eval', 'xpath_eval_expression','xpath_new_context','xpath_register_ns', 'xpath_register_ns_auto','xptr_eval','xptr_new_context','yp_all', 'yp_cat','yp_errno','yp_err_string','yp_first', 'yp_get_default_domain','yp_master','yp_match','yp_next','yp_order', 'zend_current_obfuscation_level','zend_get_cfg_var','zend_get_id', 'zend_loader_current_file','zend_loader_enabled', 'zend_loader_file_encoded','zend_loader_file_licensed', 'zend_loader_install_license','zend_loader_version', 'zend_logo_guid','zend_match_hostmasks','zend_obfuscate_class_name', 'zend_obfuscate_function_name','zend_optimizer_version', 'zend_runtime_obfuscate','zend_version','zip_close', 'zip_entry_close','zip_entry_compressedsize', 'zip_entry_compressionmethod','zip_entry_filesize','zip_entry_name', 'zip_entry_open','zip_entry_read','zip_open','zip_read', 'zlib_get_coding_type' ), 4 => array( 'DEFAULT_INCLUDE_PATH', 'DIRECTORY_SEPARATOR', 'E_ALL', 'E_COMPILE_ERROR', 'E_COMPILE_WARNING', 'E_CORE_ERROR', 'E_CORE_WARNING', 'E_ERROR', 'E_NOTICE', 'E_PARSE', 'E_STRICT', 'E_USER_ERROR', 'E_USER_NOTICE', 'E_USER_WARNING', 'E_WARNING', 'ENT_COMPAT','ENT_QUOTES','ENT_NOQUOTES', 'false', 'null', 'PEAR_EXTENSION_DIR', 'PEAR_INSTALL_DIR', 'PHP_BINDIR', 'PHP_CONFIG_FILE_PATH', 'PHP_DATADIR', 'PHP_EXTENSION_DIR', 'PHP_LIBDIR', 'PHP_LOCALSTATEDIR', 'PHP_OS', 'PHP_OUTPUT_HANDLER_CONT', 'PHP_OUTPUT_HANDLER_END', 'PHP_OUTPUT_HANDLER_START', 'PHP_SYSCONFDIR', 'PHP_VERSION', 'true', '__CLASS__', '__FILE__', '__FUNCTION__', '__LINE__', '__METHOD__' ) ), 'SYMBOLS' => array( 1 => array( '<'.'%', '<'.'%=', '%'.'>', '<'.'?', '<'.'?=', '?'.'>' ), 0 => array( '(', ')', '[', ']', '{', '}', '!', '@', '%', '&', '|', '/', '<', '>', '=', '-', '+', '*', '.', ':', ',', ';' ) ), 'CASE_SENSITIVE' => array( GESHI_COMMENTS => false, 1 => false, 2 => false, 3 => false, 4 => false ), 'STYLES' => array( 'KEYWORDS' => array( 1 => 'color: #b1b100;', 2 => 'color: #000000; font-weight: bold;', 3 => 'color: #990000;', 4 => 'color: #009900; font-weight: bold;' ), 'COMMENTS' => array( 1 => 'color: #666666; font-style: italic;', 2 => 'color: #666666; font-style: italic;', 3 => 'color: #0000cc; font-style: italic;', 4 => 'color: #009933; font-style: italic;', 'MULTI' => 'color: #666666; font-style: italic;' ), 'ESCAPE_CHAR' => array( 0 => 'color: #000099; font-weight: bold;', 1 => 'color: #000099; font-weight: bold;', 2 => 'color: #660099; font-weight: bold;', 3 => 'color: #660099; font-weight: bold;', 4 => 'color: #006699; font-weight: bold;', 5 => 'color: #006699; font-weight: bold; font-style: italic;', 6 => 'color: #009933; font-weight: bold;', 'HARD' => 'color: #000099; font-weight: bold;' ), 'BRACKETS' => array( 0 => 'color: #009900;' ), 'STRINGS' => array( 0 => 'color: #0000ff;', 'HARD' => 'color: #0000ff;' ), 'NUMBERS' => array( 0 => 'color: #cc66cc;', GESHI_NUMBER_OCT_PREFIX => 'color: #208080;', GESHI_NUMBER_HEX_PREFIX => 'color: #208080;', GESHI_NUMBER_FLT_SCI_ZERO => 'color:#800080;', ), 'METHODS' => array( 1 => 'color: #004000;', 2 => 'color: #004000;' ), 'SYMBOLS' => array( 0 => 'color: #339933;', 1 => 'color: #000000; font-weight: bold;' ), 'REGEXPS' => array( 0 => 'color: #000088;' ), 'SCRIPT' => array( 0 => '', 1 => '', 2 => '', 3 => '', 4 => '', 5 => '' ) ), 'URLS' => array( 1 => '', 2 => '', 3 => 'http://www.php.net/{FNAMEL}', 4 => '' ), 'OOLANG' => true, 'OBJECT_SPLITTERS' => array( 1 => '->', 2 => '::' ), 'REGEXPS' => array( //Variables 0 => "[\\$]{1,2}[a-zA-Z_][a-zA-Z0-9_]*" ), 'STRICT_MODE_APPLIES' => GESHI_MAYBE, 'SCRIPT_DELIMITERS' => array( 0 => array( '<?php' => '?>' ), 1 => array( '<?' => '?>' ), 2 => array( '<%' => '%>' ), 3 => array( '<script language="php">' => '</script>' ), 4 => "/(<\?(?:php)?)(?:'(?:[^'\\\\]|\\\\.)*?'|\"(?:[^\"\\\\]|\\\\.)*?\"|\/\*(?!\*\/).*?\*\/|.)*?(\?>|\Z)/sm", 5 => "/(<%)(?:'(?:[^'\\\\]|\\\\.)*?'|\"(?:[^\"\\\\]|\\\\.)*?\"|\/\*(?!\*\/).*?\*\/|.)*?(%>|\Z)/sm" ), 'HIGHLIGHT_STRICT_BLOCK' => array( 0 => true, 1 => true, 2 => true, 3 => true, 4 => true, 5 => true ), 'TAB_WIDTH' => 4 ); ?> |
If you’re remotely familiar with PHP (or even if you’re not), you can see that all that a language file consists of is
a glorified variable assignment. Easy! All a language file does is assign a variable $language_data
. Though
still, there’s a lot of indices to that array… but this section is here to break each index down and explain it to you.
There are several conventions that are used in language files. For ease of use and readability, your language files should obey the following rules:
There are more notes on each convention where it may appear in the language file sections below.
This section will look at all the sections of a language file, and how they relate to the final highlighting result.
The header of a language file is the first lines with the big comment and the start of the variable
$language_data
:
PHP code | |
1 23 45 67 89 1011 1213 1415 1617 1819 2021 2223 2425 2627 2829 3031 3233 3435 3637 3839 4041 4243 | <?php /************************************************************************************* * <name-of-language-file.php> * --------------------------------- * Author: <name> (<e-mail address>) * Copyright: (c) 2008 <name> (<website URL>) * Release Version: <GeSHi release> * Date Started: <date started> * * <name-of-language> language file for GeSHi. * * <any-comments...> * * CHANGES * ------- * <date-of-release> (<GeSHi release>) * - First Release * * TODO (updated <date-of-release>) * ------------------------- * <things-to-do> * ************************************************************************************* * * This file is part of GeSHi. * * GeSHi is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * GeSHi is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GeSHi; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ************************************************************************************/ $language_data = array ( |
The parts in angle brackets are the parts that you change for your language file. Everything else must remain the same!
Here are the parts you should change:
<name-of-language-file.php>
- This should become the name of your language file. Language file names are in
lower case and contain only alphanumeric characters, dashes and underscores. Language files end with .php (which
you should put with the name of your language file, eg language.php)<name>
- Your name, or alias.<e-mail address>
- Your e-mail address. If you want your language file included with GeSHi you must
include an e-mail address that refers to an inbox controlled by you.<website>
- A URL of a website of yours (perhaps to a page that deals with your contribution to GeSHi, or
your home page/blog)<date-started>
- The date you started working on the language file. If you can’t remember, guestimate.<name-of-language>
- The name of the language you made this language file for (probably similar to
the language file name).<any-comments>
- Any comments you have to make about this language file, perhaps on where you got the keywords for,
what dialect of the language this language file is for etc etc. If you don’t have any comments, remove the space for them.<date-of-release
- The date you released the language file to the public. If you simply send it to me for inclusion
in a new GeSHi and don’t release it, leave this blank, and I’ll replace it with the date of the GeSHi release that
it is first added to.<GeSHi release>
- This is the version of the release that will contain the changes you made.
So if you have version 1.0.8 of GeSHi running this will be the next version to be released, e.g. 1.0.8.1.Everything should remain the same.
Also: I’m not sure about the copyright on a new language file. I’m not a lawyer, could someone contact me about whether the copyright for a new language file should be exclusivly the authors, or joint with me (if included in a GeSHi release)?
Here is an example from the php language file of the first indices:
PHP code | |
1 23 45 6 | 'LANG_NAME' => 'PHP', 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'),'COMMENT_MULTI' => array('/*' => '*/'), 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,'QUOTEMARKS' => array("'", '"'), 'ESCAPE_CHAR' => '\\', |
The first indices are the first few lines of a language file before the KEYWORDS index. These indices specify:
GESHI_CAPS_UPPER
: Convert the case of all keywords to upper case.GESHI_CAPS_LOWER
: Convert the case of all keywords to lower case.GESHI_CAPS_NO_CHANGE
: Don’t change the case of any keyword.''
). This is not an array! If found, any character after an
escape character and the escape character itself will be highlighted differently, and the character after the
escape character cannot end a string.In some language files you might see here other indices too, but those are dealt with later on.
Keywords will make up the bulk of a language file. In this part you add keywords for your language, including inbuilt functions, data types, predefined constants etc etc.
Here’s a (shortened) example from the php language file:
PHP code | |
1 23 45 67 89 1011 1213 1415 1617 1819 2021 2223 2425 2627 2829 3031 3233 3435 3637 3839 40 | 'KEYWORDS' => array( 1 => array( 'as', 'break', 'case', 'do', 'else', 'elseif', 'endif', 'endswitch', 'endwhile', 'for', 'foreach', 'if', 'include', 'include_once', 'require', 'require_once', 'return', 'switch', 'while' ), 2 => array( '</script>', '<?', '<?php', '<script language=', '?>', 'class', 'default', 'DEFAULT_INCLUDE_PATH', 'E_ALL', 'E_COMPILE_ERROR', 'E_COMPILE_WARNING', 'E_CORE_ERROR', 'E_CORE_WARNING', 'E_ERROR', 'E_NOTICE', 'E_PARSE', 'E_USER_ERROR', 'E_USER_NOTICE', 'E_USER_WARNING', 'E_WARNING', 'false', 'function', 'new', 'null', 'PEAR_EXTENSION_DIR', 'PEAR_INSTALL_DIR', 'PHP_BINDIR', 'PHP_CONFIG_FILE_PATH', 'PHP_DATADIR', 'PHP_EXTENSION_DIR', 'PHP_LIBDIR', 'PHP_LOCALSTATEDIR', 'PHP_OS', 'PHP_OUTPUT_HANDLER_CONT', 'PHP_OUTPUT_HANDLER_END', 'PHP_OUTPUT_HANDLER_START', 'PHP_SYSCONFDIR', 'PHP_VERSION', 'true', 'var', '__CLASS__', '__FILE__', '__FUNCTION__', '__LINE__', '__METHOD__' ), 3 => array( 'xml_parser_create', 'xml_parser_create_ns', 'xml_parser_free', 'xml_parser_get_option', 'xml_parser_set_option', 'xml_parse_into_struct', 'xml_set_character_data_handler', 'xml_set_default_handler', 'xml_set_element_handler', 'xml_set_end_namespace_decl_handler', 'xml_set_external_entity_ref_handler', 'xml_set_notation_decl_handler', 'xml_set_object', 'xml_set_processing_instruction_handler', 'xml_set_start_namespace_decl_handler', 'xml_set_unparsed_entity_decl_handler', 'yp_all', 'yp_cat', 'yp_errno', 'yp_err_string', 'yp_first', 'yp_get_default_domain', 'yp_master', 'yp_match', 'yp_next', 'yp_order', 'zend_logo_guid', 'zend_version', 'zlib_get_coding_type' ) ), |
You can see that the index ‘KEYWORDS’ refers to an array of arrays, indexed by positive integers. In each array, there are some keywords (in the actual php language file there is in fact many more keywords in the array indexed by 3). Here are some points to note about these keywords:
htmlentities()
form: All keywords should be written as if they had been
run through the php function htmlentities()
. E.g, the keyword is <foo>
, not
<foo>
So you’ve put all the keywords for your language in? Now for a breather before we style them :). Symbols define what symbols your language uses. These are things like colons, brackets/braces, and other such general punctuation. No alphanumeric stuff belongs here, just the same as no symbols belong into the keywords section.
As of GeSHi version 1.0.7.21 the symbols section can be used in two ways:
Here’s an example for flat symbol usage
PHP code | |
1
23
| 'SYMBOLS' => array( '(', ')', '[', ']', '{', '}', '!', '@', '|', '&', '+', '-', '*', '/', '%', '=', '<', '>'), |
which is not too different from the newly introduced group usage shown below:
PHP code | |
1 23 45 6 | 'SYMBOLS' => array( 0 => array('(', ')', '[', ']', '{', '}'), 1 => array('!', '@', '|', '&'), 2 => array('+', '-', '*', '/', '%'), 3 => array('=', '<', '>') ), |
Please note that versions before 1.0.7.21 will silently ignore this setting.
Also note that GeSHi 1.0.7.21 itself had some bugs in Symbol highlighting that could cause heavily scrambled code output.
The following case sensitivity group alludes to the keywords section: here you can set which keyword groups are case sensitive.
In the ‘CASE_SENSITIVE’ group there’s a special key GESHI_COMMENTS
which is used to set whether comments are
case sensitive or not (for example, BASIC has the REM statement which while not being case sensitive is still alphanumeric, and
as in the example given before about the Java language file using “import” as a single line comment, this can be
useful sometimes. true if comments are case sensitive, false otherwise. All of the other indices
correspond to indices in the 'KEYWORDS'
section (see above).
This is the fun part! Here you get to choose the colours, fonts, backgrounds and anything else you’d like for your language file.
Here’s an example:
PHP code | |
1 23 45 67 89 1011 1213 1415 1617 1819 2021 2223 2425 2627 2829 3031 3233 3435 3637 3839 | 'STYLES' => array( 'KEYWORDS' => array( 1 => 'color: #b1b100;', 2 => 'color: #000000; font-weight: bold;', 3 => 'color: #000066;' ), 'COMMENTS' => array( 1 => 'color: #808080; font-style: italic;', 2 => 'color: #808080; font-style: italic;', 'MULTI' => 'color: #808080; font-style: italic;' ), 'ESCAPE_CHAR' => array( 0 => 'color: #000099; font-weight: bold;' ), 'BRACKETS' => array( 0 => 'color: #66cc66;' ), 'STRINGS' => array( 0 => 'color: #ff0000;' ), 'NUMBERS' => array( 0 => 'color: #cc66cc;' ), 'METHODS' => array( 0 => 'color: #006600;' ), 'SYMBOLS' => array( 0 => 'color: #66cc66;' ), 'REGEXPS' => array( 0 => 'color: #0000ff;' ), 'SCRIPT' => array( 0 => '', 1 => '', 2 => '', 3 => '' ) ), |
Note that all style rules should end with a semi-colon! This is important: GeSHi may add extra rules to the rules you specify (and will do so if a user tries to change your styles on the fly), so the last semi-colon in any stylesheet rule is important!
All strings here should contain valid stylesheet declarations (it’s also fine to have the empty string).
create_function
would not work with this due to a PHP bug, so you have to
put the function definition at the top of the language file. Be sure to prefix the function name
with geshi_[languagename]_
as to not conflict with other functions!This section lets you specify a url to visit for each keyword group. Useful for pointing functions at their online manual entries.
Here is an example:
PHP code | |
1 23 45 6 | 'URLS' => array( 1 => '', 2 => '', 3 => 'http://www.php.net/{FNAME}', 4 => '' ), |
The indices of this array correspond to the keyword groups you specified in the keywords section. The string {FNAME}
marks where the name of the function is substituted in. So for the example above, if the keyword being highlighted is
“echo”, then the keyword will be a URL pointing to http://www.php.net/echo
. Because some languages (Java!) don’t
keep a uniform URL for functions/classes, you may have trouble in creating a URL for that language (though look in the
java language file for a novel solution to it’s problem)
If your language supports different formats of numbers (e.g. integers and float representations) and you want GeSHi to handle them differently you can select from a set of predefined formats.
PHP code | |
1 23 4 | 'NUMBERS' => GESHI_NUMBER_INT_BASIC | GESHI_NUMBER_INT_CSTYLE | GESHI_NUMBER_BIN_PREFIX_0B | GESHI_NUMBER_OCT_PREFIX | GESHI_NUMBER_HEX_PREFIX | GESHI_NUMBER_FLT_NONSCI | GESHI_NUMBER_FLT_NONSCI_F | GESHI_NUMBER_FLT_SCI_SHORT | GESHI_NUMBER_FLT_SCI_ZERO, |
All the formats you want GeSHi to recognize are selected via a bitmask that is built by bitwise OR-ing the format constants. When styling you use these constants to assign the proper styles. A style not assigned will automatically fallback to style group 0.
For a complete list of formats supported by GeSHi have a look into the sources of geshi.php.
If you want to define your own formats for numbers or when you want to group the style for two or more formats you can use the array syntax.
PHP code | |
1 23 45 67 | 'NUMBERS' => array( 1 => GESHI_NUMBER_INT_BASIC | GESHI_NUMBER_INT_CSTYLE, 2 => GESHI_NUMBER_BIN_PREFIX_0B, 3 => GESHI_NUMBER_OCT_PREFIX, 4 => GESHI_NUMBER_HEX_PREFIX, 5 => GESHI_NUMBER_FLT_NONSCI | GESHI_NUMBER_FLT_NONSCI_F | GESHI_NUMBER_FLT_SCI_SHORT | GESHI_NUMBER_FLT_SCI_ZERO ), |
This creates 5 style groups 1..5 that will highlight each of the formats specified for each group. Styling of these groups doesn’t use the constants but uses the indices you just defined.
Instead of using those predefined constants you also can assign a PCRE that matches a number when using this advanced format.
The extended format hasn’t been exhaustively been tested. So beware of bugs there.
Now we’re reaching the most little-used section of a language file, which includes such goodies as object orientation support and context support. GeSHi can highlight methods and data fields of objects easily, all you need to do is to tell it to do so and what the “splitter” is between object/method etc.
Here’s an example:
PHP code | |
1
2 | 'OOLANG' => true, 'OBJECT_SPLITTER' => '->', |
If your language has object orientation, the value of 'OOLANG'
is true, otherwise it is false. If it is object
orientated, in the 'OBJECT_SPLITTER'
value you put the htmlentities()
version of the “splitter” between
objects and methods/fields. If it is not, then make this the empty string.
Regular expressions are a good way to catch any other lexic that fits certain rules but can’t be listed as a keyword. A good example is variables in PHP: variables always start with either one or two “$” signs, then alphanumeric characters (a simplification). This is easy to catch with regular expressions.
And new to version 1.0.2, there is an advanced way of using regular expressions to catch certain things but highlight only part of those things. This is particularly useful for languages like XML.
Regular expressions use the PCRE syntax (perl-style), not the ereg()
style!
Here is an example (this time the PHP file merged with the XML file):
PHP code | |
1 23 45 67 89 1011 1213 1415 | 0 => array( GESHI_SEARCH => '(((xml:)?[a-z\-]+))(=)', GESHI_REPLACE => '\\1', GESHI_MODIFIERS => '', GESHI_BEFORE => '', GESHI_AFTER => '\\4' ), 1 => array( GESHI_SEARCH => '(>/?[a-z0-9]*(>)?)', GESHI_REPLACE => '\\1', GESHI_MODIFIERS => '', GESHI_BEFORE => '', GESHI_AFTER => '' ),2 => "[\\$]{1,2}[a-zA-Z_][a-zA-Z0-9_]*" |
As you can see there are two formats. One is the “simple” format used in GeSHi < 1.0.2, and the other is a more advanced syntax. Firstly, the simple syntax:
()
) then by all means give it a try,
but I’m not sure whether under some circumstances GeSHi may throw a wobbly. You have been warned! If you want to
use brackets, it would be better to use the advanced syntax..*?
regex). Use advanced syntax instead.And now for advanced syntax, which gives you much more control over exactly what is highlighted:
()
). See how in the first example above, most of the regular expression is in one set of brackets
(with the equals sign in other brackets). You should make sure that the part of the regular expression that is
supposed to match what is highlighted is in brackets.\\number
to match that group, where number
is a number corresponding to how many open brackets are between the open
bracket of the group you want highlighted and the start of the GESHI_SEARCH string + 1. This may sound confusing,
and it probably is, but if you’re familiar with how PHP’s regular expressions work you should understand. In the
example above, the opening bracket for the stuff we want highlighted is the very first bracket in the string, so
the number of brackets before that bracket and the start of the string is 0. So we add 1 and get our replacement
string of \\1
(whew!).If you didn’t understand a word of that, make sure that there are brackets around the string in GESHI_SEARCH
and use \\1
for GESHI_REPLACE
;)
.*?
), then your modifiers should include “s” and “i” (e.g. use ‘si’ for this).Is that totally confusing? Here’s the test for if you’re an android or not: If you found that perfectly understandable then you’re an android ;). Here’s a better example:
Let’s say that I’m making a language, and variables in this language always start with a dollar sign ($), are always written in lowercase letters and always end with an ampersand (&). eg:
$foo& = 'bar'
I want to highlight only the text between the $ and the &. How do I do that? With simple regular expressions I can’t, but with advanced, it’s relatively easy:
PHP code | |
1 23 45 67 89 1011 1213 14 | 1 => array( // search for a dollar sign, then one or more of the characters a-z, then an ampersand GESHI_SEARCH => '(\$)([a-z]+)(&)', // we wanna highlight the characters, which are in the second bracketed group GESHI_REPLACE => '\\2', // no modifiers, since we're not matching the "anything" regex GESHI_MODIFIERS => '', // before the highlighted characters should be the first // bracketed group (always a dollar sign in this example) GESHI_BEFORE => '\\1', // after the highlighted characters should be the third // bracketed group (always an ampersand in this example) GESHI_AFTER => '\\3' ), |
So if someone tried to highlight using my language, all cases of $foo&
would turn into:
$<span style="color: blue;">foo</span><span style="color: green;">&</span>
(which would of course be viewed in a browser to get something like $foo&
)
For languages like HTML, it’s good if we can highlight a tag (like <a>
for example). But how do we stop
every single “a” in the source getting highlighted? What about for attributes? If I’ve got the word “colspan” in my
text I don’t want that highlighted! So how do you tell GeSHi not to highlight in that case? You do it with “Strict Blocks”.
Here is an example:
PHP code | |
1 23 45 67 89 1011 1213 1415 1617 1819 2021 2223 2425 2627 | <? /* ... */ 'STRICT_MODE_APPLIES' => GESHI_MAYBE,'SCRIPT_DELIMITERS' => array( 0 => array( '<?php' => '?>' ), 1 => array( '<?' => '?>' ), 2 => array( '<%' => '%>' ), 3 => array( '<script language="php">' => '</script>' ) 4 => "/(<\?(?:php)?)(?:'(?:[^'\\\\]|\\\\.)*?'|\"(?:[^\"\\\\]|\\\\.)*?\"|\/\*(?!\*\/).*?\*\/|.)*?(\?>|\Z)/sm", 5 => "/(<%)(?:'(?:[^'\\\\]|\\\\.)*?'|\"(?:[^\"\\\\]|\\\\.)*?\"|\/\*(?!\*\/).*?\*\/|.)*?(%>|\Z)/sm" ),'HIGHLIGHT_STRICT_BLOCK' => array( 0 => true, 1 => true, 2 => true, 3 => true, 4 => true, 5 => true )/* ... */ ?> |
What is strict mode? Strict mode says that highlighting only occurs inside the blocks you specify. You can see from
the example above that highlighting will only occur if the source is inside <?php ... ?>
(though note the
GESHI_MAYBE
!). Here are some points about strict highlighting:
GESHI_ALWAYS
: Strict mode always applies for all of the blocks you specify. Users of your language
file cannot turn strict mode off. This should be used for markup languages.GESHI_NEVER
: Strict mode is never used. Users of your language file cannot turn strict mode on. Use this
value if there is no such thing as a block of code that would not be highlighted in your language
(most languages, like C, Java etc. use this because anything in a C file should be highlighted).GESHI_MAYBE
: Strict mode *sometimes* applies. It defaults to “off”. Users can turn strict mode on if
they please. If strict mode is off then everything in the source will be highlighted, even things outside
the strict block markers. If strict mode is on then nothing outside strict block markers will be highlighted.'OPEN' => 'CLOSE'
. Delimiters can be of any
length > 0. Delimiters are not formatted as if they were run through htmlentities()
!<!DOCTYPE
and ending with >
. However, you can still
style the overall block using the method described above, and the XML language file does just that.The delimiters should be in reverse alphabetical order. Note that in the above example, <?php
comes before <?
.
Since GeSHi 1.0.8 instead of specifying an array with starter and ender you may also provide a regular expression that matches the full block you wish to highlight. If the regular expression match starts at the same position as a previous array declaration the Regexp match is taken. This is to allow for a fall-back when a preg_match doesn’t quite work as expected so you still get reasonably well results.
If you didn’t get this, you might want to look into the PHP or HTML language files as this feature is used there to fix some issues that have been there for about 3 years.
For PHP versions <4.3.3 Strict Block Regexps are completely ignored due to problems in those version that would cause loads of warning messages otherwise.
Sometimes it is necessary for a language to render correctly to tweak some of the assumptions GeSHi usually makes to match the behaviour your language expects.
To achieve this there is an experimental section called 'PARSER_CONTROL'
which is optional and should be used only if necessary.
With the help of this section some internal parameters of GeSHi can be set which are not overrideable by the API and thus their use should be limited as much as possible.
The syntax of the PARSER_CONTROL basically resembles an array structure simular to the one found in the rest of the language file. All subsections of the PARSER_CONTROL are optional. If a given setting isn’t present the usual default values of GeSHi are used. No validation of settings is performed for these settings. Also note that unknown settings are silently ignored.
All PARSER_CONTROL settings are experimental and subject to change. So if you need a special setting in a public language file you should consider requesting it upstream. This is also the reason why documentation on these settings will only cover broad usage information as the underlying implementation might change without further notice.
One of the most common reasons why you might want to use the PARSER_CONTROL settings is to tweak what characters are allowed to surround a keyword. Usually GeSHi checks for a fixed set of characters like brackets and common symbols that denote the word boundary for a keyword. If this set conflicts with your language (e.g. - is allowed inside a keyword) or you want to limit the usage of a keyword to certain areas (e.g. for HTML tag names only match after <) you can change those conditions here.
Keyword boundary rules can either be set globally (directly within the PARSER_CONTROL’s KEYWORDS section or on a per-group basis. E.g. the following sample from the HTML language file sets different settings for keyword matching only for Keyword Group 2 and leaves the other groups alone.
PHP code | |
1 23 45 67 8 | 'PARSER_CONTROL' => array( 'KEYWORDS' => array( 2 => array( 'DISALLOWED_BEFORE' => '(?<=<|<\/)', 'DISALLOWED_AFTER' => '(?=\s|\/|>)', ) ) ) |
The name 'DISALLOWED_BEFORE'
and 'DISALLOWED_AFTER'
might sound confusing at first, since they don’t define what to prevent, but what to match in order to find a keyword.
The reason for this strange naming is based in the original implementation of this feature when Nigel implemented this in the old parser statically.
When this implementation was brought out via the PARSER_CONTROL settings the original naming wasn’t altered since at that time this really was a blacklist of characters.
Later on this implementation was changed from a blacklist of characters to a part of a PCRE regexp, but leaving the name.
The naming might be subject to change though.
Another option you can change since GeSHi 1.0.8.3 is whether to treat spaces within keywords as literals (only a single space as given) or if the space should match any whitespace at that location. The following code will enable this behaviour for the whole keyword set. As said above you can choose to enable this for single keyword groups only though.
PHP code | |
1 23 45 | 'PARSER_CONTROL' => array( 'KEYWORDS' => array( 'SPACE_AS_WHITESPACE' => true ) ), |
Another option of interest might be disabling certain features for a given language. This might come in handy if the language file you are working on doesn’t support a given function or highlighting certain aspects won’t work properly or would interfere with custom implementations using regular expressions.
PHP code | |
1 23 45 67 89 1011 12 | 'PARSER_CONTROL' => array( 'ENABLE_FLAGS' => array( 'ALL' => GESHI_NEVER, 'NUMBERS' => GESHI_NEVER, 'METHODS' => GESHI_NEVER, 'SCRIPT' => GESHI_NEVER, 'SYMBOLS' => GESHI_NEVER, 'ESCAPE_CHAR' => GESHI_NEVER, 'BRACKETS' => GESHI_NEVER, 'STRINGS' => GESHI_NEVER, ) ) |
Inside the 'ENABLE_FLAGS'
section follows an array of 'name'=>value
pairs.
Valid names are the sections below the 'STYLES'
section (well, not exactly, but you can look there for what the features are called inside GeSHi).
Valid values are the GeSHi constants GESHI_NEVER
(don’t process this feature), GESHI_ALWAYS
(always process this feature, ignore the user) and GESHI_MAYBE
(listen to the user if he want’s this highlighted).
The value GESHI_MAYBE
is the default one and thus needs not to be set explicitely.
Another setting available through the PARSER_CONTROL settings is the possibility to limit the allowed characters before an single line comment.
PHP code | |
1 23 45 | 'PARSER_CONTROL' => array( 'COMMENTS' => array( 'DISALLOWED_BEFORE' => '$' ) ) |
With the current implementation the DISALLOWED_BEFORE COMMENT-specific setting is a list of characters. But this is subject to change.
There is no 'DISALLOWED_AFTER'
setting with the 'COMMENTS'
-PARSER_CONTROL.
Another PARSER_CONTROL setting for the environment around certain syntactic constructs refers to the handling of object-oriented languages.
PHP code | |
1 23 45 67 | 'PARSER_CONTROL' => array( 'OOLANG' => array( 'MATCH_BEFORE' => '', 'MATCH_AFTER' => '[a-zA-Z_][a-zA-Z0-9_]*', 'MATCH_SPACES' => '[\s]*' ) ) |
Please note that the settings discussed in this section are experimental and might be changed, removed or altered in their meaning at any time.
All language files should end with:
PHP code | |
1
23
| ); ?> |
That is the string content "\n);\n?>\n"
.
Make sure that there is EXACTLY one linebreak character at the end. If you accidentially include more you might end up with messages like “Headers already sent”.
Since GeSHi 1.0.8 there is a new script langcheck.php
in the contrib directory that scans all
language files it finds in the geshi/ subdirectory of the GeSHi installation for mistakes.
Please make sure that your language does not contain any mistakes that this script shows you when sending in your language file for inclusion into the official release as this saves work for us when including your file. Also you can be sure your language file will work as expected once your language file validates correctly.
Please note that not all of the language files shipped with GeSHi are fully valid yet, but we’re working on it and are happy about every patch we get!
I’m afraid I have been lying for a little while about this now! Since 1.0.7 I have been including a phpdoc API for the sourcecode in the api directory, but have forgot to update the documentation! However, it is available, and may assist you in coding, especially for plugin coders.
That’s all, folks!
I’ve improved the documentation greatly from version 1.0.1, but there may still be problems with it, or it may still be confusing for you. Or perhaps I was just plain wrong about one point! If so, contact me and I’ll do my best to sort it out.
In case you were wondering, I’ve finished development of the 1.0.X thread of GeSHi. The only releases I’ll make in this thread will be of the bug-fix/add language files type. In particular, version 1.0.2 was a “concept” release - testing how far I could take the highlighting idea (as well as ideas from others).
I’m planning a code rewrite for 1.2.X, which will be based on a new engine - a “psuedo-tokenizer” engine. Hopefully it will massively reduce the server load and time taken (by almost eliminating regexps), while providing superior highlighting. But fear not! The interface and method names should all remain the same ^_^ (though I can’t say the same for language files!)
And finally, a couple of people have been asking me: how did you generate that documentation? The amazing answer is: my brain. And yes, it took a long time, and I don’t recommend doing it this way. And yes, you can borrow the styles if you like, though flick me an e-mail if you do.
Anyway, enough blather from me. Get GeSHi working for you already! :D
The PRE header (see The Code Container) is not valid HTML, you might want to use one of the other header types instead. ↩
Support is granted for PHP 4.3.0 and above, but especially 4.3.x cannot be guaranteed to work due to a lack of test systems. If you are forced to use such old PHP versions complain at your hoster or contact us if you find compatibility issues so we can try to resolve them. It’s only PHP 4.4.X and above that is verified to work. ↩
I am no longer working on this MOD, however if someone else wants to they can contact me for more information. ↩
Available as plugin only. In addition, some of the other entries mentioned here may only have GeSHi available as a plugin. ↩