-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from wrav/release/1.3.0
Changes for v1.3.0
- Loading branch information
Showing
14 changed files
with
204 additions
and
14 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 |
---|---|---|
|
@@ -40,6 +40,7 @@ public function init() | |
]; | ||
|
||
$this->css = [ | ||
'css/oembed.css', | ||
]; | ||
|
||
parent::init(); | ||
|
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,15 @@ | ||
.oembed-header { | ||
margin: 0.5rem 0; | ||
background: #f3f7fc; | ||
padding: 10px 15px; | ||
cursor: pointer | ||
} | ||
|
||
.oembed-preview { | ||
width: 100%; | ||
overflow: hidden; | ||
} | ||
|
||
.oembed-preview iframe { | ||
max-width: 100%; | ||
} |
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,21 @@ | ||
<?php | ||
namespace wrav\oembed\events; | ||
|
||
use craft; | ||
use craft\base\ElementInterface; | ||
use craft\behaviors\DraftBehavior; | ||
use yii\base\Event; | ||
|
||
/** | ||
* Broken Url event class. | ||
* | ||
* @since 1.2.6 | ||
*/ | ||
class BrokenUrlEvent extends Event | ||
{ | ||
/** | ||
* @var string The url which is broken | ||
*/ | ||
public $url; | ||
|
||
} |
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,52 @@ | ||
<?php | ||
namespace wrav\oembed\jobs; | ||
|
||
use craft; | ||
use craft\base\ElementInterface; | ||
use craft\behaviors\DraftBehavior; | ||
use craft\queue\BaseJob; | ||
use wrav\oembed\Oembed; | ||
|
||
/** | ||
* BrokenUrlNotify job class. | ||
* | ||
* @since 1.2.6 | ||
*/ | ||
class BrokenUrlNotify extends BaseJob | ||
{ | ||
public $url = null; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function execute($queue) | ||
{ | ||
$email = Oembed::getInstance()->getSettings()->notificationEmail; | ||
$subject = Craft::$app->getSystemName() . ' :: oEmbed detected broken URL'; | ||
|
||
if (!$email) { | ||
$email = \craft\helpers\App::mailSettings()->fromEmail; | ||
} | ||
|
||
if (!$email || !$this->url) { | ||
return false; | ||
} | ||
|
||
return Craft::$app | ||
->getMailer() | ||
->compose() | ||
->setTo($email) | ||
->setSubject($subject) | ||
->setHtmlBody('The following URL is invalid: '.$this->url) | ||
->send(); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function defaultDescription(): string | ||
{ | ||
return Craft::t('app', 'Send notification of broken URL'); | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -1,9 +1,7 @@ | ||
{% set media = craft.oembed.embed(url) %} | ||
|
||
{% if media and media.code|default(false) %} | ||
<div class="embed-preview"> | ||
{{ media.code|default('')|raw }} | ||
</div> | ||
{{ media.code|default('')|raw }} | ||
{% else %} | ||
<p class="error">Please check your URL.</p> | ||
{% endif %} |
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