# firebox/1.1.1/Inc/Core/Frontend.php

FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin &amp; Cart Abandonment, version 1.1.1. 103 lines.

- Page: https://pluginprobe.com/plugins/firebox/1.1.1/code/Inc/Core/Frontend.php
- Raw: https://pluginprobe.com/plugins/firebox/1.1.1/raw/Inc/Core/Frontend.php
- Modified: 2022-07-07T12:43:50+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/firebox/1.1.1/code/Inc/Core/Frontend.php#L10-L20`.

```php
<?php
/**
 * @package         FireBox
 * @version         1.1.1 Free
 * 
 * @author          FirePlugins <info@fireplugins.com>
 * @link            https://www.fireplugins.com
 * @copyright       Copyright © 2022 FirePlugins All Rights Reserved
 * @license         GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/

namespace FireBox\Core;

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

use FPFramework\Libs\Registry;

class Frontend
{
    public function __construct()
    {
		// ensure we run only on front-end
		if (is_admin())
		{
			return;
		}

		// Prepare Gutenberg Blocks that contain attributes by FireBox
		new \FireBox\Core\FB\BoxBlocksParser();

		/**
		 * Event that runs before any rendering of popups.
		 */
		do_action('firebox/boxes/before_render');

        $this->render();

		$this->init_dependencies();

		/**
		 * Event that runs after popups have been rendered.
		 */
		do_action('firebox/boxes/after_render');
	}
	
	/**
	 * Initializes the dependencies
	 * 
	 * @return  void
	 */
	private function init_dependencies()
	{
		$actions = [];
		
		

		// Initialize Sounds
		$actions[] = new \FireBox\Core\FB\Actions\Sounds();
			
		// Make actions filterable
		$actions = apply_filters('firebox/actions/box/edit', $actions);
	
		// Run actions
		new \FireBox\Core\FB\Actions\ActionsBase($actions);
	}
	
	/**
	 * Renders all boxes on front-end
	 * 
	 * @return  void
	 */
	private function render()
	{
		if ($this->checkForBoxPreview())
		{
			return;
		}

		// increment session counter
		\FPFramework\Libs\Functions::incrementSession();
		
		/**
		 * Adds all boxes at the end of page.
		 */
		add_action('wp', function() {
			firebox()->boxes->render();
		});
	}

	/**
	 * Check if we are previewing a box and do not show other boxes.
	 * 
	 * @return  boolean
	 */
	private function checkForBoxPreview()
	{
		$previewer = new Previewer();
		return $previewer->init();
	}
}
```
