Yoast\WP\SEO\User_Meta\User_Interface

Cleanup_Integration{}Yoast 1.0

Handles the cleanup for user meta.

Хуков нет.

Использование

$Cleanup_Integration = new Cleanup_Integration();
// use class methods

Методы

  1. public __construct( Cleanup_Service $cleanup_service )
  2. public add_user_meta_cleanup_tasks( $tasks )
  3. public register_hooks()

Код Cleanup_Integration{} Yoast 25.1

class Cleanup_Integration implements Integration_Interface {

	use No_Conditionals;

	/**
	 * The cleanup service.
	 *
	 * @var Cleanup_Service
	 */
	private $cleanup_service;

	/**
	 * The constructor.
	 *
	 * @param Cleanup_Service $cleanup_service The cleanup service.
	 */
	public function __construct( Cleanup_Service $cleanup_service ) {
		$this->cleanup_service = $cleanup_service;
	}

	/**
	 * Registers action hook.
	 *
	 * @return void
	 */
	public function register_hooks(): void {
		\add_filter( 'wpseo_misc_cleanup_tasks', [ $this, 'add_user_meta_cleanup_tasks' ] );
	}

	/**
	 * Adds cleanup tasks for the cleanup integration.
	 *
	 * @param Closure[] $tasks Array of tasks to be added.
	 *
	 * @return Closure[] An associative array of tasks to be added to the cleanup integration.
	 */
	public function add_user_meta_cleanup_tasks( $tasks ) {
		return \array_merge(
			$tasks,
			[
				'clean_selected_empty_usermeta' => function ( $limit ) {
					return $this->cleanup_service->cleanup_selected_empty_usermeta( $limit );
				},
			]
		);
	}
}