diff --git a/fp-plugins/favicon/doc_favicon.txt b/fp-plugins/favicon/doc_favicon.txt index 7d28e936..5bcb1aa5 100644 --- a/fp-plugins/favicon/doc_favicon.txt +++ b/fp-plugins/favicon/doc_favicon.txt @@ -9,7 +9,7 @@ If you want to use your own favicon, please make sure that the favicon is a mult The favicon.ico file should be a multi-layered icon with the sizes 16x16, 32x32 and 48x48. To display the favicon correctly on mobile Android devices, the path in the site.webmanifest.json.php file must refer to the favicon. -The same applies to Windows 10 devices or higher. The path to the matching icons is specified in the browserconfig.xml.php file. +The same applies to Windows 10 devices or higher. The path to the matching icons is specified in the browserconfig.xml.php file. Google Search, for example, only supports one favicon per website, whereby a website is defined by the host name. -If you activate the FavIcon plugin, a request for the favicon in the main directory will be answered with 404. +If you activate the FavIcon plugin, a request for the favicon in the main directory will be answered with 307, temporary redirect. diff --git a/fp-plugins/favicon/imgs/apple-touch-icon-precomposed.png b/fp-plugins/favicon/imgs/apple-touch-icon-precomposed.png new file mode 100644 index 00000000..deb38f9d Binary files /dev/null and b/fp-plugins/favicon/imgs/apple-touch-icon-precomposed.png differ diff --git a/fp-plugins/favicon/imgs/apple-touch-icon-180x180.png b/fp-plugins/favicon/imgs/apple-touch-icon.png similarity index 100% rename from fp-plugins/favicon/imgs/apple-touch-icon-180x180.png rename to fp-plugins/favicon/imgs/apple-touch-icon.png diff --git a/fp-plugins/favicon/imgs/browserconfig.xml.php b/fp-plugins/favicon/imgs/browserconfig.xml.php index 5526d5f2..e99eb7ab 100644 --- a/fp-plugins/favicon/imgs/browserconfig.xml.php +++ b/fp-plugins/favicon/imgs/browserconfig.xml.php @@ -3,15 +3,19 @@ require_once('../../../defaults.php'); $blogBaseUrl = BLOG_BASEURL; + +// Indicates the version of the symbol. Increase it by one when you change the image ($v = '?v=3', $v = '?v=4', etc.). +// The browser will then immediately display the latest version. +$v = '?v=2'; ?> - - - - + + + + #b77b7b diff --git a/fp-plugins/favicon/imgs/favicon-16x16.ico b/fp-plugins/favicon/imgs/favicon-16x16.ico deleted file mode 100644 index 44ad541c..00000000 Binary files a/fp-plugins/favicon/imgs/favicon-16x16.ico and /dev/null differ diff --git a/fp-plugins/favicon/imgs/favicon-32x32.ico b/fp-plugins/favicon/imgs/favicon-32x32.ico deleted file mode 100644 index 294a32a9..00000000 Binary files a/fp-plugins/favicon/imgs/favicon-32x32.ico and /dev/null differ diff --git a/fp-plugins/favicon/imgs/favicon-48x48.ico b/fp-plugins/favicon/imgs/favicon-48x48.ico deleted file mode 100644 index cfed6d88..00000000 Binary files a/fp-plugins/favicon/imgs/favicon-48x48.ico and /dev/null differ diff --git a/fp-plugins/favicon/imgs/site.webmanifest.json.php b/fp-plugins/favicon/imgs/site.webmanifest.json.php index ff660559..160b925b 100644 --- a/fp-plugins/favicon/imgs/site.webmanifest.json.php +++ b/fp-plugins/favicon/imgs/site.webmanifest.json.php @@ -3,16 +3,20 @@ require_once('../../../defaults.php'); $blogBaseUrl = BLOG_BASEURL; + +// Indicates the version of the symbol. Increase it by one when you change the image ($v = '?v=3', $v = '?v=4', etc.). +// The browser will then immediately display the latest version. +$v = '?v=2'; ?> { "icons": [ { - "src": "android-chrome-192x192.png", + "src": "android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" }, { - "src": "android-chrome-256x256.png", + "src": "android-chrome-256x256.png", "sizes": "256x256", "type": "image/png" } diff --git a/fp-plugins/favicon/plugin.favicon.php b/fp-plugins/favicon/plugin.favicon.php index fe7dabae..7f184b05 100755 --- a/fp-plugins/favicon/plugin.favicon.php +++ b/fp-plugins/favicon/plugin.favicon.php @@ -8,49 +8,70 @@ * Description: Adds favicons for search engines, mobile devices or browsers to FlatPress. Part of the standard distribution. [More information] */ -// Google Search, for example, only supports one favicon per website, whereby a website is defined by the host name. -// If an icon in the main directory, do not load!!! -$httpHost = $_SERVER ['HTTP_HOST']; -$requestUri = $_SERVER ['REQUEST_URI']; -if (strpos($httpHost, 'favicon') || strpos($requestUri, 'favicon')) { - http_response_code(404); -} +function plugin_favicon_head() { -if (strpos($httpHost, 'apple-touch-icon') || strpos($requestUri, 'apple-touch-icon')) { - http_response_code(404); -} + // Google Search, for example, only supports one favicon per website, whereby a website is defined by the host name. + // If an icon is in the main directory, do not load it, but redirect it temporarily!!! + redir_favicon(); + + // Indicates the version of the symbol. Increase it by one when you change the image ($v = '?v=3', $v = '?v=4', etc.). + // The browser will then immediately display the latest version. + $v = '?v=2'; -function plugin_favicon_head() { - // FlatPress icon set echo ' - - ' . // Smartphone iOS Safari - '' . // - '' . // - '' . // - '' . // - '' . // - // Smartphone Android Chrome - '' . // For Android home screen - '' . // - '' . // - '' . // - '' . // This file must be located in the imgs directory! - // Mac OS Safari - '' . // Mask icon for Safari pinned tabs - // Classic/, desktop browsers - '' . // Multilayer icon - '' . // Highest resolution icon - '' . // - '' . // - // Windows 10 or higher + ' . // + + // Smartphone iOS Safari + '' . // + '' . // + '' . // + '' . // + '' . // + '' . // + + // Smartphone Android Chrome + '' . // For Android home screen + '' . // + '' . // + '' . // + '' . // This file must be located in the imgs directory! + + // Mac OS Safari + '' . // Mask icon for Safari pinned tabs + + // Classic/, desktop browsers + '' . // FlatPress multilayer icon + + // Windows 10 or higher '' . // - '' . // This file must be located in the imgs directory! - '' . // - ' - + '' . // This file must be located in the imgs directory! + '' . // + + '' . // Specify a color for the browser toolbar and the status bar on mobile devices + ' '; } +function redir_favicon() { + + $requestUri = $_SERVER ['REQUEST_URI']; + $favicons = array ( + 'favicon.ico', + 'apple-touch-icon.png', + 'apple-touch-icon-precomposed.png' + ); + + foreach($favicons as $favicon) { + if (strpos($requestUri, $favicon) !== false) { + http_response_code(307); // Temporary Redirect + header('Location: ' . plugin_geturl('favicon') . 'imgs/' . $favicon); + return true; + } + } + + return false; +} + + add_action('wp_head', 'plugin_favicon_head'); ?>