Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get the icon image from the WordPress Plugin API
<?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
You can’t perform that action at this time.