Changeset 3782
- Timestamp:
- 08/08/2016 12:23:26 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-controls.php
r3038 r3782 127 127 * the current version the plugin is marked as tested with. 128 128 * 129 * @global string $wp_version The WordPress version string. 130 * 129 131 * @param string $tested_up_to The version which the plugin is currently specified as compatible to. 130 *131 132 * @return array An array containing 'versions' an array of versions for display, and 'tested_up_to' 132 133 * the sanitized/most recent version of the $tested_up_to parameter. … … 134 135 protected static function get_tested_up_to_versions( $tested_up_to ) { 135 136 global $wp_version; 137 136 138 // Fetch all "compatible" versions, this array is in the form of [ '4.4.2' => [ '4.4.1', '4.4' ], ...] 137 139 if ( function_exists( 'wporg_get_version_equivalents' ) ) { 140 138 141 // This function is a global WordPress.org function. 139 142 $all_versions = wporg_get_version_equivalents(); … … 143 146 144 147 $versions = array_slice( array_keys( $all_versions ), 0, 4 ); 145 // WordPress.org runs trunk, this keeps the highest version selectable as trunk146 $versions[5] = preg_replace( '!-\d{4,}$!', '', $wp_version );147 148 148 $found = false;149 149 foreach( $versions as $version ) { 150 if ( i sset( $all_versions[ $version ] ) && in_array( $tested_up_to, $all_versions[ $version ] ) ) {150 if ( in_array( $tested_up_to, $all_versions[ $version ] ) ) { 151 151 $tested_up_to = $version; 152 $found = true;153 152 break; 154 153 } 155 154 } 155 156 156 // If the version specified isn't going to display, insert it into the list. 157 if ( ! $found ) { 158 $versions[4] = $tested_up_to; 159 ksort( $versions ); 157 if ( ! in_array( $tested_up_to, $versions ) ) { 158 $versions[] = $tested_up_to; 160 159 } 160 161 // WordPress.org runs trunk, this keeps the highest version selectable as trunk. 162 $versions[] = preg_replace( '!-\d{4,}$!', '', $wp_version ); 161 163 162 164 return compact( 'versions', 'tested_up_to' ); 163 165 } 164 166 } 165
Note: See TracChangeset
for help on using the changeset viewer.