HEX
Server: LiteSpeed
System: Linux onyx.7ho.st 5.14.0-611.13.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 11 04:57:59 EST 2025 x86_64
User: atiscoir (1242)
PHP: 8.1.34
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open
Upload Files
File: /home/atiscoir/public_html/wp-content/plugins/simple-history/loggers/class-export-logger.php
<?php

namespace Simple_History\Loggers;

use Simple_History\Helpers;

/**
 * Logs WordPress exports
 */
class Export_Logger extends Logger {
	/** @var string Logger slug */
	public $slug = 'SimpleExportLogger';

	/**
	 * Get array with information about this logger
	 *
	 * @return array
	 */
	public function get_info() {
		return array(
			'name'        => __( 'Export Logger', 'simple-history' ),
			'description' => __( 'Logs updates to WordPress export', 'simple-history' ),
			'capability'  => 'export',
			'messages'    => array(
				'created_export' => __( 'Created XML export', 'simple-history' ),
			),
			'labels'      => array(
				'search' => array(
					'label'   => _x( 'Export', 'Export logger: search', 'simple-history' ),
					'options' => array(
						_x( 'Created exports', 'Export logger: search', 'simple-history' ) => array(
							'created_export',
						),
					),
				),
			),
		);
	}

	/**
	 * Called when logger is loaded
	 */
	public function loaded() {
		add_action( 'export_wp', array( $this, 'on_export_wp' ), 10, 1 );
	}

	/**
	 * Called when export is created.
	 * Fired from filter "export_wp".
	 *
	 * @param array $args Arguments passed to export_wp().
	 */
	public function on_export_wp( $args ) {
		$content = $args['content'] ?? '';

		$this->info_message(
			'created_export',
			array(
				'export_content' => $content,
				'export_args'    => Helpers::json_encode( $args ),
			)
		);
	}
}