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

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