Back to PhocacartCountry class

Method getCountryFlag

public static
getCountryFlag
(mixed $code = '', mixed $frontend = 0, mixed $image = '', mixed $width = '', mixed $height = '')

Method getCountryFlag - Source code

public static function getCountryFlag($code = '', $frontend = 0, $image = '', $width = '', $height = '')
{
    if ($image != '') {
        $imageO = PhocacartImage::getImage($image, '', $width, $height);
        if ($imageO) {
            return $imageO;
        }
    }
    if ($code != '') {
        //$link	= '/media/mod_languages/images/'. strip_tags(strtolower($code)). '.gif';
        //$link	= '/media/com_phocacart/images/flags/'. strip_tags(strtolower($code)). '-22x14.png';
        $link = '/media/com_phocacart/images/flags/' . strip_tags(strtolower($code)) . '.png';
        $abs = JPATH_ROOT . $link;
        if ($frontend == 1) {
            $rel = Uri::base(true) . $link;
        } else {
            $rel = str_replace('/administrator', '', Uri::base(true)) . $link;
        }
        if (File::exists($abs)) {
            return '<img src="' . $rel . '" alt="" />';
        }
    }
    return '';
}