<?php
/**
 * Handles the display of logged out content shortcode generator.
 *
 * @package     wp-user-manager
 * @copyright   Copyright (c) 2018, Alessandro Tesoro
 * @license     https://opensource.org/licenses/GPL-3.0 GNU Public License
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Add registration form shortcode window to the editor.
 */
class WPUM_Shortcode_Content_Loggedout extends WPUM_Shortcode_Generator {

	/**
	 * Inject the editor for this shortcode.
	 */
	public function __construct() {
		parent::__construct( 'wpum_restrict_logged_out' );
	}

	/**
	 * Set the label and title of the shortcode.
	 *
	 * @return void
	 */
	public function set_labels() {
		$this->shortcode['title'] = esc_html__( 'Logged out only user content', 'wp-user-manager' );
		$this->shortcode['label'] = esc_html__( 'Logged out only user content', 'wp-user-manager' );
	}

	/**
	 * Setup fields for the login shortcode window.
	 *
	 * @return array
	 */
	public function define_fields() {
		return array(
			array(
				'type'    => 'listbox',
				'name'    => 'show_message',
				'label'   => esc_html__( 'Show message', 'wp-user-manager' ),
				'options' => $this->get_yes_no(),
			),
		);
	}
}

new WPUM_Shortcode_Content_Loggedout();
