PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.1
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.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
← All changes | back/Helpers/Update/Cms.php +0 -138 10.10.2 → 11.1.1 View file →
@@ -1,138 +1,0 @@
1 -<?php
2 -
3 -namespace AcyMailing\Helpers\Update;
4 -
5 -use AcyMailing\Helpers\UpdatemeHelper;
6 -
7 -trait Cms
8 -{
9 - public function installTables(): void
10 - {
11 - $queries = file_get_contents(ACYM_BACK.'tables.sql');
12 - $tables = explode('CREATE TABLE IF NOT EXISTS', $queries);
13 -
14 - foreach ($tables as $oneTable) {
15 - $oneTable = trim($oneTable);
16 - if (empty($oneTable)) {
17 - continue;
18 - }
19 - acym_query('CREATE TABLE IF NOT EXISTS'.$oneTable);
20 - }
21 - }
22 -
23 - public function installLanguages(): void
24 - {
25 - $siteLanguages = acym_getLanguages();
26 - if (!empty($siteLanguages[ACYM_DEFAULT_LANGUAGE])) {
27 - unset($siteLanguages[ACYM_DEFAULT_LANGUAGE]);
28 - }
29 -
30 - $installedLanguages = array_keys($siteLanguages);
31 - if (empty($installedLanguages) || !class_exists(UpdatemeHelper::class)) {
32 - return;
33 - }
34 -
35 - ob_start();
36 - $languagesContent = UpdatemeHelper::call('public/download/translations?version=latest&codes='.implode(',', $installedLanguages));
37 - $warnings = ob_get_clean();
38 - if (!empty($warnings) && acym_isDebug()) {
39 - acym_enqueueMessage($warnings, 'warning');
40 - }
41 -
42 - if (empty($languagesContent) || $languagesContent['status'] === 'error') {
43 - acym_enqueueMessage(acym_translation('ACYM_ERROR_LOAD_LANGUAGES'), 'error');
44 -
45 - return;
46 - }
47 -
48 - $decodedLanguages = $languagesContent['translations'];
49 -
50 - $success = [];
51 - $error = [];
52 - $errorLoad = [];
53 -
54 - foreach ($decodedLanguages as $code => $content) {
55 - if (empty($content)) {
56 - $errorLoad[] = $code;
57 - continue;
58 - }
59 -
60 - $path = acym_getLanguagePath(ACYM_ROOT, $code).DS.$code.'.'.ACYM_LANGUAGE_FILE.'.ini';
61 - if (acym_writeFile($path, $content)) {
62 - $this->installBackLanguages($code);
63 - $success[] = $code;
64 - } else {
65 - $error[] = acym_translationSprintf('ACYM_FAIL_SAVE_FILE', $path);
66 - }
67 - }
68 -
69 - if (!empty($success)) acym_enqueueMessage(acym_translationSprintf('ACYM_TRANSLATION_INSTALLED', implode(', ', $success)));
70 - if (!empty($error)) acym_enqueueMessage($error, 'error');
71 - if (!empty($errorLoad)) acym_enqueueMessage(acym_translationSprintf('ACYM_ERROR_LOAD_LANGUAGE', implode(', ', $errorLoad)), 'warning');
72 - }
73 -
74 - public function installBackLanguages(string $onlyCode = ''): void
75 - {
76 - if (ACYM_CMS !== 'joomla') {
77 - return;
78 - }
79 -
80 - $menuStrings = [
81 - 'ACYM_DASHBOARD',
82 - 'ACYM_SUBSCRIBERS',
83 - 'ACYM_CUSTOM_FIELDS',
84 - 'ACYM_LISTS',
85 - 'ACYM_SEGMENTS',
86 - 'ACYM_EMAILS',
87 - 'ACYM_TEMPLATES',
88 - 'ACYM_AUTOMATION',
89 - 'ACYM_QUEUE',
90 - 'ACYM_STATISTICS',
91 - 'ACYM_BOUNCE_HANDLING',
92 - 'ACYM_ADD_ONS',
93 - 'ACYM_CONFIGURATION',
94 - 'ACYM_MENU_PROFILE',
95 - 'ACYM_MENU_PROFILE_DESC',
96 - 'ACYM_MENU_ARCHIVE',
97 - 'ACYM_MENU_ARCHIVE_DESC',
98 - 'ACYM_MENU_LISTS',
99 - 'ACYM_MENU_LISTS_DESC',
100 - 'ACYM_MENU_SUBSCRIBERS',
101 - 'ACYM_MENU_SUBSCRIBERS_DESC',
102 - 'ACYM_MENU_CAMPAIGNS',
103 - 'ACYM_MENU_CAMPAIGNS_DESC',
104 - 'ACYM_SUBSCRIPTION_FORMS',
105 - 'ACYM_EMAILS_OVERRIDE',
106 - 'ACYM_MAILBOX_ACTIONS',
107 - 'ACYM_GOPRO',
108 - 'ACYM_SCENARIO',
109 - ];
110 -
111 - $siteLanguages = empty($onlyCode) ? array_keys(acym_getLanguages()) : [$onlyCode];
112 -
113 - foreach ($siteLanguages as $code) {
114 - $path = acym_getLanguagePath(ACYM_ROOT, $code).DS.$code.'.com_acym.ini';
115 - if (!file_exists($path)) continue;
116 -
117 - $content = file_get_contents($path);
118 - if (empty($content)) continue;
119 -
120 - $menuFileContent = 'ACYM="AcyMailing"'."\r\n";
121 - $menuFileContent .= 'COM_ACYM="AcyMailing"'."\r\n";
122 - $menuFileContent .= 'COM_ACYM_CONFIGURATION="AcyMailing"'."\r\n";
123 -
124 - foreach ($menuStrings as $oneString) {
125 - preg_match('#[^_]'.$oneString.'="(.*)"#i', $content, $matches);
126 - if (empty($matches[1])) continue;
127 -
128 - $menuFileContent .= $oneString.'="'.$matches[1].'"'."\r\n";
129 - }
130 -
131 - $menuPath = ACYM_ROOT.'administrator'.DS.'language'.DS.$code.DS.$code.'.com_acym.sys.ini';
132 -
133 - if (!acym_writeFile($menuPath, $menuFileContent)) {
134 - acym_enqueueMessage(acym_translationSprintf('ACYM_FAIL_SAVE_FILE', $menuPath), 'error');
135 - }
136 - }
137 - }
138 -}