Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sommerregen committed May 17, 2015
2 parents 4629952 + eed562b commit 46620de
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 5 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# v1.1.0
## 05/17/2015

1. [](#new)
* Added support for **Slides.com SlideDesk** as requested in issue [#4](https://github.com/Sommerregen/grav-plugin-mediaembed/issues/4)
2. [](#improved)
* Assets checks (in rare cases it was possible that MediaEmbed throws an error)

# v1.0.2
## 05/10/2015

Expand All @@ -13,7 +21,7 @@
## 04/28/2015

3. [](#bugfix)
* Fixed issue #1 with broken MediaEmbed functionality (i.e. removed test code)
* Fixed issue [#1](https://github.com/Sommerregen/grav-plugin-mediaembed/issues/1) with broken MediaEmbed functionality (i.e. removed test code)

# v1.0.0
## 04/26/2015
Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: MediaEmbed
version: 1.0.2
version: 1.1.0
description: "This plugin embeds several media sites (e.g. YouTube, Vimeo, Soundcloud) by only providing the URL to the medium."
icon: spinner
author:
Expand Down
4 changes: 3 additions & 1 deletion classes/OEmbed/OEmbed.php
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,9 @@ public function onTwigTemplateVariables(Event $event)
{
$mediaembed = $event['mediaembed'];
foreach ($this->config->get('assets', []) as $asset) {
$mediaembed->add($asset);
if (is_string($asset) && strlen($asset) > 0) {
$mediaembed->add($asset);
}
}
}

Expand Down
72 changes: 72 additions & 0 deletions classes/Services/Slides.php
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;
}
}
4 changes: 2 additions & 2 deletions mediaembed.php
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
Expand Down
21 changes: 21 additions & 0 deletions mediaembed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,24 @@ services:
- "gist.github.com/*"
- "gist.github.com/*/*"
- "gist.github.com/*?*"

Slides:
enabled: true # Set to false to disable this service completely
type: "rich" # Type of the media service

# Canonical URL of media service (used in endpoint calls)
canonical: "http://slides.com/{:id}"

# Endpoint to grab media informations
endpoint: "http://slides.com/{:id}"

# Schemes to grab media id
schemes:
- "slides.com/*"
- "slid.es/*"

# Custom service-related media option overrides
params:
style: "light" # Footer style: dark, light, hidden
width: 1920
height: 1400

0 comments on commit 46620de

Please sign in to comment.