PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 1.7.3
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v1.7.3
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 / library / ostraining / embera / Lib / Embera / Providers / Facebook.php
embedpress / library / ostraining / embera / Lib / Embera / Providers Last commit date
AmCharts.php 9 years ago Animatron.php 9 years ago Animoto.php 9 years ago AolOn.php 9 years ago AppNet.php 9 years ago AudioSnaps.php 9 years ago Bambuser.php 9 years ago BlipTV.php 9 years ago Cacoo.php 9 years ago Chartblocks.php 9 years ago Chirbit.php 9 years ago CircuitLab.php 9 years ago Clyp.php 9 years ago Codepoints.php 9 years ago CollegeHumor.php 9 years ago Coub.php 9 years ago CrowdRanking.php 9 years ago DailyMile.php 9 years ago DailyMotion.php 9 years ago Deviantart.php 9 years ago Dipity.php 9 years ago DotSub.php 9 years ago Edocr.php 9 years ago EgliseInfo.php 9 years ago Facebook.php 9 years ago Flickr.php 9 years ago FunnyOrDie.php 9 years ago GeographCI.php 9 years ago GeographDe.php 9 years ago GeographUk.php 9 years ago GettyImages.php 9 years ago Gfycat.php 9 years ago GithubGist.php 9 years ago Gmep.php 9 years ago Hq23.php 9 years ago Huffduffer.php 9 years ago Hulu.php 9 years ago IFTTT.php 9 years ago IFixIt.php 9 years ago Infogram.php 9 years ago Instagram.php 9 years ago Issuu.php 9 years ago Kickstarter.php 9 years ago LearningApps.php 9 years ago Meetup.php 9 years ago MixCloud.php 9 years ago MobyPicture.php 9 years ago NFB.php 9 years ago Officemix.php 9 years ago OfficialFM.php 9 years ago Oumy.php 9 years ago Pastery.php 9 years ago PollDaddy.php 9 years ago PollEveryWhere.php 9 years ago Portfolium.php 9 years ago Rapidengage.php 9 years ago Rdio.php 9 years ago ReleaseWire.php 9 years ago RepubHub.php 9 years ago Reverbnation.php 9 years ago Revision3.php 9 years ago Roomshare.php 9 years ago Rutube.php 9 years ago Sapo.php 9 years ago Screenr.php 9 years ago Scribd.php 9 years ago ShortNote.php 9 years ago Shoudio.php 9 years ago Showtheway.php 9 years ago Silk.php 9 years ago Sketchfab.php 9 years ago SlideShare.php 9 years ago SoundCloud.php 9 years ago Speakerdeck.php 9 years ago Spotify.php 9 years ago Sway.php 9 years ago Ted.php 9 years ago TheySaidSo.php 9 years ago Twitter.php 9 years ago Ustream.php 9 years ago Verse.php 9 years ago Viddler.php 9 years ago VideoFork.php 9 years ago VideoJug.php 9 years ago Vimeo.php 9 years ago Vine.php 9 years ago WordpressTV.php 9 years ago YFrog.php 9 years ago Yandex.php 9 years ago Youtube.php 9 years ago
Facebook.php
142 lines
1 <?php
2 /**
3 * Facebook.php
4 *
5 * @package Providers
6 * @author Michael Pratt <pratt@hablarmierda.net>
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\Providers;
14
15 /**
16 * The Facebook Provider (Public posts and videos)
17 * @link https://www.facebook.com
18 * @link https://developers.facebook.com/docs/plugins/oembed-endpoints
19 */
20 class Facebook extends \Embera\Adapters\Service
21 {
22 /**
23 * inline {@inheritdoc}
24 * This Provider is kind of special, because it uses different oembed endpoints
25 * based on the given url. The default value of the endpoint is null and is set
26 * during the process of getting the url information.
27 */
28 protected $apiUrl = null;
29
30 /** Patterns that match posts urls */
31 protected $postPatterns = array(
32 /**
33 * https://www.facebook.com/{page-name}/posts/{post-id}
34 * https://www.facebook.com/{username}/posts/{post-id}
35 * https://www.facebook.com/{username}/activity/{activity-id}
36 *
37 * Undocumented: https://www.facebook.com/{username}/photos/{photo-id}
38 */
39 '~facebook\.com/(?:[^/]+)/(?:posts|activity|photos)/(?:[^/]+)/?~i',
40
41 /**
42 * https://www.facebook.com/notes/{username}/{note-url}/{note-id}
43 */
44 '~facebook\.com/notes/(?:[^/]+)/(?:[^/]+)/(?:[^/]+)/?~i',
45
46 /**
47 * https://www.facebook.com/photo.php?fbid={photo-id}
48 * https://www.facebook.com/permalink.php?story_fbid={post-id}
49 */
50 '~facebook\.com/(?:photo|permalink)\.php\?(?:(story_)?fbid)=(?:[^ ]+)~i',
51
52 /**
53 * https://www.facebook.com/photos/{photo-id}
54 * https://www.facebook.com/questions/{question-id}
55 */
56 '~facebook\.com/(?:photos|questions)/(?:[^/ ]+)/?~i',
57
58 /**
59 * NOTE: This url scheme is stated to be supported, however
60 * I havent found any example that work. I'm leaving it
61 * but I suspect that its not valid anymore.. we know how
62 * facebook is with API's :/
63 *
64 * However in order to be really complaint with the documentation
65 * I'm leaving the pattern.
66 *
67 * https://www.facebook.com/media/set?set={set-id}
68 */
69 '~facebook\.com/media/set/?\?set=(?:[^/ ]+)~i',
70 );
71
72 /** Patterns that match video urls */
73 protected $videoPatterns = array(
74 /**
75 * https://www.facebook.com/{page-name}/videos/{video-id}/
76 * https://www.facebook.com/{username}/videos/{video-id}/
77 */
78 '~facebook\.com/(?:[^/]+)/videos/(?:[^/]+)/?~i',
79
80 /**
81 ` * https://www.facebook.com/video.php?id={video-id}
82 * https://www.facebook.com/video.php?v={video-id}
83 */
84 '~facebook\.com/video\.php\?(?:id|v)=(?:[^ ]+)~i',
85 );
86
87 /** Patterns that match page urls */
88 protected $pagePatterns = array(
89 '~facebook\.com\/(?:[^\/]+)[\/]?$~'
90 );
91
92 /** inline {@inheritdoc} */
93 protected function validateUrl()
94 {
95 $this->url->convertToHttps();
96 return ($this->urlMatchesPattern(array_merge($this->postPatterns, $this->videoPatterns, $this->pagePatterns)));
97 }
98
99 /**
100 * Checks if $this->url matches the given list of patterns
101 *
102 * @param array $patternList Array with regex
103 * @return bool
104 */
105 protected function urlMatchesPattern(array $patternList)
106 {
107 foreach ($patternList as $p) {
108 if (preg_match($p, $this->url)) {
109 return true;
110 }
111 }
112
113 return false;
114 }
115
116 /**
117 * inline {@inheritdoc}
118 *
119 * Im overriding this method because I need to set the
120 * endpoint based on the given url. By default we're always assuming
121 * it is a post url unless we have a specific video match.
122 *
123 * Why? Because we already did url validation and We dont want
124 * to loop over both sets of patterns all over again right? So
125 * we just need to loop over the smaller one ;)
126 */
127 public function getInfo()
128 {
129 if ($this->urlMatchesPattern($this->videoPatterns)) {
130 $this->apiUrl = 'https://www.facebook.com/plugins/video/oembed.json/';
131 } else if ($this->urlMatchesPattern($this->postPatterns)) {
132 $this->apiUrl = 'https://www.facebook.com/plugins/post/oembed.json/';
133 } else {
134 $this->apiUrl = 'https://www.facebook.com/plugins/page/oembed.json/';
135 }
136
137 return parent::getInfo();
138 }
139 }
140
141 ?>
142