Changeset 3420136
- Timestamp:
- 12/15/2025 12:45:40 PM (4 months ago)
- Location:
- tiny-comment-spam-blocker
- Files:
-
- 9 added
- 5 edited
-
tags/1.3.0 (added)
-
tags/1.3.0/languages (added)
-
tags/1.3.0/languages/tiny-comment-spam-blocker-ja.mo (added)
-
tags/1.3.0/languages/tiny-comment-spam-blocker-ja.po (added)
-
tags/1.3.0/languages/tiny-comment-spam-blocker.pot (added)
-
tags/1.3.0/readme.txt (added)
-
tags/1.3.0/screenshot-1.png (added)
-
tags/1.3.0/screenshot-2.png (added)
-
tags/1.3.0/tiny-comment-spam-blocker.php (added)
-
trunk/languages/tiny-comment-spam-blocker-ja.mo (modified) (previous)
-
trunk/languages/tiny-comment-spam-blocker-ja.po (modified) (3 diffs)
-
trunk/languages/tiny-comment-spam-blocker.pot (modified) (3 diffs)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/tiny-comment-spam-blocker.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tiny-comment-spam-blocker/trunk/languages/tiny-comment-spam-blocker-ja.po
r3397677 r3420136 1 1 msgid "" 2 2 msgstr "" 3 "Project-Id-Version: Tiny Comment Spam Blocker 1. 2.0\n"3 "Project-Id-Version: Tiny Comment Spam Blocker 1.3.0\n" 4 4 "Report-Msgid-Bugs-To: \n" 5 "POT-Creation-Date: 2025-1 1-18 00:05:58+0000\n"6 "PO-Revision-Date: 2025-1 1-18 00:09:23+0000\n"5 "POT-Creation-Date: 2025-12-15 12:25:28+0000\n" 6 "PO-Revision-Date: 2025-12-15 12:33:45+0000\n" 7 7 "Last-Translator: Kasuga\n" 8 8 "Language-Team: \n" … … 68 68 msgstr "NOTE: 禁止語リストは、コメント本文、メールアドレス、および IP アドレスに適用されます。" 69 69 70 msgid "Block No Japanese Comments" 71 msgstr "日本語なしコメントをブロック" 72 73 msgid "If enabled, Comments without Japanese characters (Hiragana, Katakana, Kanji) will be blocked." 74 msgstr "有効化すると、日本語文字(ひらがな/カタカナ/漢字)を含まないコメントをブロックします。" 75 70 76 msgid "Detection Log Output" 71 77 msgstr "検知ログ" … … 92 98 msgstr "禁止語が検出されました: %1$s: %2$s" 93 99 100 msgid "Blocked: Comment contains no Japanese characters." 101 msgstr "ブロックしました: コメントに日本語が含まれていません。" 102 94 103 msgid "Unknown Page" 95 104 msgstr "不明なページ" -
tiny-comment-spam-blocker/trunk/languages/tiny-comment-spam-blocker.pot
r3397677 r3420136 1 1 msgid "" 2 2 msgstr "" 3 "Project-Id-Version: Tiny Comment Spam Blocker 1. 2.0\n"3 "Project-Id-Version: Tiny Comment Spam Blocker 1.3.0\n" 4 4 "Report-Msgid-Bugs-To: \n" 5 "POT-Creation-Date: 2025-1 1-18 00:05:58+0000\n"5 "POT-Creation-Date: 2025-12-15 12:25:28+0000\n" 6 6 "PO-Revision-Date: \n" 7 7 "Last-Translator: \n" … … 68 68 msgstr "" 69 69 70 msgid "Block No Japanese Comments" 71 msgstr "" 72 73 msgid "If enabled, Comments without Japanese characters (Hiragana, Katakana, Kanji) will be blocked." 74 msgstr "" 75 70 76 msgid "Detection Log Output" 71 77 msgstr "" … … 92 98 msgstr "" 93 99 100 msgid "Blocked: Comment contains no Japanese characters." 101 msgstr "" 102 94 103 msgid "Unknown Page" 95 104 msgstr "" -
tiny-comment-spam-blocker/trunk/readme.txt
r3418599 r3420136 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 1. 2.17 Stable tag: 1.3.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 19 19 4. **User Agent Validation** – Detects suspicious User-Agent strings and blocks them. 20 20 5. **Forbidden Word Filtering** – Blocks submissions containing words or phrases from a configurable list within the **comment body, email address, or IP address.** 21 6. **(Option) Block Non-Japanese Comments** – Blocks comments that do not contain Japanese characters (Hiragana, Katakana, or Han/Kanji), primarily targeting machine-translated or foreign spam. 21 22 22 23 These filters are applied in order: if a comment passes the first check, it proceeds to the second, and so on, until all checks are applied or the comment is blocked. … … 59 60 `spam@email.com` 60 61 `164.138.205.72` 62 * **Block No Japanese Comments** - If enabled, this becomes the final check: Comments that contain Japanese characters (Hiragana, Katakana, or Kanji) will be automatically accepted after passing other security checks. **Comments without Japanese characters will be blocked.** 61 63 62 64 --- … … 85 87 86 88 == Changelog == 89 = 1.3.0 = 90 * Added a new option to block non-Japanese comments. 91 87 92 = 1.2.1 = 88 93 * Fix a minor bug -
tiny-comment-spam-blocker/trunk/tiny-comment-spam-blocker.php
r3404807 r3420136 3 3 * Plugin Name: Tiny Comment Spam Blocker 4 4 * Description: Lightweight but robust. Blocks comment spam with five techniques: nonce, submission time checks, honeypot fields, user agent validation, and forbidden word filtering. 5 * Version: 1. 2.15 * Version: 1.3.0 6 6 * Author: Kasuga 7 7 * License: GPLv2 or later … … 90 90 add_option( 'tcsb_time_threshold', 5 ); 91 91 add_option( 'tcsb_badwords_list', TCSB_DEFAULT_BADWORDS ); 92 // NEW: Add default option for skipping spam check for Japanese comments. 93 add_option( 'tcsb_enable_japanese_skip', false ); 92 94 } 93 95 … … 155 157 'sanitize_callback' => 'sanitize_textarea_field', 156 158 'default' => TCSB_DEFAULT_BADWORDS, 159 ) 160 ); 161 // NEW: Register setting for Japanese comment skip. 162 register_setting( 163 'tcsb_settings_group', 164 'tcsb_enable_japanese_skip', 165 array( 166 'type' => 'boolean', 167 'sanitize_callback' => 'rest_sanitize_boolean', 168 'default' => false, 157 169 ) 158 170 ); … … 267 279 <th scope="row"><?php esc_html_e( 'Forbidden Words List', 'tiny-comment-spam-blocker' ); ?></th> 268 280 <td> 269 <textarea name="tcsb_badwords_list" rows="10" cols="50" style="font-family: monospace;"><?php echo esc_textarea( get_option( 'tcsb_badwords_list', TCSB_DEFAULT_BADWORDS ) ); // ★定数を使用?></textarea>281 <textarea name="tcsb_badwords_list" rows="10" cols="50" style="font-family: monospace;"><?php echo esc_textarea( get_option( 'tcsb_badwords_list', TCSB_DEFAULT_BADWORDS ) ); ?></textarea> 270 282 <p class="description"><?php esc_html_e( 'Enter one forbidden word or phrase per line. Case is not sensitive.', 'tiny-comment-spam-blocker' ); ?></p> 271 283 <p class="description"><?php esc_html_e( 'NOTE: The badwords list applies to the comment content, email address, and IP address.', 'tiny-comment-spam-blocker' ); ?></p> 284 </td> 285 </tr> 286 <tr valign="top"> 287 <th scope="row"><?php esc_html_e( 'Block No Japanese Comments', 'tiny-comment-spam-blocker' ); ?></th> 288 <td> 289 <input type="checkbox" name="tcsb_enable_japanese_skip" value="1" <?php checked( 1, get_option( 'tcsb_enable_japanese_skip', false ) ); ?> /> 290 <p class="description"><?php esc_html_e( 'If enabled, Comments without Japanese characters (Hiragana, Katakana, Kanji) will be blocked.', 'tiny-comment-spam-blocker' ); ?></p> 272 291 </td> 273 292 </tr> … … 357 376 * 4. Suspicious User-Agent check 358 377 * 5. Forbidden word list check 378 * 6. Japanese language check (New) 359 379 * 360 380 * @param array $commentdata The comment data to validate. … … 437 457 $email_addr 438 458 ); 459 } 460 } 461 } 462 463 // 6. Japanese language check (NEW) 464 $enable_japanese_skip = get_option( 'tcsb_enable_japanese_skip', false ); 465 466 if ( $enable_japanese_skip ) { 467 // Checks for Japanese characters (Hiragana, Katakana, Kanji) in the comment content. 468 if ( isset( $commentdata['comment_content'] ) ) { 469 if ( preg_match( '/[\p{Hiragana}\p{Katakana}\p{Han}]/u', $commentdata['comment_content'] ) ) { 470 return $commentdata; 471 } elseif ( ! empty( $commentdata['comment_content'] ) ) { 472 tcsb_handle_spam( 473 __( 'Blocked: Comment contains no Japanese characters.', 'tiny-comment-spam-blocker' ), 474 $remote_addr, 475 $email_addr 476 ); 439 477 } 440 478 } … … 482 520 } 483 521 484 // wp_die( esc_html( $message ) );485 522 wp_die( esc_html__( 'The comment submission was blocked.', 'tiny-comment-spam-blocker' ) ); 486 523 } … … 550 587 delete_option( 'tcsb_time_threshold' ); 551 588 delete_option( 'tcsb_badwords_list' ); 589 delete_option( 'tcsb_enable_japanese_skip' ); // NEW: Delete Japanese skip option. 552 590 553 591 // Delete log file and directory.
Note: See TracChangeset
for help on using the changeset viewer.