diff --git a/src/Managers/CleanupManager.php b/src/Managers/CleanupManager.php index a674f20..85dc5ce 100644 --- a/src/Managers/CleanupManager.php +++ b/src/Managers/CleanupManager.php @@ -18,9 +18,20 @@ * Cleanup a WordPress project for security and performance. */ class CleanupManager implements ManagerInterface { - // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** - * @inheritdoc + * Wether to enable XML RPC endpoint or not. + */ + protected bool $xml_rpc; + + /** + * Constructor. + */ + public function __construct(bool $xml_rpc = false) { + $this->xml_rpc = $xml_rpc; + } + + /** + * {@inheritdoc} */ public function run() { // Clean up . @@ -47,6 +58,8 @@ public function run() { // Remove comments from the admin menu. add_action( 'admin_menu', array( $this, 'remove_comments_from_admin_menu' ) ); + + add_action( 'xmlrpc_enabled', array( $this, 'xmlrpc_enabled' ) ); } /** @@ -152,4 +165,11 @@ public function remove_comments_from_admin_menu():void { // Remove comments admin menu item. remove_menu_page( 'edit-comments.php' ); } + + /** + * Enable or disable XML RPC endpoint. + */ + public function xmlrpc_enabled(): bool { + return $this->xml_rpc; + } }