summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-09-04 05:51:59 +0200
committerPierre Schmitz <pierre@archlinux.de>2013-09-04 05:51:59 +0200
commit91e194556c52d2f354344f930419eef2dd6267f0 (patch)
tree0cd12490d3cd3499274017c9b799d0f738d3719e /extensions
parent08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (diff)
Update to MediaWiki 1.21.2
Diffstat (limited to 'extensions')
-rw-r--r--extensions/Cite/.gitreview5
-rw-r--r--extensions/ConfirmEdit/.gitreview5
-rw-r--r--extensions/ConfirmEdit/ReCaptcha.i18n.php3
-rw-r--r--extensions/Gadgets/.gitreview5
-rw-r--r--extensions/Gadgets/tests/GadgetTest.php81
-rw-r--r--extensions/ImageMap/.gitreview5
-rw-r--r--extensions/InputBox/.gitreview5
-rw-r--r--extensions/Interwiki/.gitreview6
-rw-r--r--extensions/LocalisationUpdate/.gitreview5
-rw-r--r--extensions/LocalisationUpdate/tests/tokenTest.php91
-rw-r--r--extensions/Nuke/.gitreview5
-rw-r--r--extensions/ParserFunctions/.gitreview5
-rw-r--r--extensions/ParserFunctions/ParserFunctions.i18n.magic.php4
-rw-r--r--extensions/ParserFunctions/tests/ExpressionTest.php76
-rw-r--r--extensions/PdfHandler/.gitreview5
-rw-r--r--extensions/PdfHandler/PdfHandler_body.php2
-rw-r--r--extensions/Poem/.gitreview5
-rw-r--r--extensions/Renameuser/.gitreview5
-rw-r--r--extensions/SpamBlacklist/.gitreview5
-rw-r--r--extensions/SyntaxHighlight_GeSHi/.gitreview5
-rw-r--r--extensions/SyntaxHighlight_GeSHi/geshi/contrib/aliased.php123
-rw-r--r--extensions/SyntaxHighlight_GeSHi/geshi/contrib/cssgen.php466
-rw-r--r--extensions/SyntaxHighlight_GeSHi/geshi/contrib/cssgen2.php59
-rw-r--r--extensions/SyntaxHighlight_GeSHi/geshi/contrib/example.php217
-rw-r--r--extensions/SyntaxHighlight_GeSHi/geshi/contrib/langcheck.php769
-rw-r--r--extensions/SyntaxHighlight_GeSHi/geshi/contrib/langwiz.php1158
-rw-r--r--extensions/TitleBlacklist/.gitreview5
-rw-r--r--extensions/TitleBlacklist/tests/ApiQueryTitleBlacklistTest.php110
-rw-r--r--extensions/TitleBlacklist/tests/testSource4
-rw-r--r--extensions/Vector/.gitreview5
-rw-r--r--extensions/WikiEditor/.gitreview6
-rw-r--r--extensions/WikiEditor/.jshintignore2
-rw-r--r--extensions/WikiEditor/.jshintrc9
-rw-r--r--extensions/WikiEditor/tests/selenium/WikiDialogs_Links.php67
-rw-r--r--extensions/WikiEditor/tests/selenium/WikiDialogs_Links_Setup.php295
-rw-r--r--extensions/WikiEditor/tests/selenium/WikiEditorConstants.php84
-rw-r--r--extensions/WikiEditor/tests/selenium/WikiEditorSeleniumConfig.php27
-rw-r--r--extensions/WikiEditor/tests/selenium/WikiEditorTestSuite.php35
38 files changed, 972 insertions, 2797 deletions
diff --git a/extensions/Cite/.gitreview b/extensions/Cite/.gitreview
new file mode 100644
index 00000000..6ae9db41
--- /dev/null
+++ b/extensions/Cite/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/extensions/Cite.git
+defaultbranch=master
diff --git a/extensions/ConfirmEdit/.gitreview b/extensions/ConfirmEdit/.gitreview
new file mode 100644
index 00000000..780d35df
--- /dev/null
+++ b/extensions/ConfirmEdit/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/extensions/ConfirmEdit.git
+defaultbranch=master
diff --git a/extensions/ConfirmEdit/ReCaptcha.i18n.php b/extensions/ConfirmEdit/ReCaptcha.i18n.php
index a7fffb59..e8722f93 100644
--- a/extensions/ConfirmEdit/ReCaptcha.i18n.php
+++ b/extensions/ConfirmEdit/ReCaptcha.i18n.php
@@ -400,13 +400,12 @@ $messages['nl-informal'] = array(
);
/** Polish (polski)
- * @author WTM
*/
$messages['pl'] = array(
'recaptcha-edit' => 'Aby uchronić nas przed robotami, proszę wpisać dwa widoczne słowa w poniższym polu:',
'recaptcha-addurl' => 'Twoja edycja zawiera linki zewnętrzne. Aby uchronić nas przed robotami, proszę wpisać dwa widoczne słowa w poniższym polu:',
'recaptcha-badpass' => 'Aby uchronić nas przed złamaniem automatycznym haseł, proszę wpisać dwa widoczne słowa w poniższym polu:',
- 'recaptcha-createaccount' => 'Aby uchronić nas przed automatycznym tworzeniem użytkowników, proszę wpisać dwa widoczne słowa w poniższym polu:',
+ 'recaptcha-createaccount' => 'Aby uchronić nas przed automatycznym stworzeniem użytkowników, proszę wpisać dwa widoczne słowa w poniższym polu:',
'recaptcha-createaccount-fail' => 'Odpowiedź na reCAPTCHA jest fałszywa lub brakująca.',
'recaptcha-create' => 'Aby uchronić nas przed tworzeniem stron przez robotów, proszę wpisać dwa widoczne słowa w poniższym polu:',
);
diff --git a/extensions/Gadgets/.gitreview b/extensions/Gadgets/.gitreview
new file mode 100644
index 00000000..a1a8ead4
--- /dev/null
+++ b/extensions/Gadgets/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/extensions/Gadgets.git
+defaultbranch=master
diff --git a/extensions/Gadgets/tests/GadgetTest.php b/extensions/Gadgets/tests/GadgetTest.php
new file mode 100644
index 00000000..c9332a6c
--- /dev/null
+++ b/extensions/Gadgets/tests/GadgetTest.php
@@ -0,0 +1,81 @@
+<?php
+/**
+ * @group Gadgets
+ */
+
+class GadgetsTest extends MediaWikiTestCase {
+ private function create( $line ) {
+ $g = Gadget::newFromDefinition( $line );
+ // assertInstanceOf() is available since PHPUnit 3.5
+ $this->assertEquals( 'Gadget', get_class( $g ) );
+
+ return $g;
+ }
+
+ function testInvalidLines() {
+ $this->assertFalse( Gadget::newFromDefinition( '' ) );
+ $this->assertFalse( Gadget::newFromDefinition( '<foo|bar>' ) );
+ }
+
+ function testSimpleCases() {
+ $g = $this->create( '* foo bar| foo.css|foo.js|foo.bar' );
+ $this->assertEquals( 'foo_bar', $g->getName() );
+ $this->assertEquals( 'ext.gadget.foo_bar', $g->getModuleName() );
+ $this->assertEquals( array( 'Gadget-foo.js' ), $g->getScripts() );
+ $this->assertEquals( array( 'Gadget-foo.css' ), $g->getStyles() );
+ $this->assertEquals( array( 'Gadget-foo.js', 'Gadget-foo.css' ),
+ $g->getScriptsAndStyles() );
+ $this->assertEquals( array( 'Gadget-foo.js' ), $g->getLegacyScripts() );
+ $this->assertFalse( $g->supportsResourceLoader() );
+ $this->assertTrue( $g->hasModule() );
+ }
+
+ function testRLtag() {
+ $g = $this->create( '*foo [ResourceLoader]|foo.js|foo.css' );
+ $this->assertEquals( 'foo', $g->getName() );
+ $this->assertTrue( $g->supportsResourceLoader() );
+ $this->assertEquals( 0, count( $g->getLegacyScripts() ) );
+ }
+
+ function testDependencies() {
+ $g = $this->create( '* foo[ResourceLoader|dependencies=jquery.ui]|bar.js' );
+ $this->assertEquals( array( 'Gadget-bar.js' ), $g->getScripts() );
+ $this->assertTrue( $g->supportsResourceLoader() );
+ $this->assertEquals( array( 'jquery.ui' ), $g->getDependencies() );
+ }
+
+ function testPreferences() {
+ global $wgUser, $wgOut, $wgTitle;
+
+ // This test makes call to the parser which requires valids Outputpage
+ // and Title objects. Set them up there, they will be released at the
+ // end of the test.
+ $old_wgOut = $wgOut;
+ $old_wgTitle = $wgTitle;
+ $wgTitle = Title::newFromText( 'Parser test for Gadgets extension' );
+
+ // Proceed with test setup:
+ $prefs = array();
+ $context = new RequestContext();
+ $wgOut = $context->getOutput();
+ $wgOut->setTitle( Title::newFromText( 'test' ) );
+
+ Gadget::loadStructuredList( '* foo | foo.js
+==keep-section1==
+* bar| bar.js
+==remove-section==
+* baz [rights=embezzle] |baz.js
+==keep-section2==
+* quux [rights=read] | quux.js' );
+ $this->assertTrue( GadgetHooks::getPreferences( $wgUser, $prefs ), 'GetPrefences hook should return true' );
+
+ $options = $prefs['gadgets']['options'];
+ $this->assertFalse( isset( $options['&lt;gadget-section-remove-section&gt;'] ), 'Must not show empty sections' );
+ $this->assertTrue( isset( $options['&lt;gadget-section-keep-section1&gt;'] ) );
+ $this->assertTrue( isset( $options['&lt;gadget-section-keep-section2&gt;'] ) );
+
+ // Restore globals
+ $wgOut = $old_wgOut;
+ $wgTitle = $old_wgTitle;
+ }
+}
diff --git a/extensions/ImageMap/.gitreview b/extensions/ImageMap/.gitreview
new file mode 100644
index 00000000..2629c9d9
--- /dev/null
+++ b/extensions/ImageMap/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/extensions/ImageMap.git
+defaultbranch=master
diff --git a/extensions/InputBox/.gitreview b/extensions/InputBox/.gitreview
new file mode 100644
index 00000000..9d0c704d
--- /dev/null
+++ b/extensions/InputBox/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/extensions/InputBox.git
+defaultbranch=master
diff --git a/extensions/Interwiki/.gitreview b/extensions/Interwiki/.gitreview
new file mode 100644
index 00000000..fcc03f61
--- /dev/null
+++ b/extensions/Interwiki/.gitreview
@@ -0,0 +1,6 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/extensions/Interwiki.git
+defaultbranch=master
+defaultrebase=0 \ No newline at end of file
diff --git a/extensions/LocalisationUpdate/.gitreview b/extensions/LocalisationUpdate/.gitreview
new file mode 100644
index 00000000..da37d04d
--- /dev/null
+++ b/extensions/LocalisationUpdate/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/extensions/LocalisationUpdate.git
+defaultbranch=master
diff --git a/extensions/LocalisationUpdate/tests/tokenTest.php b/extensions/LocalisationUpdate/tests/tokenTest.php
new file mode 100644
index 00000000..1112313c
--- /dev/null
+++ b/extensions/LocalisationUpdate/tests/tokenTest.php
@@ -0,0 +1,91 @@
+<?php
+
+$IP = strval( getenv( 'MW_INSTALL_PATH' ) ) !== ''
+ ? getenv( 'MW_INSTALL_PATH' )
+ : realpath( dirname( __FILE__ ) . "/../../../" );
+
+require_once( "$IP/maintenance/commandLine.inc" );
+
+function evalExtractArray( $php, $varname ) {
+ eval( $php );
+ return @$$varname;
+}
+
+function confExtractArray( $php, $varname ) {
+ try {
+ $ce = new ConfEditor("<?php $php");
+ $vars = $ce->getVars();
+ $retval = @$vars[$varname];
+ } catch( Exception $e ) {
+ print $e . "\n";
+ $retval = null;
+ }
+ return $retval;
+}
+
+function quickTokenExtractArray( $php, $varname ) {
+ $reader = new QuickArrayReader("<?php $php");
+ return $reader->getVar( $varname );
+}
+
+
+if( count( $args ) ) {
+ $sources = $args;
+} else {
+ $sources =
+ array_merge(
+ glob("$IP/extensions/*/*.i18n.php"),
+ glob("$IP/languages/messages/Messages*.php") );
+}
+
+foreach( $sources as $sourceFile ) {
+ $rel = basename( $sourceFile );
+ $out = str_replace( '/', '-', $rel );
+
+ $sourceData = file_get_contents( $sourceFile );
+
+ if( preg_match( '!extensions/!', $sourceFile ) ) {
+ $sourceData = LocalisationUpdate::cleanupExtensionFile( $sourceData );
+ $items = 'langs';
+ } else {
+ $sourceData = LocalisationUpdate::cleanupFile( $sourceData );
+ $items = 'messages';
+ }
+
+ file_put_contents( "$out.txt", $sourceData );
+
+ $start = microtime(true);
+ $eval = evalExtractArray( $sourceData, 'messages' );
+ $deltaEval = microtime(true) - $start;
+
+ $start = microtime(true);
+ $quick = quickTokenExtractArray( $sourceData, 'messages' );
+ $deltaQuick = microtime(true) - $start;
+
+ $start = microtime(true);
+ $token = confExtractArray( $sourceData, 'messages' );
+ $deltaToken = microtime(true) - $start;
+
+ $hashEval = md5(serialize($eval));
+ $hashToken = md5(serialize($token));
+ $hashQuick = md5(serialize($quick));
+ $countEval = count( (array)$eval);
+ $countToken = count( (array)$token );
+ $countQuick = count( (array)$quick );
+
+ printf( "%s %s %d $items - %0.1fms - eval\n", $rel, $hashEval, $countEval, $deltaEval * 1000 );
+ printf( "%s %s %d $items - %0.1fms - QuickArrayReader\n", $rel, $hashQuick, $countQuick, $deltaQuick * 1000 );
+ printf( "%s %s %d $items - %0.1fms - ConfEditor\n", $rel, $hashToken, $countToken, $deltaToken * 1000 );
+
+ if( $hashEval !== $hashToken || $hashEval !== $hashQuick ) {
+ echo "FAILED on $rel\n";
+ file_put_contents( "$out-eval.txt", var_export( $eval, true ) );
+ file_put_contents( "$out-token.txt", var_export( $token, true ) );
+ file_put_contents( "$out-quick.txt", var_export( $quick, true ) );
+ #die("check eval.txt and token.txt\n");
+ }
+ echo "\n";
+}
+
+echo "ok\n";
+
diff --git a/extensions/Nuke/.gitreview b/extensions/Nuke/.gitreview
new file mode 100644
index 00000000..c623aede
--- /dev/null
+++ b/extensions/Nuke/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/extensions/Nuke.git
+defaultbranch=master
diff --git a/extensions/ParserFunctions/.gitreview b/extensions/ParserFunctions/.gitreview
new file mode 100644
index 00000000..decb9867
--- /dev/null
+++ b/extensions/ParserFunctions/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/extensions/ParserFunctions.git
+defaultbranch=master
diff --git a/extensions/ParserFunctions/ParserFunctions.i18n.magic.php b/extensions/ParserFunctions/ParserFunctions.i18n.magic.php
index 1a37cf9e..4fdb83eb 100644
--- a/extensions/ParserFunctions/ParserFunctions.i18n.magic.php
+++ b/extensions/ParserFunctions/ParserFunctions.i18n.magic.php
@@ -96,8 +96,8 @@ $magicWords['br'] = array(
/** Chechen (нохчийн) */
$magicWords['ce'] = array(
- 'time' => array( 0, 'хан' ),
- 'replace' => array( 0, 'хийцарна', 'замена' ),
+ 'time' => array( 0, 'хан', 'time' ),
+ 'replace' => array( 0, 'хийцарна', 'замена', 'replace' ),
);
/** Czech (česky) */
diff --git a/extensions/ParserFunctions/tests/ExpressionTest.php b/extensions/ParserFunctions/tests/ExpressionTest.php
new file mode 100644
index 00000000..169a9cb4
--- /dev/null
+++ b/extensions/ParserFunctions/tests/ExpressionTest.php
@@ -0,0 +1,76 @@
+<?php
+class ExpressionTest extends MediaWikiTestCase {
+
+ /**
+ * @var ExprParser
+ */
+ protected $parser;
+
+ protected function setUp() {
+ parent::setUp();
+ $this->parser = new ExprParser();
+ }
+
+ /**
+ * @dataProvider provideExpressions
+ */
+ function testExpression( $input, $expected ) {
+ $this->assertEquals(
+ $expected,
+ $this->parser->doExpression( $input )
+ );
+ }
+
+ function provideExpressions() {
+ return array(
+ array( '1 or 0', '1' ),
+ array( 'not (1 and 0)', '1' ),
+ array( 'not 0', '1' ),
+ array( '4 < 5', '1' ),
+ array( '-5 < 2', '1' ),
+ array( '-2 <= -2', '1' ),
+ array( '4 > 3', '1' ),
+ array( '4 > -3', '1' ),
+ array( '5 >= 2', '1' ),
+ array( '2 >= 2', '1' ),
+ array( '1 != 2', '1' ),
+ array( '-4 * -4 = 4 * 4', '1' ),
+ array( 'not (1 != 1)', '1' ),
+ array( '1 + 1', '2' ),
+ array( '-1 + 1', '0' ),
+ array( '+1 + 1', '2' ),
+ array( '4 * 4', '16' ),
+ array( '(1/3) * 3', '1' ),
+ array( '3 / 1.5', '2' ),
+ array( '3 / 0.2', '15' ),
+ array( '3 / ( 2.0 * 0.1 )', '15' ),
+ array( '3 / ( 2.0 / 10 )', '15' ),
+ array( '3 / (- 0.2 )', '-15' ),
+ array( '3 / abs( 0.2 )', '15' ),
+ array( '3 mod 2', '1' ),
+ array( '1e4', '10000' ),
+ array( '1e-2', '0.01' ),
+ array( '4.0 round 0', '4' ),
+ array( 'ceil 4', '4' ),
+ array( 'floor 4', '4' ),
+ array( '4.5 round 0', '5' ),
+ array( '4.2 round 0', '4' ),
+ array( '-4.2 round 0', '-4' ),
+ array( '-4.5 round 0', '-5' ),
+ array( '-2.0 round 0', '-2' ),
+ array( 'ceil -3', '-3' ),
+ array( 'floor -6.0', '-6' ),
+ array( 'ceil 4.2', '5' ),
+ array( 'ceil -4.5', '-4' ),
+ array( 'floor -4.5', '-5' ),
+ array( 'abs(-2)', '2' ),
+ array( 'ln(exp(1))', '1' ),
+ array( 'trunc(4.5)', '4' ),
+ array( 'trunc(-4.5)', '-4' ),
+ array( '123 fmod (2^64-1)', '123' ),
+ array( '5.7 mod 1.3', '0' ),
+ array( '5.7 fmod 1.3', '0.5' ),
+ );
+ }
+}
+
diff --git a/extensions/PdfHandler/.gitreview b/extensions/PdfHandler/.gitreview
new file mode 100644
index 00000000..f5eca40e
--- /dev/null
+++ b/extensions/PdfHandler/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/extensions/PdfHandler.git
+defaultbranch=master
diff --git a/extensions/PdfHandler/PdfHandler_body.php b/extensions/PdfHandler/PdfHandler_body.php
index 8fa6719b..73ce1b58 100644
--- a/extensions/PdfHandler/PdfHandler_body.php
+++ b/extensions/PdfHandler/PdfHandler_body.php
@@ -315,7 +315,7 @@ class PdfHandler extends ImageHandler {
*/
function pageCount( $image ) {
$data = $this->getMetaArray( $image );
- if ( !$data || !isset( $data['Pages'] ) ) {
+ if ( !$data ) {
return false;
}
return intval( $data['Pages'] );
diff --git a/extensions/Poem/.gitreview b/extensions/Poem/.gitreview
new file mode 100644
index 00000000..aac78b2b
--- /dev/null
+++ b/extensions/Poem/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/extensions/Poem.git
+defaultbranch=master
diff --git a/extensions/Renameuser/.gitreview b/extensions/Renameuser/.gitreview
new file mode 100644
index 00000000..0d757141
--- /dev/null
+++ b/extensions/Renameuser/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/extensions/Renameuser.git
+defaultbranch=master
diff --git a/extensions/SpamBlacklist/.gitreview b/extensions/SpamBlacklist/.gitreview
new file mode 100644
index 00000000..d74ae8f9
--- /dev/null
+++ b/extensions/SpamBlacklist/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/extensions/SpamBlacklist.git
+defaultbranch=master
diff --git a/extensions/SyntaxHighlight_GeSHi/.gitreview b/extensions/SyntaxHighlight_GeSHi/.gitreview
new file mode 100644
index 00000000..cb9e4b44
--- /dev/null
+++ b/extensions/SyntaxHighlight_GeSHi/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/extensions/SyntaxHighlight_GeSHi.git
+defaultbranch=master
diff --git a/extensions/SyntaxHighlight_GeSHi/geshi/contrib/aliased.php b/extensions/SyntaxHighlight_GeSHi/geshi/contrib/aliased.php
deleted file mode 100644
index cee31289..00000000
--- a/extensions/SyntaxHighlight_GeSHi/geshi/contrib/aliased.php
+++ /dev/null
@@ -1,123 +0,0 @@
-<?php
-
-/**
- * Another GeSHi example script
- *
- * Configure your Apache server with 'AcceptPathInfo true' and something like
- * 'Alias /viewmysource /var/www/geshi/contrib/aliased.php'. Don't forget
- * to protect this alias as necessary.
- *
- * Usage - visit /viewmysource/file.name.ext to see that file with syntax
- * highlighting, where "viewmysource" is the name of the alias you set up.
- * You can use this without an alias too, just by visiting
- * aliased.php/file.name.ext.
- *
- * @author Ross Golder <ross@golder.org>
- * @version $Id: aliased.php 2533 2012-08-15 18:49:04Z benbe $
- */
-
-// Your config here
-define("SOURCE_ROOT", "/var/www/your/source/root/");
-
-// Assume you've put geshi in the include_path already
-require_once("geshi.php");
-
-// Get path info
-$path = SOURCE_ROOT.$_SERVER['PATH_INFO'];
-
-// Check for dickheads trying to use '../' to get to sensitive areas
-$base_path_len = strlen(SOURCE_ROOT);
-$real_path = realpath($path);
-if(strncmp($real_path, SOURCE_ROOT, $base_path_len)) {
- exit("Access outside acceptable path.");
-}
-
-// Check file exists
-if(!file_exists($path)) {
- exit("File not found ($path).");
-}
-
-// Prepare GeSHi instance
-$geshi = new GeSHi();
-$geshi->set_language('text');
-$geshi->load_from_file($path);
-$geshi->set_header_type(GESHI_HEADER_PRE);
-$geshi->enable_classes();
-$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 10);
-$geshi->set_overall_style('color: #000066; border: 1px solid #d0d0d0; background-color: #f0f0f0;', true);
-$geshi->set_line_style('font: normal normal 95% \'Courier New\', Courier, monospace; color: #003030;', 'font-weight: bold; color: #006060;', true);
-$geshi->set_code_style('color: #000020;', 'color: #000020;');
-$geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
-$geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
-$geshi->set_header_content('Source code viewer - ' . $path . ' - ' . $geshi->get_language_name());
-$geshi->set_header_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;');
-$geshi->set_footer_content('Parsed in <TIME> seconds, using GeSHi <VERSION>');
-$geshi->set_footer_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-top: 1px solid #d0d0d0; padding: 2px;');
-
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>Source code viewer - <?php echo $path; ?> - <?php $geshi->get_language_name(); ?></title>
- <style type="text/css">
- <!--
- <?php
- // Output the stylesheet. Note it doesn't output the <style> tag
- echo $geshi->get_stylesheet();
- ?>
- html {
- background-color: #f0f0f0;
- }
- body {
- font-family: Verdana, Arial, sans-serif;
- margin: 10px;
- border: 2px solid #e0e0e0;
- background-color: #fcfcfc;
- padding: 5px;
- }
- h2 {
- margin: .1em 0 .2em .5em;
- border-bottom: 1px solid #b0b0b0;
- color: #b0b0b0;
- font-weight: normal;
- font-size: 150%;
- }
- h3 {
- margin: .1em 0 .2em .5em;
- color: #b0b0b0;
- font-weight: normal;
- font-size: 120%;
- }
- #footer {
- text-align: center;
- font-size: 80%;
- color: #a9a9a9;
- }
- #footer a {
- color: #9999ff;
- }
- textarea {
- border: 1px solid #b0b0b0;
- font-size: 90%;
- color: #333;
- margin-left: 20px;
- }
- select, input {
- margin-left: 20px;
- }
- p {
- font-size: 90%;
- margin-left: .5em;
- }
- -->
- </style>
-</head>
-<body>
-<?php
-// The fun part :)
-echo $geshi->parse_code();
-?>
-<hr/>
-</body>
-</html>
diff --git a/extensions/SyntaxHighlight_GeSHi/geshi/contrib/cssgen.php b/extensions/SyntaxHighlight_GeSHi/geshi/contrib/cssgen.php
deleted file mode 100644
index cc71b58f..00000000
--- a/extensions/SyntaxHighlight_GeSHi/geshi/contrib/cssgen.php
+++ /dev/null
@@ -1,466 +0,0 @@
-<?php
-/*************************************************************************************
- * cssgen.php
- * ----------
- * Author: Nigel McNie (nigel@geshi.org)
- * Copyright: (c) 2004 Nigel McNie
- * Release Version: 1.0.8.6
- * Date Started: 2004/05/20
- *
- * Application to generate custom CSS files for GeSHi (based on an idea by Andreas
- * Gohr)
- *
- *************************************************************************************
- *
- * This file is part of GeSHi.
- *
- * GeSHi is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GeSHi is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GeSHi; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- ************************************************************************************/
-
-set_magic_quotes_runtime(0);
-//
-// Functions
-//
-
-function make_header ( $title )
-{
- echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>GeSHi CSS Generator :: ' . $title . ' </title>
- <style type="text/css" media="screen">
- <!--
- html {
- font-family: Verdana, Arial, sans-serif;
- font-size: 80%;
- background-color: #d0d0d0;
- }
- body {
- margin: 10px;
- padding: 5px;
- border: 1px solid #f0f0f0;
- background-color: #f6f6f6;
- }
- h1 {
- border-bottom: 2px solid #e0e0e0;
- font-weight: normal;
- font-size: 150%;
- color: #c0c0c0;
- }
- input, textarea {
- border: 1px solid #d0d0d0;
- }
- th {
- text-align: right;
- font-weight: normal;
- }
- pre {
- font-size: 110%;
- color: #202020;
- }
- #footer {
- color: #b0b0b0;
- text-align: center;
- font-size: 90%;
- margin: 0 auto;
- border-top: 1px solid #e0e0e0;
- }
- #footer a {
- color: #c0c0c0;
- }
- -->
- </style>
- <script type="text/javascript">
- function select (state)
- {
- var cboxes = document.getElementsByTagName(\'input\');
- for (var i = 0; i < cboxes.length; i++) {
- if (cboxes[i].type == "checkbox") {
- if (state == "true") {
- cboxes[i].checked = true;
- } elseif (state == "false") {
- cboxes[i].checked = false;
- } elseif (state == "invert") {
- cboxes[i].checked = !cboxes[i].checked;
- }
- }
- }
- }
- </script>
-</head>
-<body>
-<h1>' . $title . '</h1>
-';
-}
-
-function make_footer ()
-{
- echo '<div id="footer"><a href="http://qbnz.com/highlighter/">GeSHi</a> &copy; Nigel McNie, 2004, released under the GPL</div></body>
-</html>';
-}
-
-
-function get_var ( $var_name )
-{
- if ( isset($_GET[$var_name]) )
- {
- return str_replace("\'", "'", $_GET[$var_name]);
- }
- elseif ( isset($_POST[$var_name]) )
- {
- return str_replace("\'", "'", $_POST[$var_name]);
- }
- return null;
-}
-
-
-
-//
-// Unset everything
-//
-foreach ( $_REQUEST as $var )
-{
- unset($$var);
-}
-foreach ( array(
- '_POST' => 'HTTP_POST_VARS',
- '_GET' => 'HTTP_GET_VARS',
- '_COOKIE' => 'HTTP_COOKIE_VARS',
- '_SERVER' => 'HTTP_SERVER_VARS',
- '_ENV' => 'HTTP_ENV_VARS',
- '_FILES' => 'HTTP_POST_FILES') as $array => $other )
-{
- if ( !isset($$array) )
- {
- $$array = $$other;
- }
- unset($$other);
-}
-
-
-// Get what step we're up to
-$step = get_var('step');
-
-if ( !$step || $step == 1 )
-{
- $errors = 0;
- make_header('Step 1');
- echo "Welcome to the GeSHi CSS generator.<br /><pre>Searching for GeSHi... ";
-
- // Find GeSHi
- $geshi_path = get_var('geshi-path');
- $geshi_lang_path = get_var('geshi-lang-path');
-
- if(strstr($geshi_path, '..')) {
- unset($geshi_path);
- }
- if(strstr($geshi_lang_path, '..')) {
- unset($geshi_lang_path);
- }
-
- if ( !$geshi_path )
- {
- $geshi_path = '../geshi.php';
- }
- if ( !$geshi_lang_path )
- {
- $geshi_lang_path = '../geshi/';
- }
-
- if ( is_file($geshi_path) && is_readable($geshi_path) )
- {
- // Get file contents and see if GeSHi is in here
- $file = @file($geshi_path);
- $contents = '';
- foreach ( $file as $line )
- {
- $contents .= $line;
- }
- if ( strpos($contents, '<?php
-/**
- * GeSHi - Generic Syntax Highlighter') !== false )
- {
- echo '<span style="color: green;">Found at ' . realpath($geshi_path) . '</span>';
- }
- else
- {
- ++$errors;
- $no_geshi_dot_php_error = true;
- echo '<span style="color: red;">Not found</span>';
- }
- }
- else
- {
- ++$errors;
- $no_geshi_dot_php_error = true;
- echo '<span style="color: red;">Not found</span>';
- }
-
- // Find language files
- echo "\nSearching for language files... ";
- if ( is_readable($geshi_lang_path . 'css-gen.cfg') )
- {
-
- echo '<span style="color: green;">Found at ' . realpath($geshi_lang_path) . '</span>';
- }
- else
- {
- ++$errors;
- $no_lang_dir_error = true;
- echo '<span style="color: red;">Not found</span>';
- }
- echo "</pre>\n";
-
- if ( $errors > 0 )
- {
- // We're gonna have to ask for the paths...
- echo 'Unfortunately CSSGen could not detect the following paths. Please input them and press &quot;submit&quot; to try again.';
- echo "
-<form action=\"cssgen.php\" method=\"post\">";
- if ( $no_geshi_dot_php_error )
- {
- echo "
-<br />geshi.php: <input type=\"text\" name=\"geshi-path\" value=\"" . realpath('../geshi.php') . "\" size=\"50\" />";
- }
- else
- {
- echo '<input type="hidden" name="geshi-path" value="' . htmlspecialchars($geshi_path) . '" />';
- }
- if ( $no_lang_dir_error )
- {
- echo "
-<br />language files directory: <input type=\"text\" name=\"geshi-lang-path\" value=\"" . realpath('../geshi/') . "/\" size=\"50\" /> (should have a trailing slash)";
- }
- else
- {
- echo '<input type="hidden" name="geshi-lang-path" value="' . $geshi_lang_path . '" />';
- }
-
- echo "
-<br /><input type=\"submit\" value=\"Search\" /></form>";
- }
- else
- {
- // no errors - echo continue form
- echo 'Everything seems to be detected successfully. Use the button to continue.
-<br /><br /><form action="cssgen.php?step=2" method="post">
-<input type="hidden" name="geshi-path" value="' . realpath($geshi_path) . '" /><input type="hidden" name="geshi-lang-path" value="' . realpath($geshi_lang_path) . '" />
-<input type="submit" value="Step 2" />';
- }
-
- make_footer();
-}
-// Step 2
-elseif ( $step == 2 )
-{
- make_header('Step 2');
-
- $geshi_path = get_var('geshi-path');
- $geshi_lang_path = get_var('geshi-lang-path');
-
- $dh = opendir($geshi_lang_path);
- $lang_files = array();
- $file = readdir($dh);
- while ( $file !== false )
- {
- if ( $file == '.' || $file == '..' || $file == 'CVS' || $file == 'css-gen.cfg' )
- {
- $file = readdir($dh);
- continue;
- }
- if(!strstr(file_get_contents($dh . DIRECTORY_SEPARATOR . $file), '$language_data')) {
- $file = readdir($dh);
- continue;
- }
- $lang_files[] = $file;
- $file = readdir($dh);
- }
- closedir($dh);
- sort($lang_files);
-
- // Now installed languages are in $lang_files
-
- echo '<form action="cssgen.php?step=3" method="post" id="step2">
-What languages are you wanting to make this stylesheet for?<br /><br />
-Detected languages:<br />';
-
- foreach ( $lang_files as $lang )
- {
- $lang = substr($lang, 0, strpos($lang, '.'));
- if ($lang) {
- echo "<input type=\"checkbox\" name=\"langs[$lang]\" checked=\"checked\" />&nbsp;$lang<br />\n";
- }
- }
-
- echo "Select: <a href=\"javascript:select('true')\">All</a>, <a href=\"javascript:select('false')\">None</a>, <a href=\"javascript:select('invert')\">Invert</a><br />\n";
-
- echo 'If you\'d like any other languages not detected here to be supported, please enter
-them here, one per line:<br /><textarea rows="4" cols="20" name="extra-langs"></textarea><br />
-';
-
- echo '<br />Styles:
-<table>
- <tr><th>Style for the overall code block:</th><td><input type="text" name="overall" value="border: 1px dotted #a0a0a0; font-family: \'Courier New\', Courier, monospace; background-color: #f0f0f0; color: #0000bb;" /></td></tr>
- <tr><th>Default Styles</th><td><input type="text" name="default-styles" value="font-weight:normal;background:transparent;color:#000; padding-left: 5px;" /></td></tr>
- <tr><th>Keywords I (if, do, while etc)</th><td><input type="text" name="keywords-1" value="color: #a1a100;" /></td></tr>
- <tr><th>Keywords II (null, true, false etc)</th><td><input type="text" name="keywords-2" value="color: #000; font-weight: bold;" /></td></tr>
- <tr><th>Inbuilt Functions (echo, print etc)</th><td><input type="text" name="keywords-3" value="color: #000066;" /></td></tr>
- <tr><th>Data Types (int, boolean etc)</th><td><input type="text" name="keywords-4" value="color: #f63333;" /></td></tr>
-
- <tr><th>Comments (//, <!-- --> etc)</th><td><input type="text" name="comments" value="color: #808080;" /></td></tr>
- <tr><th>Escaped Characters (\n, \t etc)</th><td><input type="text" name="escaped-chars" value="color: #000033; font-weight: bold;" /></td></tr>
- <tr><th>Brackets ( ([{}]) etc)</th><td><input type="text" name="brackets" value="color: #66cc66;" /></td></tr>
- <tr><th>Strings ("foo" etc)</th><td><input type="text" name="strings" value="color: #ff0000;" /></td></tr>
- <tr><th>Numbers (1, -54, 2.5 etc)</th><td><input type="text" name="numbers" value="color: #ff33ff;" /></td></tr>
- <tr><th>Methods (Foo.bar() etc)</th><td><input type="text" name="methods" value="color: #006600;" /></td></tr>
-</table>';
-
- echo '<input type="hidden" name="geshi-path" value="' . realpath($geshi_path) . '" /><input type="hidden" name="geshi-lang-path" value="' . realpath($geshi_lang_path) . '" />
-<input type="submit" value="Step 3" /></form>';
-
- make_footer();
-}
-// Step 3
-elseif ( $step == 3 )
-{
- make_header('Step 3');
- echo '<p>Here is your completed stylesheet. Note that it may not be perfect - no regular expression styles are included for one thing,
-you\'ll have to add those yourself (php and xml are just two languages that use them), and line numbers are not included, however
-it includes most of the basic information.</p>';
-
- // Make the stylesheet
- $part_selector_1 = '';
- $part_selector_2 = '';
- $part_selector_3 = '';
-
- $langs = get_var('langs');
- $extra_langs = trim(get_var('extra-langs'));
- if ( $extra_langs != '' )
- {
- $l = explode("\r\n", $extra_langs);
- foreach ( $l as $lng )
- {
- $langs[$lng] = true;
- }
- }
-
-
- foreach ( $langs as $lang => $dummy )
- {
- $part_selector_1 .= ".$lang {PART}, ";
- $part_selector_2 .= ".$lang {PART1}, .$lang {PART2}, ";
- $part_selector_3 .= ".$lang {PART1}, .$lang {PART2}, .$lang {PART3}, ";
- }
- $part_selector_1 = substr($part_selector_1, 0, -2);
- $part_selector_2 = substr($part_selector_2, 0, -2);
- $part_selector_3 = substr($part_selector_3, 0, -2);
-
-
- $default_styles = get_var('default-styles');
- $ol_selector = str_replace('{PART}', 'ol', $part_selector_1);
- $overall_styles = get_var('overall');
- $overall_selector = str_replace('{PART}', '', $part_selector_1);
-
- $stylesheet = "/* GeSHi (c) Nigel McNie 2004 (http://qbnz.com/highlighter) */";
-
- if ( $overall != '' )
- {
- $stylesheet .= "\n$overall_selector {{$overall_styles}}";
- }
- if ( $default_styles != '' )
- {
- $default_selector = str_replace(array('{PART1}', '{PART2}'), array('.de1', '.de2'), $part_selector_2);
- $stylesheet .= "\n$default_selector {{$default_styles}}";
- }
-
- // Do keywords
- $keywords_1 = get_var('keywords-1');
- $keyword_selector_1 = str_replace('{PART}', '.kw1', $part_selector_1);
- if ( $keywords_1 != '' )
- {
- $stylesheet .= "\n$keyword_selector_1 {{$keywords_1}}";
- }
-
- $keywords_2 = get_var('keywords-2');
- $keyword_selector_2 = str_replace('{PART}', '.kw2', $part_selector_1);
- if ( $keywords_2 != '' )
- {
- $stylesheet .= "\n$keyword_selector_2 {{$keywords_2}}";
- }
-
- $keywords_3 = get_var('keywords-3');
- $keyword_selector_3 = str_replace('{PART}', '.kw3', $part_selector_1);
- if ( $keywords_3 != '' )
- {
- $stylesheet .= "\n$keyword_selector_3 {{$keywords_3}}";
- }
-
- $keywords_4 = get_var('keywords-4');
- $keyword_selector_4 = str_replace('{PART}', '.kw4', $part_selector_1);
- if ( $keywords_4 != '' )
- {
- $stylesheet .= "\n$keyword_selector_4 {{$keywords_4}}";
- }
-
- // Do other lexics
- $comments = get_var('comments');
- $comment_selector = str_replace(array('{PART1}', '{PART2}', '{PART3}'), array('.co1', '.co2', '.coMULTI'), $part_selector_3);
- if ( $comments != '' )
- {
- $stylesheet .= "\n$comment_selector {{$comments}}";
- }
-
- $esc = get_var('escaped-chars');
- $esc_selector = str_replace('{PART}', '.es0', $part_selector_1);
- if ( $esc != '' )
- {
- $stylesheet .= "\n$esc_selector {{$esc}}";
- }
-
- $brackets = get_var('brackets');
- $brk_selector = str_replace('{PART}', '.br0', $part_selector_1);
- if ( $brackets != '' )
- {
- $stylesheet .= "\n$brk_selector {{$brackets}}";
- }
-
- $strings = get_var('strings');
- $string_selector = str_replace('{PART}', '.st0', $part_selector_1);
- if ( $strings != '' )
- {
- $stylesheet .= "\n$string_selector {{$strings}}";
- }
-
- $numbers = get_var('numbers');
- $num_selector = str_replace('{PART}', '.nu0', $part_selector_1);
- if ( $numbers != '' )
- {
- $stylesheet .= "\n$num_selector {{$numbers}}";
- }
-
- $methods = get_var('methods');
- $method_selector = str_replace('{PART}', '.me0', $part_selector_1);
- if ( $methods != '' )
- {
- $stylesheet .= "\n$method_selector {{$methods}}";
- }
-
- echo "<pre>$stylesheet</pre>";
-
- make_footer();
-}
-
-?>
diff --git a/extensions/SyntaxHighlight_GeSHi/geshi/contrib/cssgen2.php b/extensions/SyntaxHighlight_GeSHi/geshi/contrib/cssgen2.php
deleted file mode 100644
index cc3c39cb..00000000
--- a/extensions/SyntaxHighlight_GeSHi/geshi/contrib/cssgen2.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/**
- * A simple script which outputs the CSS classes for all languages
- * supported by GeSHi. You can access it directly to download
- * the CSS file. On *NIX you can also do a simple `php cssgen.php > geshi.css`.
- *
- * This file is part of GeSHi.
- *
- * GeSHi is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GeSHi is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GeSHi; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package geshi
- * @subpackage contrib
- * @author revulo <revulon@gmail.com>
- * @copyright 2008 revulo
- * @license http://gnu.org/copyleft/gpl.html GNU GPL
- *
- */
-
-require dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'geshi.php';
-$geshi = new GeSHi;
-
-$languages = array();
-if ($handle = opendir($geshi->language_path)) {
- while (($file = readdir($handle)) !== false) {
- $pos = strpos($file, '.');
- if ($pos > 0 && substr($file, $pos) == '.php') {
- $languages[] = substr($file, 0, $pos);
- }
- }
- closedir($handle);
-}
-sort($languages);
-
-header('Content-Type: application/octet-stream');
-header('Content-Disposition: attachment; filename="geshi.css"');
-
-echo "/**\n".
- " * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann\n" .
- " * (http://qbnz.com/highlighter/ and http://geshi.org/)\n".
- " */\n";
-
-foreach ($languages as $language) {
- $geshi->set_language($language);
- // note: the false argument is required for stylesheet generators, see API documentation
- $css = $geshi->get_stylesheet(false);
- echo preg_replace('/^\/\*\*.*?\*\//s', '', $css);
-}
diff --git a/extensions/SyntaxHighlight_GeSHi/geshi/contrib/example.php b/extensions/SyntaxHighlight_GeSHi/geshi/contrib/example.php
deleted file mode 100644
index e07399e3..00000000
--- a/extensions/SyntaxHighlight_GeSHi/geshi/contrib/example.php
+++ /dev/null
@@ -1,217 +0,0 @@
-<?php
-/**
- * GeSHi example script
- *
- * Just point your browser at this script (with geshi.php in the parent directory,
- * and the language files in subdirectory "../geshi/")
- *
- * @author Nigel McNie
- * @version $Id: example.php 2510 2012-06-27 15:57:55Z reedy_boy $
- */
-header('Content-Type: text/html; charset=utf-8');
-
-error_reporting(E_ALL);
-
-// Rudimentary checking of where GeSHi is. In a default install it will be in ../, but
-// it could be in the current directory if the include_path is set. There's nowhere else
-// we can reasonably guess.
-if (is_readable('../geshi.php')) {
- $path = '../';
-} elseif (is_readable('geshi.php')) {
- $path = './';
-} else {
- die('Could not find geshi.php - make sure it is in your include path!');
-}
-require $path . 'geshi.php';
-
-$fill_source = false;
-if (isset($_POST['submit'])) {
- if (get_magic_quotes_gpc()) {
- $_POST['source'] = stripslashes($_POST['source']);
- }
- if (!strlen(trim($_POST['source']))) {
- $_POST['language'] = preg_replace('#[^a-zA-Z0-9\-_]#', '', $_POST['language']);
- $_POST['source'] = implode('', @file($path . 'geshi/' . $_POST['language'] . '.php'));
- $_POST['language'] = 'php';
- } else {
- $fill_source = true;
- }
-
- // Here's a free demo of how GeSHi works.
-
- // First the initialisation: source code to highlight and the language to use. Make sure
- // you sanitise correctly if you use $_POST of course - this very script has had a security
- // advisory against it in the past because of this. Please try not to use this script on a
- // live site.
- $geshi = new GeSHi($_POST['source'], $_POST['language']);
-
- // Use the PRE_VALID header. This means less output source since we don't have to output &nbsp;
- // everywhere. Of course it also means you can't set the tab width.
- // HEADER_PRE_VALID puts the <pre> tag inside the list items (<li>) thus producing valid HTML markup.
- // HEADER_PRE puts the <pre> tag around the list (<ol>) which is invalid in HTML 4 and XHTML 1
- // HEADER_DIV puts a <div> tag arount the list (valid!) but needs to replace whitespaces with &nbsp
- // thus producing much larger overhead. You can set the tab width though.
- $geshi->set_header_type(GESHI_HEADER_PRE_VALID);
-
- // Enable CSS classes. You can use get_stylesheet() to output a stylesheet for your code. Using
- // CSS classes results in much less output source.
- $geshi->enable_classes();
-
- // Enable line numbers. We want fancy line numbers, and we want every 5th line number to be fancy
- $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 5);
-
- // Set the style for the PRE around the code. The line numbers are contained within this box (not
- // XHTML compliant btw, but if you are liberally minded about these things then you'll appreciate
- // the reduced source output).
- $geshi->set_overall_style('font: normal normal 90% monospace; color: #000066; border: 1px solid #d0d0d0; background-color: #f0f0f0;', false);
-
- // Set the style for line numbers. In order to get style for line numbers working, the <li> element
- // is being styled. This means that the code on the line will also be styled, and most of the time
- // you don't want this. So the set_code_style reverts styles for the line (by using a <div> on the line).
- // So the source output looks like this:
- //
- // <pre style="[set_overall_style styles]"><ol>
- // <li style="[set_line_style styles]"><div style="[set_code_style styles]>...</div></li>
- // ...
- // </ol></pre>
- $geshi->set_line_style('color: #003030;', 'font-weight: bold; color: #006060;', true);
- $geshi->set_code_style('color: #000020;', true);
-
- // Styles for hyperlinks in the code. GESHI_LINK for default styles, GESHI_HOVER for hover style etc...
- // note that classes must be enabled for this to work.
- $geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
- $geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
-
- // Use the header/footer functionality. This puts a div with content within the PRE element, so it is
- // affected by the styles set by set_overall_style. So if the PRE has a border then the header/footer will
- // appear inside it.
- $geshi->set_header_content('<SPEED> <TIME> GeSHi &copy; 2004-2007, Nigel McNie, 2007-2008 Benny Baumann. View source of example.php for example of using GeSHi');
- $geshi->set_header_content_style('font-family: sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;');
-
- // You can use <TIME> and <VERSION> as placeholders
- $geshi->set_footer_content('Parsed in <TIME> seconds at <SPEED>, using GeSHi <VERSION>');
- $geshi->set_footer_content_style('font-family: sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-top: 1px solid #d0d0d0; padding: 2px;');
-} else {
- // make sure we don't preselect any language
- $_POST['language'] = null;
-}
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>GeSHi examples</title>
- <style type="text/css">
- <!--
- <?php
- if (isset($_POST['submit'])) {
- // Output the stylesheet. Note it doesn't output the <style> tag
- echo $geshi->get_stylesheet(true);
- }
- ?>
- html {
- background-color: #f0f0f0;
- }
- body {
- font-family: Verdana, Arial, sans-serif;
- margin: 10px;
- border: 2px solid #e0e0e0;
- background-color: #fcfcfc;
- padding: 5px;
- }
- h2 {
- margin: .1em 0 .2em .5em;
- border-bottom: 1px solid #b0b0b0;
- color: #b0b0b0;
- font-weight: normal;
- font-size: 150%;
- }
- h3 {
- margin: .1em 0 .2em .5em;
- color: #b0b0b0;
- font-weight: normal;
- font-size: 120%;
- }
- #footer {
- text-align: center;
- font-size: 80%;
- color: #a9a9a9;
- }
- #footer a {
- color: #9999ff;
- }
- textarea {
- border: 1px solid #b0b0b0;
- font-size: 90%;
- color: #333;
- margin-left: 20px;
- }
- select, input {
- margin-left: 20px;
- }
- p {
- font-size: 90%;
- margin-left: .5em;
- }
- -->
- </style>
-</head>
-<body>
-<h2>GeSHi Example Script</h2>
-<p>To use this script, make sure that <strong>geshi.php</strong> is in the parent directory or in your
-include_path, and that the language files are in a subdirectory of GeSHi's directory called <strong>geshi/</strong>.</p>
-<p>Enter your source and a language to highlight the source in and submit, or just choose a language to
-have that language file highlighted in PHP.</p>
-<?php
-if (isset($_POST['submit'])) {
- // The fun part :)
- echo $geshi->parse_code();
- echo '<hr />';
-}
-?>
-<form action="<?php echo basename($_SERVER['PHP_SELF']); ?>" method="post">
-<h3>Source to highlight</h3>
-<p>
-<textarea rows="10" cols="60" name="source" id="source"><?php echo $fill_source ? htmlspecialchars($_POST['source']) : '' ?></textarea>
-</p>
-<h3>Choose a language</h3>
-<p>
-<select name="language" id="language">
-<?php
-if (!($dir = @opendir(dirname(__FILE__) . '/geshi'))) {
- if (!($dir = @opendir(dirname(__FILE__) . '/../geshi'))) {
- echo '<option>No languages available!</option>';
- }
-}
-$languages = array();
-while ($file = readdir($dir)) {
- if ( $file[0] == '.' || strpos($file, '.', 1) === false) {
- continue;
- }
- $lang = substr($file, 0, strpos($file, '.'));
- $languages[] = $lang;
-}
-closedir($dir);
-sort($languages);
-foreach ($languages as $lang) {
- if (isset($_POST['language']) && $_POST['language'] == $lang) {
- $selected = 'selected="selected"';
- } else {
- $selected = '';
- }
- echo '<option value="' . $lang . '" '. $selected .'>' . $lang . "</option>\n";
-}
-
-?>
-</select>
-</p>
-<p>
-<input type="submit" name="submit" value="Highlight Source" />
-<input type="submit" name="clear" onclick="document.getElementById('source').value='';document.getElementById('language').value='';return false" value="clear" />
-</p>
-</form>
-<div id="footer">GeSHi &copy; Nigel McNie, 2004, released under the GNU GPL<br />
-For a better demonstration, check out the <a href="http://qbnz.com/highlighter/demo.php">online demo</a>
-</div>
-</body>
-</html>
diff --git a/extensions/SyntaxHighlight_GeSHi/geshi/contrib/langcheck.php b/extensions/SyntaxHighlight_GeSHi/geshi/contrib/langcheck.php
deleted file mode 100644
index fa8288be..00000000
--- a/extensions/SyntaxHighlight_GeSHi/geshi/contrib/langcheck.php
+++ /dev/null
@@ -1,769 +0,0 @@
-<?php
-/**
- * GeSHi language file validation script
- *
- * Just point your browser at this script (with geshi.php in the parent directory)
- * and the language files in subdirectory "../geshi/" are being validated
- *
- * CLI mode is supported
- *
- * @author Benny Baumann
- * @version $Id: langcheck.php 2510 2012-06-27 15:57:55Z reedy_boy $
- */
-header('Content-Type: text/html; charset=utf-8');
-
-set_time_limit(0);
-error_reporting(E_ALL);
-$time_start = explode(' ', microtime());
-
-function colorize($level, $string) {
- static $colors, $end;
- if ( !isset($colors) ) {
- if ( PHP_SAPI != 'cli' ) {
- $end = '</span>';
- $colors = array(
- TYPE_NOTICE => '<span style="color:#080;font-weight:bold;">',
- TYPE_WARNING => '<span style="color:#CC0; font-weight: bold;">',
- TYPE_ERROR => '<span style="color:#F00; font-weight: bold;">',
- TYPE_OK => '<span style="color: #080; font-weight: bold;">'
- );
- } else {
- $end = chr(27).'[0m';
- $colors = array(
- TYPE_NOTICE => chr(27).'[1m',
- TYPE_WARNING => chr(27).'[1;33m',
- TYPE_ERROR => chr(27).'[1;31m',
- TYPE_OK => chr(27).'[1;32m'
- );
- }
- }
-
- if ( !isset($colors[$level]) ) {
- trigger_error("no colors for level $level", E_USER_ERROR);
- }
-
- return $colors[$level].$string.$end;
-}
-
-define ('TYPE_NOTICE', 0);
-define ('TYPE_WARNING', 1);
-define ('TYPE_ERROR', 2);
-define ('TYPE_OK', 3);
-
-$error_abort = false;
-$error_cache = array();
-function output_error_cache(){
- global $error_cache, $error_abort;
-
- if(count($error_cache)) {
- echo colorize(TYPE_ERROR, "Failed");
- if ( PHP_SAPI == 'cli' ) {
- echo "\n\n";
- } else {
- echo "<br /><ol>\n";
- }
- foreach($error_cache as $error_msg) {
- if ( PHP_SAPI == 'cli' ) {
- echo "\n";
- } else {
- echo "<li>";
- }
- switch($error_msg['t']) {
- case TYPE_NOTICE:
- $msg = 'NOTICE';
- break;
- case TYPE_WARNING:
- $msg = 'WARNING';
- break;
- case TYPE_ERROR:
- $msg = 'ERROR';
- break;
- }
- echo colorize($error_msg['t'], $msg);
- if ( PHP_SAPI == 'cli' ) {
- echo "\t" . $error_msg['m'];
- } else {
- echo " " . $error_msg['m'] . "</li>";
- }
- }
- if ( PHP_SAPI == 'cli' ) {
- echo "\n";
- } else {
- echo "</ol>\n";
- }
- } else {
- echo colorize(TYPE_OK, "OK");
- if ( PHP_SAPI == 'cli' ) {
- echo "\n";
- } else {
- echo "\n<br />";
- }
- }
- echo "\n";
-
- $error_cache = array();
-}
-
-function report_error($type, $message) {
- global $error_cache, $error_abort;
-
- $error_cache[] = array('t' => $type, 'm' => $message);
- if(TYPE_ERROR == $type) {
- $error_abort = true;
- }
-}
-
-function dupfind_strtolower(&$value){
- $value = strtolower($value);
-}
-
-if ( PHP_SAPI != 'cli' ) { ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>GeSHi Language File Validation Script</title>
- <style type="text/css">
- <!--
- html {
- background-color: #f0f0f0;
- }
- body {
- font-family: Verdana, Arial, sans-serif;
- margin: 10px;
- border: 2px solid #e0e0e0;
- background-color: #fcfcfc;
- padding: 5px;
- font-size: 10pt;
- }
- h2 {
- margin: .1em 0 .2em .5em;
- border-bottom: 1px solid #b0b0b0;
- color: #b0b0b0;
- font-weight: normal;
- font-size: 150%;
- }
- h3 {
- margin: .1em 0 .2em .5em;
- color: #b0b0b0;
- font-weight: normal;
- font-size: 120%;
- }
- #footer {
- text-align: center;
- font-size: 80%;
- color: #a9a9a9;
- }
- #footer a {
- color: #9999ff;
- }
- textarea {
- border: 1px solid #b0b0b0;
- font-size: 90%;
- color: #333;
- margin-left: 20px;
- }
- select, input {
- margin-left: 20px;
- }
- p {
- font-size: 90%;
- margin-left: .5em;
- }
- -->
- </style>
-</head>
-<body>
-<h2>GeSHi Language File Validation Script</h2>
-<p>To use this script, make sure that <strong>geshi.php</strong> is in the
-parent directory or in your include_path, and that the language files are in a
-subdirectory of GeSHi's directory called <strong>geshi/</strong>.</p>
-<p>Everything else will be done by this script automatically. After the script
-finished you should see messages of what could cause trouble with GeSHi or where
-your language files can be improved. Please be patient, as this might take some time.</p>
-
-<ol>
-<li>Checking where to find GeSHi installation ...<?php
-} else { ?>
-<?php echo colorize(TYPE_NOTICE, "#### GeSHi Language File Validation Script ####") ?>
-
-
-To use this script, make sure that <?php echo colorize(TYPE_NOTICE, "geshi.php"); ?> is in the
-parent directory or in your include_path, and that the language files are in a
-subdirectory of GeSHi's directory called <?php echo colorize(TYPE_NOTICE, "geshi/"); ?>.
-
-Everything else will be done by this script automatically. After the script
-finished you should see messages of what could cause trouble with GeSHi or where
-your language files can be improved. Please be patient, as this might take some time.
-
-
-Checking where to find GeSHi installation ...<?php echo "\t";
-}
-
-// Rudimentary checking of where GeSHi is. In a default install it will be in ../, but
-// it could be in the current directory if the include_path is set. There's nowhere else
-// we can reasonably guess.
-if (is_readable('../geshi.php')) {
- $path = '../';
-} elseif (is_readable('geshi.php')) {
- $path = './';
-} else {
- report_error(TYPE_ERROR, 'Could not find geshi.php - make sure it is in your include path!');
-}
-
-if(!$error_abort) {
- require $path . 'geshi.php';
-
- if(!class_exists('GeSHi')) {
- report_error(TYPE_ERROR, 'The GeSHi class was not found, although it seemed we loaded the correct file!');
- }
-}
-
-if(!$error_abort) {
- if(!defined('GESHI_LANG_ROOT')) {
- report_error(TYPE_ERROR, 'There\'s no information present on where to find the language files!');
- } elseif(!is_dir(GESHI_LANG_ROOT)) {
- report_error(TYPE_ERROR, 'The path "'.GESHI_LANG_ROOT.'" given, does not ressemble a directory!');
- } elseif(!is_readable(GESHI_LANG_ROOT)) {
- report_error(TYPE_ERROR, 'The path "'.GESHI_LANG_ROOT.'" is not readable to this script!');
- }
-}
-
-output_error_cache();
-
-if(!$error_abort) {
- if ( PHP_SAPI == 'cli' ) {
- echo "Listing available language files ...\t\t";
- } else {
- echo "</li>\n<li>Listing available language files ... ";
- }
-
- if (!($dir = @opendir(GESHI_LANG_ROOT))) {
- report_error(TYPE_ERROR, 'Error requesting listing for available language files!');
- }
-
- $languages = array();
-
- if(!$error_abort) {
- while ($file = readdir($dir)) {
- if (!$file || $file[0] == '.' || strpos($file, '.php') === false) {
- continue;
- }
- $lang = substr($file, 0, strpos($file, '.'));
- if(4 != strlen($file) - strlen($lang)) {
- continue;
- }
- $languages[] = $lang;
- }
- closedir($dir);
- }
-
- $languages = array_unique($languages);
- sort($languages);
-
- if(!count($languages)) {
- report_error(TYPE_WARNING, 'Unable to locate any usable language files in "'.GESHI_LANG_ROOT.'"!');
- }
-
- output_error_cache();
-}
-
-if ( PHP_SAPI == 'cli' ) {
- if (isset($_SERVER['argv'][1]) && in_array($_SERVER['argv'][1], $languages)) {
- $languages = array($_SERVER['argv'][1]);
- }
-} else {
- if (isset($_REQUEST['show']) && in_array($_REQUEST['show'], $languages)) {
- $languages = array($_REQUEST['show']);
- }
-}
-
-if(!$error_abort) {
- foreach ($languages as $lang) {
-
- if ( PHP_SAPI == 'cli' ) {
- echo "Validating language file for '$lang' ...\t\t";
- } else {
- echo "</li>\n<li>Validating language file for '$lang' ... ";
- }
-
- $langfile = GESHI_LANG_ROOT . $lang . '.php';
-
- $language_data = array();
-
- if(!is_file($langfile)) {
- report_error(TYPE_ERROR, 'The path "' .$langfile. '" does not ressemble a regular file!');
- } elseif(!is_readable($langfile)) {
- report_error(TYPE_ERROR, 'Cannot read file "' .$langfile. '"!');
- } else {
- $langfile_content = file_get_contents($langfile);
- if(preg_match("/\?>(?:\r?\n|\r(?!\n)){2,}\Z/", $langfile_content)) {
- report_error(TYPE_ERROR, 'Language file contains trailing empty lines at EOF!');
- }
- if(!preg_match("/\?>(?:\r?\n|\r(?!\n))?\Z/", $langfile_content)) {
- report_error(TYPE_ERROR, 'Language file contains no PHP end marker at EOF!');
- }
- if(preg_match("/\t/", $langfile_content)) {
- report_error(TYPE_NOTICE, 'Language file contains unescaped tabulator chars (probably for indentation)!');
- }
- if(preg_match('/^(?: )*(?! )(?! \*) /m', $langfile_content)) {
- report_error(TYPE_NOTICE, 'Language file contains irregular indentation (other than 4 spaces per indentation level)!');
- }
-
- if(!preg_match("/\/\*\*((?!\*\/).)*?Author:((?!\*\/).)*?\*\//s", $langfile_content)) {
- report_error(TYPE_WARNING, 'Language file does not contain a specification of an author!');
- }
- if(!preg_match("/\/\*\*((?!\*\/).)*?Copyright:((?!\*\/).)*?\*\//s", $langfile_content)) {
- report_error(TYPE_WARNING, 'Language file does not contain a specification of the copyright!');
- }
- if(!preg_match("/\/\*\*((?!\*\/).)*?Release Version:((?!\*\/).)*?\*\//s", $langfile_content)) {
- report_error(TYPE_WARNING, 'Language file does not contain a specification of the release version!');
- }
- if(!preg_match("/\/\*\*((?!\*\/).)*?Date Started:((?!\*\/).)*?\*\//s", $langfile_content)) {
- report_error(TYPE_WARNING, 'Language file does not contain a specification of the date it was started!');
- }
- if(!preg_match("/\/\*\*((?!\*\/).)*?This file is part of GeSHi\.((?!\*\/).)*?\*\//s", $langfile_content)) {
- report_error(TYPE_WARNING, 'Language file does not state that it belongs to GeSHi!');
- }
- if(!preg_match("/\/\*\*((?!\*\/).)*?language file for GeSHi\.((?!\*\/).)*?\*\//s", $langfile_content)) {
- report_error(TYPE_WARNING, 'Language file does not state that it is a language file for GeSHi!');
- }
- if(!preg_match("/\/\*\*((?!\*\/).)*?GNU General Public License((?!\*\/).)*?\*\//s", $langfile_content)) {
- report_error(TYPE_WARNING, 'Language file does not state that it is provided under the terms of the GNU GPL!');
- }
-
- unset($langfile_content);
-
- include $langfile;
-
- if(!isset($language_data)) {
- report_error(TYPE_ERROR, 'Language file does not contain a $language_data structure to check!');
- } elseif (!is_array($language_data)) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data structure which is not an array!');
- }
- }
-
- if(!$error_abort) {
- if(!isset($language_data['LANG_NAME'])) {
- report_error(TYPE_ERROR, 'Language file contains no $language_data[\'LANG_NAME\'] specification!');
- } elseif (!is_string($language_data['LANG_NAME'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'LANG_NAME\'] specification which is not a string!');
- }
-
- if(!isset($language_data['COMMENT_SINGLE'])) {
- report_error(TYPE_ERROR, 'Language file contains no $language_data[\'COMMENT_SIGNLE\'] structure to check!');
- } elseif (!is_array($language_data['COMMENT_SINGLE'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'COMMENT_SINGLE\'] structure which is not an array!');
- }
-
- if(!isset($language_data['COMMENT_MULTI'])) {
- report_error(TYPE_ERROR, 'Language file contains no $language_data[\'COMMENT_MULTI\'] structure to check!');
- } elseif (!is_array($language_data['COMMENT_MULTI'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'COMMENT_MULTI\'] structure which is not an array!');
- }
-
- if(isset($language_data['COMMENT_REGEXP'])) {
- if (!is_array($language_data['COMMENT_REGEXP'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'COMMENT_REGEXP\'] structure which is not an array!');
- }
- }
-
- if(!isset($language_data['QUOTEMARKS'])) {
- report_error(TYPE_ERROR, 'Language file contains no $language_data[\'QUOTEMARKS\'] structure to check!');
- } elseif (!is_array($language_data['QUOTEMARKS'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'QUOTEMARKS\'] structure which is not an array!');
- }
-
- if(isset($language_data['HARDQUOTE'])) {
- if (!is_array($language_data['HARDQUOTE'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'HARDQUOTE\'] structure which is not an array!');
- }
- }
-
- if(!isset($language_data['ESCAPE_CHAR'])) {
- report_error(TYPE_ERROR, 'Language file contains no $language_data[\'ESCAPE_CHAR\'] specification to check!');
- } elseif (!is_string($language_data['ESCAPE_CHAR'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'ESCAPE_CHAR\'] specification which is not a string!');
- } elseif (1 < strlen($language_data['ESCAPE_CHAR'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'ESCAPE_CHAR\'] specification is not empty or exactly one char!');
- }
-
- if(!isset($language_data['CASE_KEYWORDS'])) {
- report_error(TYPE_ERROR, 'Language file contains no $language_data[\'CASE_KEYWORDS\'] specification!');
- } elseif (!is_int($language_data['CASE_KEYWORDS'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'CASE_KEYWORDS\'] specification which is not an integer!');
- } elseif (GESHI_CAPS_NO_CHANGE != $language_data['CASE_KEYWORDS'] &&
- GESHI_CAPS_LOWER != $language_data['CASE_KEYWORDS'] &&
- GESHI_CAPS_UPPER != $language_data['CASE_KEYWORDS']) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'CASE_KEYWORDS\'] specification which is neither of GESHI_CAPS_NO_CHANGE, GESHI_CAPS_LOWER nor GESHI_CAPS_UPPER!');
- }
-
- if(!isset($language_data['KEYWORDS'])) {
- report_error(TYPE_ERROR, 'Language file contains no $language_data[\'KEYWORDS\'] structure to check!');
- } elseif (!is_array($language_data['KEYWORDS'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'KEYWORDS\'] structure which is not an array!');
- } else {
- foreach($language_data['KEYWORDS'] as $kw_key => $kw_value) {
- if(!is_integer($kw_key)) {
- report_error(TYPE_WARNING, "Language file contains an key '$kw_key' in \$language_data['KEYWORDS'] that is not integer!");
- } elseif (!is_array($kw_value)) {
- report_error(TYPE_ERROR, "Language file contains a \$language_data['KEYWORDS']['$kw_value'] structure which is not an array!");
- }
- }
- }
-
- if(!isset($language_data['SYMBOLS'])) {
- report_error(TYPE_ERROR, 'Language file contains no $language_data[\'SYMBOLS\'] structure to check!');
- } elseif (!is_array($language_data['SYMBOLS'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'SYMBOLS\'] structure which is not an array!');
- }
-
- if(!isset($language_data['CASE_SENSITIVE'])) {
- report_error(TYPE_ERROR, 'Language file contains no $language_data[\'CASE_SENSITIVE\'] structure to check!');
- } elseif (!is_array($language_data['CASE_SENSITIVE'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'CASE_SENSITIVE\'] structure which is not an array!');
- } else {
- foreach($language_data['CASE_SENSITIVE'] as $cs_key => $cs_value) {
- if(!is_integer($cs_key)) {
- report_error(TYPE_WARNING, "Language file contains an key '$cs_key' in \$language_data['CASE_SENSITIVE'] that is not integer!");
- } elseif (!is_bool($cs_value)) {
- report_error(TYPE_ERROR, "Language file contains a Case Sensitivity specification for \$language_data['CASE_SENSITIVE']['$cs_value'] which is not a boolean!");
- }
- }
- }
-
- if(!isset($language_data['URLS'])) {
- report_error(TYPE_ERROR, 'Language file contains no $language_data[\'URLS\'] structure to check!');
- } elseif (!is_array($language_data['URLS'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'URLS\'] structure which is not an array!');
- } else {
- foreach($language_data['URLS'] as $url_key => $url_value) {
- if(!is_integer($url_key)) {
- report_error(TYPE_WARNING, "Language file contains an key '$url_key' in \$language_data['URLS'] that is not integer!");
- } elseif (!is_string($url_value)) {
- report_error(TYPE_ERROR, "Language file contains a Documentation URL specification for \$language_data['URLS']['$url_value'] which is not a string!");
- } elseif (preg_match('#&([^;]*(=|$))#U', $url_value)) {
- report_error(TYPE_ERROR, "Language file contains unescaped ampersands (&amp;) in \$language_data['URLS']!");
- }
- }
- }
-
- if(!isset($language_data['OOLANG'])) {
- report_error(TYPE_ERROR, 'Language file contains no $language_data[\'OOLANG\'] specification!');
- } elseif (!is_int($language_data['OOLANG']) && !is_bool($language_data['OOLANG'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'OOLANG\'] specification which is neither boolean nor integer!');
- } elseif (false !== $language_data['OOLANG'] &&
- true !== $language_data['OOLANG'] &&
- 2 !== $language_data['OOLANG']) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'OOLANG\'] specification which is neither of false, true or 2!');
- }
-
- if(!isset($language_data['OBJECT_SPLITTERS'])) {
- report_error(TYPE_ERROR, 'Language file contains no $language_data[\'OBJECT_SPLITTERS\'] structure to check!');
- } elseif (!is_array($language_data['OBJECT_SPLITTERS'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'OBJECT_SPLITTERS\'] structure which is not an array!');
- }
-
- if(!isset($language_data['REGEXPS'])) {
- report_error(TYPE_ERROR, 'Language file contains no $language_data[\'REGEXPS\'] structure to check!');
- } elseif (!is_array($language_data['REGEXPS'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'REGEXPS\'] structure which is not an array!');
- }
-
- if(!isset($language_data['STRICT_MODE_APPLIES'])) {
- report_error(TYPE_ERROR, 'Language file contains no $language_data[\'STRICT_MODE_APPLIES\'] specification!');
- } elseif (!is_int($language_data['STRICT_MODE_APPLIES'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'STRICT_MODE_APPLIES\'] specification which is not an integer!');
- } elseif (GESHI_MAYBE != $language_data['STRICT_MODE_APPLIES'] &&
- GESHI_ALWAYS != $language_data['STRICT_MODE_APPLIES'] &&
- GESHI_NEVER != $language_data['STRICT_MODE_APPLIES']) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'STRICT_MODE_APPLIES\'] specification which is neither of GESHI_MAYBE, GESHI_ALWAYS nor GESHI_NEVER!');
- }
-
- if(!isset($language_data['SCRIPT_DELIMITERS'])) {
- report_error(TYPE_ERROR, 'Language file contains no $language_data[\'SCRIPT_DELIMITERS\'] structure to check!');
- } elseif (!is_array($language_data['SCRIPT_DELIMITERS'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'SCRIPT_DELIMITERS\'] structure which is not an array!');
- }
-
- if(!isset($language_data['HIGHLIGHT_STRICT_BLOCK'])) {
- report_error(TYPE_ERROR, 'Language file contains no $language_data[\'HIGHLIGHT_STRICT_BLOCK\'] structure to check!');
- } elseif (!is_array($language_data['HIGHLIGHT_STRICT_BLOCK'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'HIGHLIGHT_STRICT_BLOCK\'] structure which is not an array!');
- }
-
- if(isset($language_data['TAB_WIDTH'])) {
- if (!is_int($language_data['TAB_WIDTH'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'TAB_WIDTH\'] specification which is not an integer!');
- } elseif (1 > $language_data['TAB_WIDTH']) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'TAB_WIDTH\'] specification which is less than 1!');
- }
- }
-
- if(isset($language_data['PARSER_CONTROL'])) {
- if (!is_array($language_data['PARSER_CONTROL'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'PARSER_CONTROL\'] structure which is not an array!');
- }
- }
-
- if(!isset($language_data['STYLES'])) {
- report_error(TYPE_ERROR, 'Language file contains no $language_data[\'STYLES\'] structure to check!');
- } elseif (!is_array($language_data['STYLES'])) {
- report_error(TYPE_ERROR, 'Language file contains a $language_data[\'STYLES\'] structure which is not an array!');
- } else {
- $style_arrays = array('KEYWORDS', 'COMMENTS', 'ESCAPE_CHAR',
- 'BRACKETS', 'STRINGS', 'NUMBERS', 'METHODS', 'SYMBOLS',
- 'REGEXPS', 'SCRIPT');
- foreach($style_arrays as $style_kind) {
- if(!isset($language_data['STYLES'][$style_kind])) {
- report_error(TYPE_ERROR, "Language file contains no \$language_data['STYLES']['$style_kind'] structure to check!");
- } elseif (!is_array($language_data['STYLES'][$style_kind])) {
- report_error(TYPE_ERROR, "Language file contains a \$language_data['STYLES\']['$style_kind'] structure which is not an array!");
- } else {
- foreach($language_data['STYLES'][$style_kind] as $sk_key => $sk_value) {
- if(!is_int($sk_key) && ('COMMENTS' != $style_kind && 'MULTI' != $sk_key)
- && !(('STRINGS' == $style_kind || 'ESCAPE_CHAR' == $style_kind) && 'HARD' == $sk_key)) {
- report_error(TYPE_WARNING, "Language file contains an key '$sk_key' in \$language_data['STYLES']['$style_kind'] that is not integer!");
- } elseif (!is_string($sk_value)) {
- report_error(TYPE_WARNING, "Language file contains a CSS specification for \$language_data['STYLES']['$style_kind'][$key] which is not a string!");
- }
- }
- }
- }
-
- unset($style_arrays);
- }
- }
-
- if(!$error_abort) {
- //Initial sanity checks survived? --> Let's dig deeper!
- foreach($language_data['KEYWORDS'] as $key => $keywords) {
- if(!isset($language_data['CASE_SENSITIVE'][$key])) {
- report_error(TYPE_ERROR, "Language file contains no \$language_data['CASE_SENSITIVE'] specification for keyword group $key!");
- }
- if(!isset($language_data['URLS'][$key])) {
- report_error(TYPE_ERROR, "Language file contains no \$language_data['URLS'] specification for keyword group $key!");
- }
- if(empty($keywords)) {
- report_error(TYPE_WARNING, "Language file contains an empty keyword list in \$language_data['KEYWORDS'] for group $key!");
- }
- foreach($keywords as $id => $kw) {
- if(!is_string($kw)) {
- report_error(TYPE_WARNING, "Language file contains an non-string entry at \$language_data['KEYWORDS'][$key][$id]!");
- } elseif (!strlen($kw)) {
- report_error(TYPE_ERROR, "Language file contains an empty string entry at \$language_data['KEYWORDS'][$key][$id]!");
- } elseif (preg_match('/^([\(\)\{\}\[\]\^=.,:;\-+\*\/%\$\"\'\?]|&[\w#]\w*;)+$/i', $kw)) {
- report_error(TYPE_NOTICE, "Language file contains an keyword ('$kw') at \$language_data['KEYWORDS'][$key][$id] which seems to be better suited for the symbols section!");
- }
- }
- if(isset($language_data['CASE_SENSITIVE'][$key]) && !$language_data['CASE_SENSITIVE'][$key]) {
- array_walk($keywords, 'dupfind_strtolower');
- }
- if(count($keywords) != count(array_unique($keywords))) {
- $kw_diffs = array_count_values($keywords);
- foreach($kw_diffs as $kw => $kw_count) {
- if($kw_count > 1) {
- report_error(TYPE_WARNING, "Language file contains per-group duplicate keyword '$kw' in \$language_data['KEYWORDS'][$key]!");
- }
- }
- }
- }
-
- $disallowed_before = "(?<![a-zA-Z0-9\$_\|\#;>|^&";
- $disallowed_after = "(?![a-zA-Z0-9_\|%\\-&;";
-
- foreach($language_data['KEYWORDS'] as $key => $keywords) {
- foreach($language_data['KEYWORDS'] as $key2 => $keywords2) {
- if($key2 <= $key) {
- continue;
- }
- $kw_diffs = array_intersect($keywords, $keywords2);
- foreach($kw_diffs as $kw) {
- if(isset($language_data['PARSER_CONTROL']['KEYWORDS'])) {
- //Check the precondition\post-cindition for the involved keyword groups
- $g1_pre = $disallowed_before;
- $g2_pre = $disallowed_before;
- $g1_post = $disallowed_after;
- $g2_post = $disallowed_after;
- if(isset($language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_BEFORE'])) {
- $g1_pre = $language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_BEFORE'];
- $g2_pre = $language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_BEFORE'];
- }
- if(isset($language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_AFTER'])) {
- $g1_post = $language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_AFTER'];
- $g2_post = $language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_AFTER'];
- }
-
- if(isset($language_data['PARSER_CONTROL']['KEYWORDS'][$key]['DISALLOWED_BEFORE'])) {
- $g1_pre = $language_data['PARSER_CONTROL']['KEYWORDS'][$key]['DISALLOWED_BEFORE'];
- }
- if(isset($language_data['PARSER_CONTROL']['KEYWORDS'][$key]['DISALLOWED_AFTER'])) {
- $g1_post = $language_data['PARSER_CONTROL']['KEYWORDS'][$key]['DISALLOWED_AFTER'];
- }
-
- if(isset($language_data['PARSER_CONTROL']['KEYWORDS'][$key2]['DISALLOWED_BEFORE'])) {
- $g2_pre = $language_data['PARSER_CONTROL']['KEYWORDS'][$key2]['DISALLOWED_BEFORE'];
- }
- if(isset($language_data['PARSER_CONTROL']['KEYWORDS'][$key2]['DISALLOWED_AFTER'])) {
- $g2_post = $language_data['PARSER_CONTROL']['KEYWORDS'][$key2]['DISALLOWED_AFTER'];
- }
-
- if($g1_pre != $g2_pre || $g1_post != $g2_post) {
- continue;
- }
- }
- report_error(TYPE_WARNING, "Language file contains cross-group duplicate keyword '$kw' in \$language_data['KEYWORDS'][$key] and \$language_data['KEYWORDS'][$key2]!");
- }
- }
- }
- foreach($language_data['CASE_SENSITIVE'] as $key => $keywords) {
- if(!isset($language_data['KEYWORDS'][$key]) && $key != GESHI_COMMENTS) {
- report_error(TYPE_WARNING, "Language file contains an superfluous \$language_data['CASE_SENSITIVE'] specification for non-existing keyword group $key!");
- }
- }
- foreach($language_data['URLS'] as $key => $keywords) {
- if(!isset($language_data['KEYWORDS'][$key])) {
- report_error(TYPE_WARNING, "Language file contains an superfluous \$language_data['URLS'] specification for non-existing keyword group $key!");
- }
- }
- foreach($language_data['STYLES']['KEYWORDS'] as $key => $keywords) {
- if(!isset($language_data['KEYWORDS'][$key])) {
- report_error(TYPE_WARNING, "Language file contains an superfluous \$language_data['STYLES']['KEYWORDS'] specification for non-existing keyword group $key!");
- }
- }
-
- foreach($language_data['COMMENT_SINGLE'] as $ck => $cv) {
- if(!is_int($ck)) {
- report_error(TYPE_WARNING, "Language file contains an key '$ck' in \$language_data['COMMENT_SINGLE'] that is not integer!");
- }
- if(!is_string($cv)) {
- report_error(TYPE_WARNING, "Language file contains an non-string entry at \$language_data['COMMENT_SINGLE'][$ck]!");
- }
- if(!isset($language_data['STYLES']['COMMENTS'][$ck])) {
- report_error(TYPE_WARNING, "Language file contains no \$language_data['STYLES']['COMMENTS'] specification for comment group $ck!");
- }
- }
- if(isset($language_data['COMMENT_REGEXP'])) {
- foreach($language_data['COMMENT_REGEXP'] as $ck => $cv) {
- if(!is_int($ck)) {
- report_error(TYPE_WARNING, "Language file contains an key '$ck' in \$language_data['COMMENT_REGEXP'] that is not integer!");
- }
- if(!is_string($cv)) {
- report_error(TYPE_WARNING, "Language file contains an non-string entry at \$language_data['COMMENT_REGEXP'][$ck]!");
- }
- if(!isset($language_data['STYLES']['COMMENTS'][$ck])) {
- report_error(TYPE_WARNING, "Language file contains no \$language_data['STYLES']['COMMENTS'] specification for comment group $ck!");
- }
- }
- }
- foreach($language_data['STYLES']['COMMENTS'] as $ck => $cv) {
- if($ck != 'MULTI' && !isset($language_data['COMMENT_SINGLE'][$ck]) &&
- !isset($language_data['COMMENT_REGEXP'][$ck])) {
- report_error(TYPE_NOTICE, "Language file contains an superfluous \$language_data['STYLES']['COMMENTS'] specification for Single Line or Regular-Expression Comment key $ck!");
- }
- }
- if (isset($language_data['STYLES']['STRINGS']['HARD'])) {
- if (empty($language_data['HARDQUOTE'])) {
- report_error(TYPE_NOTICE, "Language file contains superfluous \$language_data['STYLES']['STRINGS'] specification for key 'HARD', but no 'HARDQUOTE's are defined!");
- }
- unset($language_data['STYLES']['STRINGS']['HARD']);
- }
- foreach($language_data['STYLES']['STRINGS'] as $sk => $sv) {
- if($sk && !isset($language_data['QUOTEMARKS'][$sk])) {
- report_error(TYPE_NOTICE, "Language file contains an superfluous \$language_data['STYLES']['STRINGS'] specification for non-existing quotemark key $sk!");
- }
- }
-
- foreach($language_data['REGEXPS'] as $rk => $rv) {
- if(!is_int($rk)) {
- report_error(TYPE_WARNING, "Language file contains an key '$rk' in \$language_data['REGEXPS'] that is not integer!");
- }
- if(is_string($rv)) {
- //Check for unmasked / in regular expressions ...
- if(empty($rv)) {
- report_error(TYPE_WARNING, "Language file contains an empty regular expression at \$language_data['REGEXPS'][$rk]!");
- } else {
- if(preg_match("/(?<!\\\\)\//s", $rv)) {
- report_error(TYPE_WARNING, "Language file contains a regular expression with an unmasked / character at \$language_data['REGEXPS'][$rk]!");
- } elseif (preg_match("/(?<!<)(\\\\\\\\)*\\\\\|(?!>)/s", $rv)) {
- report_error(TYPE_WARNING, "Language file contains a regular expression with an unescaped match for a pipe character '|' which needs escaping as '&lt;PIPE&gt;' instead at \$language_data['REGEXPS'][$rk]!");
- }
- }
- } elseif(is_array($rv)) {
- if(!isset($rv[GESHI_SEARCH])) {
- report_error(TYPE_ERROR, "Language file contains no GESHI_SEARCH entry in extended regular expression at \$language_data['REGEXPS'][$rk]!");
- } elseif(!is_string($rv[GESHI_SEARCH])) {
- report_error(TYPE_ERROR, "Language file contains a GESHI_SEARCH entry in extended regular expression at \$language_data['REGEXPS'][$rk] which is not a string!");
- } else {
- if(preg_match("/(?<!\\\\)\//s", $rv[GESHI_SEARCH])) {
- report_error(TYPE_WARNING, "Language file contains a regular expression with an unmasked / character at \$language_data['REGEXPS'][$rk]!");
- } elseif (preg_match("/(?<!<)(\\\\\\\\)*\\\\\|(?!>)/s", $rv[GESHI_SEARCH])) {
- report_error(TYPE_WARNING, "Language file contains a regular expression with an unescaped match for a pipe character '|' which needs escaping as '&lt;PIPE&gt;' instead at \$language_data['REGEXPS'][$rk]!");
- }
- }
- if(!isset($rv[GESHI_REPLACE])) {
- report_error(TYPE_WARNING, "Language file contains no GESHI_REPLACE entry in extended regular expression at \$language_data['REGEXPS'][$rk]!");
- } elseif(!is_string($rv[GESHI_REPLACE])) {
- report_error(TYPE_ERROR, "Language file contains a GESHI_REPLACE entry in extended regular expression at \$language_data['REGEXPS'][$rk] which is not a string!");
- }
- if(!isset($rv[GESHI_MODIFIERS])) {
- report_error(TYPE_WARNING, "Language file contains no GESHI_MODIFIERS entry in extended regular expression at \$language_data['REGEXPS'][$rk]!");
- } elseif(!is_string($rv[GESHI_MODIFIERS])) {
- report_error(TYPE_ERROR, "Language file contains a GESHI_MODIFIERS entry in extended regular expression at \$language_data['REGEXPS'][$rk] which is not a string!");
- }
- if(!isset($rv[GESHI_BEFORE])) {
- report_error(TYPE_WARNING, "Language file contains no GESHI_BEFORE entry in extended regular expression at \$language_data['REGEXPS'][$rk]!");
- } elseif(!is_string($rv[GESHI_BEFORE])) {
- report_error(TYPE_ERROR, "Language file contains a GESHI_BEFORE entry in extended regular expression at \$language_data['REGEXPS'][$rk] which is not a string!");
- }
- if(!isset($rv[GESHI_AFTER])) {
- report_error(TYPE_WARNING, "Language file contains no GESHI_AFTER entry in extended regular expression at \$language_data['REGEXPS'][$rk]!");
- } elseif(!is_string($rv[GESHI_AFTER])) {
- report_error(TYPE_ERROR, "Language file contains a GESHI_AFTER entry in extended regular expression at \$language_data['REGEXPS'][$rk] which is not a string!");
- }
- } else {
- report_error(TYPE_WARNING, "Language file contains an non-string and non-array entry at \$language_data['REGEXPS'][$rk]!");
- }
- if(!isset($language_data['STYLES']['REGEXPS'][$rk])) {
- report_error(TYPE_WARNING, "Language file contains no \$language_data['STYLES']['REGEXPS'] specification for regexp group $rk!");
- }
- }
- foreach($language_data['STYLES']['REGEXPS'] as $rk => $rv) {
- if(!isset($language_data['REGEXPS'][$rk])) {
- report_error(TYPE_NOTICE, "Language file contains an superfluous \$language_data['STYLES']['REGEXPS'] specification for regexp key $rk!");
- }
- }
-
-
- }
-
- output_error_cache();
-
- flush();
-
- if($error_abort) {
- break;
- }
- }
-}
-
-$time_end = explode(' ', microtime());
-$time_diff = $time_end[0] + $time_end[1] - $time_start[0] - $time_start[1];
-
-if ( PHP_SAPI != 'cli' ) {
-?></li>
-</ol>
-
-<p>Validation process completed in <? printf("%.2f", $time_diff); ?> seconds.</p>
-
-<div id="footer">GeSHi &copy; 2004-2007 Nigel McNie, 2007-2008 Benny Baumann, released under the GNU GPL</div>
-</body>
-</html>
-
-<?php } else { ?>
-
-Validation process completed in <? printf("%.2f", $time_diff); ?> seconds.
-
-GeSHi &copy; 2004-2007 Nigel McNie, 2007-2012 Benny Baumann, released under the GNU GPL
-
-<?php } ?> \ No newline at end of file
diff --git a/extensions/SyntaxHighlight_GeSHi/geshi/contrib/langwiz.php b/extensions/SyntaxHighlight_GeSHi/geshi/contrib/langwiz.php
deleted file mode 100644
index 32d025a9..00000000
--- a/extensions/SyntaxHighlight_GeSHi/geshi/contrib/langwiz.php
+++ /dev/null
@@ -1,1158 +0,0 @@
-<?php
-/**
- * GeSHi example script
- *
- * Just point your browser at this script (with geshi.php in the parent directory,
- * and the language files in subdirectory "../geshi/")
- *
- *This script
- *
- * @author Nigel McNie, Benny Baumann (BenBE@geshi.org), Andreas 'Segaja' Schleifer (webmaster at segaja dot de)
- * @version $Id: langwiz.php 2510 2012-06-27 15:57:55Z reedy_boy $
- */
-header('Content-Type: text/html; charset=utf-8');
-
-set_time_limit(0);
-error_reporting(E_ALL);
-$time_start = explode(' ', microtime());
-
-//Handle crappy PHP magic:
-if (get_magic_quotes_gpc()) {
- function stripslashes_deep($value) {
- $value = is_array($value) ?
- array_map('stripslashes_deep', $value) :
- stripslashes($value);
-
- return $value;
- }
-
- $_POST = array_map('stripslashes_deep', $_POST);
- $_GET = array_map('stripslashes_deep', $_GET);
- $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
- $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
-}
-
-function htmlspecialchars_deep($value) {
- return is_array($value) ? array_map('htmlspecialchars_deep', $value) : htmlspecialchars($value);
-}
-
-define ('TYPE_NOTICE', 0);
-define ('TYPE_WARNING', 1);
-define ('TYPE_ERROR', 2);
-
-$error_abort = false;
-$error_cache = array();
-function output_error_cache(){
- global $error_cache, $error_abort;
-
- if(count($error_cache)) {
- echo "<span style=\"color: #F00; font-weight: bold;\">Failed</span><br />";
- echo "<ol>\n";
- foreach($error_cache as $error_msg) {
- echo "<li>";
- switch($error_msg['t']) {
- case TYPE_NOTICE:
- echo "<span style=\"color: #080; font-weight: bold;\">NOTICE:</span>";
- break;
- case TYPE_WARNING:
- echo "<span style=\"color: #CC0; font-weight: bold;\">WARNING:</span>";
- break;
- case TYPE_ERROR:
- echo "<span style=\"color: #F00; font-weight: bold;\">ERROR:</span>";
- break;
- }
- echo " " . $error_msg['m'] . "</li>";
- }
- echo "</ol>\n";
- } else {
- echo "<span style=\"color: #080; font-weight: bold;\">OK</span><br />";
- }
- echo "\n";
-
- $error_cache = array();
-}
-
-function report_error($type, $message) {
- global $error_cache, $error_abort;
-
- $error_cache[] = array('t' => $type, 'm' => $message);
- if(TYPE_ERROR == $type) {
- $error_abort = true;
- }
-}
-
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>GeSHi Language File Generator Script</title>
- <style type="text/css">
- <!--
- html {
- background-color: #f0f0f0;
- }
- body {
- font-family: Verdana, Arial, sans-serif;
- margin: 10px;
- border: 2px solid #e0e0e0;
- background-color: #fcfcfc;
- padding: 5px;
- font-size: 10pt;
- }
- h2 {
- margin: .1em 0 .2em .5em;
- border-bottom: 1px solid #b0b0b0;
- color: #b0b0b0;
- font-weight: normal;
- font-size: 150%;
- }
- h3 {
- margin: .1em 0 .2em .5em;
- color: #b0b0b0;
- font-weight: normal;
- font-size: 120%;
- }
- #footer {
- text-align: center;
- font-size: 80%;
- color: #a9a9a9;
- }
- #footer a {
- color: #9999ff;
- }
- textarea {
- border: 1px solid #b0b0b0;
- font-size: 90%;
- color: #333;
- margin-left: 20px;
- }
- select, input {
- margin-left: 2px;
- border: 1px solid #808080;
- }
- p {
- font-size: 90%;
- margin-left: .5em;
- }
- fieldset {
- border: 1px dotted gray;
- background-color: #f0f0f0;
- margin-bottom: .5em;
- }
- legend {
- font-weight: bold;
- background-color: #f9f9f9;
- border: 1px solid #a0a0a0;
- border-width: 1px 2px 2px 1px;
- }
- fieldset table > tbody > tr > td {
- width: 20%;
- }
- fieldset table > tbody > tr > td+td {
- width: 80%;
- }
-
- fieldset table > tbody > tr > td+td > input {
- width: 98%;
- }
- -->
- </style>
-</head>
-<body>
-<h2>GeSHi Language File Generator Script</h2>
-<p>To use this script, make sure that <strong>geshi.php</strong> is in the
-parent directory or in your include_path, and that the language files are in a
-subdirectory of GeSHi's directory called <strong>geshi/</strong>.</p>
-<p>If not already done, select a language file below that will be used as
-base for the language file to generate or create a blank one. Following this
-you can do whatever you like to edit your language file. But note that not all
-features are made available through this script.</p>
-
-<p>Checking GeSHi installation ... <?php
-// Rudimentary checking of where GeSHi is. In a default install it will be in ../, but
-// it could be in the current directory if the include_path is set. There's nowhere else
-// we can reasonably guess.
-if (is_readable('../geshi.php')) {
- $path = '../';
-} elseif (is_readable('geshi.php')) {
- $path = './';
-} else {
- report_error(TYPE_ERROR, 'Could not find geshi.php - make sure it is in your include path!');
-}
-
-if(!$error_abort) {
- require $path . 'geshi.php';
-
- if(!class_exists('GeSHi')) {
- report_error(TYPE_ERROR, 'The GeSHi class was not found, although it seemed we loaded the correct file!');
- }
-}
-
-if(!$error_abort) {
- if(!defined('GESHI_LANG_ROOT')) {
- report_error(TYPE_ERROR, 'There\'s no information present on where to find the language files!');
- } elseif(!is_dir(GESHI_LANG_ROOT)) {
- report_error(TYPE_ERROR, 'The path "'.GESHI_LANG_ROOT.'" given, does not ressemble a directory!');
- } elseif(!is_readable(GESHI_LANG_ROOT)) {
- report_error(TYPE_ERROR, 'The path "'.GESHI_LANG_ROOT.'" is not readable to this script!');
- }
-}
-
-if(!$error_abort) {
- if (!($dir = @opendir(GESHI_LANG_ROOT))) {
- report_error(TYPE_ERROR, 'Error requesting listing for available language files!');
- }
-
- $languages = array();
-
- if(!$error_abort) {
- while ($file = readdir($dir)) {
- if (!$file || $file[0] == '.' || strpos($file, '.') === false) {
- continue;
- }
- $lang = substr($file, 0, strpos($file, '.'));
- $languages[] = $lang;
- }
- closedir($dir);
- }
-
- $languages = array_unique($languages);
- sort($languages);
-
- if(!count($languages)) {
- report_error(TYPE_WARNING, 'Unable to locate any usable language files in "'.GESHI_LANG_ROOT.'"!');
- }
-}
-
-output_error_cache();
-
-// --- empty variables for values of $_POST - begin ---
-$post_var_names = array('li', 'ai', 'ld');
-
-$li = array(
- 'file' => 'example',
- 'name' => 'Example'
- );
-
-$ai = array(
- 'name' => 'Benny Baumann',
- 'email' => 'BenBE@geshi.org',
- 'web' => 'http://qbnz.com/highlighter/'
- );
-
-$ld = array(
- 'cmt' => array(
- 'sl' => array(
- 1 => array(
- 'start' => '//',
- 'style' => 'font-style: italic; color: #666666;'
- ),
- 2 => array(
- 'start' => '#',
- 'style' => 'font-style: italic; color: #666666;'
- )
- ),
- 'ml' => array(
- 1 => array(
- 'start' => '/*',
- 'end' => '*/',
- 'style' => 'font-style: italic; color: #666666;'
- ),
- 2 => array(
- 'start' => '/**',
- 'end' => '*/',
- 'style' => 'font-style: italic; color: #006600;'
- )
- ),
- 'rxc' => array(
- 1 => array(
- 'rx' => '/Hello RegExp/',
- 'style' => 'font-style: italic; color: #666666;'
- )
- )
- ),
- 'str' => array(
- 'qm' => array(
- 1 => array(
- 'delim' => "'",
- 'style' => 'color: #0000FF;'
- ),
- 2 => array(
- 'delim' => "&quot;",
- 'style' => 'color: #0000FF;'
- )
- ),
- 'ec' => array(
- 'char' => '\\',
- 'style' => 'font-weight: bold; color: #000080;'
- ),
- 'erx' => array(
- 1 => array(
- 'rx' => '/\{\\\\$\w+\}/',
- 'style' => 'font-weight: bold; color: #008080;'
- ),
- 2 => array(
- 'rx'=> '/\{\\\\$\w+\}/',
- 'style' => 'font-weight: bold; color: #008080;'
- )
- )
- ),
- 'kw_case' => 'GESHI_CAPS_NO_CHANGE',
- 'kw' => array(
- 1 => array(
- 'list' => '',
- 'case' => '0',
- 'style' => 'color: #0000FF; font-weight: bold;',
- 'docs' => ''
- )
- ),
- 'sy' => array(
- 0 => array(
- 'list' => '',
- 'style' => 'color: #0000FF; font-weight: bold;'
- )
- )
- );
-
-$kw_case_sel = array(
- 'GESHI_CAPS_NO_CHANGE' => '',
- 'GESHI_CAPS_UPPER' => '',
- 'GESHI_CAPS_LOWER' => ''
- );
-
-$kw_cases_sel = array(
- 1 => array(
- 0 => '',
- 1 => ''
- )
- );
-// --- empty variables for values of $_POST - end ---
-
-echo "<pre>";
-//var_dump($languages);
-
-foreach($post_var_names as $varName) { // export wanted variables of $_POST array...
- if(array_key_exists($varName, $_POST)) {
- $$varName = htmlspecialchars_deep($_POST[$varName]);
- }
-}
-
-// determine the selected kw_case...
-$kw_case_sel[$ld['kw_case']] = ' selected="selected"';
-
-// determine the selected kw_cases...
-for($i = 1; $i <= count($kw_cases_sel); $i += 1) {
- $kw_cases_sel[$i][(int) $ld['kw'][$i]['case']] = ' selected="selected"';
-}
-
-$lang = validate_lang();
-var_dump($lang);
-echo "</pre>";
-
-?>
-
-<form action="?action=test" method="post">
- <fieldset>
- <legend>Generic Information</legend>
-
- <table width="100%">
- <tr>
- <td>
- <label for="li[file]">Language File ID:</label>
- </td>
- <td>
- <input type="text" name="li[file]" id="li[file]" value="<?=$li['file']; ?>" />
- </td>
- </tr>
-
- <tr>
- <td>
- <label for="li[name]">Language Name:</label>
- </td>
- <td>
- <input type="text" name="li[name]" id="li[name]" value="<?=$li['name']; ?>" />
- </td>
- </tr>
-
- </table>
- </fieldset>
-
- <fieldset>
- <legend>Author</legend>
-
- <table width="100%">
- <tr>
- <td>
- <label for="ai[name]">Full Name:</label>
- </td>
- <td>
- <input type="text" name="ai[name]" id="ai[name]" value="<?=$ai['name']; ?>" />
- </td>
- </tr>
-
- <tr>
- <td>
- <label for="ai[email]">eMail address:</label>
- </td>
- <td>
- <input type="text" name="ai[email]" id="ai[email]" value="<?=$ai['email']; ?>" />
- </td>
- </tr>
-
- <tr>
- <td>
- <label for="ai[web]">Homepage:</label>
- </td>
- <td>
- <input type="text" name="ai[web]" id="ai[web]" value="<?=$ai['web']; ?>" />
- </td>
- </tr>
- </table>
- </fieldset>
-
- <fieldset>
- <legend>Comments</legend>
-
- <fieldset>
- <legend>Single Line</legend>
-
- <fieldset>
- <legend>Comment Group 1</legend>
-
- <table width="100%">
- <tr>
- <td>
- <label for="ld[cmt][sl][1][start]">Comment Start:</label>
- </td>
- <td>
- <input type="text" name="ld[cmt][sl][1][start]" id="ld[cmt][sl][1][start]" value="<?=$ld['cmt']['sl'][1]['start']; ?>" />
- </td>
- </tr>
-
- <tr>
- <td>
- <label for="ld[cmt][sl][1][style]">Comment Style:</label>
- </td>
- <td>
- <input type="text" name="ld[cmt][sl][1][style]" id="ld[cmt][sl][1][style]" value="<?=$ld['cmt']['sl'][1]['style']; ?>" />
- </td>
- </tr>
- </table>
- </fieldset>
-
- <fieldset>
- <legend>Comment Group 2</legend>
-
- <table width="100%">
- <tr>
- <td>
- <label for="ld[cmt][sl][2][start]">Comment Start:</label>
- </td>
- <td>
- <input type="text" name="ld[cmt][sl][2][start]" id="ld[cmt][sl][2][start]" value="<?=$ld['cmt']['sl'][2]['start']; ?>" />
- </td>
- </tr>
-
- <tr>
- <td>
- <label for="ld[cmt][sl][2][style]">Comment Style:</label>
- </td>
- <td>
- <input type="text" name="ld[cmt][sl][2][style]" id="ld[cmt][sl][2][style]" value="<?=$ld['cmt']['sl'][2]['style']; ?>" />
- </td>
- </tr>
- </table>
- </fieldset>
- </fieldset>
-
- <fieldset>
- <legend>Multiple Lines</legend>
-
- <fieldset>
- <legend>Comment Group 1</legend>
-
- <table width="100%">
- <tr>
- <td>
- <label for="ld[cmt][ml][1][start]">Comment Start:</label>
- </td>
- <td>
- <input type="text" name="ld[cmt][ml][1][start]" id="ld[cmt][ml][1][start]" value="<?=$ld['cmt']['ml'][1]['start']; ?>" />
- </td>
- </tr>
-
- <tr>
- <td>
- <label for="ld[cmt][ml][1][end]">Comment End:</label>
- </td>
- <td>
- <input type="text" name="ld[cmt][ml][1][end]" id="ld[cmt][ml][1][end]" value="<?=$ld['cmt']['ml'][1]['end']; ?>" />
- </td>
- </tr>
-
- <tr>
- <td>
- <label for="ld[cmt][ml][1][style]">Comment Style:</label>
- </td>
- <td>
- <input type="text" name="ld[cmt][ml][1][style]" id="ld[cmt][ml][1][style]" value="<?=$ld['cmt']['ml'][1]['style']; ?>" />
- </td>
- </tr>
- </table>
- </fieldset>
-
- <fieldset>
- <legend>Comment Group 2</legend>
-
- <table width="100%">
- <tr>
- <td>
- <label for="ld[cmt][ml][2][start]">Comment Start:</label>
- </td>
- <td>
- <input type="text" name="ld[cmt][ml][2][start]" id="ld[cmt][ml][2][start]" value="<?=$ld['cmt']['ml'][2]['start']; ?>" />
- </td>
- </tr>
-
- <tr>
- <td>
- <label for="ld[cmt][ml][2][end]">Comment End:</label>
- </td>
- <td>
- <input type="text" name="ld[cmt][ml][2][end]" id="ld[cmt][ml][2][end]" value="<?=$ld['cmt']['ml'][2]['end']; ?>" />
- </td>
- </tr>
-
- <tr>
- <td>
- <label for="ld[cmt][ml][2][style]">Comment Style:</label>
- </td>
- <td>
- <input type="text" name="ld[cmt][ml][2][style]" id="ld[cmt][ml][2][style]" value="<?=$ld['cmt']['ml'][2]['style']; ?>" />
- </td>
- </tr>
- </table>
- </fieldset>
- </fieldset>
-
- <fieldset>
- <legend>Regular Expressions</legend>
-
- <fieldset>
- <legend>Comment Group 1</legend>
-
- <table width="100%">
- <tr>
- <td>
- <label for="ld[cmt][rxc][1][rx]">Comment RX:</label>
- </td>
- <td>
- <input type="text" name="ld[cmt][rxc][1][rx]" id="ld[cmt][rxc][1][rx]" value="<?=$ld['cmt']['rxc'][1]['rx']; ?>" />
- </td>
- </tr>
-
- <tr>
- <td>
- <label for="ld[cmt][rxc][1][style]">Comment Style:</label>
- </td>
- <td>
- <input type="text" name="ld[cmt][rxc][1][style]" id="ld[cmt][rxc][1][style]" value="<?=$ld['cmt']['rxc'][1]['style']; ?>" />
- </td>
- </tr>
- </table>
- </fieldset>
- </fieldset>
- </fieldset>
-
- <fieldset>
- <legend>Strings</legend>
-
- <fieldset>
- <legend>String \ Quotes (delimiters, parsed)</legend>
-
- <fieldset>
- <legend>Quotemark Group 1</legend>
-
- <table width="100%">
- <tr>
- <td>
- <label for="ld[str][qm][1][delim]">String Delimiter:</label>
- </td>
- <td>
- <input type="text" name="ld[str][qm][1][delim]" id="ld[str][qm][1][delim]" value="<?=$ld['str']['qm'][1]['delim']; ?>" />
- </td>
- </tr>
-
- <tr>
- <td>
- <label for="ld[str][qm][1][style]">String Style:</label>
- </td>
- <td>
- <input type="text" name="ld[str][qm][1][style]" id="ld[str][qm][1][style]" value="<?=$ld['str']['qm'][1]['style']; ?>" />
- </td>
- </tr>
- </table>
- </fieldset>
- <fieldset>
- <legend>Quotemark Group 2</legend>
-
- <table width="100%">
- <tr>
- <td>
- <label for="ld[str][qm][1][delim]">String Delimiter:</label>
- </td>
- <td>
- <input type="text" name="ld[str][qm][2][delim]" id="ld[str][qm][2][delim]" value="<?=$ld['str']['qm'][2]['delim']; ?>" />
- </td>
- </tr>
-
- <tr>
- <td>
- <label for="ld[str][qm][1][style]">String Style:</label>
- </td>
- <td>
- <input type="text" name="ld[str][qm][2][style]" id="ld[str][qm][2][style]" value="<?=$ld['str']['qm'][2]['style']; ?>" />
- </td>
- </tr>
- </table>
- </fieldset>
-
-
- </fieldset>
-
- <fieldset>
- <legend>Escape Sequences</legend>
-
- <fieldset>
- <legend>Generic Escape Char</legend>
-
- <table width="100%">
- <tr>
- <td>
- <label for="ld[str][ec][char]">Escape Char:</label>
- </td>
- <td>
- <input type="text" name="ld[str][ec][char]" id="ld[str][ec][char]" value="<?=$ld['str']['ec']['char']; ?>" />
- </td>
- </tr>
-
- <tr>
- <td>
- <label for="ld[str][ec][style]">Escape Char Style:</label>
- </td>
- <td>
- <input type="text" name="ld[str][ec][style]" id="ld[str][ec][style]" value="<?=$ld['str']['ec']['style']; ?>" />
- </td>
- </tr>
- </table>
- </fieldset>
-
- <fieldset>
- <legend>Escape Regexp Group 1</legend>
-
- <table width="100%">
- <tr>
- <td>
- <label for="ld[str][erx][1][rx]">Escape Regexp:</label>
- </td>
- <td>
- <input type="text" name="ld[str][erx][1][rx]" id="ld[str][erx][1][rx]" value="<?=$ld['str']['erx'][1]['rx']; ?>" />
- </td>
- </tr>
-
- <tr>
- <td>
- <label for="ld[str][erx][1][style]">Escape Style:</label>
- </td>
- <td>
- <input type="text" name="ld[str][erx][1][style]" id="ld[str][erx][1][style]" value="<?=$ld['str']['erx'][1]['style']; ?>" />
- </td>
- </tr>
- </table>
- </fieldset>
-
- <fieldset>
- <legend>Escape Regexp Group 2</legend>
-
- <table width="100%">
- <tr>
- <td>
- <label for="ld[str][erx][2][rx]">Escape Regexp:</label>
- </td>
- <td>
- <input type="text" name="ld[str][erx][2][rx]" id="ld[str][erx][2][rx]" value="<?=$ld['str']['erx'][2]['rx']; ?>" />
- </td>
- </tr>
-
- <tr>
- <td>
- <label for="ld[str][erx][2][style]">Escape Style:</label>
- </td>
- <td>
- <input type="text" name="ld[str][erx][2][style]" id="ld[str][erx][2][style]" value="<?=$ld['str']['erx'][2]['style']; ?>" />
- </td>
- </tr>
- </table>
- </fieldset>
- </fieldset>
- </fieldset>
-
- <fieldset>
- <legend>Keywords</legend>
-
- <fieldset>
- <legend>Case of Keywords</legend>
-
- <table width="100%">
- <tr>
- <td>
- <label for="ld[kw_case]">Handling of keywords case:</label>
- </td>
- <td>
- <select name=ld[kw_case]" id="ld[kw_case]">
- <option value="GESHI_CAPS_NO_CHANGE"<?=$kw_case_sel['GESHI_CAPS_NO_CHANGE']; ?>>Don’t change the case of any keyword</option>
- <option value="GESHI_CAPS_UPPER"<?=$kw_case_sel['GESHI_CAPS_UPPER']; ?>>Convert the case of all keywords to upper case</option>
- <option value="GESHI_CAPS_LOWER"<?=$kw_case_sel['GESHI_CAPS_LOWER']; ?>>Convert the case of all keywords to lower case</option>
- </select>
- </td>
- </tr>
- </table>
- </fieldset>
-
- <fieldset>
- <legend>Keyword Group 1</legend>
-
- <table width="100%">
- <tr>
- <td>
- <label for="ld[kw][1][list]">Keyword List:</label>
- </td>
- <td>
- <textarea name="ld[kw][1][list]" id="ld[kw][1][list]" rows="10" cols="80"><?=$ld['kw'][1]['list']; ?></textarea>
- </td>
- </tr>
-
- <tr>
- <td>
- <label for="ld[kw][1][case]">Case Sensitive:</label>
- </td>
- <td>
- <select name="ld[kw][1][case]" id="ld[kw][1][case]">
- <option value="0"<?=$kw_cases_sel[1][0]; ?>>No</option>
- <option value="1"<?=$kw_cases_sel[1][1]; ?>>Yes</option>
- </select>
- </td>
- </tr>
-
- <tr>
- <td>
- <label for="ld[kw][1][style]">Keyword Style:</label>
- </td>
- <td>
- <input type="text" name="ld[kw][1][style]" id="ld[kw][1][style]" value="<?=$ld['kw'][1]['style']; ?>" />
- </td>
- </tr>
-
- <tr>
- <td>
- <label for="ld[kw][1][docs]">Documentation URL:</label>
- </td>
- <td>
- <input type="text" name="ld[kw][1][docs]" id="ld[kw][1][docs]" value="<?=$ld['kw'][1]['docs']; ?>" />
- </td>
- </tr>
- </table>
- </fieldset>
-
- </fieldset>
-
-
- <fieldset>
- <legend>Symbols</legend>
-
- <fieldset>
- <legend>Symbols Group 1</legend>
-
- <table width="100%">
- <tr>
- <td>
- <label for="ld[sy][0][list]">Symbols List:</label>
- </td>
- <td>
- <textarea name="ld[sy][0][list]" id="ld[sy][0][list]" rows="10" cols="80"><?=$ld['sy'][0]['list']; ?></textarea>
- </td>
- </tr>
-
- <tr>
- <td>
- <label for="ld[sy][0][style]">Symbols Style:</label>
- </td>
- <td>
- <input type="text" name="ld[sy][0][style]" id="ld[sy][0][style]" value="<?=$ld['sy'][0]['style']; ?>" />
- </td>
- </tr>
- </table>
- </fieldset>
-
- </fieldset>
-
-
- <div id="langfile">
- <fieldset>
- <legend>Language File Source</legend>
-<?
-$G = new GeSHi('', 'php');
-$langfile_source = gen_langfile($lang);
-$G->set_source($langfile_source);
-echo $G->parse_code();
-unset($G);
-?>
- </fieldset>
- </div>
-
- <input type="submit" name="btn" value="Send!" />
-</form>
-
-<p>Operation completed in <?
-$time_end = explode(' ', microtime());
-$time_diff = $time_end[0] + $time_end[1] - $time_start[0] - $time_start[1];
-
-echo sprintf("%.2f", $time_diff);
-?> seconds.</p>
-
-<div id="footer">GeSHi &copy; 2004-2007 Nigel McNie, 2007-2009 Benny Baumann, released under the GNU GPL</div>
-</body>
-</html>
-<?
-
-function str_to_phpstring($str, $doublequote = false){
- if($doublequote) {
- return '"' . strtr($str,
- array(
- "\"" => "\\\"",
- "\\" => "\\\\",
- "\0" => "\\0",
- "\n" => "\\n",
- "\r" => "\\r",
- "\t" => "\\t",
- "\$" => "\\\$"
- )
- ) . '"';
- } else {
- return "'" . strtr($str,
- array(
- "'" => "\\'",
- "\\" => "\\\\"
- )
- ) . "'";
- }
-}
-
-function validate_lang(){
- $ai = array(
- 'name' => 'Benny Baumann',
- 'email' => 'BenBE@geshi.org',
- 'web' => 'http://qbnz.com/highlighter/'
- );
-
- $li = array(
- 'file' => 'example',
- 'desc' => 'Example'
- );
-
- if(isset($_POST['ld'])) {
- $ld = $_POST['ld'];
- } else {
- $ld = array(
- 'cmt' => array(
- 'sl' => array(
- 1 => array(
- 'start' => '//',
- 'style' => 'test'
- )
- ),
- 'ml' => array(
- 1 => array(
- 'start' => '/*',
- 'end' => '*/',
- 'style' => 'font-style: italic; color: #666666;'
- )
- ),
- 'rxc' => array(
- 1 => array(
- 'rx' => '/Hello/',
- 'style' => 'color: #00000'
- )
- )
- ),
- 'str' => array(
- 'qm' => array(),
- 'ec' => array(
- 'char' => ''
- ),
- 'erx' => array()
- ),
- 'kw' => array(),
- 'kw_case' => 'GESHI_CAPS_NO_CHANGE',
- 'sy' => array()
- );
- }
-
- return array('ai' => $ai, 'li' => $li, 'ld' => $ld);
-}
-
-function gen_langfile($lang){
- $langfile = $lang['li']['file'];
- $langdesc = $lang['li']['desc'];
-
- $langauthor_name = $lang['ai']['name'];
- $langauthor_email = $lang['ai']['email'];
- $langauthor_web = $lang['ai']['web'];
-
- $langversion = GESHI_VERSION;
-
- $langdate = date('Y/m/d');
- $langyear = date('Y');
-
- $i = ' ';
- $i = array('', $i, $i.$i, $i.$i.$i);
-
- $src = <<<GESHI_LANGFILE_HEAD
-<?php
-/*************************************************************************************
- * {$langfile}.php
- * --------
- * Author: {$langauthor_name} ({$langauthor_email})
- * Copyright: (c) {$langyear} {$langauthor_name} ({$langauthor_web})
- * Release Version: {$langversion}
- * Date Started: {$langdate}
- *
- * {$langdesc} language file for GeSHi.
- *
- * CHANGES
- * -------
- * {$langdate} ({$langversion})
- * - First Release
- *
- * TODO (updated {$langdate})
- * -------------------------
- * * Complete language file
- *
- *************************************************************************************
- *
- * This file is part of GeSHi.
- *
- * GeSHi is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GeSHi is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GeSHi; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- ************************************************************************************/
-
-\$language_data = array(
-
-GESHI_LANGFILE_HEAD;
-
- //Language Name
- $src .= $i[1] . "'LANG_NAME' => ".str_to_phpstring($langdesc).",\n";
-
- //Comments
- $src .= $i[1] . "'COMMENT_SINGLE' => array(\n";
- foreach($lang['ld']['cmt']['sl'] as $idx_cmt_sl => $tmp_cmt_sl) {
- $src .= $i[2] . ((int)$idx_cmt_sl). " => ". str_to_phpstring($tmp_cmt_sl['start']) . ",\n";
- }
- $src .= $i[2] . "),\n";
- $src .= $i[1] . "'COMMENT_MULTI' => array(\n";
- foreach($lang['ld']['cmt']['ml'] as $tmp_cmt_ml) {
- $src .= $i[2] . str_to_phpstring($tmp_cmt_ml['start']). " => ". str_to_phpstring($tmp_cmt_ml['end']) . ",\n";
- }
- $src .= $i[2] . "),\n";
- $src .= $i[1] . "'COMMENT_REGEXP' => array(\n";
- foreach($lang['ld']['cmt']['rxc'] as $idx_cmt_rxc => $tmp_cmt_rxc) {
- $src .= $i[2] . ((int)$idx_cmt_rxc). " => ". str_to_phpstring($tmp_cmt_rxc['rx']) . ",\n";
- }
- $src .= $i[2] . "),\n";
-
- //Case Keywords
- $src .= $i[1] . "'CASE_KEYWORDS' => " . $lang['ld']['kw_case'] . ",\n";
-
- //Quotes \ Strings
- $src .= $i[1] . "'QUOTEMARKS' => array(\n";
- foreach($lang['ld']['str']['qm'] as $idx_str_qm => $tmp_str_qm) {
- $src .= $i[2] . ((int)$idx_str_qm). " => ". str_to_phpstring($tmp_str_qm['delim']) . ",\n";
- }
- $src .= $i[2] . "),\n";
- $src .= $i[1] . "'ESCAPE_CHAR' => " . str_to_phpstring($lang['ld']['str']['ec']['char']) . ",\n";
- $src .= $i[1] . "'ESCAPE_REGEXP' => array(\n";
- foreach($lang['ld']['str']['erx'] as $idx_str_erx => $tmp_str_erx) {
- $src .= $i[2] . ((int)$idx_str_erx). " => ". str_to_phpstring($tmp_str_erx['rx']) . ",\n";
- }
- $src .= $i[2] . "),\n";
-
- //HardQuotes
- $src .= $i[1] . "'HARDQUOTE' => array(\n";
- $src .= $i[2] . "),\n";
- $src .= $i[1] . "'HARDESCAPE' => array(\n";
- $src .= $i[2] . "),\n";
- $src .= $i[1] . "'HARDCHAR' => '',\n";
-
- //Numbers
- $src .= $i[1] . "'NUMBERS' =>\n";
- $src .= $i[2] . "GESHI_NUMBER_INT_BASIC | GESHI_NUMBER_OCT_PREFIX | GESHI_NUMBER_HEX_PREFIX |\n";
- $src .= $i[2] . "GESHI_NUMBER_FLT_SCI_ZERO,\n";
-
- //Keywords
- $src .= $i[1] . "'KEYWRODS' => array(\n";
- foreach($lang['ld']['kw'] as $idx_kw => $tmp_kw) {
- $src .= $i[2] . ((int)$idx_kw) . " => array(\n";
- if(!is_array($tmp_kw['list'])) {
- $tmp_kw['list'] = explode("\n", $tmp_kw['list']);
- }
- $tmp_kw['list'] = array_map('trim', $tmp_kw['list']);
- sort($tmp_kw['list']);
- $kw_esc = array_map('str_to_phpstring', $tmp_kw['list']);
- $kw_nl = true;
- $kw_pos = 0;
- foreach($kw_esc as $kw_data) {
- if((strlen($kw_data) + $kw_pos > 79) && $kw_pos > strlen($i[3])) {
- $src .= "\n";
- $kw_nl = true;
- $kw_pos = 0;
- }
- if($kw_nl) {
- $src .= $i[3];
- $kw_pos += strlen($i[3]);
- $kw_nl = false;
- }
- $src .= $kw_data . ', ';
- $kw_pos += strlen($kw_data) + 2;
- }
- $src .= "\n";
- $src .= $i[3] . "),\n";
- }
- $src .= $i[2] . "),\n";
-
- //Case Sensitivity
- $src .= $i[1] . "'CASE_SENSITIVE' => array(\n";
- foreach($lang['ld']['kw'] as $idx_kw => $tmp_kw) {
- $src .= $i[2] . ((int)$idx_kw) . " => " . ($tmp_kw['case'] ? 'true' : 'false') . ",\n";
- }
- $src .= $i[2] . "),\n";
-
- //Symbols
- $src .= $i[1] . "'SYMBOLS' => array(\n";
- foreach($lang['ld']['sy'] as $idx_kw => $tmp_kw) {
- $src .= $i[2] . ((int)$idx_kw) . " => array(\n";
- $tmp_kw['list'] = (array)$tmp_kw['list'];
- sort($tmp_kw['list']);
- $kw_esc = array_map('str_to_phpstring', $tmp_kw['list']);
- $kw_nl = true;
- $kw_pos = strlen($i[3]);
- foreach($kw_esc as $kw_data) {
- if((strlen($kw_data) + $kw_pos > 79) && $kw_pos > strlen($i[3])) {
- $src .= "\n";
- $kw_nl = true;
- $kw_pos = 0;
- }
- if($kw_nl) {
- $src .= $i[3];
- $kw_pos += strlen($i[3]);
- $kw_nl = false;
- }
- $src .= $kw_data . ', ';
- $kw_pos += strlen($kw_data) + 2;
- }
- $src .= "\n";
- $src .= $i[3] . "),\n";
- }
- $src .= $i[2] . "),\n";
-
- //Styles \ CSS
- $src .= $i[1] . "'STYLES' => array(\n";
- $src .= $i[2] . "'KEYWRODS' => array(\n";
- foreach($lang['ld']['kw'] as $idx_kw => $tmp_kw) {
- $src .= $i[3] . ((int)$idx_kw) . " => " . str_to_phpstring($tmp_kw['style']) . ",\n";
- }
- $src .= $i[3] . "),\n";
- $src .= $i[2] . "'COMMENTS' => array(\n";
- foreach($lang['ld']['cmt']['sl'] as $idx_cmt_sl => $tmp_cmt_sl) {
- $src .= $i[3] . ((int)$idx_cmt_sl) . " => " . str_to_phpstring($tmp_cmt_sl['style']) . ",\n";
- }
- foreach($lang['ld']['cmt']['rxc'] as $idx_cmt_rxc => $tmp_cmt_rxc) {
- $src .= $i[3] . ((int)$idx_cmt_rxc) . " => " . str_to_phpstring($tmp_cmt_rxc['style']) . ",\n";
- }
- $src .= $i[3] . "'MULTI' => " . str_to_phpstring($lang['ld']['cmt']['ml'][1]['style']) . "\n";
- $src .= $i[3] . "),\n";
- $src .= $i[2] . "'ESCAPE_CHAR' => array(\n";
- foreach($lang['ld']['str']['erx'] as $idx_str_erx => $tmp_str_erx) {
- $src .= $i[3] . ((int)$idx_str_erx). " => ". str_to_phpstring($tmp_str_erx['style']) . ",\n";
- }
- // 'HARD' => 'color: #000099; font-weight: bold;'
- $src .= $i[3] . "),\n";
- $src .= $i[2] . "'BRACKETS' => array(\n";
- $src .= $i[3] . "),\n";
- $src .= $i[2] . "'STRINGS' => array(\n";
- foreach($lang['ld']['str']['qm'] as $idx_str_qm => $tmp_str_qm) {
- $src .= $i[3] . ((int)$idx_str_qm). " => ". str_to_phpstring($tmp_str_qm['style']) . ",\n";
- }
- // 'HARD' => 'color: #0000ff;'
- $src .= $i[3] . "),\n";
- $src .= $i[2] . "'NUMBERS' => array(\n";
- $src .= $i[3] . "),\n";
- $src .= $i[2] . "'METHODS' => array(\n";
- $src .= $i[3] . "),\n";
- $src .= $i[2] . "'SYMBOLS' => array(\n";
- foreach($lang['ld']['sy'] as $idx_kw => $tmp_kw) {
- $src .= $i[3] . ((int)$idx_kw) . " => " . str_to_phpstring($tmp_kw['style']) . ",\n";
- }
- $src .= $i[3] . "),\n";
- $src .= $i[2] . "'REGEXPS' => array(\n";
- $src .= $i[3] . "),\n";
- $src .= $i[2] . "'SCRIPT' => array(\n";
- $src .= $i[3] . "),\n";
- $src .= $i[2] . "),\n";
-
- //Keyword Documentation
- $src .= $i[1] . "'URLS' => array(\n";
- foreach($lang['ld']['kw'] as $idx_kw => $tmp_kw) {
- $src .= $i[2] . ((int)$idx_kw) . " => " . str_to_phpstring($tmp_kw['docs']) . ",\n";
- }
- $src .= $i[2] . "),\n";
- $src .= $i[1] . "'OOLANG' => false,\n";
- $src .= $i[1] . "'OBJECT_SPLITTERS' => array(\n";
- $src .= $i[2] . "),\n";
- $src .= $i[1] . "'REGEXPS' => array(\n";
- $src .= $i[2] . "),\n";
- $src .= $i[1] . "'STRICT_MODE_APPLIES' => GESHI_MAYBE,\n";
- $src .= $i[1] . "'SCRIPT_DELIMITERS' => array(\n";
- $src .= $i[2] . "),\n";
- $src .= $i[1] . "'HIGHLIGHT_STRICT_BLOCK' => array(\n";
- $src .= $i[2] . "),\n";
- $src .= $i[1] . "'TAB_WIDTH' => 4,\n";
-
- $src .= <<<GESHI_LANGFILE_FOOTER
-);
-
-?>
-GESHI_LANGFILE_FOOTER;
-
- //Reduce source ...
- $src = preg_replace('/array\(\s*\)/s', 'array()', $src);
- $src = preg_replace('/\,(\s*\))/s', '\1', $src);
- $src = preg_replace('/\s+$/m', '', $src);
-
- return $src;
-}
-
-// vim: shiftwidth=4 softtabstop=4
-?>
diff --git a/extensions/TitleBlacklist/.gitreview b/extensions/TitleBlacklist/.gitreview
new file mode 100644
index 00000000..964229c3
--- /dev/null
+++ b/extensions/TitleBlacklist/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/extensions/TitleBlacklist.git
+defaultbranch=master
diff --git a/extensions/TitleBlacklist/tests/ApiQueryTitleBlacklistTest.php b/extensions/TitleBlacklist/tests/ApiQueryTitleBlacklistTest.php
new file mode 100644
index 00000000..1f8164e7
--- /dev/null
+++ b/extensions/TitleBlacklist/tests/ApiQueryTitleBlacklistTest.php
@@ -0,0 +1,110 @@
+<?php
+/**
+ * Test the TitleBlacklist API.
+ *
+ * This wants to run with phpunit.php, like so:
+ * cd $IP/tests/phpunit
+ * php phpunit.php ../../extensions/TitleBlacklist/tests/ApiQueryTitleBlacklistTest.php
+ *
+ * The blacklist file is `testSource` and shared by all tests.
+ *
+ * Ian Baker <ian@wikimedia.org>
+ */
+
+ini_set( 'include_path', ini_get( 'include_path' ) . ':' . __DIR__ . '/../../../tests/phpunit/includes/api' );
+
+/**
+ * @group medium
+ **/
+class ApiQueryTitleBlacklistTest extends ApiTestCase {
+
+ function setUp() {
+ global $wgTitleBlacklistSources;
+ parent::setUp();
+ $this->doLogin();
+
+ $wgTitleBlacklistSources = array(
+ array(
+ 'type' => TBLSRC_FILE,
+ 'src' => __DIR__ . '/testSource',
+ ),
+ );
+ }
+
+ /**
+ * Verify we allow a title which is not blacklisted
+ */
+ function testCheckingUnlistedTitle() {
+ $unlisted = $this->doApiRequest( array(
+ 'action' => 'titleblacklist',
+ // evil_acc is blacklisted as <newaccountonly>
+ 'tbtitle' => 'evil_acc',
+ 'tbaction' => 'create',
+ 'tbnooverride' => true,
+ ) );
+
+ $this->assertEquals(
+ 'ok',
+ $unlisted[0]['titleblacklist']['result'],
+ 'Not blacklisted title returns ok'
+ );
+ }
+
+ /**
+ * Verify tboverride works
+ */
+ function testTboverride() {
+ global $wgGroupPermissions;
+
+ // Allow all users to override the titleblacklist
+ $wgGroupPermissions['*']['tboverride'] = true;
+
+ $unlisted = $this->doApiRequest( array(
+ 'action' => 'titleblacklist',
+ 'tbtitle' => 'bar',
+ 'tbaction' => 'create',
+ ) );
+
+ $this->assertEquals(
+ 'ok',
+ $unlisted[0]['titleblacklist']['result'],
+ 'Blacklisted title returns ok if the user is allowd to tboverride'
+ );
+ }
+
+ /**
+ * Verify a blacklisted title gives out an error.
+ */
+ function testCheckingBlackListedTitle() {
+ $listed = $this->doApiRequest( array(
+ 'action' => 'titleblacklist',
+ 'tbtitle' => 'bar',
+ 'tbaction' => 'create',
+ 'tbnooverride' => true,
+ ) );
+
+ $this->assertEquals(
+ 'blacklisted',
+ $listed[0]['titleblacklist']['result'],
+ 'Listed title returns error'
+ );
+ $this->assertEquals(
+ "The title \"bar\" has been banned from creation.\nIt matches the following blacklist entry: <code>[Bb]ar #example blacklist entry</code>",
+ $listed[0]['titleblacklist']['reason'],
+ 'Listed title error text is as expected'
+ );
+
+ $this->assertEquals(
+ "titleblacklist-forbidden-edit",
+ $listed[0]['titleblacklist']['message'],
+ 'Correct blacklist message name is returned'
+ );
+
+ $this->assertEquals(
+ "[Bb]ar #example blacklist entry",
+ $listed[0]['titleblacklist']['line'],
+ 'Correct blacklist line is returned'
+ );
+
+ }
+}
diff --git a/extensions/TitleBlacklist/tests/testSource b/extensions/TitleBlacklist/tests/testSource
new file mode 100644
index 00000000..f73d9dd7
--- /dev/null
+++ b/extensions/TitleBlacklist/tests/testSource
@@ -0,0 +1,4 @@
+[Bb]ar #example blacklist entry
+.*[Ff]ail.*
+.*[Nn]yancat.* <errmsg=blacklisted-nyancat>
+.*evil_acc.* <newaccountonly>
diff --git a/extensions/Vector/.gitreview b/extensions/Vector/.gitreview
new file mode 100644
index 00000000..8d06d24a
--- /dev/null
+++ b/extensions/Vector/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/extensions/Vector.git
+defaultbranch=master
diff --git a/extensions/WikiEditor/.gitreview b/extensions/WikiEditor/.gitreview
new file mode 100644
index 00000000..622413f0
--- /dev/null
+++ b/extensions/WikiEditor/.gitreview
@@ -0,0 +1,6 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/extensions/WikiEditor.git
+defaultbranch=master
+defaultrebase=0
diff --git a/extensions/WikiEditor/.jshintignore b/extensions/WikiEditor/.jshintignore
new file mode 100644
index 00000000..66a218b5
--- /dev/null
+++ b/extensions/WikiEditor/.jshintignore
@@ -0,0 +1,2 @@
+# upstream lib from Google
+modules/contentCollector.js
diff --git a/extensions/WikiEditor/.jshintrc b/extensions/WikiEditor/.jshintrc
new file mode 100644
index 00000000..64cd5087
--- /dev/null
+++ b/extensions/WikiEditor/.jshintrc
@@ -0,0 +1,9 @@
+{
+ "predef": [
+ "mediaWiki",
+ "jQuery"
+ ],
+ "browser": true,
+ "smarttabs": true,
+ "multistr": true
+}
diff --git a/extensions/WikiEditor/tests/selenium/WikiDialogs_Links.php b/extensions/WikiEditor/tests/selenium/WikiDialogs_Links.php
new file mode 100644
index 00000000..7153f49f
--- /dev/null
+++ b/extensions/WikiEditor/tests/selenium/WikiDialogs_Links.php
@@ -0,0 +1,67 @@
+<?php
+require_once 'WikiDialogs_Links_Setup.php';
+/**
+ * Description of WikiNewPageDialogs
+ *
+ * @author bhagyag, pdhanda
+ *
+ * This test case is part of the WikiEditorTestSuite.
+ * Configuration for these tests are dosumented as part of extensions/WikiEditor/tests/selenium/WikiEditorTestSuite.php
+ *
+ */
+class WikiDialogs_Links extends WikiDialogs_Links_Setup {
+ // Set up the testing environment
+ function setup() {
+ parent::setUp();
+ parent::doCreateInternalTestPageIfMissing();
+ }
+
+ function tearDown() {
+ parent::doLogout();
+ parent::tearDown();
+ }
+
+ // Create a new page temporary
+ function createNewPage() {
+ parent::doOpenLink();
+ parent::login();
+ parent::doCreateNewPageTemporary();
+ }
+
+ // Add a internal link and verify
+ function testInternalLink() {
+ $this->createNewPage();
+ parent::verifyInternalLink();
+ }
+
+ // Add a internal link with different display text and verify
+ function testInternalLinkWithDisplayText() {
+ $this->createNewPage();
+ parent::verifyInternalLinkWithDisplayText();
+ }
+
+ // Add a internal link with blank display text and verify
+ function testInternalLinkWithBlankDisplayText() {
+ $this->createNewPage();
+ parent::verifyInternalLinkWithBlankDisplayText();
+ }
+
+ // Add external link and verify
+ function testExternalLink() {
+ $this->createNewPage();
+ parent::verifyExternalLink();
+ }
+
+ // Add external link with different display text and verify
+ function testExternalLinkWithDisplayText( ) {
+ $this->createNewPage();
+ parent::verifyExternalLinkWithDisplayText();
+ }
+
+ // Add external link with Blank display text and verify
+ function testExternalLinkWithBlankDisplayText() {
+ $this->createNewPage();
+ parent::verifyExternalLinkWithBlankDisplayText();
+ }
+
+}
diff --git a/extensions/WikiEditor/tests/selenium/WikiDialogs_Links_Setup.php b/extensions/WikiEditor/tests/selenium/WikiDialogs_Links_Setup.php
new file mode 100644
index 00000000..352ebec0
--- /dev/null
+++ b/extensions/WikiEditor/tests/selenium/WikiDialogs_Links_Setup.php
@@ -0,0 +1,295 @@
+<?php
+include( "WikiEditorConstants.php" );
+/**
+ * This test case will be handling the Wiki Tool bar Dialog functions
+ * Date : Apr - 2010
+ * @author : BhagyaG - Calcey
+ */
+class WikiDialogs_Links_Setup extends SeleniumTestCase {
+
+ // Open the page.
+ function doOpenLink() {
+ $this->open( $this->getUrl() . '/index.php' );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ }
+
+ // Expand advance tool bar section if its not
+ function doExpandAdvanceSection() {
+ if ( !$this->isTextPresent( TEXT_HEADING ) ) {
+ $this->click( LINK_ADVANCED );
+ }
+ }
+
+ // Log out from the application
+ function doLogout() {
+ $this->open( $this->getUrl() . '/index.php' );
+ if ( $this->isTextPresent( TEXT_LOGOUT ) ) {
+ $this->click( LINK_LOGOUT );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $this->assertEquals( TEXT_LOGOUT_CONFIRM, $this->getText( LINK_LOGIN ) );
+ $this->open( $this->getUrl() . '/index.php' );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ }
+ }
+
+ // Create a temporary fixture page
+ function doCreateInternalTestPageIfMissing() {
+ $this->type( INPUT_SEARCH_BOX, WIKI_INTERNAL_LINK );
+ $this->click( BUTTON_SEARCH );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $this->click( LINK_START . WIKI_INTERNAL_LINK );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $location = $this->getLocation() . "\n";
+ if ( strpos( $location, '&redlink=1' ) !== false ) {
+ $this->type( TEXT_EDITOR, "Test fixture page. No real content here" );
+ $this->click( BUTTON_SAVE_WATCH );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $this->assertTrue( $this->isTextPresent( WIKI_INTERNAL_LINK ),
+ $this->getText( TEXT_PAGE_HEADING ) );
+ }
+ }
+
+ // Create a temporary new page
+ function doCreateNewPageTemporary() {
+ $this->type( INPUT_SEARCH_BOX, WIKI_TEMP_NEWPAGE );
+ $this->click( BUTTON_SEARCH );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $this->click( LINK_START . WIKI_TEMP_NEWPAGE );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ }
+
+ // Add a internal link and verify
+ function verifyInternalLink() {
+ $this->type( TEXT_EDITOR, "" );
+ $this->click( LINK_ADDLINK );
+ $this->waitForPopup( 'addLink', WIKI_TEST_WAIT_TIME );
+ $this->type( TEXT_LINKNAME, ( WIKI_INTERNAL_LINK ) );
+ $this->assertTrue( $this->isElementPresent( ICON_PAGEEXISTS ), 'Element ' . ICON_PAGEEXISTS . 'Not found' );
+ $this->assertEquals( "on", $this->getValue( OPT_INTERNAL ) );
+ $this->click( BUTTON_INSERTLINK );
+ $this->click( LINK_PREVIEW );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $this->assertEquals( ( WIKI_INTERNAL_LINK ), $this->getText( LINK_START . WIKI_INTERNAL_LINK ) );
+ $this->click( LINK_START . WIKI_INTERNAL_LINK );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $this->assertTrue( $this->isTextPresent( WIKI_INTERNAL_LINK ), $this->getText( TEXT_PAGE_HEADING ) );
+ }
+
+ // Add a internal link with different display text and verify
+ function verifyInternalLinkWithDisplayText() {
+ $this->type( TEXT_EDITOR, "" );
+ $this->click( LINK_ADDLINK );
+ $this->waitForPopup( 'addLink', WIKI_TEST_WAIT_TIME );
+ $this->type( TEXT_LINKNAME, WIKI_INTERNAL_LINK );
+ $this->type ( TEXT_LINKDISPLAYNAME, WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT );
+ $this->assertTrue( $this->isElementPresent( ICON_PAGEEXISTS ) );
+ $this->assertEquals( "on", $this->getValue( OPT_INTERNAL ) );
+ $this->click( BUTTON_INSERTLINK );
+ $this->click( LINK_PREVIEW );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $this->assertEquals( WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT,
+ $this->getText( LINK_START . WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT ) );
+ $this->click( LINK_START . WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $this->assertTrue( $this->isTextPresent( WIKI_INTERNAL_LINK ), $this->getText( TEXT_PAGE_HEADING ) );
+
+ }
+
+ // Add a internal link with blank display text and verify
+ function verifyInternalLinkWithBlankDisplayText() {
+ $this->type( TEXT_EDITOR, "" );
+ $this->click( LINK_ADDLINK );
+ $this->waitForPopup( 'addLink', WIKI_TEST_WAIT_TIME );
+ $this->type( TEXT_LINKNAME, WIKI_INTERNAL_LINK );
+ $this->type( TEXT_LINKDISPLAYNAME, "" );
+ $this->assertTrue( $this->isElementPresent( ICON_PAGEEXISTS ) );
+ $this->assertEquals( "on", $this->getValue( OPT_INTERNAL ) );
+ $this->click( BUTTON_INSERTLINK );
+ $this->click( LINK_PREVIEW );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $this->assertEquals( WIKI_INTERNAL_LINK, $this->getText( LINK_START . WIKI_INTERNAL_LINK ) );
+ $this->click( LINK_START . WIKI_INTERNAL_LINK );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $this->assertEquals( WIKI_INTERNAL_LINK, $this->getText( TEXT_PAGE_HEADING ) );
+
+ }
+
+ // Add external link and verify
+ function verifyExternalLink() {
+ $this->type( LINK_PREVIEW, "" );
+ $this->click( LINK_ADDLINK );
+ $this->type( TEXT_LINKNAME, WIKI_EXTERNAL_LINK );
+ $this->assertTrue( $this->isElementPresent( ICON_PAGEEXTERNAL ) );
+ $this->assertEquals( "on", $this->getValue( OPT_EXTERNAL ) );
+ $this->click( BUTTON_INSERTLINK );
+ $this->click( LINK_PREVIEW );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $this->assertEquals( WIKI_EXTERNAL_LINK, $this->getText( LINK_START . WIKI_EXTERNAL_LINK ) );
+
+ $this->click( LINK_START . WIKI_EXTERNAL_LINK );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $this->assertEquals( WIKI_EXTERNAL_LINK_TITLE, $this->getTitle() );
+ }
+
+ // Add external link with different display text and verify
+ function verifyExternalLinkWithDisplayText() {
+ $this->type( TEXT_EDITOR, "" );
+ $this->click( LINK_ADDLINK );
+ $this->type( TEXT_LINKNAME, WIKI_EXTERNAL_LINK );
+ $this->type( TEXT_LINKDISPLAYNAME, WIKI_EXTERNAL_LINK_TITLE );
+ $this->assertTrue( $this->isElementPresent( ICON_PAGEEXTERNAL ) );
+ $this->assertEquals( "on", $this->getValue( OPT_EXTERNAL ) );
+ $this->click( BUTTON_INSERTLINK );
+ $this->click( LINK_PREVIEW );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $this->assertEquals( WIKI_EXTERNAL_LINK_TITLE, $this->getText( LINK_START . WIKI_EXTERNAL_LINK_TITLE ) );
+ $this->click( LINK_START . ( WIKI_EXTERNAL_LINK_TITLE ) );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $this->assertEquals( WIKI_EXTERNAL_LINK_TITLE , $this->getTitle() );
+ }
+
+ // Add external link with Blank display text and verify
+ function verifyExternalLinkWithBlankDisplayText() {
+ $this->type( TEXT_EDITOR, "" );
+ $this->click( LINK_ADDLINK );
+ $this->type( TEXT_LINKNAME, WIKI_EXTERNAL_LINK );
+ $this->type( TEXT_LINKDISPLAYNAME, "" );
+ $this->assertTrue( $this->isElementPresent( ICON_PAGEEXTERNAL ) );
+ $this->assertEquals( "on", $this->getValue( OPT_EXTERNAL ) );
+ $this->click( BUTTON_INSERTLINK );
+ $this->click( LINK_PREVIEW );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $this->assertEquals( "[1]", $this->getText( LINK_START . "[1]" ) );
+ $this->click( LINK_START . "[1]" );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $this->assertEquals( WIKI_EXTERNAL_LINK_TITLE, $this->getTitle() );
+ }
+
+ // Add a table and verify
+ function verifyCreateTable() {
+ $WIKI_TABLE_ROW = 2;
+ $WIKI_TABLE_COL = "5";
+ $this->doExpandAdvanceSection();
+ $this->type( TEXT_EDITOR, "" );
+ $this->click( LINK_ADDTABLE );
+ $this->click( CHK_SORT );
+ $this->type( TEXT_ROW, $WIKI_TABLE_ROW );
+ $this->type( TEXT_COL, $WIKI_TABLE_COL );
+ $this->click( BUTTON_INSERTABLE );
+ $this->click( CHK_SORT );
+ $this->click( LINK_PREVIEW );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $WIKI_TABLE_ROW = $WIKI_TABLE_ROW + 1;
+ $this->assertTrue( $this->isElementPresent( TEXT_TABLEID_OTHER .
+ TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW .
+ TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL .
+ TEXT_VALIDATE_TABLE_PART3 ) );
+ }
+
+ // Add a table and verify only with head row
+ function verifyCreateTableWithHeadRow() {
+ $WIKI_TABLE_ROW = 3;
+ $WIKI_TABLE_COL = "4";
+ $this->doExpandAdvanceSection();
+ $this->type( TEXT_EDITOR, "" );
+ $this->click( LINK_ADDTABLE );
+ $this->click( CHK_BOARDER );
+ $this->type( TEXT_ROW, $WIKI_TABLE_ROW );
+ $this->type( TEXT_COL, $WIKI_TABLE_COL );
+ $this->click( BUTTON_INSERTABLE );
+ $this->click( LINK_PREVIEW );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $WIKI_TABLE_ROW = $WIKI_TABLE_ROW + 1;
+ $this->assertTrue( $this->isElementPresent( TEXT_TABLEID_OTHER .
+ TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW .
+ TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL .
+ TEXT_VALIDATE_TABLE_PART3 ) );
+ }
+
+ // Add a table and verify only with borders
+ function verifyCreateTableWithBorders() {
+ $WIKI_TABLE_ROW = "4";
+ $WIKI_TABLE_COL = "6";
+ $this->type( TEXT_EDITOR, "" );
+ $this->click( LINK_ADDTABLE );
+ $this->click( CHK_HEADER );
+ $this->type( TEXT_ROW, $WIKI_TABLE_ROW );
+ $this->type( TEXT_COL, $WIKI_TABLE_COL );
+ $this->click( BUTTON_INSERTABLE );
+ $this->click( CHK_HEADER );
+ $this->click( LINK_PREVIEW );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $this->assertTrue( $this->isElementPresent( TEXT_TABLEID_OTHER .
+ TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW .
+ TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL .
+ TEXT_VALIDATE_TABLE_PART3 ) );
+ }
+
+ // Add a table and verify only with sort row
+ function verifyCreateTableWithSortRow() {
+ $WIKI_TABLE_ROW = "2";
+ $WIKI_TABLE_COL = "5";
+ $this->type( TEXT_EDITOR, "" );
+ $this->click( LINK_ADDTABLE );
+ $this->click( CHK_HEADER );
+ $this->click( CHK_BOARDER );
+ $this->click( CHK_SORT );
+ $this->type( TEXT_ROW, $WIKI_TABLE_ROW );
+ $this->type( TEXT_COL, $WIKI_TABLE_COL );
+ $this->click( BUTTON_INSERTABLE );
+ $this->click( CHK_HEADER );
+ $this->click( CHK_BOARDER );
+ $this->click( CHK_SORT );
+ $this->click( LINK_PREVIEW );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $this->assertTrue( $this->isElementPresent( TEXT_TABLEID_WITHALLFEATURES .
+ TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW .
+ TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL .
+ TEXT_VALIDATE_TABLE_PART3 ) );
+ }
+
+ // Add a table without headers,borders and sort rows
+ function verifyCreateTableWithNoSpecialEffects() {
+ $WIKI_TABLE_ROW = "6";
+ $WIKI_TABLE_COL = "2";
+ $this->
+ $this->doExpandAdvanceSection();
+ $this->type( TEXT_EDITOR, "" );
+ $this->click( LINK_ADDTABLE );
+ $this->click( CHK_BOARDER );
+ $this->click( CHK_HEADER );
+ $this->type( TEXT_ROW, $WIKI_TABLE_ROW );
+ $this->type( TEXT_COL, $WIKI_TABLE_COL );
+ $this->click( BUTTON_INSERTABLE );
+ $this->click( CHK_BOARDER );
+ $this->click( CHK_HEADER );
+ $this->click( INK_PREVIEW );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $this->assertTrue( $this->isElementPresent( TEXT_TABLEID_OTHER .
+ TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW .
+ TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL .
+ TEXT_VALIDATE_TABLE_PART3 ) );
+ }
+
+ // Add a table with headers,borders and sort rows
+ function verifyCreateTableWithAllSpecialEffects() {
+ $WIKI_TABLE_ROW = 6;
+ $WIKI_TABLE_COL = "2";
+ $this->doExpandAdvanceSection();
+ $this->type( TEXT_EDITOR, "" );
+ $this->click( LINK_ADDTABLE );
+ $this->click( CHK_SORT );
+ $this->type( TEXT_ROW, $WIKI_TABLE_ROW );
+ $this->type( TEXT_COL, $WIKI_TABLE_COL );
+ $this->click( BUTTON_INSERTABLE );
+ $this->click( CHK_SORT );
+ $this->click( LINK_PREVIEW );
+ $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
+ $WIKI_TABLE_ROW = $WIKI_TABLE_ROW + 1;
+ $this->assertTrue( $this->isElementPresent( TEXT_TABLEID_WITHALLFEATURES .
+ TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW .
+ TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL .
+ TEXT_VALIDATE_TABLE_PART3 ) );
+ }
+
+}
diff --git a/extensions/WikiEditor/tests/selenium/WikiEditorConstants.php b/extensions/WikiEditor/tests/selenium/WikiEditorConstants.php
new file mode 100644
index 00000000..090f96bf
--- /dev/null
+++ b/extensions/WikiEditor/tests/selenium/WikiEditorConstants.php
@@ -0,0 +1,84 @@
+<?php
+define ( 'WIKI_TEST_WAIT_TIME', "3000" ); // Waiting time
+
+// tool bar, buttons , links
+// commonly using links
+define ( 'LINK_MAIN_PAGE', "link=Main page" );
+define ( 'LINK_RANDOM_PAGE', "link=Random article" );
+define ( 'TEXT_PAGE_HEADING', "firstHeading" );
+define ( 'LINK_START', "link=" );
+define ( 'LINK_EDITPAGE', "//li[@id='ca-edit']/a/span" );
+define ( 'TEXT_EDITOR', "wpTextbox1" );
+define ( 'LINK_PREVIEW', "wpPreview" );
+
+define ( 'WIKI_SEARCH_PAGE', "Hair (musical)" ); // Page name to search
+define ( 'WIKI_TEXT_SEARCH', "TV" ); // Text to search
+define ( 'WIKI_INTERNAL_LINK', "Wikieditor-Fixture-Page" ); // Exisiting page name to add as an internal tag
+define ( 'WIKI_EXTERNAL_LINK', "www.google.com" ); // External web site name
+define ( 'WIKI_EXTERNAL_LINK_TITLE', "Google" ); // Page title of the external web site name
+define ( 'WIKI_CODE_PATH', getcwd() ); // get the current path of the program
+define ( 'WIKI_SCREENSHOTS_PATH', "screenshots" ); // the folder the error screen shots will be saved
+define ( 'WIKI_SCREENSHOTS_TYPE', "png" ); // screen print type
+define ( 'WIKI_TEMP_NEWPAGE', "TestWikiPage" ); // temporary creating new page name
+// for WikiCommonFunction_TC
+
+// for WikiSearch_TC
+define ( 'INPUT_SEARCH_BOX', "searchInput" );
+define ( 'BUTTON_SEARCH', "mw-searchButton" );
+define ( 'TEXT_SEARCH_RESULT_HEADING', " - Search results - Wikipedia, the free encyclopedia" );
+
+// for WikiWatchUnWatch_TC
+define ( 'LINK_WATCH_PAGE', "link=Watch" );
+define ( 'LINK_WATCH_LIST', "link=My watchlist" );
+define ( 'LINK_WATCH_EDIT', "link=View and edit watchlist" );
+define ( 'LINK_UNWATCH', "link=Unwatch" );
+define ( 'BUTTON_WATCH', "wpWatchthis" );
+define ( 'BUTTON_SAVE_WATCH', "wpSave" );
+define ( 'TEXT_WATCH', "Watch" );
+define ( 'TEXT_UNWATCH', "Unwatch" );
+
+// for WikiCommonFunction_TC
+define ( 'TEXT_LOGOUT', "Log out" );
+define ( 'LINK_LOGOUT', "link=Log out" );
+define ( 'LINK_LOGIN', "link=Log in / create account" );
+define ( 'TEXT_LOGOUT_CONFIRM', "Log in / create account" );
+define ( 'INPUT_USER_NAME', "wpName1" );
+define ( 'INPUT_PASSWD', "wpPassword1" );
+define ( 'BUTTON_LOGIN', "wpLoginAttempt" );
+define ( 'TEXT_HEADING', "Heading" );
+define ( 'LINK_ADVANCED', "link=Advanced" );
+
+// for WikiDialogs_TC
+define ( 'LINK_ADDLINK', "//div[@id='wikiEditor-ui-toolbar']/div[1]/div[2]/span[2 ]" );
+define ( 'TEXT_LINKNAME', "wikieditor-toolbar-link-int-target" );
+define ( 'TEXT_LINKDISPLAYNAME', "wikieditor-toolbar-link-int-text" );
+define ( 'TEXT_LINKDISPLAYNAME_APPENDTEXT', " Test" );
+define ( 'ICON_PAGEEXISTS', "wikieditor-toolbar-link-int-target-status-exists" );
+define ( 'ICON_PAGEEXTERNAL', "wikieditor-toolbar-link-int-target-status-external" );
+define ( 'OPT_INTERNAL', "wikieditor-toolbar-link-type-int" );
+define ( 'OPT_EXTERNAL', "wikieditor-toolbar-link-type-ext" );
+define ( 'BUTTON_INSERTLINK', "//div[10]/div[11]/button[1]" );
+define ( 'LINK_ADDTABLE', "//div[@id='wikiEditor-ui-toolbar']/div[3]/div[1]/div[4]/span[2]" );
+define ( 'CHK_HEADER', "wikieditor-toolbar-table-dimensions-header" );
+define ( 'CHK_BOARDER', "wikieditor-toolbar-table-wikitable" );
+define ( 'CHK_SORT', "wikieditor-toolbar-table-sortable" );
+define ( 'TEXT_ROW', "wikieditor-toolbar-table-dimensions-rows" );
+define ( 'TEXT_COL', "wikieditor-toolbar-table-dimensions-columns" );
+define ( 'BUTTON_INSERTABLE', "//div[3]/button[1]" );
+define ( 'TEXT_HEADTABLE_TEXT', "Header text" );
+define ( 'TEXT_TABLEID_WITHALLFEATURES', "//table[@id='sortable_table_id_0']/tbody/" );
+define ( 'TEXT_TABLEID_OTHER', "//div[@id='wikiPreview']/table/tbody/" );
+define ( 'TEXT_VALIDATE_TABLE_PART1', "tr[" );
+define ( 'TEXT_VALIDATE_TABLE_PART2', "]/td[" );
+define ( 'TEXT_VALIDATE_TABLE_PART3', "]" );
+define ( 'LINK_SEARCH', "//div[@id='wikiEditor-ui-toolbar']/div[3]/div[1]/div[5]/span" );
+define ( 'INPUT_SEARCH', "wikieditor-toolbar-replace-search" );
+define ( 'INPUT_REPLACE', "wikieditor-toolbar-replace-replace" );
+define ( 'BUTTON_REPLACEALL', "//button[3]" );
+define ( 'BUTTON_REPLACENEXT', "//button[2]" );
+define ( 'BUTTON_CANCEL', "//button[4]" );
+define ( 'TEXT_PREVIEW_TEXT1', "//div[@id='wikiPreview']/p[1]" );
+define ( 'TEXT_PREVIEW_TEXT2', "//div[@id='wikiPreview']/p[2]" );
+define ( 'TEXT_PREVIEW_TEXT3', "//div[@id='wikiPreview']/p[3]" );
+
+
diff --git a/extensions/WikiEditor/tests/selenium/WikiEditorSeleniumConfig.php b/extensions/WikiEditor/tests/selenium/WikiEditorSeleniumConfig.php
new file mode 100644
index 00000000..ad4be489
--- /dev/null
+++ b/extensions/WikiEditor/tests/selenium/WikiEditorSeleniumConfig.php
@@ -0,0 +1,27 @@
+<?php
+
+class WikiEditorSeleniumConfig {
+
+ public static function getSettings( &$includeFiles, &$globalConfigs ) {
+ $includes = array(
+ 'extensions/Vector/Vector.php',
+ 'extensions/WikiEditor/WikiEditor.php'
+ );
+ $configs = array(
+ 'wgDefaultSkin' => 'vector',
+ 'wgWikiEditorFeatures' => array(
+ 'toolbar' => array( 'global' => true, 'user' => true ),
+ 'toc' => array( 'global' => false, 'user' => false ),
+ 'highlight' => array( 'global' => false, 'user' => false ),
+ 'templateEditor' => array( 'global' => false, 'user' => false ),
+ 'dialogs' => array( 'global' => true, 'user' => true )
+ ),
+ 'wgVectorFeatures' => array(
+ 'editwarning' => array( 'global' => false, 'user' => false )
+ )
+ );
+ $includeFiles = array_merge( $includeFiles, $includes );
+ $globalConfigs = array_merge( $globalConfigs, $configs );
+ return true;
+ }
+} \ No newline at end of file
diff --git a/extensions/WikiEditor/tests/selenium/WikiEditorTestSuite.php b/extensions/WikiEditor/tests/selenium/WikiEditorTestSuite.php
new file mode 100644
index 00000000..b4029d3a
--- /dev/null
+++ b/extensions/WikiEditor/tests/selenium/WikiEditorTestSuite.php
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * To configure MW for these tests
+ * 1) If you are running multiple test suites, add the following in LocalSettings.php
+ * require_once("extensions/WikiEditor/tests/selenium/WikiEditorSeleniumConfig.php");
+ * $wgSeleniumTestConfigs['WikiEditorTestSuite'] = 'WikiEditorSeleniumConfig::getSettings';
+ * OR
+ * 2) Add the following to your Localsettings.php
+ * require_once( "$IP/extensions/Vector/Vector.php" );
+ * require_once( "$IP/extensions/WikiEditor/WikiEditor.php" );
+ * $wgDefaultSkin = 'vector';
+ * $wgVectorFeatures['editwarning'] = array( 'global' => false, 'user' => false );
+ * $wgWikiEditorFeatures['templateEditor'] = array( 'global' => false, 'user' => false );
+ * $wgWikiEditorFeatures['toolbar'] = array( 'global' => true, 'user' => true );
+ * $wgWikiEditorFeatures['toc'] = array( 'global' => false, 'user' => false );
+ * $wgWikiEditorFeatures['highlight'] = array( 'global' => false, 'user' => false );
+ * $wgWikiEditorFeatures['dialogs'] = array( 'global' => true, 'user' => true );
+ *
+ */
+class WikiEditorTestSuite extends SeleniumTestSuite
+{
+ public function setUp() {
+ $this->setLoginBeforeTests( false );
+ parent::setUp();
+ }
+ public function addTests() {
+ $testFiles = array(
+ 'extensions/WikiEditor/tests/selenium/WikiDialogs_Links.php'
+ );
+ parent::addTestFiles( $testFiles );
+ }
+
+
+}