PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 4.4.8
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v4.4.8
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 / vendor / wpdevelopers / embera / src / Embera / Provider / Facebook.php
embedpress / vendor / wpdevelopers / embera / src / Embera / Provider Last commit date
Acast.php 9 months ago ActBlue.php 9 months ago Adilo.php 9 months ago Adways.php 9 months ago Afreecatv.php 9 months ago Altium.php 9 months ago Altru.php 9 months ago Amtraker.php 9 months ago Animoto.php 9 months ago AnnieMusic.php 9 months ago Apester.php 9 months ago Archivos.php 9 months ago Assemblrworld.php 9 months ago AudioClip.php 9 months ago Audioboom.php 9 months ago Audiocom.php 9 months ago Audiomack.php 9 months ago Audiomeans.php 9 months ago BeamsFm.php 9 months ago BeautifulAI.php 9 months ago Behance.php 9 months ago Biqnetwork.php 9 months ago Bitchute.php 9 months ago BlackfireIO.php 9 months ago Blogcast.php 9 months ago BlueskySocial.php 9 months ago Bookingmood.php 9 months ago Bumper.php 9 months ago Bunny.php 9 months ago Buttondown.php 9 months ago Canva.php 9 months ago Celero.php 9 months ago Ceros.php 9 months ago ChartBlocks.php 9 months ago Chroco.php 9 months ago CircuitLab.php 9 months ago Clyp.php 9 months ago CodeHS.php 9 months ago CodeSandbox.php 9 months ago Codepoints.php 9 months ago Commaful.php 9 months ago Coub.php 9 months ago Crumbs.php 9 months ago Cueup.php 9 months ago Curated.php 9 months ago Dadan.php 9 months ago DailyMotion.php 9 months ago Dalexni.php 9 months ago Datawrapper.php 9 months ago Deseretnews.php 9 months ago Deviantart.php 9 months ago Didacte.php 9 months ago Digiteka.php 9 months ago DocDroid.php 9 months ago Docswell.php 9 months ago DreamBroker.php 9 months ago EchoesHQ.php 9 months ago Embedery.php 9 months ago Ethfiddle.php 9 months ago EventLive.php 9 months ago Everviz.php 9 months ago FITE.php 9 months ago Facebook.php 9 months ago Fader.php 9 months ago FaithLifeTV.php 9 months ago Figma.php 9 months ago Fitapp.php 9 months ago Flickr.php 9 months ago Flourish.php 9 months ago FlowHubOrg.php 9 months ago Fooday.php 9 months ago Framatube.php 9 months ago Framer.php 9 months ago Genially.php 9 months ago GeographCI.php 9 months ago GeographUk.php 9 months ago GetShow.php 9 months ago GettyImages.php 9 months ago Giphy.php 9 months ago GloriaTV.php 9 months ago Gmetri.php 9 months ago Gong.php 9 months ago Grain.php 9 months ago Gumlet.php 9 months ago Gyazo.php 9 months ago Hash.php 9 months ago Hearthis.php 9 months ago Heyzine.php 9 months ago HiHaHo.php 5 years ago HippoVideo.php 9 months ago Hopvue.php 9 months ago Huffduffer.php 9 months ago IHeartRadio.php 5 years ago Ideamapper.php 9 months ago Imgur.php 9 months ago Infogram.php 9 months ago Infoveave.php 9 months ago Injurymap.php 9 months ago InsightTimer.php 9 months ago Instagram.php 9 months ago InsticatorContentEngagementUnit.php 9 months ago Issuu.php 9 months ago ItabtechInfosys.php 9 months ago ItemisCreate.php 9 months ago Jovian.php 9 months ago KakaoTV.php 9 months ago Kickstarter.php 9 months ago KirimEmail.php 9 months ago Kit.php 9 months ago Knacki.php 9 months ago Kooapp.php 9 months ago Kurozora.php 9 months ago LearningApps.php 9 months ago Libsyn.php 9 months ago Lineplace.php 9 months ago Livestream.php 9 months ago LocalVoicesNetwork.php 9 months ago Loom.php 9 months ago LottieFiles.php 9 months ago Ludus.php 9 months ago Lumiere.php 9 months ago Matterport.php 9 months ago MediaLab.php 9 months ago Mediastream.php 9 months ago MedienArchivKuenste.php 9 months ago MermaidInk.php 9 months ago Miro.php 9 months ago MixCloud.php 9 months ago Mixpanel.php 9 months ago MusicboxManiacs.php 9 months ago MySQLVisualExplain.php 9 months ago NDLA.php 9 months ago NFTndx.php 9 months ago Namchey.php 9 months ago Nanoo.php 9 months ago NaturalAtlas.php 9 months ago Nebula.php 9 months ago NeetoRecord.php 9 months ago Nfb.php 9 months ago Odysee.php 9 months ago OmnyStudio.php 9 months ago OraTV.php 9 months ago Orbitvu.php 9 months ago Origits.php 9 months ago Outplayed.php 9 months ago OverflowIO.php 9 months ago Pandavideo.php 9 months ago Pastery.php 9 months ago PeerTubeTV.php 9 months ago Picturelfy.php 9 months ago Piggy.php 9 months ago Pikasso.php 9 months ago Pinpoll.php 9 months ago Pinterest.php 9 months ago Pitchhub.php 9 months ago Playbuzz.php 9 months ago Plusdocs.php 9 months ago Podbean.php 9 months ago Polldaddy.php 9 months ago Portfolium.php 9 months ago Prezi.php 9 months ago ProviderAdapter.php 5 years ago ProviderInterface.php 9 months ago QTpi.php 9 months ago Quartr.php 9 months ago RadioPublic.php 5 years ago Rcvis.php 9 months ago Reddit.php 9 months ago ReleaseWire.php 9 months ago Render.php 9 months ago Replit.php 9 months ago ReverbNation.php 9 months ago RoosterTeeth.php 9 months ago Rumble.php 9 months ago RunKit.php 9 months ago SapoVideos.php 9 months ago Sbedit.php 9 months ago Scenes.php 9 months ago ScreenNine.php 9 months ago Screencast.php 9 months ago ScribbleMaps.php 9 months ago Scribd.php 9 months ago SendToNews.php 9 months ago Shoudio.php 9 months ago ShowTheWay.php 5 years ago Sketchfab.php 9 months ago SlateApp.php 9 months ago Slideshare.php 9 months ago SmashNotes.php 9 months ago Smugmug.php 9 months ago SocialExplorer.php 9 months ago SongLink.php 9 months ago SoundCloud.php 9 months ago SpeakerDeck.php 9 months ago Spotify.php 9 months ago Spotlightr.php 9 months ago Spreaker.php 9 months ago SproutVideo.php 9 months ago Spyke.php 9 months ago StandfordDigitalRepository.php 9 months ago Streamable.php 9 months ago Streamio.php 9 months ago Sudomemo.php 9 months ago Sutori.php 9 months ago Sway.php 9 months ago Synthesia.php 9 months ago Ted.php 9 months ago TheNewYorkTimes.php 9 months ago ThreeQ.php 9 months ago Tickcounter.php 9 months ago TikTok.php 9 months ago TonicAudio.php 9 months ago Toornament.php 9 months ago Trackspace.php 9 months ago TrinityAudio.php 9 months ago Tumblr.php 9 months ago Tuxx.php 9 months ago Tvcf.php 9 months ago Twinmotion.php 9 months ago Twitter.php 9 months ago UAPod.php 9 months ago UniversitePantheonSorbonne.php 9 months ago UpecPod.php 9 months ago UstreamTV.php 9 months ago Ustudio.php 9 months ago Verse.php 9 months ago VidMount.php 9 months ago Videfit.php 9 months ago Vidyard.php 9 months ago Vimeo.php 9 months ago Viostream.php 9 months ago Viously.php 9 months ago Vizdom.php 9 months ago Vlipsy.php 9 months ago VouchFor.php 9 months ago VoxSnap.php 9 months ago WaveVideo.php 9 months ago Web3IsGoingJustGreat.php 9 months ago Webcrumbs.php 9 months ago Wecandeo.php 9 months ago Whimsical.php 9 months ago Wistia.php 9 months ago Wizer.php 9 months ago Wokwi.php 9 months ago WolframCloud.php 9 months ago Wordpress.php 9 months ago Wordwall.php 9 months ago Youtube.php 9 months ago Yumpu.php 9 months ago Zeplin.php 9 months ago Zingsoft.php 9 months ago Zoomable.php 9 months ago iFixit.php 9 months ago
Facebook.php
207 lines
1 <?php
2 /**
3 * Facebook.php
4 *
5 * @package Embera
6 * @author Michael Pratt <yo@michael-pratt.com>
7 * @link http://www.michael-pratt.com/
8 *
9 * For the full copyright and license information, please view the LICENSE
10 * file that was distributed with this source code.
11 */
12
13 namespace Embera\Provider;
14
15 use Embera\Url;
16
17 /**
18 * Facebook Provider
19 * Connect with friends and the world around you on Facebook.
20 * This Provider Requires the use of an access_token provided by Facebook.
21 * Example: `$embera = new Embera([ 'facebook_access_token' => 'yourtokenforfacebook' ]);`
22 *
23 * @link https://facebook.com
24 * @see https://developers.facebook.com/docs/plugins/oembed-endpoints
25 */
26 class Facebook extends ProviderAdapter implements ProviderInterface
27 {
28 /** inline {@inheritdoc} */
29 protected $shouldSendRequest = false;
30 /** inline {@inheritdoc} */
31 protected $endpoint = 'https://graph.facebook.com/v16.0/oembed_{type}';
32
33 /** inline {@inheritdoc} */
34 protected static $hosts = [
35 'facebook.com'
36 ];
37
38 /** inline {@inheritdoc} */
39 protected $allowedParams = [ 'maxwidth', 'maxheight', 'callback', 'omitscript', 'breaking_change', 'access_token', 'fields', 'locale' ];
40
41 /** inline {@inheritdoc} */
42 protected $httpsSupport = true;
43
44 /** inline {@inheritdoc} */
45 protected $responsiveSupport = true;
46
47 /** Patterns that match posts urls */
48 protected $postPatterns = [
49 /**
50 * https://www.facebook.com/{page-name}/posts/{post-id}
51 * https://www.facebook.com/{username}/posts/{post-id}
52 * https://www.facebook.com/{username}/activity/{activity-id}
53 *
54 * Undocumented: https://www.facebook.com/{username}/photos/{photo-id}
55 */
56 '~facebook\.com/(?:[^/]+)/(?:posts|activity|photos)/(?:[^/]+)/?~i',
57
58 /**
59 * https://www.facebook.com/notes/{username}/{note-url}/{note-id}
60 */
61 '~facebook\.com/notes/(?:[^/]+)/(?:[^/]+)/(?:[^/]+)/?~i',
62
63 /**
64 * https://www.facebook.com/photo.php?fbid={photo-id}
65 * https://www.facebook.com/permalink.php?story_fbid={post-id}
66 */
67 '~facebook\.com/(?:photo|permalink)\.php\?(?:(story_)?fbid)=(?:[^ ]+)~i',
68
69 /**
70 * https://www.facebook.com/photos/{photo-id}
71 * https://www.facebook.com/questions/{question-id}
72 */
73 '~facebook\.com/(?:photos|questions)/(?:[^/ ]+)/?~i',
74
75 /**
76 * NOTE: This url scheme is stated to be supported, however
77 * I havent found any example that work. I'm leaving it
78 * but I suspect that its not valid anymore.. we know how
79 * facebook is with API's :/
80 *
81 * However in order to be really complaint with the documentation
82 * I'm leaving the pattern.
83 *
84 * https://www.facebook.com/media/set?set={set-id}
85 */
86 '~facebook\.com/media/set/?\?set=(?:[^/ ]+)~i',
87 ];
88
89 /** Patterns that match video urls */
90 protected $videoPatterns = [
91 /**
92 * https://www.facebook.com/{page-name}/videos/{video-id}/
93 * https://www.facebook.com/{username}/videos/{video-id}/
94 */
95 '~facebook\.com/(?:[^/]+)/videos/(?:[^/]+)/?~i',
96
97 /**
98 * https://www.facebook.com/video.php?id={video-id}
99 * https://www.facebook.com/video.php?v={video-id}
100 */
101 '~facebook\.com/video\.php\?(?:id|v)=(?:[^ ]+)~i',
102
103 /**
104 * https://www.facebook.com/watch?v={video-id}
105 */
106 '~facebook\.com/watch\?v=(?:[^ ]+)~i',
107 ];
108
109 /** Patterns that match page urls */
110 protected $pagePatterns = array(
111 '~facebook\.com\/\S+[\/]?$~'
112 );
113
114 /**
115 * Checks if $url matches the given list of patterns
116 *
117 * @param string $url
118 * @param array $patternList
119 * @return bool
120 */
121 protected function urlMatchesPattern($url, array $patternList)
122 {
123 foreach ($patternList as $p) {
124 if (preg_match($p, (string) $url)) {
125 return true;
126 }
127 }
128
129 return false;
130 }
131
132 /** inline {@inheritdoc} */
133 public function validateUrl(Url $url)
134 {
135 return $this->urlMatchesPattern($url, array_merge($this->postPatterns, $this->videoPatterns, $this->pagePatterns));
136 }
137
138 /** inline {@inheritdoc} */
139 public function getEndpoint()
140 {
141 if ($this->urlMatchesPattern($this->url, $this->videoPatterns)) {
142 $type = 'video';
143 } elseif ($this->urlMatchesPattern($this->url, $this->postPatterns)) {
144 $type = 'post';
145 } else {
146 $type = 'page';
147 }
148
149 return str_replace('{type}', $type, $this->endpoint);
150 }
151
152 /** inline {@inheritdoc} */
153 public function normalizeUrl(Url $url)
154 {
155 $url->convertToHttps();
156 return $url;
157 }
158
159 /** inline {@inheritdoc} */
160 public function getStaticResponse() {
161 $response = [];
162 $params =$this->getParams();
163 $embedUrl = 'https://www.facebook.com/plugins/post.php?href={url}&width={width}&height={height}&show_text=true';
164 $height= 680;
165 $width = 500;
166 $attr = [];
167 $attr[] = 'class="embera-facebook-iframe-{md5}"';
168 $attr[] = 'src="' . $embedUrl . '"';
169 $attr[] = 'width="{width}"';
170 $attr[] = 'height="{height}"';
171 $attr[] = 'style="border:none;overflow:hidden"';
172 $attr[] = 'scrolling="no"';
173 $attr[] = 'frameborder="0"';
174 $attr[] = 'allowTransparency="true"';
175
176 $iframe = '<iframe ' . implode(' ', $attr) . '></iframe>';
177 if (!empty($params['maxheight'])) {
178 $height = $params['maxheight'];
179 } else {
180 if (!empty($params['maxwidth'])){
181 $height = min(680, (int) ($params['maxwidth'] + 100));
182 }
183 }
184
185 if (!empty($params['maxwidth'])) {
186 $width = $params['maxwidth'];
187 } else {
188 if (!empty($params['maxheight'])){
189 $width = min(500, (int) ($params['maxheight'] - 100));
190 }
191 }
192
193 $table = array(
194 '{url}' => rawurlencode($this->url),
195 '{md5}' => substr(md5($this->url), 0, 5),
196 '{width}' => $width,
197 '{height}' => $height,
198 );
199
200 // Replace the html response
201 $response['html'] = str_replace(array_keys($table), array_values($table), $iframe);
202
203 return $response;
204 }
205
206 }
207