PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.1.4
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.1.4
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.1.4, at back/Core/AcymView.php

146 lines 5.6 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()
27 {
28 return $this->name;
29 }
30
31 public function getLayout()
32 {
33 return acym_getVar('cmd', 'layout', acym_getVar('cmd', 'task', 'listing'));
34 }
35
36 public function setLayout($value)
37 {
38 acym_setVar('layout', $value);
39 }
40
41 public function display($controller, $data = [])
42 {
43 $name = $this->getName();
44 $view = $this->getLayout();
45
46 if (method_exists($this, $view)) $this->$view();
47
48 $viewFolder = acym_isAdmin() ? ACYM_VIEW : ACYM_VIEW_FRONT;
49 if (!file_exists($viewFolder.ucfirst($name).DS.'tmpl'.DS.$view.'.php')) {
50 $view = 'listing';
51 }
52 $getCleanView = ($name !== 'archive' && $view !== 'listing') && ($name !== 'frontusers' || $view !== 'profile');
53 if (ACYM_CMS === 'wordpress' && $getCleanView) {
54 echo ob_get_clean();
55 }
56
57 if (ACYM_CMS !== 'wordpress' || ($name === 'frontusers' && ($view === 'unsubscribe' || $view === 'unsubscribepage')) || !defined(
58 'DOING_AJAX'
59 ) || !DOING_AJAX || ($name === 'archive' && $view === 'view')) {
60 acym_loadAssets($name, $view);
61 $controller->loadScripts($view);
62 }
63
64 if (!empty($_SESSION['acynotif'])) {
65 echo implode('', $_SESSION['acynotif']);
66 $_SESSION['acynotif'] = [];
67 }
68
69 $outsideForm = (strpos($name, 'mails') !== false && $view === 'edit') || (strpos($name, 'campaigns') !== false && $view === 'edit_email');
70 if ($outsideForm) {
71 echo '<form id="acym_form" action="'.acym_completeLink(
72 acym_getVar('cmd', 'ctrl')
73 ).'" class="acym__form__mail__edit" method="post" name="acyForm" data-abide novalidate enctype="multipart/form-data">';
74 }
75
76 if (acym_getVar('cmd', 'task') != 'ajaxEncoding') {
77 echo '<div id="acym_wrapper" class="'.$name.'_'.$view.' cms_'.ACYM_CMS.' cms_v_'.substr(ACYM_CMSV, 0, 1).'">';
78 }
79
80 if (acym_isLeftMenuNecessary()) {
81 echo acym_getLeftMenu($name).'<div id="acym_content">';
82 }
83
84 if (!empty($data['header'])) {
85 echo $data['header'];
86 }
87
88 $remindme = json_decode($this->config->get('remindme', '[]'), true);
89 if ($this->config->get('walk_through', 0) == 0) {
90 if (acym_isAdmin()) {
91 if (!in_array('multilingual', $remindme) && acym_level(ACYM_ESSENTIAL) && $this->config->get('multilingual', '0') === '0') {
92 if (count(acym_getLanguages(false, true)) > 1) {
93 $message = acym_translation('ACYM_MULTILINGUAL_OPTIONS_PROMPT');
94 $message .= ' <a id="acym__multilingual__reminder" href="'.acym_completeLink('configuration&task=multilingual').'">'.acym_translation('ACYM_YES').'</a>';
95 $message .= ' / <a href="#" title="multilingual" class="acym__do__not__remindme__multilingual">'.acym_translation('ACYM_NO').'</a>';
96 acym_display($message, 'info', false);
97 } else {
98 $remindme[] = 'multilingual';
99 $this->config->save(['remindme' => json_encode($remindme)]);
100 }
101 }
102
103 $maliciousScan = $this->config->get('malicious_scan', 0);
104 if (!empty($maliciousScan)) {
105 $this->config->save(['malicious_scan' => 0]);
106 acym_display(acym_translation('ACYM_NEW_SECURITY_TOOL'), 'info');
107 }
108 }
109 }
110
111 acym_trigger('acym_displayTrackingMessage', [&$message], 'plgAcymWoocommerce');
112
113 if (acym_isAdmin()) {
114 acym_trigger('onAcymDisplayPage');
115 acym_displayMessages();
116 }
117
118 include acym_getView($name, $view);
119
120 if (acym_isLeftMenuNecessary()) echo '</div>';
121 if (acym_getVar('cmd', 'task') != 'ajaxEncoding') {
122 echo '</div>';
123 }
124
125 if ($outsideForm) {
126 echo '</form>';
127 }
128
129 if (ACYM_CMS !== 'wordpress' || !acym_isAdmin()) {
130 return;
131 }
132
133 $remind = json_decode($this->config->get('remindme', '[]'));
134 $installationDate = $this->config->get('install_date', time());
135
136 if (!in_array('reviews', $remind) && !in_array($controller->name, ['dashboard', 'language']) && $installationDate < time() - 7 * 86400) {
137 echo '<div id="acym__reviews__footer" style="margin: 0 0 30px 30px;">';
138 echo acym_translationSprintf(
139 'ACYM_REVIEW_FOOTER',
140 '<a title="reviews" id="acym__reviews__footer__link" target="_blank" href="https://wordpress.org/support/plugin/acymailing/reviews/?rate=5#new-post"><i class="acymicon-star acym__color__light-blue"></i><i class="acymicon-star acym__color__light-blue"></i><i class="acymicon-star acym__color__light-blue"></i><i class="acymicon-star acym__color__light-blue"></i><i class="acymicon-star acym__color__light-blue"></i></a>'
141 );
142 echo '</div>';
143 }
144 }
145 }
146