diff --git a/plugin/AD_Overlay/AD_Overlay.php b/plugin/AD_Overlay/AD_Overlay.php index 474bcebf9..fe3771f4b 100644 --- a/plugin/AD_Overlay/AD_Overlay.php +++ b/plugin/AD_Overlay/AD_Overlay.php @@ -1,226 +1,228 @@ Help"; return $txt . $help; } public function getName() { return "AD_Overlay"; } public function getUUID() { return "ADO73225-3807-4167-ba81-0509dd280e06"; } public function getPluginVersion() { return "1.0"; } public function getEmptyDataObject() { global $global; $obj = new stdClass(); $o = new stdClass(); $o->type = "textarea"; $o->value = ' '; $obj->adText = $o; $o = new stdClass(); $o->type = "textarea"; $o->value = ' '; $obj->mobileAdText = $o; //$obj->allowUsersToAddCustomText = false; //Where to display overlays, by default. Assuming the included stylesheet is used, the following values are supported: // "top-left", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left". $obj->align = "bottom-left"; $obj->showBackground = true; //bottom aligned overlays will adjust positioning when the control bar minimizes. $obj->attachToControlBar = false; /* $obj->start = true; $obj->mid25Percent = false; $obj->mid50Percent = false; $obj->mid75Percent = false; $obj->end = false; $obj->durationInSeconds = 30; * */ $obj->debug = false; //$obj->adWidth = 0; //$obj->adHeight = 0; $obj->allowUserAds = true; $obj->AdminMustApproveUserAds = true; return $obj; } public function getHeadCode() { if (empty($_GET['videoName']) && empty($_GET['u']) && empty($_GET['link'])) { return false; } $obj = $this->getDataObject(); global $global; $style = "width: 100%;"; if (!empty($obj->adWidth) && !empty($obj->adHeight)) { $style = "width: $obj->adWidth; height: width: $obj->adHeight;"; } $css = ''; $css .= ''; return $css; } public function getFooterCode() { global $global, $video; if (basename($_SERVER["SCRIPT_FILENAME"]) === 'managerUsers.php') { include $global['systemRootPath'] . 'plugin/AD_Overlay/footer.php'; } if (empty($_GET['videoName']) && empty($_GET['u']) && empty($_GET['link'])) { return false; } $obj = $this->getDataObject(); if (isMobile()) { $adText = $obj->mobileAdText->value; } else { $adText = $obj->adText->value; } if ($obj->allowUserAds) { if (!empty($video['id'])) { $v = Video::getVideoLight($video['id']); $users_id = $video['users_id']; } if (!empty($_GET['c'])) { $u = new User(0, $_GET['u'], false); $users_id = $u->getBdId(); } if (empty($users_id)) { return ''; } $code = $this->getAdsFromUserIfActive($users_id); if (!empty($code)) { $adText = $code; } } if (empty(trim($adText))) { return ''; } + + $ad = AVideoPlugin::getObjectData('ADs'); $js = ''; $js .= ''; $onPlayerReady = "setTimeout(function(){ \$('#cbb').click(function() { \$('.vjs-overlay').fadeOut(); $('#mainVideo .vjs-control-bar').removeClass('vjs-hidden'); $('#mainVideo .vjs-control-bar').addClass('vjs-fade-out'); }); },1000); setTimeout(function(){ $('#mainVideo .vjs-control-bar').removeClass('vjs-hidden'); $('#mainVideo .vjs-control-bar').addClass('vjs-fade-out'); },3000); player.overlay({ content: $('#adOverlay').html(), debug: true, showBackground:" . ($obj->showBackground ? "true" : "false") . ", attachToControlBar:" . ($obj->attachToControlBar ? "true" : "false") . ", overlays: [{ start: 'play', end: 3600, align: '{$obj->align}' }] });"; $js .= ''; return $js; } public static function profileTabName($users_id) { global $global; if (!User::canUpload()) { return ''; } include $global['systemRootPath'] . 'plugin/AD_Overlay/profileTabName.php'; } public static function profileTabContent($users_id) { global $global; if (!User::canUpload()) { return ''; } include $global['systemRootPath'] . 'plugin/AD_Overlay/profileTabContent.php'; } public function getUsersManagerListButton() { $btn = ""; $obj = $this->getDataObject(); if (!empty($obj->allowUserAds)) { $btn = ''; } return $btn; } private function getAdsFromUserIfActive($users_id) { $ad = new AD_Overlay_Code(0); $ad->loadFromUser($users_id); if (!empty($ad->getStatus()) && $ad->getStatus() == 'a') { return $ad->getCode(); } return false; } } diff --git a/plugin/ADs/ADs.php b/plugin/ADs/ADs.php index 8ea0f3a04..15dc2e566 100644 --- a/plugin/ADs/ADs.php +++ b/plugin/ADs/ADs.php @@ -1,159 +1,159 @@ Help"; $help = ""; return $txt . $help; } public function getName() { return "ADs"; } public function getUUID() { return "ADs73225-3807-4167-ba81-0509dd280e06"; } public function getPluginVersion() { return "1.0"; } public function getEmptyDataObject() { global $global,$config; $obj = new stdClass(); $adsense = $config->getAdsense(); $o = new stdClass(); $o->type = "textarea"; $o->value = empty($adsense)?"
":$adsense;; $obj->leaderBoardBigVideo = $o; $o = new stdClass(); $o->type = "textarea"; $o->value = empty($adsense)?"":$adsense; $obj->leaderBoardTop = $o; $o = new stdClass(); $o->type = "textarea"; $o->value = empty($adsense)?"":$adsense; $obj->leaderBoardTop2 = $o; $o = new stdClass(); $o->type = "textarea"; $o->value = empty($adsense)?"":$adsense; $obj->channelLeaderBoardTop = $o; $o = new stdClass(); $o->type = "textarea"; $o->value = empty($adsense)?"":$adsense;; $obj->leaderBoardMiddle = $o; /* $o = new stdClass(); $o->type = "textarea"; $o->value = empty($adsense)?"":$adsense;; $obj->leaderBoardFooter = $o; * */ $o = new stdClass(); $o->type = "textarea"; $o->value = empty($adsense)?"":$adsense;; $obj->sideRectangle = $o; $o = new stdClass(); $o->type = "textarea"; $o->value = empty($adsense)?"
":$adsense;; $obj->leaderBoardBigVideoMobile = $o; $o = new stdClass(); $o->type = "textarea"; $o->value = empty($adsense)?"":$adsense;; $obj->leaderBoardTopMobile = $o; $o = new stdClass(); $o->type = "textarea"; $o->value = empty($adsense)?"":$adsense;; $obj->leaderBoardTopMobile2 = $o; $o = new stdClass(); $o->type = "textarea"; $o->value = empty($adsense)?"":$adsense; $obj->channelLeaderBoardTopMobile = $o; $o = new stdClass(); $o->type = "textarea"; $o->value = empty($adsense)?"":$adsense;; $obj->leaderBoardMiddleMobile = $o; /* $o = new stdClass(); $o->type = "textarea"; $o->value = empty($adsense)?"":$adsense; $obj->leaderBoardFooterMobile = $o; * */ $obj->tags3rdParty = ""; return $obj; } public function getHeadCode() { $head = ""; if(!empty($_GET['abkw'])){ $abkw = preg_replace('/[^a-zA-Z0-9_ ,-]/', '',$_GET['abkw']); $head .= ""; return $head; } $obj = $this->getDataObject(); if(!empty($_GET['videoName'])){ if(!empty($obj->tags3rdParty)){ $v = Video::getVideoFromCleanTitle($_GET['videoName']); if(!empty($v)){ $channelName = $v["channelName"]; $category = $v["category"]; $head .= str_replace(array('{ChannelName}','{Category}'), array(addcslashes($channelName,"'"), addcslashes($category,"'")), $obj->tags3rdParty); return $head; } } } if(!empty($_GET['catName'])){ if(!empty($obj->tags3rdParty)){ $v = Category::getCategoryByName($_GET['catName']); if(!empty($v)){ $head .= str_replace(array(',','{ChannelName}','{Category}'), array('', '', addcslashes($v["name"],"'")), $obj->tags3rdParty); return $head; } } } if(!empty($_GET['channelName'])){ if(!empty($obj->tags3rdParty)){ $head .= str_replace(array(',','{ChannelName}','{Category}'), array('', addcslashes($_GET['channelName'],"'"), ''), $obj->tags3rdParty); return $head; } } return "{$head}"; } static function giveGoogleATimeout($adCode){ if(preg_match("/adsbygoogle/i", $adCode)){ - $adCode = str_replace("(adsbygoogle = window.adsbygoogle || []).push({});", "clearTimeout(adsbygoogleTimeout); adsbygoogleTimeout = setTimeout(function () {(adsbygoogle = window.adsbygoogle || []).push({});},3000);", trim($adCode)); + $adCode = str_replace("(adsbygoogle = window.adsbygoogle || []).push({});", "clearTimeout(adsbygoogleTimeout); adsbygoogleTimeout = setTimeout(function () {(adsbygoogle = window.adsbygoogle || []).push({});},5000);", trim($adCode)); $adCode = "
{$adCode}
"; } return $adCode; } } \ No newline at end of file