| 1 | <?php
|
|---|
| 2 | /* -----------------------------------------------------------------------------------------
|
|---|
| 3 | $Id$
|
|---|
| 4 |
|
|---|
| 5 | modified eCommerce Shopsoftware
|
|---|
| 6 | http://www.modified-shop.org
|
|---|
| 7 |
|
|---|
| 8 | Copyright (c) 2009 - 2013 [www.modified-shop.org]
|
|---|
| 9 | -----------------------------------------------------------------------------------------
|
|---|
| 10 | Released under the GNU General Public License
|
|---|
| 11 | ---------------------------------------------------------------------------------------*/
|
|---|
| 12 |
|
|---|
| 13 | $ws_dir = 'templates/'.CURRENT_TEMPLATE.'/favicons/';
|
|---|
| 14 | $fs_dir = DIR_FS_CATALOG.$ws_dir;
|
|---|
| 15 |
|
|---|
| 16 | if (is_dir($fs_dir)) {
|
|---|
| 17 | // favicon
|
|---|
| 18 | $favicon_array = glob($fs_dir.'favicon*');
|
|---|
| 19 | natcasesort($favicon_array);
|
|---|
| 20 | if (count($favicon_array) > 0) {
|
|---|
| 21 | foreach ($favicon_array as $favicon) {
|
|---|
| 22 | $favicon_type = pathinfo($favicon);
|
|---|
| 23 | $favicon = basename($favicon);
|
|---|
| 24 | preg_match('/(\d+)x(\d+)/', $favicon, $match);
|
|---|
| 25 | if (isset($match[0]) && $match[0] != '') {
|
|---|
| 26 | echo '<link rel="icon" type="image/'.$favicon_type['extension'].'" href="'.xtc_href_link($ws_dir.$favicon, '', $request_type, false).'?v='.md5_file($ws_dir.$favicon).'" sizes="'.$match[0].'" />'."\n";
|
|---|
| 27 | } else {
|
|---|
| 28 | if ($favicon_type['extension'] == 'ico') {
|
|---|
| 29 | echo '<link rel="shortcut icon" type="image/x-icon" href="'.xtc_href_link($ws_dir.$favicon, '', $request_type, false).'?v='.md5_file($ws_dir.$favicon).'" />'."\n";
|
|---|
| 30 | echo '<link rel="icon" type="image/x-icon" href="'.xtc_href_link($ws_dir.$favicon, '', $request_type, false).'?v='.md5_file($ws_dir.$favicon).'" />'."\n";
|
|---|
| 31 | } else {
|
|---|
| 32 | echo '<link rel="icon" type="image/'.$favicon_type['extension'].'" href="'.xtc_href_link($ws_dir.$favicon, '', $request_type, false).'?v='.md5_file($ws_dir.$favicon).'" />'."\n";
|
|---|
| 33 | }
|
|---|
| 34 | }
|
|---|
| 35 | }
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 | // apple touch icon
|
|---|
| 39 | $apple_touch_icon_array = glob($fs_dir.'apple-touch-icon*');
|
|---|
| 40 | natcasesort($apple_touch_icon_array);
|
|---|
| 41 | if (count($apple_touch_icon_array) > 0) {
|
|---|
| 42 | foreach ($apple_touch_icon_array as $apple_touch_icon) {
|
|---|
| 43 | $apple_touch_icon = basename($apple_touch_icon);
|
|---|
| 44 | preg_match('/(\d+)x(\d+)/', $apple_touch_icon, $match);
|
|---|
| 45 | if (isset($match[0]) && $match[0] != '') {
|
|---|
| 46 | echo '<link rel="apple-touch-icon" href="'.xtc_href_link($ws_dir.$apple_touch_icon, '', $request_type, false).'?v='.md5_file($ws_dir.$apple_touch_icon).'" sizes="'.$match[0].'" />'."\n";
|
|---|
| 47 | } else {
|
|---|
| 48 | echo '<link rel="apple-touch-icon" href="'.xtc_href_link($ws_dir.$apple_touch_icon, '', $request_type, false).'?v='.md5_file($ws_dir.$apple_touch_icon).'" />'."\n";
|
|---|
| 49 | }
|
|---|
| 50 | }
|
|---|
| 51 | echo '<meta name="apple-mobile-web-app-title" content="'.encode_htmlspecialchars(TITLE).'" />'."\n";
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | // windows icon
|
|---|
| 55 | $mstile_array = glob($fs_dir.'mstile*');
|
|---|
| 56 | natcasesort($mstile_array);
|
|---|
| 57 | if (count($mstile_array) > 0) {
|
|---|
| 58 | $browserconfig = '<?xml version="1.0" encoding="utf-8"?><browserconfig><msapplication><tile>';
|
|---|
| 59 | foreach ($mstile_array as $mstile) {
|
|---|
| 60 | $mstile = basename($mstile);
|
|---|
| 61 | preg_match('/(\d+)x(\d+)/', $mstile, $match);
|
|---|
| 62 | if (isset($match[0]) && $match[0] != '') {
|
|---|
| 63 | if ($match[1] == '144' && $match[2] == '144') {
|
|---|
| 64 | echo '<meta name="msapplication-TileImage" content="'.xtc_href_link($ws_dir.$mstile, '', $request_type, false).'?v='.md5_file($ws_dir.$mstile).'" />'."\n";
|
|---|
| 65 | }
|
|---|
| 66 | if ($match[1] > $match[2]) {
|
|---|
| 67 | $browserconfig .= '<wide'.$match[0].'logo src="'.xtc_href_link($ws_dir.$mstile, '', $request_type, false).'?v='.md5_file($ws_dir.$mstile).'"/>';
|
|---|
| 68 | echo '<meta name="msapplication-wide'.$match[0].'logo" content="'.xtc_href_link($ws_dir.$mstile, '', $request_type, false).'?v='.md5_file($ws_dir.$mstile).'" />'."\n";
|
|---|
| 69 | } else {
|
|---|
| 70 | $browserconfig .= '<square'.$match[0].'logo src="'.xtc_href_link($ws_dir.$mstile, '', $request_type, false).'?v='.md5_file($ws_dir.$mstile).'"/>';
|
|---|
| 71 | echo '<meta name="msapplication-square'.$match[0].'logo" content="'.xtc_href_link($ws_dir.$mstile, '', $request_type, false).'?v='.md5_file($ws_dir.$mstile).'" />'."\n";
|
|---|
| 72 | }
|
|---|
| 73 | }
|
|---|
| 74 | }
|
|---|
| 75 | echo '<meta name="msapplication-TileColor" content="#ffffff" />'."\n";
|
|---|
| 76 | echo '<meta name="theme-color" content="#ffffff">'."\n";
|
|---|
| 77 | echo '<meta name="msapplication-navbutton-color" content="#ffffff" />'."\n";
|
|---|
| 78 | echo '<meta name="msapplication-tooltip" content="'.encode_htmlspecialchars(TITLE).'" />'."\n";
|
|---|
| 79 | $browserconfig .= '</tile></msapplication></browserconfig>';
|
|---|
| 80 | $browserconfig_file_path = $fs_dir.'browserconfig.xml';
|
|---|
| 81 | $browserconfig_file = is_writeable($browserconfig_file_path) ? filemtime($browserconfig_file_path) : false;
|
|---|
| 82 | if ($browserconfig_file && (time() - $browserconfig_file > 86400 || filesize($browserconfig_file_path) == 0)) {
|
|---|
| 83 | file_put_contents($browserconfig_file_path, $browserconfig, LOCK_EX);
|
|---|
| 84 | }
|
|---|
| 85 | echo '<meta name="msapplication-config" content="'.xtc_href_link($ws_dir.'browserconfig.xml','', $request_type, false).'?v='.md5_file($ws_dir.'browserconfig.xml').'" />'."\n";
|
|---|
| 86 | }
|
|---|
| 87 |
|
|---|
| 88 | // android touch icon
|
|---|
| 89 | $android_touch_icon_array = glob($fs_dir.'android-chrome*');
|
|---|
| 90 | natcasesort($android_touch_icon_array);
|
|---|
| 91 | if (count($android_touch_icon_array) > 0) {
|
|---|
| 92 | $manifest_array = array('name' => encode_htmlspecialchars(TITLE),
|
|---|
| 93 | 'icons' => array()
|
|---|
| 94 | );
|
|---|
| 95 | foreach ($android_touch_icon_array as $android_touch_icon) {
|
|---|
| 96 | $android_touch_icon_type = pathinfo($android_touch_icon);
|
|---|
| 97 | $android_touch_icon = basename($android_touch_icon);
|
|---|
| 98 | preg_match('/(\d+)x(\d+)/', $android_touch_icon, $match);
|
|---|
| 99 | if (isset($match[0]) && $match[0] != '') {
|
|---|
| 100 | echo '<link rel="icon" type="image/png" href="'.xtc_href_link($ws_dir.$android_touch_icon, '', $request_type, false).'?v='.md5_file($ws_dir.$android_touch_icon).'" sizes="'.$match[0].'" />'."\n";
|
|---|
| 101 | $manifest_array['icons'][] = array('src' => xtc_href_link($ws_dir.$android_touch_icon, '', $request_type, false),
|
|---|
| 102 | 'sizes' => $match[0],
|
|---|
| 103 | 'type' => 'image/'.$android_touch_icon_type['extension'],
|
|---|
| 104 | 'density' => ''.($match[1] / 48).''
|
|---|
| 105 | );
|
|---|
| 106 | }
|
|---|
| 107 | }
|
|---|
| 108 | if (count($manifest_array['icons']) > 0) {
|
|---|
| 109 | $manifest_file_path = $fs_dir.'manifest.json';
|
|---|
| 110 | $manifest_file = is_writeable($manifest_file_path) ? filemtime($manifest_file_path) : false;
|
|---|
| 111 | if ($manifest_file && ($manifest_file < (time() - 86400) || filesize($manifest_file_path) == 0)) {
|
|---|
| 112 | file_put_contents($manifest_file_path, json_encode($manifest_array), LOCK_EX);
|
|---|
| 113 | }
|
|---|
| 114 | echo '<link rel="manifest" href="'.xtc_href_link($ws_dir.'manifest.json', '', $request_type, false).'?v='.md5_file($ws_dir.'manifest.json').'" />'."\n";
|
|---|
| 115 | }
|
|---|
| 116 | }
|
|---|
| 117 |
|
|---|
| 118 | // application name
|
|---|
| 119 | echo '<meta name="application-name" content="'.encode_htmlspecialchars(TITLE).'" />'."\n";
|
|---|
| 120 | } else {
|
|---|
| 121 | echo '<link rel="shortcut icon" type="image/x-icon" href="'.xtc_href_link('templates/'.CURRENT_TEMPLATE.'/favicon.ico','', $request_type, false).'?v='.md5_file('templates/'.CURRENT_TEMPLATE.'/favicon.ico').'" />'."\n";
|
|---|
| 122 | }
|
|---|
| 123 | ?>
|
|---|