<?php
/**
 * Site Info Class
 *
 * @package errigal
 * @since 1.1.0
 */

namespace Errigal\Shared;

defined( 'ABSPATH' ) || exit;

/**
 * This class is in charge of providing site info functions.
 *
 * @since 1.1.0
 */
class Errigal_Site_Info {
	/**
	 * Title: blogname.
	 *
	 * @since 1.1.0
	 *
	 * @var string
	 */
	private const TITLE = 'name';

	/**
	 * Description: blogdescription.
	 *
	 * @since 1.1.0
	 *
	 * @var string
	 */
	private const DESCRIPTION = 'description';

	/**
	 * Charset: blog_charset.
	 *
	 * @since 1.1.0
	 *
	 * @var string
	 */
	private const CHARSET = 'charset';

	/**
	 * Pingback URL.
	 *
	 * @since 1.1.0
	 *
	 * @var string
	 */
	private const PINGBACK_URL = 'pingback_url';

	/**
	 * Gets title.
	 *
	 * @since 1.1.0
	 *
	 * @return string
	 */
	public static function get_title() {
		return esc_html( get_bloginfo( self::TITLE ) );
	}

	/**
	 * Gets description.
	 *
	 * @since 1.1.0
	 *
	 * @return string
	 */
	public static function get_description() {
		return esc_html( get_bloginfo( self::DESCRIPTION ) );
	}

	/**
	 * Gets charset.
	 *
	 * @since 1.1.0
	 *
	 * @return string
	 */
	public static function get_charset() {
		return esc_attr( get_bloginfo( self::CHARSET ) );
	}

	/**
	 * Gets pingback URL.
	 *
	 * @since 1.1.0
	 *
	 * @return string
	 */
	public static function get_pingback_url() {
		return esc_url( get_bloginfo( self::PINGBACK_URL ) );
	}

	/**
	 * Gets home URL.
	 *
	 * @since 1.1.0
	 *
	 * @return string
	 */
	public static function get_home_url() {
		return esc_url( trailingslashit( home_url() ) );
	}

	/**
	 * Gets home link text.
	 *
	 * @since 1.2.0
	 *
	 * @return string
	 */
	public static function get_home_link_text() {
		return esc_html__( 'Home', 'errigal' );
	}
}
