diff --git a/htdocs/.htaccess b/htdocs/.htaccess deleted file mode 100644 index ef40de1c7..000000000 --- a/htdocs/.htaccess +++ /dev/null @@ -1,674 +0,0 @@ -# Apache Server Configs v2.2.0 | MIT License -# https://github.com/h5bp/server-configs-apache - -# (!) Using `.htaccess` files slows down Apache, therefore, if you have access -# to the main server config file (usually called `httpd.conf`), you should add -# this logic there: http://httpd.apache.org/docs/current/howto/htaccess.html. - -# ############################################################################## -# # CROSS-ORIGIN RESOURCE SHARING (CORS) # -# ############################################################################## - -# ------------------------------------------------------------------------------ -# | Cross-domain AJAX requests | -# ------------------------------------------------------------------------------ - -# Allow cross-origin AJAX requests. -# http://code.google.com/p/html5security/wiki/CrossOriginRequestSecurity -# http://enable-cors.org/ - -# -# Header set Access-Control-Allow-Origin "*" -# - -# ------------------------------------------------------------------------------ -# | CORS-enabled images | -# ------------------------------------------------------------------------------ - -# Send the CORS header for images when browsers request it. -# https://developer.mozilla.org/en-US/docs/HTML/CORS_Enabled_Image -# http://blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html -# http://hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/ - - - - - SetEnvIf Origin ":" IS_CORS - Header set Access-Control-Allow-Origin "*" env=IS_CORS - - - - -# ------------------------------------------------------------------------------ -# | Web fonts access | -# ------------------------------------------------------------------------------ - -# Allow access to web fonts from all domains. - - - - Header set Access-Control-Allow-Origin "*" - - - - -# ############################################################################## -# # ERRORS # -# ############################################################################## - -# ------------------------------------------------------------------------------ -# | 404 error prevention for non-existing redirected folders | -# ------------------------------------------------------------------------------ - -# Prevent Apache from returning a 404 error as the result of a rewrite -# when the directory with the same name does not exist. -# http://httpd.apache.org/docs/current/content-negotiation.html#multiviews -# http://www.webmasterworld.com/apache/3808792.htm - -Options -MultiViews - -# ------------------------------------------------------------------------------ -# | Custom error messages / pages | -# ------------------------------------------------------------------------------ - -# Customize what Apache returns to the client in case of an error. -# http://httpd.apache.org/docs/current/mod/core.html#errordocument - -ErrorDocument 404 /404.html - - -# ############################################################################## -# # INTERNET EXPLORER # -# ############################################################################## - -# ------------------------------------------------------------------------------ -# | Better website experience | -# ------------------------------------------------------------------------------ - -# Force Internet Explorer to render pages in the highest available mode -# in the various cases when it may not. -# http://hsivonen.iki.fi/doctype/ie-mode.pdf - - - Header set X-UA-Compatible "IE=edge" - # `mod_headers` cannot match based on the content-type, however, this - # header should be send only for HTML pages and not for the other resources - - Header unset X-UA-Compatible - - - -# ------------------------------------------------------------------------------ -# | Cookie setting from iframes | -# ------------------------------------------------------------------------------ - -# Allow cookies to be set from iframes in Internet Explorer. -# http://msdn.microsoft.com/en-us/library/ms537343.aspx -# http://www.w3.org/TR/2000/CR-P3P-20001215/ - -# -# Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"" -# - - -# ############################################################################## -# # MIME TYPES AND ENCODING # -# ############################################################################## - -# ------------------------------------------------------------------------------ -# | Proper MIME types for all files | -# ------------------------------------------------------------------------------ - - - - # Audio - AddType audio/mp4 m4a f4a f4b - AddType audio/ogg oga ogg opus - - # Data interchange - AddType application/json json map - AddType application/ld+json jsonld - - # JavaScript - # Normalize to standard type. - # http://tools.ietf.org/html/rfc4329#section-7.2 - AddType application/javascript js - - # Video - AddType video/mp4 f4v f4p m4v mp4 - AddType video/ogg ogv - AddType video/webm webm - AddType video/x-flv flv - - # Web fonts - AddType application/font-woff woff - AddType application/vnd.ms-fontobject eot - - # Browsers usually ignore the font MIME types and simply sniff the bytes - # to figure out the font type. - # http://mimesniff.spec.whatwg.org/#matching-a-font-type-pattern - - # Chrome however, shows a warning if any other MIME types are used for - # the following fonts. - - AddType application/x-font-ttf ttc ttf - AddType font/opentype otf - - # Make SVGZ fonts work on the iPad. - # https://twitter.com/FontSquirrel/status/14855840545 - AddType image/svg+xml svgz - AddEncoding gzip svgz - - # Other - AddType application/octet-stream safariextz - AddType application/x-chrome-extension crx - AddType application/x-opera-extension oex - AddType application/x-web-app-manifest+json webapp - AddType application/x-xpinstall xpi - AddType application/xml atom rdf rss xml - AddType image/webp webp - AddType image/x-icon cur - AddType text/cache-manifest appcache manifest - AddType text/vtt vtt - AddType text/x-component htc - AddType text/x-vcard vcf - - - -# ------------------------------------------------------------------------------ -# | UTF-8 encoding | -# ------------------------------------------------------------------------------ - -# Use UTF-8 encoding for anything served as `text/html` or `text/plain`. -AddDefaultCharset utf-8 - -# Force UTF-8 for certain file formats. - - AddCharset utf-8 .atom .css .js .json .jsonld .rss .vtt .webapp .xml - - - -# ############################################################################## -# # URL REWRITES # -# ############################################################################## - -# ------------------------------------------------------------------------------ -# | Rewrite engine | -# ------------------------------------------------------------------------------ - -# Turn on the rewrite engine and enable the `FollowSymLinks` option (this is -# necessary in order for the following directives to work). - -# If your web host doesn't allow the `FollowSymlinks` option, you may need to -# comment it out and use `Options +SymLinksIfOwnerMatch`, but be aware of the -# performance impact. -# http://httpd.apache.org/docs/current/misc/perf-tuning.html#symlinks - -# Also, some cloud hosting services require `RewriteBase` to be set. -# http://www.rackspace.com/knowledge_center/frequently-asked-question/why-is-mod-rewrite-not-working-on-my-site - - - Options +FollowSymlinks - # Options +SymLinksIfOwnerMatch - RewriteEngine On - # RewriteBase / - # Redirect "democlient.html" to the new place... - Redirect permanent /democlient.html http://cppcheck.sourceforge.net/demo/ - - # Redirect "devinfo.html" to the new place... - Redirect permanent /devinfo.html http://cppcheck.sourceforge.net/devinfo/ - - # Redirect doxyoutput, coverage- and cpd report to the new place... - Redirect permanent /doxyoutput/ http://cppcheck.sourceforge.net/devinfo/doxyoutput/ - Redirect permanent /doxygen-errors.txt http://cppcheck.sourceforge.net/devinfo/doxygen-errors.txt - Redirect permanent /coverage_report/ http://cppcheck.sourceforge.net/devinfo/coverage_report/ - Redirect permanent /cpd.txt http://cppcheck.sourceforge.net/devinfo/cpd.txt - - -# ------------------------------------------------------------------------------ -# | Suppressing / Forcing the `www.` at the beginning of URLs | -# ------------------------------------------------------------------------------ - -# The same content should never be available under two different URLs, -# especially not with and without `www.` at the beginning. This can cause -# SEO problems (duplicate content), and therefore, you should choose one -# of the alternatives and redirect the other one. - -# By default `Option 1` (no `www.`) is activated. -# http://no-www.org/faq.php?q=class_b - -# If you would prefer to use `Option 2`, just comment out all the lines -# from `Option 1` and uncomment the ones from `Option 2`. - -# IMPORTANT: NEVER USE BOTH RULES AT THE SAME TIME! - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Option 1: rewrite www.example.com → example.com - - - RewriteCond %{HTTPS} !=on - RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] - RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L] - - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Option 2: rewrite example.com → www.example.com - -# Be aware that the following might not be a good idea if you use "real" -# subdomains for certain parts of your website. - -# -# RewriteCond %{HTTPS} !=on -# RewriteCond %{HTTP_HOST} !^www\. [NC] -# RewriteCond %{SERVER_ADDR} !=127.0.0.1 -# RewriteCond %{SERVER_ADDR} !=::1 -# RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] -# - - -# ############################################################################## -# # SECURITY # -# ############################################################################## - -# ------------------------------------------------------------------------------ -# | Clickjacking | -# ------------------------------------------------------------------------------ - -# Protect website against clickjacking. - -# The example below sends the `X-Frame-Options` response header with the value -# `DENY`, informing browsers not to display the web page content in any frame. - -# This might not be the best setting for everyone. You should read about the -# other two possible values for `X-Frame-Options`: `SAMEORIGIN` & `ALLOW-FROM`. -# http://tools.ietf.org/html/rfc7034#section-2.1 - -# Keep in mind that while you could send the `X-Frame-Options` header for all -# of your site’s pages, this has the potential downside that it forbids even -# non-malicious framing of your content (e.g.: when users visit your site using -# a Google Image Search results page). - -# Nonetheless, you should ensure that you send the `X-Frame-Options` header for -# all pages that allow a user to make a state changing operation (e.g: pages -# that contain one-click purchase links, checkout or bank-transfer confirmation -# pages, pages that make permanent configuration changes, etc.). - -# Sending the `X-Frame-Options` header can also protect your website against -# more than just clickjacking attacks: https://cure53.de/xfo-clickjacking.pdf. - -# http://tools.ietf.org/html/rfc7034 -# http://blogs.msdn.com/b/ieinternals/archive/2010/03/30/combating-clickjacking-with-x-frame-options.aspx -# https://www.owasp.org/index.php/Clickjacking - -# -# Header set X-Frame-Options "DENY" -# -# Header unset X-Frame-Options -# -# - -# ------------------------------------------------------------------------------ -# | Content Security Policy (CSP) | -# ------------------------------------------------------------------------------ - -# Mitigate the risk of cross-site scripting and other content-injection attacks. - -# This can be done by setting a `Content Security Policy` which whitelists -# trusted sources of content for your website. - -# The example header below allows ONLY scripts that are loaded from the current -# site's origin (no inline scripts, no CDN, etc). This almost certainly won't -# work as-is for your site! - -# For more details on how to craft a reasonable policy for your site, read: -# http://html5rocks.com/en/tutorials/security/content-security-policy (or the -# specification: http://w3.org/TR/CSP). Also, to make things easier, you can -# use an online CSP header generator such as: http://cspisawesome.com/. - -# -# Header set Content-Security-Policy "script-src 'self'; object-src 'self'" -# -# Header unset Content-Security-Policy -# -# - -# ------------------------------------------------------------------------------ -# | File access | -# ------------------------------------------------------------------------------ - -# Block access to directories without a default document. -# You should leave the following uncommented, as you shouldn't allow anyone to -# surf through every directory on your server (which may includes rather private -# places such as the CMS's directories). - - - Options -Indexes - - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Block access to hidden files and directories. -# This includes directories used by version control systems such as Git and SVN. - - - RewriteCond %{SCRIPT_FILENAME} -d [OR] - RewriteCond %{SCRIPT_FILENAME} -f - RewriteRule "(^|/)\." - [F] - - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Block access to files that can expose sensitive information. - -# By default, block access to backup and source files that may be left by some -# text editors and can pose a security risk when anyone has access to them. -# http://feross.org/cmsploit/ - -# IMPORTANT: Update the `` regular expression from below to include -# any files that might end up on your production server and can expose sensitive -# information about your website. These files may include: configuration files, -# files that contain metadata about the project (e.g.: project dependencies), -# build scripts, etc.. - - - - # Apache < 2.3 - - Order allow,deny - Deny from all - Satisfy All - - - # Apache ≥ 2.3 - - Require all denied - - - - -# ------------------------------------------------------------------------------ -# | Reducing MIME-type security risks | -# ------------------------------------------------------------------------------ - -# Prevent some browsers from MIME-sniffing the response. - -# This reduces exposure to drive-by download attacks and should be enable -# especially if the web server is serving user uploaded content, content -# that could potentially be treated by the browser as executable. - -# http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx -# http://msdn.microsoft.com/en-us/library/ie/gg622941.aspx -# http://mimesniff.spec.whatwg.org/ - -# -# Header set X-Content-Type-Options "nosniff" -# - -# ------------------------------------------------------------------------------ -# | Reflected Cross-Site Scripting (XSS) attacks | -# ------------------------------------------------------------------------------ - -# (1) Try to re-enable the Cross-Site Scripting (XSS) filter built into the -# most recent web browsers. -# -# The filter is usually enabled by default, but in some cases it may be -# disabled by the user. However, in Internet Explorer for example, it can -# be re-enabled just by sending the `X-XSS-Protection` header with the -# value of `1`. -# -# (2) Prevent web browsers from rendering the web page if a potential reflected -# (a.k.a non-persistent) XSS attack is detected by the filter. -# -# By default, if the filter is enabled and browsers detect a reflected -# XSS attack, they will attempt to block the attack by making the smallest -# possible modifications to the returned web page. -# -# Unfortunately, in some browsers (e.g.: Internet Explorer), this default -# behavior may allow the XSS filter to be exploited, thereby, it's better -# to tell browsers to prevent the rendering of the page altogether, instead -# of attempting to modify it. -# -# http://hackademix.net/2009/11/21/ies-xss-filter-creates-xss-vulnerabilities -# -# IMPORTANT: Do not rely on the XSS filter to prevent XSS attacks! Ensure that -# you are taking all possible measures to prevent XSS attacks, the most obvious -# being: validating and sanitizing your site's inputs. -# -# http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-iv-the-xss-filter.aspx -# http://blogs.msdn.com/b/ieinternals/archive/2011/01/31/controlling-the-internet-explorer-xss-filter-with-the-x-xss-protection-http-header.aspx -# https://www.owasp.org/index.php/Cross-site_Scripting_%28XSS%29 - -# -# # (1) (2) -# Header set X-XSS-Protection "1; mode=block" -# -# Header unset X-XSS-Protection -# -# - -# ------------------------------------------------------------------------------ -# | Secure Sockets Layer (SSL) | -# ------------------------------------------------------------------------------ - -# Rewrite secure requests properly in order to prevent SSL certificate warnings. -# E.g.: prevent `https://www.example.com` when your certificate only allows -# `https://secure.example.com`. - -# -# RewriteCond %{SERVER_PORT} !^443 -# RewriteRule ^ https://example-domain-please-change-me.com%{REQUEST_URI} [R=301,L] -# - -# ------------------------------------------------------------------------------ -# | HTTP Strict Transport Security (HSTS) | -# ------------------------------------------------------------------------------ - -# Force client-side SSL redirection. - -# If a user types `example.com` in his browser, the above rule will redirect -# him to the secure version of the site. That still leaves a window of -# opportunity (the initial HTTP connection) for an attacker to downgrade or -# redirect the request. - -# The following header ensures that browser will ONLY connect to your server -# via HTTPS, regardless of what the users type in the address bar. - -# http://tools.ietf.org/html/draft-ietf-websec-strict-transport-sec-14#section-6.1 -# http://www.html5rocks.com/en/tutorials/security/transport-layer-security/ - -# IMPORTANT: Remove the `includeSubDomains` optional directive if the subdomains -# are not using HTTPS. - -# -# Header set Strict-Transport-Security "max-age=16070400; includeSubDomains" -# - -# ------------------------------------------------------------------------------ -# | Server software information | -# ------------------------------------------------------------------------------ - -# Avoid displaying the exact Apache version number, the description of the -# generic OS-type and the information about Apache's compiled-in modules. - -# ADD THIS DIRECTIVE IN THE `httpd.conf` AS IT WILL NOT WORK IN THE `.htaccess`! - -# ServerTokens Prod - - -# ############################################################################## -# # WEB PERFORMANCE # -# ############################################################################## - -# ------------------------------------------------------------------------------ -# | Compression | -# ------------------------------------------------------------------------------ - - - - # Force compression for mangled headers. - # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping - - - SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding - RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding - - - - # Compress all output labeled with one of the following MIME-types - # (for Apache versions below 2.3.7, you don't need to enable `mod_filter` - # and can remove the `` and `` lines - # as `AddOutputFilterByType` is still in the core directives). -# - AddOutputFilterByType DEFLATE application/atom+xml \ - application/javascript \ - application/json \ - application/ld+json \ - application/rss+xml \ - application/vnd.ms-fontobject \ - application/x-font-ttf \ - application/x-web-app-manifest+json \ - application/xhtml+xml \ - application/xml \ - font/opentype \ - image/svg+xml \ - image/x-icon \ - text/css \ - text/html \ - text/plain \ - text/x-component \ - text/xml -# - - - -# ------------------------------------------------------------------------------ -# | Content transformations | -# ------------------------------------------------------------------------------ - -# Prevent mobile network providers from modifying the website's content. -# http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.5. - -# -# Header set Cache-Control "no-transform" -# - -# ------------------------------------------------------------------------------ -# | ETags | -# ------------------------------------------------------------------------------ - -# Remove `ETags` as resources are sent with far-future expires headers. -# http://developer.yahoo.com/performance/rules.html#etags. - -# `FileETag None` doesn't work in all cases. - - Header unset ETag - - -FileETag None - -# ------------------------------------------------------------------------------ -# | Expires headers | -# ------------------------------------------------------------------------------ - -# The following expires headers are set pretty far in the future. If you -# don't control versioning with filename-based cache busting, consider -# lowering the cache time for resources such as style sheets and JavaScript -# files to something like one week. - - - - ExpiresActive on - ExpiresDefault "access plus 1 month" - - # CSS - ExpiresByType text/css "access plus 1 week" - - # Data interchange - ExpiresByType application/json "access plus 0 seconds" - ExpiresByType application/ld+json "access plus 0 seconds" - ExpiresByType application/xml "access plus 0 seconds" - ExpiresByType text/xml "access plus 0 seconds" - - # Favicon (cannot be renamed!) and cursor images - ExpiresByType image/x-icon "access plus 1 week" - - # HTML components (HTCs) - ExpiresByType text/x-component "access plus 1 month" - - # HTML - ExpiresByType text/html "access plus 0 seconds" - - # JavaScript - ExpiresByType application/javascript "access plus 1 week" - - # Manifest files - ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds" - ExpiresByType text/cache-manifest "access plus 0 seconds" - - # Media - ExpiresByType audio/ogg "access plus 1 month" - ExpiresByType image/gif "access plus 1 month" - ExpiresByType image/jpeg "access plus 1 month" - ExpiresByType image/png "access plus 1 month" - ExpiresByType video/mp4 "access plus 1 month" - ExpiresByType video/ogg "access plus 1 month" - ExpiresByType video/webm "access plus 1 month" - - # Web feeds - ExpiresByType application/atom+xml "access plus 1 hour" - ExpiresByType application/rss+xml "access plus 1 hour" - - # Web fonts - ExpiresByType application/font-woff "access plus 1 month" - ExpiresByType application/vnd.ms-fontobject "access plus 1 month" - ExpiresByType application/x-font-ttf "access plus 1 month" - ExpiresByType font/opentype "access plus 1 month" - ExpiresByType image/svg+xml "access plus 1 month" - - - -# ------------------------------------------------------------------------------ -# | Filename-based cache busting | -# ------------------------------------------------------------------------------ - -# If you're not using a build process to manage your filename version revving, -# you might want to consider enabling the following directives to route all -# requests such as `/css/style.12345.css` to `/css/style.css`. - -# To understand why this is important and a better idea than `*.css?v231`, read: -# http://stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring - -# -# RewriteCond %{REQUEST_FILENAME} !-f -# RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpe?g|gif)$ $1.$3 [L] -# - -# ------------------------------------------------------------------------------ -# | File concatenation | -# ------------------------------------------------------------------------------ - -# Allow concatenation from within specific style sheets and JavaScript files. - -# e.g.: -# -# If you have the following content in a file -# -# -# -# -# Apache will replace it with the content from the specified files. - -# -# -# Options +Includes -# AddOutputFilterByType INCLUDES application/javascript application/json -# SetOutputFilter INCLUDES -# -# -# Options +Includes -# AddOutputFilterByType INCLUDES text/css -# SetOutputFilter INCLUDES -# -# diff --git a/htdocs/404.html b/htdocs/404.html deleted file mode 100644 index eec1d15a8..000000000 --- a/htdocs/404.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - Cppcheck - Page Not Found - - - - -

Page Not Found

-

Sorry, but the page you were trying to view does not exist.

- - - diff --git a/htdocs/Readme.md b/htdocs/Readme.md deleted file mode 100644 index afe746577..000000000 --- a/htdocs/Readme.md +++ /dev/null @@ -1,9 +0,0 @@ -Getting started ---------------- - -* Install [node.js](http://nodejs.org/download/) -* Install the node.js dependencies: `npm install` -* Run `node make` or `node make minify` - -You can run `npm run lint` to run [JSHint](https://github.com/jshint/jshint) -and [csslint](https://github.com/stubbornella/csslint) for our files. diff --git a/htdocs/analyticstracking.php b/htdocs/analyticstracking.php deleted file mode 100644 index c0e41fd59..000000000 --- a/htdocs/analyticstracking.php +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/htdocs/demo/index.php b/htdocs/demo/index.php deleted file mode 100644 index 432aab1c4..000000000 --- a/htdocs/demo/index.php +++ /dev/null @@ -1,102 +0,0 @@ - - - - - Online Demo - Cppcheck - - - - - - - - - - -
- -
-
-
-

Online Demo

-
-

(max 1024 characters)
-
- -

-
-

Examples

-

This code can be copied and pasted in the edit box above.

-

NULL pointers

-
void f1(struct fred_t *p)
-{
-    // dereference p and then check if it's NULL
-    int x = p->x;
-    if (p)
-        do_something(x);
-}
-
-void f2()
-{
-    const char *p = NULL;
-    for (int i = 0; str[i] != '\0'; i++)
-    {
-        if (str[i] == ' ')
-        {
-            p = str + i;
-            break;
-        }
-    }
-
-    // p is NULL if str doesn't have a space. If str always has a
-    // a space then the condition (str[i] != '\0') would be redundant
-    return p[1];
-}
-
-void f3(int a)
-{
-    struct fred_t *p = NULL;
-    if (a == 1)
-        p = fred1;
-
-    // if a is not 1 then p is NULL
-    p->x = 0;
-}
-
-
- - - diff --git a/htdocs/demo/report/index.php b/htdocs/demo/report/index.php deleted file mode 100644 index 39cc8eaeb..000000000 --- a/htdocs/demo/report/index.php +++ /dev/null @@ -1,178 +0,0 @@ - $code - ) - ); - - $opts = array('http' => - array( - 'method' => 'POST', - 'header' => 'Content-type: application/x-www-form-urlencoded', - 'content' => $postdata - ) - ); - - $context = stream_context_create($opts); - - return @file_get_contents('http://cppcheck.sourceforge.net/cgi-bin/democlient.cgi', false, $context); - } - - function cut_string($string, $length = 1024) { - if (strlen($string) > $length) { - return substr($string, 0, $length); - } - return $string; - } - - //-------------------------------------------------------------------------------- - // XML output... - //-------------------------------------------------------------------------------- - if ($isXmlOutput) { //if XML output... - header('Content-Type: text/xml'); - - if (!$isCodePosted) { //if NO code posted... - echo "\n\n"; - exit; - } - - $output = get_democlient_output(cut_string($_POST['code'])); - - if ($output === false) { //if NO demo client output... - echo "\n\n"; - exit; - } - - echo $output; - exit; - } - //-------------------------------------------------------------------------------- -?> - - - - - Online Demo Report - Cppcheck - - - - - - - - - - -
- -
-
-
-

Online Demo Report

-errors->error as $error) { //for all errors... - $severity = (string)$error->attributes()->severity; - $msg = (string)$error->attributes()->msg; - $line = (string)$error->location->attributes()->line; - if (!empty($severity) && !empty($msg) && !empty($line)) { //if complete error... - $parsed[] = array('severity' => $severity, 'msg' => $msg, 'line' => $line); - } - } - return $parsed; - } - catch (Exception $ex) { - return array(); - } - } - - if ($isCodePosted) { //if code posted... - include_once '../../site/geshi/geshi.php'; - - $code = cut_string($_POST['code']); - - $geshi = new GeSHi($code, 'cpp'); - $geshi->enable_classes(); - $geshi->set_header_type(GESHI_HEADER_PRE_TABLE); - $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS); - $geshi->set_overall_class('geshicode'); - - echo "

Input

\n"; - echo $geshi->parse_code(); - - echo "

Output

\n"; - - $output = get_democlient_output($code); - - if (!$output === false) { - $results = parse_democlient_output($output); - - if (!empty($results)) { - echo "\n"; - echo "\n"; - echo " \n"; - echo "\n"; - echo "\n"; - foreach ($results as $result) { //for each result... - echo " \n"; - } - echo "\n"; - echo "
LineSeverityMessage
" . htmlspecialchars($result['line']) . "" . htmlspecialchars($result['severity']) . "" . htmlspecialchars($result['msg']) . "
\n"; - } - else { - echo "

No errors found.

\n"; - } - } - else { - echo "

Problem with demo client. Please try again.

\n"; - } - } - else { //if NO code posted... - echo "

Use the online demo page to create the report.

\n"; - } -?> -
-
- - - \ No newline at end of file diff --git a/htdocs/devinfo/index.php b/htdocs/devinfo/index.php deleted file mode 100644 index 82925c90c..000000000 --- a/htdocs/devinfo/index.php +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Developer Information - Cppcheck - - - - - - - - - - - - -
- -
-
- -
-
-
-

Source Code

-

Latest version can be found in the -cppcheck git repository.

-

To get the source code using git:

-
git clone git://github.com/danmar/cppcheck.git
-

To get the source code using subversion:

-
svn checkout https://github.com/danmar/cppcheck/trunk
-

You can also download -the latest sources in a zip or tgz archive from the github website.

-

Recent Commits

- -

View all commits…

-

Trac Timeline

-set_feed_url('http://sourceforge.net/apps/trac/cppcheck/timeline?changeset=on&ticket=on&milestone=on&wiki=on&max=10&daysback=90&format=rss'); - $feed->set_cache_location('../site/simplepie/cache'); - $feed->init(); - print("
    \n"); - foreach ($feed->get_items() as $item) { //for the last timeline items... - if ($author = $item->get_author()) { - $author = "by ".trim($author->get_name()).""; - } else { - $author = null; - } - print("
  • get_link()."\">".$item->get_title()." ".$author." on ".$item->get_date('Y-m-d')."
  • \n"); - } - print("
\n"); -?> -

View complete Trac timeline…

-

Active Forum Topics

-\n"); - foreach ($activetopics->getTopics(0, 10) as $topic) { //for all active topics... - $lastPostLine = ''; - if ($topic->getLastPost() != null) { - $lastPost = $topic->getLastPost(); - $lastPostLine = sprintf('last post by %1$s at %2$s', $lastPost->getUser(), $lastPost->getDate('Y-m-d H:i')); - } - print("
  • getLink()."\">".$topic->getTitle()." ".$lastPostLine."
  • \n"); - } - print("\n"); -?> -

    View all active topics…

    -

    Doxygen

    - -

    Other

    - -
    -
    - - - diff --git a/htdocs/favicon.ico b/htdocs/favicon.ico deleted file mode 100644 index 4ebd49388..000000000 Binary files a/htdocs/favicon.ico and /dev/null differ diff --git a/htdocs/gsoc2014.php b/htdocs/gsoc2014.php deleted file mode 100644 index e5b2ea9a6..000000000 --- a/htdocs/gsoc2014.php +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - google summer of code 2014 ideas - - - - - - -
    - -
    -
    -
    - -

    Overview

    - -

    -

      -
    1. Core Cppcheck -
        -
      1. Add 1 new checker (C++)
      2. -
      3. Abstract interpretation of loops (C++)
      4. -
      5. Check for unused functions when -j is used (C++)
      6. -
    2. -
    3. Configurations -
        -
      1. Add a configuration (XML)
      2. -
      3. Auto generate configuration (C++ / scripting) -
      4. GUI for editing configurations (C++,Qt)
      5. -
    4. -
    5. Distributed computing -
        -
      1. Distributed computing (Network programming, Python / C++)
      2. -
    6. - -

      - -

      1. Core Cppcheck

      - -

      - Project 1.1
      - Name: Add 1 new checker
      - Skills required: C++
      - Description: There are several tickets in our issue tracker that has ideas for new checkers. - The subtasks will be: pick a ticket to fix, write test cases, implement new checker, test it against various - projects. -

      - -

      - Project 1.2
      - Name: Abstract interpretation of loops
      - Skills required: C++
      - Description: You will write an C/C++ expression interpreter that uses the Cppcheck syntax - tree to interpret the expressions in loops. When there are unknown operands (variables with unknown value, - etc) the interpreter shall bailout. You will interpret the loop expressions until : the loop finish , or - there is a timeout , or the variables are unchanged. During the interpretation, the variable values will be - recorded and saved as ValueFlow values. You can read an overview of the Cppcheck syntax tree and ValueFlow - analysis in the cppcheck - design document. -

      - -

      - Project 1.3
      - Name: Check for unused functions when -j is used
      - Skills required: C++, threads
      - Description: Currently the check for unused functions only works when the analysis is - single-threaded. When multithreaded analysis is done the check is disabled. Currently the check saves function - usage information in a container. The same container is used for all files. This should be refactored. For each - file there should be a separate container for the function usage information. -

      - -

      2. Configurations

      - -

      - Project 2.1
      - Name: Add a configuration
      - Skills required: C/C++ (not much), XML
      - Description: More configuration files are needed for various libraries. Subtasks: choose - a popular library. Analyse the library functions and read API documentation. Write proper configuration - file for Cppcheck. Test the configuration. -

      - -

      - Project 2.2
      - Name: Autogenerated configurations
      - Skills required: C++ / scripting
      - Description: Auto generate configuration from headers. To parse the headers, you can for - instance do this yourself (python script/c++/..) or you can modify cppcheck. All function names will be - extracted, and you will also determine what function arguments are passed by value. -

      - -

      - Project 2.3
      - Name: GUI for editing configurations
      - Skills required: C++, Qt
      - Description: A graphical user interface for editing configurations would be nice. This can - be developed as a standalone program or integrated in the cppcheck-gui program. However in the end the plan - is that it will be merged into the cppcheck-gui program. -

      - -

      3. Distributed computing

      - -

      - Project 3.1
      - Name: Distributed computing
      - Skills required: Network, python / c++
      - Description: Make it possible to distribute analysis. A client and server needs to be - written. The client will execute cppcheck to perform analysis. The programming language used to write the - client and server is either python or c++ (your choice). The server shall be able to handle at least 100 - clients. The client and server needs to be cross platform. -

      - -
    -
    - - - diff --git a/htdocs/index.php b/htdocs/index.php deleted file mode 100644 index acc3e97be..000000000 --- a/htdocs/index.php +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - Cppcheck - A tool for static C/C++ code analysis - - - - - - - -
    - -
    -
    - -
    -
    -
    -

    -Cppcheck is a static analysis tool -for C/C++ code. Unlike C/C++ compilers and many other analysis tools it does -not detect syntax errors in the code. Cppcheck primarily detects the types of -bugs that the compilers normally do not detect. The goal is to detect only real -errors in the code (i.e. have zero false positives). -

    - -

    Download

    -

    - - Download Now! - Version 1.65 for Windows - -

    -

    You can download the standalone Cppcheck from our project page or add it -as a plugin for your favorite IDE:

    - - -

    Using a battery of tools is better than using 1 tool. Therefore we recommend that you also use other tools.

    - -

    One other tool you can use is PVS-Studio. There is a -comparison of Cppcheck and PVS-Studio and we believe it's a good and honest comparison. -PVS-Studio is commercial, however there is a free trial.

    - -

    Features

    -
      -
    • Out of bounds checking
    • -
    • Check the code for each class
    • -
    • Checking exception safety
    • -
    • Memory leaks checking
    • -
    • Warn if obsolete functions are used
    • -
    • Check for invalid usage of STL
    • -
    • Check for uninitialized variables and unused functions
    • -
    - -

    News

    -set_feed_url('http://sourceforge.net/p/cppcheck/news/feed'); - $feed->set_cache_location('./site/simplepie/cache'); - $feed->init(); - print("\n"); -?> -

    View all news…

    - -

    Documentation

    -

    You can read the manual or download some -articles.

    - -

    Support

    - - -

    Contribute

    -

    You are welcome to contribute. Help is needed.

    -
    -
    Testing
    -
    Pick a project and test it's source with latest version. Write tickets to - Trac about issues you - find from Cppcheck. If you test open source projects and write bug reports to - them, check the issues in the “Found bugs” - wiki section, and write links to the bug reports you have created e.g. to our - forum, so we can keep - a track about them.
    -
    Developing
    -
    Pick a ticket from Trac, - write a test case for it (and write a comment to the ticket that test case has - been created). Or pick a test case that fails and try to fix it. Make a patch - and submit it to Trac either inline if it is small, or attach it as a file.
    -
    Marketing
    -
    Write articles, reviews or tell your friends about us. The more users we - have, the more people we have testing and the better we can become.
    -
    Design
    -
    Invent new good checks and create tickets to Trac - about them.
    -
    Integration
    -
    Write a plugin to your favorite IDE or create a package for your distribution - or operating system.
    -
    Technical Writer
    -
    Write better documentation for the bugs we find. Currently only a few bugs - have any documentation at all.
    -
    -
    -
    - - - diff --git a/htdocs/make.js b/htdocs/make.js deleted file mode 100644 index 6d949d9ca..000000000 --- a/htdocs/make.js +++ /dev/null @@ -1,99 +0,0 @@ -/**! - * Cppcheck - A tool for static C/C++ code analysis - * Copyright (C) 2014 XhmikosR and Cppcheck team. - * - * This program 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 3 of the License, or - * (at your option) any later version. - * - * This program 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 this program. If not, see . - */ - -(function () { - "use strict"; - - require("shelljs/make"); - var fs = require("fs"), - CleanCSS = require("clean-css"), - UglifyJS = require("uglify-js"), - rootDir = __dirname + "/"; // absolute path to project's root - - // - // make minify - // - target.minify = function () { - cd(rootDir); - echo(); - echo("### Minifying css files..."); - - // pack.css - var inCss = cat(["site/css/normalize.css", - "site/css/all.css", - "site/css/demo.css"]); - - var minifier = new CleanCSS({ - keepSpecialComments: 0, - compatibility: "ie8" - }); - - fs.writeFileSync("site/css/pack.css", minifier.minify(inCss), "utf8"); - - echo(); - echo("### Finished site/css/pack.css."); - - echo(); - echo("### Minifying js files..."); - - var inJs = cat(["site/js/github.js", - "site/js/picnet.table.filter.min.js"]); - - var minifiedJs = UglifyJS.minify(inJs, { - compress: true, - fromString: true, // this is needed to pass JS source code instead of filenames - mangle: true, - warnings: false - }); - - fs.writeFileSync("site/js/pack.js", minifiedJs.code, "utf8"); - - echo(); - echo("### Finished site/js/pack.js."); - - minifiedJs = UglifyJS.minify(cat("site/js/sorttable.js"), { - compress: true, - fromString: true, // this is needed to pass JS source code instead of filenames - mangle: true, - warnings: false - }); - - fs.writeFileSync("site/js/sorttable.min.js", minifiedJs.code, "utf8"); - - echo(); - echo("### Finished site/js/sorttable.min.js."); - }; - - - // - // make all - // - target.all = function () { - target.minify(); - }; - - // - // make help - // - target.help = function () { - echo("Available targets:"); - echo(" minify Creates the minified CSS and JS"); - echo(" help shows this help message"); - }; - -}()); diff --git a/htdocs/package.json b/htdocs/package.json deleted file mode 100644 index 91eef969a..000000000 --- a/htdocs/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "cppcheck-web", - "version": "0.2.0", - "author": "XhmikosR (https://github.com/XhmikosR)", - "description": "The dependencies to build cppcheck's website", - "homepage": "https://github.com/danmar/cppcheck", - "repository": { - "type": "git", - "url": "https://github.com/danmar/cppcheck.git" - }, - "bugs": { - "url": "http://sourceforge.net/apps/trac/cppcheck/wiki" - }, - "license": "GPLv3", - "main": "make.js", - "scripts": { - "lint": "node run-tests" - }, - "dependencies": { - "clean-css": "~2.1.8", - "csslint": "~0.10.0", - "jshint": "~2.5.1", - "shelljs": "~0.3.0", - "uglify-js": "~2.4.13" - }, - "jshintConfig": { - "camelcase": true, - "curly": true, - "eqeqeq": true, - "forin": true, - "indent": 4, - "latedef": true, - "noarg": true, - "node": true, - "noempty": true, - "quotmark": "double", - "shelljs": true, - "strict": true, - "undef": true, - "unused": true - }, - "engines": { - "node": ">=0.8.0" - } -} diff --git a/htdocs/run-tests.js b/htdocs/run-tests.js deleted file mode 100644 index 8d8103a72..000000000 --- a/htdocs/run-tests.js +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env node - -/**! - * Cppcheck - A tool for static C/C++ code analysis - * Copyright (C) 2014 XhmikosR and Cppcheck team. - * - * This program 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 3 of the License, or - * (at your option) any later version. - * - * This program 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 this program. If not, see . - */ - -require("shelljs/global"); - -cd(__dirname); - -// -// JSHint -// -var jshintBin = "./node_modules/jshint/bin/jshint"; - -if (!test("-f", jshintBin)) { - echo("JSHint not found. Run `npm install` in the root dir first."); - exit(1); -} - -if (exec("node" + " " + jshintBin + " " + "make.js run-tests.js site/js/github.js").code !== 0) { - echo("*** JSHint failed! (return code != 0)"); - echo(); -} else { - echo("JSHint completed successfully"); - echo(); -} - - -// -// csslint -// -var csslintBin = "./node_modules/csslint/cli.js"; - -if (!test("-f", csslintBin)) { - echo("csslint not found. Run `npm install` in the root dir first."); - exit(1); -} - -// csslint doesn't return proper error codes... -/*if (exec("node" + " " + csslintBin + " " + "css/all.css").code !== 0) { - echo("*** csslint failed! (return code != 0)"); - echo(); -}*/ -exec("node" + " " + csslintBin + " " + "site/css/all.css"); diff --git a/htdocs/site/activetopics.php b/htdocs/site/activetopics.php deleted file mode 100644 index 686514259..000000000 --- a/htdocs/site/activetopics.php +++ /dev/null @@ -1,265 +0,0 @@ -_forumHome = $forumHome; - $this->_topics = array(); - - $this->update(); - } - - /** - * ... - * @param int $start ... - * @param int $end ... - * @return array ... - */ - public function getTopics($start = 0, $end = 0) { - if ($end == 0) { - return array_slice($this->_topics, $start); - } - else { - return array_slice($this->_topics, $start, $end); - } - //return $this->_topics; - } - - /** - * ... - * @param int $days ... - */ - public function update($days = 30) { - $this->_topics = array(); - $html = file_get_contents($this->_forumHome . 'search.php?st=' . $days . '&search_id=active_topics'); - $html = strip_tags($html, '
    '); - $html = preg_replace(array('#\t#', '#&sid=[a-z0-9]+#'), '', $html); - if (preg_match_all('#(.*?)#im', $html, $matches)) { - $lastPosts = array(); - if (preg_match_all('#
    \nby (.*?) ([A-Za-z0-9,: ]+) \n
    #i', $html, $lastPostMatches)) { - $lastPostUserLinks = $lastPostMatches[1]; - $lastPostUserNames = $lastPostMatches[2]; - $lastPostTimes = $lastPostMatches[3]; - for ($i = 0; $i < count($lastPostUserLinks); $i++) { //for all users... - $link = $this->_forumHome . $lastPostUserLinks[$i]; - $name = $lastPostUserNames[$i]; - $timestamp = strtotime($lastPostTimes[$i]); - if ($timestamp === false || $timestamp === -1) { - $timestamp = 0; - } - - $lastPosts[] = new Forum_LastPost(new Forum_User($link, $name), $timestamp); - } - } - $links = $matches[1]; - $titles = $matches[2]; - for ($i = 0; $i < count($links); $i++) { //for all topics... - $link = $this->_forumHome . $links[$i]; - $title = $titles[$i]; - $lastPost = $lastPosts[$i]; - - $this->_topics[] = new Forum_Topic($link, $title, $lastPost); - } - } - } -} - -class Forum_Topic { - /** - * ... - * @var string ... - */ - private $_link; - - /** - * ... - * @var string ... - */ - private $_title; - - /** - * ... - * @var Forum_LastPost ... - */ - private $_lastPost; - - /** - * ... - * @param string $link ... - * @param string $title ... - * @param Forum_LastPost $lastPost ... - */ - public function __construct($link, $title, $lastPost = null) { - $this->_link = $link; - $this->_title = $title; - $this->_lastPost = $lastPost; - } - - /** - * ... - * @return string ... - */ - public function getLink() { - return $this->_link; - } - - /** - * ... - * @return string ... - */ - public function getTitle() { - return $this->_title; - } - - /** - * ... - * @return Forum_LastPost ... - */ - public function getLastPost() { - return $this->_lastPost; - } - - /** - * ... - * @return Forum_User ... - * @deprecated - */ - public function getLastPostUser() { - if (!empty($this->_lastPost)) { - return $this->_lastPost->getUser(); - } - return null; - } - - /** - * ... - * @return integer ... - * @deprecated - */ - public function getLastPostTimestamp() { - if (!empty($this->_lastPost)) { - return $this->_lastPost->getTimestamp(); - } - return 0; - } -} - -class Forum_User { - /** - * ... - * @var string ... - */ - private $_link; - - /** - * ... - * @var string ... - */ - private $_name; - - /** - * ... - * @param string $link ... - * @param string $name ... - */ - public function __construct($link, $name) { - $this->_link = $link; - $this->_name = $name; - } - - /** - * ... - * @return string ... - */ - public function getLink() { - return $this->_link; - } - - /** - * ... - * @return string ... - */ - public function getName() { - return $this->_name; - } - - /** - * ... - */ - public function __toString() { - return $this->_name; - } -} - -class Forum_LastPost { - /** - * ... - * @var Forum_User ... - */ - private $_user; - - /** - * ... - * @var integer ... - */ - private $_timestamp; - - /** - * ... - * @param Forum_User $user ... - * @param integer $timestamp ... - */ - public function __construct($user, $timestamp) { - $this->_user = $user; - $this->_timestamp = $timestamp; - } - - /** - * ... - * @return Forum_User ... - */ - public function getUser() { - return $this->_user; - } - - /** - * ... - * @return integer ... - */ - public function getTimestamp() { - return $this->_timestamp; - } - - /** - * ... - * @return string ... - */ - public function getDate($format) { - return date($format, $this->_timestamp); - } -} -?> diff --git a/htdocs/site/css/all.css b/htdocs/site/css/all.css deleted file mode 100644 index 11e1e422d..000000000 --- a/htdocs/site/css/all.css +++ /dev/null @@ -1,192 +0,0 @@ -/*csslint box-sizing: false, ids: false, qualified-headings: false*/ - -body { - padding: 0; - font: 16px Calibri, Verdana, sans-serif; - color: black; - background-color: #eee; -} - -dt { - font-weight: bold; -} - - -/* Default link style */ -a:hover { - -webkit-transition: all 0.20s ease-in-out; - -moz-transition: all 0.20s ease-in-out; - -o-transition: all 0.20s ease-in-out; - transition: all 0.20s ease-in-out; -} - -a:link, -a:visited { color: #036; text-decoration: underline; } - -a:active, -a:focus, -a:hover, -a:visited { color: #369; } - - -/* Header */ -#header { - color: #69c; - background-color: #036; -} - -#header a { - color: inherit; - text-decoration: none; -} - -#header h1 { - margin: 0; - padding: 0; - font-family: Orbitron; -} - -#header p { - margin: 0; - padding: 0; - font-size: larger; -} - -/* Tabs */ -#tabs { - color: #eee; - background-color: #369; - border-top: 1px solid black; - border-bottom: 1px solid black; -} - -#tabs ul { - margin: 0; - padding: 0; - list-style-type: none; - font-size: larger; -} - -#tabs li { - display: inline; - padding: 0 0.5em; - border-right: 1px solid black; -} - -#tabs li:first-child { - padding-left: 0; -} - -#tabs li:last-child { - border: none; -} - -#tabs a:link, -#tabs a:visited { color: #eee; text-decoration: none; } - -#tabs a:focus, -#tabs a:hover, -#tabs a:active { color: white; text-decoration: underline; } - - -/* Anchors */ -#anchors ul { - margin: 0; - padding: 0.5em 0; - list-style-type: none; - font-size: smaller; -} - -#anchors li { - display: inline; - padding: 0 0.5em; -} - -#anchors li:first-child { - padding-left: 0; -} - -#anchors .wrap { - padding: 0; -} - - -/* Wrap */ -.wrap { - width: 50em; - margin: 0 auto; - padding: 0.5em; - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; -} - - -/* RSS feed items */ -.rssfeeditems em { - margin-left: 0.5em; - color: #888; - font-size: smaller; -} - -a.author:link, -a.author:visited, -a.author:link:hover, -a.author:visited:hover, -a.author:focus, -a.author:active { - color: #888; -} - - -/* "Download Now!" link */ -a.downloadnow { - display: block; - width: 12em; - margin: 0; - padding: 5px; - text-align: center; - text-decoration: none; - color: white; - background-color: #060; - border: 1px solid #003D00; - -webkit-border-radius: 0.5em; - -khtml-border-radius: 0.5em; - -moz-border-radius: 0.5em; - border-radius: 0.5em; - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; -} - -a.downloadnow:focus, -a.downloadnow:hover { - background-color: #090; -} - -.downButtonText { - display: block; - font-size: larger; - font-weight: bold; -} - -.downButtonVersion { - display: block; - font-size: smaller; -} - -/* Command */ -.cmd { - padding: 0.5em; - background-color: #f7f7f7; - border: 1px solid silver; - border-left: 10px solid silver; -} - -/* Printing */ -@media print { - #header { color: black; border-bottom: 1px solid black; } - #tabs { display: none; } - #resultsTable th, - #resultsTable td { background-color: white; border: 1px solid black; } -} diff --git a/htdocs/site/css/daca2.css b/htdocs/site/css/daca2.css deleted file mode 100644 index 506113d32..000000000 --- a/htdocs/site/css/daca2.css +++ /dev/null @@ -1,24 +0,0 @@ -table { - text-align: center; -} - -td { - font-size: 0.9em; - padding: 0.2em; -} - -td + td { - padding-left: 6em; -} - -th { - cursor: pointer; -} - -th + th { - padding-left: 5em; -} - -table.sortable th:not(.sorttable_sorted):not(.sorttable_sorted_reverse):after { - content: " \25B4\25BE"; -} diff --git a/htdocs/site/css/demo.css b/htdocs/site/css/demo.css deleted file mode 100644 index 4a69f766e..000000000 --- a/htdocs/site/css/demo.css +++ /dev/null @@ -1,77 +0,0 @@ -/* Source Code */ -.geshicode { - padding: 0.5em; - background: #f7f7f7; - border: 1px solid #e2e2e2; -} - -/* Results table */ -#resultsTable { - border-collapse: collapse; -} - -#resultsTable th { - padding: 0.25em; - text-align: left; - background: #e2e2e2; - border: 1px solid #e2e2e2; -} - -#resultsTable td { - padding: 0.25em; - background: #f7f7f7; - border: 1px solid #e2e2e2; -} - -#resultsTable .center { - text-align: center; -} - -/* Max characters */ -.maxChars { - margin-left: 2em; - color: #888; - font-size: smaller; - font-style: italic; -} - -/** - * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann - * (http://qbnz.com/highlighter/ and http://geshi.org/) - */ -.cpp.geshicode .de1, .cpp.geshicode .de2 {font:normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;} -.cpp.geshicode {font-family:monospace;} -.cpp.geshicode .imp {font-weight:bold; color:red;} -.cpp.geshicode li, .cpp.geshicode .li1 {font-weight:normal; vertical-align:top;} -.cpp.geshicode .ln {width:1px; text-align:right; margin:0; padding:0 2px; vertical-align:top; color:#999999;} -.cpp.geshicode .kw1 {color:#0000ff;} -.cpp.geshicode .kw2 {color:#0000ff;} -.cpp.geshicode .kw3 {color:#0000dd;} -.cpp.geshicode .kw4 {color:#0000ff;} -.cpp.geshicode .co1 {color:#666666;} -.cpp.geshicode .co2 {color:#339900;} -.cpp.geshicode .coMULTI {color:#ff0000; font-style:italic;} -.cpp.geshicode .es0 {color:#000099; font-weight:bold;} -.cpp.geshicode .es1 {color:#000099; font-weight:bold;} -.cpp.geshicode .es2 {color:#660099; font-weight:bold;} -.cpp.geshicode .es3 {color:#660099; font-weight:bold;} -.cpp.geshicode .es4 {color:#660099; font-weight:bold;} -.cpp.geshicode .es5 {color:#006699; font-weight:bold;} -.cpp.geshicode .br0 {color:#008000;} -.cpp.geshicode .sy0 {color:#008000;} -.cpp.geshicode .sy1 {color:#000080;} -.cpp.geshicode .sy2 {color:#000040;} -.cpp.geshicode .sy3 {color:#000040;} -.cpp.geshicode .sy4 {color:#008080;} -.cpp.geshicode .st0 {color:#ff0000;} -.cpp.geshicode .nu0 {color:#0000dd;} -.cpp.geshicode .nu6 {color:#208080;} -.cpp.geshicode .nu8 {color:#208080;} -.cpp.geshicode .nu12 {color:#208080;} -.cpp.geshicode .nu16 {color:#800080;} -.cpp.geshicode .nu17 {color:#800080;} -.cpp.geshicode .nu18 {color:#800080;} -.cpp.geshicode .nu19 {color:#800080;} -.cpp.geshicode .me1 {color:#007788;} -.cpp.geshicode .me2 {color:#007788;} -.cpp.geshicode span.xtra {display:block;} diff --git a/htdocs/site/css/normalize.css b/htdocs/site/css/normalize.css deleted file mode 100644 index bb96bc339..000000000 --- a/htdocs/site/css/normalize.css +++ /dev/null @@ -1,423 +0,0 @@ -/*! normalize.css v3.0.0 | MIT License | git.io/normalize */ - -/** - * 1. Set default font family to sans-serif. - * 2. Prevent iOS text size adjust after orientation change, without disabling - * user zoom. - */ - -html { - font-family: sans-serif; /* 1 */ - -ms-text-size-adjust: 100%; /* 2 */ - -webkit-text-size-adjust: 100%; /* 2 */ -} - -/** - * Remove default margin. - */ - -body { - margin: 0; -} - -/* HTML5 display definitions - ========================================================================== */ - -/** - * Correct `block` display not defined in IE 8/9. - */ - -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -main, -nav, -section, -summary { - display: block; -} - -/** - * 1. Correct `inline-block` display not defined in IE 8/9. - * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. - */ - -audio, -canvas, -progress, -video { - display: inline-block; /* 1 */ - vertical-align: baseline; /* 2 */ -} - -/** - * Prevent modern browsers from displaying `audio` without controls. - * Remove excess height in iOS 5 devices. - */ - -audio:not([controls]) { - display: none; - height: 0; -} - -/** - * Address `[hidden]` styling not present in IE 8/9. - * Hide the `template` element in IE, Safari, and Firefox < 22. - */ - -[hidden], -template { - display: none; -} - -/* Links - ========================================================================== */ - -/** - * Remove the gray background color from active links in IE 10. - */ - -a { - background: transparent; -} - -/** - * Improve readability when focused and also mouse hovered in all browsers. - */ - -a:active, -a:hover { - outline: 0; -} - -/* Text-level semantics - ========================================================================== */ - -/** - * Address styling not present in IE 8/9, Safari 5, and Chrome. - */ - -abbr[title] { - border-bottom: 1px dotted; -} - -/** - * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome. - */ - -b, -strong { - font-weight: bold; -} - -/** - * Address styling not present in Safari 5 and Chrome. - */ - -dfn { - font-style: italic; -} - -/** - * Address variable `h1` font-size and margin within `section` and `article` - * contexts in Firefox 4+, Safari 5, and Chrome. - */ - -h1 { - font-size: 2em; - margin: 0.67em 0; -} - -/** - * Address styling not present in IE 8/9. - */ - -mark { - background: #ff0; - color: #000; -} - -/** - * Address inconsistent and variable font size in all browsers. - */ - -small { - font-size: 80%; -} - -/** - * Prevent `sub` and `sup` affecting `line-height` in all browsers. - */ - -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sup { - top: -0.5em; -} - -sub { - bottom: -0.25em; -} - -/* Embedded content - ========================================================================== */ - -/** - * Remove border when inside `a` element in IE 8/9. - */ - -img { - border: 0; -} - -/** - * Correct overflow displayed oddly in IE 9. - */ - -svg:not(:root) { - overflow: hidden; -} - -/* Grouping content - ========================================================================== */ - -/** - * Address margin not present in IE 8/9 and Safari 5. - */ - -figure { - margin: 1em 40px; -} - -/** - * Address differences between Firefox and other browsers. - */ - -hr { - -moz-box-sizing: content-box; - box-sizing: content-box; - height: 0; -} - -/** - * Contain overflow in all browsers. - */ - -pre { - overflow: auto; -} - -/** - * Address odd `em`-unit font size rendering in all browsers. - */ - -code, -kbd, -pre, -samp { - font-family: monospace, monospace; - font-size: 1em; -} - -/* Forms - ========================================================================== */ - -/** - * Known limitation: by default, Chrome and Safari on OS X allow very limited - * styling of `select`, unless a `border` property is set. - */ - -/** - * 1. Correct color not being inherited. - * Known issue: affects color of disabled elements. - * 2. Correct font properties not being inherited. - * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome. - */ - -button, -input, -optgroup, -select, -textarea { - color: inherit; /* 1 */ - font: inherit; /* 2 */ - margin: 0; /* 3 */ -} - -/** - * Address `overflow` set to `hidden` in IE 8/9/10. - */ - -button { - overflow: visible; -} - -/** - * Address inconsistent `text-transform` inheritance for `button` and `select`. - * All other form control elements do not inherit `text-transform` values. - * Correct `button` style inheritance in Firefox, IE 8+, and Opera - * Correct `select` style inheritance in Firefox. - */ - -button, -select { - text-transform: none; -} - -/** - * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` - * and `video` controls. - * 2. Correct inability to style clickable `input` types in iOS. - * 3. Improve usability and consistency of cursor style between image-type - * `input` and others. - */ - -button, -html input[type="button"], /* 1 */ -input[type="reset"], -input[type="submit"] { - -webkit-appearance: button; /* 2 */ - cursor: pointer; /* 3 */ -} - -/** - * Re-set default cursor for disabled elements. - */ - -button[disabled], -html input[disabled] { - cursor: default; -} - -/** - * Remove inner padding and border in Firefox 4+. - */ - -button::-moz-focus-inner, -input::-moz-focus-inner { - border: 0; - padding: 0; -} - -/** - * Address Firefox 4+ setting `line-height` on `input` using `!important` in - * the UA stylesheet. - */ - -input { - line-height: normal; -} - -/** - * It's recommended that you don't attempt to style these elements. - * Firefox's implementation doesn't respect box-sizing, padding, or width. - * - * 1. Address box sizing set to `content-box` in IE 8/9/10. - * 2. Remove excess padding in IE 8/9/10. - */ - -input[type="checkbox"], -input[type="radio"] { - box-sizing: border-box; /* 1 */ - padding: 0; /* 2 */ -} - -/** - * Fix the cursor style for Chrome's increment/decrement buttons. For certain - * `font-size` values of the `input`, it causes the cursor style of the - * decrement button to change from `default` to `text`. - */ - -input[type="number"]::-webkit-inner-spin-button, -input[type="number"]::-webkit-outer-spin-button { - height: auto; -} - -/** - * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome. - * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome - * (include `-moz` to future-proof). - */ - -input[type="search"] { - -webkit-appearance: textfield; /* 1 */ - -moz-box-sizing: content-box; - -webkit-box-sizing: content-box; /* 2 */ - box-sizing: content-box; -} - -/** - * Remove inner padding and search cancel button in Safari and Chrome on OS X. - * Safari (but not Chrome) clips the cancel button when the search input has - * padding (and `textfield` appearance). - */ - -input[type="search"]::-webkit-search-cancel-button, -input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} - -/** - * Define consistent border, margin, and padding. - */ - -fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; -} - -/** - * 1. Correct `color` not being inherited in IE 8/9. - * 2. Remove padding so people aren't caught out if they zero out fieldsets. - */ - -legend { - border: 0; /* 1 */ - padding: 0; /* 2 */ -} - -/** - * Remove default vertical scrollbar in IE 8/9. - */ - -textarea { - overflow: auto; -} - -/** - * Don't inherit the `font-weight` (applied by a rule above). - * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. - */ - -optgroup { - font-weight: bold; -} - -/* Tables - ========================================================================== */ - -/** - * Remove most spacing between table cells. - */ - -table { - border-collapse: collapse; - border-spacing: 0; -} - -td, -th { - padding: 0; -} diff --git a/htdocs/site/css/pack.css b/htdocs/site/css/pack.css deleted file mode 100644 index 81e5c98db..000000000 --- a/htdocs/site/css/pack.css +++ /dev/null @@ -1 +0,0 @@ -html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:0 0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}body{padding:0;font:16px Calibri,Verdana,sans-serif;color:#000;background-color:#eee}dt{font-weight:700}a:hover{-webkit-transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}a:link,a:visited{color:#036;text-decoration:underline}a:active,a:focus,a:hover,a:visited{color:#369}#header{color:#69c;background-color:#036}#header a{color:inherit;text-decoration:none}#header h1{margin:0;padding:0;font-family:Orbitron}#header p{margin:0;padding:0;font-size:larger}#tabs{color:#eee;background-color:#369;border-top:1px solid #000;border-bottom:1px solid #000}#tabs ul{margin:0;padding:0;list-style-type:none;font-size:larger}#tabs li{display:inline;padding:0 .5em;border-right:1px solid #000}#tabs li:first-child{padding-left:0}#tabs li:last-child{border:none}#tabs a:link,#tabs a:visited{color:#eee;text-decoration:none}#tabs a:active,#tabs a:focus,#tabs a:hover{color:#fff;text-decoration:underline}#anchors ul{margin:0;padding:.5em 0;list-style-type:none;font-size:smaller}#anchors li{display:inline;padding:0 .5em}#anchors li:first-child{padding-left:0}#anchors .wrap{padding:0}.wrap{width:50em;margin:0 auto;padding:.5em;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.rssfeeditems em{margin-left:.5em;color:#888;font-size:smaller}a.author:active,a.author:focus,a.author:link,a.author:link:hover,a.author:visited,a.author:visited:hover{color:#888}a.downloadnow{display:block;width:12em;margin:0;padding:5px;text-align:center;text-decoration:none;color:#fff;background-color:#060;border:1px solid #003D00;-webkit-border-radius:.5em;-khtml-border-radius:.5em;-moz-border-radius:.5em;border-radius:.5em;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}a.downloadnow:focus,a.downloadnow:hover{background-color:#090}.downButtonText{display:block;font-size:larger;font-weight:700}.downButtonVersion{display:block;font-size:smaller}.cmd{padding:.5em;background-color:#f7f7f7;border:1px solid silver;border-left:10px solid silver}@media print{#header{color:#000;border-bottom:1px solid #000}#tabs{display:none}#resultsTable td,#resultsTable th{background-color:#fff;border:1px solid #000}}.geshicode{padding:.5em;background:#f7f7f7;border:1px solid #e2e2e2}#resultsTable{border-collapse:collapse}#resultsTable th{padding:.25em;text-align:left;background:#e2e2e2;border:1px solid #e2e2e2}#resultsTable td{padding:.25em;background:#f7f7f7;border:1px solid #e2e2e2}#resultsTable .center{text-align:center}.maxChars{margin-left:2em;color:#888;font-size:smaller;font-style:italic}.cpp.geshicode .de1,.cpp.geshicode .de2{font:normal normal 1em/1.2em monospace;margin:0;padding:0;background:0 0;vertical-align:top}.cpp.geshicode{font-family:monospace}.cpp.geshicode .imp{font-weight:700;color:red}.cpp.geshicode .li1,.cpp.geshicode li{font-weight:400;vertical-align:top}.cpp.geshicode .ln{width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;color:#999}.cpp.geshicode .kw1,.cpp.geshicode .kw2{color:#00f}.cpp.geshicode .kw3{color:#00d}.cpp.geshicode .kw4{color:#00f}.cpp.geshicode .co1{color:#666}.cpp.geshicode .co2{color:#390}.cpp.geshicode .coMULTI{color:red;font-style:italic}.cpp.geshicode .es0,.cpp.geshicode .es1{color:#009;font-weight:700}.cpp.geshicode .es2,.cpp.geshicode .es3,.cpp.geshicode .es4{color:#609;font-weight:700}.cpp.geshicode .es5{color:#069;font-weight:700}.cpp.geshicode .br0,.cpp.geshicode .sy0{color:green}.cpp.geshicode .sy1{color:navy}.cpp.geshicode .sy2,.cpp.geshicode .sy3{color:#000040}.cpp.geshicode .sy4{color:teal}.cpp.geshicode .st0{color:red}.cpp.geshicode .nu0{color:#00d}.cpp.geshicode .nu12,.cpp.geshicode .nu6,.cpp.geshicode .nu8{color:#208080}.cpp.geshicode .nu16,.cpp.geshicode .nu17,.cpp.geshicode .nu18,.cpp.geshicode .nu19{color:purple}.cpp.geshicode .me1,.cpp.geshicode .me2{color:#078}.cpp.geshicode span.xtra{display:block} \ No newline at end of file diff --git a/htdocs/site/geshi/geshi.php b/htdocs/site/geshi/geshi.php deleted file mode 100644 index c6ff9ef77..000000000 --- a/htdocs/site/geshi/geshi.php +++ /dev/null @@ -1,4775 +0,0 @@ -, Benny Baumann - * @copyright (C) 2004 - 2007 Nigel McNie, (C) 2007 - 2008 Benny Baumann - * @license http://gnu.org/copyleft/gpl.html GNU GPL - * - */ - -// -// GeSHi Constants -// You should use these constant names in your programs instead of -// their values - you never know when a value may change in a future -// version -// - -/** The version of this GeSHi file */ -define('GESHI_VERSION', '1.0.8.11'); - -// Define the root directory for the GeSHi code tree -if (!defined('GESHI_ROOT')) { - /** The root directory for GeSHi */ - define('GESHI_ROOT', dirname(__FILE__) . DIRECTORY_SEPARATOR); -} -/** The language file directory for GeSHi - @access private */ -define('GESHI_LANG_ROOT', GESHI_ROOT . 'geshi' . DIRECTORY_SEPARATOR); - -// Define if GeSHi should be paranoid about security -if (!defined('GESHI_SECURITY_PARANOID')) { - /** Tells GeSHi to be paranoid about security settings */ - define('GESHI_SECURITY_PARANOID', false); -} - -// Line numbers - use with enable_line_numbers() -/** Use no line numbers when building the result */ -define('GESHI_NO_LINE_NUMBERS', 0); -/** Use normal line numbers when building the result */ -define('GESHI_NORMAL_LINE_NUMBERS', 1); -/** Use fancy line numbers when building the result */ -define('GESHI_FANCY_LINE_NUMBERS', 2); - -// Container HTML type -/** Use nothing to surround the source */ -define('GESHI_HEADER_NONE', 0); -/** Use a "div" to surround the source */ -define('GESHI_HEADER_DIV', 1); -/** Use a "pre" to surround the source */ -define('GESHI_HEADER_PRE', 2); -/** Use a pre to wrap lines when line numbers are enabled or to wrap the whole code. */ -define('GESHI_HEADER_PRE_VALID', 3); -/** - * Use a "table" to surround the source: - * - * - * - * - * - *
    $header
    $linenumbers
    $code>
    $footer
    - * - * this is essentially only a workaround for Firefox, see sf#1651996 or take a look at - * https://bugzilla.mozilla.org/show_bug.cgi?id=365805 - * @note when linenumbers are disabled this is essentially the same as GESHI_HEADER_PRE - */ -define('GESHI_HEADER_PRE_TABLE', 4); - -// Capatalisation constants -/** Lowercase keywords found */ -define('GESHI_CAPS_NO_CHANGE', 0); -/** Uppercase keywords found */ -define('GESHI_CAPS_UPPER', 1); -/** Leave keywords found as the case that they are */ -define('GESHI_CAPS_LOWER', 2); - -// Link style constants -/** Links in the source in the :link state */ -define('GESHI_LINK', 0); -/** Links in the source in the :hover state */ -define('GESHI_HOVER', 1); -/** Links in the source in the :active state */ -define('GESHI_ACTIVE', 2); -/** Links in the source in the :visited state */ -define('GESHI_VISITED', 3); - -// Important string starter/finisher -// Note that if you change these, they should be as-is: i.e., don't -// write them as if they had been run through htmlentities() -/** The starter for important parts of the source */ -define('GESHI_START_IMPORTANT', ''); -/** The ender for important parts of the source */ -define('GESHI_END_IMPORTANT', ''); - -/**#@+ - * @access private - */ -// When strict mode applies for a language -/** Strict mode never applies (this is the most common) */ -define('GESHI_NEVER', 0); -/** Strict mode *might* apply, and can be enabled or - disabled by {@link GeSHi->enable_strict_mode()} */ -define('GESHI_MAYBE', 1); -/** Strict mode always applies */ -define('GESHI_ALWAYS', 2); - -// Advanced regexp handling constants, used in language files -/** The key of the regex array defining what to search for */ -define('GESHI_SEARCH', 0); -/** The key of the regex array defining what bracket group in a - matched search to use as a replacement */ -define('GESHI_REPLACE', 1); -/** The key of the regex array defining any modifiers to the regular expression */ -define('GESHI_MODIFIERS', 2); -/** The key of the regex array defining what bracket group in a - matched search to put before the replacement */ -define('GESHI_BEFORE', 3); -/** The key of the regex array defining what bracket group in a - matched search to put after the replacement */ -define('GESHI_AFTER', 4); -/** The key of the regex array defining a custom keyword to use - for this regexp's html tag class */ -define('GESHI_CLASS', 5); - -/** Used in language files to mark comments */ -define('GESHI_COMMENTS', 0); - -/** Used to work around missing PHP features **/ -define('GESHI_PHP_PRE_433', !(version_compare(PHP_VERSION, '4.3.3') === 1)); - -/** make sure we can call stripos **/ -if (!function_exists('stripos')) { - // the offset param of preg_match is not supported below PHP 4.3.3 - if (GESHI_PHP_PRE_433) { - /** - * @ignore - */ - function stripos($haystack, $needle, $offset = null) { - if (!is_null($offset)) { - $haystack = substr($haystack, $offset); - } - if (preg_match('/'. preg_quote($needle, '/') . '/', $haystack, $match, PREG_OFFSET_CAPTURE)) { - return $match[0][1]; - } - return false; - } - } - else { - /** - * @ignore - */ - function stripos($haystack, $needle, $offset = null) { - if (preg_match('/'. preg_quote($needle, '/') . '/', $haystack, $match, PREG_OFFSET_CAPTURE, $offset)) { - return $match[0][1]; - } - return false; - } - } -} - -/** some old PHP / PCRE subpatterns only support up to xxx subpatterns in - regular expressions. Set this to false if your PCRE lib is up to date - @see GeSHi->optimize_regexp_list() - **/ -define('GESHI_MAX_PCRE_SUBPATTERNS', 500); -/** it's also important not to generate too long regular expressions - be generous here... but keep in mind, that when reaching this limit we - still have to close open patterns. 12k should do just fine on a 16k limit. - @see GeSHi->optimize_regexp_list() - **/ -define('GESHI_MAX_PCRE_LENGTH', 12288); - -//Number format specification -/** Basic number format for integers */ -define('GESHI_NUMBER_INT_BASIC', 1); //Default integers \d+ -/** Enhanced number format for integers like seen in C */ -define('GESHI_NUMBER_INT_CSTYLE', 2); //Default C-Style \d+[lL]? -/** Number format to highlight binary numbers with a suffix "b" */ -define('GESHI_NUMBER_BIN_SUFFIX', 16); //[01]+[bB] -/** Number format to highlight binary numbers with a prefix % */ -define('GESHI_NUMBER_BIN_PREFIX_PERCENT', 32); //%[01]+ -/** Number format to highlight binary numbers with a prefix 0b (C) */ -define('GESHI_NUMBER_BIN_PREFIX_0B', 64); //0b[01]+ -/** Number format to highlight octal numbers with a leading zero */ -define('GESHI_NUMBER_OCT_PREFIX', 256); //0[0-7]+ -/** Number format to highlight octal numbers with a prefix 0o (logtalk) */ -define('GESHI_NUMBER_OCT_PREFIX_0O', 512); //0[0-7]+ -/** Number format to highlight octal numbers with a leading @ (Used in HiSofts Devpac series). */ -define('GESHI_NUMBER_OCT_PREFIX_AT', 1024); //@[0-7]+ -/** Number format to highlight octal numbers with a suffix of o */ -define('GESHI_NUMBER_OCT_SUFFIX', 2048); //[0-7]+[oO] -/** Number format to highlight hex numbers with a prefix 0x */ -define('GESHI_NUMBER_HEX_PREFIX', 4096); //0x[0-9a-fA-F]+ -/** Number format to highlight hex numbers with a prefix $ */ -define('GESHI_NUMBER_HEX_PREFIX_DOLLAR', 8192); //$[0-9a-fA-F]+ -/** Number format to highlight hex numbers with a suffix of h */ -define('GESHI_NUMBER_HEX_SUFFIX', 16384); //[0-9][0-9a-fA-F]*h -/** Number format to highlight floating-point numbers without support for scientific notation */ -define('GESHI_NUMBER_FLT_NONSCI', 65536); //\d+\.\d+ -/** Number format to highlight floating-point numbers without support for scientific notation */ -define('GESHI_NUMBER_FLT_NONSCI_F', 131072); //\d+(\.\d+)?f -/** Number format to highlight floating-point numbers with support for scientific notation (E) and optional leading zero */ -define('GESHI_NUMBER_FLT_SCI_SHORT', 262144); //\.\d+e\d+ -/** Number format to highlight floating-point numbers with support for scientific notation (E) and required leading digit */ -define('GESHI_NUMBER_FLT_SCI_ZERO', 524288); //\d+(\.\d+)?e\d+ -//Custom formats are passed by RX array - -// Error detection - use these to analyse faults -/** No sourcecode to highlight was specified - * @deprecated - */ -define('GESHI_ERROR_NO_INPUT', 1); -/** The language specified does not exist */ -define('GESHI_ERROR_NO_SUCH_LANG', 2); -/** GeSHi could not open a file for reading (generally a language file) */ -define('GESHI_ERROR_FILE_NOT_READABLE', 3); -/** The header type passed to {@link GeSHi->set_header_type()} was invalid */ -define('GESHI_ERROR_INVALID_HEADER_TYPE', 4); -/** The line number type passed to {@link GeSHi->enable_line_numbers()} was invalid */ -define('GESHI_ERROR_INVALID_LINE_NUMBER_TYPE', 5); -/**#@-*/ - - -/** - * The GeSHi Class. - * - * Please refer to the documentation for GeSHi 1.0.X that is available - * at http://qbnz.com/highlighter/documentation.php for more information - * about how to use this class. - * - * @package geshi - * @author Nigel McNie , Benny Baumann - * @copyright (C) 2004 - 2007 Nigel McNie, (C) 2007 - 2008 Benny Baumann - */ -class GeSHi { - /**#@+ - * @access private - */ - /** - * The source code to highlight - * @var string - */ - var $source = ''; - - /** - * The language to use when highlighting - * @var string - */ - var $language = ''; - - /** - * The data for the language used - * @var array - */ - var $language_data = array(); - - /** - * The path to the language files - * @var string - */ - var $language_path = GESHI_LANG_ROOT; - - /** - * The error message associated with an error - * @var string - * @todo check err reporting works - */ - var $error = false; - - /** - * Possible error messages - * @var array - */ - var $error_messages = array( - GESHI_ERROR_NO_SUCH_LANG => 'GeSHi could not find the language {LANGUAGE} (using path {PATH})', - GESHI_ERROR_FILE_NOT_READABLE => 'The file specified for load_from_file was not readable', - GESHI_ERROR_INVALID_HEADER_TYPE => 'The header type specified is invalid', - GESHI_ERROR_INVALID_LINE_NUMBER_TYPE => 'The line number type specified is invalid' - ); - - /** - * Whether highlighting is strict or not - * @var boolean - */ - var $strict_mode = false; - - /** - * Whether to use CSS classes in output - * @var boolean - */ - var $use_classes = false; - - /** - * The type of header to use. Can be one of the following - * values: - * - * - GESHI_HEADER_PRE: Source is outputted in a "pre" HTML element. - * - GESHI_HEADER_DIV: Source is outputted in a "div" HTML element. - * - GESHI_HEADER_NONE: No header is outputted. - * - * @var int - */ - var $header_type = GESHI_HEADER_PRE; - - /** - * Array of permissions for which lexics should be highlighted - * @var array - */ - var $lexic_permissions = array( - 'KEYWORDS' => array(), - 'COMMENTS' => array('MULTI' => true), - 'REGEXPS' => array(), - 'ESCAPE_CHAR' => true, - 'BRACKETS' => true, - 'SYMBOLS' => false, - 'STRINGS' => true, - 'NUMBERS' => true, - 'METHODS' => true, - 'SCRIPT' => true - ); - - /** - * The time it took to parse the code - * @var double - */ - var $time = 0; - - /** - * The content of the header block - * @var string - */ - var $header_content = ''; - - /** - * The content of the footer block - * @var string - */ - var $footer_content = ''; - - /** - * The style of the header block - * @var string - */ - var $header_content_style = ''; - - /** - * The style of the footer block - * @var string - */ - var $footer_content_style = ''; - - /** - * Tells if a block around the highlighted source should be forced - * if not using line numbering - * @var boolean - */ - var $force_code_block = false; - - /** - * The styles for hyperlinks in the code - * @var array - */ - var $link_styles = array(); - - /** - * Whether important blocks should be recognised or not - * @var boolean - * @deprecated - * @todo REMOVE THIS FUNCTIONALITY! - */ - var $enable_important_blocks = false; - - /** - * Styles for important parts of the code - * @var string - * @deprecated - * @todo As above - rethink the whole idea of important blocks as it is buggy and - * will be hard to implement in 1.2 - */ - var $important_styles = 'font-weight: bold; color: red;'; // Styles for important parts of the code - - /** - * Whether CSS IDs should be added to the code - * @var boolean - */ - var $add_ids = false; - - /** - * Lines that should be highlighted extra - * @var array - */ - var $highlight_extra_lines = array(); - - /** - * Styles of lines that should be highlighted extra - * @var array - */ - var $highlight_extra_lines_styles = array(); - - /** - * Styles of extra-highlighted lines - * @var string - */ - var $highlight_extra_lines_style = 'background-color: #ffc;'; - - /** - * The line ending - * If null, nl2br() will be used on the result string. - * Otherwise, all instances of \n will be replaced with $line_ending - * @var string - */ - var $line_ending = null; - - /** - * Number at which line numbers should start at - * @var int - */ - var $line_numbers_start = 1; - - /** - * The overall style for this code block - * @var string - */ - var $overall_style = 'font-family:monospace;'; - - /** - * The style for the actual code - * @var string - */ - var $code_style = 'font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;'; - - /** - * The overall class for this code block - * @var string - */ - var $overall_class = ''; - - /** - * The overall ID for this code block - * @var string - */ - var $overall_id = ''; - - /** - * Line number styles - * @var string - */ - var $line_style1 = 'font-weight: normal; vertical-align:top;'; - - /** - * Line number styles for fancy lines - * @var string - */ - var $line_style2 = 'font-weight: bold; vertical-align:top;'; - - /** - * Style for line numbers when GESHI_HEADER_PRE_TABLE is chosen - * @var string - */ - var $table_linenumber_style = 'width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;'; - - /** - * Flag for how line numbers are displayed - * @var boolean - */ - var $line_numbers = GESHI_NO_LINE_NUMBERS; - - /** - * Flag to decide if multi line spans are allowed. Set it to false to make sure - * each tag is closed before and reopened after each linefeed. - * @var boolean - */ - var $allow_multiline_span = true; - - /** - * The "nth" value for fancy line highlighting - * @var int - */ - var $line_nth_row = 0; - - /** - * The size of tab stops - * @var int - */ - var $tab_width = 8; - - /** - * Should we use language-defined tab stop widths? - * @var int - */ - var $use_language_tab_width = false; - - /** - * Default target for keyword links - * @var string - */ - var $link_target = ''; - - /** - * The encoding to use for entity encoding - * NOTE: Used with Escape Char Sequences to fix UTF-8 handling (cf. SF#2037598) - * @var string - */ - var $encoding = 'utf-8'; - - /** - * Should keywords be linked? - * @var boolean - */ - var $keyword_links = true; - - /** - * Currently loaded language file - * @var string - * @since 1.0.7.22 - */ - var $loaded_language = ''; - - /** - * Wether the caches needed for parsing are built or not - * - * @var bool - * @since 1.0.8 - */ - var $parse_cache_built = false; - - /** - * Work around for Suhosin Patch with disabled /e modifier - * - * Note from suhosins author in config file: - *
    - * The /e modifier inside preg_replace() allows code execution. - * Often it is the cause for remote code execution exploits. It is wise to - * deactivate this feature and test where in the application it is used. - * The developer using the /e modifier should be made aware that he should - * use preg_replace_callback() instead - *
    - * - * @var array - * @since 1.0.8 - */ - var $_kw_replace_group = 0; - var $_rx_key = 0; - - /** - * some "callback parameters" for handle_multiline_regexps - * - * @since 1.0.8 - * @access private - * @var string - */ - var $_hmr_before = ''; - var $_hmr_replace = ''; - var $_hmr_after = ''; - var $_hmr_key = 0; - - /**#@-*/ - - /** - * Creates a new GeSHi object, with source and language - * - * @param string The source code to highlight - * @param string The language to highlight the source with - * @param string The path to the language file directory. This - * is deprecated! I've backported the auto path - * detection from the 1.1.X dev branch, so now it - * should be automatically set correctly. If you have - * renamed the language directory however, you will - * still need to set the path using this parameter or - * {@link GeSHi->set_language_path()} - * @since 1.0.0 - */ - function GeSHi($source = '', $language = '', $path = '') { - if (!empty($source)) { - $this->set_source($source); - } - if (!empty($language)) { - $this->set_language($language); - } - $this->set_language_path($path); - } - - /** - * Returns the version of GeSHi - * - * @return string - * @since 1 0.8.11 - */ - function get_version() - { - return GESHI_VERSION; - } - - /** - * Returns an error message associated with the last GeSHi operation, - * or false if no error has occured - * - * @return string|false An error message if there has been an error, else false - * @since 1.0.0 - */ - function error() { - if ($this->error) { - //Put some template variables for debugging here ... - $debug_tpl_vars = array( - '{LANGUAGE}' => $this->language, - '{PATH}' => $this->language_path - ); - $msg = str_replace( - array_keys($debug_tpl_vars), - array_values($debug_tpl_vars), - $this->error_messages[$this->error]); - - return "
    GeSHi Error: $msg (code {$this->error})
    "; - } - return false; - } - - /** - * Gets a human-readable language name (thanks to Simon Patterson - * for the idea :)) - * - * @return string The name for the current language - * @since 1.0.2 - */ - function get_language_name() { - if (GESHI_ERROR_NO_SUCH_LANG == $this->error) { - return $this->language_data['LANG_NAME'] . ' (Unknown Language)'; - } - return $this->language_data['LANG_NAME']; - } - - /** - * Sets the source code for this object - * - * @param string The source code to highlight - * @since 1.0.0 - */ - function set_source($source) { - $this->source = $source; - $this->highlight_extra_lines = array(); - } - - /** - * Sets the language for this object - * - * @note since 1.0.8 this function won't reset language-settings by default anymore! - * if you need this set $force_reset = true - * - * @param string The name of the language to use - * @since 1.0.0 - */ - function set_language($language, $force_reset = false) { - if ($force_reset) { - $this->loaded_language = false; - } - - //Clean up the language name to prevent malicious code injection - $language = preg_replace('#[^a-zA-Z0-9\-_]#', '', $language); - - $language = strtolower($language); - - //Retreive the full filename - $file_name = $this->language_path . $language . '.php'; - if ($file_name == $this->loaded_language) { - // this language is already loaded! - return; - } - - $this->language = $language; - - $this->error = false; - $this->strict_mode = GESHI_NEVER; - - //Check if we can read the desired file - if (!is_readable($file_name)) { - $this->error = GESHI_ERROR_NO_SUCH_LANG; - return; - } - - // Load the language for parsing - $this->load_language($file_name); - } - - /** - * Sets the path to the directory containing the language files. Note - * that this path is relative to the directory of the script that included - * geshi.php, NOT geshi.php itself. - * - * @param string The path to the language directory - * @since 1.0.0 - * @deprecated The path to the language files should now be automatically - * detected, so this method should no longer be needed. The - * 1.1.X branch handles manual setting of the path differently - * so this method will disappear in 1.2.0. - */ - function set_language_path($path) { - if(strpos($path,':')) { - //Security Fix to prevent external directories using fopen wrappers. - if(DIRECTORY_SEPARATOR == "\\") { - if(!preg_match('#^[a-zA-Z]:#', $path) || false !== strpos($path, ':', 2)) { - return; - } - } else { - return; - } - } - if(preg_match('#[^/a-zA-Z0-9_\.\-\\\s:]#', $path)) { - //Security Fix to prevent external directories using fopen wrappers. - return; - } - if(GESHI_SECURITY_PARANOID && false !== strpos($path, '/.')) { - //Security Fix to prevent external directories using fopen wrappers. - return; - } - if(GESHI_SECURITY_PARANOID && false !== strpos($path, '..')) { - //Security Fix to prevent external directories using fopen wrappers. - return; - } - if ($path) { - $this->language_path = ('/' == $path[strlen($path) - 1]) ? $path : $path . '/'; - $this->set_language($this->language); // otherwise set_language_path has no effect - } - } - - /** - * Get supported langs or an associative array lang=>full_name. - * @param boolean $longnames - * @return array - */ - function get_supported_languages($full_names=false) - { - // return array - $back = array(); - - // we walk the lang root - $dir = dir($this->language_path); - - // foreach entry - while (false !== ($entry = $dir->read())) - { - $full_path = $this->language_path.$entry; - - // Skip all dirs - if (is_dir($full_path)) { - continue; - } - - // we only want lang.php files - if (!preg_match('/^([^.]+)\.php$/', $entry, $matches)) { - continue; - } - - // Raw lang name is here - $langname = $matches[1]; - - // We want the fullname too? - if ($full_names === true) - { - if (false !== ($fullname = $this->get_language_fullname($langname))) - { - $back[$langname] = $fullname; // we go associative - } - } - else - { - // just store raw langname - $back[] = $langname; - } - } - - $dir->close(); - - return $back; - } - - /** - * Get full_name for a lang or false. - * @param string $language short langname (html4strict for example) - * @return mixed - */ - function get_language_fullname($language) - { - //Clean up the language name to prevent malicious code injection - $language = preg_replace('#[^a-zA-Z0-9\-_]#', '', $language); - - $language = strtolower($language); - - // get fullpath-filename for a langname - $fullpath = $this->language_path.$language.'.php'; - - // we need to get contents :S - if (false === ($data = file_get_contents($fullpath))) { - $this->error = sprintf('Geshi::get_lang_fullname() Unknown Language: %s', $language); - return false; - } - - // match the langname - if (!preg_match('/\'LANG_NAME\'\s*=>\s*\'((?:[^\']|\\\')+?)\'/', $data, $matches)) { - $this->error = sprintf('Geshi::get_lang_fullname(%s): Regex can not detect language', $language); - return false; - } - - // return fullname for langname - return stripcslashes($matches[1]); - } - - /** - * Sets the type of header to be used. - * - * If GESHI_HEADER_DIV is used, the code is surrounded in a "div".This - * means more source code but more control over tab width and line-wrapping. - * GESHI_HEADER_PRE means that a "pre" is used - less source, but less - * control. Default is GESHI_HEADER_PRE. - * - * From 1.0.7.2, you can use GESHI_HEADER_NONE to specify that no header code - * should be outputted. - * - * @param int The type of header to be used - * @since 1.0.0 - */ - function set_header_type($type) { - //Check if we got a valid header type - if (!in_array($type, array(GESHI_HEADER_NONE, GESHI_HEADER_DIV, - GESHI_HEADER_PRE, GESHI_HEADER_PRE_VALID, GESHI_HEADER_PRE_TABLE))) { - $this->error = GESHI_ERROR_INVALID_HEADER_TYPE; - return; - } - - //Set that new header type - $this->header_type = $type; - } - - /** - * Sets the styles for the code that will be outputted - * when this object is parsed. The style should be a - * string of valid stylesheet declarations - * - * @param string The overall style for the outputted code block - * @param boolean Whether to merge the styles with the current styles or not - * @since 1.0.0 - */ - function set_overall_style($style, $preserve_defaults = false) { - if (!$preserve_defaults) { - $this->overall_style = $style; - } else { - $this->overall_style .= $style; - } - } - - /** - * Sets the overall classname for this block of code. This - * class can then be used in a stylesheet to style this object's - * output - * - * @param string The class name to use for this block of code - * @since 1.0.0 - */ - function set_overall_class($class) { - $this->overall_class = $class; - } - - /** - * Sets the overall id for this block of code. This id can then - * be used in a stylesheet to style this object's output - * - * @param string The ID to use for this block of code - * @since 1.0.0 - */ - function set_overall_id($id) { - $this->overall_id = $id; - } - - /** - * Sets whether CSS classes should be used to highlight the source. Default - * is off, calling this method with no arguments will turn it on - * - * @param boolean Whether to turn classes on or not - * @since 1.0.0 - */ - function enable_classes($flag = true) { - $this->use_classes = ($flag) ? true : false; - } - - /** - * Sets the style for the actual code. This should be a string - * containing valid stylesheet declarations. If $preserve_defaults is - * true, then styles are merged with the default styles, with the - * user defined styles having priority - * - * Note: Use this method to override any style changes you made to - * the line numbers if you are using line numbers, else the line of - * code will have the same style as the line number! Consult the - * GeSHi documentation for more information about this. - * - * @param string The style to use for actual code - * @param boolean Whether to merge the current styles with the new styles - * @since 1.0.2 - */ - function set_code_style($style, $preserve_defaults = false) { - if (!$preserve_defaults) { - $this->code_style = $style; - } else { - $this->code_style .= $style; - } - } - - /** - * Sets the styles for the line numbers. - * - * @param string The style for the line numbers that are "normal" - * @param string|boolean If a string, this is the style of the line - * numbers that are "fancy", otherwise if boolean then this - * defines whether the normal styles should be merged with the - * new normal styles or not - * @param boolean If set, is the flag for whether to merge the "fancy" - * styles with the current styles or not - * @since 1.0.2 - */ - function set_line_style($style1, $style2 = '', $preserve_defaults = false) { - //Check if we got 2 or three parameters - if (is_bool($style2)) { - $preserve_defaults = $style2; - $style2 = ''; - } - - //Actually set the new styles - if (!$preserve_defaults) { - $this->line_style1 = $style1; - $this->line_style2 = $style2; - } else { - $this->line_style1 .= $style1; - $this->line_style2 .= $style2; - } - } - - /** - * Sets whether line numbers should be displayed. - * - * Valid values for the first parameter are: - * - * - GESHI_NO_LINE_NUMBERS: Line numbers will not be displayed - * - GESHI_NORMAL_LINE_NUMBERS: Line numbers will be displayed - * - GESHI_FANCY_LINE_NUMBERS: Fancy line numbers will be displayed - * - * For fancy line numbers, the second parameter is used to signal which lines - * are to be fancy. For example, if the value of this parameter is 5 then every - * 5th line will be fancy. - * - * @param int How line numbers should be displayed - * @param int Defines which lines are fancy - * @since 1.0.0 - */ - function enable_line_numbers($flag, $nth_row = 5) { - if (GESHI_NO_LINE_NUMBERS != $flag && GESHI_NORMAL_LINE_NUMBERS != $flag - && GESHI_FANCY_LINE_NUMBERS != $flag) { - $this->error = GESHI_ERROR_INVALID_LINE_NUMBER_TYPE; - } - $this->line_numbers = $flag; - $this->line_nth_row = $nth_row; - } - - /** - * Sets wether spans and other HTML markup generated by GeSHi can - * span over multiple lines or not. Defaults to true to reduce overhead. - * Set it to false if you want to manipulate the output or manually display - * the code in an ordered list. - * - * @param boolean Wether multiline spans are allowed or not - * @since 1.0.7.22 - */ - function enable_multiline_span($flag) { - $this->allow_multiline_span = (bool) $flag; - } - - /** - * Get current setting for multiline spans, see GeSHi->enable_multiline_span(). - * - * @see enable_multiline_span - * @return bool - */ - function get_multiline_span() { - return $this->allow_multiline_span; - } - - /** - * Sets the style for a keyword group. If $preserve_defaults is - * true, then styles are merged with the default styles, with the - * user defined styles having priority - * - * @param int The key of the keyword group to change the styles of - * @param string The style to make the keywords - * @param boolean Whether to merge the new styles with the old or just - * to overwrite them - * @since 1.0.0 - */ - function set_keyword_group_style($key, $style, $preserve_defaults = false) { - //Set the style for this keyword group - if (!$preserve_defaults) { - $this->language_data['STYLES']['KEYWORDS'][$key] = $style; - } else { - $this->language_data['STYLES']['KEYWORDS'][$key] .= $style; - } - - //Update the lexic permissions - if (!isset($this->lexic_permissions['KEYWORDS'][$key])) { - $this->lexic_permissions['KEYWORDS'][$key] = true; - } - } - - /** - * Turns highlighting on/off for a keyword group - * - * @param int The key of the keyword group to turn on or off - * @param boolean Whether to turn highlighting for that group on or off - * @since 1.0.0 - */ - function set_keyword_group_highlighting($key, $flag = true) { - $this->lexic_permissions['KEYWORDS'][$key] = ($flag) ? true : false; - } - - /** - * Sets the styles for comment groups. If $preserve_defaults is - * true, then styles are merged with the default styles, with the - * user defined styles having priority - * - * @param int The key of the comment group to change the styles of - * @param string The style to make the comments - * @param boolean Whether to merge the new styles with the old or just - * to overwrite them - * @since 1.0.0 - */ - function set_comments_style($key, $style, $preserve_defaults = false) { - if (!$preserve_defaults) { - $this->language_data['STYLES']['COMMENTS'][$key] = $style; - } else { - $this->language_data['STYLES']['COMMENTS'][$key] .= $style; - } - } - - /** - * Turns highlighting on/off for comment groups - * - * @param int The key of the comment group to turn on or off - * @param boolean Whether to turn highlighting for that group on or off - * @since 1.0.0 - */ - function set_comments_highlighting($key, $flag = true) { - $this->lexic_permissions['COMMENTS'][$key] = ($flag) ? true : false; - } - - /** - * Sets the styles for escaped characters. If $preserve_defaults is - * true, then styles are merged with the default styles, with the - * user defined styles having priority - * - * @param string The style to make the escape characters - * @param boolean Whether to merge the new styles with the old or just - * to overwrite them - * @since 1.0.0 - */ - function set_escape_characters_style($style, $preserve_defaults = false, $group = 0) { - if (!$preserve_defaults) { - $this->language_data['STYLES']['ESCAPE_CHAR'][$group] = $style; - } else { - $this->language_data['STYLES']['ESCAPE_CHAR'][$group] .= $style; - } - } - - /** - * Turns highlighting on/off for escaped characters - * - * @param boolean Whether to turn highlighting for escape characters on or off - * @since 1.0.0 - */ - function set_escape_characters_highlighting($flag = true) { - $this->lexic_permissions['ESCAPE_CHAR'] = ($flag) ? true : false; - } - - /** - * Sets the styles for brackets. If $preserve_defaults is - * true, then styles are merged with the default styles, with the - * user defined styles having priority - * - * This method is DEPRECATED: use set_symbols_style instead. - * This method will be removed in 1.2.X - * - * @param string The style to make the brackets - * @param boolean Whether to merge the new styles with the old or just - * to overwrite them - * @since 1.0.0 - * @deprecated In favour of set_symbols_style - */ - function set_brackets_style($style, $preserve_defaults = false) { - if (!$preserve_defaults) { - $this->language_data['STYLES']['BRACKETS'][0] = $style; - } else { - $this->language_data['STYLES']['BRACKETS'][0] .= $style; - } - } - - /** - * Turns highlighting on/off for brackets - * - * This method is DEPRECATED: use set_symbols_highlighting instead. - * This method will be remove in 1.2.X - * - * @param boolean Whether to turn highlighting for brackets on or off - * @since 1.0.0 - * @deprecated In favour of set_symbols_highlighting - */ - function set_brackets_highlighting($flag) { - $this->lexic_permissions['BRACKETS'] = ($flag) ? true : false; - } - - /** - * Sets the styles for symbols. If $preserve_defaults is - * true, then styles are merged with the default styles, with the - * user defined styles having priority - * - * @param string The style to make the symbols - * @param boolean Whether to merge the new styles with the old or just - * to overwrite them - * @param int Tells the group of symbols for which style should be set. - * @since 1.0.1 - */ - function set_symbols_style($style, $preserve_defaults = false, $group = 0) { - // Update the style of symbols - if (!$preserve_defaults) { - $this->language_data['STYLES']['SYMBOLS'][$group] = $style; - } else { - $this->language_data['STYLES']['SYMBOLS'][$group] .= $style; - } - - // For backward compatibility - if (0 == $group) { - $this->set_brackets_style ($style, $preserve_defaults); - } - } - - /** - * Turns highlighting on/off for symbols - * - * @param boolean Whether to turn highlighting for symbols on or off - * @since 1.0.0 - */ - function set_symbols_highlighting($flag) { - // Update lexic permissions for this symbol group - $this->lexic_permissions['SYMBOLS'] = ($flag) ? true : false; - - // For backward compatibility - $this->set_brackets_highlighting ($flag); - } - - /** - * Sets the styles for strings. If $preserve_defaults is - * true, then styles are merged with the default styles, with the - * user defined styles having priority - * - * @param string The style to make the escape characters - * @param boolean Whether to merge the new styles with the old or just - * to overwrite them - * @param int Tells the group of strings for which style should be set. - * @since 1.0.0 - */ - function set_strings_style($style, $preserve_defaults = false, $group = 0) { - if (!$preserve_defaults) { - $this->language_data['STYLES']['STRINGS'][$group] = $style; - } else { - $this->language_data['STYLES']['STRINGS'][$group] .= $style; - } - } - - /** - * Turns highlighting on/off for strings - * - * @param boolean Whether to turn highlighting for strings on or off - * @since 1.0.0 - */ - function set_strings_highlighting($flag) { - $this->lexic_permissions['STRINGS'] = ($flag) ? true : false; - } - - /** - * Sets the styles for strict code blocks. If $preserve_defaults is - * true, then styles are merged with the default styles, with the - * user defined styles having priority - * - * @param string The style to make the script blocks - * @param boolean Whether to merge the new styles with the old or just - * to overwrite them - * @param int Tells the group of script blocks for which style should be set. - * @since 1.0.8.4 - */ - function set_script_style($style, $preserve_defaults = false, $group = 0) { - // Update the style of symbols - if (!$preserve_defaults) { - $this->language_data['STYLES']['SCRIPT'][$group] = $style; - } else { - $this->language_data['STYLES']['SCRIPT'][$group] .= $style; - } - } - - /** - * Sets the styles for numbers. If $preserve_defaults is - * true, then styles are merged with the default styles, with the - * user defined styles having priority - * - * @param string The style to make the numbers - * @param boolean Whether to merge the new styles with the old or just - * to overwrite them - * @param int Tells the group of numbers for which style should be set. - * @since 1.0.0 - */ - function set_numbers_style($style, $preserve_defaults = false, $group = 0) { - if (!$preserve_defaults) { - $this->language_data['STYLES']['NUMBERS'][$group] = $style; - } else { - $this->language_data['STYLES']['NUMBERS'][$group] .= $style; - } - } - - /** - * Turns highlighting on/off for numbers - * - * @param boolean Whether to turn highlighting for numbers on or off - * @since 1.0.0 - */ - function set_numbers_highlighting($flag) { - $this->lexic_permissions['NUMBERS'] = ($flag) ? true : false; - } - - /** - * Sets the styles for methods. $key is a number that references the - * appropriate "object splitter" - see the language file for the language - * you are highlighting to get this number. If $preserve_defaults is - * true, then styles are merged with the default styles, with the - * user defined styles having priority - * - * @param int The key of the object splitter to change the styles of - * @param string The style to make the methods - * @param boolean Whether to merge the new styles with the old or just - * to overwrite them - * @since 1.0.0 - */ - function set_methods_style($key, $style, $preserve_defaults = false) { - if (!$preserve_defaults) { - $this->language_data['STYLES']['METHODS'][$key] = $style; - } else { - $this->language_data['STYLES']['METHODS'][$key] .= $style; - } - } - - /** - * Turns highlighting on/off for methods - * - * @param boolean Whether to turn highlighting for methods on or off - * @since 1.0.0 - */ - function set_methods_highlighting($flag) { - $this->lexic_permissions['METHODS'] = ($flag) ? true : false; - } - - /** - * Sets the styles for regexps. If $preserve_defaults is - * true, then styles are merged with the default styles, with the - * user defined styles having priority - * - * @param string The style to make the regular expression matches - * @param boolean Whether to merge the new styles with the old or just - * to overwrite them - * @since 1.0.0 - */ - function set_regexps_style($key, $style, $preserve_defaults = false) { - if (!$preserve_defaults) { - $this->language_data['STYLES']['REGEXPS'][$key] = $style; - } else { - $this->language_data['STYLES']['REGEXPS'][$key] .= $style; - } - } - - /** - * Turns highlighting on/off for regexps - * - * @param int The key of the regular expression group to turn on or off - * @param boolean Whether to turn highlighting for the regular expression group on or off - * @since 1.0.0 - */ - function set_regexps_highlighting($key, $flag) { - $this->lexic_permissions['REGEXPS'][$key] = ($flag) ? true : false; - } - - /** - * Sets whether a set of keywords are checked for in a case sensitive manner - * - * @param int The key of the keyword group to change the case sensitivity of - * @param boolean Whether to check in a case sensitive manner or not - * @since 1.0.0 - */ - function set_case_sensitivity($key, $case) { - $this->language_data['CASE_SENSITIVE'][$key] = ($case) ? true : false; - } - - /** - * Sets the case that keywords should use when found. Use the constants: - * - * - GESHI_CAPS_NO_CHANGE: leave keywords as-is - * - GESHI_CAPS_UPPER: convert all keywords to uppercase where found - * - GESHI_CAPS_LOWER: convert all keywords to lowercase where found - * - * @param int A constant specifying what to do with matched keywords - * @since 1.0.1 - */ - function set_case_keywords($case) { - if (in_array($case, array( - GESHI_CAPS_NO_CHANGE, GESHI_CAPS_UPPER, GESHI_CAPS_LOWER))) { - $this->language_data['CASE_KEYWORDS'] = $case; - } - } - - /** - * Sets how many spaces a tab is substituted for - * - * Widths below zero are ignored - * - * @param int The tab width - * @since 1.0.0 - */ - function set_tab_width($width) { - $this->tab_width = intval($width); - - //Check if it fit's the constraints: - if ($this->tab_width < 1) { - //Return it to the default - $this->tab_width = 8; - } - } - - /** - * Sets whether or not to use tab-stop width specifed by language - * - * @param boolean Whether to use language-specific tab-stop widths - * @since 1.0.7.20 - */ - function set_use_language_tab_width($use) { - $this->use_language_tab_width = (bool) $use; - } - - /** - * Returns the tab width to use, based on the current language and user - * preference - * - * @return int Tab width - * @since 1.0.7.20 - */ - function get_real_tab_width() { - if (!$this->use_language_tab_width || - !isset($this->language_data['TAB_WIDTH'])) { - return $this->tab_width; - } else { - return $this->language_data['TAB_WIDTH']; - } - } - - /** - * Enables/disables strict highlighting. Default is off, calling this - * method without parameters will turn it on. See documentation - * for more details on strict mode and where to use it. - * - * @param boolean Whether to enable strict mode or not - * @since 1.0.0 - */ - function enable_strict_mode($mode = true) { - if (GESHI_MAYBE == $this->language_data['STRICT_MODE_APPLIES']) { - $this->strict_mode = ($mode) ? GESHI_ALWAYS : GESHI_NEVER; - } - } - - /** - * Disables all highlighting - * - * @since 1.0.0 - * @todo Rewrite with array traversal - * @deprecated In favour of enable_highlighting - */ - function disable_highlighting() { - $this->enable_highlighting(false); - } - - /** - * Enables all highlighting - * - * The optional flag parameter was added in version 1.0.7.21 and can be used - * to enable (true) or disable (false) all highlighting. - * - * @since 1.0.0 - * @param boolean A flag specifying whether to enable or disable all highlighting - * @todo Rewrite with array traversal - */ - function enable_highlighting($flag = true) { - $flag = $flag ? true : false; - foreach ($this->lexic_permissions as $key => $value) { - if (is_array($value)) { - foreach ($value as $k => $v) { - $this->lexic_permissions[$key][$k] = $flag; - } - } else { - $this->lexic_permissions[$key] = $flag; - } - } - - // Context blocks - $this->enable_important_blocks = $flag; - } - - /** - * Given a file extension, this method returns either a valid geshi language - * name, or the empty string if it couldn't be found - * - * @param string The extension to get a language name for - * @param array A lookup array to use instead of the default one - * @since 1.0.5 - * @todo Re-think about how this method works (maybe make it private and/or make it - * a extension->lang lookup?) - * @todo static? - */ - function get_language_name_from_extension( $extension, $lookup = array() ) { - $extension = strtolower($extension); - - if ( !is_array($lookup) || empty($lookup)) { - $lookup = array( - '6502acme' => array( 'a', 's', 'asm', 'inc' ), - '6502tasm' => array( 'a', 's', 'asm', 'inc' ), - '6502kickass' => array( 'a', 's', 'asm', 'inc' ), - '68000devpac' => array( 'a', 's', 'asm', 'inc' ), - 'abap' => array('abap'), - 'actionscript' => array('as'), - 'ada' => array('a', 'ada', 'adb', 'ads'), - 'apache' => array('conf'), - 'asm' => array('ash', 'asm', 'inc'), - 'asp' => array('asp'), - 'bash' => array('sh'), - 'bf' => array('bf'), - 'c' => array('c', 'h'), - 'c_mac' => array('c', 'h'), - 'caddcl' => array(), - 'cadlisp' => array(), - 'cdfg' => array('cdfg'), - 'cobol' => array('cbl'), - 'cpp' => array('cpp', 'hpp', 'C', 'H', 'CPP', 'HPP'), - 'csharp' => array('cs'), - 'css' => array('css'), - 'd' => array('d'), - 'delphi' => array('dpk', 'dpr', 'pp', 'pas'), - 'diff' => array('diff', 'patch'), - 'dos' => array('bat', 'cmd'), - 'gdb' => array('kcrash', 'crash', 'bt'), - 'gettext' => array('po', 'pot'), - 'gml' => array('gml'), - 'gnuplot' => array('plt'), - 'groovy' => array('groovy'), - 'haskell' => array('hs'), - 'haxe' => array('hx'), - 'html4strict' => array('html', 'htm'), - 'ini' => array('ini', 'desktop'), - 'java' => array('java'), - 'javascript' => array('js'), - 'klonec' => array('kl1'), - 'klonecpp' => array('klx'), - 'latex' => array('tex'), - 'lisp' => array('lisp'), - 'lua' => array('lua'), - 'matlab' => array('m'), - 'mpasm' => array(), - 'mysql' => array('sql'), - 'nsis' => array(), - 'objc' => array(), - 'oobas' => array(), - 'oracle8' => array(), - 'oracle10' => array(), - 'pascal' => array('pas'), - 'perl' => array('pl', 'pm'), - 'php' => array('php', 'php5', 'phtml', 'phps'), - 'povray' => array('pov'), - 'providex' => array('pvc', 'pvx'), - 'prolog' => array('pl'), - 'python' => array('py'), - 'qbasic' => array('bi'), - 'reg' => array('reg'), - 'ruby' => array('rb'), - 'sas' => array('sas'), - 'scala' => array('scala'), - 'scheme' => array('scm'), - 'scilab' => array('sci'), - 'smalltalk' => array('st'), - 'smarty' => array(), - 'tcl' => array('tcl'), - 'text' => array('txt'), - 'vb' => array('bas'), - 'vbnet' => array(), - 'visualfoxpro' => array(), - 'whitespace' => array('ws'), - 'xml' => array('xml', 'svg', 'xrc'), - 'z80' => array('z80', 'asm', 'inc') - ); - } - - foreach ($lookup as $lang => $extensions) { - if (in_array($extension, $extensions)) { - return $lang; - } - } - - return 'text'; - } - - /** - * Given a file name, this method loads its contents in, and attempts - * to set the language automatically. An optional lookup table can be - * passed for looking up the language name. If not specified a default - * table is used - * - * The language table is in the form - *
    array(
    -     *   'lang_name' => array('extension', 'extension', ...),
    -     *   'lang_name' ...
    -     * );
    - * - * @param string The filename to load the source from - * @param array A lookup array to use instead of the default one - * @todo Complete rethink of this and above method - * @since 1.0.5 - */ - function load_from_file($file_name, $lookup = array()) { - if (is_readable($file_name)) { - $this->set_source(file_get_contents($file_name)); - $this->set_language($this->get_language_name_from_extension(substr(strrchr($file_name, '.'), 1), $lookup)); - } else { - $this->error = GESHI_ERROR_FILE_NOT_READABLE; - } - } - - /** - * Adds a keyword to a keyword group for highlighting - * - * @param int The key of the keyword group to add the keyword to - * @param string The word to add to the keyword group - * @since 1.0.0 - */ - function add_keyword($key, $word) { - if (!is_array($this->language_data['KEYWORDS'][$key])) { - $this->language_data['KEYWORDS'][$key] = array(); - } - if (!in_array($word, $this->language_data['KEYWORDS'][$key])) { - $this->language_data['KEYWORDS'][$key][] = $word; - - //NEW in 1.0.8 don't recompile the whole optimized regexp, simply append it - if ($this->parse_cache_built) { - $subkey = count($this->language_data['CACHED_KEYWORD_LISTS'][$key]) - 1; - $this->language_data['CACHED_KEYWORD_LISTS'][$key][$subkey] .= '|' . preg_quote($word, '/'); - } - } - } - - /** - * Removes a keyword from a keyword group - * - * @param int The key of the keyword group to remove the keyword from - * @param string The word to remove from the keyword group - * @param bool Wether to automatically recompile the optimized regexp list or not. - * Note: if you set this to false and @see GeSHi->parse_code() was already called once, - * for the current language, you have to manually call @see GeSHi->optimize_keyword_group() - * or the removed keyword will stay in cache and still be highlighted! On the other hand - * it might be too expensive to recompile the regexp list for every removal if you want to - * remove a lot of keywords. - * @since 1.0.0 - */ - function remove_keyword($key, $word, $recompile = true) { - $key_to_remove = array_search($word, $this->language_data['KEYWORDS'][$key]); - if ($key_to_remove !== false) { - unset($this->language_data['KEYWORDS'][$key][$key_to_remove]); - - //NEW in 1.0.8, optionally recompile keyword group - if ($recompile && $this->parse_cache_built) { - $this->optimize_keyword_group($key); - } - } - } - - /** - * Creates a new keyword group - * - * @param int The key of the keyword group to create - * @param string The styles for the keyword group - * @param boolean Whether the keyword group is case sensitive ornot - * @param array The words to use for the keyword group - * @since 1.0.0 - */ - function add_keyword_group($key, $styles, $case_sensitive = true, $words = array()) { - $words = (array) $words; - if (empty($words)) { - // empty word lists mess up highlighting - return false; - } - - //Add the new keyword group internally - $this->language_data['KEYWORDS'][$key] = $words; - $this->lexic_permissions['KEYWORDS'][$key] = true; - $this->language_data['CASE_SENSITIVE'][$key] = $case_sensitive; - $this->language_data['STYLES']['KEYWORDS'][$key] = $styles; - - //NEW in 1.0.8, cache keyword regexp - if ($this->parse_cache_built) { - $this->optimize_keyword_group($key); - } - } - - /** - * Removes a keyword group - * - * @param int The key of the keyword group to remove - * @since 1.0.0 - */ - function remove_keyword_group ($key) { - //Remove the keyword group internally - unset($this->language_data['KEYWORDS'][$key]); - unset($this->lexic_permissions['KEYWORDS'][$key]); - unset($this->language_data['CASE_SENSITIVE'][$key]); - unset($this->language_data['STYLES']['KEYWORDS'][$key]); - - //NEW in 1.0.8 - unset($this->language_data['CACHED_KEYWORD_LISTS'][$key]); - } - - /** - * compile optimized regexp list for keyword group - * - * @param int The key of the keyword group to compile & optimize - * @since 1.0.8 - */ - function optimize_keyword_group($key) { - $this->language_data['CACHED_KEYWORD_LISTS'][$key] = - $this->optimize_regexp_list($this->language_data['KEYWORDS'][$key]); - $space_as_whitespace = false; - if(isset($this->language_data['PARSER_CONTROL'])) { - if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS'])) { - if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS']['SPACE_AS_WHITESPACE'])) { - $space_as_whitespace = $this->language_data['PARSER_CONTROL']['KEYWORDS']['SPACE_AS_WHITESPACE']; - } - if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPACE'])) { - if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPACE'])) { - $space_as_whitespace = $this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPACE']; - } - } - } - } - if($space_as_whitespace) { - foreach($this->language_data['CACHED_KEYWORD_LISTS'][$key] as $rxk => $rxv) { - $this->language_data['CACHED_KEYWORD_LISTS'][$key][$rxk] = - str_replace(" ", "\\s+", $rxv); - } - } - } - - /** - * Sets the content of the header block - * - * @param string The content of the header block - * @since 1.0.2 - */ - function set_header_content($content) { - $this->header_content = $content; - } - - /** - * Sets the content of the footer block - * - * @param string The content of the footer block - * @since 1.0.2 - */ - function set_footer_content($content) { - $this->footer_content = $content; - } - - /** - * Sets the style for the header content - * - * @param string The style for the header content - * @since 1.0.2 - */ - function set_header_content_style($style) { - $this->header_content_style = $style; - } - - /** - * Sets the style for the footer content - * - * @param string The style for the footer content - * @since 1.0.2 - */ - function set_footer_content_style($style) { - $this->footer_content_style = $style; - } - - /** - * Sets whether to force a surrounding block around - * the highlighted code or not - * - * @param boolean Tells whether to enable or disable this feature - * @since 1.0.7.20 - */ - function enable_inner_code_block($flag) { - $this->force_code_block = (bool)$flag; - } - - /** - * Sets the base URL to be used for keywords - * - * @param int The key of the keyword group to set the URL for - * @param string The URL to set for the group. If {FNAME} is in - * the url somewhere, it is replaced by the keyword - * that the URL is being made for - * @since 1.0.2 - */ - function set_url_for_keyword_group($group, $url) { - $this->language_data['URLS'][$group] = $url; - } - - /** - * Sets styles for links in code - * - * @param int A constant that specifies what state the style is being - * set for - e.g. :hover or :visited - * @param string The styles to use for that state - * @since 1.0.2 - */ - function set_link_styles($type, $styles) { - $this->link_styles[$type] = $styles; - } - - /** - * Sets the target for links in code - * - * @param string The target for links in the code, e.g. _blank - * @since 1.0.3 - */ - function set_link_target($target) { - if (!$target) { - $this->link_target = ''; - } else { - $this->link_target = ' target="' . $target . '"'; - } - } - - /** - * Sets styles for important parts of the code - * - * @param string The styles to use on important parts of the code - * @since 1.0.2 - */ - function set_important_styles($styles) { - $this->important_styles = $styles; - } - - /** - * Sets whether context-important blocks are highlighted - * - * @param boolean Tells whether to enable or disable highlighting of important blocks - * @todo REMOVE THIS SHIZ FROM GESHI! - * @deprecated - * @since 1.0.2 - */ - function enable_important_blocks($flag) { - $this->enable_important_blocks = ( $flag ) ? true : false; - } - - /** - * Whether CSS IDs should be added to each line - * - * @param boolean If true, IDs will be added to each line. - * @since 1.0.2 - */ - function enable_ids($flag = true) { - $this->add_ids = ($flag) ? true : false; - } - - /** - * Specifies which lines to highlight extra - * - * The extra style parameter was added in 1.0.7.21. - * - * @param mixed An array of line numbers to highlight, or just a line - * number on its own. - * @param string A string specifying the style to use for this line. - * If null is specified, the default style is used. - * If false is specified, the line will be removed from - * special highlighting - * @since 1.0.2 - * @todo Some data replication here that could be cut down on - */ - function highlight_lines_extra($lines, $style = null) { - if (is_array($lines)) { - //Split up the job using single lines at a time - foreach ($lines as $line) { - $this->highlight_lines_extra($line, $style); - } - } else { - //Mark the line as being highlighted specially - $lines = intval($lines); - $this->highlight_extra_lines[$lines] = $lines; - - //Decide on which style to use - if ($style === null) { //Check if we should use default style - unset($this->highlight_extra_lines_styles[$lines]); - } elseif ($style === false) { //Check if to remove this line - unset($this->highlight_extra_lines[$lines]); - unset($this->highlight_extra_lines_styles[$lines]); - } else { - $this->highlight_extra_lines_styles[$lines] = $style; - } - } - } - - /** - * Sets the style for extra-highlighted lines - * - * @param string The style for extra-highlighted lines - * @since 1.0.2 - */ - function set_highlight_lines_extra_style($styles) { - $this->highlight_extra_lines_style = $styles; - } - - /** - * Sets the line-ending - * - * @param string The new line-ending - * @since 1.0.2 - */ - function set_line_ending($line_ending) { - $this->line_ending = (string)$line_ending; - } - - /** - * Sets what number line numbers should start at. Should - * be a positive integer, and will be converted to one. - * - * Warning: Using this method will add the "start" - * attribute to the <ol> that is used for line numbering. - * This is not valid XHTML strict, so if that's what you - * care about then don't use this method. Firefox is getting - * support for the CSS method of doing this in 1.1 and Opera - * has support for the CSS method, but (of course) IE doesn't - * so it's not worth doing it the CSS way yet. - * - * @param int The number to start line numbers at - * @since 1.0.2 - */ - function start_line_numbers_at($number) { - $this->line_numbers_start = abs(intval($number)); - } - - /** - * Sets the encoding used for htmlspecialchars(), for international - * support. - * - * NOTE: This is not needed for now because htmlspecialchars() is not - * being used (it has a security hole in PHP4 that has not been patched). - * Maybe in a future version it may make a return for speed reasons, but - * I doubt it. - * - * @param string The encoding to use for the source - * @since 1.0.3 - */ - function set_encoding($encoding) { - if ($encoding) { - $this->encoding = strtolower($encoding); - } - } - - /** - * Turns linking of keywords on or off. - * - * @param boolean If true, links will be added to keywords - * @since 1.0.2 - */ - function enable_keyword_links($enable = true) { - $this->keyword_links = (bool) $enable; - } - - /** - * Setup caches needed for styling. This is automatically called in - * parse_code() and get_stylesheet() when appropriate. This function helps - * stylesheet generators as they rely on some style information being - * preprocessed - * - * @since 1.0.8 - * @access private - */ - function build_style_cache() { - //Build the style cache needed to highlight numbers appropriate - if($this->lexic_permissions['NUMBERS']) { - //First check what way highlighting information for numbers are given - if(!isset($this->language_data['NUMBERS'])) { - $this->language_data['NUMBERS'] = 0; - } - - if(is_array($this->language_data['NUMBERS'])) { - $this->language_data['NUMBERS_CACHE'] = $this->language_data['NUMBERS']; - } else { - $this->language_data['NUMBERS_CACHE'] = array(); - if(!$this->language_data['NUMBERS']) { - $this->language_data['NUMBERS'] = - GESHI_NUMBER_INT_BASIC | - GESHI_NUMBER_FLT_NONSCI; - } - - for($i = 0, $j = $this->language_data['NUMBERS']; $j > 0; ++$i, $j>>=1) { - //Rearrange style indices if required ... - if(isset($this->language_data['STYLES']['NUMBERS'][1<<$i])) { - $this->language_data['STYLES']['NUMBERS'][$i] = - $this->language_data['STYLES']['NUMBERS'][1<<$i]; - unset($this->language_data['STYLES']['NUMBERS'][1<<$i]); - } - - //Check if this bit is set for highlighting - if($j&1) { - //So this bit is set ... - //Check if it belongs to group 0 or the actual stylegroup - if(isset($this->language_data['STYLES']['NUMBERS'][$i])) { - $this->language_data['NUMBERS_CACHE'][$i] = 1 << $i; - } else { - if(!isset($this->language_data['NUMBERS_CACHE'][0])) { - $this->language_data['NUMBERS_CACHE'][0] = 0; - } - $this->language_data['NUMBERS_CACHE'][0] |= 1 << $i; - } - } - } - } - } - } - - /** - * Setup caches needed for parsing. This is automatically called in parse_code() when appropriate. - * This function makes stylesheet generators much faster as they do not need these caches. - * - * @since 1.0.8 - * @access private - */ - function build_parse_cache() { - // cache symbol regexp - //As this is a costy operation, we avoid doing it for multiple groups ... - //Instead we perform it for all symbols at once. - // - //For this to work, we need to reorganize the data arrays. - if ($this->lexic_permissions['SYMBOLS'] && !empty($this->language_data['SYMBOLS'])) { - $this->language_data['MULTIPLE_SYMBOL_GROUPS'] = count($this->language_data['STYLES']['SYMBOLS']) > 1; - - $this->language_data['SYMBOL_DATA'] = array(); - $symbol_preg_multi = array(); // multi char symbols - $symbol_preg_single = array(); // single char symbols - foreach ($this->language_data['SYMBOLS'] as $key => $symbols) { - if (is_array($symbols)) { - foreach ($symbols as $sym) { - $sym = $this->hsc($sym); - if (!isset($this->language_data['SYMBOL_DATA'][$sym])) { - $this->language_data['SYMBOL_DATA'][$sym] = $key; - if (isset($sym[1])) { // multiple chars - $symbol_preg_multi[] = preg_quote($sym, '/'); - } else { // single char - if ($sym == '-') { - // don't trigger range out of order error - $symbol_preg_single[] = '\-'; - } else { - $symbol_preg_single[] = preg_quote($sym, '/'); - } - } - } - } - } else { - $symbols = $this->hsc($symbols); - if (!isset($this->language_data['SYMBOL_DATA'][$symbols])) { - $this->language_data['SYMBOL_DATA'][$symbols] = 0; - if (isset($symbols[1])) { // multiple chars - $symbol_preg_multi[] = preg_quote($symbols, '/'); - } elseif ($symbols == '-') { - // don't trigger range out of order error - $symbol_preg_single[] = '\-'; - } else { // single char - $symbol_preg_single[] = preg_quote($symbols, '/'); - } - } - } - } - - //Now we have an array with each possible symbol as the key and the style as the actual data. - //This way we can set the correct style just the moment we highlight ... - // - //Now we need to rewrite our array to get a search string that - $symbol_preg = array(); - if (!empty($symbol_preg_multi)) { - rsort($symbol_preg_multi); - $symbol_preg[] = implode('|', $symbol_preg_multi); - } - if (!empty($symbol_preg_single)) { - rsort($symbol_preg_single); - $symbol_preg[] = '[' . implode('', $symbol_preg_single) . ']'; - } - $this->language_data['SYMBOL_SEARCH'] = implode("|", $symbol_preg); - } - - // cache optimized regexp for keyword matching - // remove old cache - $this->language_data['CACHED_KEYWORD_LISTS'] = array(); - foreach (array_keys($this->language_data['KEYWORDS']) as $key) { - if (!isset($this->lexic_permissions['KEYWORDS'][$key]) || - $this->lexic_permissions['KEYWORDS'][$key]) { - $this->optimize_keyword_group($key); - } - } - - // brackets - if ($this->lexic_permissions['BRACKETS']) { - $this->language_data['CACHE_BRACKET_MATCH'] = array('[', ']', '(', ')', '{', '}'); - if (!$this->use_classes && isset($this->language_data['STYLES']['BRACKETS'][0])) { - $this->language_data['CACHE_BRACKET_REPLACE'] = array( - '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">[|>', - '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">]|>', - '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">(|>', - '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">)|>', - '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">{|>', - '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">}|>', - ); - } - else { - $this->language_data['CACHE_BRACKET_REPLACE'] = array( - '<| class="br0">[|>', - '<| class="br0">]|>', - '<| class="br0">(|>', - '<| class="br0">)|>', - '<| class="br0">{|>', - '<| class="br0">}|>', - ); - } - } - - //Build the parse cache needed to highlight numbers appropriate - if($this->lexic_permissions['NUMBERS']) { - //Check if the style rearrangements have been processed ... - //This also does some preprocessing to check which style groups are useable ... - if(!isset($this->language_data['NUMBERS_CACHE'])) { - $this->build_style_cache(); - } - - //Number format specification - //All this formats are matched case-insensitively! - static $numbers_format = array( - GESHI_NUMBER_INT_BASIC => - '(?:(? - '(? - '(? - '(? - '(? - '(? - '(? - '(? - '(? - '(? - '(? - '(? - '(? - '(? - '(? - '(?language_data['NUMBERS_RXCACHE'] = array(); - foreach($this->language_data['NUMBERS_CACHE'] as $key => $rxdata) { - if(is_string($rxdata)) { - $regexp = $rxdata; - } else { - //This is a bitfield of number flags to highlight: - //Build an array, implode them together and make this the actual RX - $rxuse = array(); - for($i = 1; $i <= $rxdata; $i<<=1) { - if($rxdata & $i) { - $rxuse[] = $numbers_format[$i]; - } - } - $regexp = implode("|", $rxuse); - } - - $this->language_data['NUMBERS_RXCACHE'][$key] = - "/(?)($regexp)(?!(?:|(?>[^\<]))+>)(?![^<]*>)(?!\|>)(?!\/>)/i"; // - } - - if(!isset($this->language_data['PARSER_CONTROL']['NUMBERS']['PRECHECK_RX'])) { - $this->language_data['PARSER_CONTROL']['NUMBERS']['PRECHECK_RX'] = '#\d#'; - } - } - - $this->parse_cache_built = true; - } - - /** - * Returns the code in $this->source, highlighted and surrounded by the - * nessecary HTML. - * - * This should only be called ONCE, cos it's SLOW! If you want to highlight - * the same source multiple times, you're better off doing a whole lot of - * str_replaces to replace the <span>s - * - * @since 1.0.0 - */ - function parse_code () { - // Start the timer - $start_time = microtime(); - - // Replace all newlines to a common form. - $code = str_replace("\r\n", "\n", $this->source); - $code = str_replace("\r", "\n", $code); - - // Firstly, if there is an error, we won't highlight - if ($this->error) { - //Escape the source for output - $result = $this->hsc($this->source); - - //This fix is related to SF#1923020, but has to be applied regardless of - //actually highlighting symbols. - $result = str_replace(array('', ''), array(';', '|'), $result); - - // Timing is irrelevant - $this->set_time($start_time, $start_time); - $this->finalise($result); - return $result; - } - - // make sure the parse cache is up2date - if (!$this->parse_cache_built) { - $this->build_parse_cache(); - } - - // Initialise various stuff - $length = strlen($code); - $COMMENT_MATCHED = false; - $stuff_to_parse = ''; - $endresult = ''; - - // "Important" selections are handled like multiline comments - // @todo GET RID OF THIS SHIZ - if ($this->enable_important_blocks) { - $this->language_data['COMMENT_MULTI'][GESHI_START_IMPORTANT] = GESHI_END_IMPORTANT; - } - - if ($this->strict_mode) { - // Break the source into bits. Each bit will be a portion of the code - // within script delimiters - for example, HTML between < and > - $k = 0; - $parts = array(); - $matches = array(); - $next_match_pointer = null; - // we use a copy to unset delimiters on demand (when they are not found) - $delim_copy = $this->language_data['SCRIPT_DELIMITERS']; - $i = 0; - while ($i < $length) { - $next_match_pos = $length + 1; // never true - foreach ($delim_copy as $dk => $delimiters) { - if(is_array($delimiters)) { - foreach ($delimiters as $open => $close) { - // make sure the cache is setup properly - if (!isset($matches[$dk][$open])) { - $matches[$dk][$open] = array( - 'next_match' => -1, - 'dk' => $dk, - - 'open' => $open, // needed for grouping of adjacent code blocks (see below) - 'open_strlen' => strlen($open), - - 'close' => $close, - 'close_strlen' => strlen($close), - ); - } - // Get the next little bit for this opening string - if ($matches[$dk][$open]['next_match'] < $i) { - // only find the next pos if it was not already cached - $open_pos = strpos($code, $open, $i); - if ($open_pos === false) { - // no match for this delimiter ever - unset($delim_copy[$dk][$open]); - continue; - } - $matches[$dk][$open]['next_match'] = $open_pos; - } - if ($matches[$dk][$open]['next_match'] < $next_match_pos) { - //So we got a new match, update the close_pos - $matches[$dk][$open]['close_pos'] = - strpos($code, $close, $matches[$dk][$open]['next_match']+1); - - $next_match_pointer =& $matches[$dk][$open]; - $next_match_pos = $matches[$dk][$open]['next_match']; - } - } - } else { - //So we should match an RegExp as Strict Block ... - /** - * The value in $delimiters is expected to be an RegExp - * containing exactly 2 matching groups: - * - Group 1 is the opener - * - Group 2 is the closer - */ - if(!GESHI_PHP_PRE_433 && //Needs proper rewrite to work with PHP >=4.3.0; 4.3.3 is guaranteed to work. - preg_match($delimiters, $code, $matches_rx, PREG_OFFSET_CAPTURE, $i)) { - //We got a match ... - if(isset($matches_rx['start']) && isset($matches_rx['end'])) - { - $matches[$dk] = array( - 'next_match' => $matches_rx['start'][1], - 'dk' => $dk, - - 'close_strlen' => strlen($matches_rx['end'][0]), - 'close_pos' => $matches_rx['end'][1], - ); - } else { - $matches[$dk] = array( - 'next_match' => $matches_rx[1][1], - 'dk' => $dk, - - 'close_strlen' => strlen($matches_rx[2][0]), - 'close_pos' => $matches_rx[2][1], - ); - } - } else { - // no match for this delimiter ever - unset($delim_copy[$dk]); - continue; - } - - if ($matches[$dk]['next_match'] <= $next_match_pos) { - $next_match_pointer =& $matches[$dk]; - $next_match_pos = $matches[$dk]['next_match']; - } - } - } - - // non-highlightable text - $parts[$k] = array( - 1 => substr($code, $i, $next_match_pos - $i) - ); - ++$k; - - if ($next_match_pos > $length) { - // out of bounds means no next match was found - break; - } - - // highlightable code - $parts[$k][0] = $next_match_pointer['dk']; - - //Only combine for non-rx script blocks - if(is_array($delim_copy[$next_match_pointer['dk']])) { - // group adjacent script blocks, e.g. should be one block, not three! - $i = $next_match_pos + $next_match_pointer['open_strlen']; - while (true) { - $close_pos = strpos($code, $next_match_pointer['close'], $i); - if ($close_pos == false) { - break; - } - $i = $close_pos + $next_match_pointer['close_strlen']; - if ($i == $length) { - break; - } - if ($code[$i] == $next_match_pointer['open'][0] && ($next_match_pointer['open_strlen'] == 1 || - substr($code, $i, $next_match_pointer['open_strlen']) == $next_match_pointer['open'])) { - // merge adjacent but make sure we don't merge things like - foreach ($matches as $submatches) { - foreach ($submatches as $match) { - if ($match['next_match'] == $i) { - // a different block already matches here! - break 3; - } - } - } - } else { - break; - } - } - } else { - $close_pos = $next_match_pointer['close_pos'] + $next_match_pointer['close_strlen']; - $i = $close_pos; - } - - if ($close_pos === false) { - // no closing delimiter found! - $parts[$k][1] = substr($code, $next_match_pos); - ++$k; - break; - } else { - $parts[$k][1] = substr($code, $next_match_pos, $i - $next_match_pos); - ++$k; - } - } - unset($delim_copy, $next_match_pointer, $next_match_pos, $matches); - $num_parts = $k; - - if ($num_parts == 1 && $this->strict_mode == GESHI_MAYBE) { - // when we have only one part, we don't have anything to highlight at all. - // if we have a "maybe" strict language, this should be handled as highlightable code - $parts = array( - 0 => array( - 0 => '', - 1 => '' - ), - 1 => array( - 0 => null, - 1 => $parts[0][1] - ) - ); - $num_parts = 2; - } - - } else { - // Not strict mode - simply dump the source into - // the array at index 1 (the first highlightable block) - $parts = array( - 0 => array( - 0 => '', - 1 => '' - ), - 1 => array( - 0 => null, - 1 => $code - ) - ); - $num_parts = 2; - } - - //Unset variables we won't need any longer - unset($code); - - //Preload some repeatedly used values regarding hardquotes ... - $hq = isset($this->language_data['HARDQUOTE']) ? $this->language_data['HARDQUOTE'][0] : false; - $hq_strlen = strlen($hq); - - //Preload if line numbers are to be generated afterwards - //Added a check if line breaks should be forced even without line numbers, fixes SF#1727398 - $check_linenumbers = $this->line_numbers != GESHI_NO_LINE_NUMBERS || - !empty($this->highlight_extra_lines) || !$this->allow_multiline_span; - - //preload the escape char for faster checking ... - $escaped_escape_char = $this->hsc($this->language_data['ESCAPE_CHAR']); - - // this is used for single-line comments - $sc_disallowed_before = ""; - $sc_disallowed_after = ""; - - if (isset($this->language_data['PARSER_CONTROL'])) { - if (isset($this->language_data['PARSER_CONTROL']['COMMENTS'])) { - if (isset($this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_BEFORE'])) { - $sc_disallowed_before = $this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_BEFORE']; - } - if (isset($this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_AFTER'])) { - $sc_disallowed_after = $this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_AFTER']; - } - } - } - - //Fix for SF#1932083: Multichar Quotemarks unsupported - $is_string_starter = array(); - if ($this->lexic_permissions['STRINGS']) { - foreach ($this->language_data['QUOTEMARKS'] as $quotemark) { - if (!isset($is_string_starter[$quotemark[0]])) { - $is_string_starter[$quotemark[0]] = (string)$quotemark; - } elseif (is_string($is_string_starter[$quotemark[0]])) { - $is_string_starter[$quotemark[0]] = array( - $is_string_starter[$quotemark[0]], - $quotemark); - } else { - $is_string_starter[$quotemark[0]][] = $quotemark; - } - } - } - - // Now we go through each part. We know that even-indexed parts are - // code that shouldn't be highlighted, and odd-indexed parts should - // be highlighted - for ($key = 0; $key < $num_parts; ++$key) { - $STRICTATTRS = ''; - - // If this block should be highlighted... - if (!($key & 1)) { - // Else not a block to highlight - $endresult .= $this->hsc($parts[$key][1]); - unset($parts[$key]); - continue; - } - - $result = ''; - $part = $parts[$key][1]; - - $highlight_part = true; - if ($this->strict_mode && !is_null($parts[$key][0])) { - // get the class key for this block of code - $script_key = $parts[$key][0]; - $highlight_part = $this->language_data['HIGHLIGHT_STRICT_BLOCK'][$script_key]; - if ($this->language_data['STYLES']['SCRIPT'][$script_key] != '' && - $this->lexic_permissions['SCRIPT']) { - // Add a span element around the source to - // highlight the overall source block - if (!$this->use_classes && - $this->language_data['STYLES']['SCRIPT'][$script_key] != '') { - $attributes = ' style="' . $this->language_data['STYLES']['SCRIPT'][$script_key] . '"'; - } else { - $attributes = ' class="sc' . $script_key . '"'; - } - $result .= ""; - $STRICTATTRS = $attributes; - } - } - - if ($highlight_part) { - // Now, highlight the code in this block. This code - // is really the engine of GeSHi (along with the method - // parse_non_string_part). - - // cache comment regexps incrementally - $next_comment_regexp_key = ''; - $next_comment_regexp_pos = -1; - $next_comment_multi_pos = -1; - $next_comment_single_pos = -1; - $comment_regexp_cache_per_key = array(); - $comment_multi_cache_per_key = array(); - $comment_single_cache_per_key = array(); - $next_open_comment_multi = ''; - $next_comment_single_key = ''; - $escape_regexp_cache_per_key = array(); - $next_escape_regexp_key = ''; - $next_escape_regexp_pos = -1; - - $length = strlen($part); - for ($i = 0; $i < $length; ++$i) { - // Get the next char - $char = $part[$i]; - $char_len = 1; - - // update regexp comment cache if needed - if (isset($this->language_data['COMMENT_REGEXP']) && $next_comment_regexp_pos < $i) { - $next_comment_regexp_pos = $length; - foreach ($this->language_data['COMMENT_REGEXP'] as $comment_key => $regexp) { - $match_i = false; - if (isset($comment_regexp_cache_per_key[$comment_key]) && - ($comment_regexp_cache_per_key[$comment_key]['pos'] >= $i || - $comment_regexp_cache_per_key[$comment_key]['pos'] === false)) { - // we have already matched something - if ($comment_regexp_cache_per_key[$comment_key]['pos'] === false) { - // this comment is never matched - continue; - } - $match_i = $comment_regexp_cache_per_key[$comment_key]['pos']; - } elseif ( - //This is to allow use of the offset parameter in preg_match and stay as compatible with older PHP versions as possible - (GESHI_PHP_PRE_433 && preg_match($regexp, substr($part, $i), $match, PREG_OFFSET_CAPTURE)) || - (!GESHI_PHP_PRE_433 && preg_match($regexp, $part, $match, PREG_OFFSET_CAPTURE, $i)) - ) { - $match_i = $match[0][1]; - if (GESHI_PHP_PRE_433) { - $match_i += $i; - } - - $comment_regexp_cache_per_key[$comment_key] = array( - 'key' => $comment_key, - 'length' => strlen($match[0][0]), - 'pos' => $match_i - ); - } else { - $comment_regexp_cache_per_key[$comment_key]['pos'] = false; - continue; - } - - if ($match_i !== false && $match_i < $next_comment_regexp_pos) { - $next_comment_regexp_pos = $match_i; - $next_comment_regexp_key = $comment_key; - if ($match_i === $i) { - break; - } - } - } - } - - $string_started = false; - - if (isset($is_string_starter[$char])) { - // Possibly the start of a new string ... - - //Check which starter it was ... - //Fix for SF#1932083: Multichar Quotemarks unsupported - if (is_array($is_string_starter[$char])) { - $char_new = ''; - foreach ($is_string_starter[$char] as $testchar) { - if ($testchar === substr($part, $i, strlen($testchar)) && - strlen($testchar) > strlen($char_new)) { - $char_new = $testchar; - $string_started = true; - } - } - if ($string_started) { - $char = $char_new; - } - } else { - $testchar = $is_string_starter[$char]; - if ($testchar === substr($part, $i, strlen($testchar))) { - $char = $testchar; - $string_started = true; - } - } - $char_len = strlen($char); - } - - if ($string_started && ($i != $next_comment_regexp_pos)) { - // Hand out the correct style information for this string - $string_key = array_search($char, $this->language_data['QUOTEMARKS']); - if (!isset($this->language_data['STYLES']['STRINGS'][$string_key]) || - !isset($this->language_data['STYLES']['ESCAPE_CHAR'][$string_key])) { - $string_key = 0; - } - - // parse the stuff before this - $result .= $this->parse_non_string_part($stuff_to_parse); - $stuff_to_parse = ''; - - if (!$this->use_classes) { - $string_attributes = ' style="' . $this->language_data['STYLES']['STRINGS'][$string_key] . '"'; - } else { - $string_attributes = ' class="st'.$string_key.'"'; - } - - // now handle the string - $string = "" . GeSHi::hsc($char); - $start = $i + $char_len; - $string_open = true; - - if(empty($this->language_data['ESCAPE_REGEXP'])) { - $next_escape_regexp_pos = $length; - } - - do { - //Get the regular ending pos ... - $close_pos = strpos($part, $char, $start); - if(false === $close_pos) { - $close_pos = $length; - } - - if($this->lexic_permissions['ESCAPE_CHAR']) { - // update escape regexp cache if needed - if (isset($this->language_data['ESCAPE_REGEXP']) && $next_escape_regexp_pos < $start) { - $next_escape_regexp_pos = $length; - foreach ($this->language_data['ESCAPE_REGEXP'] as $escape_key => $regexp) { - $match_i = false; - if (isset($escape_regexp_cache_per_key[$escape_key]) && - ($escape_regexp_cache_per_key[$escape_key]['pos'] >= $start || - $escape_regexp_cache_per_key[$escape_key]['pos'] === false)) { - // we have already matched something - if ($escape_regexp_cache_per_key[$escape_key]['pos'] === false) { - // this comment is never matched - continue; - } - $match_i = $escape_regexp_cache_per_key[$escape_key]['pos']; - } elseif ( - //This is to allow use of the offset parameter in preg_match and stay as compatible with older PHP versions as possible - (GESHI_PHP_PRE_433 && preg_match($regexp, substr($part, $start), $match, PREG_OFFSET_CAPTURE)) || - (!GESHI_PHP_PRE_433 && preg_match($regexp, $part, $match, PREG_OFFSET_CAPTURE, $start)) - ) { - $match_i = $match[0][1]; - if (GESHI_PHP_PRE_433) { - $match_i += $start; - } - - $escape_regexp_cache_per_key[$escape_key] = array( - 'key' => $escape_key, - 'length' => strlen($match[0][0]), - 'pos' => $match_i - ); - } else { - $escape_regexp_cache_per_key[$escape_key]['pos'] = false; - continue; - } - - if ($match_i !== false && $match_i < $next_escape_regexp_pos) { - $next_escape_regexp_pos = $match_i; - $next_escape_regexp_key = $escape_key; - if ($match_i === $start) { - break; - } - } - } - } - - //Find the next simple escape position - if('' != $this->language_data['ESCAPE_CHAR']) { - $simple_escape = strpos($part, $this->language_data['ESCAPE_CHAR'], $start); - if(false === $simple_escape) { - $simple_escape = $length; - } - } else { - $simple_escape = $length; - } - } else { - $next_escape_regexp_pos = $length; - $simple_escape = $length; - } - - if($simple_escape < $next_escape_regexp_pos && - $simple_escape < $length && - $simple_escape < $close_pos) { - //The nexxt escape sequence is a simple one ... - $es_pos = $simple_escape; - - //Add the stuff not in the string yet ... - $string .= $this->hsc(substr($part, $start, $es_pos - $start)); - - //Get the style for this escaped char ... - if (!$this->use_classes) { - $escape_char_attributes = ' style="' . $this->language_data['STYLES']['ESCAPE_CHAR'][0] . '"'; - } else { - $escape_char_attributes = ' class="es0"'; - } - - //Add the style for the escape char ... - $string .= "" . - GeSHi::hsc($this->language_data['ESCAPE_CHAR']); - - //Get the byte AFTER the ESCAPE_CHAR we just found - $es_char = $part[$es_pos + 1]; - if ($es_char == "\n") { - // don't put a newline around newlines - $string .= "\n"; - $start = $es_pos + 2; - } elseif (ord($es_char) >= 128) { - //This is an non-ASCII char (UTF8 or single byte) - //This code tries to work around SF#2037598 ... - if(function_exists('mb_substr')) { - $es_char_m = mb_substr(substr($part, $es_pos+1, 16), 0, 1, $this->encoding); - $string .= $es_char_m . ''; - } elseif (!GESHI_PHP_PRE_433 && 'utf-8' == $this->encoding) { - if(preg_match("/[\xC2-\xDF][\x80-\xBF]". - "|\xE0[\xA0-\xBF][\x80-\xBF]". - "|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}". - "|\xED[\x80-\x9F][\x80-\xBF]". - "|\xF0[\x90-\xBF][\x80-\xBF]{2}". - "|[\xF1-\xF3][\x80-\xBF]{3}". - "|\xF4[\x80-\x8F][\x80-\xBF]{2}/s", - $part, $es_char_m, null, $es_pos + 1)) { - $es_char_m = $es_char_m[0]; - } else { - $es_char_m = $es_char; - } - $string .= $this->hsc($es_char_m) . ''; - } else { - $es_char_m = $this->hsc($es_char); - } - $start = $es_pos + strlen($es_char_m) + 1; - } else { - $string .= $this->hsc($es_char) . ''; - $start = $es_pos + 2; - } - } elseif ($next_escape_regexp_pos < $length && - $next_escape_regexp_pos < $close_pos) { - $es_pos = $next_escape_regexp_pos; - //Add the stuff not in the string yet ... - $string .= $this->hsc(substr($part, $start, $es_pos - $start)); - - //Get the key and length of this match ... - $escape = $escape_regexp_cache_per_key[$next_escape_regexp_key]; - $escape_str = substr($part, $es_pos, $escape['length']); - $escape_key = $escape['key']; - - //Get the style for this escaped char ... - if (!$this->use_classes) { - $escape_char_attributes = ' style="' . $this->language_data['STYLES']['ESCAPE_CHAR'][$escape_key] . '"'; - } else { - $escape_char_attributes = ' class="es' . $escape_key . '"'; - } - - //Add the style for the escape char ... - $string .= "" . - $this->hsc($escape_str) . ''; - - $start = $es_pos + $escape['length']; - } else { - //Copy the remainder of the string ... - $string .= $this->hsc(substr($part, $start, $close_pos - $start + $char_len)) . ''; - $start = $close_pos + $char_len; - $string_open = false; - } - } while($string_open); - - if ($check_linenumbers) { - // Are line numbers used? If, we should end the string before - // the newline and begin it again (so when
  • s are put in the source - // remains XHTML compliant) - // note to self: This opens up possibility of config files specifying - // that languages can/cannot have multiline strings??? - $string = str_replace("\n", "\n", $string); - } - - $result .= $string; - $string = ''; - $i = $start - 1; - continue; - } elseif ($this->lexic_permissions['STRINGS'] && $hq && $hq[0] == $char && - substr($part, $i, $hq_strlen) == $hq && ($i != $next_comment_regexp_pos)) { - // The start of a hard quoted string - if (!$this->use_classes) { - $string_attributes = ' style="' . $this->language_data['STYLES']['STRINGS']['HARD'] . '"'; - $escape_char_attributes = ' style="' . $this->language_data['STYLES']['ESCAPE_CHAR']['HARD'] . '"'; - } else { - $string_attributes = ' class="st_h"'; - $escape_char_attributes = ' class="es_h"'; - } - // parse the stuff before this - $result .= $this->parse_non_string_part($stuff_to_parse); - $stuff_to_parse = ''; - - // now handle the string - $string = ''; - - // look for closing quote - $start = $i + $hq_strlen; - while ($close_pos = strpos($part, $this->language_data['HARDQUOTE'][1], $start)) { - $start = $close_pos + 1; - if ($this->lexic_permissions['ESCAPE_CHAR'] && $part[$close_pos - 1] == $this->language_data['HARDCHAR'] && - (($i + $hq_strlen) != ($close_pos))) { //Support empty string for HQ escapes if Starter = Escape - // make sure this quote is not escaped - foreach ($this->language_data['HARDESCAPE'] as $hardescape) { - if (substr($part, $close_pos - 1, strlen($hardescape)) == $hardescape) { - // check wether this quote is escaped or if it is something like '\\' - $escape_char_pos = $close_pos - 1; - while ($escape_char_pos > 0 - && $part[$escape_char_pos - 1] == $this->language_data['HARDCHAR']) { - --$escape_char_pos; - } - if (($close_pos - $escape_char_pos) & 1) { - // uneven number of escape chars => this quote is escaped - continue 2; - } - } - } - } - - // found closing quote - break; - } - - //Found the closing delimiter? - if (!$close_pos) { - // span till the end of this $part when no closing delimiter is found - $close_pos = $length; - } - - //Get the actual string - $string = substr($part, $i, $close_pos - $i + 1); - $i = $close_pos; - - // handle escape chars and encode html chars - // (special because when we have escape chars within our string they may not be escaped) - if ($this->lexic_permissions['ESCAPE_CHAR'] && $this->language_data['ESCAPE_CHAR']) { - $start = 0; - $new_string = ''; - while ($es_pos = strpos($string, $this->language_data['ESCAPE_CHAR'], $start)) { - // hmtl escape stuff before - $new_string .= $this->hsc(substr($string, $start, $es_pos - $start)); - // check if this is a hard escape - foreach ($this->language_data['HARDESCAPE'] as $hardescape) { - if (substr($string, $es_pos, strlen($hardescape)) == $hardescape) { - // indeed, this is a hardescape - $new_string .= "" . - $this->hsc($hardescape) . ''; - $start = $es_pos + strlen($hardescape); - continue 2; - } - } - // not a hard escape, but a normal escape - // they come in pairs of two - $c = 0; - while (isset($string[$es_pos + $c]) && isset($string[$es_pos + $c + 1]) - && $string[$es_pos + $c] == $this->language_data['ESCAPE_CHAR'] - && $string[$es_pos + $c + 1] == $this->language_data['ESCAPE_CHAR']) { - $c += 2; - } - if ($c) { - $new_string .= "" . - str_repeat($escaped_escape_char, $c) . - ''; - $start = $es_pos + $c; - } else { - // this is just a single lonely escape char... - $new_string .= $escaped_escape_char; - $start = $es_pos + 1; - } - } - $string = $new_string . $this->hsc(substr($string, $start)); - } else { - $string = $this->hsc($string); - } - - if ($check_linenumbers) { - // Are line numbers used? If, we should end the string before - // the newline and begin it again (so when
  • s are put in the source - // remains XHTML compliant) - // note to self: This opens up possibility of config files specifying - // that languages can/cannot have multiline strings??? - $string = str_replace("\n", "\n", $string); - } - - $result .= "" . $string . ''; - $string = ''; - continue; - } else { - //Have a look for regexp comments - if ($i == $next_comment_regexp_pos) { - $COMMENT_MATCHED = true; - $comment = $comment_regexp_cache_per_key[$next_comment_regexp_key]; - $test_str = $this->hsc(substr($part, $i, $comment['length'])); - - //@todo If remove important do remove here - if ($this->lexic_permissions['COMMENTS']['MULTI']) { - if (!$this->use_classes) { - $attributes = ' style="' . $this->language_data['STYLES']['COMMENTS'][$comment['key']] . '"'; - } else { - $attributes = ' class="co' . $comment['key'] . '"'; - } - - $test_str = "" . $test_str . ""; - - // Short-cut through all the multiline code - if ($check_linenumbers) { - // strreplace to put close span and open span around multiline newlines - $test_str = str_replace( - "\n", "\n", - str_replace("\n ", "\n ", $test_str) - ); - } - } - - $i += $comment['length'] - 1; - - // parse the rest - $result .= $this->parse_non_string_part($stuff_to_parse); - $stuff_to_parse = ''; - } - - // If we haven't matched a regexp comment, try multi-line comments - if (!$COMMENT_MATCHED) { - // Is this a multiline comment? - if (!empty($this->language_data['COMMENT_MULTI']) && $next_comment_multi_pos < $i) { - $next_comment_multi_pos = $length; - foreach ($this->language_data['COMMENT_MULTI'] as $open => $close) { - $match_i = false; - if (isset($comment_multi_cache_per_key[$open]) && - ($comment_multi_cache_per_key[$open] >= $i || - $comment_multi_cache_per_key[$open] === false)) { - // we have already matched something - if ($comment_multi_cache_per_key[$open] === false) { - // this comment is never matched - continue; - } - $match_i = $comment_multi_cache_per_key[$open]; - } elseif (($match_i = stripos($part, $open, $i)) !== false) { - $comment_multi_cache_per_key[$open] = $match_i; - } else { - $comment_multi_cache_per_key[$open] = false; - continue; - } - if ($match_i !== false && $match_i < $next_comment_multi_pos) { - $next_comment_multi_pos = $match_i; - $next_open_comment_multi = $open; - if ($match_i === $i) { - break; - } - } - } - } - if ($i == $next_comment_multi_pos) { - $open = $next_open_comment_multi; - $close = $this->language_data['COMMENT_MULTI'][$open]; - $open_strlen = strlen($open); - $close_strlen = strlen($close); - $COMMENT_MATCHED = true; - $test_str_match = $open; - //@todo If remove important do remove here - if ($this->lexic_permissions['COMMENTS']['MULTI'] || - $open == GESHI_START_IMPORTANT) { - if ($open != GESHI_START_IMPORTANT) { - if (!$this->use_classes) { - $attributes = ' style="' . $this->language_data['STYLES']['COMMENTS']['MULTI'] . '"'; - } else { - $attributes = ' class="coMULTI"'; - } - $test_str = "" . $this->hsc($open); - } else { - if (!$this->use_classes) { - $attributes = ' style="' . $this->important_styles . '"'; - } else { - $attributes = ' class="imp"'; - } - - // We don't include the start of the comment if it's an - // "important" part - $test_str = ""; - } - } else { - $test_str = $this->hsc($open); - } - - $close_pos = strpos( $part, $close, $i + $open_strlen ); - - if ($close_pos === false) { - $close_pos = $length; - } - - // Short-cut through all the multiline code - $rest_of_comment = $this->hsc(substr($part, $i + $open_strlen, $close_pos - $i - $open_strlen + $close_strlen)); - if (($this->lexic_permissions['COMMENTS']['MULTI'] || - $test_str_match == GESHI_START_IMPORTANT) && - $check_linenumbers) { - - // strreplace to put close span and open span around multiline newlines - $test_str .= str_replace( - "\n", "\n", - str_replace("\n ", "\n ", $rest_of_comment) - ); - } else { - $test_str .= $rest_of_comment; - } - - if ($this->lexic_permissions['COMMENTS']['MULTI'] || - $test_str_match == GESHI_START_IMPORTANT) { - $test_str .= ''; - } - - $i = $close_pos + $close_strlen - 1; - - // parse the rest - $result .= $this->parse_non_string_part($stuff_to_parse); - $stuff_to_parse = ''; - } - } - - // If we haven't matched a multiline comment, try single-line comments - if (!$COMMENT_MATCHED) { - // cache potential single line comment occurances - if (!empty($this->language_data['COMMENT_SINGLE']) && $next_comment_single_pos < $i) { - $next_comment_single_pos = $length; - foreach ($this->language_data['COMMENT_SINGLE'] as $comment_key => $comment_mark) { - $match_i = false; - if (isset($comment_single_cache_per_key[$comment_key]) && - ($comment_single_cache_per_key[$comment_key] >= $i || - $comment_single_cache_per_key[$comment_key] === false)) { - // we have already matched something - if ($comment_single_cache_per_key[$comment_key] === false) { - // this comment is never matched - continue; - } - $match_i = $comment_single_cache_per_key[$comment_key]; - } elseif ( - // case sensitive comments - ($this->language_data['CASE_SENSITIVE'][GESHI_COMMENTS] && - ($match_i = stripos($part, $comment_mark, $i)) !== false) || - // non case sensitive - (!$this->language_data['CASE_SENSITIVE'][GESHI_COMMENTS] && - (($match_i = strpos($part, $comment_mark, $i)) !== false))) { - $comment_single_cache_per_key[$comment_key] = $match_i; - } else { - $comment_single_cache_per_key[$comment_key] = false; - continue; - } - if ($match_i !== false && $match_i < $next_comment_single_pos) { - $next_comment_single_pos = $match_i; - $next_comment_single_key = $comment_key; - if ($match_i === $i) { - break; - } - } - } - } - if ($next_comment_single_pos == $i) { - $comment_key = $next_comment_single_key; - $comment_mark = $this->language_data['COMMENT_SINGLE'][$comment_key]; - $com_len = strlen($comment_mark); - - // This check will find special variables like $# in bash - // or compiler directives of Delphi beginning {$ - if ((empty($sc_disallowed_before) || ($i == 0) || - (false === strpos($sc_disallowed_before, $part[$i-1]))) && - (empty($sc_disallowed_after) || ($length <= $i + $com_len) || - (false === strpos($sc_disallowed_after, $part[$i + $com_len])))) - { - // this is a valid comment - $COMMENT_MATCHED = true; - if ($this->lexic_permissions['COMMENTS'][$comment_key]) { - if (!$this->use_classes) { - $attributes = ' style="' . $this->language_data['STYLES']['COMMENTS'][$comment_key] . '"'; - } else { - $attributes = ' class="co' . $comment_key . '"'; - } - $test_str = "" . $this->hsc($this->change_case($comment_mark)); - } else { - $test_str = $this->hsc($comment_mark); - } - - //Check if this comment is the last in the source - $close_pos = strpos($part, "\n", $i); - $oops = false; - if ($close_pos === false) { - $close_pos = $length; - $oops = true; - } - $test_str .= $this->hsc(substr($part, $i + $com_len, $close_pos - $i - $com_len)); - if ($this->lexic_permissions['COMMENTS'][$comment_key]) { - $test_str .= ""; - } - - // Take into account that the comment might be the last in the source - if (!$oops) { - $test_str .= "\n"; - } - - $i = $close_pos; - - // parse the rest - $result .= $this->parse_non_string_part($stuff_to_parse); - $stuff_to_parse = ''; - } - } - } - } - - // Where are we adding this char? - if (!$COMMENT_MATCHED) { - $stuff_to_parse .= $char; - } else { - $result .= $test_str; - unset($test_str); - $COMMENT_MATCHED = false; - } - } - // Parse the last bit - $result .= $this->parse_non_string_part($stuff_to_parse); - $stuff_to_parse = ''; - } else { - $result .= $this->hsc($part); - } - // Close the that surrounds the block - if ($STRICTATTRS != '') { - $result = str_replace("\n", "\n", $result); - $result .= ''; - } - - $endresult .= $result; - unset($part, $parts[$key], $result); - } - - //This fix is related to SF#1923020, but has to be applied regardless of - //actually highlighting symbols. - /** NOTE: memorypeak #3 */ - $endresult = str_replace(array('', ''), array(';', '|'), $endresult); - -// // Parse the last stuff (redundant?) -// $result .= $this->parse_non_string_part($stuff_to_parse); - - // Lop off the very first and last spaces -// $result = substr($result, 1, -1); - - // We're finished: stop timing - $this->set_time($start_time, microtime()); - - $this->finalise($endresult); - return $endresult; - } - - /** - * Swaps out spaces and tabs for HTML indentation. Not needed if - * the code is in a pre block... - * - * @param string The source to indent (reference!) - * @since 1.0.0 - * @access private - */ - function indent(&$result) { - /// Replace tabs with the correct number of spaces - if (false !== strpos($result, "\t")) { - $lines = explode("\n", $result); - $result = null;//Save memory while we process the lines individually - $tab_width = $this->get_real_tab_width(); - $tab_string = ' ' . str_repeat(' ', $tab_width); - - for ($key = 0, $n = count($lines); $key < $n; $key++) { - $line = $lines[$key]; - if (false === strpos($line, "\t")) { - continue; - } - - $pos = 0; - $length = strlen($line); - $lines[$key] = ''; // reduce memory - - $IN_TAG = false; - for ($i = 0; $i < $length; ++$i) { - $char = $line[$i]; - // Simple engine to work out whether we're in a tag. - // If we are we modify $pos. This is so we ignore HTML - // in the line and only workout the tab replacement - // via the actual content of the string - // This test could be improved to include strings in the - // html so that < or > would be allowed in user's styles - // (e.g. quotes: '<' '>'; or similar) - if ($IN_TAG) { - if ('>' == $char) { - $IN_TAG = false; - } - $lines[$key] .= $char; - } elseif ('<' == $char) { - $IN_TAG = true; - $lines[$key] .= '<'; - } elseif ('&' == $char) { - $substr = substr($line, $i + 3, 5); - $posi = strpos($substr, ';'); - if (false === $posi) { - ++$pos; - } else { - $pos -= $posi+2; - } - $lines[$key] .= $char; - } elseif ("\t" == $char) { - $str = ''; - // OPTIMISE - move $strs out. Make an array: - // $tabs = array( - // 1 => ' ', - // 2 => '  ', - // 3 => '   ' etc etc - // to use instead of building a string every time - $tab_end_width = $tab_width - ($pos % $tab_width); //Moved out of the look as it doesn't change within the loop - if (($pos & 1) || 1 == $tab_end_width) { - $str .= substr($tab_string, 6, $tab_end_width); - } else { - $str .= substr($tab_string, 0, $tab_end_width+5); - } - $lines[$key] .= $str; - $pos += $tab_end_width; - - if (false === strpos($line, "\t", $i + 1)) { - $lines[$key] .= substr($line, $i + 1); - break; - } - } elseif (0 == $pos && ' ' == $char) { - $lines[$key] .= ' '; - ++$pos; - } else { - $lines[$key] .= $char; - ++$pos; - } - } - } - $result = implode("\n", $lines); - unset($lines);//We don't need the lines separated beyond this --- free them! - } - // Other whitespace - // BenBE: Fix to reduce the number of replacements to be done - $result = preg_replace('/^ /m', ' ', $result); - $result = str_replace(' ', '  ', $result); - - if ($this->line_numbers == GESHI_NO_LINE_NUMBERS && $this->header_type != GESHI_HEADER_PRE_TABLE) { - if ($this->line_ending === null) { - $result = nl2br($result); - } else { - $result = str_replace("\n", $this->line_ending, $result); - } - } - } - - /** - * Changes the case of a keyword for those languages where a change is asked for - * - * @param string The keyword to change the case of - * @return string The keyword with its case changed - * @since 1.0.0 - * @access private - */ - function change_case($instr) { - switch ($this->language_data['CASE_KEYWORDS']) { - case GESHI_CAPS_UPPER: - return strtoupper($instr); - case GESHI_CAPS_LOWER: - return strtolower($instr); - default: - return $instr; - } - } - - /** - * Handles replacements of keywords to include markup and links if requested - * - * @param string The keyword to add the Markup to - * @return The HTML for the match found - * @since 1.0.8 - * @access private - * - * @todo Get rid of ender in keyword links - */ - function handle_keyword_replace($match) { - $k = $this->_kw_replace_group; - $keyword = $match[0]; - $keyword_match = $match[1]; - - $before = ''; - $after = ''; - - if ($this->keyword_links) { - // Keyword links have been ebabled - - if (isset($this->language_data['URLS'][$k]) && - $this->language_data['URLS'][$k] != '') { - // There is a base group for this keyword - - // Old system: strtolower - //$keyword = ( $this->language_data['CASE_SENSITIVE'][$group] ) ? $keyword : strtolower($keyword); - // New system: get keyword from language file to get correct case - if (!$this->language_data['CASE_SENSITIVE'][$k] && - strpos($this->language_data['URLS'][$k], '{FNAME}') !== false) { - foreach ($this->language_data['KEYWORDS'][$k] as $word) { - if (strcasecmp($word, $keyword_match) == 0) { - break; - } - } - } else { - $word = $keyword_match; - } - - $before = '<|UR1|"' . - str_replace( - array( - '{FNAME}', - '{FNAMEL}', - '{FNAMEU}', - '.'), - array( - str_replace('+', '%20', urlencode($this->hsc($word))), - str_replace('+', '%20', urlencode($this->hsc(strtolower($word)))), - str_replace('+', '%20', urlencode($this->hsc(strtoupper($word)))), - ''), - $this->language_data['URLS'][$k] - ) . '">'; - $after = ''; - } - } - - return $before . '<|/'. $k .'/>' . $this->change_case($keyword) . '|>' . $after; - } - - /** - * handles regular expressions highlighting-definitions with callback functions - * - * @note this is a callback, don't use it directly - * - * @param array the matches array - * @return The highlighted string - * @since 1.0.8 - * @access private - */ - function handle_regexps_callback($matches) { - // before: "' style=\"' . call_user_func(\"$func\", '\\1') . '\"\\1|>'", - return ' style="' . call_user_func($this->language_data['STYLES']['REGEXPS'][$this->_rx_key], $matches[1]) . '"'. $matches[1] . '|>'; - } - - /** - * handles newlines in REGEXPS matches. Set the _hmr_* vars before calling this - * - * @note this is a callback, don't use it directly - * - * @param array the matches array - * @return string - * @since 1.0.8 - * @access private - */ - function handle_multiline_regexps($matches) { - $before = $this->_hmr_before; - $after = $this->_hmr_after; - if ($this->_hmr_replace) { - $replace = $this->_hmr_replace; - $search = array(); - - foreach (array_keys($matches) as $k) { - $search[] = '\\' . $k; - } - - $before = str_replace($search, $matches, $before); - $after = str_replace($search, $matches, $after); - $replace = str_replace($search, $matches, $replace); - } else { - $replace = $matches[0]; - } - return $before - . '<|!REG3XP' . $this->_hmr_key .'!>' - . str_replace("\n", "|>\n<|!REG3XP" . $this->_hmr_key . '!>', $replace) - . '|>' - . $after; - } - - /** - * Takes a string that has no strings or comments in it, and highlights - * stuff like keywords, numbers and methods. - * - * @param string The string to parse for keyword, numbers etc. - * @since 1.0.0 - * @access private - * @todo BUGGY! Why? Why not build string and return? - */ - function parse_non_string_part($stuff_to_parse) { - $stuff_to_parse = ' ' . $this->hsc($stuff_to_parse); - - // Highlight keywords - $disallowed_before = "(?lexic_permissions['STRINGS']) { - $quotemarks = preg_quote(implode($this->language_data['QUOTEMARKS']), '/'); - $disallowed_before .= $quotemarks; - $disallowed_after .= $quotemarks; - } - $disallowed_before .= "])"; - $disallowed_after .= "])"; - - $parser_control_pergroup = false; - if (isset($this->language_data['PARSER_CONTROL'])) { - if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS'])) { - $x = 0; // check wether per-keyword-group parser_control is enabled - if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_BEFORE'])) { - $disallowed_before = $this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_BEFORE']; - ++$x; - } - if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_AFTER'])) { - $disallowed_after = $this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_AFTER']; - ++$x; - } - $parser_control_pergroup = (count($this->language_data['PARSER_CONTROL']['KEYWORDS']) - $x) > 0; - } - } - - foreach (array_keys($this->language_data['KEYWORDS']) as $k) { - if (!isset($this->lexic_permissions['KEYWORDS'][$k]) || - $this->lexic_permissions['KEYWORDS'][$k]) { - - $case_sensitive = $this->language_data['CASE_SENSITIVE'][$k]; - $modifiers = $case_sensitive ? '' : 'i'; - - // NEW in 1.0.8 - per-keyword-group parser control - $disallowed_before_local = $disallowed_before; - $disallowed_after_local = $disallowed_after; - if ($parser_control_pergroup && isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$k])) { - if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_BEFORE'])) { - $disallowed_before_local = - $this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_BEFORE']; - } - - if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_AFTER'])) { - $disallowed_after_local = - $this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_AFTER']; - } - } - - $this->_kw_replace_group = $k; - - //NEW in 1.0.8, the cached regexp list - // since we don't want PHP / PCRE to crash due to too large patterns we split them into smaller chunks - for ($set = 0, $set_length = count($this->language_data['CACHED_KEYWORD_LISTS'][$k]); $set < $set_length; ++$set) { - $keywordset =& $this->language_data['CACHED_KEYWORD_LISTS'][$k][$set]; - // Might make a more unique string for putting the number in soon - // Basically, we don't put the styles in yet because then the styles themselves will - // get highlighted if the language has a CSS keyword in it (like CSS, for example ;)) - $stuff_to_parse = preg_replace_callback( - "/$disallowed_before_local({$keywordset})(?!\(?:htm|php|aspx?))$disallowed_after_local/$modifiers", - array($this, 'handle_keyword_replace'), - $stuff_to_parse - ); - } - } - } - - // Regular expressions - foreach ($this->language_data['REGEXPS'] as $key => $regexp) { - if ($this->lexic_permissions['REGEXPS'][$key]) { - if (is_array($regexp)) { - if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) { - // produce valid HTML when we match multiple lines - $this->_hmr_replace = $regexp[GESHI_REPLACE]; - $this->_hmr_before = $regexp[GESHI_BEFORE]; - $this->_hmr_key = $key; - $this->_hmr_after = $regexp[GESHI_AFTER]; - $stuff_to_parse = preg_replace_callback( - "/" . $regexp[GESHI_SEARCH] . "/{$regexp[GESHI_MODIFIERS]}", - array($this, 'handle_multiline_regexps'), - $stuff_to_parse); - $this->_hmr_replace = false; - $this->_hmr_before = ''; - $this->_hmr_after = ''; - } else { - $stuff_to_parse = preg_replace( - '/' . $regexp[GESHI_SEARCH] . '/' . $regexp[GESHI_MODIFIERS], - $regexp[GESHI_BEFORE] . '<|!REG3XP'. $key .'!>' . $regexp[GESHI_REPLACE] . '|>' . $regexp[GESHI_AFTER], - $stuff_to_parse); - } - } else { - if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) { - // produce valid HTML when we match multiple lines - $this->_hmr_key = $key; - $stuff_to_parse = preg_replace_callback( "/(" . $regexp . ")/", - array($this, 'handle_multiline_regexps'), $stuff_to_parse); - $this->_hmr_key = ''; - } else { - $stuff_to_parse = preg_replace( "/(" . $regexp . ")/", "<|!REG3XP$key!>\\1|>", $stuff_to_parse); - } - } - } - } - - // Highlight numbers. As of 1.0.8 we support different types of numbers - $numbers_found = false; - - if ($this->lexic_permissions['NUMBERS'] && preg_match($this->language_data['PARSER_CONTROL']['NUMBERS']['PRECHECK_RX'], $stuff_to_parse )) { - $numbers_found = true; - - //For each of the formats ... - foreach($this->language_data['NUMBERS_RXCACHE'] as $id => $regexp) { - //Check if it should be highlighted ... - $stuff_to_parse = preg_replace($regexp, "<|/NUM!$id/>\\1|>", $stuff_to_parse); - } - } - - // - // Now that's all done, replace /[number]/ with the correct styles - // - foreach (array_keys($this->language_data['KEYWORDS']) as $k) { - if (!$this->use_classes) { - $attributes = ' style="' . - (isset($this->language_data['STYLES']['KEYWORDS'][$k]) ? - $this->language_data['STYLES']['KEYWORDS'][$k] : "") . '"'; - } else { - $attributes = ' class="kw' . $k . '"'; - } - $stuff_to_parse = str_replace("<|/$k/>", "<|$attributes>", $stuff_to_parse); - } - - if ($numbers_found) { - // Put number styles in - foreach($this->language_data['NUMBERS_RXCACHE'] as $id => $regexp) { - //Commented out for now, as this needs some review ... - // if ($numbers_permissions & $id) { - //Get the appropriate style ... - //Checking for unset styles is done by the style cache builder ... - if (!$this->use_classes) { - $attributes = ' style="' . $this->language_data['STYLES']['NUMBERS'][$id] . '"'; - } else { - $attributes = ' class="nu'.$id.'"'; - } - - //Set in the correct styles ... - $stuff_to_parse = str_replace("/NUM!$id/", $attributes, $stuff_to_parse); - // } - } - } - - // Highlight methods and fields in objects - if ($this->lexic_permissions['METHODS'] && $this->language_data['OOLANG']) { - $oolang_spaces = "[\s]*"; - $oolang_before = ""; - $oolang_after = "[a-zA-Z][a-zA-Z0-9_]*"; - if (isset($this->language_data['PARSER_CONTROL'])) { - if (isset($this->language_data['PARSER_CONTROL']['OOLANG'])) { - if (isset($this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_BEFORE'])) { - $oolang_before = $this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_BEFORE']; - } - if (isset($this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_AFTER'])) { - $oolang_after = $this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_AFTER']; - } - if (isset($this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_SPACES'])) { - $oolang_spaces = $this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_SPACES']; - } - } - } - - foreach ($this->language_data['OBJECT_SPLITTERS'] as $key => $splitter) { - if (false !== strpos($stuff_to_parse, $splitter)) { - if (!$this->use_classes) { - $attributes = ' style="' . $this->language_data['STYLES']['METHODS'][$key] . '"'; - } else { - $attributes = ' class="me' . $key . '"'; - } - $stuff_to_parse = preg_replace("/($oolang_before)(" . preg_quote($this->language_data['OBJECT_SPLITTERS'][$key], '/') . ")($oolang_spaces)($oolang_after)/", "\\1\\2\\3<|$attributes>\\4|>", $stuff_to_parse); - } - } - } - - // - // Highlight brackets. Yes, I've tried adding a semi-colon to this list. - // You try it, and see what happens ;) - // TODO: Fix lexic permissions not converting entities if shouldn't - // be highlighting regardless - // - if ($this->lexic_permissions['BRACKETS']) { - $stuff_to_parse = str_replace( $this->language_data['CACHE_BRACKET_MATCH'], - $this->language_data['CACHE_BRACKET_REPLACE'], $stuff_to_parse ); - } - - - //FIX for symbol highlighting ... - if ($this->lexic_permissions['SYMBOLS'] && !empty($this->language_data['SYMBOLS'])) { - //Get all matches and throw away those witin a block that is already highlighted... (i.e. matched by a regexp) - $n_symbols = preg_match_all("/<\|(?:|[^>])+>(?:(?!\|>).*?)\|>|<\/a>|(?:" . $this->language_data['SYMBOL_SEARCH'] . ")+(?![^<]+?>)/", $stuff_to_parse, $pot_symbols, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); - $global_offset = 0; - for ($s_id = 0; $s_id < $n_symbols; ++$s_id) { - $symbol_match = $pot_symbols[$s_id][0][0]; - if (strpos($symbol_match, '<') !== false || strpos($symbol_match, '>') !== false) { - // already highlighted blocks _must_ include either < or > - // so if this conditional applies, we have to skip this match - // BenBE: UNLESS the block contains or - if(strpos($symbol_match, '') === false && - strpos($symbol_match, '') === false) { - continue; - } - } - - // if we reach this point, we have a valid match which needs to be highlighted - - $symbol_length = strlen($symbol_match); - $symbol_offset = $pot_symbols[$s_id][0][1]; - unset($pot_symbols[$s_id]); - $symbol_end = $symbol_length + $symbol_offset; - $symbol_hl = ""; - - // if we have multiple styles, we have to handle them properly - if ($this->language_data['MULTIPLE_SYMBOL_GROUPS']) { - $old_sym = -1; - // Split the current stuff to replace into its atomic symbols ... - preg_match_all("/" . $this->language_data['SYMBOL_SEARCH'] . "/", $symbol_match, $sym_match_syms, PREG_PATTERN_ORDER); - foreach ($sym_match_syms[0] as $sym_ms) { - //Check if consequtive symbols belong to the same group to save output ... - if (isset($this->language_data['SYMBOL_DATA'][$sym_ms]) - && ($this->language_data['SYMBOL_DATA'][$sym_ms] != $old_sym)) { - if (-1 != $old_sym) { - $symbol_hl .= "|>"; - } - $old_sym = $this->language_data['SYMBOL_DATA'][$sym_ms]; - if (!$this->use_classes) { - $symbol_hl .= '<| style="' . $this->language_data['STYLES']['SYMBOLS'][$old_sym] . '">'; - } else { - $symbol_hl .= '<| class="sy' . $old_sym . '">'; - } - } - $symbol_hl .= $sym_ms; - } - unset($sym_match_syms); - - //Close remaining tags and insert the replacement at the right position ... - //Take caution if symbol_hl is empty to avoid doubled closing spans. - if (-1 != $old_sym) { - $symbol_hl .= "|>"; - } - } else { - if (!$this->use_classes) { - $symbol_hl = '<| style="' . $this->language_data['STYLES']['SYMBOLS'][0] . '">'; - } else { - $symbol_hl = '<| class="sy0">'; - } - $symbol_hl .= $symbol_match . '|>'; - } - - $stuff_to_parse = substr_replace($stuff_to_parse, $symbol_hl, $symbol_offset + $global_offset, $symbol_length); - - // since we replace old text with something of different size, - // we'll have to keep track of the differences - $global_offset += strlen($symbol_hl) - $symbol_length; - } - } - //FIX for symbol highlighting ... - - // Add class/style for regexps - foreach (array_keys($this->language_data['REGEXPS']) as $key) { - if ($this->lexic_permissions['REGEXPS'][$key]) { - if (is_callable($this->language_data['STYLES']['REGEXPS'][$key])) { - $this->_rx_key = $key; - $stuff_to_parse = preg_replace_callback("/!REG3XP$key!(.*)\|>/U", - array($this, 'handle_regexps_callback'), - $stuff_to_parse); - } else { - if (!$this->use_classes) { - $attributes = ' style="' . $this->language_data['STYLES']['REGEXPS'][$key] . '"'; - } else { - if (is_array($this->language_data['REGEXPS'][$key]) && - array_key_exists(GESHI_CLASS, $this->language_data['REGEXPS'][$key])) { - $attributes = ' class="' . - $this->language_data['REGEXPS'][$key][GESHI_CLASS] . '"'; - } else { - $attributes = ' class="re' . $key . '"'; - } - } - $stuff_to_parse = str_replace("!REG3XP$key!", "$attributes", $stuff_to_parse); - } - } - } - - // Replace with . for urls - $stuff_to_parse = str_replace('', '.', $stuff_to_parse); - // Replace <|UR1| with link_styles[GESHI_LINK])) { - if ($this->use_classes) { - $stuff_to_parse = str_replace('<|UR1|', 'link_target . ' href=', $stuff_to_parse); - } else { - $stuff_to_parse = str_replace('<|UR1|', 'link_target . ' style="' . $this->link_styles[GESHI_LINK] . '" href=', $stuff_to_parse); - } - } else { - $stuff_to_parse = str_replace('<|UR1|', 'link_target . ' href=', $stuff_to_parse); - } - - // - // NOW we add the span thingy ;) - // - - $stuff_to_parse = str_replace('<|', '', '', $stuff_to_parse ); - return substr($stuff_to_parse, 1); - } - - /** - * Sets the time taken to parse the code - * - * @param microtime The time when parsing started - * @param microtime The time when parsing ended - * @since 1.0.2 - * @access private - */ - function set_time($start_time, $end_time) { - $start = explode(' ', $start_time); - $end = explode(' ', $end_time); - $this->time = $end[0] + $end[1] - $start[0] - $start[1]; - } - - /** - * Gets the time taken to parse the code - * - * @return double The time taken to parse the code - * @since 1.0.2 - */ - function get_time() { - return $this->time; - } - - /** - * Merges arrays recursively, overwriting values of the first array with values of later arrays - * - * @since 1.0.8 - * @access private - */ - function merge_arrays() { - $arrays = func_get_args(); - $narrays = count($arrays); - - // check arguments - // comment out if more performance is necessary (in this case the foreach loop will trigger a warning if the argument is not an array) - for ($i = 0; $i < $narrays; $i ++) { - if (!is_array($arrays[$i])) { - // also array_merge_recursive returns nothing in this case - trigger_error('Argument #' . ($i+1) . ' is not an array - trying to merge array with scalar! Returning false!', E_USER_WARNING); - return false; - } - } - - // the first array is in the output set in every case - $ret = $arrays[0]; - - // merege $ret with the remaining arrays - for ($i = 1; $i < $narrays; $i ++) { - foreach ($arrays[$i] as $key => $value) { - if (is_array($value) && isset($ret[$key])) { - // if $ret[$key] is not an array you try to merge an scalar value with an array - the result is not defined (incompatible arrays) - // in this case the call will trigger an E_USER_WARNING and the $ret[$key] will be false. - $ret[$key] = $this->merge_arrays($ret[$key], $value); - } else { - $ret[$key] = $value; - } - } - } - - return $ret; - } - - /** - * Gets language information and stores it for later use - * - * @param string The filename of the language file you want to load - * @since 1.0.0 - * @access private - * @todo Needs to load keys for lexic permissions for keywords, regexps etc - */ - function load_language($file_name) { - if ($file_name == $this->loaded_language) { - // this file is already loaded! - return; - } - - //Prepare some stuff before actually loading the language file - $this->loaded_language = $file_name; - $this->parse_cache_built = false; - $this->enable_highlighting(); - $language_data = array(); - - //Load the language file - require $file_name; - - // Perhaps some checking might be added here later to check that - // $language data is a valid thing but maybe not - $this->language_data = $language_data; - - // Set strict mode if should be set - $this->strict_mode = $this->language_data['STRICT_MODE_APPLIES']; - - // Set permissions for all lexics to true - // so they'll be highlighted by default - foreach (array_keys($this->language_data['KEYWORDS']) as $key) { - if (!empty($this->language_data['KEYWORDS'][$key])) { - $this->lexic_permissions['KEYWORDS'][$key] = true; - } else { - $this->lexic_permissions['KEYWORDS'][$key] = false; - } - } - - foreach (array_keys($this->language_data['COMMENT_SINGLE']) as $key) { - $this->lexic_permissions['COMMENTS'][$key] = true; - } - foreach (array_keys($this->language_data['REGEXPS']) as $key) { - $this->lexic_permissions['REGEXPS'][$key] = true; - } - - // for BenBE and future code reviews: - // we can use empty here since we only check for existance and emptiness of an array - // if it is not an array at all but rather false or null this will work as intended as well - // even if $this->language_data['PARSER_CONTROL'] is undefined this won't trigger a notice - if (!empty($this->language_data['PARSER_CONTROL']['ENABLE_FLAGS'])) { - foreach ($this->language_data['PARSER_CONTROL']['ENABLE_FLAGS'] as $flag => $value) { - // it's either true or false and maybe is true as well - $perm = $value !== GESHI_NEVER; - if ($flag == 'ALL') { - $this->enable_highlighting($perm); - continue; - } - if (!isset($this->lexic_permissions[$flag])) { - // unknown lexic permission - continue; - } - if (is_array($this->lexic_permissions[$flag])) { - foreach ($this->lexic_permissions[$flag] as $key => $val) { - $this->lexic_permissions[$flag][$key] = $perm; - } - } else { - $this->lexic_permissions[$flag] = $perm; - } - } - unset($this->language_data['PARSER_CONTROL']['ENABLE_FLAGS']); - } - - //Fix: Problem where hardescapes weren't handled if no ESCAPE_CHAR was given - //You need to set one for HARDESCAPES only in this case. - if(!isset($this->language_data['HARDCHAR'])) { - $this->language_data['HARDCHAR'] = $this->language_data['ESCAPE_CHAR']; - } - - //NEW in 1.0.8: Allow styles to be loaded from a separate file to override defaults - $style_filename = substr($file_name, 0, -4) . '.style.php'; - if (is_readable($style_filename)) { - //Clear any style_data that could have been set before ... - if (isset($style_data)) { - unset($style_data); - } - - //Read the Style Information from the style file - include $style_filename; - - //Apply the new styles to our current language styles - if (isset($style_data) && is_array($style_data)) { - $this->language_data['STYLES'] = - $this->merge_arrays($this->language_data['STYLES'], $style_data); - } - } - } - - /** - * Takes the parsed code and various options, and creates the HTML - * surrounding it to make it look nice. - * - * @param string The code already parsed (reference!) - * @since 1.0.0 - * @access private - */ - function finalise(&$parsed_code) { - // Remove end parts of important declarations - // This is BUGGY!! My fault for bad code: fix coming in 1.2 - // @todo Remove this crap - if ($this->enable_important_blocks && - (strpos($parsed_code, $this->hsc(GESHI_START_IMPORTANT)) === false)) { - $parsed_code = str_replace($this->hsc(GESHI_END_IMPORTANT), '', $parsed_code); - } - - // Add HTML whitespace stuff if we're using the
    header - if ($this->header_type != GESHI_HEADER_PRE && $this->header_type != GESHI_HEADER_PRE_VALID) { - $this->indent($parsed_code); - } - - // purge some unnecessary stuff - /** NOTE: memorypeak #1 */ - $parsed_code = preg_replace('#]+>(\s*)#', '\\1', $parsed_code); - - // If we are using IDs for line numbers, there needs to be an overall - // ID set to prevent collisions. - if ($this->add_ids && !$this->overall_id) { - $this->overall_id = 'geshi-' . substr(md5(microtime()), 0, 4); - } - - // Get code into lines - /** NOTE: memorypeak #2 */ - $code = explode("\n", $parsed_code); - $parsed_code = $this->header(); - - // If we're using line numbers, we insert
  • s and appropriate - // markup to style them (otherwise we don't need to do anything) - if ($this->line_numbers != GESHI_NO_LINE_NUMBERS && $this->header_type != GESHI_HEADER_PRE_TABLE) { - // If we're using the
     header, we shouldn't add newlines because
    -            // the 
     will line-break them (and the 
  • s already do this for us) - $ls = ($this->header_type != GESHI_HEADER_PRE && $this->header_type != GESHI_HEADER_PRE_VALID) ? "\n" : ''; - - // Set vars to defaults for following loop - $i = 0; - - // Foreach line... - for ($i = 0, $n = count($code); $i < $n;) { - //Reset the attributes for a new line ... - $attrs = array(); - - // Make lines have at least one space in them if they're empty - // BenBE: Checking emptiness using trim instead of relying on blanks - if ('' == trim($code[$i])) { - $code[$i] = ' '; - } - - // If this is a "special line"... - if ($this->line_numbers == GESHI_FANCY_LINE_NUMBERS && - $i % $this->line_nth_row == ($this->line_nth_row - 1)) { - // Set the attributes to style the line - if ($this->use_classes) { - //$attr = ' class="li2"'; - $attrs['class'][] = 'li2'; - $def_attr = ' class="de2"'; - } else { - //$attr = ' style="' . $this->line_style2 . '"'; - $attrs['style'][] = $this->line_style2; - // This style "covers up" the special styles set for special lines - // so that styles applied to special lines don't apply to the actual - // code on that line - $def_attr = ' style="' . $this->code_style . '"'; - } - } else { - if ($this->use_classes) { - //$attr = ' class="li1"'; - $attrs['class'][] = 'li1'; - $def_attr = ' class="de1"'; - } else { - //$attr = ' style="' . $this->line_style1 . '"'; - $attrs['style'][] = $this->line_style1; - $def_attr = ' style="' . $this->code_style . '"'; - } - } - - //Check which type of tag to insert for this line - if ($this->header_type == GESHI_HEADER_PRE_VALID) { - $start = ""; - $end = '
  • '; - } else { - // Span or div? - $start = ""; - $end = ''; - } - - ++$i; - - // Are we supposed to use ids? If so, add them - if ($this->add_ids) { - $attrs['id'][] = "$this->overall_id-$i"; - } - - //Is this some line with extra styles??? - if (in_array($i, $this->highlight_extra_lines)) { - if ($this->use_classes) { - if (isset($this->highlight_extra_lines_styles[$i])) { - $attrs['class'][] = "lx$i"; - } else { - $attrs['class'][] = "ln-xtra"; - } - } else { - array_push($attrs['style'], $this->get_line_style($i)); - } - } - - // Add in the line surrounded by appropriate list HTML - $attr_string = ''; - foreach ($attrs as $key => $attr) { - $attr_string .= ' ' . $key . '="' . implode(' ', $attr) . '"'; - } - - $parsed_code .= "$start{$code[$i-1]}$end
  • $ls"; - unset($code[$i - 1]); - } - } else { - $n = count($code); - if ($this->use_classes) { - $attributes = ' class="de1"'; - } else { - $attributes = ' style="'. $this->code_style .'"'; - } - if ($this->header_type == GESHI_HEADER_PRE_VALID) { - $parsed_code .= ''; - } elseif ($this->header_type == GESHI_HEADER_PRE_TABLE) { - if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) { - if ($this->use_classes) { - $attrs = ' class="ln"'; - } else { - $attrs = ' style="'. $this->table_linenumber_style .'"'; - } - $parsed_code .= ''; - // get linenumbers - // we don't merge it with the for below, since it should be better for - // memory consumption this way - // @todo: but... actually it would still be somewhat nice to merge the two loops - // the mem peaks are at different positions - for ($i = 0; $i < $n; ++$i) { - $close = 0; - // fancy lines - if ($this->line_numbers == GESHI_FANCY_LINE_NUMBERS && - $i % $this->line_nth_row == ($this->line_nth_row - 1)) { - // Set the attributes to style the line - if ($this->use_classes) { - $parsed_code .= ''; - } else { - // This style "covers up" the special styles set for special lines - // so that styles applied to special lines don't apply to the actual - // code on that line - $parsed_code .= '' - .''; - } - $close += 2; - } - //Is this some line with extra styles??? - if (in_array($i + 1, $this->highlight_extra_lines)) { - if ($this->use_classes) { - if (isset($this->highlight_extra_lines_styles[$i])) { - $parsed_code .= ""; - } else { - $parsed_code .= ""; - } - } else { - $parsed_code .= "get_line_style($i) . "\">"; - } - ++$close; - } - $parsed_code .= $this->line_numbers_start + $i; - if ($close) { - $parsed_code .= str_repeat('', $close); - } elseif ($i != $n) { - $parsed_code .= "\n"; - } - } - $parsed_code .= ''; - } - $parsed_code .= ''; - } - // No line numbers, but still need to handle highlighting lines extra. - // Have to use divs so the full width of the code is highlighted - $close = 0; - for ($i = 0; $i < $n; ++$i) { - // Make lines have at least one space in them if they're empty - // BenBE: Checking emptiness using trim instead of relying on blanks - if ('' == trim($code[$i])) { - $code[$i] = ' '; - } - // fancy lines - if ($this->line_numbers == GESHI_FANCY_LINE_NUMBERS && - $i % $this->line_nth_row == ($this->line_nth_row - 1)) { - // Set the attributes to style the line - if ($this->use_classes) { - $parsed_code .= ''; - } else { - // This style "covers up" the special styles set for special lines - // so that styles applied to special lines don't apply to the actual - // code on that line - $parsed_code .= '' - .''; - } - $close += 2; - } - //Is this some line with extra styles??? - if (in_array($i + 1, $this->highlight_extra_lines)) { - if ($this->use_classes) { - if (isset($this->highlight_extra_lines_styles[$i])) { - $parsed_code .= ""; - } else { - $parsed_code .= ""; - } - } else { - $parsed_code .= "get_line_style($i) . "\">"; - } - ++$close; - } - - $parsed_code .= $code[$i]; - - if ($close) { - $parsed_code .= str_repeat('', $close); - $close = 0; - } - elseif ($i + 1 < $n) { - $parsed_code .= "\n"; - } - unset($code[$i]); - } - - if ($this->header_type == GESHI_HEADER_PRE_VALID || $this->header_type == GESHI_HEADER_PRE_TABLE) { - $parsed_code .= ''; - } - if ($this->header_type == GESHI_HEADER_PRE_TABLE && $this->line_numbers != GESHI_NO_LINE_NUMBERS) { - $parsed_code .= ''; - } - } - - $parsed_code .= $this->footer(); - } - - /** - * Creates the header for the code block (with correct attributes) - * - * @return string The header for the code block - * @since 1.0.0 - * @access private - */ - function header() { - // Get attributes needed - /** - * @todo Document behaviour change - class is outputted regardless of whether - * we're using classes or not. Same with style - */ - $attributes = ' class="' . $this->_genCSSName($this->language); - if ($this->overall_class != '') { - $attributes .= " ".$this->_genCSSName($this->overall_class); - } - $attributes .= '"'; - - if ($this->overall_id != '') { - $attributes .= " id=\"{$this->overall_id}\""; - } - if ($this->overall_style != '' && !$this->use_classes) { - $attributes .= ' style="' . $this->overall_style . '"'; - } - - $ol_attributes = ''; - - if ($this->line_numbers_start != 1) { - $ol_attributes .= ' start="' . $this->line_numbers_start . '"'; - } - - // Get the header HTML - $header = $this->header_content; - if ($header) { - if ($this->header_type == GESHI_HEADER_PRE || $this->header_type == GESHI_HEADER_PRE_VALID) { - $header = str_replace("\n", '', $header); - } - $header = $this->replace_keywords($header); - - if ($this->use_classes) { - $attr = ' class="head"'; - } else { - $attr = " style=\"{$this->header_content_style}\""; - } - if ($this->header_type == GESHI_HEADER_PRE_TABLE && $this->line_numbers != GESHI_NO_LINE_NUMBERS) { - $header = "$header"; - } else { - $header = "$header"; - } - } - - if (GESHI_HEADER_NONE == $this->header_type) { - if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) { - return "$header"; - } - return $header . ($this->force_code_block ? '
    ' : ''); - } - - // Work out what to return and do it - if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) { - if ($this->header_type == GESHI_HEADER_PRE) { - return "$header"; - } elseif ($this->header_type == GESHI_HEADER_DIV || - $this->header_type == GESHI_HEADER_PRE_VALID) { - return "$header"; - } elseif ($this->header_type == GESHI_HEADER_PRE_TABLE) { - return "$header"; - } - } else { - if ($this->header_type == GESHI_HEADER_PRE) { - return "$header" . - ($this->force_code_block ? '
    ' : ''); - } else { - return "$header" . - ($this->force_code_block ? '
    ' : ''); - } - } - } - - /** - * Returns the footer for the code block. - * - * @return string The footer for the code block - * @since 1.0.0 - * @access private - */ - function footer() { - $footer = $this->footer_content; - if ($footer) { - if ($this->header_type == GESHI_HEADER_PRE) { - $footer = str_replace("\n", '', $footer);; - } - $footer = $this->replace_keywords($footer); - - if ($this->use_classes) { - $attr = ' class="foot"'; - } else { - $attr = " style=\"{$this->footer_content_style}\""; - } - if ($this->header_type == GESHI_HEADER_PRE_TABLE && $this->line_numbers != GESHI_NO_LINE_NUMBERS) { - $footer = "$footer"; - } else { - $footer = "$footer
    "; - } - } - - if (GESHI_HEADER_NONE == $this->header_type) { - return ($this->line_numbers != GESHI_NO_LINE_NUMBERS) ? '' . $footer : $footer; - } - - if ($this->header_type == GESHI_HEADER_DIV || $this->header_type == GESHI_HEADER_PRE_VALID) { - if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) { - return "$footer
    "; - } - return ($this->force_code_block ? '
    ' : '') . - "$footer"; - } - elseif ($this->header_type == GESHI_HEADER_PRE_TABLE) { - if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) { - return "$footer"; - } - return ($this->force_code_block ? '' : '') . - "$footer"; - } - else { - if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) { - return "$footer"; - } - return ($this->force_code_block ? '' : '') . - "$footer"; - } - } - - /** - * Replaces certain keywords in the header and footer with - * certain configuration values - * - * @param string The header or footer content to do replacement on - * @return string The header or footer with replaced keywords - * @since 1.0.2 - * @access private - */ - function replace_keywords($instr) { - $keywords = $replacements = array(); - - $keywords[] = '
      to have no effect at all if there are line numbers - // (
        s have margins that should be destroyed so all layout is - // controlled by the set_overall_style method, which works on the - //
         or 
        container). Additionally, set default styles for lines - if (!$economy_mode || $this->line_numbers != GESHI_NO_LINE_NUMBERS) { - //$stylesheet .= "$selector, {$selector}ol, {$selector}ol li {margin: 0;}\n"; - $stylesheet .= "$selector.de1, $selector.de2 {{$this->code_style}}\n"; - } - - // Add overall styles - // note: neglect economy_mode, empty styles are meaningless - if ($this->overall_style != '') { - $stylesheet .= "$selector {{$this->overall_style}}\n"; - } - - // Add styles for links - // note: economy mode does not make _any_ sense here - // either the style is empty and thus no selector is needed - // or the appropriate key is given. - foreach ($this->link_styles as $key => $style) { - if ($style != '') { - switch ($key) { - case GESHI_LINK: - $stylesheet .= "{$selector}a:link {{$style}}\n"; - break; - case GESHI_HOVER: - $stylesheet .= "{$selector}a:hover {{$style}}\n"; - break; - case GESHI_ACTIVE: - $stylesheet .= "{$selector}a:active {{$style}}\n"; - break; - case GESHI_VISITED: - $stylesheet .= "{$selector}a:visited {{$style}}\n"; - break; - } - } - } - - // Header and footer - // note: neglect economy_mode, empty styles are meaningless - if ($this->header_content_style != '') { - $stylesheet .= "$selector.head {{$this->header_content_style}}\n"; - } - if ($this->footer_content_style != '') { - $stylesheet .= "$selector.foot {{$this->footer_content_style}}\n"; - } - - // Styles for important stuff - // note: neglect economy_mode, empty styles are meaningless - if ($this->important_styles != '') { - $stylesheet .= "$selector.imp {{$this->important_styles}}\n"; - } - - // Simple line number styles - if ((!$economy_mode || $this->line_numbers != GESHI_NO_LINE_NUMBERS) && $this->line_style1 != '') { - $stylesheet .= "{$selector}li, {$selector}.li1 {{$this->line_style1}}\n"; - } - if ((!$economy_mode || $this->line_numbers != GESHI_NO_LINE_NUMBERS) && $this->table_linenumber_style != '') { - $stylesheet .= "{$selector}.ln {{$this->table_linenumber_style}}\n"; - } - // If there is a style set for fancy line numbers, echo it out - if ((!$economy_mode || $this->line_numbers == GESHI_FANCY_LINE_NUMBERS) && $this->line_style2 != '') { - $stylesheet .= "{$selector}.li2 {{$this->line_style2}}\n"; - } - - // note: empty styles are meaningless - foreach ($this->language_data['STYLES']['KEYWORDS'] as $group => $styles) { - if ($styles != '' && (!$economy_mode || - (isset($this->lexic_permissions['KEYWORDS'][$group]) && - $this->lexic_permissions['KEYWORDS'][$group]))) { - $stylesheet .= "$selector.kw$group {{$styles}}\n"; - } - } - foreach ($this->language_data['STYLES']['COMMENTS'] as $group => $styles) { - if ($styles != '' && (!$economy_mode || - (isset($this->lexic_permissions['COMMENTS'][$group]) && - $this->lexic_permissions['COMMENTS'][$group]) || - (!empty($this->language_data['COMMENT_REGEXP']) && - !empty($this->language_data['COMMENT_REGEXP'][$group])))) { - $stylesheet .= "$selector.co$group {{$styles}}\n"; - } - } - foreach ($this->language_data['STYLES']['ESCAPE_CHAR'] as $group => $styles) { - if ($styles != '' && (!$economy_mode || $this->lexic_permissions['ESCAPE_CHAR'])) { - // NEW: since 1.0.8 we have to handle hardescapes - if ($group === 'HARD') { - $group = '_h'; - } - $stylesheet .= "$selector.es$group {{$styles}}\n"; - } - } - foreach ($this->language_data['STYLES']['BRACKETS'] as $group => $styles) { - if ($styles != '' && (!$economy_mode || $this->lexic_permissions['BRACKETS'])) { - $stylesheet .= "$selector.br$group {{$styles}}\n"; - } - } - foreach ($this->language_data['STYLES']['SYMBOLS'] as $group => $styles) { - if ($styles != '' && (!$economy_mode || $this->lexic_permissions['SYMBOLS'])) { - $stylesheet .= "$selector.sy$group {{$styles}}\n"; - } - } - foreach ($this->language_data['STYLES']['STRINGS'] as $group => $styles) { - if ($styles != '' && (!$economy_mode || $this->lexic_permissions['STRINGS'])) { - // NEW: since 1.0.8 we have to handle hardquotes - if ($group === 'HARD') { - $group = '_h'; - } - $stylesheet .= "$selector.st$group {{$styles}}\n"; - } - } - foreach ($this->language_data['STYLES']['NUMBERS'] as $group => $styles) { - if ($styles != '' && (!$economy_mode || $this->lexic_permissions['NUMBERS'])) { - $stylesheet .= "$selector.nu$group {{$styles}}\n"; - } - } - foreach ($this->language_data['STYLES']['METHODS'] as $group => $styles) { - if ($styles != '' && (!$economy_mode || $this->lexic_permissions['METHODS'])) { - $stylesheet .= "$selector.me$group {{$styles}}\n"; - } - } - // note: neglect economy_mode, empty styles are meaningless - foreach ($this->language_data['STYLES']['SCRIPT'] as $group => $styles) { - if ($styles != '') { - $stylesheet .= "$selector.sc$group {{$styles}}\n"; - } - } - foreach ($this->language_data['STYLES']['REGEXPS'] as $group => $styles) { - if ($styles != '' && (!$economy_mode || - (isset($this->lexic_permissions['REGEXPS'][$group]) && - $this->lexic_permissions['REGEXPS'][$group]))) { - if (is_array($this->language_data['REGEXPS'][$group]) && - array_key_exists(GESHI_CLASS, $this->language_data['REGEXPS'][$group])) { - $stylesheet .= "$selector."; - $stylesheet .= $this->language_data['REGEXPS'][$group][GESHI_CLASS]; - $stylesheet .= " {{$styles}}\n"; - } else { - $stylesheet .= "$selector.re$group {{$styles}}\n"; - } - } - } - // Styles for lines being highlighted extra - if (!$economy_mode || (count($this->highlight_extra_lines)!=count($this->highlight_extra_lines_styles))) { - $stylesheet .= "{$selector}.ln-xtra, {$selector}li.ln-xtra, {$selector}div.ln-xtra {{$this->highlight_extra_lines_style}}\n"; - } - $stylesheet .= "{$selector}span.xtra { display:block; }\n"; - foreach ($this->highlight_extra_lines_styles as $lineid => $linestyle) { - $stylesheet .= "{$selector}.lx$lineid, {$selector}li.lx$lineid, {$selector}div.lx$lineid {{$linestyle}}\n"; - } - - return $stylesheet; - } - - /** - * Get's the style that is used for the specified line - * - * @param int The line number information is requested for - * @access private - * @since 1.0.7.21 - */ - function get_line_style($line) { - //$style = null; - $style = null; - if (isset($this->highlight_extra_lines_styles[$line])) { - $style = $this->highlight_extra_lines_styles[$line]; - } else { // if no "extra" style assigned - $style = $this->highlight_extra_lines_style; - } - - return $style; - } - - /** - * this functions creates an optimized regular expression list - * of an array of strings. - * - * Example: - * $list = array('faa', 'foo', 'foobar'); - * => string 'f(aa|oo(bar)?)' - * - * @param $list array of (unquoted) strings - * @param $regexp_delimiter your regular expression delimiter, @see preg_quote() - * @return string for regular expression - * @author Milian Wolff - * @since 1.0.8 - * @access private - */ - function optimize_regexp_list($list, $regexp_delimiter = '/') { - $regex_chars = array('.', '\\', '+', '-', '*', '?', '[', '^', ']', '$', - '(', ')', '{', '}', '=', '!', '<', '>', '|', ':', $regexp_delimiter); - sort($list); - $regexp_list = array(''); - $num_subpatterns = 0; - $list_key = 0; - - // the tokens which we will use to generate the regexp list - $tokens = array(); - $prev_keys = array(); - // go through all entries of the list and generate the token list - $cur_len = 0; - for ($i = 0, $i_max = count($list); $i < $i_max; ++$i) { - if ($cur_len > GESHI_MAX_PCRE_LENGTH) { - // seems like the length of this pcre is growing exorbitantly - $regexp_list[++$list_key] = $this->_optimize_regexp_list_tokens_to_string($tokens); - $num_subpatterns = substr_count($regexp_list[$list_key], '(?:'); - $tokens = array(); - $cur_len = 0; - } - $level = 0; - $entry = preg_quote((string) $list[$i], $regexp_delimiter); - $pointer = &$tokens; - // properly assign the new entry to the correct position in the token array - // possibly generate smaller common denominator keys - while (true) { - // get the common denominator - if (isset($prev_keys[$level])) { - if ($prev_keys[$level] == $entry) { - // this is a duplicate entry, skip it - continue 2; - } - $char = 0; - while (isset($entry[$char]) && isset($prev_keys[$level][$char]) - && $entry[$char] == $prev_keys[$level][$char]) { - ++$char; - } - if ($char > 0) { - // this entry has at least some chars in common with the current key - if ($char == strlen($prev_keys[$level])) { - // current key is totally matched, i.e. this entry has just some bits appended - $pointer = &$pointer[$prev_keys[$level]]; - } else { - // only part of the keys match - $new_key_part1 = substr($prev_keys[$level], 0, $char); - $new_key_part2 = substr($prev_keys[$level], $char); - - if (in_array($new_key_part1[0], $regex_chars) - || in_array($new_key_part2[0], $regex_chars)) { - // this is bad, a regex char as first character - $pointer[$entry] = array('' => true); - array_splice($prev_keys, $level, count($prev_keys), $entry); - $cur_len += strlen($entry); - continue; - } else { - // relocate previous tokens - $pointer[$new_key_part1] = array($new_key_part2 => $pointer[$prev_keys[$level]]); - unset($pointer[$prev_keys[$level]]); - $pointer = &$pointer[$new_key_part1]; - // recreate key index - array_splice($prev_keys, $level, count($prev_keys), array($new_key_part1, $new_key_part2)); - $cur_len += strlen($new_key_part2); - } - } - ++$level; - $entry = substr($entry, $char); - continue; - } - // else: fall trough, i.e. no common denominator was found - } - if ($level == 0 && !empty($tokens)) { - // we can dump current tokens into the string and throw them away afterwards - $new_entry = $this->_optimize_regexp_list_tokens_to_string($tokens); - $new_subpatterns = substr_count($new_entry, '(?:'); - if (GESHI_MAX_PCRE_SUBPATTERNS && $num_subpatterns + $new_subpatterns > GESHI_MAX_PCRE_SUBPATTERNS) { - $regexp_list[++$list_key] = $new_entry; - $num_subpatterns = $new_subpatterns; - } else { - if (!empty($regexp_list[$list_key])) { - $new_entry = '|' . $new_entry; - } - $regexp_list[$list_key] .= $new_entry; - $num_subpatterns += $new_subpatterns; - } - $tokens = array(); - $cur_len = 0; - } - // no further common denominator found - $pointer[$entry] = array('' => true); - array_splice($prev_keys, $level, count($prev_keys), $entry); - - $cur_len += strlen($entry); - break; - } - unset($list[$i]); - } - // make sure the last tokens get converted as well - $new_entry = $this->_optimize_regexp_list_tokens_to_string($tokens); - if (GESHI_MAX_PCRE_SUBPATTERNS && $num_subpatterns + substr_count($new_entry, '(?:') > GESHI_MAX_PCRE_SUBPATTERNS) { - if ( !empty($regexp_list[$list_key]) ) { - ++$list_key; - } - $regexp_list[$list_key] = $new_entry; - } else { - if (!empty($regexp_list[$list_key])) { - $new_entry = '|' . $new_entry; - } - $regexp_list[$list_key] .= $new_entry; - } - return $regexp_list; - } - /** - * this function creates the appropriate regexp string of an token array - * you should not call this function directly, @see $this->optimize_regexp_list(). - * - * @param &$tokens array of tokens - * @param $recursed bool to know wether we recursed or not - * @return string - * @author Milian Wolff - * @since 1.0.8 - * @access private - */ - function _optimize_regexp_list_tokens_to_string(&$tokens, $recursed = false) { - $list = ''; - foreach ($tokens as $token => $sub_tokens) { - $list .= $token; - $close_entry = isset($sub_tokens['']); - unset($sub_tokens['']); - if (!empty($sub_tokens)) { - $list .= '(?:' . $this->_optimize_regexp_list_tokens_to_string($sub_tokens, true) . ')'; - if ($close_entry) { - // make sub_tokens optional - $list .= '?'; - } - } - $list .= '|'; - } - if (!$recursed) { - // do some optimizations - // common trailing strings - // BUGGY! - //$list = preg_replace_callback('#(?<=^|\:|\|)\w+?(\w+)(?:\|.+\1)+(?=\|)#', create_function( - // '$matches', 'return "(?:" . preg_replace("#" . preg_quote($matches[1], "#") . "(?=\||$)#", "", $matches[0]) . ")" . $matches[1];'), $list); - // (?:p)? => p? - $list = preg_replace('#\(\?\:(.)\)\?#', '\1?', $list); - // (?:a|b|c|d|...)? => [abcd...]? - // TODO: a|bb|c => [ac]|bb - static $callback_2; - if (!isset($callback_2)) { - $callback_2 = create_function('$matches', 'return "[" . str_replace("|", "", $matches[1]) . "]";'); - } - $list = preg_replace_callback('#\(\?\:((?:.\|)+.)\)#', $callback_2, $list); - } - // return $list without trailing pipe - return substr($list, 0, -1); - } -} // End Class GeSHi - - -if (!function_exists('geshi_highlight')) { - /** - * Easy way to highlight stuff. Behaves just like highlight_string - * - * @param string The code to highlight - * @param string The language to highlight the code in - * @param string The path to the language files. You can leave this blank if you need - * as from version 1.0.7 the path should be automatically detected - * @param boolean Whether to return the result or to echo - * @return string The code highlighted (if $return is true) - * @since 1.0.2 - */ - function geshi_highlight($string, $language, $path = null, $return = false) { - $geshi = new GeSHi($string, $language, $path); - $geshi->set_header_type(GESHI_HEADER_NONE); - - if ($return) { - return '' . $geshi->parse_code() . ''; - } - - echo '' . $geshi->parse_code() . ''; - - if ($geshi->error()) { - return false; - } - return true; - } -} - -?> \ No newline at end of file diff --git a/htdocs/site/geshi/geshi/c.php b/htdocs/site/geshi/geshi/c.php deleted file mode 100644 index 35d5b019d..000000000 --- a/htdocs/site/geshi/geshi/c.php +++ /dev/null @@ -1,281 +0,0 @@ - 'C', - 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'), - 'COMMENT_MULTI' => array('/*' => '*/'), - 'COMMENT_REGEXP' => array( - //Multiline-continued single-line comments - 1 => '/\/\/(?:\\\\\\\\|\\\\\\n|.)*$/m', - //Multiline-continued preprocessor define - 2 => '/#(?:\\\\\\\\|\\\\\\n|.)*$/m' - ), - 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, - 'QUOTEMARKS' => array("'", '"'), - 'ESCAPE_CHAR' => '', - 'ESCAPE_REGEXP' => array( - //Simple Single Char Escapes - 1 => "#\\\\[\\\\abfnrtv\'\"?\n]#i", - //Hexadecimal Char Specs - 2 => "#\\\\x[\da-fA-F]{2}#", - //Hexadecimal Char Specs - 3 => "#\\\\u[\da-fA-F]{4}#", - //Hexadecimal Char Specs - 4 => "#\\\\U[\da-fA-F]{8}#", - //Octal Char Specs - 5 => "#\\\\[0-7]{1,3}#" - ), - '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, - 'KEYWORDS' => array( - 1 => array( - 'if', 'return', 'while', 'case', 'continue', 'default', - 'do', 'else', 'for', 'switch', 'goto' - ), - 2 => array( - 'null', 'false', 'break', 'true', 'function', 'enum', 'extern', 'inline' - ), - 3 => array( - // assert.h - 'assert', - - //complex.h - 'cabs', 'cacos', 'cacosh', 'carg', 'casin', 'casinh', 'catan', - 'catanh', 'ccos', 'ccosh', 'cexp', 'cimag', 'cis', 'clog', 'conj', - 'cpow', 'cproj', 'creal', 'csin', 'csinh', 'csqrt', 'ctan', 'ctanh', - - //ctype.h - 'digittoint', 'isalnum', 'isalpha', 'isascii', 'isblank', 'iscntrl', - 'isdigit', 'isgraph', 'islower', 'isprint', 'ispunct', 'isspace', - 'isupper', 'isxdigit', 'toascii', 'tolower', 'toupper', - - //inttypes.h - 'imaxabs', 'imaxdiv', 'strtoimax', 'strtoumax', 'wcstoimax', - 'wcstoumax', - - //locale.h - 'localeconv', 'setlocale', - - //math.h - 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'cosh', 'exp', - 'fabs', 'floor', 'frexp', 'ldexp', 'log', 'log10', 'modf', 'pow', - 'sin', 'sinh', 'sqrt', 'tan', 'tanh', - - //setjmp.h - 'longjmp', 'setjmp', - - //signal.h - 'raise', - - //stdarg.h - 'va_arg', 'va_copy', 'va_end', 'va_start', - - //stddef.h - 'offsetof', - - //stdio.h - 'clearerr', 'fclose', 'fdopen', 'feof', 'ferror', 'fflush', 'fgetc', - 'fgetpos', 'fgets', 'fopen', 'fprintf', 'fputc', 'fputchar', - 'fputs', 'fread', 'freopen', 'fscanf', 'fseek', 'fsetpos', 'ftell', - 'fwrite', 'getc', 'getch', 'getchar', 'gets', 'perror', 'printf', - 'putc', 'putchar', 'puts', 'remove', 'rename', 'rewind', 'scanf', - 'setbuf', 'setvbuf', 'snprintf', 'sprintf', 'sscanf', 'tmpfile', - 'tmpnam', 'ungetc', 'vfprintf', 'vfscanf', 'vprintf', 'vscanf', - 'vsprintf', 'vsscanf', - - //stdlib.h - 'abort', 'abs', 'atexit', 'atof', 'atoi', 'atol', 'bsearch', - 'calloc', 'div', 'exit', 'free', 'getenv', 'itoa', 'labs', 'ldiv', - 'ltoa', 'malloc', 'qsort', 'rand', 'realloc', 'srand', 'strtod', - 'strtol', 'strtoul', 'system', - - //string.h - 'memchr', 'memcmp', 'memcpy', 'memmove', 'memset', 'strcat', - 'strchr', 'strcmp', 'strcoll', 'strcpy', 'strcspn', 'strerror', - 'strlen', 'strncat', 'strncmp', 'strncpy', 'strpbrk', 'strrchr', - 'strspn', 'strstr', 'strtok', 'strxfrm', - - //time.h - 'asctime', 'clock', 'ctime', 'difftime', 'gmtime', 'localtime', - 'mktime', 'strftime', 'time', - - //wchar.h - 'btowc', 'fgetwc', 'fgetws', 'fputwc', 'fputws', 'fwide', - 'fwprintf', 'fwscanf', 'getwc', 'getwchar', 'mbrlen', 'mbrtowc', - 'mbsinit', 'mbsrtowcs', 'putwc', 'putwchar', 'swprintf', 'swscanf', - 'ungetwc', 'vfwprintf', 'vswprintf', 'vwprintf', 'wcrtomb', - 'wcscat', 'wcschr', 'wcscmp', 'wcscoll', 'wcscpy', 'wcscspn', - 'wcsftime', 'wcslen', 'wcsncat', 'wcsncmp', 'wcsncpy', 'wcspbrk', - 'wcsrchr', 'wcsrtombs', 'wcsspn', 'wcsstr', 'wcstod', 'wcstok', - 'wcstol', 'wcstoul', 'wcsxfrm', 'wctob', 'wmemchr', 'wmemcmp', - 'wmemcpy', 'wmemmove', 'wmemset', 'wprintf', 'wscanf', - - //wctype.h - 'iswalnum', 'iswalpha', 'iswcntrl', 'iswctype', 'iswdigit', - 'iswgraph', 'iswlower', 'iswprint', 'iswpunct', 'iswspace', - 'iswupper', 'iswxdigit', 'towctrans', 'towlower', 'towupper', - 'wctrans', 'wctype' - ), - 4 => array( - 'auto', 'char', 'const', 'double', 'float', 'int', 'long', - 'register', 'short', 'signed', 'sizeof', 'static', 'struct', - 'typedef', 'union', 'unsigned', 'void', 'volatile', 'wchar_t', - - 'int8', 'int16', 'int32', 'int64', - 'uint8', 'uint16', 'uint32', 'uint64', - - 'int_fast8_t', 'int_fast16_t', 'int_fast32_t', 'int_fast64_t', - 'uint_fast8_t', 'uint_fast16_t', 'uint_fast32_t', 'uint_fast64_t', - - 'int_least8_t', 'int_least16_t', 'int_least32_t', 'int_least64_t', - 'uint_least8_t', 'uint_least16_t', 'uint_least32_t', 'uint_least64_t', - - 'int8_t', 'int16_t', 'int32_t', 'int64_t', - 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t', - - 'intmax_t', 'uintmax_t', 'intptr_t', 'uintptr_t', - 'size_t', 'off_t' - ), - ), - 'SYMBOLS' => array( - '(', ')', '{', '}', '[', ']', - '+', '-', '*', '/', '%', - '=', '<', '>', - '!', '^', '&', '|', - '?', ':', - ';', ',' - ), - 'CASE_SENSITIVE' => array( - GESHI_COMMENTS => false, - 1 => true, - 2 => true, - 3 => true, - 4 => true, - ), - 'STYLES' => array( - 'KEYWORDS' => array( - 1 => 'color: #b1b100;', - 2 => 'color: #000000; font-weight: bold;', - 3 => 'color: #000066;', - 4 => 'color: #993333;' - ), - 'COMMENTS' => array( - 1 => 'color: #666666; font-style: italic;', - 2 => 'color: #339933;', - 'MULTI' => 'color: #808080; 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: #660099; font-weight: bold;', - 5 => 'color: #006699; font-weight: bold;', - 'HARD' => '', - ), - 'BRACKETS' => array( - 0 => 'color: #009900;' - ), - 'STRINGS' => array( - 0 => 'color: #ff0000;' - ), - 'NUMBERS' => array( - 0 => 'color: #0000dd;', - GESHI_NUMBER_BIN_PREFIX_0B => 'color: #208080;', - GESHI_NUMBER_OCT_PREFIX => 'color: #208080;', - GESHI_NUMBER_HEX_PREFIX => 'color: #208080;', - GESHI_NUMBER_FLT_SCI_SHORT => 'color:#800080;', - GESHI_NUMBER_FLT_SCI_ZERO => 'color:#800080;', - GESHI_NUMBER_FLT_NONSCI_F => 'color:#800080;', - GESHI_NUMBER_FLT_NONSCI => 'color:#800080;' - ), - 'METHODS' => array( - 1 => 'color: #202020;', - 2 => 'color: #202020;' - ), - 'SYMBOLS' => array( - 0 => 'color: #339933;' - ), - 'REGEXPS' => array( - ), - 'SCRIPT' => array( - ) - ), - 'URLS' => array( - 1 => '', - 2 => '', - 3 => 'http://www.opengroup.org/onlinepubs/009695399/functions/{FNAMEL}.html', - 4 => '' - ), - 'OOLANG' => true, - 'OBJECT_SPLITTERS' => array( - 1 => '.', - 2 => '::' - ), - 'REGEXPS' => array( - ), - 'STRICT_MODE_APPLIES' => GESHI_NEVER, - 'SCRIPT_DELIMITERS' => array( - ), - 'HIGHLIGHT_STRICT_BLOCK' => array( - ), - 'TAB_WIDTH' => 4 -); - -?> \ No newline at end of file diff --git a/htdocs/site/geshi/geshi/cpp.php b/htdocs/site/geshi/geshi/cpp.php deleted file mode 100644 index 42ab311cc..000000000 --- a/htdocs/site/geshi/geshi/cpp.php +++ /dev/null @@ -1,240 +0,0 @@ - 'C++', - 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'), - 'COMMENT_MULTI' => array('/*' => '*/'), - 'COMMENT_REGEXP' => array( - //Multiline-continued single-line comments - 1 => '/\/\/(?:\\\\\\\\|\\\\\\n|.)*$/m', - //Multiline-continued preprocessor define - 2 => '/#(?:\\\\\\\\|\\\\\\n|.)*$/m' - ), - 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, - 'QUOTEMARKS' => array("'", '"'), - 'ESCAPE_CHAR' => '', - 'ESCAPE_REGEXP' => array( - //Simple Single Char Escapes - 1 => "#\\\\[abfnrtv\\\'\"?\n]#i", - //Hexadecimal Char Specs - 2 => "#\\\\x[\da-fA-F]{2}#", - //Hexadecimal Char Specs - 3 => "#\\\\u[\da-fA-F]{4}#", - //Hexadecimal Char Specs - 4 => "#\\\\U[\da-fA-F]{8}#", - //Octal Char Specs - 5 => "#\\\\[0-7]{1,3}#" - ), - '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, - 'KEYWORDS' => array( - 1 => array( - 'break', 'case', 'continue', 'default', 'do', 'else', 'for', 'goto', 'if', 'return', - 'switch', 'throw', 'while' - ), - 2 => array( - 'NULL', 'false', 'true', 'enum', 'errno', 'EDOM', - 'ERANGE', 'FLT_RADIX', 'FLT_ROUNDS', 'FLT_DIG', 'DBL_DIG', 'LDBL_DIG', - 'FLT_EPSILON', 'DBL_EPSILON', 'LDBL_EPSILON', 'FLT_MANT_DIG', 'DBL_MANT_DIG', - 'LDBL_MANT_DIG', 'FLT_MAX', 'DBL_MAX', 'LDBL_MAX', 'FLT_MAX_EXP', 'DBL_MAX_EXP', - 'LDBL_MAX_EXP', 'FLT_MIN', 'DBL_MIN', 'LDBL_MIN', 'FLT_MIN_EXP', 'DBL_MIN_EXP', - 'LDBL_MIN_EXP', 'CHAR_BIT', 'CHAR_MAX', 'CHAR_MIN', 'SCHAR_MAX', 'SCHAR_MIN', - 'UCHAR_MAX', 'SHRT_MAX', 'SHRT_MIN', 'USHRT_MAX', 'INT_MAX', 'INT_MIN', - 'UINT_MAX', 'LONG_MAX', 'LONG_MIN', 'ULONG_MAX', 'HUGE_VAL', 'SIGABRT', - 'SIGFPE', 'SIGILL', 'SIGINT', 'SIGSEGV', 'SIGTERM', 'SIG_DFL', 'SIG_ERR', - 'SIG_IGN', 'BUFSIZ', 'EOF', 'FILENAME_MAX', 'FOPEN_MAX', 'L_tmpnam', - 'SEEK_CUR', 'SEEK_END', 'SEEK_SET', 'TMP_MAX', 'stdin', 'stdout', 'stderr', - 'EXIT_FAILURE', 'EXIT_SUCCESS', 'RAND_MAX', 'CLOCKS_PER_SEC', - 'virtual', 'public', 'private', 'protected', 'template', 'using', 'namespace', - 'try', 'catch', 'inline', 'dynamic_cast', 'const_cast', 'reinterpret_cast', - 'static_cast', 'explicit', 'friend', 'typename', 'typeid', 'class' - ), - 3 => array( - 'cin', 'cerr', 'clog', 'cout', 'delete', 'new', 'this', - 'printf', 'fprintf', 'snprintf', 'sprintf', 'assert', - 'isalnum', 'isalpha', 'isdigit', 'iscntrl', 'isgraph', 'islower', 'isprint', - 'ispunct', 'isspace', 'isupper', 'isxdigit', 'tolower', 'toupper', - 'exp', 'log', 'log10', 'pow', 'sqrt', 'ceil', 'floor', 'fabs', 'ldexp', - 'frexp', 'modf', 'fmod', 'sin', 'cos', 'tan', 'asin', 'acos', 'atan', 'atan2', - 'sinh', 'cosh', 'tanh', 'setjmp', 'longjmp', - 'va_start', 'va_arg', 'va_end', 'offsetof', 'sizeof', 'fopen', 'freopen', - 'fflush', 'fclose', 'remove', 'rename', 'tmpfile', 'tmpname', 'setvbuf', - 'setbuf', 'vfprintf', 'vprintf', 'vsprintf', 'fscanf', 'scanf', 'sscanf', - 'fgetc', 'fgets', 'fputc', 'fputs', 'getc', 'getchar', 'gets', 'putc', - 'putchar', 'puts', 'ungetc', 'fread', 'fwrite', 'fseek', 'ftell', 'rewind', - 'fgetpos', 'fsetpos', 'clearerr', 'feof', 'ferror', 'perror', 'abs', 'labs', - 'div', 'ldiv', 'atof', 'atoi', 'atol', 'strtod', 'strtol', 'strtoul', 'calloc', - 'malloc', 'realloc', 'free', 'abort', 'exit', 'atexit', 'system', 'getenv', - 'bsearch', 'qsort', 'rand', 'srand', 'strcpy', 'strncpy', 'strcat', 'strncat', - 'strcmp', 'strncmp', 'strcoll', 'strchr', 'strrchr', 'strspn', 'strcspn', - 'strpbrk', 'strstr', 'strlen', 'strerror', 'strtok', 'strxfrm', 'memcpy', - 'memmove', 'memcmp', 'memchr', 'memset', 'clock', 'time', 'difftime', 'mktime', - 'asctime', 'ctime', 'gmtime', 'localtime', 'strftime' - ), - 4 => array( - 'auto', 'bool', 'char', 'const', 'double', 'float', 'int', 'long', 'longint', - 'register', 'short', 'shortint', 'signed', 'static', 'struct', - 'typedef', 'union', 'unsigned', 'void', 'volatile', 'extern', 'jmp_buf', - 'signal', 'raise', 'va_list', 'ptrdiff_t', 'size_t', 'FILE', 'fpos_t', - 'div_t', 'ldiv_t', 'clock_t', 'time_t', 'tm', 'wchar_t', - - 'int8', 'int16', 'int32', 'int64', - 'uint8', 'uint16', 'uint32', 'uint64', - - 'int_fast8_t', 'int_fast16_t', 'int_fast32_t', 'int_fast64_t', - 'uint_fast8_t', 'uint_fast16_t', 'uint_fast32_t', 'uint_fast64_t', - - 'int_least8_t', 'int_least16_t', 'int_least32_t', 'int_least64_t', - 'uint_least8_t', 'uint_least16_t', 'uint_least32_t', 'uint_least64_t', - - 'int8_t', 'int16_t', 'int32_t', 'int64_t', - 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t', - - 'intmax_t', 'uintmax_t', 'intptr_t', 'uintptr_t' - ), - ), - 'SYMBOLS' => array( - 0 => array('(', ')', '{', '}', '[', ']'), - 1 => array('<', '>','='), - 2 => array('+', '-', '*', '/', '%'), - 3 => array('!', '^', '&', '|'), - 4 => array('?', ':', ';') - ), - 'CASE_SENSITIVE' => array( - GESHI_COMMENTS => false, - 1 => true, - 2 => true, - 3 => true, - 4 => true, - ), - 'STYLES' => array( - 'KEYWORDS' => array( - 1 => 'color: #0000ff;', - 2 => 'color: #0000ff;', - 3 => 'color: #0000dd;', - 4 => 'color: #0000ff;' - ), - 'COMMENTS' => array( - 1 => 'color: #666666;', - 2 => 'color: #339900;', - 'MULTI' => 'color: #ff0000; 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: #660099; font-weight: bold;', - 5 => 'color: #006699; font-weight: bold;', - 'HARD' => '', - ), - 'BRACKETS' => array( - 0 => 'color: #008000;' - ), - 'STRINGS' => array( - 0 => 'color: #FF0000;' - ), - 'NUMBERS' => array( - 0 => 'color: #0000dd;', - GESHI_NUMBER_BIN_PREFIX_0B => 'color: #208080;', - GESHI_NUMBER_OCT_PREFIX => 'color: #208080;', - GESHI_NUMBER_HEX_PREFIX => 'color: #208080;', - GESHI_NUMBER_FLT_SCI_SHORT => 'color:#800080;', - GESHI_NUMBER_FLT_SCI_ZERO => 'color:#800080;', - GESHI_NUMBER_FLT_NONSCI_F => 'color:#800080;', - GESHI_NUMBER_FLT_NONSCI => 'color:#800080;' - ), - 'METHODS' => array( - 1 => 'color: #007788;', - 2 => 'color: #007788;' - ), - 'SYMBOLS' => array( - 0 => 'color: #008000;', - 1 => 'color: #000080;', - 2 => 'color: #000040;', - 3 => 'color: #000040;', - 4 => 'color: #008080;' - ), - 'REGEXPS' => array( - ), - 'SCRIPT' => array( - ) - ), - 'URLS' => array( - 1 => '', - 2 => '', - 3 => '', - 4 => '' - ), - 'OOLANG' => true, - 'OBJECT_SPLITTERS' => array( - 1 => '.', - 2 => '::' - ), - 'REGEXPS' => array( - ), - 'STRICT_MODE_APPLIES' => GESHI_NEVER, - 'SCRIPT_DELIMITERS' => array( - ), - 'HIGHLIGHT_STRICT_BLOCK' => array( - ), - 'TAB_WIDTH' => 4, - 'PARSER_CONTROL' => array( - 'KEYWORDS' => array( - 'DISALLOWED_BEFORE' => "(? "(?![a-zA-Z0-9_\|%\\-])" - ) - ) -); - -?> \ No newline at end of file diff --git a/htdocs/site/js/github.js b/htdocs/site/js/github.js deleted file mode 100644 index 339782cc5..000000000 --- a/htdocs/site/js/github.js +++ /dev/null @@ -1,52 +0,0 @@ -/*! Inspired by: http://aboutcode.net/2010/11/11/list-github-projects-using-javascript.html */ - -/* jshint browser:true, jquery:true */ - -// htmlEntities taken from http://css-tricks.com/snippets/javascript/htmlentities-for-javascript/ -function htmlEntities(str) { - "use strict"; - var ret = String(str) - .replace(/&/g, "&") - .replace(//g, ">") - .replace(/"/g, """); - - return ret; -} - -jQuery.fn.listCommits = function(username, repository, branch) { - "use strict"; - this.html("Querying GitHub for recent commits…"); - - var target = this; - $.getJSON("https://api.github.com/repos/" + username + "/" + repository + "/commits?sha=" + branch + "&callback=?", function(response) { - var commits = response.data; - var list = $("
          "); - - target.empty().append(list); - - $(commits).each(function(i) { - var githubUrl = "https://github.com/" + username + "/" + repository + "/commit/" + this.sha; - var shortMessage = htmlEntities(cutLines(this.commit.message)); - - if (this.author !== null) { - list.append("
        • " + shortMessage + " by " + this.author.login + "
        • "); - } else { - list.append("
        • " + shortMessage + " by " + this.commit.author.name + "
        • "); - } - - if (i === 9) { - return false; - } - }); - }); - - function cutLines(message) { - var lineFeed = message.indexOf("\n"); - - if (lineFeed > -1) { - return message.slice(0, lineFeed); - } - return message; - } -}; diff --git a/htdocs/site/js/jquery-1.11.0.min.js b/htdocs/site/js/jquery-1.11.0.min.js deleted file mode 100644 index 73f33fb3a..000000000 --- a/htdocs/site/js/jquery-1.11.0.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery v1.11.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ -!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k="".trim,l={},m="1.11.0",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(l.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:k&&!k.call("\ufeff\xa0")?function(a){return null==a?"":k.call(a)}:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||n.guid++,e):void 0},now:function(){return+new Date},support:l}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s="sizzle"+-new Date,t=a.document,u=0,v=0,w=eb(),x=eb(),y=eb(),z=function(a,b){return a===b&&(j=!0),0},A="undefined",B=1<<31,C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=D.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",M=L.replace("w","w#"),N="\\["+K+"*("+L+")"+K+"*(?:([*^$|!~]?=)"+K+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+M+")|)|)"+K+"*\\]",O=":("+L+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+N.replace(3,8)+")*)|.*)\\)|)",P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(O),U=new RegExp("^"+M+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L.replace("w","w*")+")"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=/'|\\/g,ab=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),bb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{G.apply(D=H.call(t.childNodes),t.childNodes),D[t.childNodes.length].nodeType}catch(cb){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function db(a,b,d,e){var f,g,h,i,j,m,p,q,u,v;if((b?b.ownerDocument||b:t)!==l&&k(b),b=b||l,d=d||[],!a||"string"!=typeof a)return d;if(1!==(i=b.nodeType)&&9!==i)return[];if(n&&!e){if(f=Z.exec(a))if(h=f[1]){if(9===i){if(g=b.getElementById(h),!g||!g.parentNode)return d;if(g.id===h)return d.push(g),d}else if(b.ownerDocument&&(g=b.ownerDocument.getElementById(h))&&r(b,g)&&g.id===h)return d.push(g),d}else{if(f[2])return G.apply(d,b.getElementsByTagName(a)),d;if((h=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(h)),d}if(c.qsa&&(!o||!o.test(a))){if(q=p=s,u=b,v=9===i&&a,1===i&&"object"!==b.nodeName.toLowerCase()){m=ob(a),(p=b.getAttribute("id"))?q=p.replace(_,"\\$&"):b.setAttribute("id",q),q="[id='"+q+"'] ",j=m.length;while(j--)m[j]=q+pb(m[j]);u=$.test(a)&&mb(b.parentNode)||b,v=m.join(",")}if(v)try{return G.apply(d,u.querySelectorAll(v)),d}catch(w){}finally{p||b.removeAttribute("id")}}}return xb(a.replace(P,"$1"),b,d,e)}function eb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function fb(a){return a[s]=!0,a}function gb(a){var b=l.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function hb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function ib(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||B)-(~a.sourceIndex||B);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function jb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function kb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function lb(a){return fb(function(b){return b=+b,fb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function mb(a){return a&&typeof a.getElementsByTagName!==A&&a}c=db.support={},f=db.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},k=db.setDocument=function(a){var b,e=a?a.ownerDocument||a:t,g=e.defaultView;return e!==l&&9===e.nodeType&&e.documentElement?(l=e,m=e.documentElement,n=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){k()},!1):g.attachEvent&&g.attachEvent("onunload",function(){k()})),c.attributes=gb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=gb(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(e.getElementsByClassName)&&gb(function(a){return a.innerHTML="
          ",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=gb(function(a){return m.appendChild(a).id=s,!e.getElementsByName||!e.getElementsByName(s).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==A&&n){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){var c=typeof a.getAttributeNode!==A&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==A?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==A&&n?b.getElementsByClassName(a):void 0},p=[],o=[],(c.qsa=Y.test(e.querySelectorAll))&&(gb(function(a){a.innerHTML="",a.querySelectorAll("[t^='']").length&&o.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||o.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll(":checked").length||o.push(":checked")}),gb(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&o.push("name"+K+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||o.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),o.push(",.*:")})),(c.matchesSelector=Y.test(q=m.webkitMatchesSelector||m.mozMatchesSelector||m.oMatchesSelector||m.msMatchesSelector))&&gb(function(a){c.disconnectedMatch=q.call(a,"div"),q.call(a,"[s!='']:x"),p.push("!=",O)}),o=o.length&&new RegExp(o.join("|")),p=p.length&&new RegExp(p.join("|")),b=Y.test(m.compareDocumentPosition),r=b||Y.test(m.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},z=b?function(a,b){if(a===b)return j=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===t&&r(t,a)?-1:b===e||b.ownerDocument===t&&r(t,b)?1:i?I.call(i,a)-I.call(i,b):0:4&d?-1:1)}:function(a,b){if(a===b)return j=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],k=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:i?I.call(i,a)-I.call(i,b):0;if(f===g)return ib(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)k.unshift(c);while(h[d]===k[d])d++;return d?ib(h[d],k[d]):h[d]===t?-1:k[d]===t?1:0},e):l},db.matches=function(a,b){return db(a,null,null,b)},db.matchesSelector=function(a,b){if((a.ownerDocument||a)!==l&&k(a),b=b.replace(S,"='$1']"),!(!c.matchesSelector||!n||p&&p.test(b)||o&&o.test(b)))try{var d=q.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return db(b,l,null,[a]).length>0},db.contains=function(a,b){return(a.ownerDocument||a)!==l&&k(a),r(a,b)},db.attr=function(a,b){(a.ownerDocument||a)!==l&&k(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!n):void 0;return void 0!==f?f:c.attributes||!n?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},db.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},db.uniqueSort=function(a){var b,d=[],e=0,f=0;if(j=!c.detectDuplicates,i=!c.sortStable&&a.slice(0),a.sort(z),j){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return i=null,a},e=db.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=db.selectors={cacheLength:50,createPseudo:fb,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ab,bb),a[3]=(a[4]||a[5]||"").replace(ab,bb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||db.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&db.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return V.CHILD.test(a[0])?null:(a[3]&&void 0!==a[4]?a[2]=a[4]:c&&T.test(c)&&(b=ob(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ab,bb).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=w[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&w(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==A&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=db.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),t=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&t){k=q[s]||(q[s]={}),j=k[a]||[],n=j[0]===u&&j[1],m=j[0]===u&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[u,n,m];break}}else if(t&&(j=(b[s]||(b[s]={}))[a])&&j[0]===u)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(t&&((l[s]||(l[s]={}))[a]=[u,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||db.error("unsupported pseudo: "+a);return e[s]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?fb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:fb(function(a){var b=[],c=[],d=g(a.replace(P,"$1"));return d[s]?fb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:fb(function(a){return function(b){return db(a,b).length>0}}),contains:fb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:fb(function(a){return U.test(a||"")||db.error("unsupported lang: "+a),a=a.replace(ab,bb).toLowerCase(),function(b){var c;do if(c=n?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===m},focus:function(a){return a===l.activeElement&&(!l.hasFocus||l.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:lb(function(){return[0]}),last:lb(function(a,b){return[b-1]}),eq:lb(function(a,b,c){return[0>c?c+b:c]}),even:lb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:lb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:lb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:lb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function qb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=v++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[u,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[s]||(b[s]={}),(h=i[d])&&h[0]===u&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function rb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function sb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function tb(a,b,c,d,e,f){return d&&!d[s]&&(d=tb(d)),e&&!e[s]&&(e=tb(e,f)),fb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||wb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:sb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=sb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=sb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ub(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],i=g||d.relative[" "],j=g?1:0,k=qb(function(a){return a===b},i,!0),l=qb(function(a){return I.call(b,a)>-1},i,!0),m=[function(a,c,d){return!g&&(d||c!==h)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>j;j++)if(c=d.relative[a[j].type])m=[qb(rb(m),c)];else{if(c=d.filter[a[j].type].apply(null,a[j].matches),c[s]){for(e=++j;f>e;e++)if(d.relative[a[e].type])break;return tb(j>1&&rb(m),j>1&&pb(a.slice(0,j-1).concat({value:" "===a[j-2].type?"*":""})).replace(P,"$1"),c,e>j&&ub(a.slice(j,e)),f>e&&ub(a=a.slice(e)),f>e&&pb(a))}m.push(c)}return rb(m)}function vb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,i,j,k){var m,n,o,p=0,q="0",r=f&&[],s=[],t=h,v=f||e&&d.find.TAG("*",k),w=u+=null==t?1:Math.random()||.1,x=v.length;for(k&&(h=g!==l&&g);q!==x&&null!=(m=v[q]);q++){if(e&&m){n=0;while(o=a[n++])if(o(m,g,i)){j.push(m);break}k&&(u=w)}c&&((m=!o&&m)&&p--,f&&r.push(m))}if(p+=q,c&&q!==p){n=0;while(o=b[n++])o(r,s,g,i);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=E.call(j));s=sb(s)}G.apply(j,s),k&&!f&&s.length>0&&p+b.length>1&&db.uniqueSort(j)}return k&&(u=w,h=t),r};return c?fb(f):f}g=db.compile=function(a,b){var c,d=[],e=[],f=y[a+" "];if(!f){b||(b=ob(a)),c=b.length;while(c--)f=ub(b[c]),f[s]?d.push(f):e.push(f);f=y(a,vb(e,d))}return f};function wb(a,b,c){for(var d=0,e=b.length;e>d;d++)db(a,b[d],c);return c}function xb(a,b,e,f){var h,i,j,k,l,m=ob(a);if(!f&&1===m.length){if(i=m[0]=m[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&c.getById&&9===b.nodeType&&n&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(ab,bb),b)||[])[0],!b)return e;a=a.slice(i.shift().value.length)}h=V.needsContext.test(a)?0:i.length;while(h--){if(j=i[h],d.relative[k=j.type])break;if((l=d.find[k])&&(f=l(j.matches[0].replace(ab,bb),$.test(i[0].type)&&mb(b.parentNode)||b))){if(i.splice(h,1),a=f.length&&pb(i),!a)return G.apply(e,f),e;break}}}return g(a,m)(f,b,!n,e,$.test(a)&&mb(b.parentNode)||b),e}return c.sortStable=s.split("").sort(z).join("")===s,c.detectDuplicates=!!j,k(),c.sortDetached=gb(function(a){return 1&a.compareDocumentPosition(l.createElement("div"))}),gb(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||hb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&gb(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||hb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),gb(function(a){return null==a.getAttribute("disabled")})||hb(J,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),db}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return n.inArray(a,b)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;e>b;b++)if(n.contains(d[b],this))return!0}));for(b=0;e>b;b++)n.find(a,d[b],c);return c=this.pushStack(e>1?n.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=a.document,A=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,B=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:A.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:z,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=z.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return y.find(a);this.length=1,this[0]=d}return this.context=z,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};B.prototype=n.fn,y=n(z);var C=/^(?:parents|prev(?:Until|All))/,D={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!n(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b,c=n(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(n.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?n.inArray(this[0],n(a)):n.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function E(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return E(a,"nextSibling")},prev:function(a){return E(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return n.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(D[a]||(e=n.unique(e)),C.test(a)&&(e=e.reverse())),this.pushStack(e)}});var F=/\S+/g,G={};function H(a){var b=G[a]={};return n.each(a.match(F)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?G[a]||H(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&n.each(arguments,function(a,c){var d;while((d=n.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){if(a===!0?!--n.readyWait:!n.isReady){if(!z.body)return setTimeout(n.ready);n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(z,[n]),n.fn.trigger&&n(z).trigger("ready").off("ready"))}}});function J(){z.addEventListener?(z.removeEventListener("DOMContentLoaded",K,!1),a.removeEventListener("load",K,!1)):(z.detachEvent("onreadystatechange",K),a.detachEvent("onload",K))}function K(){(z.addEventListener||"load"===event.type||"complete"===z.readyState)&&(J(),n.ready())}n.ready.promise=function(b){if(!I)if(I=n.Deferred(),"complete"===z.readyState)setTimeout(n.ready);else if(z.addEventListener)z.addEventListener("DOMContentLoaded",K,!1),a.addEventListener("load",K,!1);else{z.attachEvent("onreadystatechange",K),a.attachEvent("onload",K);var c=!1;try{c=null==a.frameElement&&z.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!n.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}J(),n.ready()}}()}return I.promise(b)};var L="undefined",M;for(M in n(l))break;l.ownLast="0"!==M,l.inlineBlockNeedsLayout=!1,n(function(){var a,b,c=z.getElementsByTagName("body")[0];c&&(a=z.createElement("div"),a.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",b=z.createElement("div"),c.appendChild(a).appendChild(b),typeof b.style.zoom!==L&&(b.style.cssText="border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1",(l.inlineBlockNeedsLayout=3===b.offsetWidth)&&(c.style.zoom=1)),c.removeChild(a),a=b=null)}),function(){var a=z.createElement("div");if(null==l.deleteExpando){l.deleteExpando=!0;try{delete a.test}catch(b){l.deleteExpando=!1}}a=null}(),n.acceptData=function(a){var b=n.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(O,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}n.data(a,b,c)}else c=void 0}return c}function Q(a){var b;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function R(a,b,d,e){if(n.acceptData(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[n.camelCase(b)])):f=g,f -}}function S(a,b,c){if(n.acceptData(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?n.cache[a[n.expando]]:a[n.expando],!!a&&!Q(a)},data:function(a,b,c){return R(a,b,c)},removeData:function(a,b){return S(a,b)},_data:function(a,b,c){return R(a,b,c,!0)},_removeData:function(a,b){return S(a,b,!0)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--)d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d]));n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?P(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},X=/^(?:checkbox|radio)$/i;!function(){var a=z.createDocumentFragment(),b=z.createElement("div"),c=z.createElement("input");if(b.setAttribute("className","t"),b.innerHTML="
          a",l.leadingWhitespace=3===b.firstChild.nodeType,l.tbody=!b.getElementsByTagName("tbody").length,l.htmlSerialize=!!b.getElementsByTagName("link").length,l.html5Clone="<:nav>"!==z.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,a.appendChild(c),l.appendChecked=c.checked,b.innerHTML="",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,a.appendChild(b),b.innerHTML="",l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){l.noCloneEvent=!1}),b.cloneNode(!0).click()),null==l.deleteExpando){l.deleteExpando=!0;try{delete b.test}catch(d){l.deleteExpando=!1}}a=b=c=null}(),function(){var b,c,d=z.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(l[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),l[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var Y=/^(?:input|select|textarea)$/i,Z=/^key/,$=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,ab=/^([^.]*)(?:\.(.+)|)$/;function bb(){return!0}function cb(){return!1}function db(){try{return z.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=n.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof n===L||a&&n.event.triggered===a.type?void 0:n.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(F)||[""],h=b.length;while(h--)f=ab.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=n.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=n.event.special[o]||{},l=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},i),(m=g[o])||(m=g[o]=[],m.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,l):m.push(l),n.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n.hasData(a)&&n._data(a);if(r&&(k=r.events)){b=(b||"").match(F)||[""],j=b.length;while(j--)if(h=ab.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;while(f--)g=m[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(k)&&(delete r.handle,n._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,m,o=[d||z],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||z,3!==d.nodeType&&8!==d.nodeType&&!_.test(p+n.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[n.expando]?b:new n.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),k=n.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!n.isWindow(d)){for(i=k.delegateType||p,_.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||z)&&o.push(l.defaultView||l.parentWindow||a)}m=0;while((h=o[m++])&&!b.isPropagationStopped())b.type=m>1?i:k.bindType||p,f=(n._data(h,"events")||{})[b.type]&&n._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&n.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&n.acceptData(d)&&g&&d[p]&&!n.isWindow(d)){l=d[g],l&&(d[g]=null),n.event.triggered=p;try{d[p]()}catch(r){}n.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(n._data(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((n.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?n(c,this).index(i)>=0:n.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h]","i"),ib=/^\s+/,jb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,kb=/<([\w:]+)/,lb=/\s*$/g,sb={option:[1,""],legend:[1,"
          ","
          "],area:[1,"",""],param:[1,"",""],thead:[1,"","
          "],tr:[2,"","
          "],col:[2,"","
          "],td:[3,"","
          "],_default:l.htmlSerialize?[0,"",""]:[1,"X
          ","
          "]},tb=eb(z),ub=tb.appendChild(z.createElement("div"));sb.optgroup=sb.option,sb.tbody=sb.tfoot=sb.colgroup=sb.caption=sb.thead,sb.th=sb.td;function vb(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==L?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==L?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||n.nodeName(d,b)?f.push(d):n.merge(f,vb(d,b));return void 0===b||b&&n.nodeName(a,b)?n.merge([a],f):f}function wb(a){X.test(a.type)&&(a.defaultChecked=a.checked)}function xb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function yb(a){return a.type=(null!==n.find.attr(a,"type"))+"/"+a.type,a}function zb(a){var b=qb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ab(a,b){for(var c,d=0;null!=(c=a[d]);d++)n._data(c,"globalEval",!b||n._data(b[d],"globalEval"))}function Bb(a,b){if(1===b.nodeType&&n.hasData(a)){var c,d,e,f=n._data(a),g=n._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)n.event.add(b,c,h[c][d])}g.data&&(g.data=n.extend({},g.data))}}function Cb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!l.noCloneEvent&&b[n.expando]){e=n._data(b);for(d in e.events)n.removeEvent(b,d,e.handle);b.removeAttribute(n.expando)}"script"===c&&b.text!==a.text?(yb(b).text=a.text,zb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),l.html5Clone&&a.innerHTML&&!n.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&X.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}n.extend({clone:function(a,b,c){var d,e,f,g,h,i=n.contains(a.ownerDocument,a);if(l.html5Clone||n.isXMLDoc(a)||!hb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ub.innerHTML=a.outerHTML,ub.removeChild(f=ub.firstChild)),!(l.noCloneEvent&&l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(d=vb(f),h=vb(a),g=0;null!=(e=h[g]);++g)d[g]&&Cb(e,d[g]);if(b)if(c)for(h=h||vb(a),d=d||vb(f),g=0;null!=(e=h[g]);g++)Bb(e,d[g]);else Bb(a,f);return d=vb(f,"script"),d.length>0&&Ab(d,!i&&vb(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k,m=a.length,o=eb(b),p=[],q=0;m>q;q++)if(f=a[q],f||0===f)if("object"===n.type(f))n.merge(p,f.nodeType?[f]:f);else if(mb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(kb.exec(f)||["",""])[1].toLowerCase(),k=sb[i]||sb._default,h.innerHTML=k[1]+f.replace(jb,"<$1>")+k[2],e=k[0];while(e--)h=h.lastChild;if(!l.leadingWhitespace&&ib.test(f)&&p.push(b.createTextNode(ib.exec(f)[0])),!l.tbody){f="table"!==i||lb.test(f)?""!==k[1]||lb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)n.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}n.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),l.appendChecked||n.grep(vb(p,"input"),wb),q=0;while(f=p[q++])if((!d||-1===n.inArray(f,d))&&(g=n.contains(f.ownerDocument,f),h=vb(o.appendChild(f),"script"),g&&Ab(h),c)){e=0;while(f=h[e++])pb.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=n.expando,j=n.cache,k=l.deleteExpando,m=n.event.special;null!=(d=a[h]);h++)if((b||n.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)m[e]?n.event.remove(d,e):n.removeEvent(d,e,g.handle);j[f]&&(delete j[f],k?delete d[i]:typeof d.removeAttribute!==L?d.removeAttribute(i):d[i]=null,c.push(f))}}}),n.fn.extend({text:function(a){return W(this,function(a){return void 0===a?n.text(this):this.empty().append((this[0]&&this[0].ownerDocument||z).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(vb(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&Ab(vb(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&n.cleanData(vb(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&n.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return W(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(gb,""):void 0;if(!("string"!=typeof a||nb.test(a)||!l.htmlSerialize&&hb.test(a)||!l.leadingWhitespace&&ib.test(a)||sb[(kb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(jb,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(vb(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(vb(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,k=this.length,m=this,o=k-1,p=a[0],q=n.isFunction(p);if(q||k>1&&"string"==typeof p&&!l.checkClone&&ob.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(k&&(i=n.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=n.map(vb(i,"script"),yb),f=g.length;k>j;j++)d=i,j!==o&&(d=n.clone(d,!0,!0),f&&n.merge(g,vb(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,n.map(g,zb),j=0;f>j;j++)d=g[j],pb.test(d.type||"")&&!n._data(d,"globalEval")&&n.contains(h,d)&&(d.src?n._evalUrl&&n._evalUrl(d.src):n.globalEval((d.text||d.textContent||d.innerHTML||"").replace(rb,"")));i=c=null}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=0,e=[],g=n(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),n(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Db,Eb={};function Fb(b,c){var d=n(c.createElement(b)).appendTo(c.body),e=a.getDefaultComputedStyle?a.getDefaultComputedStyle(d[0]).display:n.css(d[0],"display");return d.detach(),e}function Gb(a){var b=z,c=Eb[a];return c||(c=Fb(a,b),"none"!==c&&c||(Db=(Db||n("