mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
Creating a plugin for replace configurations->adsense
This commit is contained in:
parent
c3dc469ccc
commit
f5be6d3579
16 changed files with 342 additions and 237 deletions
|
@ -1973,3 +1973,47 @@ function ddosProtection() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getAdsLeaderBoardTop(){
|
||||||
|
$ad = YouPHPTubePlugin::getObjectDataIfEnabled('ADs');
|
||||||
|
if(!empty($ad)){
|
||||||
|
if(isMobile()){
|
||||||
|
return $ad->leaderBoardTopMobile->value;
|
||||||
|
}else{
|
||||||
|
return $ad->leaderBoardTop->value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAdsLeaderBoardMiddle(){
|
||||||
|
$ad = YouPHPTubePlugin::getObjectDataIfEnabled('ADs');
|
||||||
|
if(!empty($ad)){
|
||||||
|
if(isMobile()){
|
||||||
|
return $ad->leaderBoardMiddleMobile->value;
|
||||||
|
}else{
|
||||||
|
return $ad->leaderBoardMiddle->value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAdsLeaderBoardFooter(){
|
||||||
|
$ad = YouPHPTubePlugin::getObjectDataIfEnabled('ADs');
|
||||||
|
if(!empty($ad)){
|
||||||
|
if(isMobile()){
|
||||||
|
return $ad->leaderBoardFooterMobile->value;
|
||||||
|
}else{
|
||||||
|
return $ad->leaderBoardFooter->value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAdsSideRectangle(){
|
||||||
|
$ad = YouPHPTubePlugin::getObjectDataIfEnabled('ADs');
|
||||||
|
if(!empty($ad)){
|
||||||
|
if(isMobile()){
|
||||||
|
return $ad->sideRectangle->value;
|
||||||
|
}else{
|
||||||
|
return $ad->sideRectangle->value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
77
plugin/ADs/ADs.php
Normal file
77
plugin/ADs/ADs.php
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
|
||||||
|
|
||||||
|
class ADs extends PluginAbstract {
|
||||||
|
|
||||||
|
public function getDescription() {
|
||||||
|
$txt = "Handle the ads system, like Adsense or similar";
|
||||||
|
//$help = "<br><small><a href='https://github.com/DanielnetoDotCom/YouPHPTube/wiki/AD_Overlay-Plugin' target='__blank'><i class='fas fa-question-circle'></i> Help</a></small>";
|
||||||
|
$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)?"<img src='{$global['webSiteRootURL']}plugin/ADs/sample728x90.jpg'>":$adsense;
|
||||||
|
$obj->leaderBoardTop = $o;
|
||||||
|
|
||||||
|
$o = new stdClass();
|
||||||
|
$o->type = "textarea";
|
||||||
|
$o->value = empty($adsense)?"<img src='{$global['webSiteRootURL']}plugin/ADs/sample728x90.jpg'>":$adsense;;
|
||||||
|
$obj->leaderBoardMiddle = $o;
|
||||||
|
/*
|
||||||
|
$o = new stdClass();
|
||||||
|
$o->type = "textarea";
|
||||||
|
$o->value = empty($adsense)?"<img src='{$global['webSiteRootURL']}plugin/ADs/sample728x90.jpg'>":$adsense;;
|
||||||
|
$obj->leaderBoardFooter = $o;
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
$o = new stdClass();
|
||||||
|
$o->type = "textarea";
|
||||||
|
$o->value = empty($adsense)?"<img src='{$global['webSiteRootURL']}plugin/ADs/sample300x250.jpg'>":$adsense;;
|
||||||
|
$obj->sideRectangle = $o;
|
||||||
|
|
||||||
|
$o = new stdClass();
|
||||||
|
$o->type = "textarea";
|
||||||
|
$o->value = empty($adsense)?"<img src='{$global['webSiteRootURL']}plugin/ADs/sample300x250.jpg'>":$adsense;;
|
||||||
|
$obj->leaderBoardTopMobile = $o;
|
||||||
|
|
||||||
|
$o = new stdClass();
|
||||||
|
$o->type = "textarea";
|
||||||
|
$o->value = empty($adsense)?"<img src='{$global['webSiteRootURL']}plugin/ADs/sample300x250.jpg'>":$adsense;;
|
||||||
|
$obj->leaderBoardMiddleMobile = $o;
|
||||||
|
/*
|
||||||
|
$o = new stdClass();
|
||||||
|
$o->type = "textarea";
|
||||||
|
$o->value = empty($adsense)?"<img src='{$global['webSiteRootURL']}plugin/ADs/sample300x250.jpg'>":$adsense;;
|
||||||
|
$obj->leaderBoardFooterMobile = $o;
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTags() {
|
||||||
|
return array('free');
|
||||||
|
}
|
||||||
|
}
|
BIN
plugin/ADs/sample300x250.jpg
Normal file
BIN
plugin/ADs/sample300x250.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
BIN
plugin/ADs/sample728x90.jpg
Normal file
BIN
plugin/ADs/sample728x90.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
|
@ -54,8 +54,6 @@ class CustomizeAdvanced extends PluginAbstract {
|
||||||
$obj->doNotUseXsendFile = false;
|
$obj->doNotUseXsendFile = false;
|
||||||
$obj->makeVideosInactiveAfterEncode = false;
|
$obj->makeVideosInactiveAfterEncode = false;
|
||||||
$obj->usePermalinks = false;
|
$obj->usePermalinks = false;
|
||||||
$obj->showAdsenseBannerOnTop = false;
|
|
||||||
$obj->showAdsenseBannerOnLeft = true;
|
|
||||||
$obj->disableAnimatedGif = false;
|
$obj->disableAnimatedGif = false;
|
||||||
$obj->removeBrowserChannelLinkFromMenu = false;
|
$obj->removeBrowserChannelLinkFromMenu = false;
|
||||||
$obj->EnableWavesurfer = false;
|
$obj->EnableWavesurfer = false;
|
||||||
|
|
|
@ -42,7 +42,7 @@ if(!isset($global['systemRootPath'])){
|
||||||
<div data-spy="affix" style="margin-right: 10vw;" >
|
<div data-spy="affix" style="margin-right: 10vw;" >
|
||||||
<div class="list-group-item ">
|
<div class="list-group-item ">
|
||||||
<?php
|
<?php
|
||||||
echo $config->getAdsense();
|
echo getAdsSideRectangle();
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -72,7 +72,6 @@ class Gallery extends PluginAbstract {
|
||||||
$obj->screenColsMedium = 3;
|
$obj->screenColsMedium = 3;
|
||||||
$obj->screenColsSmall = 2;
|
$obj->screenColsSmall = 2;
|
||||||
$obj->screenColsXSmall = 1;
|
$obj->screenColsXSmall = 1;
|
||||||
$obj->showTopBannerOnMobile = false;
|
|
||||||
return $obj;
|
return $obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -291,8 +291,12 @@ function createGallerySection($videos, $crc = "", $get = array()) {
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php } ?>
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div class="row text-center" style="padding: 10px;">
|
||||||
|
<?php echo getAdsLeaderBoardMiddle(); ?>
|
||||||
|
</div>
|
||||||
<!--
|
<!--
|
||||||
createGallerySection
|
createGallerySection
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -80,15 +80,9 @@ $contentSearchFound = false;
|
||||||
<body class="<?php echo $global['bodyClass']; ?>">
|
<body class="<?php echo $global['bodyClass']; ?>">
|
||||||
<?php include $global['systemRootPath'] . 'view/include/navbar.php'; ?>
|
<?php include $global['systemRootPath'] . 'view/include/navbar.php'; ?>
|
||||||
<div class="container-fluid gallery" itemscope itemtype="http://schema.org/VideoObject">
|
<div class="container-fluid gallery" itemscope itemtype="http://schema.org/VideoObject">
|
||||||
<?php
|
|
||||||
if (!empty($obj->showTopBannerOnMobile) || !isMobile()) {
|
|
||||||
?>
|
|
||||||
<div class="row text-center" style="padding: 10px;">
|
<div class="row text-center" style="padding: 10px;">
|
||||||
<?php echo $config->getAdsense(); ?>
|
<?php echo getAdsLeaderBoardTop(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<div class="col-sm-10 col-sm-offset-1 list-group-item">
|
<div class="col-sm-10 col-sm-offset-1 list-group-item">
|
||||||
|
|
||||||
<div class="row mainArea">
|
<div class="row mainArea">
|
||||||
|
|
|
@ -76,7 +76,7 @@ $liveDO = YouPHPTubePlugin::getObjectData("Live");
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<?php
|
<?php
|
||||||
echo $config->getAdsense();
|
echo getAdsSideRectangle();
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -77,7 +77,7 @@ if(!empty($objSecure)){
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="col-md-9 col-sm-9 col-xs-9" style="margin: 0; padding: 0;" id="embedVideo-content">
|
<div class="col-md-9 col-sm-9 col-xs-9" style="margin: 0; padding: 0;" id="embedVideo-content">
|
||||||
<?php
|
<?php
|
||||||
echo $config->getAdsense();
|
echo getAdsLeaderBoardTop();
|
||||||
?>
|
?>
|
||||||
<div class="embed-responsive embed-responsive-16by9" >
|
<div class="embed-responsive embed-responsive-16by9" >
|
||||||
<video poster="<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/OnAir.jpg" controls autoplay="autoplay"
|
<video poster="<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/OnAir.jpg" controls autoplay="autoplay"
|
||||||
|
@ -106,7 +106,7 @@ if(!empty($objSecure)){
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
echo $config->getAdsense();
|
echo getAdsLeaderBoardFooter();
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 col-sm-3 col-xs-3" style="margin: 0; padding: 0;">
|
<div class="col-md-3 col-sm-3 col-xs-3" style="margin: 0; padding: 0;">
|
||||||
|
|
|
@ -87,7 +87,7 @@ if(!empty($_GET['embed'])){
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<?php
|
<?php
|
||||||
echo $config->getAdsense();
|
echo getAdsSideRectangle();
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -99,7 +99,7 @@ foreach ($playList as $value) {
|
||||||
<div class="col-lg-12 col-sm-12 col-xs-12">
|
<div class="col-lg-12 col-sm-12 col-xs-12">
|
||||||
<center style="margin:5px;">
|
<center style="margin:5px;">
|
||||||
<?php
|
<?php
|
||||||
echo $config->getAdsense();
|
echo getAdsLeaderBoardTop();
|
||||||
?>
|
?>
|
||||||
</center>
|
</center>
|
||||||
</div>
|
</div>
|
||||||
|
@ -158,15 +158,9 @@ foreach ($playList as $value) {
|
||||||
<div class="col-sm-8 col-md-8" id="modeYoutubeBottomContent">
|
<div class="col-sm-8 col-md-8" id="modeYoutubeBottomContent">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-2 col-md-2 bgWhite list-group-item rightBar">
|
<div class="col-sm-2 col-md-2 bgWhite list-group-item rightBar">
|
||||||
<?php
|
|
||||||
if (!empty($advancedCustom->showAdsenseBannerOnLeft)) {
|
|
||||||
?>
|
|
||||||
<div class="col-lg-12 col-sm-12 col-xs-12">
|
<div class="col-lg-12 col-sm-12 col-xs-12">
|
||||||
<?php echo $config->getAdsense(); ?>
|
<?php echo getAdsSideRectangle(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<input type="search" id="playListSearch" class="form-control" placeholder=" <?php echo __("Search"); ?>"/>
|
<input type="search" id="playListSearch" class="form-control" placeholder=" <?php echo __("Search"); ?>"/>
|
||||||
<select class="form-control" id="embededSortBy" >
|
<select class="form-control" id="embededSortBy" >
|
||||||
<option value="default"> <?php echo __("Default"); ?></option>
|
<option value="default"> <?php echo __("Default"); ?></option>
|
||||||
|
|
|
@ -82,7 +82,7 @@ $contentSearchFound = false;
|
||||||
<?php include $global['systemRootPath'] . 'view/include/navbar.php'; ?>
|
<?php include $global['systemRootPath'] . 'view/include/navbar.php'; ?>
|
||||||
<div class="container YouTube" itemscope itemtype="http://schema.org/VideoObject">
|
<div class="container YouTube" itemscope itemtype="http://schema.org/VideoObject">
|
||||||
<div class="row text-center" style="padding: 10px;">
|
<div class="row text-center" style="padding: 10px;">
|
||||||
<?php echo $config->getAdsense(); ?>
|
<?php echo getAdsLeaderBoardTop(); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="">
|
<div class="">
|
||||||
|
|
||||||
|
|
|
@ -519,9 +519,10 @@ if (User::isAdmin()) {
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2"><?php echo __("Google Ad Sense"); ?></label>
|
<label class="col-md-2"><?php echo __("Google Ad Sense"); ?></label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<textarea id="adsense" class="form-control" type="text" rows="20" ><?php echo $config->getAdsense(); ?></textarea>
|
<input type="hidden" value="" id="adsense"/>
|
||||||
<small>For Google AdSense code: <a href='https://www.google.com/adsense' target="_blank">https://www.google.com/adsense</a></small><br>
|
<div class="alert alert-info">
|
||||||
<small>Leave blank for native code</small>
|
Google AD Sense and any other Ads provider are moved to the <a href='<?php echo $global['webSiteRootURL']; ?>plugins'>ADs plugin </a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -246,7 +246,6 @@ YouPHPTubePlugin::getModeYouTube($v['id']);
|
||||||
$video['type'] = "video";
|
$video['type'] = "video";
|
||||||
}
|
}
|
||||||
$img_portrait = ($video['rotation'] === "90" || $video['rotation'] === "270") ? "img-portrait" : "";
|
$img_portrait = ($video['rotation'] === "90" || $video['rotation'] === "270") ? "img-portrait" : "";
|
||||||
if (!empty($advancedCustom->showAdsenseBannerOnTop)) {
|
|
||||||
?>
|
?>
|
||||||
<style>
|
<style>
|
||||||
.compress {
|
.compress {
|
||||||
|
@ -257,13 +256,12 @@ YouPHPTubePlugin::getModeYouTube($v['id']);
|
||||||
<div class="col-lg-12 col-sm-12 col-xs-12">
|
<div class="col-lg-12 col-sm-12 col-xs-12">
|
||||||
<center style="margin:5px;">
|
<center style="margin:5px;">
|
||||||
<?php
|
<?php
|
||||||
echo $config->getAdsense();
|
echo getAdsLeaderBoardTop();
|
||||||
?>
|
?>
|
||||||
</center>
|
</center>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
|
||||||
$vType = $video['type'];
|
$vType = $video['type'];
|
||||||
if ($vType == "linkVideo") {
|
if ($vType == "linkVideo") {
|
||||||
$vType = "video";
|
$vType = "video";
|
||||||
|
@ -284,14 +282,10 @@ YouPHPTubePlugin::getModeYouTube($v['id']);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4 col-md-4 bgWhite list-group-item rightBar">
|
<div class="col-sm-4 col-md-4 bgWhite list-group-item rightBar">
|
||||||
<?php
|
<div class="col-lg-12 col-sm-12 col-xs-12 text-center">
|
||||||
if (!empty($advancedCustom->showAdsenseBannerOnLeft)) {
|
<?php echo getAdsSideRectangle(); ?>
|
||||||
?>
|
|
||||||
<div class="col-lg-12 col-sm-12 col-xs-12">
|
|
||||||
<?php echo $config->getAdsense(); ?>
|
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
|
||||||
if (!empty($playlist_id)) {
|
if (!empty($playlist_id)) {
|
||||||
include $global['systemRootPath'] . 'view/include/playlist.php';
|
include $global['systemRootPath'] . 'view/include/playlist.php';
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue