diff --git a/code/Profiles/SocialFeed_Profile.php b/code/Profiles/SocialFeed_Profile.php index 04e81d0..4864231 100644 --- a/code/Profiles/SocialFeed_Profile.php +++ b/code/Profiles/SocialFeed_Profile.php @@ -201,7 +201,7 @@ public function getTemplates() { } public function getStyleClasses() { - return singleton('utilities')->raw2htmlid('platform-' . str_replace('_', '-', strtolower($this->singular_name()))); + return singleton('mwm')->raw2htmlid('platform-' . str_replace('_', '-', strtolower($this->singular_name()))); } public function Link($parent = null) { diff --git a/code/Providers/Facebook.php b/code/Providers/Facebook.php index c0ff4cd..83bf935 100644 --- a/code/Providers/Facebook.php +++ b/code/Providers/Facebook.php @@ -20,6 +20,8 @@ class Facebook extends Oauth implements \Flushable protected $defaultType = 'feed'; + protected $allowLargeUnsafeImages = true; + protected $replaceInUrls = [ //'/v/' => '/', // 'p600x600/' => '', @@ -212,6 +214,19 @@ protected function handlePost(array $data, $settings = [], $type = 'feed', $user } } + if($post['Type'] == 'video' && $post['Source']) { + $url = parse_url($post['Source']); + parse_str($url['query'], $query); + + if(isset($query['autoplay'])) { + unset($query['autoplay']); + } + + $url = sprintf('%s://%s%s%s', $url['scheme'], $url['host'], $url['path'], (!empty($query) ? '?' . http_build_query($query) : '')); + + $post['ObjectEmbed'] = ''; + } + return $post; } @@ -266,6 +281,17 @@ protected function getPictureFromData($data) { else $link = $data; + if($this->allowLargeUnsafeImages && strpos($link, '/safe_image.php?') !== false) { + $parts = parse_url($link); + + if(isset($parts['query'])) { + parse_str($parts['query'], $query); + if(isset($query['url'])) { + $link = $query['url']; + } + } + } + return $link ? str_replace(array_keys($this->replaceInUrls), array_values($this->replaceInUrls), $link) : ''; } diff --git a/code/SocialFeed.php b/code/SocialFeed.php index 249ada7..19a7d81 100644 --- a/code/SocialFeed.php +++ b/code/SocialFeed.php @@ -7,6 +7,10 @@ * @author Mellisa Hankins */ +if(!class_exists('Page')) { + return; +} + class SocialFeed extends Page { private static $description = 'A page that displays a social feed from various social platforms';