@@ -66,6 +66,20 @@ public static function init() {
6666 add_action ( 'init ' , array ( self ::instance (), 'create_job_queue ' ) );
6767 }
6868
69+ /**
70+ * Return an array of available PHP versions to test.
71+ */
72+ function get_phpversions () {
73+
74+ return apply_filters ( 'phpcompat_phpversions ' , array (
75+ 'PHP 7.0 ' => '7.0 ' ,
76+ 'PHP 5.6 ' => '5.6 ' ,
77+ 'PHP 5.5 ' => '5.5 ' ,
78+ 'PHP 5.4 ' => '5.4 ' ,
79+ 'PHP 5.3 ' => '5.3 ' ,
80+ ));
81+ }
82+
6983 /**
7084 * Start the test!
7185 *
@@ -250,6 +264,8 @@ function settings_page() {
250264 $ test_version = get_option ( 'wpephpcompat.test_version ' );
251265 $ only_active = get_option ( 'wpephpcompat.only_active ' );
252266
267+ $ phpversions = $ this ->get_phpversions ();
268+
253269 // Assigns defaults for the scan if none are found in the database.
254270 $ test_version = ( false !== $ test_version ) ? $ test_version : '7.0 ' ;
255271 $ only_active = ( false !== $ only_active ) ? $ only_active : 'yes ' ;
@@ -277,11 +293,11 @@ function settings_page() {
277293 <tr>
278294 <th scope="row"><label for="phptest_version"><?php esc_attr_e ( 'PHP Version ' , 'php-compatibility-checker ' ); ?> </label></th>
279295 <td>
280- <label><input type="radio" name="phptest_version" value="7.0" < ?php checked ( $ test_version , ' 7.0 ' , true ); ?> > PHP 7.0</label><br>
281- <label><input type="radio" name="phptest_version" value="5.6" <?php checked ( $ test_version , ' 5.6 ' , true ); ?> > PHP 5.6</label><br>
282- <label><input type="radio" name="phptest_version" value="5.5" <?php checked ( $ test_version , ' 5.5 ' , true ); ?> > PHP 5.5</label><br>
283- <label><input type="radio" name="phptest_version" value="5.4" <?php checked ( $ test_version , ' 5.4 ' , true ); ?> > PHP 5.4</label><br>
284- <label><input type="radio" name="phptest_version" value="5.3" <?php checked ( $ test_version , ' 5.3 ' , true ); ?> > PHP 5.3</label >
296+ <?php
297+ foreach ( $ phpversions as $ name => $ version ) {
298+ printf ( ' <label><input type="radio" name="phptest_version" value="%s" %s /> %s</label><br> ' , $ version , checked ( $ test_version , $ version , false ), $ name );
299+ }
300+ ? >
285301 </td>
286302 </tr>
287303 <tr>
0 commit comments