<?php namespace MailPoet\AdminPages\Pages; if (!defined('ABSPATH')) exit; use MailPoet\AdminPages\PageRenderer; use MailPoet\Listing\PageLimit; use MailPoet\Models\Segment; use MailPoet\Settings\SettingsController; use MailPoet\Settings\UserFlagsController; use MailPoet\Util\Installation; use MailPoet\Util\License\License; use MailPoet\WP\Functions as WPFunctions; class Forms { /** @var PageRenderer */ private $pageRenderer; /** @var PageLimit */ private $listingPageLimit; /** @var Installation */ private $installation; /** @var UserFlagsController */ private $userFlags; /** @var WPFunctions */ private $wp; /** @var SettingsController */ private $settings; public function __construct( PageRenderer $pageRenderer, PageLimit $listingPageLimit, Installation $installation, SettingsController $settings, UserFlagsController $userFlags, WPFunctions $wp ) { $this->pageRenderer = $pageRenderer; $this->listingPageLimit = $listingPageLimit; $this->installation = $installation; $this->userFlags = $userFlags; $this->wp = $wp; $this->settings = $settings; } public function render() { $data = []; $data['items_per_page'] = $this->listingPageLimit->getLimitPerPage('forms'); $data['segments'] = Segment::findArray(); $data['is_new_user'] = $this->installation->isNewInstallation(); $data = $this->getNPSSurveyData($data); $this->pageRenderer->displayPage('forms.html', $data); } public function getNPSSurveyData($data) { $data['display_nps_survey'] = false; if ($this->userFlags->get('display_new_form_editor_nps_survey')) { $data['current_wp_user'] = $this->wp->wpGetCurrentUser()->to_array(); $data['site_url'] = $this->wp->siteUrl(); $data['premium_plugin_active'] = License::getLicense(); $data['current_wp_user_firstname'] = $this->wp->wpGetCurrentUser()->user_firstname; $installedAtDiff = (new \DateTime($this->settings->get('installed_at')))->diff(new \DateTime()); $data['installed_days_ago'] = (int)$installedAtDiff->format('%a'); $data['display_nps_survey'] = true; $this->userFlags->set('display_new_form_editor_nps_survey', false); } return $data; } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
ExperimentalFeatures.php | File | 420 B | 0644 |
|
FormEditor.php | File | 13.31 KB | 0644 |
|
Forms.php | File | 2.2 KB | 0644 |
|
Help.php | File | 1.96 KB | 0644 |
|
Logs.php | File | 1.41 KB | 0644 |
|
MP2Migration.php | File | 730 B | 0644 |
|
NewsletterEditor.php | File | 5.93 KB | 0644 |
|
Newsletters.php | File | 6.84 KB | 0644 |
|
Premium.php | File | 923 B | 0644 |
|
Segments.php | File | 5.42 KB | 0644 |
|
Settings.php | File | 3.48 KB | 0644 |
|
Subscribers.php | File | 3.88 KB | 0644 |
|
SubscribersExport.php | File | 646 B | 0644 |
|
SubscribersImport.php | File | 1.3 KB | 0644 |
|
WelcomeWizard.php | File | 2.15 KB | 0644 |
|
WooCommerceSetup.php | File | 741 B | 0644 |
|
index.php | File | 0 B | 0644 |
|