r106368 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106367‎ | r106368 | r106369 >
Date:21:07, 15 December 2011
Author:danwe
Status:ok
Tags:
Comment:
Version increased to 0.5.3.
With parameter 'linked' set, wfEscapeWikiText() won't be used to escape sitenames within links since this could break a link.
Modified paths:
  • /trunk/extensions/SubpageFun/RELEASE-NOTES (modified) (history)
  • /trunk/extensions/SubpageFun/SubpageFun.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SubpageFun/SubpageFun.php
@@ -8,7 +8,7 @@
99 * Support: http://www.mediawiki.org/wiki/Extension_talk:Subpage_Fun
1010 * Source code: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SubpageFun
1111 *
12 - * @version: 0.5.2
 12+ * @version: 0.5.3
1313 * @license: ISC license
1414 * @author: Daniel Werner < danweetz@web.de >
1515 *
@@ -49,7 +49,7 @@
5050
5151 class ExtSubpageFun {
5252
53 - const VERSION = '0.5.2';
 53+ const VERSION = '0.5.3';
5454
5555 const MAG_SUBPAGETITLE = 'subpagetitle';
5656 const MAG_SUBPAGES = 'subpages';
@@ -92,7 +92,7 @@
9393
9494 /**
9595 * Helper function for seperating n arguments of a MW parser function
96 - * @return Array
 96+ * @return array
9797 */
9898 private static function getFunctionArgsArray( $args )
9999 {
@@ -149,21 +149,20 @@
150150 * Create a list with page titles as final output of a SubpageFun function.
151151 * The output ist un-parsed wiki markup, no HTML.
152152 *
153 - * @param $pages Array the pages
154 - * @param $link Boolean whether or not to link the pages in the list
155 - * @param $sep String glue between the pages
 153+ * @param array $pages array of Title elements
 154+ * @param bool $link whether or not to link the pages in the list
 155+ * @param string $sep glue between the pages
156156 *
157 - * @return String
 157+ * @return string
158158 */
159 - private static function createSiteList( $pages, $link = false, $sep = ', ' ) {
160 - //if( $pages === null )
161 - // return '';
 159+ protected static function createSiteList( $pages, $link = false, $sep = ', ' ) {
162160 $out = array();
163 - foreach( $pages as $page ) {
164 - $text = wfEscapeWikiText( $page->getPrefixedText() );
 161+ foreach( $pages as $page ) {
 162+ $text = $page->getPrefixedText();
165163 if( $link ) {
166164 $out[] = "[[:{$text}]]";
167165 } else {
 166+ $text = wfEscapeWikiText( $text );
168167 $out[] = $text;
169168 }
170169 }
@@ -174,11 +173,12 @@
175174 * Filters a list of title elements by a word or a regular expression.
176175 * The titles name without prefix is taken for comparision.
177176 *
178 - * @param array $list
 177+ * @param array $list
179178 * @param string $filter
 179+ *
180180 * @return array
181181 */
182 - private static function filterSiteList( array $list, $filter = null ) {
 182+ protected static function filterSiteList( array $list, $filter = null ) {
183183 // return all if no filter set:
184184 if( $filter === null ) {
185185 return $list;
@@ -211,7 +211,7 @@
212212 *
213213 * @return boolean
214214 */
215 - private static function isValidRegEx( $pattern ) {
 215+ public static function isValidRegEx( $pattern ) {
216216 // validate first for allowd delimiters '/%|' and flags
217217 if( ! preg_match( '/^([\\/\\|%]).*\\1[imsSuUx]*$/', $pattern ) ) {
218218 return false;
@@ -228,9 +228,10 @@
229229 * a number, including negative value, is given
230230 *
231231 * @param $depth Mixed
 232+ *
232233 * @return Mixed null or integer
233234 */
234 - private static function valDepth( $depth ) {
 235+ protected static function valDepth( $depth ) {
235236 if( $depth === null || $depth === false || trim( $depth ) === '' ) {
236237 return null;
237238 }
Index: trunk/extensions/SubpageFun/RELEASE-NOTES
@@ -1,13 +1,16 @@
22 'Supage Fun' Changelog:
33 =======================
44
5 -* December 2, 2011 - Version 0.5.2:
 5+* (trunk) -- Version 0.5.3:
 6+ - With parameter 'linked' set, wfEscapeWikiText() won't be used to escape sitenames within links since this could break a link.
 7+
 8+* December 2, 2011 -- Version 0.5.2:
69 - Support for 'Parser Fun' extensions 'THIS' function added. With 'Parser Fun' enabled it now is possible to call
710 '{{THIS:SUBPAGETITLE}}' which will output the subpage title of the template or page where the phrase is defined on, not the
811 page which is actually being rendered by the parser as '{{SUBPAGETITLE}}' would output it.
912 - Parser function functions within 'ExtSubpageFun' class now have a 'pf_' prefix.
1013
11 -* November 8, 2011 - Version 0.5.1:
 14+* November 8, 2011 -- Version 0.5.1:
1215 - All functions/variables returning page names in any way are using 'wfEscapeWikiText()' now like other variables like 'PAGENAME'
1316 for example.
1417 - 'filter' parameter can be used for 'NUMBEROFSUBPAGES'.

Status & tagging log