PluginProbe
Depicter — Popup & Slider Builder / 1.9.2
Depicter — Popup & Slider Builder v1.9.2
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
← All changes | app/src/Front/Assets.php +42 -0 1.3.21.9.2 View file →
@@ -2,8 +2,9 @@
2 2 namespace Depicter\Front;
3 3
4 4
5 5 use Averta\Core\Utility\Arr;
6 +use Averta\WordPress\Utility\Sanitize;
6 7
7 8
8 9 class Assets
9 10 {
@@ -171,8 +172,10 @@
171 172 $this->enqueueCustomGoogleFonts( $documentID );
172 173 } else {
173 174 $this->enqueueCustomStyles( $documentID );
174 175 }
176 +
177 + do_action( 'depicter/after/enqueue/styles/' . $documentID );
175 178 }
176 179
177 180 /**
178 181 * Enqueues styles and scripts of a document
@@ -186,10 +189,14 @@
186 189 $isPrivilegedUser = is_null( $isPrivilegedUser ) ? \Depicter::authorization()->currentUserCanPublishDocument() : $isPrivilegedUser;
187 190
188 191 if ( ! did_action( 'depicter/after/enqueue/styles' ) ) {
189 192 $this->enqueueStyles();
193 + }
194 +
195 + if ( !did_action('depicter/after/enqueue/styles/' . $documentID ) ) {
190 196 $this->enqueueCustomAssets( $documentID, $isPrivilegedUser );
191 197 }
198 +
192 199 if ( ! did_action( 'depicter/after/enqueue/scripts' ) ) {
193 200 $this->enqueueScripts();
194 201 }
195 202 }
@@ -194,8 +201,33 @@
194 201 }
195 202 }
196 203
197 204 /**
205 + * Print media preload tags of a document if exists
206 + *
207 + * @param int $documentID
208 + *
209 + * @return void
210 + */
211 + public function printPreloadTags( $documentID ) {
212 + if( false !== $preloadTags = \Depicter::cache('document')->get( $documentID . '_preload_tags' ) ){
213 + echo Sanitize::html( $preloadTags );
214 + }
215 + }
216 +
217 + /**
218 + *
219 + * @param int $documentID
220 + *
221 + * @return void
222 + */
223 + public function enqueuePreloadTags( $documentID ) {
224 + add_action( 'wp_head', function () use ( $documentID ) {
225 + $this->printPreloadTags( $documentID );
226 + }, 10 );
227 + }
228 +
229 + /**
198 230 * Searches for group(s) in list of given assets and returns result in a list
199 231 *
200 232 * @param string|array $group A group name or list of groups in array
201 233 * @param array $assets
@@ -250,8 +282,9 @@
250 282 'minireset' => $this->baseAssetsUrl . '/resources/styles/frontend/reset.min.css',
251 283 'depicter-preview-style' => $this->baseAssetsUrl . '/resources/styles/player/preview.css'
252 284 ],
253 285 'common' => [
286 + 'depicter-front-pre' => $this->baseAssetsUrl . '/resources/styles/player/depicter-pre.css',
254 287 'depicter--front-common' => $this->baseAssetsUrl . '/resources/styles/player/depicter.css'
255 288 ]
256 289 ];
257 290
@@ -265,13 +298,22 @@
265 298 */
266 299 protected function getScriptsDictionary()
267 300 {
268 301 $scriptsDictionary = [
302 + 'injector' => [
303 + 'depicter--injector' => $this->baseAssetsUrl . '/resources/scripts/player/injector.js'
304 + ],
269 305 'player' => [
270 306 'depicter--player' => $this->baseAssetsUrl . '/resources/scripts/player/depicter.js'
271 307 ],
272 308 'widget' => [
273 309 'depicter-widget' => $this->baseAssetsUrl . '/resources/scripts/widgets/elementor-widget.js'
310 + ],
311 + 'iframe-resizer' => [
312 + 'depicter-iframe-resizer' => $this->baseAssetsUrl . '/resources/scripts/admin/iframeResizer.min.js'
313 + ],
314 + 'iframe-resizer-content' => [
315 + 'depicter-iframe-resizer-content' => $this->baseAssetsUrl . '/resources/scripts/admin/iframeResizer.contentWindow.min.js'
274 316 ]
275 317 ];
276 318
277 319 return $scriptsDictionary;