Created
January 26, 2012 03:56
-
-
Save pdewouters/1680885 to your computer and use it in GitHub Desktop.
display plugin download count from wordpress.org repository
This file contains hidden or 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 wpc_get_plugin_dl_count(){ | |
$payload = array( | |
'action' => 'plugin_information', | |
'request' => serialize( | |
(object)array( | |
'slug' => 'pinterest-rss-widget', | |
'fields' => array('description' => true) | |
) | |
) | |
); | |
$body = wp_remote_post( 'http://api.wordpress.org/plugins/info/1.0/', array( 'body' => $payload) ); | |
$downloaded = unserialize($body['body'])->downloaded; | |
print 'Plugin downloaded ' .$downloaded . ' times.'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment