Version Description
=
Download this release
Release Info
Developer | tsato |
Plugin | Throws SPAM Away |
Version | 1.0 |
Comparing to | |
See all releases |
Version 1.0
- readme.txt +45 -0
- throws_spam_away.php +51 -0
readme.txt
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Plugin Name ===
|
2 |
+
Contributors: tsato
|
3 |
+
Donate link: http://iscw.jp/
|
4 |
+
Tags: comments, spam
|
5 |
+
Requires at least: 3.1
|
6 |
+
Tested up to: 3.2.1
|
7 |
+
Stable tag: 1.0
|
8 |
+
|
9 |
+
コメント内にマルチバイト文字が一つも存在しない場合あたかも受け付けたように振る舞いながらも無視
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
コメント欄にダブルバイトが含まれていないと投稿出来ない・・・といってもエラーにするのではなく「無視」して何事もなかったようにもとの記事に戻る。
|
13 |
+
|
14 |
+
== Installation ==
|
15 |
+
|
16 |
+
This section describes how to install the plugin and get it working.
|
17 |
+
|
18 |
+
e.g.
|
19 |
+
|
20 |
+
1. Upload `throws-spam-away` to the `/wp-content/plugins/` directory
|
21 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress
|
22 |
+
|
23 |
+
== Frequently Asked Questions ==
|
24 |
+
|
25 |
+
= A question that someone might have =
|
26 |
+
|
27 |
+
= What about foo bar? =
|
28 |
+
|
29 |
+
|
30 |
+
== Screenshots ==
|
31 |
+
|
32 |
+
== Changelog ==
|
33 |
+
|
34 |
+
= 1.0 =
|
35 |
+
新規作成
|
36 |
+
|
37 |
+
== Upgrade Notice ==
|
38 |
+
|
39 |
+
= 1.0 =
|
40 |
+
とりあえず作りました!
|
41 |
+
== Arbitrary section ==
|
42 |
+
|
43 |
+
== A brief Markdown Example ==
|
44 |
+
|
45 |
+
`<?php code(); // goes in backticks ?>`
|
throws_spam_away.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Throws SPAM Away
|
4 |
+
Plugin URI: http://iscw.jp/wp/
|
5 |
+
Description: コメント内に日本語の記述が一つも存在しない場合はあたかも受け付けたように振る舞いながらも捨ててしまうプラグイン
|
6 |
+
Author: 株式会社アイ・エス・シー さとう たけし
|
7 |
+
Version: 1.0
|
8 |
+
Author URI: http://iscw.jp/
|
9 |
+
*/
|
10 |
+
|
11 |
+
class ThrowsSpamAway {
|
12 |
+
var $version = '1.0';
|
13 |
+
function ThrowsSpamAway() {
|
14 |
+
}
|
15 |
+
|
16 |
+
function comment_form() {
|
17 |
+
// 注意文言表示
|
18 |
+
echo '<div id="throwsSpamAway">';
|
19 |
+
echo '日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)';
|
20 |
+
echo '</div>';
|
21 |
+
return true;
|
22 |
+
}
|
23 |
+
|
24 |
+
function comment_post($id) {
|
25 |
+
global $newThrowsSpamAway;
|
26 |
+
global $user_ID;
|
27 |
+
|
28 |
+
if( $user_ID ) {
|
29 |
+
return $id;
|
30 |
+
}
|
31 |
+
|
32 |
+
$comment = $_POST["comment"];
|
33 |
+
if ($newThrowsSpamAway->validation($comment)) {
|
34 |
+
return $id;
|
35 |
+
}
|
36 |
+
wp_die( __('日本語を含まない記事は投稿できませんよ。<script type="text/javascript">window.setTimeout(location.href = "'.$_SERVER['HTTP_REFERER'].'", 100);</script>', 'throws-spam-away'));
|
37 |
+
}
|
38 |
+
|
39 |
+
function validation($comment) {
|
40 |
+
if (strlen(bin2hex($comment)) / 2 == mb_strlen($comment)) {
|
41 |
+
return false;
|
42 |
+
} else {
|
43 |
+
return true;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
$newThrowsSpamAway = new ThrowsSpamAway;
|
49 |
+
add_action('comment_form', array(&$newThrowsSpamAway, "comment_form"), 9999);
|
50 |
+
add_action('pre_comment_on_post', array(&$newThrowsSpamAway, "comment_post"), 9999);
|
51 |
+
?>
|