-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcleantalk-bbpress-scan.php
52 lines (44 loc) · 2.11 KB
/
cleantalk-bbpress-scan.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/*
Plugin Name: CleanTalk bbPress spam scanner
Plugin URI: https://cleantalk.org
Description: Check existing bbPress topics for spam and move to trash all found spam.
Version: 1.0.2
Author: СleanTalk <[email protected]>
Author URI: https://cleantalk.org
Text Domain: cleantalk-bbpress-scan
Domain Path: /i18n
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Check if cleantalk-spam-protect and bbpress are active
**/
if (
in_array( 'cleantalk-spam-protect/cleantalk.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) &&
in_array( 'bbpress/bbpress.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) )
) {
require_once realpath( plugin_dir_path( __FILE__ ) . '/../cleantalk-spam-protect/lib/autoloader.php' );
require_once 'inc/CleantalkBbPressScanner.php';
require_once 'inc/CleantalkBbPressChecker.php';
require_once 'inc/CleantalkBbPressListTable.php';
add_action( 'admin_menu', 'ct_bbpress_find_spam_page' );
function ct_bbpress_find_spam_page() {
$bbpress_check_spam = add_comments_page(
__( "Check bbPress for spam", 'cleantalk-spam-protect'),
__( "Find bbPress spam", 'cleantalk-spam-protect'),
'activate_plugins',
'ct_bbpress_check_spam', array( '\Cleantalk\BbPressChecker\CleantalkBbPressScanner', 'showFindSpamPage' )
);
// @ToDo uncomment this after implementing right submenu position
//remove_submenu_page( 'edit-comments.php', 'ct_bbpress_check_spam' );
}
// Ajax actions
add_action( 'wp_ajax_ajax_bbpress_scan_clear_topics', array( '\Cleantalk\BbPressChecker\CleantalkBbPressChecker', 'ct_ajax_clear_topics' ) );
add_action( 'wp_ajax_ajax_bbpress_scan_check_topics', array( '\Cleantalk\BbPressChecker\CleantalkBbPressChecker', 'ct_ajax_check_topics' ) );
add_action( 'wp_ajax_ajax_bbpress_scan_info_topics', array( '\Cleantalk\BbPressChecker\CleantalkBbPressChecker', 'ct_ajax_info' ) );
} else {
// @ToDO we have to display a notice about cleantalk plugin required
}