diff --git a/plugin/TheaterButton/TheaterButton.php b/plugin/TheaterButton/TheaterButton.php old mode 100644 new mode 100755 index 0b769dcc3..85e889ec9 --- a/plugin/TheaterButton/TheaterButton.php +++ b/plugin/TheaterButton/TheaterButton.php @@ -1,89 +1,96 @@ show_switch_button = true; $obj->compress_is_default = false; return $obj; } public function getHeadCode() { global $global; if (empty($_GET['videoName'])) { return ""; } $tmp = "mainVideo"; if(!empty($_SESSION['type'])){ if(($_SESSION['type']=="audio")||($_SESSION['type']=="linkAudio")){ $tmp = "mainAudio"; } } $css = ''; $css .= ''; return $css; } public function getJSFiles(){ global $global, $autoPlayVideo, $isEmbed; - $obj = $this->getDataObject(); - if ((empty($_GET['videoName']))||($isEmbed==1)) { - return array(); - } - $video = Video::getVideoFromCleanTitle($_GET['videoName']); - if($video['type']=='embed' || $video['type']=='article' || $video['type']=='pdf'){ - return ''; + if (!$this->showButton()) { + return ""; } + $obj = $this->getDataObject(); if(!empty($obj->show_switch_button)){ return array("plugin/TheaterButton/script.js","plugin/TheaterButton/addButton.js"); } return array("plugin/TheaterButton/script.js"); } public function getFooterCode() { global $global, $autoPlayVideo, $isEmbed; - if ((empty($_GET['videoName']))||($isEmbed==1)) { + if (!$this->showButton()) { return ""; } - $video = Video::getVideoFromCleanTitle($_GET['videoName']); - if($video['type']=='embed' || $video['type']=='article' || $video['type']=='pdf'){ - return ''; - } $obj = $this->getDataObject(); $js = ''; if(empty($obj->show_switch_button)){ if($obj->compress_is_default){ $js .= ''; }else{ $js .= ''; } } return $js; } + + private function showButton(){ + global $global, $isEmbed, $advancedCustom; + if ((empty($_GET['videoName']))) { + return false; + } + $video = Video::getVideoFromCleanTitle($_GET['videoName']); + if(($isEmbed==1 || $video['type']=='embed') && !$advancedCustom->disableYoutubePlayerIntegration){ + return false; + } + if($video['type']=='article' || $video['type']=='pdf'){ + return false; + } + return true; + } public function getTags() { return array('free', 'buttons', 'video player'); } }