function jeg_social_icon($withtext)
{
    $html = "<ul>";
    $socialarray = jeg_populate_social();
    foreach ($socialarray as $soc) {
        if ($withtext) {
            $html .= "<li><a href='" . $soc['url'] . "' class='" . $soc['class'] . "'><i class='" . $soc['icon'] . "'></i>" . $soc['text'] . "</a></li>";
        } else {
            $html .= "<li><a href='" . $soc['url'] . "' class='" . $soc['class'] . "'><i class='" . $soc['icon'] . "'></i></a></li>";
        }
    }
    $html .= "</ul>";
    return $html;
}
<?php

$populatesocial = jeg_populate_social();
if (!empty($populatesocial)) {
    ?>
	<div class="footsocial">
		<?php 
    echo jeg_social_icon(false);
    ?>
	</div>
<?php 
}