-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
108 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
/** | ||
* Slides.com | ||
* | ||
* Present your ideas - Slides is a place for creating, presenting and | ||
* sharing presentations. | ||
* | ||
* Licensed under MIT, see LICENSE. | ||
*/ | ||
|
||
namespace Grav\Plugin\MediaEmbed\Services; | ||
|
||
use Grav\Plugin\MediaEmbed\OEmbed\OEmbedRich; | ||
|
||
/** | ||
* Slides | ||
*/ | ||
class Slides extends OEmbedRich | ||
{ | ||
public function getOEmbed() | ||
{ | ||
if ($this->oembed) { | ||
return $this->oembed; | ||
} | ||
|
||
$endpoint = $this->format($this->config->get('endpoint', '')); | ||
if (!$endpoint) { | ||
return []; | ||
} | ||
|
||
// Extract owner from embed code | ||
list($owner, $id) = explode('/', $this->embedCode, 2); | ||
|
||
// Fake response | ||
$this->oembed = [ | ||
'type' => 'rich', | ||
'title' => '', | ||
'description' => '', | ||
'author_name' => $owner, | ||
'author_url' => 'http://slides.com/'.$owner, | ||
'provider' => 'Slides', | ||
'provider_url' => 'http://slides.com', | ||
'url' => 'http://slides.com/'.$this->embedCode, | ||
'html' => '<iframe src="//slides.com/'.rtrim($this->embedCode, '/').'/embed" width="576" height="420" scrolling="no" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>', | ||
'width' => 576, | ||
'height' => 420, | ||
]; | ||
|
||
return $this->oembed; | ||
} | ||
|
||
public function getEmbedCode($params = []) | ||
{ | ||
$embed = parent::getEmbedCode($params); | ||
if ($this->embedCode && $this->oembed) { | ||
// Inject parameters directly into HTML OEmbed attribute | ||
$query = http_build_query($this->params()); | ||
$url = $this->attributes['protocol'].'slides.com/'.rtrim($this->embedCode, '/').'/embed'; | ||
if (mb_strlen($query) > 0) { | ||
$url .= (false === strpos($url, '?') ? '?' : '&') . $query; | ||
} | ||
|
||
// Get width and height | ||
$width = $this->attributes['width']; | ||
$height = $this->attributes['height']; | ||
|
||
$embed = '<iframe src="'.$url.'" width="'.$width.'" height="'.$height.'" scrolling="no" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'; | ||
} | ||
|
||
return $embed; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
<?php | ||
/** | ||
* MediaEmbed v1.0.2 | ||
* MediaEmbed v1.1.0 | ||
* | ||
* This plugin embeds several media sites (e.g. YouTube, Vimeo, | ||
* Soundcloud) by only providing the URL to the medium. | ||
* | ||
* Licensed under MIT, see LICENSE. | ||
* | ||
* @package MediaEmbed | ||
* @version 1.0.2 | ||
* @version 1.1.0 | ||
* @link <https://github.com/sommerregen/grav-plugin-archive-plus> | ||
* @author Benjamin Regler <[email protected]> | ||
* @copyright 2015, Benjamin Regler | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters