PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.10.2
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.10.2
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
acymailing / back / Core / AcymView.php

AcymView.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 10.10.2, at back/Core/AcymView.php

150 lines 5.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace AcyMailing\Core;
4
5 abstract class AcymView extends AcymObject
6 {
7 public string $name = '';
8 protected array $steps = [];
9 protected string $step = '';
10
11 public array $tabs = [];
12
13 public function __construct()
14 {
15 parent::__construct();
16
17 $classname = get_class($this);
18 $classname = substr($classname, strrpos($classname, '\\') + 1);
19 $this->name = strtolower(substr($classname, 0, -4));
20 $this->step = acym_getVar('string', 'nextstep', '');
21 if (empty($this->step)) {
22 $this->step = acym_getVar('string', 'step', '');
23 }
24 }
25
26 public function getName(): string
27 {
28 return $this->name;
29 }
30
31 public function getLayout(): string
32 {
33 return acym_getVar('cmd', 'layout', acym_getVar('cmd', 'task', 'listing'));
34 }
35
36 public function display(object $controller, array $data = []): void
37 {
38 $name = $this->getName();
39 $view = $this->getLayout();
40
41 if (method_exists($this, $view)) $this->$view();
42
43 $viewFolder = acym_isAdmin() ? ACYM_VIEW : ACYM_VIEW_FRONT;
44 if (!file_exists($viewFolder.ucfirst($name).DS.'tmpl'.DS.$view.'.php')) {
45 $view = 'listing';
46 }
47 $getCleanView = ($name !== 'archive' && $view !== 'listing') && ($name !== 'frontusers' || $view !== 'profile');
48 if (ACYM_CMS === 'wordpress' && $getCleanView) {
49 echo ob_get_clean();
50 }
51
52 if (
53 ACYM_CMS !== 'wordpress'
54 || ($name === 'frontusers' && ($view === 'unsubscribe' || $view === 'unsubscribepage'))
55 || !defined('DOING_AJAX')
56 || !DOING_AJAX
57 || ($name === 'archive' && $view === 'view')
58 ) {
59 acym_loadAssets($name, $view);
60 $controller->loadScripts($view);
61 }
62
63 if (!empty($_SESSION['acynotif'])) {
64 echo implode('', $_SESSION['acynotif']);
65 $_SESSION['acynotif'] = [];
66 }
67
68 $outsideForm = (strpos($name, 'mails') !== false && $view === 'edit') || (strpos($name, 'campaigns') !== false && $view === 'edit_email');
69 if ($outsideForm) {
70 echo '<form id="acym_form" action="'.acym_completeLink(
71 acym_getVar('cmd', 'ctrl')
72 ).'" class="acym__form__mail__edit" method="post" name="acyForm" data-abide novalidate enctype="multipart/form-data">';
73 }
74
75 if (acym_getVar('cmd', 'task') !== 'ajaxEncoding') {
76 echo '<div id="acym_wrapper" class="'.$name.'_'.$view.' cms_'.ACYM_CMS.' cms_v_'.substr(ACYM_CMSV, 0, 1).'">';
77 }
78
79 if (acym_isLeftMenuNecessary()) {
80 echo acym_getLeftMenu($name).'<div id="acym_content">';
81 }
82
83 if (!empty($data['header'])) {
84 echo $data['header'];
85 }
86
87 $remindme = json_decode($this->config->get('remindme', '[]'), true);
88 if ($this->config->get('walk_through', 0) == 0) {
89 if (acym_isAdmin()) {
90 if (!in_array('multilingual', $remindme) && acym_level(ACYM_ESSENTIAL) && $this->config->get('multilingual', '0') === '0') {
91 if (count(acym_getLanguages(false, true)) > 1) {
92 $message = acym_translation('ACYM_MULTILINGUAL_OPTIONS_PROMPT');
93 $message .= ' <a id="acym__multilingual__reminder" href="'.acym_completeLink('configuration&task=multilingual').'">'.acym_translation('ACYM_YES').'</a>';
94 $message .= ' / <a href="#" title="multilingual" class="acym__do__not__remindme__multilingual">'.acym_translation('ACYM_NO').'</a>';
95 acym_display($message, 'info', false);
96 } else {
97 $remindme[] = 'multilingual';
98 $this->config->saveConfig(['remindme' => json_encode($remindme)]);
99 }
100 }
101
102 $maliciousScan = $this->config->get('malicious_scan', 0);
103 if (!empty($maliciousScan)) {
104 $this->config->saveConfig(['malicious_scan' => 0]);
105 acym_display(acym_translation('ACYM_NEW_SECURITY_TOOL'), 'info');
106 }
107 }
108 }
109
110 acym_trigger('acym_displayTrackingMessage', [&$message], 'plgAcymWoocommerce');
111
112 if (acym_isAdmin()) {
113 acym_trigger('onAcymDisplayPage');
114 acym_displayMessages();
115 }
116
117 include acym_getView($name, $view);
118
119 if (acym_isLeftMenuNecessary()) {
120 echo '</div>';
121 }
122
123 if (acym_getVar('cmd', 'task') !== 'ajaxEncoding') {
124 echo '</div>';
125 }
126
127 if ($outsideForm) {
128 echo '</form>';
129 }
130
131 if (ACYM_CMS !== 'wordpress' || !acym_isAdmin() || in_array($controller->name, ['dashboard', 'language', 'campaigns']) || acym_isAjax()) {
132 return;
133 }
134
135 $remind = json_decode($this->config->get('remindme', '[]'));
136 $installationDate = $this->config->get('install_date', time());
137 $sevenDaysAgo = time() - 7 * 86400;
138
139 if (!in_array('reviews', $remind) && $installationDate < $sevenDaysAgo) {
140 echo '<div id="acym__reviews__footer" style="margin: 0 0 30px 30px;">';
141 echo acym_translationSprintf(
142 'ACYM_REVIEW_FOOTER',
143 '<a title="reviews" id="acym__reviews__footer__link" target="_blank" href="https://wordpress.org/support/plugin/acymailing/reviews/?rate=5#new-post">
144 '.str_repeat('<i class="acymicon-star"></i>', 5).'</a>'
145 );
146 echo '</div>';
147 }
148 }
149 }
150