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/Core/wordpress/content.php +0 -235 10.11.1 → 11.1.1 View file →
@@ -1,235 +1,0 @@
1 -<?php
2 -
3 -function acym_cmsModal(
4 - bool $isIframe,
5 - string $content,
6 - string $buttonText,
7 - bool $isButton,
8 - string $modalTitle,
9 - ?string $identifier = null,
10 - int $width = 800,
11 - int $height = 400
12 -): string {
13 - add_thickbox();
14 -
15 - $class = $isButton ? ' button' : '';
16 -
17 - if ($isIframe) {
18 - return '<a href="'.$content.'&TB_iframe=true&width='.$width.'&height='.$height.'" class="thickbox'.$class.'">'.acym_translation($buttonText).'</a>';
19 - } else {
20 - if (empty($identifier)) {
21 - $identifier = 'identifier_'.rand(1000, 9000);
22 - }
23 -
24 - return '<div id="'.$identifier.'" style="display:none;">'.$content.'</div>
25 - <a href="#TB_inline?width='.$width.'&height='.$height.'&inlineId='.$identifier.'" class="thickbox'.$class.'">'.acym_translation($buttonText).'</a>';
26 - }
27 -}
28 -
29 -function acym_CMSArticleTitle(int $id): string
30 -{
31 - $title = acym_loadResult('SELECT post_title FROM #__posts WHERE ID = '.intval($id));
32 -
33 - return empty($title) ? '' : $title;
34 -}
35 -
36 -function acym_getArticleURL(int $id, bool $popup, string $text): string
37 -{
38 - if (empty($id)) {
39 - return '';
40 - }
41 -
42 - $url = get_permalink($id);
43 -
44 - if ($popup) {
45 - $url .= (strpos($url, '?') ? '&' : '?').acym_noTemplate();
46 - $url = acym_frontModal($url, $text, false);
47 - } else {
48 - $url = '<a title="'.acym_translation($text, true).'" href="'.acym_escape($url).'" target="_blank">'.acym_translation($text).'</a>';
49 - }
50 -
51 - return $url;
52 -}
53 -
54 -function acym_articleSelectionPage(): string
55 -{
56 - return admin_url('admin-ajax.php').'?action=acymailing_router&page=acymailing_configuration&ctrl=configuration&task=getarticles&'.acym_getFormToken();
57 -}
58 -
59 -function acym_getPageOverride(string $ctrl, string $view, bool $forceBackend = false): string
60 -{
61 - return ACYM_OVERRIDES.$ctrl.DS.$view.'.php';
62 -}
63 -
64 -function acym_cmsCleanHtml(string $html): string
65 -{
66 - if (strpos($html, '<!-- wp:') === false) return $html;
67 -
68 - $elementsToRemove = [
69 - 'shortcode',
70 - 'core-embed/.*',
71 - 'video .*',
72 - 'audio .*',
73 - ];
74 -
75 - $replacements = [
76 - '#<!-- wp:core-embed/vimeo.*"url":"([^"]+)".+<!-- /wp:core-embed/vimeo -->#Uis' => '{vimeo}$1{/vimeo}',
77 - '#<!-- wp:core-embed/youtube.*"url":"([^"]+)".+<!-- /wp:core-embed/youtube -->#Uis' => '{youtube}$1{/youtube}',
78 - '#<!-- wp:embed .*"url":"([^"]+)".+"providerNameSlug":"vimeo".+<!-- /wp:embed -->#Uis' => '{vimeo}$1{/vimeo}',
79 - '#<!-- wp:embed .*"url":"([^"]+)".+"providerNameSlug":"youtube".+<!-- /wp:embed -->#Uis' => '{youtube}$1{/youtube}',
80 - '#<a [^>]*wp-block-file__button[^>]*>[^<]*</a>#Uis' => '',
81 - ];
82 -
83 - foreach ($elementsToRemove as $oneElement) {
84 - $replacements['#<!-- wp:'.$oneElement.' -->.*<!-- /wp:'.$oneElement.' -->#Uis'] = '';
85 - }
86 -
87 - $cleanText = preg_replace(array_keys($replacements), $replacements, $html);
88 - if (!empty($cleanText)) $html = $cleanText;
89 -
90 - $html .= '<style type="text/css">
91 - .wp-block-media-text {
92 - display: grid;
93 - grid-template-rows: auto;
94 - align-items: center;
95 - grid-template-areas: "media-text-media media-text-content";
96 - grid-template-columns: 50% auto;
97 - }
98 - .wp-block-media-text .wp-block-media-text__media {
99 - grid-area: media-text-media;
100 - margin: 0;
101 - }
102 - .wp-block-media-text .wp-block-media-text__content {
103 - word-break: break-word;
104 - grid-area: media-text-content;
105 - padding: 0 8%;
106 - }
107 -
108 - .wp-block-columns {
109 - display: flex !important;
110 - flex-wrap: nowrap;
111 - }
112 - .wp-block-columns .wp-block-column {
113 - flex-basis: 100%;
114 - flex-grow: 0;
115 - }
116 -
117 - table.wp-block-table td {
118 - padding: 1em 1.41575em !important;
119 - }
120 -
121 - .wp-block-preformatted, .wp-block-code, .wp-block-verse {
122 - padding: 1.618em;
123 - }
124 -
125 - .wp-block-file {
126 - margin: 20px 0;
127 - }
128 -
129 - .wp-block-cover, .wp-block-cover-image {
130 - -webkit-box-orient: horizontal;
131 - -webkit-box-direction: normal;
132 - -webkit-flex-flow: row wrap;
133 - flex-flow: row wrap;
134 - position: relative;
135 - background-color: #000;
136 - background-size: cover;
137 - background-position: 50%;
138 - min-height: 430px;
139 - width: 100%;
140 - margin: 0 0 1.5em;
141 - display: flex;
142 - justify-content: center;
143 - align-items: center;
144 - overflow: hidden;
145 - }
146 - .wp-block-cover-image.has-background-dim:before, .wp-block-cover.has-background-dim:before {
147 - content: "";
148 - position: absolute;
149 - top: 0;
150 - left: 0;
151 - bottom: 0;
152 - right: 0;
153 - background-color: inherit;
154 - opacity: .5;
155 - z-index: 1;
156 - }
157 - .wp-block-cover p {
158 - font-size: 1.618em;
159 - font-weight: 300;
160 - line-height: 1.618;
161 - padding: 1em;
162 - color: #fff !important;
163 - z-index: 1;
164 - }
165 -
166 - .wp-block-gallery {
167 - margin: 0 0 1.41575em;
168 - display: flex;
169 - flex-wrap: wrap;
170 - list-style-type: none;
171 - padding: 0;
172 - }
173 - .blocks-gallery-item {
174 - margin-left: auto;
175 - margin-right: auto;
176 - }
177 - </style>';
178 -
179 - return $html;
180 -}
181 -
182 -function acym_getAlias(string $name): string
183 -{
184 - return sanitize_title_with_dashes(remove_accents($name));
185 -}
186 -
187 -function acym_getAllPages(): array
188 -{
189 - $allPges = get_pages();
190 - if (empty($allPges)) return [];
191 -
192 - $return = [];
193 -
194 - foreach ($allPges as $page) {
195 - $return[$page->ID] = $page->post_title;
196 - }
197 -
198 - return $return;
199 -}
200 -
201 -function acym_getArticles(string $search): array
202 -{
203 - $return = [];
204 -
205 - $search_results = new WP_Query(
206 - [
207 - 's' => $search,
208 - 'post_status' => 'publish',
209 - 'ignore_sticky_posts' => 1,
210 - 'post_type' => ['page', 'post'],
211 - 'posts_per_page' => 20,
212 - ]
213 - );
214 -
215 - if ($search_results->have_posts()) {
216 - while ($search_results->have_posts()) {
217 - $search_results->the_post();
218 - $return[] = [$search_results->post->ID, $search_results->post->post_title];
219 - }
220 - }
221 -
222 - return $return;
223 -}
224 -
225 -function acym_getArticleById(int $id): array
226 -{
227 - $post = get_post($id);
228 -
229 - if (empty($post)) return [];
230 -
231 - return [
232 - 'id' => $post->ID,
233 - 'title' => $post->post_title,
234 - ];
235 -}