<?php

namespace FSPoster\App\Controller;

use FSPoster\App\Controller\Popups\App;
use FSPoster\App\Controller\Popups\Schedule;
use FSPoster\App\Controller\Popups\Share;
use FSPoster\App\Controller\Popups\SocialAccounts;

class Popups
{

	use SocialAccounts,
		App,
		Share,
		Schedule;

	public function __construct()
	{
		$methods = get_class_methods($this);

		foreach ($methods AS $method)
		{
			if( $method == '__construct' )
			{
				continue;
			}

			add_action( 'wp_ajax_popup_' . $method, function() use( $method )
			{
				define('MODAL' , true);
				$this->$method();
				exit();
			});
		}
	}

}
