init_hooks(); } } /** * Initiate hooks. */ private function init_hooks() { add_action( 'admin_menu', [ $this, 'add_menu' ] ); add_action( 'admin_init', [ $this, 'init_options' ] ); } /** * Init admin menu. */ public function add_menu() { add_submenu_page( 'anycomment-dashboard', __( 'Integration', "anycomment" ), __( 'Integration', "anycomment" ), 'manage_options', $this->page_slug, [ $this, 'page_html' ] ); } /** * Init options. * @return bool False on failure. */ public function init_options() { add_settings_section( 'section_integration', __( 'Generic', "anycomment" ), function () { ?>

page_slug ); $integrations = []; if ( is_plugin_active( 'akismet/akismet.php' ) ) { $integrations[] = [ 'id' => self::OPTION_AKISMET, 'title' => __( 'Akismet Anti-Spam', "anycomment" ), 'callback' => 'input_checkbox', 'description' => sprintf( __( 'Filter all new comments through Akismet Anti-Spam plugin.', "anycomment" ), "https://wordpress.org/plugins/akismet/" ) ]; } if ( is_plugin_active( 'wp-user-avatar/wp-user-avatar.php' ) ) { $integrations[] = [ 'id' => self::OPTION_WP_USER_AVATAR, 'title' => __( 'WP User Avatar', "anycomment" ), 'callback' => 'input_checkbox', 'description' => sprintf( __( 'Use WP User Avatar for handling avatars in the plugin.', "anycomment" ), "https://wordpress.org/plugins/wp-user-avatar/" ) ]; } $this->render_fields( $this->page_slug, 'section_integration', $integrations ); return true; } /** * Check whether Akismet filtration enabled or not. * * @return bool */ public static function isAkismetOn() { return static::instance()->getOption( self::OPTION_AKISMET ) !== null; } /** * Check whether WP User Avatar is enabled or not. * * @since 0.0.3 * @return bool */ public static function isWPUserAvatarOn() { return static::instance()->getOption( self::OPTION_WP_USER_AVATAR ) !== null; } } endif;