src/Util/Theme.php
public static function appIcons() {
    $config = Config::instance();
    $icons_directory = THEME_DIRECTORY.'/'.$config->app_icons_directory;
    $icons_url = THEME_URL.'/'.$config->app_icons_directory;
    if(!file_exists($icons_directory)) return null;
    
    $files = scandir($icons_directory);
    if(!Arr::iterable($files)) return null;
    
    // Icon files should start with one of these, and be delimited by hyphens
    $icon_types = ['apple', 'android', 'favicon'];
    $paths = [];
    
    foreach($files as $file)  {
      if(!preg_match('/\.png$/', $file)) continue;
      
      // Get size from image name
      preg_match('/(\d+x\d+)/', $file, $sizes);
      if(!Arr::iterable($sizes)) continue;
      
      $size = reset($sizes);
      $icon_type = reset(explode('-', $file));
      if(!in_array($icon_type, $icon_types)) continue;
      
      $file_path = $icons_url.'/'.$file;
      $paths[] = View::make('meta/icon-'.$icon_type, [
        'file' => $file_path,
        'size' => $size,
      ]);
    }
    
    $paths[] = View::make('meta/icon-favicon-ico', [
      'file' => $icons_url.'/favicon.ico',
    ]);
    return join('', $paths);
  }
public static function appIcons() {
    $config = Config::instance();
    $icons_directory = THEME_DIRECTORY.'/'.$config->app_icons_directory;
    $icons_url = THEME_URL.'/'.$config->app_icons_directory;
    if(!file_exists($icons_directory)) return null;
    
    $files = scandir($icons_directory);
    if(!Arr::iterable($files)) return null;
    
    // Icon files should start with one of these, and be delimited by hyphens
    $icon_types = ['apple', 'android', 'favicon'];
    $paths = [];
    
    foreach($files as $file)  {
      if(!preg_match('/\.png$/', $file)) continue;
      
      // Get size from image name
      preg_match('/(\d+x\d+)/', $file, $sizes);
      if(!Arr::iterable($sizes)) continue;
      
      $size = reset($sizes);
      $icon_type = reset(explode('-', $file));
      if(!in_array($icon_type, $icon_types)) continue;
      
      $file_path = $icons_url.'/'.$file;
      $paths[] = View::make('meta/icon-'.$icon_type, [
        'file' => $file_path,
        'size' => $size,
      ]);
    }
    
    $paths[] = View::make('meta/icon-favicon-ico', [
      'file' => $icons_url.'/favicon.ico',
    ]);
    return join('', $paths);
  }
public static function appIcons ( ) { $ config = Config :: instance ( ) ; $ icons_directory = THEME_DIRECTORY . '/' . $ config -> app_icons_directory ; $ icons_url = THEME_URL . '/' . $ config -> app_icons_directory ; if ( ! file_exists ( $ icons_directory ) ) return null ; $ files = scandir ( $ icons_directory ) ; if ( ! Arr :: iterable ( $ files ) ) return null ; // Icon files should start with one of these, and be delimited by hyphens $ icon_types = [ 'apple' , 'android' , 'favicon' ] ; $ paths = [ ] ; foreach ( $ files as $ file ) { if ( ! preg_match ( '/\.png$/' , $ file ) ) continue ; // Get size from image name preg_match ( '/(\d+x\d+)/' , $ file , $ sizes ) ; if ( ! Arr :: iterable ( $ sizes ) ) continue ; $ size = reset ( $ sizes ) ; $ icon_type = reset ( explode ( '-' , $ file ) ) ; if ( ! in_array ( $ icon_type , $ icon_types ) ) continue ; $ file_path = $ icons_url . '/' . $ file ; $ paths [ ] = View :: make ( 'meta/icon-' . $ icon_type , [ 'file' => $ file_path , 'size' => $ size , ] ) ; } $ paths [ ] = View :: make ( 'meta/icon-favicon-ico' , [ 'file' => $ icons_url . '/favicon.ico' , ] ) ; return join ( '' , $ paths ) ; }
Get HTML for all icons
@link http://www.favicon-generator.org/
@return string
Get HTML for all icons