PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.2.2
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.2.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 / wordpress / content.php

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

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