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 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", 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/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..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] : ''; } } @@ -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; 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') { 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;