r112369 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112368‎ | r112369 | r112370 >
Date:23:14, 24 February 2012
Author:krinkle
Status:ok
Tags:
Comment:
[JSTesting] actually commit the file (follows-up r112368)
Modified paths:
  • /trunk/phase3/tests/qunit/data/styleTest.css.php (added) (history)

Diff [purge]

Index: trunk/phase3/tests/qunit/data/styleTest.css.php
@@ -0,0 +1,56 @@
 2+<?php
 3+/**
 4+ * Dynamically create a simple stylesheet for unit tests in MediaWiki.
 5+ *
 6+ * This program is free software; you can redistribute it and/or modify
 7+ * it under the terms of the GNU General Public License as published by
 8+ * the Free Software Foundation; either version 2 of the License, or
 9+ * (at your option) any later version.
 10+ *
 11+ * This program is distributed in the hope that it will be useful,
 12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 14+ * GNU General Public License for more details.
 15+ *
 16+ * You should have received a copy of the GNU General Public License along
 17+ * with this program; if not, write to the Free Software Foundation, Inc.,
 18+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 19+ * http://www.gnu.org/copyleft/gpl.html
 20+ *
 21+ * @file
 22+ * @package MediaWiki
 23+ * @author Timo Tijhof
 24+ * @since 1.20
 25+ */
 26+header( 'Content-Type: text/css; charset=utf-8' );
 27+
 28+/**
 29+ * Allows characters in ranges [a-z], [A-Z], [0-9] as well as a dot ("."), dash ("-") and hash ("#").
 30+ * @since 1.20
 31+ *
 32+ * @param $val string
 33+ * @return string: input with illigal characters removed
 34+ */
 35+function cssfilter( $val ) {
 36+ return preg_replace( '/[^A-Za-z0-9\.\-#]/', '', $val );
 37+}
 38+
 39+// Do basic sanitization
 40+$params = array_map( 'cssfilter', $_GET );
 41+
 42+// Defaults
 43+$selector = isset( $params['selector'] ) ? $params['selector'] : '.mw-test-example';
 44+$property = isset( $params['prop'] ) ? $params['prop'] : 'float';
 45+$value = isset( $params['val'] ) ? $params['val'] : 'right';
 46+
 47+$css = "
 48+/**
 49+ * Generated: " . gmdate( 'r' ) . "
 50+ */
 51+
 52+$selector {
 53+ $property: $value;
 54+}
 55+";
 56+
 57+echo trim( $css ) . "\n";
Property changes on: trunk/phase3/tests/qunit/data/styleTest.css.php
___________________________________________________________________
Added: svn:eol-style
158 + native

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r112368[JSTesting] Add more mw.loader tests...krinkle23:13, 24 February 2012

Status & tagging log