PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more / 3.3.3
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more v3.3.3
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 4 years ago Handler.php 4 years ago index.html 7 years ago
Handler.php
468 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 // PollDaddy
161 '*.polldaddy.com/s/*',
162 '*.polldaddy.com/poll/*',
163 '*.polldaddy.com/ratings/*',
164 'polldaddy.com/s/*',
165 'polldaddy.com/poll/*',
166 'polldaddy.com/ratings/*',
167
168 // VideoPress
169 'videopress.com/v/*',
170
171 // Tumblr
172 '*.tumblr.com/post/*',
173
174 // SmugMug
175 'smugmug.com/*',
176 '*.smugmug.com/*',
177
178 // SlideShare
179 'slideshare.net/*/*',
180 '*.slideshare.net/*/*',
181
182 // Reddit
183 'reddit.com/r/[^/]+/comments/*',
184
185 // Photobucket
186 'i*.photobucket.com/albums/*',
187 'gi*.photobucket.com/groups/*',
188
189 // Cloudup
190 'cloudup.com/*',
191
192 // Imgur
193 'imgur.com/*',
194 'i.imgur.com/*',
195
196 // YouTube (http://www.youtube.com/)
197 'youtube.com/watch\\?*',
198 'youtube.com/playlist\\?*',
199
200 // Flickr (http://www.flickr.com/)
201 'flickr.com/photos/*/*',
202 'flic.kr/p/*',
203
204 // Viddler (http://www.viddler.com/)
205 'viddler.com/v/*',
206
207 // Hulu (http://www.hulu.com/)
208 'hulu.com/watch/*',
209
210 // Vimeo (http://vimeo.com/)
211 'vimeo.com/*',
212 'vimeo.com/groups/*/videos/*',
213
214 // CollegeHumor (http://www.collegehumor.com/)
215 'collegehumor.com/video/*',
216
217 // Deviantart.com (http://www.deviantart.com)
218 '*.deviantart.com/art/*',
219 '*.deviantart.com/*#/d*',
220 'fav.me/*',
221 'sta.sh/*',
222
223 // SlideShare (http://www.slideshare.net/)
224
225 // chirbit.com (http://www.chirbit.com/)
226 'chirb.it/*',
227
228 // nfb.ca (http://www.nfb.ca/)
229 '*.nfb.ca/film/*',
230
231 // Scribd (http://www.scribd.com/)
232 '*.scribd.com/doc/*',
233 '*.scribd.com/document/*',
234
235 // Dotsub (http://dotsub.com/)
236 'dotsub.com/view/*',
237
238 // Animoto (http://animoto.com/)
239 'animoto.com/play/*',
240
241 // Rdio (http://rdio.com/)
242 '*.rdio.com/artist/*',
243 '*.rdio.com/people/*',
244
245 // MixCloud (http://mixcloud.com/)
246 'mixcloud.com/*/*/',
247
248 // FunnyOrDie (http://www.funnyordie.com/)
249 'funnyordie.com/videos/*',
250
251 // Ted (http://ted.com)
252 'ted.com/talks/*',
253
254 // Sapo Videos (http://videos.sapo.pt)
255 'videos.sapo.pt/*',
256
257 // Official FM (http://official.fm)
258 'official.fm/tracks/*',
259 'official.fm/playlists/*',
260
261 // HuffDuffer (http://huffduffer.com)
262 'huffduffer.com/*/*',
263
264 // Shoudio (http://shoudio.com)
265 'shoudio.com/*',
266 'shoud.io/*',
267
268 // Moby Picture (http://www.mobypicture.com)
269 'mobypicture.com/user/*/view/*',
270 'moby.to/*',
271
272 // 23HQ (http://www.23hq.com)
273 '23hq.com/*/photo/*',
274
275 // Cacoo (https://cacoo.com)
276 'cacoo.com/diagrams/*',
277
278 // Dipity (http://www.dipity.com)
279 'dipity.com/*/*/',
280
281 // Roomshare (http://roomshare.jp)
282 'roomshare.jp/post/*',
283 'roomshare.jp/en/post/*',
284
285 // Dailymotion (http://www.dailymotion.com)
286 'dailymotion.com/video/*',
287
288 // Crowd Ranking (http://crowdranking.com)
289 'c9ng.com/*/*',
290
291 // CircuitLab (https://www.circuitlab.com/)
292 'circuitlab.com/circuit/*',
293
294 // Coub (http://coub.com/)
295 'coub.com/view/*',
296 'coub.com/embed/*',
297
298 // SpeakerDeck (https://speakerdeck.com)
299 'speakerdeck.com/*/*',
300
301 // Instagram (https://instagram.com)
302 'instagram.com/p/*',
303 'instagr.am/p/*',
304
305 // SoundCloud (http://soundcloud.com/)
306 'soundcloud.com/*',
307
308 // Kickstarter (http://www.kickstarter.com)
309 'kickstarter.com/projects/*',
310
311 // Ustream (http://www.ustream.tv)
312 '*.ustream.tv/*',
313 '*.ustream.com/*',
314
315 // Daily Mile (http://www.dailymile.com)
316 'dailymile.com/people/*/entries/*',
317
318 // Sketchfab (http://sketchfab.com)
319 'sketchfab.com/models/*',
320 'sketchfab.com/*/folders/*',
321
322 // Meetup (http://www.meetup.com)
323 'meetup.com/*',
324 'meetu.ps/*',
325
326 // AudioSnaps (http://audiosnaps.com)
327 'audiosnaps.com/k/*',
328
329 // RapidEngage (https://rapidengage.com)
330 'rapidengage.com/s/*',
331
332 // Getty Images (http://www.gettyimages.com/)
333 'gty.im/*',
334 'gettyimages.com/detail/photo/*',
335
336 // amCharts Live Editor (http://live.amcharts.com/)
337 'live.amcharts.com/*',
338
339 // Infogram (https://infogr.am/)
340 'infogr.am/*',
341 'infogram.com/*',
342
343 // ChartBlocks (http://www.chartblocks.com/)
344 'public.chartblocks.com/c/*',
345
346 // ReleaseWire (http://www.releasewire.com/)
347 'rwire.com/*',
348
349 // ShortNote (https://www.shortnote.jp/)
350 'shortnote.jp/view/notes/*',
351
352 // EgliseInfo (http://egliseinfo.catholique.fr/)
353 'egliseinfo.catholique.fr/*',
354
355 // Silk (http://www.silk.co/)
356 '*.silk.co/explore/*',
357 '*.silk.co/s/embed/*',
358
359 // Twitter
360 'twitter.com/*/status/*',
361 'twitter.com/i/moments/*',
362 'twitter.com/*/timelines/*',
363
364 // http://bambuser.com
365 'bambuser.com/v/*',
366
367 // https://clyp.it
368 'clyp.it/*',
369
370 // https://gist.github.com
371 'gist.github.com/*/*',
372
373 // http://issuu.com
374 'issuu.com/*',
375
376 // https://portfolium.com
377 'portfolium.com/*',
378
379 // https://www.reverbnation.com
380 'reverbnation.com/*',
381
382 // http://rutube.ru
383 'rutube.ru/video/*',
384
385 // https://spotify.com/
386 'open.spotify.com/*',
387
388 // http://www.videojug.com
389 'videojug.com/*',
390
391 // https://vine.com
392 'vine.co/v/*',
393
394 // Facebook
395 'facebook.com/*',
396 'fb.watch/*',
397
398 // Google Shortened Url
399 'goo.gl/*',
400
401 // Google Maps
402 'google.com/*',
403 'google.com.*/*',
404 'google.co.*/*',
405 'maps.google.com/*',
406
407 // Google Docs
408 'docs.google.com/presentation/*',
409 'docs.google.com/document/*',
410 'docs.google.com/spreadsheets/*',
411 'docs.google.com/forms/*',
412 'docs.google.com/drawings/*',
413
414 // Twitch.tv
415 '*.twitch.tv/*',
416 'twitch.tv/*',
417
418 // Giphy
419 '*.giphy.com/gifs/*',
420 'giphy.com/gifs/*',
421 'i.giphy.com/*',
422 'gph.is/*',
423
424 // Wistia
425 '*.wistia.com/medias/*',
426 'fast.wistia.com/embed/medias/*.jsonp',
427 // Boomplay (http://boomplay.com/)
428 'boomplay.com/*',
429 'codepen.io/*',
430 'archivos.digital/*',
431 'audioclip.naver.com/*',
432 'app.blogcast.host/*',
433 'codepoints.net/*',
434 'codesandbox.io/*',
435 'commaful.com/*',
436 '*.survey.fm/*',
437 'survey.fm/*',
438 'datawrapper.dwcdn.net/*',
439 '*.didacte.com/*',
440 'didacte.com/*',
441 'digiteka.com/*',
442 'docdro.id/*',
443 'edumedia-sciences.com/*',
444 'ethfiddle.com/*',
445 'eyrie.io/*',
446 '*.getfader.com/*',
447 'getfader.com/*',
448 'fitapp.pro/*',
449 'fite.tv/*',
450 'public.flourish.studio/*',
451 'geograph.org.gg/*',
452 'geo-en.hlipp.de/*',
453 'geograph.org.uk/*',
454 'fortest.getshow.io/*',
455 ];
456 }
457
458 /**
459 * Update admin notice view status
460 *
461 * @since 2.5.1
462 */
463 public static function embedpress_notice_dismiss() {
464 check_ajax_referer( 'embedpress', 'security' );
465 update_option( 'embedpress_social_dismiss_notice', true );
466 }
467 }
468