Skip to content

Commit

Permalink
Merge pull request #3 from catscarlet/dev-3.0.0
Browse files Browse the repository at this point in the history
Prepare v3.0.3
  • Loading branch information
catscarlet committed Sep 12, 2019
2 parents 05bc5d7 + 7971917 commit 4ba6efe
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
6 changes: 6 additions & 0 deletions Changelog_en.md
@@ -1,5 +1,11 @@
# Changelog

## 3.0.3

- Update IPIP.net IPDB database to 2019-7.
- Support on Mobile now.
- Now has a easier way to install.(See in README.md)

## 3.0.2

Fix a style issue.
Expand Down
20 changes: 14 additions & 6 deletions README.md
Expand Up @@ -10,12 +10,24 @@
- 0.2 - 2.0.0 支持 DATAX 数据库
- 3.0.0+ 支持 IPDB 数据库

## 安装
## 安装与更新

### 手动安装

本插件未包含在 WordPress Plugin 仓库中,所以需要手动安装。

插件未在 WordPress 上保存任何数据,建议更新时删除旧插件。

以下安装方式二选一。

#### WordPress 原生上传安装

**[Release](https://github.com/catscarlet/wp-ipip/releases/latest)** 中下载最新的 zip 包(注意不是Source code)。在 WordPress 中的 **插件-安装插件** 页面中,点击上方的上传插件,选择 zip 包并上传即可。

#### 传统

*(建议使用 WordPress 原生上传安装。但这个方法不会废弃)*

将文件复制到 WordPress 的插件目录下即可,文件应该在 `/wp-content/plugins/wp-ipip` 目录下。

项目主要文件结构:
Expand Down Expand Up @@ -48,10 +60,6 @@ IPIP 数据库文件路径:`{插件路径}/ipipdotnet/ipipfree.ipdb`,直接

你可以在 IPIP 的官网下载最新版的数据库:<https://www.ipip.net/download.html>

### 更新

插件未在 WordPress 上保存任何数据,建议更新时删除旧插件并上传新文件。

### 卸载

插件未在 WordPress 上保存任何数据,直接删除插件目录即可。
Expand All @@ -78,7 +86,7 @@ IPIP 数据库文件路径:`{插件路径}/ipipdotnet/ipipfree.ipdb`,直接

### 移动端

移动端未测试
移动端于 v3.0.3 开始支持

### 收费版

Expand Down
Binary file modified ipipdotnet/ipipfree.ipdb
Binary file not shown.
1 change: 1 addition & 0 deletions js/wp-ipip.js
Expand Up @@ -40,6 +40,7 @@ jQuery(document).ready(
jQuery('.wp-ipip-comment').each(function() {
var thisId = jQuery(this).attr('id').substr(15);
jQuery('#comment-' + thisId + ' .author.column-author').append(jQuery('#wp-ipip-prefix-' + thisId));
jQuery('#comment-' + thisId + ' .comment-author').append(jQuery('#wp-ipip-mobile-prefix-' + thisId));
});
}
);
9 changes: 5 additions & 4 deletions wp-ipip.php
Expand Up @@ -2,9 +2,9 @@

/*
Plugin Name: WP-IPIP
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
Plugin URI: https://github.com/catscarlet/wp-ipip
Description: 根据评论 IP 地址定位物理地址,使用 IPIP.net 数据库。
Version: 3.0.2
Version: 3.0.3
Author: 石樱灯笼
Author URI: https://www.catscarlet.com
*/
Expand Down Expand Up @@ -44,7 +44,7 @@ function wp_ipip($comment_text, $comment = null)
$results = IP::find($comment->comment_author_IP);
} catch (Exception $e) {
$location = 'WP-IPIP Caught exception: '.$e->getMessage();
$wpipip_e = '<div class="wp-ipip-comment" id="wp-ipip-prefix-'.$comment->comment_ID.'" style="color:red">'.$location.'</div>';
$wpipip_e = '<div class="wp-ipip-comment" id="wp-ipip-prefix-'.$comment->comment_ID.'" style="color:red">'.$location.'</div><div class="wp-ipip-mobile-comment" id="wp-ipip-mobile-prefix-'.$comment->comment_ID.'" style="color:red">'.$location.'</div>';

echo $wpipip_e;

Expand All @@ -65,8 +65,9 @@ function wp_ipip($comment_text, $comment = null)
$info = implode(',', $location);

$wpipip = '<div class="wp-ipip-comment" id="wp-ipip-prefix-'.$comment->comment_ID.'"><span class="wp-ipip-link-span" ip="'.$comment->comment_author_IP.'" title="点击跳转到 IPIP.net 查看 '.$comment->comment_author_IP.' 详情">地址: '.$info.'</snap></div>';
$wpipip_mobile = '<div class="wp-ipip-comment" id="wp-ipip-mobile-prefix-'.$comment->comment_ID.'"><span class="wp-ipip-link-span" ip="'.$comment->comment_author_IP.'" title="点击跳转到 IPIP.net 查看 '.$comment->comment_author_IP.' 详情">地址: '.$info.'</snap></div>';

echo $wpipip;
echo $wpipip.$wpipip_mobile;

return $comment_text;
}

0 comments on commit 4ba6efe

Please sign in to comment.