PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 2.7.2
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v2.7.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 / vendor / wpdevelopers / embera / src / Embera / Provider / Facebook.php
embedpress / vendor / wpdevelopers / embera / src / Embera / Provider Last commit date
ActBlue.php 5 years ago Adways.php 5 years ago Altru.php 5 years ago AmCharts.php 5 years ago Animoto.php 5 years ago AnnieMusic.php 5 years ago Apester.php 5 years ago Archivos.php 5 years ago AudioClip.php 5 years ago Audioboom.php 5 years ago Audiomack.php 5 years ago Avocode.php 5 years ago Backtracks.php 5 years ago BeautifulAI.php 5 years ago BlackfireIO.php 5 years ago Blogcast.php 5 years ago Buttondown.php 5 years ago Byzart.php 5 years ago Ceros.php 5 years ago ChartBlocks.php 5 years ago Chirbit.php 5 years ago CircuitLab.php 5 years ago Clyp.php 5 years ago CocoCorp.php 5 years ago CodeHS.php 5 years ago CodePen.php 5 years ago CodeSandbox.php 5 years ago Codepoints.php 5 years ago Commaful.php 5 years ago Coub.php 5 years ago Cueup.php 5 years ago DailyMotion.php 5 years ago Datawrapper.php 5 years ago Deseretnews.php 5 years ago Deviantart.php 5 years ago Didacte.php 5 years ago Digiteka.php 5 years ago DocDroid.php 5 years ago DotSUB.php 5 years ago EduMedia.php 5 years ago Embedery.php 5 years ago Ethfiddle.php 5 years ago Eyrie.php 5 years ago FITE.php 5 years ago Facebook.php 5 years ago Fader.php 5 years ago FaithLifeTV.php 5 years ago Fitapp.php 5 years ago Flickr.php 5 years ago Flourish.php 5 years ago GeographCI.php 5 years ago GeographDE.php 5 years ago GeographUk.php 5 years ago GetShow.php 5 years ago GettyImages.php 5 years ago Gfycat.php 5 years ago Giphy.php 5 years ago GloriaTV.php 5 years ago Gyazo.php 5 years ago Hearthis.php 5 years ago HiHaHo.php 5 years ago Huffduffer.php 5 years ago IHeartRadio.php 5 years ago Infogram.php 5 years ago Infoveave.php 5 years ago Injurymap.php 5 years ago Inoreader.php 5 years ago Instagram.php 5 years ago Issuu.php 5 years ago Jovian.php 5 years ago KakaoTV.php 5 years ago Kickstarter.php 5 years ago Kidoju.php 5 years ago KirimEmail.php 5 years ago Kit.php 5 years ago Kmdr.php 5 years ago Knacki.php 5 years ago LearningApps.php 5 years ago LillePod.php 5 years ago Livestream.php 5 years ago Loom.php 5 years ago Ludus.php 5 years ago Lumiere.php 5 years ago Matterport.php 5 years ago MediaLab.php 5 years ago MedienArchivKuenste.php 5 years ago Meetup.php 5 years ago MermaidInk.php 5 years ago MessesInfo.php 5 years ago MicrosoftStream.php 5 years ago MixCloud.php 5 years ago ModeloIO.php 5 years ago MusicboxManiacs.php 5 years ago Namchey.php 5 years ago Nanoo.php 5 years ago NaturalAtlas.php 5 years ago Nfb.php 5 years ago NoPaste.php 5 years ago Omniscope.php 5 years ago OnSizzle.php 5 years ago OraTV.php 5 years ago Orbitvu.php 5 years ago Outplayed.php 5 years ago OverflowIO.php 5 years ago Oz.php 5 years ago Padlet.php 5 years ago Pastery.php 5 years ago Pinpoll.php 5 years ago Pixdor.php 5 years ago Playbuzz.php 5 years ago Podbean.php 5 years ago PolariShare.php 5 years ago Polldaddy.php 5 years ago Portfolium.php 5 years ago Posixion.php 5 years ago ProviderAdapter.php 5 years ago ProviderInterface.php 5 years ago RadioPublic.php 5 years ago Rcvis.php 5 years ago Reddit.php 5 years ago ReleaseWire.php 5 years ago Replit.php 5 years ago ReverbNation.php 5 years ago Roomshare.php 5 years ago RoosterTeeth.php 5 years ago Rumble.php 5 years ago RunKit.php 5 years ago Saooti.php 5 years ago SapoVideos.php 5 years ago ScreenNine.php 5 years ago Screencast.php 5 years ago ScribbleMaps.php 5 years ago Scribd.php 5 years ago SendToNews.php 5 years ago Shortnote.php 5 years ago Shoudio.php 5 years ago ShowTheWay.php 5 years ago Simplecast.php 5 years ago Sketchfab.php 5 years ago Slideshare.php 5 years ago SmashNotes.php 5 years ago Smugmug.php 5 years ago SocialExplorer.php 5 years ago SongLink.php 5 years ago SoundCloud.php 5 years ago SpeakerDeck.php 5 years ago Spotful.php 5 years ago Spotify.php 5 years ago Spreaker.php 5 years ago StandfordDigitalRepository.php 5 years ago Streamable.php 5 years ago Subscribi.php 5 years ago Sudomemo.php 5 years ago Sutori.php 5 years ago Sway.php 5 years ago Ted.php 5 years ago TheNewYorkTimes.php 5 years ago Tickcounter.php 5 years ago TikTok.php 5 years ago Toornament.php 5 years ago TourHero.php 5 years ago Tumblr.php 5 years ago Tuxx.php 5 years ago Tvcf.php 5 years ago TwentyThreeHq.php 5 years ago Twitter.php 5 years ago Typecast.php 5 years ago Typlog.php 5 years ago UniversitePantheonSorbonne.php 5 years ago UniversityCambridgeMap.php 5 years ago Uppy.php 5 years ago UstreamTV.php 5 years ago Ustudio.php 5 years ago Veer.php 5 years ago Verse.php 5 years ago Vidyard.php 5 years ago Vimeo.php 5 years ago Viously.php 5 years ago Vlipsy.php 5 years ago Vlive.php 5 years ago VoxSnap.php 5 years ago WaveVideo.php 5 years ago Wistia.php 5 years ago Wizer.php 5 years ago Wokwi.php 5 years ago WolframCloud.php 5 years ago Wordpress.php 5 years ago Wordwall.php 5 years ago Youtube.php 5 years ago Zeplin.php 5 years ago Zingsoft.php 5 years ago ZnipeTV.php 5 years ago Zoomable.php 5 years ago iFixit.php 5 years ago
Facebook.php
188 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 * @link https://facebook.com
20 */
21 class Facebook extends ProviderAdapter implements ProviderInterface
22 {
23 /** inline {@inheritdoc} */
24 protected $endpoint = 'https://graph.facebook.com/v8.0/oembed_{type}';
25
26 /** inline {@inheritdoc} */
27 protected static $hosts = [
28 'facebook.com'
29 ];
30
31 /** inline {@inheritdoc} */
32 protected $allowedParams = [ 'maxwidth', 'maxheight', 'callback', 'omitscript', 'breaking_change', 'access_token', 'fields' ];
33
34 /** inline {@inheritdoc} */
35 protected $httpsSupport = true;
36
37 /** inline {@inheritdoc} */
38 protected $responsiveSupport = false;
39
40 /** Patterns that match posts urls */
41 protected $postPatterns = [
42 /**
43 * https://www.facebook.com/{page-name}/posts/{post-id}
44 * https://www.facebook.com/{username}/posts/{post-id}
45 * https://www.facebook.com/{username}/activity/{activity-id}
46 *
47 * Undocumented: https://www.facebook.com/{username}/photos/{photo-id}
48 */
49 '~facebook\.com/(?:[^/]+)/(?:posts|activity|photos)/(?:[^/]+)/?~i',
50
51 /**
52 * https://www.facebook.com/notes/{username}/{note-url}/{note-id}
53 */
54 '~facebook\.com/notes/(?:[^/]+)/(?:[^/]+)/(?:[^/]+)/?~i',
55
56 /**
57 * https://www.facebook.com/photo.php?fbid={photo-id}
58 * https://www.facebook.com/permalink.php?story_fbid={post-id}
59 */
60 '~facebook\.com/(?:photo|permalink)\.php\?(?:(story_)?fbid)=(?:[^ ]+)~i',
61
62 /**
63 * https://www.facebook.com/photos/{photo-id}
64 * https://www.facebook.com/questions/{question-id}
65 */
66 '~facebook\.com/(?:photos|questions)/(?:[^/ ]+)/?~i',
67
68 /**
69 * NOTE: This url scheme is stated to be supported, however
70 * I havent found any example that work. I'm leaving it
71 * but I suspect that its not valid anymore.. we know how
72 * facebook is with API's :/
73 *
74 * However in order to be really complaint with the documentation
75 * I'm leaving the pattern.
76 *
77 * https://www.facebook.com/media/set?set={set-id}
78 */
79 '~facebook\.com/media/set/?\?set=(?:[^/ ]+)~i',
80 ];
81
82 /** Patterns that match video urls */
83 protected $videoPatterns = [
84 /**
85 * https://www.facebook.com/{page-name}/videos/{video-id}/
86 * https://www.facebook.com/{username}/videos/{video-id}/
87 */
88 '~facebook\.com/(?:[^/]+)/videos/(?:[^/]+)/?~i',
89
90 /**
91 * https://www.facebook.com/video.php?id={video-id}
92 * https://www.facebook.com/video.php?v={video-id}
93 */
94 '~facebook\.com/video\.php\?(?:id|v)=(?:[^ ]+)~i',
95 ];
96
97 /** Patterns that match page urls */
98 protected $pagePatterns = array(
99 '~facebook\.com\/\S+[\/]?$~'
100 );
101
102 /**
103 * Checks if $url matches the given list of patterns
104 *
105 * @param string $url
106 * @param array $patternList
107 * @return bool
108 */
109 protected function urlMatchesPattern($url, array $patternList)
110 {
111 foreach ($patternList as $p) {
112 if (preg_match($p, (string) $url)) {
113 return true;
114 }
115 }
116
117 return false;
118 }
119
120 /** inline {@inheritdoc} */
121 public function validateUrl(Url $url)
122 {
123 return $this->urlMatchesPattern($url, array_merge($this->postPatterns, $this->videoPatterns, $this->pagePatterns));
124 }
125
126 /** inline {@inheritdoc} */
127 public function getEndpoint()
128 {
129 if ($this->urlMatchesPattern($this->url, $this->videoPatterns)) {
130 $type = 'video';
131 } elseif ($this->urlMatchesPattern($this->url, $this->postPatterns)) {
132 $type = 'post';
133 } else {
134 $type = 'page';
135 }
136
137 return str_replace('{type}', $type, $this->endpoint);
138 }
139
140 /** inline {@inheritdoc} */
141 public function normalizeUrl(Url $url)
142 {
143 $url->convertToHttps();
144 return $url;
145 }
146
147 /** inline {@inheritdoc} */
148 public function modifyResponse(array $response = [])
149 {
150 if (!empty($response['html'])) {
151
152 // Backup the real response
153 $response['html_original'] = $response['html'];
154 $embedUrl = 'https://www.facebook.com/plugins/post.php?href={url}&width={width}&height={height}&show_text=true&appId';
155
156 $attr = [];
157 $attr[] = 'class="embera-facebook-iframe-{md5}"';
158 $attr[] = 'src="' . $embedUrl . '"';
159 $attr[] = 'width="{width}"';
160 $attr[] = 'height="{height}"';
161 $attr[] = 'style="border:none;overflow:hidden"';
162 $attr[] = 'scrolling="no"';
163 $attr[] = 'frameborder="0"';
164 $attr[] = 'allowTransparency="true"';
165
166 $iframe = '<iframe ' . implode(' ', $attr) . '></iframe>';
167 if (!empty($response['height'])) {
168 $height = $response['height'];
169 } else {
170 $height = min(680, (int) ($response['width'] + 100));
171 }
172
173 $table = array(
174 '{url}' => rawurlencode($this->url),
175 '{md5}' => substr(md5($this->url), 0, 5),
176 '{width}' => $response['width'],
177 '{height}' => $height,
178 );
179
180 // Replace the html response
181 $response['html'] = str_replace(array_keys($table), array_values($table), $iframe);
182 }
183
184 return $response;
185 }
186
187 }
188