ipv4-wildcard-calculator and update github plugin

This commit is contained in:
Denny Dai
2015-07-05 15:12:42 +08:00
parent 954e096809
commit aa26e56e92
2 changed files with 47 additions and 1 deletions
+7 -1
View File
@@ -2,6 +2,7 @@
PluginSet("find someone on Github");
$opts = array ('http' => array ('header' => "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0",));
if (strpos($plugin_text,"@") === 0) {$plugin_text = substr($plugin_text,1);}
if (!strpos($plugin_text,'/')) {
$user = file_get_contents("https://api.github.com/users/".urlencode($plugin_text).'?access_token='.PLUGIN_GITHUB_TOKEN, false, stream_context_create($opts));
$starred = file_get_contents("https://api.github.com/users/".urlencode($plugin_text)."/starred".'?access_token='.PLUGIN_GITHUB_TOKEN, false, stream_context_create($opts));
@@ -11,7 +12,12 @@ if (!strpos($plugin_text,'/')) {
plugin_github_check("Name", $user['name']);
plugin_github_check("Email", $user['email']);
plugin_github_check("Company", $user['company']);
plugin_github_check("Starred", count(json_decode($starred,true)));
if (count(json_decode($starred,true)) == 30) {
$starred = '>30';
}else{
$starred = count(json_decode($starred,true));
}
plugin_github_check("Starred", $starred);
plugin_github_check("Repos", $user['public_repos']);
plugin_github_check("Followers", $user['followers']);
plugin_github_check("Following", $user['following']);