PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.5
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.5
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / user-meta / user-interface / cleanup-integration.php

cleanup-integration.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.5, at src/user-meta/user-interface/cleanup-integration.php

59 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yoast\WP\SEO\User_Meta\User_Interface;
4
5 use Yoast\WP\SEO\Conditionals\No_Conditionals;
6 use Yoast\WP\SEO\Integrations\Integration_Interface;
7 use Yoast\WP\SEO\User_Meta\Application\Cleanup_Service;
8
9 /**
10 * Handles the cleanup for user meta.
11 */
12 class Cleanup_Integration implements Integration_Interface {
13
14 use No_Conditionals;
15
16 /**
17 * The cleanup service.
18 *
19 * @var Cleanup_Service
20 */
21 private $cleanup_service;
22
23 /**
24 * The constructor.
25 *
26 * @param Cleanup_Service $cleanup_service The cleanup service.
27 */
28 public function __construct( Cleanup_Service $cleanup_service ) {
29 $this->cleanup_service = $cleanup_service;
30 }
31
32 /**
33 * Registers action hook.
34 *
35 * @return void
36 */
37 public function register_hooks(): void {
38 \add_filter( 'wpseo_misc_cleanup_tasks', [ $this, 'add_user_meta_cleanup_tasks' ] );
39 }
40
41 /**
42 * Adds cleanup tasks for the cleanup integration.
43 *
44 * @param Closure[] $tasks Array of tasks to be added.
45 *
46 * @return Closure[] An associative array of tasks to be added to the cleanup integration.
47 */
48 public function add_user_meta_cleanup_tasks( $tasks ) {
49 return \array_merge(
50 $tasks,
51 [
52 'clean_selected_empty_usermeta' => function ( $limit ) {
53 return $this->cleanup_service->cleanup_selected_empty_usermeta( $limit );
54 },
55 ],
56 );
57 }
58 }
59