<?php

namespace TotalTheme\Hooks;

defined( 'ABSPATH' ) || exit;

/**
 * Hooks into "wp_list_categories".
 */
final class WP_Prepare_Themes_For_JS {

	/**
	 * Static-only class.
	 */
	private function __construct() {}

	/**
	 * Callback method.
	 */
	public static function callback( $themes ) {
		if ( isset( $themes['Total'] ) ) {
			$total_theme = $themes['Total'];
			if ( isset( $total_theme['author'] ) && 'WPExplorer' === $total_theme['author'] ) {
				if ( isset( $total_theme['description'] ) && is_string( $total_theme['description'] ) ) {
					$total_theme['description'] .=
					'<p><a href="https://totalwptheme.com/docs/" target="_blank" rel="noopener">' . sprintf( esc_html__( 'Documentation %s', 'total' ), '↗' ) . '</a> | <a href="https://totalwptheme.com/docs/changelog/" target="_blank" rel="noopener">' . sprintf( esc_html__( 'Changelog %s', 'total' ), '↗' ) . '</a></p>';
				}
				$themes['Total'] = $total_theme;
			}
		}
		return $themes;
	}

}
