PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more / 3.6.7
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more v3.6.7
4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / EmbedPress / Ends / Back / Handler.php
embedpress / EmbedPress / Ends / Back Last commit date
Settings 3 years ago Handler.php 3 years ago index.html 7 years ago
Handler.php
479 lines
1 <?php
2
3 namespace EmbedPress\Ends\Back;
4
5 use EmbedPress\Core;
6 use EmbedPress\Ends\Handler as EndHandlerAbstract;
7 use EmbedPress\Shortcode;
8 use Embera\Embera;
9
10 (defined( 'ABSPATH' ) && defined( 'EMBEDPRESS_IS_LOADED' )) or die( "No direct script access allowed." );
11
12 /**
13 * The admin-facing functionality of the plugin.
14 * Defines the plugin name, version, and enqueue the admin-specific stylesheets and scripts.
15 *
16 * @package EmbedPress
17 * @subpackage EmbedPress/Ends/Back
18 * @author EmbedPress <help@embedpress.com>
19 * @copyright Copyright (C) 2020 WPDeveloper. All rights reserved.
20 * @license GPLv3 or later
21 * @since 1.0.0
22 */
23 class Handler extends EndHandlerAbstract {
24 /**
25 * Method that register all scripts for the admin area.
26 *
27 * @return void
28 * @since 1.0.0
29 *
30 */
31 public function enqueueScripts() {
32 global $pagenow;
33 if ( 'post.php' === $pagenow ) {
34 $urlSchemes = apply_filters( 'embedpress:getAdditionalURLSchemes', $this->getUrlSchemes() );
35
36 wp_enqueue_script( 'embedpress-pdfobject', EMBEDPRESS_URL_ASSETS . 'js/pdfobject.min.js', [],
37 $this->pluginVersion, false );
38
39 wp_enqueue_script( "bootbox-bootstrap", EMBEDPRESS_URL_ASSETS . 'js/vendor/bootstrap/bootstrap.min.js',[ 'jquery' ], $this->pluginVersion, false );
40 wp_enqueue_script( "bootbox", EMBEDPRESS_URL_ASSETS . 'js/vendor/bootbox.min.js', [ 'jquery', 'bootbox-bootstrap' ], $this->pluginVersion, true );
41 wp_enqueue_script( $this->pluginName, EMBEDPRESS_URL_ASSETS . 'js/preview.js', [ 'jquery', 'bootbox' ],$this->pluginVersion, true );
42 wp_enqueue_style( $this->pluginName, EMBEDPRESS_URL_ASSETS . 'css/embedpress.css', $this->pluginVersion, true );
43
44 wp_localize_script( $this->pluginName, '$data', [
45 'previewSettings' => [
46 'baseUrl' => get_site_url() . '/',
47 'versionUID' => $this->pluginVersion,
48 'debug' => true,
49 ],
50 'EMBEDPRESS_SHORTCODE' => EMBEDPRESS_SHORTCODE,
51 'EMBEDPRESS_URL_ASSETS' => EMBEDPRESS_URL_ASSETS,
52 'urlSchemes' => $urlSchemes,
53 ] );
54 }
55
56
57 //load embedpress admin js
58
59 wp_enqueue_script( 'embedpress-admin', EMBEDPRESS_URL_ASSETS . 'js/admin.js', [ 'jquery' ],
60 $this->pluginVersion, true );
61
62 wp_localize_script( $this->pluginName, 'EMBEDPRESS_ADMIN_PARAMS', [
63 'ajaxurl' => admin_url('admin-ajax.php'),
64 'nonce' => wp_create_nonce('embedpress')
65 ] );
66
67
68 $installedPlugins = Core::getPlugins();
69 if ( count( $installedPlugins ) > 0 ) {
70 foreach ( $installedPlugins as $plgSlug => $plgNamespace ) {
71 $plgScriptPathRelative = "assets/js/embedpress.{$plgSlug}.js";
72 $plgName = "embedpress-{$plgSlug}";
73
74 if ( file_exists( WP_PLUGIN_DIR . "/{$plgName}/{$plgScriptPathRelative}" ) ) {
75 wp_enqueue_script( $plgName, plugins_url( $plgName ) . '/' . $plgScriptPathRelative,
76 [ $this->pluginName ], $this->pluginVersion, true );
77 }
78 }
79 }
80 }
81
82 /**
83 * Method that register all stylesheets for the admin area.
84 *
85 * @return void
86 * @since 1.0.0
87 * @static
88 *
89 */
90 public static function enqueueStyles() {
91 if ( isset( $_GET['page']) && 'embedpress' === $_GET['page'] ) {
92 wp_enqueue_style( 'embedpress-admin', plugins_url( 'embedpress/assets/css/admin.css' ) );
93 }
94
95 }
96
97 /**
98 * Method that receive a string via AJAX and return the decoded-shortcoded-version of that string.
99 *
100 * @return void
101 * @since 1.0.0
102 *
103 */
104 public function doShortcodeReceivedViaAjax() {
105 $subject = isset( $_POST['subject'] ) ? $_POST['subject'] : "";
106
107 $response = [
108 'data' => Shortcode::parseContent( $subject, true ),
109 ];
110
111 header( 'Content-Type:application/json;charset=UTF-8' );
112 echo json_encode( $response );
113
114 exit();
115 }
116
117 /**
118 * Method that receive an url via AJAX and return the info about that url/embed.
119 *
120 * @return void
121 * @since 1.0.0
122 *
123 */
124 public function getUrlInfoViaAjax() {
125 $url = isset( $_GET['url'] ) ? trim( $_GET['url'] ) : "";
126
127 $response = [
128 'url' => $url,
129 'canBeResponsive' => false,
130 ];
131
132 if ( !!strlen( $response['url'] ) ) {
133
134 $additionalServiceProviders = Core::getAdditionalServiceProviders();
135 if ( !empty( $additionalServiceProviders ) ) {
136 foreach ( $additionalServiceProviders as $serviceProviderClassName => $serviceProviderUrls ) {
137 Shortcode::addServiceProvider( $serviceProviderClassName, $serviceProviderUrls );
138 }
139 }
140 $embera = new Embera([], Shortcode::get_collection());
141
142 $urlInfo = $embera->getUrlData( $response['url'] );
143 if ( isset( $urlInfo[$response['url']] ) && $urlInfo[$response['url']]['provider_name'] ) {
144 $response['canBeResponsive'] = Core::canServiceProviderBeResponsive( strtolower( $urlInfo[$response['url']]['provider_name']) );
145 }
146 }
147
148 header( 'Content-Type:application/json;charset=UTF-8' );
149 echo json_encode( $response );
150
151 exit();
152 }
153
154 /**
155 * Returns a list of supported URL schemes for the preview script
156 *
157 * @return array
158 */
159 public function getUrlSchemes() {
160 return [
161 // Apple podcasts
162 'podcasts.apple.com/*',
163 // PollDaddy
164 '*.polldaddy.com/s/*',
165 '*.polldaddy.com/poll/*',
166 '*.polldaddy.com/ratings/*',
167 'polldaddy.com/s/*',
168 'polldaddy.com/poll/*',
169 'polldaddy.com/ratings/*',
170
171 // VideoPress
172 'videopress.com/v/*',
173
174 // Tumblr
175 '*.tumblr.com/post/*',
176
177 // SmugMug
178 'smugmug.com/*',
179 '*.smugmug.com/*',
180
181 // SlideShare
182 'slideshare.net/*/*',
183 '*.slideshare.net/*/*',
184
185 // Reddit
186 'reddit.com/r/[^/]+/comments/*',
187
188 // Photobucket
189 'i*.photobucket.com/albums/*',
190 'gi*.photobucket.com/groups/*',
191
192 // Cloudup
193 'cloudup.com/*',
194
195 // Imgur
196 'imgur.com/*',
197 'i.imgur.com/*',
198
199 // YouTube (http://www.youtube.com/)
200 'youtube.com/watch\\?*',
201 'youtube.com/playlist\\?*',
202 'youtube.com/channel/*',
203 'youtube.com/c/*',
204 'youtube.com/user/*',
205 'youtube.com/(\w+)[^?\/]*$',
206
207 // opensea
208 'opensea.io/collection/*',
209
210 // Flickr (http://www.flickr.com/)
211 'flickr.com/photos/*/*',
212 'flic.kr/p/*',
213
214 // Viddler (http://www.viddler.com/)
215 'viddler.com/v/*',
216
217 // Hulu (http://www.hulu.com/)
218 'hulu.com/watch/*',
219
220 // Vimeo (http://vimeo.com/)
221 'vimeo.com/*',
222 'vimeo.com/groups/*/videos/*',
223
224 // CollegeHumor (http://www.collegehumor.com/)
225 'collegehumor.com/video/*',
226
227 // Deviantart.com (http://www.deviantart.com)
228 '*.deviantart.com/art/*',
229 '*.deviantart.com/*#/d*',
230 'fav.me/*',
231 'sta.sh/*',
232
233 // SlideShare (http://www.slideshare.net/)
234
235 // chirbit.com (http://www.chirbit.com/)
236 'chirb.it/*',
237
238 // nfb.ca (http://www.nfb.ca/)
239 '*.nfb.ca/film/*',
240
241 // Scribd (http://www.scribd.com/)
242 '*.scribd.com/doc/*',
243 '*.scribd.com/document/*',
244
245 // Dotsub (http://dotsub.com/)
246 'dotsub.com/view/*',
247
248 // Animoto (http://animoto.com/)
249 'animoto.com/play/*',
250
251 // Rdio (http://rdio.com/)
252 '*.rdio.com/artist/*',
253 '*.rdio.com/people/*',
254
255 // MixCloud (http://mixcloud.com/)
256 'mixcloud.com/*/*/',
257
258 // FunnyOrDie (http://www.funnyordie.com/)
259 'funnyordie.com/videos/*',
260
261 // Ted (http://ted.com)
262 'ted.com/talks/*',
263
264 // Sapo Videos (http://videos.sapo.pt)
265 'videos.sapo.pt/*',
266
267 // Official FM (http://official.fm)
268 'official.fm/tracks/*',
269 'official.fm/playlists/*',
270
271 // HuffDuffer (http://huffduffer.com)
272 'huffduffer.com/*/*',
273
274 // Shoudio (http://shoudio.com)
275 'shoudio.com/*',
276 'shoud.io/*',
277
278 // Moby Picture (http://www.mobypicture.com)
279 'mobypicture.com/user/*/view/*',
280 'moby.to/*',
281
282 // 23HQ (http://www.23hq.com)
283 '23hq.com/*/photo/*',
284
285 // Cacoo (https://cacoo.com)
286 'cacoo.com/diagrams/*',
287
288 // Dipity (http://www.dipity.com)
289 'dipity.com/*/*/',
290
291 // Roomshare (http://roomshare.jp)
292 'roomshare.jp/post/*',
293 'roomshare.jp/en/post/*',
294
295 // Dailymotion (http://www.dailymotion.com)
296 'dailymotion.com/video/*',
297
298 // Crowd Ranking (http://crowdranking.com)
299 'c9ng.com/*/*',
300
301 // CircuitLab (https://www.circuitlab.com/)
302 'circuitlab.com/circuit/*',
303
304 // Coub (http://coub.com/)
305 'coub.com/view/*',
306 'coub.com/embed/*',
307
308 // SpeakerDeck (https://speakerdeck.com)
309 'speakerdeck.com/*/*',
310
311 // Instagram (https://instagram.com)
312 'instagram.com/p/*',
313 'instagr.am/p/*',
314
315 // SoundCloud (http://soundcloud.com/)
316 'soundcloud.com/*',
317
318 // Kickstarter (http://www.kickstarter.com)
319 'kickstarter.com/projects/*',
320
321 // Ustream (http://www.ustream.tv)
322 '*.ustream.tv/*',
323 '*.ustream.com/*',
324
325 // Daily Mile (http://www.dailymile.com)
326 'dailymile.com/people/*/entries/*',
327
328 // Sketchfab (http://sketchfab.com)
329 'sketchfab.com/models/*',
330 'sketchfab.com/*/folders/*',
331
332 // Meetup (http://www.meetup.com)
333 'meetup.com/*',
334 'meetu.ps/*',
335
336 // AudioSnaps (http://audiosnaps.com)
337 'audiosnaps.com/k/*',
338
339 // RapidEngage (https://rapidengage.com)
340 'rapidengage.com/s/*',
341
342 // Getty Images (http://www.gettyimages.com/)
343 'gty.im/*',
344 'gettyimages.com/detail/photo/*',
345
346 // amCharts Live Editor (http://live.amcharts.com/)
347 'live.amcharts.com/*',
348
349 // Infogram (https://infogr.am/)
350 'infogr.am/*',
351 'infogram.com/*',
352
353 // ChartBlocks (http://www.chartblocks.com/)
354 'public.chartblocks.com/c/*',
355
356 // ReleaseWire (http://www.releasewire.com/)
357 'rwire.com/*',
358
359 // ShortNote (https://www.shortnote.jp/)
360 'shortnote.jp/view/notes/*',
361
362 // EgliseInfo (http://egliseinfo.catholique.fr/)
363 'egliseinfo.catholique.fr/*',
364
365 // Silk (http://www.silk.co/)
366 '*.silk.co/explore/*',
367 '*.silk.co/s/embed/*',
368
369 // Twitter
370 'twitter.com/*/status/*',
371 'twitter.com/i/moments/*',
372 'twitter.com/*/timelines/*',
373
374 // http://bambuser.com
375 'bambuser.com/v/*',
376
377 // https://clyp.it
378 'clyp.it/*',
379
380 // https://gist.github.com
381 'gist.github.com/*/*',
382
383 // http://issuu.com
384 'issuu.com/*',
385
386 // https://portfolium.com
387 'portfolium.com/*',
388
389 // https://www.reverbnation.com
390 'reverbnation.com/*',
391
392 // http://rutube.ru
393 'rutube.ru/video/*',
394
395 // https://spotify.com/
396 'open.spotify.com/*',
397
398 // http://www.videojug.com
399 'videojug.com/*',
400
401 // https://vine.com
402 'vine.co/v/*',
403
404 // Facebook
405 'facebook.com/*',
406 'fb.watch/*',
407
408 // Google Shortened Url
409 'goo.gl/*',
410
411 // Google Maps
412 'google.com/*',
413 'google.com.*/*',
414 'google.co.*/*',
415 'maps.google.com/*',
416
417 // Google Docs
418 'docs.google.com/presentation/*',
419 'docs.google.com/document/*',
420 'docs.google.com/spreadsheets/*',
421 'docs.google.com/forms/*',
422 'docs.google.com/drawings/*',
423
424 // Twitch.tv
425 '*.twitch.tv/*',
426 'twitch.tv/*',
427
428 // Giphy
429 '*.giphy.com/gifs/*',
430 'giphy.com/gifs/*',
431 'i.giphy.com/*',
432 'gph.is/*',
433
434 // Wistia
435 '*.wistia.com/medias/*',
436 'fast.wistia.com/embed/medias/*.jsonp',
437 // Boomplay (http://boomplay.com/)
438 'boomplay.com/*',
439 'codepen.io/*',
440 'archivos.digital/*',
441 'audioclip.naver.com/*',
442 'app.blogcast.host/*',
443 'codepoints.net/*',
444 'codesandbox.io/*',
445 'commaful.com/*',
446 '*.survey.fm/*',
447 'survey.fm/*',
448 'datawrapper.dwcdn.net/*',
449 '*.didacte.com/*',
450 'didacte.com/*',
451 'digiteka.com/*',
452 'docdro.id/*',
453 'edumedia-sciences.com/*',
454 'ethfiddle.com/*',
455 'eyrie.io/*',
456 '*.getfader.com/*',
457 'getfader.com/*',
458 'fitapp.pro/*',
459 'fite.tv/*',
460 'public.flourish.studio/*',
461 'geograph.org.gg/*',
462 'geo-en.hlipp.de/*',
463 'geograph.org.uk/*',
464 'fortest.getshow.io/*',
465 'opensea.io/assets/*',
466 ];
467 }
468
469 /**
470 * Update admin notice view status
471 *
472 * @since 2.5.1
473 */
474 public static function embedpress_notice_dismiss() {
475 check_ajax_referer( 'embedpress', 'security' );
476 update_option( 'embedpress_social_dismiss_notice', true );
477 }
478 }
479