From 2bb068419555905eaad4dcd149282e62f9857d09 Mon Sep 17 00:00:00 2001 From: NicolasGraph Date: Fri, 30 Jun 2017 10:43:37 +0200 Subject: [PATCH 1/6] Shortens code: $id does not need $item to be set --- src/player/providers/Bandcamp.php | 3 +-- src/player/providers/Provider.php | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/player/providers/Bandcamp.php b/src/player/providers/Bandcamp.php index e175cfe..1a4ca60 100644 --- a/src/player/providers/Bandcamp.php +++ b/src/player/providers/Bandcamp.php @@ -100,8 +100,7 @@ public function getInfos() */ public function getPlayer() { - $item = preg_match('/([.][a-z]+\/)/', $this->play) ? $this->getInfos() : $this->play; - $id = isset($item['id']) ? $item['id'] : $this->play; + $id = preg_match('/([.][a-z]+\/)/', $this->play) ? $this->getInfos()['id'] : $this->play; if ($id) { $src = $this->src . $id; diff --git a/src/player/providers/Provider.php b/src/player/providers/Provider.php index 60e256b..a36a223 100644 --- a/src/player/providers/Provider.php +++ b/src/player/providers/Provider.php @@ -223,8 +223,7 @@ public function getSize() */ public function getPlayer() { - $item = preg_match('/([.][a-z]+\/)/', $this->play) ? $this->getInfos() : $this->play; - $id = isset($item['id']) ? $item['id'] : $this->play; + $id = preg_match('/([.][a-z]+\/)/', $this->play) ? $this->getInfos()['id'] : $this->play; if ($id) { $src = $this->src . $id; From 639b2468b6a3cc81d356c2d12897d92469c2bbe2 Mon Sep 17 00:00:00 2001 From: NicolasGraph Date: Fri, 30 Jun 2017 10:44:09 +0200 Subject: [PATCH 2/6] Typo --- docs/main/Basics.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/main/Basics.textile b/docs/main/Basics.textile index 5fa00b9..940fd2e 100644 --- a/docs/main/Basics.textile +++ b/docs/main/Basics.textile @@ -69,7 +69,7 @@ h2. Uninstall h3. From the admin interface # Check the box on the left of the plugin row under the "Admin > Plugins":?event=plugin. -# open the select list at the bottom of the plugins tables and choose _Delete_. +# open the select list at the bottom of the plugins table and choose _Delete_. # confirm the plugin deletion. h3. Via Composer From afcb920136ccf37da69096cc3d3bf3c999d0ea89 Mon Sep 17 00:00:00 2001 From: NicolasGraph Date: Fri, 30 Jun 2017 10:50:58 +0200 Subject: [PATCH 3/6] Clarifies code by using the same chunk as for Twitch --- src/player/providers/Audio.php | 11 ++++++++--- src/player/providers/Video.php | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/player/providers/Audio.php b/src/player/providers/Audio.php index a475284..a34569b 100644 --- a/src/player/providers/Audio.php +++ b/src/player/providers/Audio.php @@ -65,9 +65,14 @@ class Audio extends Video */ public function getPlayer() { - $item = preg_match('/([.][a-z]+)/', $this->play) ? $this->getInfos() : $this->play; - $id = isset($item['id']) ? $item['id'] : $this->play; - $type = isset($item['type']) ? $item['type'] : 'id'; + if (preg_match('/([.][a-z]+\/)/', $this->play)) { + $item = $this->getInfos(); + $id = $item['id']; + $type = $item['type']; + } else { + $id = $this->play; + $type = 'id'; + } if ($item) { if ($type === 'url') { diff --git a/src/player/providers/Video.php b/src/player/providers/Video.php index 2bc2366..f853ec5 100644 --- a/src/player/providers/Video.php +++ b/src/player/providers/Video.php @@ -96,9 +96,14 @@ public function getParams() */ public function getPlayer() { - $item = preg_match('/([.][a-z]+)/', $this->play) ? $this->getInfos() : $this->play; - $id = isset($item['id']) ? $item['id'] : $this->play; - $type = isset($item['type']) ? $item['type'] : 'id'; + if (preg_match('/([.][a-z]+\/)/', $this->play)) { + $item = $this->getInfos(); + $id = $item['id']; + $type = $item['type']; + } else { + $id = $this->play; + $type = 'id'; + } if ($item) { if ($type === 'url') { From a24f0b1997d7f597dd0663451dd51189be1f437c Mon Sep 17 00:00:00 2001 From: NicolasGraph Date: Fri, 30 Jun 2017 11:56:42 +0200 Subject: [PATCH 4/6] Fixes player width unit when get from height --- src/player/providers/Provider.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/player/providers/Provider.php b/src/player/providers/Provider.php index a36a223..3292b2c 100644 --- a/src/player/providers/Provider.php +++ b/src/player/providers/Provider.php @@ -210,8 +210,8 @@ public function getSize() isset($unit[0]) ? $dims['height'] .= $unit[0] : ''; } elseif ($dims['height']) { $dims['width'] = $dims['height'] * $aspect; - preg_match("/(\D+)/", $dims['width'], $unit); - isset($unit[0]) ? $dims['height'] .= $unit[0] : ''; + preg_match("/(\D+)/", $dims['height'], $unit); + isset($unit[0]) ? $dims['width'] .= $unit[0] : ''; } } From ab0ea14878efe07287e044479074812f97a5d59e Mon Sep 17 00:00:00 2001 From: NicolasGraph Date: Thu, 13 Jul 2017 16:26:26 +0200 Subject: [PATCH 5/6] Fixes https://forum.textpattern.io/viewtopic.php?pid=306270#p306270 --- src/tags.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/tags.php b/src/tags.php index 428d1db..c47e871 100644 --- a/src/tags.php +++ b/src/tags.php @@ -27,8 +27,8 @@ function oui_player($atts, $thing) { global $thisarticle, $oui_player_item; - $class = 'Oui\Player\Main'; - $obj = $class::getInstance(); + $player = 'Oui\Player\Main'; + $obj = $player::getInstance(); // Set tag attributes $get_atts = $obj->getAtts(__FUNCTION__); @@ -45,9 +45,9 @@ function oui_player($atts, $thing) } if ($provider) { - $class = 'Oui\Player\\' . $provider; - if (class_exists($class)) { - $obj = $class::getInstance(); + $player = 'Oui\Player\\' . $provider; + if (class_exists($player)) { + $obj = $player::getInstance(); } else { trigger_error('Unknown or unset provider: "' . $provider . '".'); return; @@ -68,8 +68,8 @@ function oui_if_player($atts, $thing) { global $thisarticle, $oui_player_item; - $class = 'Oui\Player\Main'; - $obj = $class::getInstance(); + $player = 'Oui\Player\Main'; + $obj = $player::getInstance(); // Set tag attributes $get_atts = $obj->getAtts(__FUNCTION__); @@ -78,9 +78,9 @@ function oui_if_player($atts, $thing) // Check if the play attribute value is recognised. if ($provider) { - $class = 'Oui\Player\\' . $provider; - if (class_exists($class)) { - $obj = $class::getInstance(); + $player = 'Oui\Player\\' . $provider; + if (class_exists($player)) { + $obj = $player::getInstance(); } else { trigger_error('Unknown or unset provider: "' . $provider . '".'); return; From 9990a8ffceddc04525c99865d0c9bb71734223f4 Mon Sep 17 00:00:00 2001 From: NicolasGraph Date: Thu, 13 Jul 2017 16:28:08 +0200 Subject: [PATCH 6/6] Version update --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 25afba4..e26cf1a 100755 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name" : "oui_player", "description" : "Embed customised players", - "version" : "1.3.0", + "version" : "1.3.1", "type" : 1, "author" : "Nicolas Morand", "author_uri" : "http://github.com/NicolasGraph",