r111285 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111284‎ | r111285 | r111286 >
Date:08:03, 12 February 2012
Author:wikinaut
Status:deferred
Tags:
Comment:
follow-up r111284 r111263 . wfEtherpadLiteStringFromTestedBoolean now returns stringified checked input or default boolean
Modified paths:
  • /trunk/extensions/EtherpadLite/EtherpadLite.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EtherpadLite/EtherpadLite.php
@@ -87,9 +87,11 @@
8888 $wgEtherpadLiteShowChat = true;
8989 $wgEtherpadLiteShowAuthorColors = true;
9090
91 -function wfEtherpadLiteTestAndReturnBoolean( $var, $default ) {
 91+
 92+function wfEtherpadLiteStringFromTestedBoolean( $var, $default ) {
9293 # http://www.php.net/manual/en/function.is-bool.php#104643
93 - return ( isset( $var ) ) ? filter_var( $var, FILTER_VALIDATE_BOOLEAN ) : $default;
 94+ $booleanVar = ( isset( $var ) ) ? filter_var( $var, FILTER_VALIDATE_BOOLEAN ) : $default;
 95+ return ( $booleanVar ) ? "true" : "false";
9496 }
9597
9698 function wfEtherpadLiteRender( $input, $args, $parser, $frame ) {
@@ -103,11 +105,11 @@
104106 $height = ( isset( $args['height'] ) ) ? $args['height'] : $wgEtherpadLiteDefaultHeight;
105107 $width = ( isset( $args['width'] ) ) ? $args['width'] : $wgEtherpadLiteDefaultWidth;
106108
107 - $useMonospaceFont = wfEtherpadLiteTestAndReturnBoolean( $args['monospaced-font'], $wgEtherpadLiteMonospacedFont );
108 - $showControls = wfEtherpadLiteTestAndReturnBoolean( $args['show-controls'], $wgEtherpadLiteShowControls ) ;
109 - $showLineNumbers = wfEtherpadLiteTestAndReturnBoolean( $args['show-linenumbers'], $wgEtherpadLiteShowLineNumbers );
110 - $showChat = wfEtherpadLiteTestAndReturnBoolean( $args['show-chat'], $wgEtherpadLiteShowChat );
111 - $noColors = ! ( wfEtherpadLiteTestAndReturnBoolean( $args['show-colors'], $wgEtherpadLiteShowAuthorColors ) );
 109+ $useMonospaceFont = wfEtherpadLiteStringFromTestedBoolean( $args['monospaced-font'], $wgEtherpadLiteMonospacedFont );
 110+ $showControls = wfEtherpadLiteStringFromTestedBoolean( $args['show-controls'], $wgEtherpadLiteShowControls ) ;
 111+ $showLineNumbers = wfEtherpadLiteStringFromTestedBoolean( $args['show-linenumbers'], $wgEtherpadLiteShowLineNumbers );
 112+ $showChat = wfEtherpadLiteStringFromTestedBoolean( $args['show-chat'], $wgEtherpadLiteShowChat );
 113+ $noColors = ! ( wfEtherpadLiteStringFromTestedBoolean( $args['show-colors'], $wgEtherpadLiteShowAuthorColors ) );
112114
113115 $epliteHostUrl = Sanitizer::cleanUrl (
114116 ( isset( $args['pad-url'] ) ) ? $args['pad-url'] : $wgEtherpadLiteDefaultPadUrl

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r111263initial import of new extension EtherpadLitewikinaut21:33, 11 February 2012
r111284first follow-up r111263 . fixing issue 1 &, 2 empty, 4 'true', 7 (same padid=...wikinaut07:42, 12 February 2012

Status & tagging log