summaryrefslogtreecommitdiff
path: root/includes/gallery
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 /includes/gallery
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 'includes/gallery')
-rw-r--r--includes/gallery/ImageGalleryBase.php331
-rw-r--r--includes/gallery/NolinesImageGallery.php38
-rw-r--r--includes/gallery/PackedImageGallery.php105
-rw-r--r--includes/gallery/PackedOverlayImageGallery.php60
-rw-r--r--includes/gallery/TraditionalImageGallery.php328
5 files changed, 862 insertions, 0 deletions
diff --git a/includes/gallery/ImageGalleryBase.php b/includes/gallery/ImageGalleryBase.php
new file mode 100644
index 00000000..f8b8c505
--- /dev/null
+++ b/includes/gallery/ImageGalleryBase.php
@@ -0,0 +1,331 @@
+<?php
+/**
+ * Image gallery.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * Image gallery
+ *
+ * Add images to the gallery using add(), then render that list to HTML using toHTML().
+ *
+ * @ingroup Media
+ */
+abstract class ImageGalleryBase extends ContextSource {
+ var $mImages, $mShowBytes, $mShowFilename, $mMode;
+ var $mCaption = false;
+
+ /**
+ * Hide blacklisted images?
+ */
+ var $mHideBadImages;
+
+ /**
+ * Registered parser object for output callbacks
+ * @var Parser
+ */
+ var $mParser;
+
+ /**
+ * Contextual title, used when images are being screened
+ * against the bad image list
+ */
+ protected $contextTitle = false;
+
+ protected $mAttribs = array();
+
+ static private $modeMapping = false;
+
+ /**
+ * Get a new image gallery. This is the method other callers
+ * should use to get a gallery.
+ *
+ * @param String|bool $mode Mode to use. False to use the default.
+ */
+ static function factory( $mode = false ) {
+ global $wgGalleryOptions, $wgContLang;
+ self::loadModes();
+ if ( !$mode ) {
+ $mode = $wgGalleryOptions['mode'];
+ }
+
+ $mode = $wgContLang->lc( $mode );
+
+ if ( isset( self::$modeMapping[$mode] ) ) {
+ return new self::$modeMapping[$mode]( $mode );
+ } else {
+ throw new MWException( "No gallery class registered for mode $mode" );
+ }
+ }
+
+ static private function loadModes() {
+ if ( self::$modeMapping === false ) {
+ self::$modeMapping = array(
+ 'traditional' => 'TraditionalImageGallery',
+ 'nolines' => 'NolinesImageGallery',
+ 'packed' => 'PackedImageGallery',
+ 'packed-hover' => 'PackedHoverImageGallery',
+ 'packed-overlay' => 'PackedOverlayImageGallery',
+ );
+ // Allow extensions to make a new gallery format.
+ wfRunHooks( 'GalleryGetModes', self::$modeMapping );
+ }
+ }
+
+ /**
+ * Create a new image gallery object.
+ *
+ * You should not call this directly, but instead use
+ * ImageGalleryBase::factory().
+ */
+ function __construct( $mode = 'traditional' ) {
+ global $wgGalleryOptions;
+ $this->mImages = array();
+ $this->mShowBytes = $wgGalleryOptions['showBytes'];
+ $this->mShowFilename = true;
+ $this->mParser = false;
+ $this->mHideBadImages = false;
+ $this->mPerRow = $wgGalleryOptions['imagesPerRow'];
+ $this->mWidths = $wgGalleryOptions['imageWidth'];
+ $this->mHeights = $wgGalleryOptions['imageHeight'];
+ $this->mCaptionLength = $wgGalleryOptions['captionLength'];
+ $this->mMode = $mode;
+ }
+
+ /**
+ * Register a parser object. If you do not set this
+ * and the output of this gallery ends up in parser
+ * cache, the javascript will break!
+ *
+ * @note This also triggers using the page's target
+ * language instead of the user language.
+ *
+ * @param $parser Parser
+ */
+ function setParser( $parser ) {
+ $this->mParser = $parser;
+ }
+
+ /**
+ * Set bad image flag
+ */
+ function setHideBadImages( $flag = true ) {
+ $this->mHideBadImages = $flag;
+ }
+
+ /**
+ * Set the caption (as plain text)
+ *
+ * @param string $caption Caption
+ */
+ function setCaption( $caption ) {
+ $this->mCaption = htmlspecialchars( $caption );
+ }
+
+ /**
+ * Set the caption (as HTML)
+ *
+ * @param string $caption Caption
+ */
+ public function setCaptionHtml( $caption ) {
+ $this->mCaption = $caption;
+ }
+
+ /**
+ * Set how many images will be displayed per row.
+ *
+ * @param $num Integer >= 0; If perrow=0 the gallery layout will adapt to screensize
+ * invalid numbers will be rejected
+ */
+ public function setPerRow( $num ) {
+ if ( $num >= 0 ) {
+ $this->mPerRow = (int)$num;
+ }
+ }
+
+ /**
+ * Set how wide each image will be, in pixels.
+ *
+ * @param $num Integer > 0; invalid numbers will be ignored
+ */
+ public function setWidths( $num ) {
+ if ( $num > 0 ) {
+ $this->mWidths = (int)$num;
+ }
+ }
+
+ /**
+ * Set how high each image will be, in pixels.
+ *
+ * @param $num Integer > 0; invalid numbers will be ignored
+ */
+ public function setHeights( $num ) {
+ if ( $num > 0 ) {
+ $this->mHeights = (int)$num;
+ }
+ }
+
+ /**
+ * Allow setting additional options. This is meant
+ * to allow extensions to add additional parameters to
+ * <gallery> parser tag.
+ *
+ * @param Array $options Attributes of gallery tag.
+ */
+ public function setAdditionalOptions( $options ) { }
+
+ /**
+ * Instruct the class to use a specific skin for rendering
+ *
+ * @param $skin Skin object
+ * @deprecated since 1.18 Not used anymore
+ */
+ function useSkin( $skin ) {
+ wfDeprecated( __METHOD__, '1.18' );
+ /* no op */
+ }
+
+ /**
+ * Add an image to the gallery.
+ *
+ * @param $title Title object of the image that is added to the gallery
+ * @param $html String: Additional HTML text to be shown. The name and size of the image are always shown.
+ * @param $alt String: Alt text for the image
+ * @param $link String: Override image link (optional)
+ * @param $handlerOpts Array: Array of options for image handler (aka page number)
+ */
+ function add( $title, $html = '', $alt = '', $link = '', $handlerOpts = array() ) {
+ if ( $title instanceof File ) {
+ // Old calling convention
+ $title = $title->getTitle();
+ }
+ $this->mImages[] = array( $title, $html, $alt, $link, $handlerOpts );
+ wfDebug( 'ImageGallery::add ' . $title->getText() . "\n" );
+ }
+
+ /**
+ * Add an image at the beginning of the gallery.
+ *
+ * @param $title Title object of the image that is added to the gallery
+ * @param $html String: Additional HTML text to be shown. The name and size of the image are always shown.
+ * @param $alt String: Alt text for the image
+ * @param $link String: Override image link (optional)
+ * @param $handlerOpts Array: Array of options for image handler (aka page number)
+ */
+ function insert( $title, $html = '', $alt = '', $link = '', $handlerOpts = array() ) {
+ if ( $title instanceof File ) {
+ // Old calling convention
+ $title = $title->getTitle();
+ }
+ array_unshift( $this->mImages, array( &$title, $html, $alt, $link, $handlerOpts ) );
+ }
+
+ /**
+ * isEmpty() returns true if the gallery contains no images
+ * @return bool
+ */
+ function isEmpty() {
+ return empty( $this->mImages );
+ }
+
+ /**
+ * Enable/Disable showing of the file size of an image in the gallery.
+ * Enabled by default.
+ *
+ * @param $f Boolean: set to false to disable.
+ */
+ function setShowBytes( $f ) {
+ $this->mShowBytes = (bool)$f;
+ }
+
+ /**
+ * Enable/Disable showing of the filename of an image in the gallery.
+ * Enabled by default.
+ *
+ * @param $f Boolean: set to false to disable.
+ */
+ function setShowFilename( $f ) {
+ $this->mShowFilename = (bool)$f;
+ }
+
+ /**
+ * Set arbitrary attributes to go on the HTML gallery output element.
+ * Should be suitable for a <ul> element.
+ *
+ * Note -- if taking from user input, you should probably run through
+ * Sanitizer::validateAttributes() first.
+ *
+ * @param array $attribs of HTML attribute pairs
+ */
+ function setAttributes( $attribs ) {
+ $this->mAttribs = $attribs;
+ }
+
+ /**
+ * Display an html representation of the gallery
+ *
+ * @return String The html
+ */
+ abstract public function toHTML();
+
+ /**
+ * @return Integer: number of images in the gallery
+ */
+ public function count() {
+ return count( $this->mImages );
+ }
+
+ /**
+ * Set the contextual title
+ *
+ * @param $title Title: contextual title
+ */
+ public function setContextTitle( $title ) {
+ $this->contextTitle = $title;
+ }
+
+ /**
+ * Get the contextual title, if applicable
+ *
+ * @return mixed Title or false
+ */
+ public function getContextTitle() {
+ return is_object( $this->contextTitle ) && $this->contextTitle instanceof Title
+ ? $this->contextTitle
+ : false;
+ }
+
+ /**
+ * Determines the correct language to be used for this image gallery
+ * @return Language object
+ */
+ protected function getRenderLang() {
+ return $this->mParser
+ ? $this->mParser->getTargetLanguage()
+ : $this->getLanguage();
+ }
+
+ /* Old constants no longer used.
+ const THUMB_PADDING = 30;
+ const GB_PADDING = 5;
+ const GB_BORDERS = 8;
+ */
+
+}
+
diff --git a/includes/gallery/NolinesImageGallery.php b/includes/gallery/NolinesImageGallery.php
new file mode 100644
index 00000000..6b0d0fa6
--- /dev/null
+++ b/includes/gallery/NolinesImageGallery.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Nolines image gallery. Like "traditional" but without borders and
+ * less padding.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+class NolinesImageGallery extends TraditionalImageGallery {
+
+ protected function getThumbPadding() {
+ return 0;
+ }
+
+ protected function getGBBorders() {
+ // This accounts for extra space between <li> elements.
+ return 4;
+ }
+
+ protected function getVPad( $boxHeight, $thumbHeight ) {
+ return 0;
+ }
+}
diff --git a/includes/gallery/PackedImageGallery.php b/includes/gallery/PackedImageGallery.php
new file mode 100644
index 00000000..963ee6b9
--- /dev/null
+++ b/includes/gallery/PackedImageGallery.php
@@ -0,0 +1,105 @@
+<?php
+/**
+ * Packed image gallery. All images adjusted to be same height.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+class PackedImageGallery extends TraditionalImageGallery {
+
+ function __construct( $mode = 'traditional' ) {
+ parent::__construct( $mode );
+ // Does not support per row option.
+ $this->mPerRow = 0;
+ }
+
+ /**
+ * We artificially have 1.5 the resolution neccessary so that
+ * we can scale it up by that much on the client side, without
+ * worrying about requesting a new image.
+ */
+ const SCALE_FACTOR = 1.5;
+
+ protected function getVPad( $boxHeight, $thumbHeight ) {
+ return ( $this->getThumbPadding() + $boxHeight - $thumbHeight / self::SCALE_FACTOR ) / 2;
+ }
+
+ protected function getThumbPadding() {
+ return 0;
+ }
+
+ protected function getGBPadding() {
+ return 2;
+ }
+
+ /**
+ * @param File $img The file being transformed. May be false
+ */
+ protected function getThumbParams( $img ) {
+ if ( $img && $img->getMediaType() === MEDIATYPE_AUDIO ) {
+ $width = $this->mWidths;
+ } else {
+ // We want the width not to be the constraining
+ // factor, so use random big number.
+ $width = $this->mHeights * 10 + 100;
+ }
+ // self::SCALE_FACTOR so the js has some room to manipulate sizes.
+ return array(
+ 'width' => $width * self::SCALE_FACTOR,
+ 'height' => $this->mHeights * self::SCALE_FACTOR,
+ );
+ }
+
+ protected function getThumbDivWidth( $thumbWidth ) {
+ // Require at least 60px wide, so caption is wide enough to work.
+ if ( $thumbWidth < 60 * self::SCALE_FACTOR ) {
+ $thumbWidth = 60 * self::SCALE_FACTOR;
+ }
+ return $thumbWidth / self::SCALE_FACTOR + $this->getThumbPadding();
+ }
+
+ /**
+ * @param MediaTransformOutput|bool $thumb the thumbnail, or false if no thumb (which can happen)
+ */
+ protected function getGBWidth( $thumb ) {
+ $thumbWidth = $thumb ? $thumb->getWidth() : $this->mWidths * self::SCALE_FACTOR;
+ return $this->getThumbDivWidth( $thumbWidth ) + $this->getGBPadding();
+ }
+
+ protected function adjustImageParameters( $thumb, &$imageParameters ) {
+ // Re-adjust back to normal size.
+ $imageParameters['override-width'] = ceil( $thumb->getWidth() / self::SCALE_FACTOR );
+ $imageParameters['override-height'] = ceil( $thumb->getHeight() / self::SCALE_FACTOR );
+ }
+
+ /**
+ * Add javascript which auto-justifies the rows by manipulating the image sizes.
+ * Also ensures that the hover version of this degrades gracefully.
+ */
+ protected function getModules() {
+ return array( 'mediawiki.page.gallery' );
+ }
+
+ /**
+ * Do not support per-row on packed. It really doesn't work
+ * since the images have varying widths.
+ */
+ public function setPerRow( $num ) {
+ return;
+ }
+}
diff --git a/includes/gallery/PackedOverlayImageGallery.php b/includes/gallery/PackedOverlayImageGallery.php
new file mode 100644
index 00000000..bba06fcf
--- /dev/null
+++ b/includes/gallery/PackedOverlayImageGallery.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * Packed overlay image gallery. All images adjusted to be same height and
+ * image caption being placed over top of image.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+class PackedOverlayImageGallery extends PackedImageGallery {
+
+ /**
+ * Add the wrapper html around the thumb's caption
+ *
+ * @param String $galleryText The caption
+ * @param MediaTransformOutput|boolean $thumb The thumb this caption is for or false for bad image.
+ */
+ protected function wrapGalleryText( $galleryText, $thumb ) {
+
+ // If we have no text, do not output anything to avoid
+ // ugly white overlay.
+ if ( trim( $galleryText ) === '' ) {
+ return '';
+ }
+
+ # ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which
+ # in version 4.8.6 generated crackpot html in its absence, see:
+ # http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar
+
+ $thumbWidth = $this->getGBWidth( $thumb ) - $this->getThumbPadding() - $this->getGBPadding();
+ $captionWidth = ceil( $thumbWidth - 20 );
+
+ $outerWrapper = '<div class="gallerytextwrapper" style="width: ' . $captionWidth . 'px">';
+ return "\n\t\t\t" . $outerWrapper . '<div class="gallerytext">' . "\n"
+ . $galleryText
+ . "\n\t\t\t</div>";
+ }
+}
+
+/**
+ * Same as Packed except different CSS is applied to make the
+ * caption only show up on hover. If a touch screen is detected,
+ * falls back to PackedHoverGallery. Degrades gracefully for
+ * screen readers.
+ */
+class PackedHoverImageGallery extends PackedOverlayImageGallery { }
diff --git a/includes/gallery/TraditionalImageGallery.php b/includes/gallery/TraditionalImageGallery.php
new file mode 100644
index 00000000..1f60fa69
--- /dev/null
+++ b/includes/gallery/TraditionalImageGallery.php
@@ -0,0 +1,328 @@
+<?php
+/**
+ * Image gallery.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+class TraditionalImageGallery extends ImageGalleryBase {
+
+
+ /**
+ * Return a HTML representation of the image gallery
+ *
+ * For each image in the gallery, display
+ * - a thumbnail
+ * - the image name
+ * - the additional text provided when adding the image
+ * - the size of the image
+ *
+ * @return string
+ */
+ function toHTML() {
+ if ( $this->mPerRow > 0 ) {
+ $maxwidth = $this->mPerRow * ( $this->mWidths + $this->getAllPadding() );
+ $oldStyle = isset( $this->mAttribs['style'] ) ? $this->mAttribs['style'] : '';
+ # _width is ignored by any sane browser. IE6 doesn't know max-width so it uses _width instead
+ $this->mAttribs['style'] = "max-width: {$maxwidth}px;_width: {$maxwidth}px;" . $oldStyle;
+ }
+
+ $attribs = Sanitizer::mergeAttributes(
+ array( 'class' => 'gallery mw-gallery-' . $this->mMode ), $this->mAttribs );
+
+ $modules = $this->getModules();
+
+ if ( $this->mParser ) {
+ $this->mParser->getOutput()->addModules( $modules );
+ } else {
+ $this->getOutput()->addModules( $modules );
+ }
+ $output = Xml::openElement( 'ul', $attribs );
+ if ( $this->mCaption ) {
+ $output .= "\n\t<li class='gallerycaption'>{$this->mCaption}</li>";
+ }
+
+ $lang = $this->getRenderLang();
+ # Output each image...
+ foreach ( $this->mImages as $pair ) {
+ $nt = $pair[0];
+ $text = $pair[1]; # "text" means "caption" here
+ $alt = $pair[2];
+ $link = $pair[3];
+
+ $descQuery = false;
+ if ( $nt->getNamespace() === NS_FILE ) {
+ # Get the file...
+ if ( $this->mParser instanceof Parser ) {
+ # Give extensions a chance to select the file revision for us
+ $options = array();
+ wfRunHooks( 'BeforeParserFetchFileAndTitle',
+ array( $this->mParser, $nt, &$options, &$descQuery ) );
+ # Fetch and register the file (file title may be different via hooks)
+ list( $img, $nt ) = $this->mParser->fetchFileAndTitle( $nt, $options );
+ } else {
+ $img = wfFindFile( $nt );
+ }
+ } else {
+ $img = false;
+ }
+
+ $params = $this->getThumbParams( $img );
+ // $pair[4] is per image handler options
+ $transformOptions = $params + $pair[4];
+
+ $thumb = false;
+
+ if ( !$img ) {
+ # We're dealing with a non-image, spit out the name and be done with it.
+ $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: ' . ( $this->getThumbPadding() + $this->mHeights ) . 'px;">'
+ . htmlspecialchars( $nt->getText() ) . '</div>';
+
+ if ( $this->mParser instanceof Parser ) {
+ $this->mParser->addTrackingCategory( 'broken-file-category' );
+ }
+ } elseif ( $this->mHideBadImages && wfIsBadImage( $nt->getDBkey(), $this->getContextTitle() ) ) {
+ # The image is blacklisted, just show it as a text link.
+ $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: ' . ( $this->getThumbPadding() + $this->mHeights ) . 'px;">' .
+ Linker::link(
+ $nt,
+ htmlspecialchars( $nt->getText() ),
+ array(),
+ array(),
+ array( 'known', 'noclasses' )
+ ) .
+ '</div>';
+ } elseif ( !( $thumb = $img->transform( $transformOptions ) ) ) {
+ # Error generating thumbnail.
+ $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: ' . ( $this->getThumbPadding() + $this->mHeights ) . 'px;">'
+ . htmlspecialchars( $img->getLastError() ) . '</div>';
+ } else {
+ $vpad = $this->getVPad( $this->mHeights, $thumb->getHeight() );
+
+ $imageParameters = array(
+ 'desc-link' => true,
+ 'desc-query' => $descQuery,
+ 'alt' => $alt,
+ 'custom-url-link' => $link
+ );
+ # In the absence of both alt text and caption, fall back on providing screen readers with the filename as alt text
+ if ( $alt == '' && $text == '' ) {
+ $imageParameters['alt'] = $nt->getText();
+ }
+
+ $this->adjustImageParameters( $thumb, $imageParameters );
+
+ # Set both fixed width and min-height.
+ $thumbhtml = "\n\t\t\t" .
+ '<div class="thumb" style="width: ' . $this->getThumbDivWidth( $thumb->getWidth() ) . 'px;">'
+ # Auto-margin centering for block-level elements. Needed now that we have video
+ # handlers since they may emit block-level elements as opposed to simple <img> tags.
+ # ref http://css-discuss.incutio.com/?page=CenteringBlockElement
+ . '<div style="margin:' . $vpad . 'px auto;">'
+ . $thumb->toHtml( $imageParameters ) . '</div></div>';
+
+ // Call parser transform hook
+ if ( $this->mParser && $img->getHandler() ) {
+ $img->getHandler()->parserTransformHook( $this->mParser, $img );
+ }
+ }
+
+ //TODO
+ // $linkTarget = Title::newFromText( $wgContLang->getNsText( MWNamespace::getUser() ) . ":{$ut}" );
+ // $ul = Linker::link( $linkTarget, $ut );
+
+ if ( $this->mShowBytes ) {
+ if ( $img ) {
+ $fileSize = htmlspecialchars( $lang->formatSize( $img->getSize() ) );
+ } else {
+ $fileSize = $this->msg( 'filemissing' )->escaped();
+ }
+ $fileSize = "$fileSize<br />\n";
+ } else {
+ $fileSize = '';
+ }
+
+ $textlink = $this->mShowFilename ?
+ Linker::link(
+ $nt,
+ htmlspecialchars( $lang->truncate( $nt->getText(), $this->mCaptionLength ) ),
+ array(),
+ array(),
+ array( 'known', 'noclasses' )
+ ) . "<br />\n" :
+ '';
+
+
+ $galleryText = $textlink . $text . $fileSize;
+ $galleryText = $this->wrapGalleryText( $galleryText, $thumb );
+
+ # Weird double wrapping (the extra div inside the li) needed due to FF2 bug
+ # Can be safely removed if FF2 falls completely out of existence
+ $output .=
+ "\n\t\t" . '<li class="gallerybox" style="width: ' . $this->getGBWidth( $thumb ) . 'px">'
+ . '<div style="width: ' . $this->getGBWidth( $thumb ) . 'px">'
+ . $thumbhtml
+ . $galleryText
+ . "\n\t\t</div></li>";
+ }
+ $output .= "\n</ul>";
+
+ return $output;
+ }
+
+
+ /**
+ * Add the wrapper html around the thumb's caption
+ *
+ * @param String $galleryText The caption
+ * @param MediaTransformOutput|boolean $thumb The thumb this caption is for or false for bad image.
+ */
+ protected function wrapGalleryText( $galleryText, $thumb ) {
+ # ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which
+ # in version 4.8.6 generated crackpot html in its absence, see:
+ # http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar
+
+ return "\n\t\t\t" . '<div class="gallerytext">' . "\n"
+ . $galleryText
+ . "\n\t\t\t</div>";
+ }
+
+ /**
+ * How much padding such the thumb have between image and inner div that
+ * that contains the border. This is both for verical and horizontal
+ * padding. (However, it is cut in half in the vertical direction).
+ * @return int
+ */
+ protected function getThumbPadding() {
+ return 30;
+ }
+
+ /**
+ *
+ * @note GB stands for gallerybox (as in the <li class="gallerybox"> element)
+ *
+ * @return int
+ */
+ protected function getGBPadding() {
+ return 5;
+ }
+
+ /**
+ * Get how much extra space the borders around the image takes up.
+ *
+ * For this mode, it is 2px borders on each side + 2px implied padding on
+ * each side from the stylesheet, giving us 2*2+2*2 = 8.
+ * @return int
+ */
+ protected function getGBBorders() {
+ return 8;
+ }
+
+ /**
+ * Get total padding.
+ *
+ * @return int How many pixels of whitespace surround the thumbnail.
+ */
+ protected function getAllPadding() {
+ return $this->getThumbPadding() + $this->getGBPadding() + $this->getGBBorders();
+ }
+
+ /**
+ * Get vertical padding for a thumbnail
+ *
+ * Generally this is the total height minus how high the thumb is.
+ *
+ * @param int $boxHeight How high we want the box to be.
+ * @param int $thumbHeight How high the thumbnail is.
+ * @return int How many vertical padding to add on each side.
+ */
+ protected function getVPad( $boxHeight, $thumbHeight ) {
+ return ( $this->getThumbPadding() + $boxHeight - $thumbHeight ) / 2;
+ }
+
+ /**
+ * Get the transform parameters for a thumbnail.
+ *
+ * @param File $img The file in question. May be false for invalid image
+ */
+ protected function getThumbParams( $img ) {
+ return array(
+ 'width' => $this->mWidths,
+ 'height' => $this->mHeights
+ );
+ }
+
+ /**
+ * Get the width of the inner div that contains the thumbnail in
+ * question. This is the div with the class of "thumb".
+ *
+ * @param int $thumbWidth The width of the thumbnail.
+ * @return int Width of inner thumb div.
+ */
+ protected function getThumbDivWidth( $thumbWidth ) {
+ return $this->mWidths + $this->getThumbPadding();
+ }
+
+ /**
+ * Width of gallerybox <li>.
+ *
+ * Generally is the width of the image, plus padding on image
+ * plus padding on gallerybox.
+ *
+ * @note Important: parameter will be false if no thumb used.
+ * @param Mixed $thumb MediaTransformObject object or false.
+ * @return int width of gallerybox element
+ */
+ protected function getGBWidth( $thumb ) {
+ return $this->mWidths + $this->getThumbPadding() + $this->getGBPadding();
+ }
+
+ /**
+ * Get a list of modules to include in the page.
+ *
+ * Primarily intended for subclasses.
+ *
+ * @return Array modules to include
+ */
+ protected function getModules() {
+ return array();
+ }
+
+ /**
+ * Adjust the image parameters for a thumbnail.
+ *
+ * Used by a subclass to insert extra high resolution images.
+ * @param MediaTransformOutput $thumb The thumbnail
+ * @param Array $imageParameters Array of options
+ */
+ protected function adjustImageParameters( $thumb, &$imageParameters ) { }
+}
+
+/**
+ * Backwards compatibility. This always uses traditional mode
+ * if called the old way, for extensions that may expect traditional
+ * mode.
+ *
+ * @deprecated 1.22 Use ImageGalleryBase::factory instead.
+ */
+class ImageGallery extends TraditionalImageGallery {
+ function __construct( $mode = 'traditional' ) {
+ wfDeprecated( __METHOD__, '1.22' );
+ parent::__construct( $mode );
+ }
+}