-
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
10 changed files
with
147 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
assets/logo.svg | ||
*.xcf | ||
.idea |
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
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,51 @@ | ||
<?php | ||
/** | ||
* | ||
* This file is part of Grav MediaEmbed plugin. | ||
* | ||
* Dual licensed under the MIT or GPL Version 3 licenses, see LICENSE. | ||
* http://benjamin-regler.de/license/ | ||
*/ | ||
|
||
namespace Grav\Plugin\MediaEmbed\Services; | ||
|
||
use Grav\Plugin\MediaEmbed\OEmbed\OEmbedRich; | ||
|
||
/** | ||
*/ | ||
class Twitter extends OEmbedRich | ||
{ | ||
|
||
public function getOEmbed() | ||
{ | ||
if ($this->oembed) { | ||
return $this->oembed; | ||
} | ||
|
||
$endpoint = $this->format($this->config->get('endpoint', '')); | ||
if (!$endpoint) { | ||
return []; | ||
} | ||
|
||
$response = \Requests::get($endpoint); | ||
if (!$response->success) { | ||
$response->throw_for_status(); | ||
} | ||
|
||
$json = json_decode($response->body, true); | ||
|
||
$this->oembed = [ | ||
'type' => 'rich', | ||
'author_name' => $json['author_name'], | ||
'author_url' => 'https://twitter.com/' . $json['author_name'], | ||
'provider_name' => 'Twitter', | ||
'provider_url' => 'https://twitter.com/', | ||
'url' => 'https://www.twitter.com/' . $this->embedCode, | ||
'html' => $json['html'], | ||
]; | ||
|
||
return $this->oembed; | ||
} | ||
} |
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,6 +1,6 @@ | ||
<?php | ||
/** | ||
* MediaEmbed v1.2.0 | ||
* MediaEmbed v1.3.0 | ||
* | ||
* This plugin embeds several media sites (e.g. YouTube, Vimeo, | ||
* Soundcloud) by only providing the URL to the medium. | ||
|
@@ -9,10 +9,10 @@ | |
* http://benjamin-regler.de/license/ | ||
* | ||
* @package MediaEmbed | ||
* @version 1.2.0 | ||
* @version 1.3.0 | ||
* @link <https://github.com/sommerregen/grav-plugin-archive-plus> | ||
* @author Benjamin Regler <[email protected]> | ||
* @copyright 2015, Benjamin Regler | ||
* @copyright 2017, Benjamin Regler | ||
* @license <http://opensource.org/licenses/MIT> MIT | ||
* @license <http://opensource.org/licenses/GPL-3.0> GPLv3 | ||
*/ | ||
|
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