| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package FirePlugins Framework |
| 4 |
* @version 1.2.3 |
| 5 |
* |
| 6 |
* @author FirePlugins <[email protected]> |
| 7 |
* @link https://www.fireplugins.com |
| 8 |
* @copyright Copyright © 2026 FirePlugins All Rights Reserved |
| 9 |
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later |
| 10 |
*/ |
| 11 |
|
| 12 |
namespace FPFramework\Base; |
| 13 |
|
| 14 |
if (!defined('ABSPATH')) |
| 15 |
{ |
| 16 |
exit; // Exit if accessed directly. |
| 17 |
} |
| 18 |
|
| 19 |
// @deprecated - Use \FPFramework\Base\Conditions\ConditionsHelper; |
| 20 |
class Assignments |
| 21 |
{ |
| 22 |
/** |
| 23 |
* Factory object |
| 24 |
* |
| 25 |
* @var \FPFramework\Base\Factory |
| 26 |
*/ |
| 27 |
protected $factory; |
| 28 |
|
| 29 |
/** |
| 30 |
* Assignments to Conditions map. |
| 31 |
* |
| 32 |
* @deprecated To be removed Early/Mid 2024 |
| 33 |
*/ |
| 34 |
protected $typeAliases = [ |
| 35 |
'date' => 'Date\Date', |
| 36 |
'time' => 'Date\Time', |
| 37 |
'ip' => 'IP', |
| 38 |
'url' => 'URL', |
| 39 |
'timeonsite' => 'TimeOnSite', |
| 40 |
'posts' => 'WP\Posts', |
| 41 |
'pages' => 'WP\Pages', |
| 42 |
'cpts' => 'WP\CustomPostTypes', |
| 43 |
'tags' => 'WP\Tags', |
| 44 |
'categories' => 'WP\Categories', |
| 45 |
'device' => 'Device', |
| 46 |
'browser' => 'Browser', |
| 47 |
'os' => 'OS', |
| 48 |
'city' => 'Geo\City', |
| 49 |
'country' => 'Geo\Country', |
| 50 |
'continent' => 'Geo\Continent', |
| 51 |
'fbform' => 'FireBox\Form', |
| 52 |
'menu' => 'WP\Menu', |
| 53 |
'grouplevel' => 'WP\UserGroup', |
| 54 |
'userid' => 'WP\UserID', |
| 55 |
'pageviews' => 'Pageviews', |
| 56 |
'onotherbox' => 'FireBox\Popup', |
| 57 |
'language' => 'WP\Language', |
| 58 |
'referrer' => 'Referrer', |
| 59 |
'cookie' => 'Cookie', |
| 60 |
'php' => 'PHP', |
| 61 |
]; |
| 62 |
|
| 63 |
/** |
| 64 |
* Constructor |
| 65 |
*/ |
| 66 |
public function __construct($factory = null) |
| 67 |
{ |
| 68 |
$this->factory = is_null($factory) ? new \FPFramework\Base\Factory() : $factory; |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* Returns the classname for a given assignment alias |
| 73 |
* |
| 74 |
* @param string $alias |
| 75 |
* @return string|void |
| 76 |
*/ |
| 77 |
public function aliasToClassname($alias) |
| 78 |
{ |
| 79 |
$alias = strtolower($alias); |
| 80 |
foreach ($this->typeAliases as $aliases => $type) |
| 81 |
{ |
| 82 |
if (strtolower($type) == $alias) |
| 83 |
{ |
| 84 |
return $type; |
| 85 |
} |
| 86 |
|
| 87 |
$aliases = explode('|', strtolower($aliases)); |
| 88 |
if (in_array($alias, $aliases)) |
| 89 |
{ |
| 90 |
return $type; |
| 91 |
} |
| 92 |
} |
| 93 |
|
| 94 |
return null; |
| 95 |
} |
| 96 |
} |