PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 3.5.1
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v3.5.1
4.6.2 4.6.1 4.6.0 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
474 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
43 wp_localize_script( $this->pluginName, '$data', [
44 'previewSettings' => [
45 'baseUrl' => get_site_url() . '/',
46 'versionUID' => $this->pluginVersion,
47 'debug' => true,
48 ],
49 'EMBEDPRESS_SHORTCODE' => EMBEDPRESS_SHORTCODE,
50 'EMBEDPRESS_URL_ASSETS' => EMBEDPRESS_URL_ASSETS,
51 'urlSchemes' => $urlSchemes,
52 ] );
53 }
54
55
56 //load embedpress admin js
57
58 wp_enqueue_script( 'embedpress-admin', EMBEDPRESS_URL_ASSETS . 'js/admin.js', [ 'jquery' ],
59 $this->pluginVersion, true );
60
61 wp_localize_script( $this->pluginName, 'EMBEDPRESS_ADMIN_PARAMS', [
62 'ajaxurl' => admin_url('admin-ajax.php'),
63 'nonce' => wp_create_nonce('embedpress')
64 ] );
65
66
67 $installedPlugins = Core::getPlugins();
68 if ( count( $installedPlugins ) > 0 ) {
69 foreach ( $installedPlugins as $plgSlug => $plgNamespace ) {
70 $plgScriptPathRelative = "assets/js/embedpress.{$plgSlug}.js";
71 $plgName = "embedpress-{$plgSlug}";
72
73 if ( file_exists( WP_PLUGIN_DIR . "/{$plgName}/{$plgScriptPathRelative}" ) ) {
74 wp_enqueue_script( $plgName, plugins_url( $plgName ) . '/' . $plgScriptPathRelative,
75 [ $this->pluginName ], $this->pluginVersion, true );
76 }
77 }
78 }
79 }
80
81 /**
82 * Method that register all stylesheets for the admin area.
83 *
84 * @return void
85 * @since 1.0.0
86 * @static
87 *
88 */
89 public static function enqueueStyles() {
90 if ( isset( $_GET['page']) && 'embedpress' === $_GET['page'] ) {
91 wp_enqueue_style( 'embedpress-admin', plugins_url( 'embedpress/assets/css/admin.css' ) );
92 }
93
94 }
95
96 /**
97 * Method that receive a string via AJAX and return the decoded-shortcoded-version of that string.
98 *
99 * @return void
100 * @since 1.0.0
101 *
102 */
103 public function doShortcodeReceivedViaAjax() {
104 $subject = isset( $_POST['subject'] ) ? $_POST['subject'] : "";
105
106 $response = [
107 'data' => Shortcode::parseContent( $subject, true ),
108 ];
109
110 header( 'Content-Type:application/json;charset=UTF-8' );
111 echo json_encode( $response );
112
113 exit();
114 }
115
116 /**
117 * Method that receive an url via AJAX and return the info about that url/embed.
118 *
119 * @return void
120 * @since 1.0.0
121 *
122 */
123 public function getUrlInfoViaAjax() {
124 $url = isset( $_GET['url'] ) ? trim( $_GET['url'] ) : "";
125
126 $response = [
127 'url' => $url,
128 'canBeResponsive' => false,
129 ];
130
131 if ( !!strlen( $response['url'] ) ) {
132
133 $additionalServiceProviders = Core::getAdditionalServiceProviders();
134 if ( !empty( $additionalServiceProviders ) ) {
135 foreach ( $additionalServiceProviders as $serviceProviderClassName => $serviceProviderUrls ) {
136 Shortcode::addServiceProvider( $serviceProviderClassName, $serviceProviderUrls );
137 }
138 }
139 $embera = new Embera([], Shortcode::get_collection());
140
141 $urlInfo = $embera->getUrlData( $response['url'] );
142 if ( isset( $urlInfo[$response['url']] ) && $urlInfo[$response['url']]['provider_name'] ) {
143 $response['canBeResponsive'] = Core::canServiceProviderBeResponsive( strtolower( $urlInfo[$response['url']]['provider_name']) );
144 }
145 }
146
147 header( 'Content-Type:application/json;charset=UTF-8' );
148 echo json_encode( $response );
149
150 exit();
151 }
152
153 /**
154 * Returns a list of supported URL schemes for the preview script
155 *
156 * @return array
157 */
158 public function getUrlSchemes() {
159 return [
160 // Apple podcasts
161 'podcasts.apple.com/*',
162 // PollDaddy
163 '*.polldaddy.com/s/*',
164 '*.polldaddy.com/poll/*',
165 '*.polldaddy.com/ratings/*',
166 'polldaddy.com/s/*',
167 'polldaddy.com/poll/*',
168 'polldaddy.com/ratings/*',
169
170 // VideoPress
171 'videopress.com/v/*',
172
173 // Tumblr
174 '*.tumblr.com/post/*',
175
176 // SmugMug
177 'smugmug.com/*',
178 '*.smugmug.com/*',
179
180 // SlideShare
181 'slideshare.net/*/*',
182 '*.slideshare.net/*/*',
183
184 // Reddit
185 'reddit.com/r/[^/]+/comments/*',
186
187 // Photobucket
188 'i*.photobucket.com/albums/*',
189 'gi*.photobucket.com/groups/*',
190
191 // Cloudup
192 'cloudup.com/*',
193
194 // Imgur
195 'imgur.com/*',
196 'i.imgur.com/*',
197
198 // YouTube (http://www.youtube.com/)
199 'youtube.com/watch\\?*',
200 'youtube.com/playlist\\?*',
201 'youtube.com/channel/*',
202 'youtube.com/c/*',
203 'youtube.com/user/*',
204 'youtube.com/(\w+)[^?\/]*$',
205
206 // Flickr (http://www.flickr.com/)
207 'flickr.com/photos/*/*',
208 'flic.kr/p/*',
209
210 // Viddler (http://www.viddler.com/)
211 'viddler.com/v/*',
212
213 // Hulu (http://www.hulu.com/)
214 'hulu.com/watch/*',
215
216 // Vimeo (http://vimeo.com/)
217 'vimeo.com/*',
218 'vimeo.com/groups/*/videos/*',
219
220 // CollegeHumor (http://www.collegehumor.com/)
221 'collegehumor.com/video/*',
222
223 // Deviantart.com (http://www.deviantart.com)
224 '*.deviantart.com/art/*',
225 '*.deviantart.com/*#/d*',
226 'fav.me/*',
227 'sta.sh/*',
228
229 // SlideShare (http://www.slideshare.net/)
230
231 // chirbit.com (http://www.chirbit.com/)
232 'chirb.it/*',
233
234 // nfb.ca (http://www.nfb.ca/)
235 '*.nfb.ca/film/*',
236
237 // Scribd (http://www.scribd.com/)
238 '*.scribd.com/doc/*',
239 '*.scribd.com/document/*',
240
241 // Dotsub (http://dotsub.com/)
242 'dotsub.com/view/*',
243
244 // Animoto (http://animoto.com/)
245 'animoto.com/play/*',
246
247 // Rdio (http://rdio.com/)
248 '*.rdio.com/artist/*',
249 '*.rdio.com/people/*',
250
251 // MixCloud (http://mixcloud.com/)
252 'mixcloud.com/*/*/',
253
254 // FunnyOrDie (http://www.funnyordie.com/)
255 'funnyordie.com/videos/*',
256
257 // Ted (http://ted.com)
258 'ted.com/talks/*',
259
260 // Sapo Videos (http://videos.sapo.pt)
261 'videos.sapo.pt/*',
262
263 // Official FM (http://official.fm)
264 'official.fm/tracks/*',
265 'official.fm/playlists/*',
266
267 // HuffDuffer (http://huffduffer.com)
268 'huffduffer.com/*/*',
269
270 // Shoudio (http://shoudio.com)
271 'shoudio.com/*',
272 'shoud.io/*',
273
274 // Moby Picture (http://www.mobypicture.com)
275 'mobypicture.com/user/*/view/*',
276 'moby.to/*',
277
278 // 23HQ (http://www.23hq.com)
279 '23hq.com/*/photo/*',
280
281 // Cacoo (https://cacoo.com)
282 'cacoo.com/diagrams/*',
283
284 // Dipity (http://www.dipity.com)
285 'dipity.com/*/*/',
286
287 // Roomshare (http://roomshare.jp)
288 'roomshare.jp/post/*',
289 'roomshare.jp/en/post/*',
290
291 // Dailymotion (http://www.dailymotion.com)
292 'dailymotion.com/video/*',
293
294 // Crowd Ranking (http://crowdranking.com)
295 'c9ng.com/*/*',
296
297 // CircuitLab (https://www.circuitlab.com/)
298 'circuitlab.com/circuit/*',
299
300 // Coub (http://coub.com/)
301 'coub.com/view/*',
302 'coub.com/embed/*',
303
304 // SpeakerDeck (https://speakerdeck.com)
305 'speakerdeck.com/*/*',
306
307 // Instagram (https://instagram.com)
308 'instagram.com/p/*',
309 'instagr.am/p/*',
310
311 // SoundCloud (http://soundcloud.com/)
312 'soundcloud.com/*',
313
314 // Kickstarter (http://www.kickstarter.com)
315 'kickstarter.com/projects/*',
316
317 // Ustream (http://www.ustream.tv)
318 '*.ustream.tv/*',
319 '*.ustream.com/*',
320
321 // Daily Mile (http://www.dailymile.com)
322 'dailymile.com/people/*/entries/*',
323
324 // Sketchfab (http://sketchfab.com)
325 'sketchfab.com/models/*',
326 'sketchfab.com/*/folders/*',
327
328 // Meetup (http://www.meetup.com)
329 'meetup.com/*',
330 'meetu.ps/*',
331
332 // AudioSnaps (http://audiosnaps.com)
333 'audiosnaps.com/k/*',
334
335 // RapidEngage (https://rapidengage.com)
336 'rapidengage.com/s/*',
337
338 // Getty Images (http://www.gettyimages.com/)
339 'gty.im/*',
340 'gettyimages.com/detail/photo/*',
341
342 // amCharts Live Editor (http://live.amcharts.com/)
343 'live.amcharts.com/*',
344
345 // Infogram (https://infogr.am/)
346 'infogr.am/*',
347 'infogram.com/*',
348
349 // ChartBlocks (http://www.chartblocks.com/)
350 'public.chartblocks.com/c/*',
351
352 // ReleaseWire (http://www.releasewire.com/)
353 'rwire.com/*',
354
355 // ShortNote (https://www.shortnote.jp/)
356 'shortnote.jp/view/notes/*',
357
358 // EgliseInfo (http://egliseinfo.catholique.fr/)
359 'egliseinfo.catholique.fr/*',
360
361 // Silk (http://www.silk.co/)
362 '*.silk.co/explore/*',
363 '*.silk.co/s/embed/*',
364
365 // Twitter
366 'twitter.com/*/status/*',
367 'twitter.com/i/moments/*',
368 'twitter.com/*/timelines/*',
369
370 // http://bambuser.com
371 'bambuser.com/v/*',
372
373 // https://clyp.it
374 'clyp.it/*',
375
376 // https://gist.github.com
377 'gist.github.com/*/*',
378
379 // http://issuu.com
380 'issuu.com/*',
381
382 // https://portfolium.com
383 'portfolium.com/*',
384
385 // https://www.reverbnation.com
386 'reverbnation.com/*',
387
388 // http://rutube.ru
389 'rutube.ru/video/*',
390
391 // https://spotify.com/
392 'open.spotify.com/*',
393
394 // http://www.videojug.com
395 'videojug.com/*',
396
397 // https://vine.com
398 'vine.co/v/*',
399
400 // Facebook
401 'facebook.com/*',
402 'fb.watch/*',
403
404 // Google Shortened Url
405 'goo.gl/*',
406
407 // Google Maps
408 'google.com/*',
409 'google.com.*/*',
410 'google.co.*/*',
411 'maps.google.com/*',
412
413 // Google Docs
414 'docs.google.com/presentation/*',
415 'docs.google.com/document/*',
416 'docs.google.com/spreadsheets/*',
417 'docs.google.com/forms/*',
418 'docs.google.com/drawings/*',
419
420 // Twitch.tv
421 '*.twitch.tv/*',
422 'twitch.tv/*',
423
424 // Giphy
425 '*.giphy.com/gifs/*',
426 'giphy.com/gifs/*',
427 'i.giphy.com/*',
428 'gph.is/*',
429
430 // Wistia
431 '*.wistia.com/medias/*',
432 'fast.wistia.com/embed/medias/*.jsonp',
433 // Boomplay (http://boomplay.com/)
434 'boomplay.com/*',
435 'codepen.io/*',
436 'archivos.digital/*',
437 'audioclip.naver.com/*',
438 'app.blogcast.host/*',
439 'codepoints.net/*',
440 'codesandbox.io/*',
441 'commaful.com/*',
442 '*.survey.fm/*',
443 'survey.fm/*',
444 'datawrapper.dwcdn.net/*',
445 '*.didacte.com/*',
446 'didacte.com/*',
447 'digiteka.com/*',
448 'docdro.id/*',
449 'edumedia-sciences.com/*',
450 'ethfiddle.com/*',
451 'eyrie.io/*',
452 '*.getfader.com/*',
453 'getfader.com/*',
454 'fitapp.pro/*',
455 'fite.tv/*',
456 'public.flourish.studio/*',
457 'geograph.org.gg/*',
458 'geo-en.hlipp.de/*',
459 'geograph.org.uk/*',
460 'fortest.getshow.io/*',
461 ];
462 }
463
464 /**
465 * Update admin notice view status
466 *
467 * @since 2.5.1
468 */
469 public static function embedpress_notice_dismiss() {
470 check_ajax_referer( 'embedpress', 'security' );
471 update_option( 'embedpress_social_dismiss_notice', true );
472 }
473 }
474