Skip to content

Commit

Permalink
Merge branch 'release/4.0.0-beta.1' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Welch committed Mar 27, 2022
2 parents 161fc9c + 3a05df4 commit 95121b0
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 115 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# YouTube Live Embed Changelog

## 4.0.0-beta.1 - 2022.03.27

### Added

* Initial Craft CMS 4 compatibility

## 1.0.5 2020-07-12

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
The MIT License (MIT)

Copyright (c) 2019 nystudio107
Copyright (c) 2022 nystudio107

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nystudio107/craft-youtubeliveembed/badges/quality-score.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-youtubeliveembed/?branch=v1) [![Code Coverage](https://scrutinizer-ci.com/g/nystudio107/craft-youtubeliveembed/badges/coverage.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-youtubeliveembed/?branch=v1) [![Build Status](https://scrutinizer-ci.com/g/nystudio107/craft-youtubeliveembed/badges/build.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-youtubeliveembed/build-status/v1) [![Code Intelligence Status](https://scrutinizer-ci.com/g/nystudio107/craft-youtubeliveembed/badges/code-intelligence.svg?b=v1)](https://scrutinizer-ci.com/code-intelligence)

# YouTube Live Embed plugin for Craft CMS 3.x
# YouTube Live Embed plugin for Craft CMS 4.x

This plugin allows you to embed a YouTube live stream and/or live chat on your webpage

![Screenshot](./docs/docs/resources/img/plugin-logo.png)

## Requirements

This plugin requires Craft CMS 3.0.0 or later and PHP 7.0+.
This plugin requires Craft CMS 4.0.0 or later and PHP 7.0+.

## Installation

Expand Down
83 changes: 39 additions & 44 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,47 +1,42 @@
{
"name": "nystudio107/craft-youtubeliveembed",
"description": "This plugin allows you to embed a YouTube live stream and/or live chat on your webpage",
"type": "craft-plugin",
"version": "1.0.5",
"keywords": [
"craft",
"cms",
"craftcms",
"craft-plugin",
"youtube",
"live",
"stream",
"chat",
"embed"
],
"support": {
"docs": "https://nystudio107.com/plugins/youtube-live-embed/documentation",
"issues": "https://nystudio107.com/plugins/youtube-live-embed/support"
},
"license": "MIT",
"authors": [
{
"name": "nystudio107",
"homepage": "https://nystudio107.com"
}
],
"require": {
"craftcms/cms": "^3.0.0"
},
"autoload": {
"psr-4": {
"nystudio107\\youtubeliveembed\\": "src/"
}
},
"extra": {
"name": "YouTube Live Embed",
"handle": "youtubeliveembed",
"hasCpSettings": true,
"hasCpSection": false,
"changelogUrl": "https://raw.githubusercontent.com/nystudio107/craft-youtubeliveembed/master/CHANGELOG.md",
"components": {
"embed": "nystudio107\\youtubeliveembed\\services\\Embed"
},
"class": "nystudio107\\youtubeliveembed\\YoutubeLiveEmbed"
"name": "nystudio107/craft-youtubeliveembed",
"description": "This plugin allows you to embed a YouTube live stream and/or live chat on your webpage",
"type": "craft-plugin",
"version": "4.0.0-beta.1",
"keywords": [
"craft",
"cms",
"craftcms",
"craft-plugin",
"youtube",
"live",
"stream",
"chat",
"embed"
],
"support": {
"docs": "https://nystudio107.com/docs/youtubeliveembed/",
"issues": "https://nystudio107.com/plugins/youtube-live-embed/support",
"source": "https://github.com/nystudio107/craft-youtubeliveembed"
},
"license": "MIT",
"authors": [
{
"name": "nystudio107",
"homepage": "https://nystudio107.com"
}
],
"require": {
"craftcms/cms": "^4.0.0-beta.1"
},
"autoload": {
"psr-4": {
"nystudio107\\youtubeliveembed\\": "src/"
}
},
"extra": {
"class": "nystudio107\\youtubeliveembed\\YoutubeLiveEmbed",
"handle": "youtubeliveembed",
"name": "YouTube Live Embed"
}
}
44 changes: 31 additions & 13 deletions src/YoutubeLiveEmbed.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@

namespace nystudio107\youtubeliveembed;

use nystudio107\youtubeliveembed\services\Embed as EmbedService;
use nystudio107\youtubeliveembed\variables\YoutubeLiveEmbedVariable;
use nystudio107\youtubeliveembed\models\Settings;

use Craft;
use craft\base\Plugin;
use craft\services\Plugins;
use craft\events\PluginEvent;
use craft\web\twig\variables\CraftVariable;

use nystudio107\youtubeliveembed\models\Settings;
use nystudio107\youtubeliveembed\services\Embed as EmbedService;
use nystudio107\youtubeliveembed\variables\YoutubeLiveEmbedVariable;
use yii\base\Event;

/**
Expand All @@ -37,14 +33,14 @@ class YoutubeLiveEmbed extends Plugin
// =========================================================================

/**
* @var YoutubeLiveEmbed
* @var ?YoutubeLiveEmbed
*/
public static $plugin;
public static ?YoutubeLiveEmbed $plugin = null;

/**
* @var string
*/
public static $youtubeChannelId;
public static string $youtubeChannelId = '';

// Public Properties
// =========================================================================
Expand All @@ -54,13 +50,35 @@ class YoutubeLiveEmbed extends Plugin
*/
public string $schemaVersion = '1.0.0';

/**
* @var bool
*/
public bool $hasCpSection = false;

/**
* @var bool
*/
public bool $hasCpSettings = false;

// Public Methods
// =========================================================================

/**
* @inheritdoc
*/
public function init()
public function __construct($id, $parent = null, array $config = [])
{
$config['components'] = [
'embed' => EmbedService::class,
];

parent::__construct($id, $parent, $config);
}

/**
* @inheritdoc
*/
public function init(): void
{
parent::init();
self::$plugin = $this;
Expand All @@ -69,7 +87,7 @@ public function init()
Event::on(
CraftVariable::class,
CraftVariable::EVENT_INIT,
function (Event $event) {
static function (Event $event) {
/** @var CraftVariable $variable */
$variable = $event->sender;
$variable->set('youtubelive', YoutubeLiveEmbedVariable::class);
Expand All @@ -92,7 +110,7 @@ function (Event $event) {
/**
* @inheritdoc
*/
protected function createSettingsModel(): ?\craft\base\Model
protected function createSettingsModel(): Settings
{
return new Settings();
}
Expand Down
4 changes: 1 addition & 3 deletions src/controllers/InfoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@

namespace nystudio107\youtubeliveembed\controllers;

use nystudio107\youtubeliveembed\YoutubeLiveEmbed;

use Craft;
use craft\web\Controller;
use nystudio107\youtubeliveembed\YoutubeLiveEmbed;

/**
* @author nystudio107
Expand Down
9 changes: 5 additions & 4 deletions src/helpers/PluginTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Craft;
use craft\helpers\Template;
use craft\web\View;
use Twig\Markup;
use yii\base\Exception;

/**
Expand Down Expand Up @@ -44,12 +45,12 @@ public static function renderStringTemplate(string $templateString, array $param
/**
* Render a plugin template
*
* @param $templatePath
* @param $params
* @param string $templatePath
* @param array $params
*
* @return \Twig\Markup
* @return Markup
*/
public static function renderPluginTemplate(string $templatePath, array $params = []): \Twig\Markup
public static function renderPluginTemplate(string $templatePath, array $params = []): Markup
{
// Stash the old template mode, and set it Control Panel template mode
$oldMode = Craft::$app->view->getTemplateMode();
Expand Down
4 changes: 2 additions & 2 deletions src/models/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ class Settings extends Model
/**
* @var string
*/
public $youtubeChannelId = '';
public string $youtubeChannelId = '';

/**
* @var bool
*/
public $isLive = false;
public bool $isLive = false;

// Public Methods
// =========================================================================
Expand Down
Loading

0 comments on commit 95121b0

Please sign in to comment.