| Server IP : 146.59.209.152 / Your IP : 216.73.216.152 Web Server : Apache System : Linux webm009.cluster131.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : monpetu ( 144298) PHP Version : 7.4.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/monpetu/www/benneplus/wp-content/plugins/cf7-widget-elementor/analyst/src/ |
Upload File : |
<?php
namespace Analyst;
use Analyst\Cache\DatabaseCache;
use Analyst\Contracts\CacheContract;
use Analyst\Notices\NoticeFactory;
/**
* Class Mutator mutates (modifies) UX with additional
* functional
*/
class Mutator
{
protected $notices = [];
/**
* @var NoticeFactory
*/
protected $factory;
/**
* @var CacheContract
*/
protected $cache;
public function __construct()
{
$this->factory = NoticeFactory::instance();
$this->notices = $this->factory->getNotices();
$this->cache = DatabaseCache::getInstance();
}
/**
* Register filters all necessary stuff.
* Can be invoked only once.
*
* @return void
*/
public function initialize()
{
$this->registerLinks();
$this->registerAssets();
$this->registerHooks();
}
/**
* Register all necessary filters and templates
*
* @return void
*/
protected function registerLinks()
{
add_action('admin_footer', function () {
analyst_require_template('optout.php', [
'shieldImage' => analyst_assets_url('img/shield_question.png')
]);
analyst_require_template('optin.php');
analyst_require_template('forms/deactivate.php', [
'pencilImage' => analyst_assets_url('img/pencil.png'),
'smileImage' => analyst_assets_url('img/smile.png'),
]);
analyst_require_template('forms/install.php', [
'pluginToInstall' => $this->cache->get('plugin_to_install'),
'shieldImage' => analyst_assets_url('img/shield_success.png'),
]);
});
add_action('admin_notices',function () {
foreach ($this->notices as $notice) {
analyst_require_template('notice.php', ['notice' => $notice]);
}
});
}
/**
* Register all assets
*/
public function registerAssets()
{
add_action('admin_enqueue_scripts', function () {
wp_enqueue_style('analyst_custom', analyst_assets_url('/css/customize.css'));
wp_enqueue_script('analyst_custom', analyst_assets_url('/js/customize.js'));
});
}
/**
* Register action hooks
*/
public function registerHooks()
{
add_action('wp_ajax_analyst_notification_dismiss', function () {
$this->factory->remove($_POST['id']);
$this->factory->sync();
});
}
}