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;
|
||||
}
|
||||
|
||||
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->makeVideosInactiveAfterEncode = false;
|
||||
$obj->usePermalinks = false;
|
||||
$obj->showAdsenseBannerOnTop = false;
|
||||
$obj->showAdsenseBannerOnLeft = true;
|
||||
$obj->disableAnimatedGif = false;
|
||||
$obj->removeBrowserChannelLinkFromMenu = false;
|
||||
$obj->EnableWavesurfer = false;
|
||||
|
|
|
@ -42,7 +42,7 @@ if(!isset($global['systemRootPath'])){
|
|||
<div data-spy="affix" style="margin-right: 10vw;" >
|
||||
<div class="list-group-item ">
|
||||
<?php
|
||||
echo $config->getAdsense();
|
||||
echo getAdsSideRectangle();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -72,7 +72,6 @@ class Gallery extends PluginAbstract {
|
|||
$obj->screenColsMedium = 3;
|
||||
$obj->screenColsSmall = 2;
|
||||
$obj->screenColsXSmall = 1;
|
||||
$obj->showTopBannerOnMobile = false;
|
||||
return $obj;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ function showThis($who) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function createGallery($title, $sort, $rowCount, $getName, $mostWord, $lessWord, $orderString, $defaultSort = "ASC", $ignoreGroup=false) {
|
||||
function createGallery($title, $sort, $rowCount, $getName, $mostWord, $lessWord, $orderString, $defaultSort = "ASC", $ignoreGroup = false) {
|
||||
if (!showThis($getName)) {
|
||||
return "";
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ function createGallerySection($videos, $crc = "", $get = array()) {
|
|||
$startG = microtime(true);
|
||||
$images = Video::getImageFromFilename($value['filename'], $value['type']);
|
||||
@$timesG[__LINE__] += microtime(true) - $startG;
|
||||
if(!is_object($images)){
|
||||
if (!is_object($images)) {
|
||||
$images = new stdClass();
|
||||
$images->thumbsGif = "";
|
||||
$images->poster = "{$global['webSiteRootURL']}view/img/notfound.jpg";
|
||||
|
@ -164,7 +164,7 @@ function createGallerySection($videos, $crc = "", $get = array()) {
|
|||
?>
|
||||
</div>
|
||||
<?php
|
||||
if($value['type']!=='pdf' && $value['type']!=='article'){
|
||||
if ($value['type'] !== 'pdf' && $value['type'] !== 'article') {
|
||||
?>
|
||||
<span class="duration"><?php echo Video::getCleanDuration($value['duration']); ?></span>
|
||||
<div class="progress" style="height: 3px; margin-bottom: 2px;">
|
||||
|
@ -291,8 +291,12 @@ function createGallerySection($videos, $crc = "", $get = array()) {
|
|||
?>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div class="row text-center" style="padding: 10px;">
|
||||
<?php echo getAdsLeaderBoardMiddle(); ?>
|
||||
</div>
|
||||
<!--
|
||||
createGallerySection
|
||||
<?php
|
||||
|
|
|
@ -80,15 +80,9 @@ $contentSearchFound = false;
|
|||
<body class="<?php echo $global['bodyClass']; ?>">
|
||||
<?php include $global['systemRootPath'] . 'view/include/navbar.php'; ?>
|
||||
<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;">
|
||||
<?php echo $config->getAdsense(); ?>
|
||||
<?php echo getAdsLeaderBoardTop(); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div class="col-sm-10 col-sm-offset-1 list-group-item">
|
||||
|
||||
<div class="row mainArea">
|
||||
|
|
|
@ -76,7 +76,7 @@ $liveDO = YouPHPTubePlugin::getObjectData("Live");
|
|||
</div>
|
||||
<div class="col-md-3">
|
||||
<?php
|
||||
echo $config->getAdsense();
|
||||
echo getAdsSideRectangle();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -77,7 +77,7 @@ if(!empty($objSecure)){
|
|||
<div class="container">
|
||||
<div class="col-md-9 col-sm-9 col-xs-9" style="margin: 0; padding: 0;" id="embedVideo-content">
|
||||
<?php
|
||||
echo $config->getAdsense();
|
||||
echo getAdsLeaderBoardTop();
|
||||
?>
|
||||
<div class="embed-responsive embed-responsive-16by9" >
|
||||
<video poster="<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/OnAir.jpg" controls autoplay="autoplay"
|
||||
|
@ -106,7 +106,7 @@ if(!empty($objSecure)){
|
|||
</div>
|
||||
|
||||
<?php
|
||||
echo $config->getAdsense();
|
||||
echo getAdsLeaderBoardFooter();
|
||||
?>
|
||||
</div>
|
||||
<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 class="col-md-3">
|
||||
<?php
|
||||
echo $config->getAdsense();
|
||||
echo getAdsSideRectangle();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -17,10 +17,10 @@ $playList = PlayList::getVideosFromPlaylist($_GET['playlists_id']);
|
|||
$playListData = array();
|
||||
$videoStartSeconds = array();
|
||||
foreach ($playList as $value) {
|
||||
if($value['type'] === 'embed'){
|
||||
if ($value['type'] === 'embed') {
|
||||
$sources[0]['type'] = 'video';
|
||||
$sources[0]['url'] = $value["videoLink"];
|
||||
}else{
|
||||
} else {
|
||||
$sources = getVideosURL($value['filename']);
|
||||
}
|
||||
$images = Video::getImageFromFilename($value['filename'], $value['type']);
|
||||
|
@ -99,7 +99,7 @@ foreach ($playList as $value) {
|
|||
<div class="col-lg-12 col-sm-12 col-xs-12">
|
||||
<center style="margin:5px;">
|
||||
<?php
|
||||
echo $config->getAdsense();
|
||||
echo getAdsLeaderBoardTop();
|
||||
?>
|
||||
</center>
|
||||
</div>
|
||||
|
@ -158,15 +158,9 @@ foreach ($playList as $value) {
|
|||
<div class="col-sm-8 col-md-8" id="modeYoutubeBottomContent">
|
||||
</div>
|
||||
<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">
|
||||
<?php echo $config->getAdsense(); ?>
|
||||
<?php echo getAdsSideRectangle(); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<input type="search" id="playListSearch" class="form-control" placeholder=" <?php echo __("Search"); ?>"/>
|
||||
<select class="form-control" id="embededSortBy" >
|
||||
<option value="default"> <?php echo __("Default"); ?></option>
|
||||
|
|
|
@ -82,7 +82,7 @@ $contentSearchFound = false;
|
|||
<?php include $global['systemRootPath'] . 'view/include/navbar.php'; ?>
|
||||
<div class="container YouTube" itemscope itemtype="http://schema.org/VideoObject">
|
||||
<div class="row text-center" style="padding: 10px;">
|
||||
<?php echo $config->getAdsense(); ?>
|
||||
<?php echo getAdsLeaderBoardTop(); ?>
|
||||
</div>
|
||||
<div class="">
|
||||
|
||||
|
|
|
@ -519,9 +519,10 @@ if (User::isAdmin()) {
|
|||
<div class="form-group">
|
||||
<label class="col-md-2"><?php echo __("Google Ad Sense"); ?></label>
|
||||
<div class="col-md-10">
|
||||
<textarea id="adsense" class="form-control" type="text" rows="20" ><?php echo $config->getAdsense(); ?></textarea>
|
||||
<small>For Google AdSense code: <a href='https://www.google.com/adsense' target="_blank">https://www.google.com/adsense</a></small><br>
|
||||
<small>Leave blank for native code</small>
|
||||
<input type="hidden" value="" id="adsense"/>
|
||||
<div class="alert alert-info">
|
||||
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>
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ if (!empty($video)) {
|
|||
$data = getimgsize($source['path']);
|
||||
$imgw = $data[0];
|
||||
$imgh = $data[1];
|
||||
}else{
|
||||
} else {
|
||||
$img = $images->poster;
|
||||
}
|
||||
} else {
|
||||
|
@ -246,7 +246,6 @@ YouPHPTubePlugin::getModeYouTube($v['id']);
|
|||
$video['type'] = "video";
|
||||
}
|
||||
$img_portrait = ($video['rotation'] === "90" || $video['rotation'] === "270") ? "img-portrait" : "";
|
||||
if (!empty($advancedCustom->showAdsenseBannerOnTop)) {
|
||||
?>
|
||||
<style>
|
||||
.compress {
|
||||
|
@ -257,13 +256,12 @@ YouPHPTubePlugin::getModeYouTube($v['id']);
|
|||
<div class="col-lg-12 col-sm-12 col-xs-12">
|
||||
<center style="margin:5px;">
|
||||
<?php
|
||||
echo $config->getAdsense();
|
||||
echo getAdsLeaderBoardTop();
|
||||
?>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
$vType = $video['type'];
|
||||
if ($vType == "linkVideo") {
|
||||
$vType = "video";
|
||||
|
@ -276,7 +274,7 @@ YouPHPTubePlugin::getModeYouTube($v['id']);
|
|||
?>
|
||||
|
||||
|
||||
<div class="row" id="modeYoutubeBottom">
|
||||
<div class="row" id="modeYoutubeBottom">
|
||||
<div class="col-sm-1 col-md-1"></div>
|
||||
<div class="col-sm-6 col-md-6" id="modeYoutubeBottomContent">
|
||||
<?php
|
||||
|
@ -284,14 +282,10 @@ YouPHPTubePlugin::getModeYouTube($v['id']);
|
|||
?>
|
||||
</div>
|
||||
<div class="col-sm-4 col-md-4 bgWhite list-group-item rightBar">
|
||||
<?php
|
||||
if (!empty($advancedCustom->showAdsenseBannerOnLeft)) {
|
||||
?>
|
||||
<div class="col-lg-12 col-sm-12 col-xs-12">
|
||||
<?php echo $config->getAdsense(); ?>
|
||||
<div class="col-lg-12 col-sm-12 col-xs-12 text-center">
|
||||
<?php echo getAdsSideRectangle(); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
if (!empty($playlist_id)) {
|
||||
include $global['systemRootPath'] . 'view/include/playlist.php';
|
||||
?>
|
||||
|
@ -445,7 +439,7 @@ YouPHPTubePlugin::getModeYouTube($v['id']);
|
|||
</script>
|
||||
</div>
|
||||
<div class="col-sm-1 col-md-1"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
|
@ -457,7 +451,7 @@ YouPHPTubePlugin::getModeYouTube($v['id']);
|
|||
<div class="alert alert-warning">
|
||||
<span class="glyphicon glyphicon-facetime-video"></span> <strong><?php echo __("Attention"); ?>!</strong> <?php echo empty($advancedCustom->videoNotFoundText->value) ? __("We have not found any videos or audios to show") : $advancedCustom->videoNotFoundText->value; ?>.
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
|
||||
<script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue