You are here

function responsive_favicons_load_all_icons in Responsive Favicons 7

Same name and namespace in other branches
  1. 8 responsive_favicons.module \responsive_favicons_load_all_icons()

Load the responsive favicons that are valid.

2 calls to responsive_favicons_load_all_icons()
responsive_favicons_page_build in ./responsive_favicons.module
Implements hook_page_build().
responsive_favicons_requirements in ./responsive_favicons.install
Implements hook_requirements().

File

./responsive_favicons.module, line 136
Responsive favicons module file.

Code

function responsive_favicons_load_all_icons() {
  $icons =& drupal_static(__FUNCTION__);
  if (!isset($icons)) {
    if ($cached = cache_get('responsive_favicons_icons', 'cache')) {
      $icons = $cached->data;
    }
    else {
      $responsive_favicon_tags = variable_get('responsive_favicons_tags', '');
      if (empty($responsive_favicon_tags)) {
        $icons = array(
          'found' => array(),
          'missing' => array(),
        );
      }
      else {
        $html = implode(PHP_EOL, $responsive_favicon_tags);
        $icons = _responsive_favicons_validate_tags($html);
        if (empty($icons['missing'])) {
          cache_set('responsive_favicons_icons', $icons, 'cache');
        }
      }
    }
  }
  return $icons;
}