{"id":15698034,"url":"https://github.com/socialsisteryi/typecho-plugin-commentshowip","last_synced_at":"2025-05-09T01:10:47.133Z","repository":{"id":103397346,"uuid":"489964989","full_name":"SocialSisterYi/Typecho-Plugin-CommentShowIp","owner":"SocialSisterYi","description":"A Typecho Plugin for show reply sender IP and location ","archived":false,"fork":false,"pushed_at":"2022-05-09T15:54:21.000Z","size":1553,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-31T20:06:47.946Z","etag":null,"topics":["typecho","typecho-plugin"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SocialSisterYi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-05-08T14:22:37.000Z","updated_at":"2024-12-09T01:22:34.000Z","dependencies_parsed_at":"2023-03-13T07:46:02.082Z","dependency_job_id":null,"html_url":"https://github.com/SocialSisterYi/Typecho-Plugin-CommentShowIp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocialSisterYi%2FTypecho-Plugin-CommentShowIp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocialSisterYi%2FTypecho-Plugin-CommentShowIp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocialSisterYi%2FTypecho-Plugin-CommentShowIp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocialSisterYi%2FTypecho-Plugin-CommentShowIp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SocialSisterYi","download_url":"https://codeload.github.com/SocialSisterYi/Typecho-Plugin-CommentShowIp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253171265,"owners_count":21865295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["typecho","typecho-plugin"],"created_at":"2024-10-03T19:22:52.317Z","updated_at":"2025-05-09T01:10:47.097Z","avatar_url":"https://github.com/SocialSisterYi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Typecho-Plugin-CommentShowIp\n\nTpecho 的评论区显示评论发布者 ip 及归属地插件\n\n## 功能介绍\n\n为博客评论区留言增加 ip 及归属地显示，用以确定发布者身份及防止“地域黑”行为\n\n\u003e 2021年10月26日，国家网信办发布《互联网用户账号名称信息管理规定（征求意见稿）》（以下简称“《征求意见稿》”），拟要求平台在用户账号信息页面展示账号IP地址属地信息：境内用户账号IP地址属地信息需标注到省（区、市），境外账号IP地址属地信息需标注到国家（地区）。\n\n以上内容与本项目无实际关联，仅作为整活使用（手动滑稽\n\n- 双模式输出（Hook与API）\n- 支持自定义HTML模板\n- ip打码及归属地精度可选\n\n## 安装\n\n将本项目文件夹放入 /usr/plugins 下，并在后台的插件管理中启用插件\n\n并将目录名设置为 `CommentShowIp`\n\n## 插件配置\n\n- 开启以hook模式显示ip：见下文介绍\n- ip后16位打码：模板输出的`{ip}`信息是否后16bit使用\\*表示，如：192.168.\\*.\\*\n- 归属地精确到城市：模板输出的`{loc}`信息是否精确到地级市，如：广东广州\n\n## 使用方法\n\n### Hook模式\n\n将插件配置中的`以hook模式显示ip`复选框选中，发布者 ip 将自动输出至评论正文区域的第一行\n\n默认关闭，不推荐使用，使用该方法无法自定义ip显示样式和输出位点\n\neg：使用默认模板\n\n![](http://i0.hdslb.com/bfs/album/048aa4afb3531c83346574ed93988788bdc38f66.png)\n\n### API模式\n\n使用`CommentShowIp_Plugin::output($reply, $template = NULL, $type = 0)`函数进行调用\n\n参数说明：\n\n| 参数     | 说明           | 类型                     | 是否可选 | 说明                                                         |\n| -------- | -------------- | ------------------------ | -------- | ------------------------------------------------------------ |\n| reply    | 评论View层对象 | Widget_Abstract_Comments | ×        |                                                              |\n| template | 模板           | string \\|\\| NULL         | √        | 输出渲染模板，如为NULL，则使用内建样式\u003cbr /\u003e格式化符`{ip}`：ip地址信息\u003cbr /\u003e格式化符`{loc}`：归属地信息 |\n| type     | 输出模式       | int                      | √        | 0：使用`echo`输出到网页\u003cbr /\u003e1：使用`return`返回             |\n\neg：使用 MDUI 框架\n\n在合适位置加入以下代码（`$this`为实例化的评论区View层对象）\n\n```php\nCommentShowIp_Plugin::output($this, \"\n\u003cdiv\u003e\n    \u003cspan style=\\\"font-size:10px;\\\" mdui-tooltip=\\\"{content: '{ip}'}\\\"\u003eip属地: {loc}\u003c/span\u003e\n\u003c/div\u003e\"\n);\n```\n\n![](http://i0.hdslb.com/bfs/album/c53eaa826316400cd1c4ef0d2c912768878e961f.png)\n\n## 声明\n\n插件使用[ipip.net Free库](https://www.ipip.net/product/ip.html)以及[ipdb for PHP Library](https://github.com/ipipdotnet/ipdb-php)\n\n商业使用禁止\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocialsisteryi%2Ftypecho-plugin-commentshowip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsocialsisteryi%2Ftypecho-plugin-commentshowip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocialsisteryi%2Ftypecho-plugin-commentshowip/lists"}