# firebox/3.1.10/Inc/Core/Admin/Capabilities.php

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

- Page: https://pluginprobe.com/plugins/firebox/3.1.10/code/Inc/Core/Admin/Capabilities.php
- Raw: https://pluginprobe.com/plugins/firebox/3.1.10/raw/Inc/Core/Admin/Capabilities.php
- Modified: 2026-08-18T13:53: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/3.1.10/code/Inc/Core/Admin/Capabilities.php#L10-L20`.

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

namespace FireBox\Core\Admin;

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

class Capabilities
{
	public function __construct()
	{
		$this->setup();
	}

	public static function getCapabilities()
	{
		return [
			'edit_firebox',
			'read_firebox',
			'delete_firebox',
			'edit_fireboxes',
			'edit_others_fireboxes',
			'publish_fireboxes',
			'read_private_fireboxes',
			'read_fireboxes',
			'delete_fireboxes',
			'delete_private_fireboxes',
			'delete_published_fireboxes',
			'delete_others_fireboxes',
			'edit_private_fireboxes',
			'edit_published_fireboxes'
		];
	}

	private function setup()
	{
		$capabilities = self::getCapabilities();

		$admin = get_role('administrator');

		if ($admin)
		{
			self::addCapabilities($admin, $capabilities);
		}
		else
		{
			$roles = get_editable_roles();

			foreach ($roles as $role_name => $data)
			{
				if (isset($data['capabilities']['manage_options']) && $data['capabilities']['manage_options'])
				{
					$role = get_role($role_name);

					if ($role)
					{
						self::addCapabilities($role, $capabilities);
					}
				}
			}
		}

        wp_get_current_user()->get_role_caps();
	}

	/**
	 * Adds the capabilities a role is missing.
	 *
	 * add_cap() writes the role option on every call, and this now runs on
	 * every site of a network, so only the missing ones are added.
	 *
	 * @param   \WP_Role  $role
	 * @param   array     $capabilities
	 *
	 * @return  void
	 */
	private static function addCapabilities($role, $capabilities)
	{
		foreach ($capabilities as $cap)
		{
			if ($role->has_cap($cap))
			{
				continue;
			}

			$role->add_cap($cap);
		}
	}
}
```
