Created
November 11, 2014 12:44
-
-
Save ejntaylor/1735e5c7053b2fc8eee2 to your computer and use it in GitHub Desktop.
Get the icon image from the WordPress Plugin API
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
<?php | |
$bp_filetypes = array('128x128.png','128x128.jpg','256x256.png','256x256.jpg','logo.svg'); | |
foreach ($bp_filetypes as $bp_filetype) { | |
$logo_item = $bp_filetype; | |
$url = 'http://ps.w.org/' . $pb_plugin_item[plugin_slug] . '/assets/icon-' . $logo_item; | |
//echo $url; | |
$exists = (@$fp = fopen($url, "r")) !== FALSE; if ($fp) fclose($fp); | |
if ($exists==true) { echo " true"; | |
$logo = $bp_filetype; | |
//echo '<img src="http://ps.w.org/' . $pb_plugin_item[plugin_slug] . '/assets/icon-'.$logo.'" style="height:50px; width:50px;">'; | |
} elseif ($exists==false) { $logo = 'no'; } | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment