'; public function __construct() { add_action( 'admin_menu', array( $this, 'oc_sp_admin_page' ) ); add_action( 'network_admin_menu', array( $this, 'oc_sp_admin_page' ) ); $base = new OnecomSp(); $this->is_premium = onecomsp_is_premium(); } public function oc_sp_admin_page() { $menu_title = __( 'Spam Protection', $this->text_domain ); add_menu_page( $menu_title, $menu_title, 'manage_options', 'onecom-wp-spam-protection', array( $this, 'sp_settings_page' ), 'dashicons-shield' ); add_submenu_page( 'onecom-wp-spam-protection', __( 'Spam Summary', $this->text_domain ), '' . __( 'Spam Summary', $this->text_domain ) . '', 'manage_options', 'onecom-wp-spam-protection', array( $this, 'sp_settings_page' ) ); } public function sp_settings_page() { if ( is_multisite() ) { include_once ONECOM_PLUGIN_PATH . 'inc/templates/multisite_support_banner.php'; } else { $spamlogs = oc_get_sp_options( 'onecom_sp_spam_logs' ); $total_count = isset( $spamlogs['spam_count'] ) ? $spamlogs['spam_count'] : 0; $comments = array(); $registration = array(); $failed_login = array(); $other = array(); if ( isset( $spamlogs['records'] ) && is_array( $spamlogs['records'] ) ) { foreach ( $spamlogs['records'] as $record ) { if ( strpos( $record[3], 'wp-comments-post.php' ) !== false ) { $comments[] = $record[3]; unset( $record[3] ); } elseif ( strpos( $record[3], 'action=register' ) !== false ) { $registration[] = $record[3]; unset( $record[3] ); } elseif ( strcmp( '/wp-login.php', $record[3] ) == 0 ) { $failed_login[] = $record[3]; unset( $record[3] ); } else { $other[] = $record[3]; } } } $disabled = ( ! $this->is_premium ) ? 'oc-show-modal' : ''; $disabled_class = ( ! $this->is_premium ) ? 'disabled-section' : ''; ?>