{"generator":"Code Snippets v3.5.0","date_created":"2023-10-02 10:23","snippets":[{"id":16,"name":"_______shortcut icon (\uad00\ub9ac\uc790 \uc678 \uc218\uc815\uae08\uc9c0)","desc":"

\uc0ac\uc6a9\ubc29\ubc95 (\uc544\ub798 \ub9c1\ud06c \ud074\ub9ad)<\/strong><\/a><\/p>\n

https:\/\/snippets.stofarm.com\/favicon<\/a><\/strong><\/p>","code":"\/\/ \uc544\ub798 \ub9c1\ud06c\ub97c \ud1b5\ud574 \uc0ac\uc6a9\ubc29\ubc95\uc744 \uaf2d \ud655\uc778\ud558\uace0 \uc0ac\uc6a9\ud558\uc138\uc694!! - \ud504\ub85c\uadf8\ub798\uba38 \ubb38\ud638\uc601\n\/\/ https:\/\/snippets.stofarm.com\/favicon\n\n$use_snippet = true; \/\/ \uae30\ubcf8\uac12\uc740 \uc0ac\uc6a9\n\nif(!$use_snippet) {\n return; \/\/ \uc2a4\ub2c8\ud54f \uc0ac\uc6a9\uc744 \uc6d0\ud558\uc9c0 \uc54a\ub294 \uacbd\uc6b0 \ubc14\ub85c \ubc18\ud658\n}\n\n\/\/ \uc124\uba85: \uad00\ub9ac\uc790\ub9cc\uc774 \uc774 \uc2a4\ub2c8\ud54f\uc744 \uc774\uc6a9\ud558\uc5ec \/favicon-link.meta \ud30c\uc77c\uc5d0 link \ud0dc\uadf8\ub97c \uc800\uc7a5\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n\/\/ \ub9e4\ubc88 \ud30c\uc77c\uc5d0 \uc811\uc18d\ud560 \ub54c\ub9c8\ub2e4 \uae30\uc874 \ub0b4\uc6a9\uc740 \uc9c0\uc6cc\uc9c0\uace0 \uc0c8\ub85c\uc6b4 link \ud0dc\uadf8\uac00 \ucd94\uac00\ub429\ub2c8\ub2e4.\n\nif (current_user_can('administrator')) {\n\n function check_url_exists($url) {\n $ch = curl_init($url);\n curl_setopt($ch, CURLOPT_NOBODY, true);\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);\n curl_exec($ch);\n $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n curl_close($ch);\n return $httpCode == 200;\n }\n\n function handle_favicon_logic() {\n \/\/ \ubc84\uc804 \uc815\ubcf4\n $version = \"1.0.0.3\"; \/\/ \ubc84\uc804 \uc5c5\ub370\uc774\ud2b8\n $date = \"2023-10-05\"; \/\/ \ub0a0\uc9dc \uc5c5\ub370\uc774\ud2b8\n\n \/\/ \ud30c\uc77c \uacbd\ub85c \uc124\uc815\n $file_path = $_SERVER['DOCUMENT_ROOT'] . \"\/favicon-link.meta\";\n\n $domain = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? \"https\" : \"http\") . \":\/\/$_SERVER[HTTP_HOST]\";\n\t\t\n\t\t\n\t\t\n $custom_favicon_url = trim(\" \");\n\n $root_ico_exists = check_url_exists(\"{$domain}\/favicon.ico\");\n $root_icon_exists = check_url_exists(\"{$domain}\/favicon.icon\");\n $ico_logo_exists = check_url_exists($custom_favicon_url);\n $custom_logo_id = get_theme_mod('custom_logo');\n $logo = wp_get_attachment_image_src($custom_logo_id, 'full');\n $site_logo_exists = $logo && check_url_exists($logo[0]);\n\n if ($_SERVER['REQUEST_URI'] == '\/check-favicon') {\n echo '\n \n \n \n \n \ub85c\uace0 \ud655\uc778<\/title>\n <style>\n body { font-family: Arial, sans-serif; background-color: #f4f4f4; height: 100vh; display: flex; align-items: center; justify-content: center; }\n .container { background-color: #fff; padding: 40px; border-radius: 10px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); width: 80%; max-width: 600px; text-align: center; }\n h2 { font-size: 26px; margin-bottom: 20px; color: #333; }\n p { font-size: 20px; margin-bottom: 30px; color: #555; }\n .status { color: green; font-weight: bold; }\n .priority { color: red; font-weight: bold; }\n a { color: #007BFF; text-decoration: none; font-size: 18px; }\n <\/style>\n <\/head>\n <body>\n <div class=\"container\">\n <h2>\ub85c\uace0 \uc0c1\ud0dc \ud655\uc778<\/h2>\n <p>\/favicon.ico \uc720\ubb34: <span class=\"' . ($root_ico_exists ? \"status priority\" : \"status\") . '\">' . ($root_ico_exists ? \"\uc874\uc7ac\ud568 (\uc6b0\uc120 \uc0ac\uc6a9\ub428)\" : \"\uc874\uc7ac\ud558\uc9c0 \uc54a\uc74c\") . '<\/span><\/p>\n <p>\/favicon.icon \uc720\ubb34: <span class=\"' . ($root_icon_exists ? \"status\" : \"absent\") . '\">' . ($root_icon_exists ? \"\uc874\uc7ac\ud568\" : \"\uc874\uc7ac\ud558\uc9c0 \uc54a\uc74c\") . '<\/span><\/p>\n <p>\ucee4\uc2a4\ud140 \ud30c\ube44\ucf58 \uc720\ubb34: <span class=\"' . ($ico_logo_exists ? \"status\" : \"absent\") . '\">' . ($ico_logo_exists ? \"\uc874\uc7ac\ud568\" : \"\uc874\uc7ac\ud558\uc9c0 \uc54a\uc74c\") . '<\/span><\/p>\n <p>\uc0ac\uc774\ud2b8 \ub85c\uace0 \uc720\ubb34: <span class=\"' . ($site_logo_exists ? \"status\" : \"absent\") . '\">' . ($site_logo_exists ? \"\uc874\uc7ac\ud568\" : \"\uc874\uc7ac\ud558\uc9c0 \uc54a\uc74c\") . '<\/span><\/p>\n <p><strong>\ubc84\uc804:<\/strong> ' . $version . ' <br><strong>\uc5c5\ub370\uc774\ud2b8 \ub0a0\uc9dc:<\/strong> ' . $date . '<\/p>\n <p><a href=\"https:\/\/snippets.stofarm.com\/favicon\" target=\"_blank\" rel=\"follow\">\ub85c\uace0 \uc124\uc815 \ubc29\ubc95\uc5d0 \ub300\ud55c \uc790\uc138\ud55c \uc548\ub0b4 \ubcf4\uae30<\/a><\/p>\n <\/div>\n <\/body>\n <\/html>';\n exit;\n }\n\n $selected_logo = '';\n if ($ico_logo_exists) {\n $selected_logo = $custom_favicon_url;\n } elseif ($root_ico_exists) {\n $selected_logo = \"{$domain}\/favicon.ico\";\n } elseif ($root_icon_exists) {\n $selected_logo = \"{$domain}\/favicon.icon\";\n } elseif ($site_logo_exists) {\n $selected_logo = $logo[0];\n }\n\n if ($selected_logo) {\n $link_tags = \"<link rel='shortcut icon' href='{$selected_logo}' type='image\/vnd.microsoft.icon'>\\n\";\n $link_tags .= \"<link rel='icon' href='{$selected_logo}' type='image\/vnd.microsoft.icon'>\\n\";\n \n \/\/ PNG \ud30c\ube44\ucf58 \ucd94\uac00\n if(pathinfo($selected_logo, PATHINFO_EXTENSION) === \"png\") {\n $link_tags .= \"<link rel='icon' type='image\/png' href='{$selected_logo}'>\\n\";\n }\n\n \/\/ \ud30c\uc77c\uc5d0 link \ud0dc\uadf8 \uc800\uc7a5\n file_put_contents($file_path, $link_tags);\n }\n }\n\t\n handle_favicon_logic();\n}\n\n\/\/ \ubaa8\ub4e0 \uc0ac\uc6a9\uc790\uc5d0\uac8c link \ud0dc\uadf8 \ucd9c\ub825\nfunction output_favicon_meta() {\n $file_path = $_SERVER['DOCUMENT_ROOT'] . \"\/favicon-link.meta\";\n if (file_exists($file_path)) {\n echo file_get_contents($file_path);\n }\n}\n\nadd_action('wp_head', 'output_favicon_meta', 999); \/\/ \ucd5c\uc6b0\uc120\uc73c\ub85c \ucd9c\ub825","tags":["wp_head","add_action"],"active":true,"modified":"2023-10-02 10:22:46","revision":"14"}]}