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