Skip to content

Instantly share code, notes, and snippets.

@georgestephanis
Created November 15, 2014 00:46
Show Gist options
  • Save georgestephanis/526288ffa1e55fd06f6f to your computer and use it in GitHub Desktop.
Save georgestephanis/526288ffa1e55fd06f6f to your computer and use it in GitHub Desktop.
<?php
function can_use_version( $version ) {
$secure_jetpacks = array(
'1.9' => '1.9.3',
'2.0' => '2.0.5',
'2.1' => '2.1.3',
'2.2' => '2.2.6',
'2.3' => '2.3.6',
'2.4' => '2.4.3',
'2.5' => '2.5.1',
'2.6' => '2.6.2',
'2.7' => '2.7.1',
'2.8' => '2.8.1',
'2.9' => '2.9.3',
);
$float_version = (string) floatval( $version );
if ( isset( $secure_jetpacks[ $float_version ] ) ) {
if ( version_compare( $version, $secure_jetpacks[ $float_version ], '<' ) ) {
return false;
}
}
// It passed the check! Return true! Not outdated or insecure!
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment