summaryrefslogtreecommitdiff
path: root/extensions/InputBox/InputBox.classes.php
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-01-28 09:50:25 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-01-28 09:50:25 -0500
commit5744df39e15f85c6cc8a9faf8924d77e76d2b216 (patch)
treea8c8dd40a94d1fa0d5377566aa5548ae55a163da /extensions/InputBox/InputBox.classes.php
parent4bb2aeca1d198391ca856aa16c40b8559c68daec (diff)
parent224b22a051051f6c2e494c3a2fb4adb42898e2d1 (diff)
Merge branch 'archwiki'
Conflicts: extensions/FluxBBAuthPlugin.php extensions/SyntaxHighlight_GeSHi/README extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.i18n.php extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php extensions/SyntaxHighlight_GeSHi/geshi/docs/CHANGES extensions/SyntaxHighlight_GeSHi/geshi/docs/THANKS extensions/SyntaxHighlight_GeSHi/geshi/docs/TODO extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/AbstractClass.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/AbstractClass_logo.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/AbstractMethod.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/AbstractPrivateClass.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/AbstractPrivateClass_logo.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/AbstractPrivateMethod.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Class.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Class_logo.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Constant.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Constructor.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Destructor.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Function.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Global.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/I.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Index.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Interface.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Interface_logo.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/L.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Lminus.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Lplus.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Method.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Page.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Page_logo.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/PrivateClass.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/PrivateClass_logo.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/PrivateMethod.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/PrivateVariable.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/StaticMethod.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/StaticVariable.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/T.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Tminus.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Tplus.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Variable.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/blank.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/class_folder.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/file.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/folder.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/function_folder.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/next_button.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/next_button_disabled.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/package.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/package_folder.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/previous_button.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/previous_button_disabled.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/private_class_logo.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/tutorial.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/tutorial_folder.png extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/up_button.png extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.html extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.txt extensions/SyntaxHighlight_GeSHi/geshi/geshi.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/4cs.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/6502acme.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/6502kickass.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/6502tasm.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/68000devpac.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/abap.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/actionscript.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/actionscript3.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/ada.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/algol68.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/apache.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/applescript.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/apt_sources.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/asm.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/asp.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/autoconf.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/autohotkey.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/autoit.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/avisynth.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/awk.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/bascomavr.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/bash.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/basic4gl.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/bf.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/bibtex.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/blitzbasic.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/bnf.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/boo.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/c.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/c_loadrunner.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/c_mac.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/caddcl.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/cadlisp.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/cfdg.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/cfm.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/chaiscript.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/cil.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/clojure.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/cmake.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/cobol.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/coffeescript.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/cpp-qt.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/cpp.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/csharp.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/css.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/cuesheet.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/d.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/dcs.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/delphi.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/diff.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/div.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/dos.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/dot.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/e.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/ecmascript.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/eiffel.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/email.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/epc.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/erlang.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/euphoria.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/f1.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/falcon.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/fo.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/fortran.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/freebasic.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/fsharp.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/gambas.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/gdb.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/genero.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/genie.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/gettext.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/glsl.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/gml.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/gnuplot.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/go.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/groovy.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/gwbasic.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/haskell.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/hicest.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/hq9plus.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/html4strict.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/html5.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/icon.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/idl.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/ini.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/inno.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/intercal.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/io.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/j.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/java.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/java5.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/javascript.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/jquery.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/kixtart.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/klonec.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/klonecpp.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/latex.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/lb.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/lisp.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/llvm.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/locobasic.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/logtalk.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/lolcode.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/lotusformulas.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/lotusscript.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/lscript.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/lsl2.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/lua.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/m68k.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/magiksf.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/make.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/mapbasic.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/matlab.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/mirc.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/mmix.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/modula2.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/modula3.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/mpasm.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/mxml.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/mysql.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/newlisp.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/nsis.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/oberon2.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/objc.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/objeck.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/ocaml-brief.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/ocaml.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/oobas.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/oracle11.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/oracle8.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/oxygene.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/oz.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/pascal.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/pcre.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/per.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/perl.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/perl6.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/pf.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/php-brief.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/php.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/pic16.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/pike.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/pixelbender.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/pli.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/plsql.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/postgresql.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/povray.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/powerbuilder.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/powershell.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/proftpd.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/progress.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/prolog.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/properties.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/providex.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/purebasic.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/pycon.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/python.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/q.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/qbasic.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/rails.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/rebol.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/reg.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/robots.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/rpmspec.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/rsplus.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/ruby.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/sas.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/scala.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/scheme.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/scilab.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/sdlbasic.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/smalltalk.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/smarty.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/sql.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/systemverilog.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/tcl.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/teraterm.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/text.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/thinbasic.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/tsql.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/typoscript.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/unicon.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/uscript.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/vala.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/vb.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/vbnet.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/verilog.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/vhdl.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/vim.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/visualfoxpro.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/visualprolog.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/whitespace.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/whois.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/winbatch.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/xbasic.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/xml.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/xorg_conf.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/xpp.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/yaml.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/z80.php extensions/SyntaxHighlight_GeSHi/geshi/geshi/zxbasic.php
Diffstat (limited to 'extensions/InputBox/InputBox.classes.php')
-rw-r--r--extensions/InputBox/InputBox.classes.php593
1 files changed, 593 insertions, 0 deletions
diff --git a/extensions/InputBox/InputBox.classes.php b/extensions/InputBox/InputBox.classes.php
new file mode 100644
index 00000000..380015cc
--- /dev/null
+++ b/extensions/InputBox/InputBox.classes.php
@@ -0,0 +1,593 @@
+<?php
+/**
+ * Classes for InputBox extension
+ *
+ * @file
+ * @ingroup Extensions
+ */
+
+// InputBox class
+class InputBox {
+
+ /* Fields */
+
+ private $mParser;
+ private $mType = '';
+ private $mWidth = 50;
+ private $mPreload = '';
+ private $mEditIntro = '';
+ private $mSummary = '';
+ private $mNosummary = '';
+ private $mMinor = '';
+ private $mPage = '';
+ private $mBR = 'yes';
+ private $mDefaultText = '';
+ private $mPlaceholderText = '';
+ private $mBGColor = 'transparent';
+ private $mButtonLabel = '';
+ private $mSearchButtonLabel = '';
+ private $mFullTextButton = '';
+ private $mLabelText = '';
+ private $mHidden = '';
+ private $mNamespaces = '';
+ private $mID = '';
+ private $mInline = false;
+ private $mPrefix = '';
+ private $mDir = '';
+
+ /* Functions */
+
+ public function __construct( $parser ) {
+ $this->mParser = $parser;
+ // Default value for dir taken from the page language (bug 37018)
+ $this->mDir = $this->mParser->getTargetLanguage()->getDir();
+ // Split caches by language, to make sure visitors do not see a cached
+ // version in a random language (since labels are in the user language)
+ $this->mParser->getOptions()->getUserLangObj();
+ }
+
+ public function render() {
+ // Handle various types
+ switch( $this->mType ) {
+ case 'create':
+ case 'comment':
+ return $this->getCreateForm();
+ case 'commenttitle':
+ return $this->getCommentForm();
+ case 'search':
+ return $this->getSearchForm('search');
+ case 'fulltext':
+ return $this->getSearchForm('fulltext');
+ case 'search2':
+ return $this->getSearchForm2();
+ default:
+ return Xml::tags( 'div', null,
+ Xml::element( 'strong',
+ array(
+ 'class' => 'error'
+ ),
+ strlen( $this->mType ) > 0
+ ? wfMessage( 'inputbox-error-bad-type', $this->mType )->text()
+ : wfMessage( 'inputbox-error-no-type' )->text()
+ )
+ );
+ }
+ }
+
+ /**
+ * Generate search form
+ * @param $type
+ * @return string HTML
+ */
+ public function getSearchForm( $type ) {
+ global $wgContLang, $wgNamespaceAliases;
+
+ // Use button label fallbacks
+ if ( !$this->mButtonLabel ) {
+ $this->mButtonLabel = wfMessage( 'tryexact' )->escaped();
+ }
+ if ( !$this->mSearchButtonLabel ) {
+ $this->mSearchButtonLabel = wfMessage( 'searchfulltext' )->escaped();
+ }
+
+ // Build HTML
+ $htmlOut = Xml::openElement( 'div',
+ array(
+ 'style' => 'margin-left: auto; margin-right: auto; text-align: center; background-color:' . $this->mBGColor
+ )
+ );
+ $htmlOut .= Xml::openElement( 'form',
+ array(
+ 'name' => 'searchbox',
+ 'id' => 'searchbox',
+ 'class' => 'searchbox',
+ 'action' => SpecialPage::getTitleFor( 'Search' )->escapeLocalUrl(),
+ )
+ );
+ $htmlOut .= Xml::element( 'input',
+ array(
+ 'class' => 'searchboxInput',
+ 'name' => 'search',
+ 'type' => $this->mHidden ? 'hidden' : 'text',
+ 'value' => $this->mDefaultText,
+ 'placeholder' => $this->mPlaceholderText,
+ 'size' => $this->mWidth,
+ 'dir' => $this->mDir,
+ )
+ );
+
+ if( $this->mPrefix != '' ){
+ $htmlOut .= Xml::element( 'input',
+ array(
+ 'name' => 'prefix',
+ 'type' => 'hidden',
+ 'value' => $this->mPrefix,
+ )
+ );
+ }
+
+ $htmlOut .= $this->mBR;
+
+ // Determine namespace checkboxes
+ $namespacesArray = explode( ',', $this->mNamespaces );
+ if ( $this->mNamespaces ) {
+ $namespaces = $wgContLang->getNamespaces();
+ $nsAliases = array_merge( $wgContLang->getNamespaceAliases(), $wgNamespaceAliases );
+ $showNamespaces = array();
+ $checkedNS = array();
+ # Check for valid namespaces
+ foreach ( $namespacesArray as $userNS ) {
+ $userNS = trim( $userNS ); # no whitespace
+
+ # Namespace needs to be checked if flagged with "**"
+ if ( strpos( $userNS, '**' ) ) {
+ $userNS = str_replace( '**', '', $userNS );
+ $checkedNS[$userNS] = true;
+ }
+
+ $mainMsg = wfMessage( 'inputbox-ns-main' )->inContentLanguage()->text();
+ if( $userNS == 'Main' || $userNS == $mainMsg ) {
+ $i = 0;
+ } elseif( array_search( $userNS, $namespaces ) ) {
+ $i = array_search( $userNS, $namespaces );
+ } elseif ( isset( $nsAliases[$userNS] ) ) {
+ $i = $nsAliases[$userNS];
+ } else {
+ continue; # Namespace not recognized, skip
+ }
+ $showNamespaces[$i] = $userNS;
+ if( isset( $checkedNS[$userNS] ) && $checkedNS[$userNS] ) {
+ $checkedNS[$i] = true;
+ }
+ }
+
+ # Show valid namespaces
+ foreach( $showNamespaces as $i => $name ) {
+ $checked = array();
+ // Namespace flagged with "**" or if it's the only one
+ if ( ( isset( $checkedNS[$i] ) && $checkedNS[$i] ) || count( $showNamespaces ) == 1 ) {
+ $checked = array( 'checked' => 'checked' );
+ }
+
+ if ( count( $showNamespaces ) == 1 ) {
+ // Checkbox
+ $htmlOut .= Xml::element( 'input',
+ array(
+ 'type' => 'hidden',
+ 'name' => 'ns' . $i,
+ 'value' => 1,
+ 'id' => 'mw-inputbox-ns' . $i
+ ) + $checked
+ );
+ } else {
+ // Checkbox
+ $htmlOut .= ' <div class="inputbox-element" style="display: inline; white-space: nowrap;">';
+ $htmlOut .= Xml::element( 'input',
+ array(
+ 'type' => 'checkbox',
+ 'name' => 'ns' . $i,
+ 'value' => 1,
+ 'id' => 'mw-inputbox-ns' . $i
+ ) + $checked
+ );
+ // Label
+ $htmlOut .= '&#160;' . Xml::label( $name, 'mw-inputbox-ns' . $i );
+ $htmlOut .= '</div> ';
+ }
+ }
+
+ // Line break
+ $htmlOut .= $this->mBR;
+ } elseif( $type == 'search' ) {
+ // Go button
+ $htmlOut .= Xml::element( 'input',
+ array(
+ 'type' => 'submit',
+ 'name' => 'go',
+ 'class' => 'searchboxGoButton',
+ 'value' => $this->mButtonLabel
+ )
+ );
+ $htmlOut .= '&#160;';
+ }
+
+ // Search button
+ $htmlOut .= Xml::element( 'input',
+ array(
+ 'type' => 'submit',
+ 'name' => 'fulltext',
+ 'class' => 'searchboxSearchButton',
+ 'value' => $this->mSearchButtonLabel
+ )
+ );
+
+ // Hidden fulltext param for IE (bug 17161)
+ if( $type == 'fulltext' ) {
+ $htmlOut .= Html::hidden( 'fulltext', 'Search' );
+ }
+
+ $htmlOut .= Xml::closeElement( 'form' );
+ $htmlOut .= Xml::closeElement( 'div' );
+
+ // Return HTML
+ return $htmlOut;
+ }
+
+ /**
+ * Generate search form version 2
+ */
+ public function getSearchForm2() {
+ // Use button label fallbacks
+ if ( !$this->mButtonLabel ) {
+ $this->mButtonLabel = wfMessage( 'tryexact' )->escaped();
+ }
+
+ $id = Sanitizer::escapeId( $this->mID, 'noninitial' );
+ $htmlLabel = '';
+ if ( isset( $this->mLabelText ) && strlen( trim( $this->mLabelText ) ) ) {
+ $this->mLabelText = $this->mParser->recursiveTagParse( $this->mLabelText );
+ $htmlLabel = Xml::openElement( 'label', array( 'for' => 'bodySearchInput' . $id ) );
+ $htmlLabel .= $this->mLabelText;
+ $htmlLabel .= Xml::closeElement( 'label' );
+ }
+ $htmlOut = Xml::openElement( 'form',
+ array(
+ 'name' => 'bodySearch' . $id,
+ 'id' => 'bodySearch' . $id,
+ 'class' => 'bodySearch',
+ 'action' => SpecialPage::getTitleFor( 'Search' )->escapeLocalUrl(),
+ 'style' => $this->mInline ? 'display: inline;' : ''
+ )
+ );
+ $htmlOut .= Xml::openElement( 'div',
+ array(
+ 'class' => 'bodySearchWrap',
+ 'style' => 'background-color:' . $this->mBGColor . ';' .
+ $this->mInline ? 'display: inline;' : ''
+ )
+ );
+ $htmlOut .= $htmlLabel;
+ $htmlOut .= Xml::element( 'input',
+ array(
+ 'type' => $this->mHidden ? 'hidden' : 'text',
+ 'name' => 'search',
+ 'size' => $this->mWidth,
+ 'id' => 'bodySearchInput' . $id,
+ 'dir' => $this->mDir,
+ )
+ );
+ $htmlOut .= Xml::element( 'input',
+ array(
+ 'type' => 'submit',
+ 'name' => 'go',
+ 'value' => $this->mButtonLabel,
+ 'class' => 'bodySearchBtnGo' . $id
+ )
+ );
+
+ // Better testing needed here!
+ if ( !empty( $this->mFullTextButton ) ) {
+ $htmlOut .= Xml::element( 'input',
+ array(
+ 'type' => 'submit',
+ 'name' => 'fulltext',
+ 'class' => 'bodySearchBtnSearch',
+ 'value' => $this->mSearchButtonLabel
+ )
+ );
+ }
+
+ $htmlOut .= Xml::closeElement( 'div' );
+ $htmlOut .= Xml::closeElement( 'form' );
+
+ // Return HTML
+ return $htmlOut;
+ }
+
+ /**
+ * Generate create page form
+ */
+ public function getCreateForm() {
+ global $wgScript;
+
+ if ( $this->mType == "comment" ) {
+ if ( !$this->mButtonLabel ) {
+ $this->mButtonLabel = wfMessage( "postcomment" )->escaped();
+ }
+ } else {
+ if ( !$this->mButtonLabel ) {
+ $this->mButtonLabel = wfMessage( 'createarticle' )->escaped();
+ }
+ }
+
+ $htmlOut = Xml::openElement( 'div',
+ array(
+ 'style' => 'margin-left: auto; margin-right: auto; text-align: center; background-color:' . $this->mBGColor
+ )
+ );
+ $createBoxParams = array(
+ 'name' => 'createbox',
+ 'class' => 'createbox',
+ 'action' => $wgScript,
+ 'method' => 'get'
+ );
+ if( isset( $this->mId ) ) {
+ $createBoxParams['id'] = Sanitizer::escapeId( $this->mId );
+ }
+ $htmlOut .= Xml::openElement( 'form', $createBoxParams );
+ $htmlOut .= Xml::openElement( 'input',
+ array(
+ 'type' => 'hidden',
+ 'name' => 'action',
+ 'value' => 'edit',
+ )
+ );
+ $htmlOut .= Xml::openElement( 'input',
+ array(
+ 'type' => 'hidden',
+ 'name' => 'preload',
+ 'value' => $this->mPreload,
+ )
+ );
+ $htmlOut .= Xml::openElement( 'input',
+ array(
+ 'type' => 'hidden',
+ 'name' => 'editintro',
+ 'value' => $this->mEditIntro,
+ )
+ );
+ $htmlOut .= Xml::openElement( 'input',
+ array(
+ 'type' => 'hidden',
+ 'name' => 'summary',
+ 'value' => $this->mSummary,
+ )
+ );
+ $htmlOut .= Xml::openElement( 'input',
+ array(
+ 'type' => 'hidden',
+ 'name' => 'nosummary',
+ 'value' => $this->mNosummary,
+ )
+ );
+ $htmlOut .= Xml::openElement( 'input',
+ array(
+ 'type' => 'hidden',
+ 'name' => 'prefix',
+ 'value' => $this->mPrefix,
+ )
+ );
+ $htmlOut .= Xml::openElement( 'input',
+ array(
+ 'type' => 'hidden',
+ 'name' => 'minor',
+ 'value' => $this->mMinor,
+ )
+ );
+ if ( $this->mType == 'comment' ) {
+ $htmlOut .= Xml::openElement( 'input',
+ array(
+ 'type' => 'hidden',
+ 'name' => 'section',
+ 'value' => 'new',
+ )
+ );
+ }
+ $htmlOut .= Xml::openElement( 'input',
+ array(
+ 'type' => $this->mHidden ? 'hidden' : 'text',
+ 'name' => 'title',
+ 'class' => 'createboxInput',
+ 'value' => $this->mDefaultText,
+ 'placeholder' => $this->mPlaceholderText,
+ 'size' => $this->mWidth,
+ 'dir' => $this->mDir,
+ )
+ );
+ $htmlOut .= $this->mBR;
+ $htmlOut .= Xml::openElement( 'input',
+ array(
+ 'type' => 'submit',
+ 'name' => 'create',
+ 'class' => 'createboxButton',
+ 'value' => $this->mButtonLabel
+ )
+ );
+ $htmlOut .= Xml::closeElement( 'form' );
+ $htmlOut .= Xml::closeElement( 'div' );
+
+ // Return HTML
+ return $htmlOut;
+ }
+
+ /**
+ * Generate new section form
+ */
+ public function getCommentForm() {
+ global $wgScript;
+
+ if ( !$this->mButtonLabel ) {
+ $this->mButtonLabel = wfMessage( "postcomment" )->escaped();
+ }
+
+ $htmlOut = Xml::openElement( 'div',
+ array(
+ 'style' => 'margin-left: auto; margin-right: auto; text-align: center; background-color:' . $this->mBGColor
+ )
+ );
+ $commentFormParams = array(
+ 'name' => 'commentbox',
+ 'class' => 'commentbox',
+ 'action' => $wgScript,
+ 'method' => 'get'
+ );
+ if( isset( $this->mId ) ) {
+ $commentFormParams['id'] = Sanitizer::escapeId( $this->mId );
+ }
+ $htmlOut .= Xml::openElement( 'form', $commentFormParams );
+ $htmlOut .= Xml::openElement( 'input',
+ array(
+ 'type' => 'hidden',
+ 'name' => 'action',
+ 'value' => 'edit',
+ )
+ );
+ $htmlOut .= Xml::openElement( 'input',
+ array(
+ 'type' => 'hidden',
+ 'name' => 'preload',
+ 'value' => $this->mPreload,
+ )
+ );
+ $htmlOut .= Xml::openElement( 'input',
+ array(
+ 'type' => 'hidden',
+ 'name' => 'editintro',
+ 'value' => $this->mEditIntro,
+ )
+ );
+ $htmlOut .= Xml::openElement( 'input',
+ array(
+ 'type' => $this->mHidden ? 'hidden' : 'text',
+ 'name' => 'preloadtitle',
+ 'class' => 'commentboxInput',
+ 'value' => $this->mDefaultText,
+ 'placeholder' => $this->mPlaceholderText,
+ 'size' => $this->mWidth,
+ 'dir' => $this->mDir,
+ )
+ );
+ $htmlOut .= Xml::openElement( 'input',
+ array(
+ 'type' => 'hidden',
+ 'name' => 'section',
+ 'value' => 'new',
+ )
+ );
+ $htmlOut .= Xml::openElement( 'input',
+ array(
+ 'type' => 'hidden',
+ 'name' => 'title',
+ 'value' => $this->mPage
+ )
+ );
+ $htmlOut .= $this->mBR;
+ $htmlOut .= Xml::openElement( 'input',
+ array(
+ 'type' => 'submit',
+ 'name' => 'create',
+ 'class' => 'commentboxButton',
+ 'value' => $this->mButtonLabel
+ )
+ );
+ $htmlOut .= Xml::closeElement( 'form' );
+ $htmlOut .= Xml::closeElement( 'div' );
+
+ // Return HTML
+ return $htmlOut;
+ }
+
+ /**
+ * Extract options from a blob of text
+ *
+ * @param string $text Tag contents
+ */
+ public function extractOptions( $text ) {
+ wfProfileIn( __METHOD__ );
+
+ // Parse all possible options
+ $values = array();
+ foreach ( explode( "\n", $text ) as $line ) {
+ if ( strpos( $line, '=' ) === false )
+ continue;
+ list( $name, $value ) = explode( '=', $line, 2 );
+ $values[ strtolower( trim( $name ) ) ] = Sanitizer::decodeCharReferences( trim( $value ) );
+ }
+
+ // Validate the dir value.
+ if ( isset( $values['dir'] ) && !in_array( $values['dir'], array( 'ltr', 'rtl' ) ) ) {
+ unset( $values['dir'] );
+ }
+
+ // Build list of options, with local member names
+ $options = array(
+ 'type' => 'mType',
+ 'width' => 'mWidth',
+ 'preload' => 'mPreload',
+ 'page' => 'mPage',
+ 'editintro' => 'mEditIntro',
+ 'summary' => 'mSummary',
+ 'nosummary' => 'mNosummary',
+ 'minor' => 'mMinor',
+ 'break' => 'mBR',
+ 'default' => 'mDefaultText',
+ 'placeholder' => 'mPlaceholderText',
+ 'bgcolor' => 'mBGColor',
+ 'buttonlabel' => 'mButtonLabel',
+ 'searchbuttonlabel' => 'mSearchButtonLabel',
+ 'fulltextbutton' => 'mFullTextButton',
+ 'namespaces' => 'mNamespaces',
+ 'labeltext' => 'mLabelText',
+ 'hidden' => 'mHidden',
+ 'id' => 'mID',
+ 'inline' => 'mInline',
+ 'prefix' => 'mPrefix',
+ 'dir' => 'mDir',
+ );
+ foreach ( $options as $name => $var ) {
+ if ( isset( $values[$name] ) ) {
+ $this->$var = $values[$name];
+ }
+ }
+
+ // Insert a line break if configured to do so
+ $this->mBR = ( strtolower( $this->mBR ) == "no" ) ? ' ' : '<br />';
+
+ // Validate the width; make sure it's a valid, positive integer
+ $this->mWidth = intval( $this->mWidth <= 0 ? 50 : $this->mWidth );
+
+ // Validate background color
+ if ( !$this->isValidColor( $this->mBGColor ) ) {
+ $this->mBGColor = 'transparent';
+ }
+ wfProfileOut( __METHOD__ );
+ }
+
+ /**
+ * Do a security check on the bgcolor parameter
+ */
+ public function isValidColor( $color ) {
+ $regex = <<<REGEX
+ /^ (
+ [a-zA-Z]* | # color names
+ \# [0-9a-f]{3} | # short hexadecimal
+ \# [0-9a-f]{6} | # long hexadecimal
+ rgb \s* \( \s* (
+ \d+ \s* , \s* \d+ \s* , \s* \d+ | # rgb integer
+ [0-9.]+% \s* , \s* [0-9.]+% \s* , \s* [0-9.]+% # rgb percent
+ ) \s* \)
+ ) $ /xi
+REGEX;
+ return (bool) preg_match( $regex, $color );
+ }
+}