Remove old cruft from test folder. Change "polluted" test suite loader to use CDN...
[jquery.git] / test / polluted.php
1 <?php
2         $baseURL = "http://ajax.googleapis.com/ajax/libs/";
3         $libraries = array(
4                 "Dojo" => array(
5                         "versions" => array( "1.1.1", "1.2.0", "1.2.3", "1.3.0", "1.3.1", "1.3.2", "1.4.0", "1.4.1", "1.4.3", "1.5.0" ),
6                         "url" => "dojo/XYZ/dojo/dojo.xd.js"
7                 ),
8                 "Ext Core" => array(
9                         "versions" => array( "3.0.0", "3.1.0" ),
10                         "url" => "ext-core/XYZ/ext-core.js"
11                 ),
12                 "jQuery" => array(
13                         "versions" => array( "1.2.3", "1.2.6", "1.3.0", "1.3.1", "1.3.2", "1.4.0", "1.4.1", "1.4.2", "1.4.3", "1.4.4", "1.5.0" ),
14                         "url" => "jquery/XYZ/jquery.min.js"
15                 ),
16                 "jQuery UI" => array(
17                         "versions" => array( "1.5.2", "1.5.3", "1.6.0", "1.7.0", "1.7.1", "1.7.2", "1.7.3", "1.8.0", "1.8.1", "1.8.2", "1.8.4", "1.8.5", "1.8.6", "1.8.7", "1.8.8", "1.8.9" ),
18                         "url" => "jqueryui/XYZ/jquery-ui.min.js"
19                 ),
20                 "MooTools" => array(
21                         "versions" => array( "1.1.1", "1.1.2", "1.2.1", "1.2.2", "1.2.3", "1.2.4", "1.2.5", "1.3.0" ),
22                         "url" => "mootools/XYZ/mootools-yui-compressed.js"
23                 ),
24                 "Prototype" => array(
25                         "versions" => array( "1.6.0.2", "1.6.0.3", "1.6.1.0", "1.7.0.0" ),
26                         "url" => "prototype/XYZ/prototype.js"
27                 ),
28                 "script.aculo.us" => array(
29                         "versions" => array( "1.8.1", "1.8.2", "1.8.3" ),
30                         "url" => "scriptaculous/XYZ/scriptaculous.js"
31                 ),
32                 "SWFObject" => array(
33                         "versions" => array( "2.1", "2.2" ),
34                         "url" => "swfobject/XYZ/swfobject.js"
35                 ),
36                 "YUI" => array(
37                         "versions" => array( "2.6.0", "2.7.0", "2.8.0r4", "2.8.1", "2.8.2", "3.3.0" ),
38                         "url" =>    "yui/XYZ/build/yui/yui-min.js"
39                 )
40         );
41
42         if( count($_POST) ) {
43                 $includes = array();
44                 foreach( $_POST as $name => $ver ){
45                         $url = $libraries[ $name ][ "url" ];
46                         if( $name == "YUI" && $ver[0] == "2" ) {
47                                 $url = str_replace( "/yui", "/yuiloader", $url, $count = 2 );
48                         }
49                         $include = "<script src='$baseURL".str_replace("XYZ", $ver, $url, $count = 1)."'></script>\n";
50                         if( $lib == "prototype" ) { // prototype must be included first
51                                 array_unshift( $includes, $include );
52                         } else {
53                                 array_push( $includes, $include );
54                         }
55                 }
56
57                 $includes = implode( "\n", $includes );
58                 $suite = file_get_contents( "index.html" );
59                 echo str_replace( "<!-- Includes -->", $includes, $suite );
60                 exit;
61         }
62 ?>
63 <!DOCTYPE html>
64 <html>
65 <head>
66   <meta http-equiv="content-type" content="text/html; charset=UTF-8">
67         <title>Run jQuery Test Suite Polluted</title>
68         <style type="text/css">
69                 .otherlibs fieldset {
70                         width: 400px
71                 }
72                 .otherlibs label{
73                         margin: 5px 0px 5px 20px;
74                 }
75         </style>
76 </head>
77
78 <body id="body">
79         <h1 id="header">jQuery Test Suite</h1>
80         <h2 id="banner" class="fail"></h2>
81         <h2 id="userAgent">Choose other libraries to include</h2>
82
83         <form class="otherlibs" action="./polluted.php" method="POST">
84                 <?php
85                         foreach( $libraries as $name => $data ) {
86                                 echo "<fieldset><legend>$name</legend>";
87                                 $i = 0;
88                                 foreach( $data[ "versions" ] as $ver ) {
89                                         $i++;
90                                         echo "<label><input type='radio' name='$name' value='$ver' />$ver</label>";
91                                         if( !($i % 4) ) echo "<br />";
92                                 }
93                                 echo "</fieldset>";
94                         }
95                 ?>
96                 <input type="submit" value=" Run " class="submit" />
97         </form>
98 </body>
99 </html>