Created
January 26, 2014 14:25
-
-
Save julienbourdeau/8633521 to your computer and use it in GitHub Desktop.
This function will give you the last stable version of WordPress. It fetches the home page of wordpress.org and return the version number from the download buttons. Curl is required.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_wordpress_last_version_number() { | |
$link = `curl http://wordpress.org | grep '<a class="button download-button button-large"'`; | |
preg_match_all("/\<a.*href=\"(.*?)\".*?\>(.*)\<\/a\>+/", $link, $matches, PREG_SET_ORDER); | |
$last_version = str_replace("Download WordPress ", '', $matches[0][2]); | |
return $last_version; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment