PluginProbe ʕ •ᴥ•ʔ
Akismet Anti-spam: Spam Protection / 5.7
Akismet Anti-spam: Spam Protection v5.7
5.7 3.0.4 3.0.5 3.1 3.1.1 3.1.10 3.1.11 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2 3.3 3.3.1 3.3.2 3.3.3 3.3.4 4.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.1 4.1.1 4.1.10 4.1.11 4.1.12 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 5.0 5.0.1 5.0.2 5.1 5.2 5.3 5.3.1 5.3.2 5.3.3 5.3.4 5.3.5 5.3.6 5.3.7 5.4 5.5 5.6 trunk 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.4.0 2.4.1 2.5.0 2.5.1 2.5.10 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 3.0.0 3.0.0-RC1 3.0.1 3.0.2 3.0.3
akismet / class-akismet-abilities.php
akismet Last commit date
_inc 1 month ago abilities 1 month ago views 1 month ago .htaccess 1 month ago LICENSE.txt 10 years ago akismet.php 1 month ago changelog.txt 1 year ago class-akismet-abilities.php 1 month ago class-akismet-compatible-plugins.php 9 months ago class-akismet-connector.php 1 month ago class.akismet-admin.php 1 month ago class.akismet-cli.php 1 year ago class.akismet-rest-api.php 2 months ago class.akismet-widget.php 7 months ago class.akismet.php 1 month ago index.php 1 year ago readme.txt 1 month ago wrapper.php 1 year ago
class-akismet-abilities.php
92 lines
1 <?php
2 /**
3 * Registers Akismet abilities with the WordPress Abilities API.
4 *
5 * @package Akismet
6 * @since 5.7
7 */
8
9 declare( strict_types = 1 );
10
11 // Load ability interface and classes.
12 require_once __DIR__ . '/abilities/interface-akismet-ability.php';
13 require_once __DIR__ . '/abilities/class-akismet-ability.php';
14 require_once __DIR__ . '/abilities/class-akismet-ability-get-stats.php';
15 require_once __DIR__ . '/abilities/class-akismet-ability-comment-check.php';
16
17 /**
18 * Class Akismet_Abilities
19 *
20 * Registers Akismet abilities with the WordPress Abilities API.
21 * Provides abilities for spam detection and comment moderation.
22 */
23 class Akismet_Abilities {
24
25 /**
26 * The category slug for Akismet abilities.
27 *
28 * @var string
29 */
30 const CATEGORY_SLUG = 'akismet';
31
32 /**
33 * Initialize the ability registration.
34 *
35 * @return void
36 */
37 public static function init() {
38 // Register category.
39 if ( did_action( 'wp_abilities_api_categories_init' ) ) {
40 self::register_category();
41 } else {
42 add_action( 'wp_abilities_api_categories_init', array( __CLASS__, 'register_category' ) );
43 }
44
45 // Register abilities.
46 if ( did_action( 'wp_abilities_api_init' ) ) {
47 self::register_abilities();
48 } else {
49 add_action( 'wp_abilities_api_init', array( __CLASS__, 'register_abilities' ) );
50 }
51 }
52
53 /**
54 * Register the Akismet ability category.
55 *
56 * @return void
57 */
58 public static function register_category() {
59 if ( ! function_exists( 'wp_register_ability_category' ) ) {
60 return;
61 }
62
63 wp_register_ability_category(
64 self::CATEGORY_SLUG,
65 array(
66 'label' => 'Akismet',
67 'description' => __( 'Abilities for spam protection and comment moderation with Akismet.', 'akismet' ),
68 )
69 );
70 }
71
72 /**
73 * Register all Akismet abilities.
74 *
75 * @return void
76 */
77 public static function register_abilities() {
78 if ( ! function_exists( 'wp_register_ability' ) ) {
79 return;
80 }
81
82 $abilities = array(
83 Akismet_Ability_Get_Stats::class,
84 Akismet_Ability_Comment_Check::class,
85 );
86
87 foreach ( $abilities as $ability_class ) {
88 new $ability_class();
89 }
90 }
91 }
92