1
0
Fork 0
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:
daniel 2019-08-30 16:18:21 -03:00
parent c3dc469ccc
commit f5be6d3579
16 changed files with 342 additions and 237 deletions

View file

@ -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
View 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');
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
plugin/ADs/sample728x90.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View file

@ -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;

View file

@ -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>

View file

@ -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;
} }

View file

@ -10,7 +10,7 @@ function showThis($who) {
return false; 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)) { if (!showThis($getName)) {
return ""; return "";
} }
@ -141,7 +141,7 @@ function createGallerySection($videos, $crc = "", $get = array()) {
$startG = microtime(true); $startG = microtime(true);
$images = Video::getImageFromFilename($value['filename'], $value['type']); $images = Video::getImageFromFilename($value['filename'], $value['type']);
@$timesG[__LINE__] += microtime(true) - $startG; @$timesG[__LINE__] += microtime(true) - $startG;
if(!is_object($images)){ if (!is_object($images)) {
$images = new stdClass(); $images = new stdClass();
$images->thumbsGif = ""; $images->thumbsGif = "";
$images->poster = "{$global['webSiteRootURL']}view/img/notfound.jpg"; $images->poster = "{$global['webSiteRootURL']}view/img/notfound.jpg";
@ -164,12 +164,12 @@ function createGallerySection($videos, $crc = "", $get = array()) {
?> ?>
</div> </div>
<?php <?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> <span class="duration"><?php echo Video::getCleanDuration($value['duration']); ?></span>
<div class="progress" style="height: 3px; margin-bottom: 2px;"> <div class="progress" style="height: 3px; margin-bottom: 2px;">
<div class="progress-bar progress-bar-danger" role="progressbar" style="width: <?php echo $value['progress']['percent'] ?>%;" aria-valuenow="<?php echo $value['progress']['percent'] ?>" aria-valuemin="0" aria-valuemax="100"></div> <div class="progress-bar progress-bar-danger" role="progressbar" style="width: <?php echo $value['progress']['percent'] ?>%;" aria-valuenow="<?php echo $value['progress']['percent'] ?>" aria-valuemin="0" aria-valuemax="100"></div>
</div> </div>
<?php <?php
} }
?> ?>
@ -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

View file

@ -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 <div class="row text-center" style="padding: 10px;">
if (!empty($obj->showTopBannerOnMobile) || !isMobile()) { <?php echo getAdsLeaderBoardTop(); ?>
?> </div>
<div class="row text-center" style="padding: 10px;">
<?php echo $config->getAdsense(); ?>
</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">

View file

@ -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>

View file

@ -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;">

View file

@ -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>

View file

@ -17,10 +17,10 @@ $playList = PlayList::getVideosFromPlaylist($_GET['playlists_id']);
$playListData = array(); $playListData = array();
$videoStartSeconds = array(); $videoStartSeconds = array();
foreach ($playList as $value) { foreach ($playList as $value) {
if($value['type'] === 'embed'){ if ($value['type'] === 'embed') {
$sources[0]['type'] = 'video'; $sources[0]['type'] = 'video';
$sources[0]['url'] = $value["videoLink"]; $sources[0]['url'] = $value["videoLink"];
}else{ } else {
$sources = getVideosURL($value['filename']); $sources = getVideosURL($value['filename']);
} }
$images = Video::getImageFromFilename($value['filename'], $value['type']); $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"> <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 <div class="col-lg-12 col-sm-12 col-xs-12">
if (!empty($advancedCustom->showAdsenseBannerOnLeft)) { <?php echo getAdsSideRectangle(); ?>
?> </div>
<div class="col-lg-12 col-sm-12 col-xs-12">
<?php echo $config->getAdsense(); ?>
</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>

View file

@ -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="">

View file

@ -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>

View file

@ -177,7 +177,7 @@ if (!empty($video)) {
$data = getimgsize($source['path']); $data = getimgsize($source['path']);
$imgw = $data[0]; $imgw = $data[0];
$imgh = $data[1]; $imgh = $data[1];
}else{ } else {
$img = $images->poster; $img = $images->poster;
} }
} else { } else {
@ -246,24 +246,22 @@ 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 { top: 100px !important;
top: 100px !important; }
} </style>
</style> <div class="row">
<div class="row"> <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 getAdsLeaderBoardTop();
echo $config->getAdsense(); ?>
?> </center>
</center>
</div>
</div> </div>
<?php </div>
} <?php
$vType = $video['type']; $vType = $video['type'];
if ($vType == "linkVideo") { if ($vType == "linkVideo") {
$vType = "video"; $vType = "video";
@ -274,179 +272,175 @@ YouPHPTubePlugin::getModeYouTube($v['id']);
} }
require "{$global['systemRootPath']}view/include/{$vType}.php"; require "{$global['systemRootPath']}view/include/{$vType}.php";
?> ?>
<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
require "{$global['systemRootPath']}view/modeYoutubeBottom.php";
?>
</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>
<?php
}
if (!empty($playlist_id)) {
include $global['systemRootPath'] . 'view/include/playlist.php';
?>
<script>
$(document).ready(function () {
Cookies.set('autoplay', true, {
path: '/',
expires: 365
});
});
</script>
<?php } else if (empty($autoPlayVideo)) {
?>
<div class="col-lg-12 col-sm-12 col-xs-12 autoplay text-muted" >
<strong><?php echo __("Autoplay ended"); ?></strong>
<span class="pull-right">
<span><?php echo __("Autoplay"); ?></span>
<span>
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="bottom" title="<?php echo __("When autoplay is enabled, a suggested video will automatically play next."); ?>"></i>
</span>
<div class="material-switch pull-right">
<input type="checkbox" class="saveCookie" name="autoplay" id="autoplay">
<label for="autoplay" class="label-primary"></label>
</div>
</span>
</div>
<?php } else if (!empty($autoPlayVideo)) { ?>
<div class="row">
<div class="col-lg-12 col-sm-12 col-xs-12 autoplay text-muted">
<strong><?php echo __("Up Next"); ?></strong>
<span class="pull-right">
<span><?php echo __("Autoplay"); ?></span>
<span>
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="bottom" title="<?php echo __("When autoplay is enabled, a suggested video will automatically play next."); ?>"></i>
</span>
<div class="material-switch pull-right">
<input type="checkbox" class="saveCookie" name="autoplay" id="autoplay">
<label for="autoplay" class="label-primary"></label>
</div>
</span>
</div>
</div>
<div class="col-lg-12 col-sm-12 col-xs-12 bottom-border autoPlayVideo" id="autoPlayVideoDiv" itemscope itemtype="http://schema.org/VideoObject" >
<a href="<?php echo Video::getLink($autoPlayVideo['id'], $autoPlayVideo['clean_title'], "", $get); ?>" title="<?php echo str_replace('"', '', $autoPlayVideo['title']); ?>" class="videoLink h6">
<div class="col-lg-5 col-sm-5 col-xs-5 nopadding thumbsImage">
<?php
$imgGif = "";
if (file_exists("{$global['systemRootPath']}videos/{$autoPlayVideo['filename']}.gif")) {
$imgGif = "{$global['webSiteRootURL']}videos/{$autoPlayVideo['filename']}.gif";
}
if ($autoPlayVideo['type'] === "pdf") {
$img = "{$global['webSiteRootURL']}videos/{$autoPlayVideo['filename']}.png";
$img_portrait = ($autoPlayVideo['rotation'] === "90" || $autoPlayVideo['rotation'] === "270") ? "img-portrait" : "";
} else if (($autoPlayVideo['type'] !== "audio") && ($autoPlayVideo['type'] !== "linkAudio")) {
$img = "{$global['webSiteRootURL']}videos/{$autoPlayVideo['filename']}.jpg";
$img_portrait = ($autoPlayVideo['rotation'] === "90" || $autoPlayVideo['rotation'] === "270") ? "img-portrait" : "";
} else {
$img = "{$global['webSiteRootURL']}view/img/audio_wave.jpg";
$img_portrait = "";
}
?>
<img src="<?php echo $img; ?>" alt="<?php echo str_replace('"', '', $autoPlayVideo['title']); ?>" class="img-responsive <?php echo $img_portrait; ?> rotate<?php echo $autoPlayVideo['rotation']; ?>" height="130" itemprop="thumbnail" />
<?php if (!empty($imgGif)) { ?>
<img src="<?php echo $imgGif; ?>" style="position: absolute; top: 0; display: none;" alt="<?php echo str_replace('"', '', $autoPlayVideo['title']); ?>" id="thumbsGIF<?php echo $autoPlayVideo['id']; ?>" class="thumbsGIF img-responsive <?php echo $img_portrait; ?> rotate<?php echo $autoPlayVideo['rotation']; ?>" height="130" />
<?php } ?>
<meta itemprop="thumbnailUrl" content="<?php echo $img; ?>" />
<meta itemprop="contentURL" content="<?php echo Video::getLink($autoPlayVideo['id'], $autoPlayVideo['clean_title']); ?>" />
<meta itemprop="embedURL" content="<?php echo Video::getLink($autoPlayVideo['id'], $autoPlayVideo['clean_title'], true); ?>" />
<meta itemprop="uploadDate" content="<?php echo $autoPlayVideo['created']; ?>" />
<time class="duration" itemprop="duration" datetime="<?php echo Video::getItemPropDuration($autoPlayVideo['duration']); ?>"><?php echo Video::getCleanDuration($autoPlayVideo['duration']); ?></time>
</div>
<div class="col-lg-7 col-sm-7 col-xs-7 videosDetails">
<div class="text-uppercase row"><strong itemprop="name" class="title"><?php echo $autoPlayVideo['title']; ?></strong></div>
<div class="details row text-muted" itemprop="description">
<div>
<strong><?php echo __("Category"); ?>: </strong>
<span class="<?php echo $autoPlayVideo['iconClass']; ?>"></span>
<?php echo $autoPlayVideo['category']; ?>
</div>
<?php
if (empty($advancedCustom->doNotDisplayViews)) { <div class="row" id="modeYoutubeBottom">
?> <div class="col-sm-1 col-md-1"></div>
<div> <div class="col-sm-6 col-md-6" id="modeYoutubeBottomContent">
<strong class=""><?php echo number_format($autoPlayVideo['views_count'], 0); ?></strong> <?php
<?php echo __("Views"); ?> require "{$global['systemRootPath']}view/modeYoutubeBottom.php";
</div> ?>
<?php </div>
} <div class="col-sm-4 col-md-4 bgWhite list-group-item rightBar">
?> <div class="col-lg-12 col-sm-12 col-xs-12 text-center">
<div><?php echo $autoPlayVideo['creator']; ?></div> <?php echo getAdsSideRectangle(); ?>
</div> </div>
<div class="row"> <?php
<?php if (!empty($playlist_id)) {
if (!empty($autoPlayVideo['tags'])) { include $global['systemRootPath'] . 'view/include/playlist.php';
foreach ($autoPlayVideo['tags'] as $autoPlayVideo2) { ?>
if ($autoPlayVideo2->label === __("Group")) { <script>
?> $(document).ready(function () {
<span class="label label-<?php echo $autoPlayVideo2->type; ?>"><?php echo $autoPlayVideo2->text; ?></span> Cookies.set('autoplay', true, {
path: '/',
expires: 365
});
});
</script>
<?php } else if (empty($autoPlayVideo)) {
?>
<div class="col-lg-12 col-sm-12 col-xs-12 autoplay text-muted" >
<strong><?php echo __("Autoplay ended"); ?></strong>
<span class="pull-right">
<span><?php echo __("Autoplay"); ?></span>
<span>
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="bottom" title="<?php echo __("When autoplay is enabled, a suggested video will automatically play next."); ?>"></i>
</span>
<div class="material-switch pull-right">
<input type="checkbox" class="saveCookie" name="autoplay" id="autoplay">
<label for="autoplay" class="label-primary"></label>
</div>
</span>
</div>
<?php } else if (!empty($autoPlayVideo)) { ?>
<div class="row">
<div class="col-lg-12 col-sm-12 col-xs-12 autoplay text-muted">
<strong><?php echo __("Up Next"); ?></strong>
<span class="pull-right">
<span><?php echo __("Autoplay"); ?></span>
<span>
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="bottom" title="<?php echo __("When autoplay is enabled, a suggested video will automatically play next."); ?>"></i>
</span>
<div class="material-switch pull-right">
<input type="checkbox" class="saveCookie" name="autoplay" id="autoplay">
<label for="autoplay" class="label-primary"></label>
</div>
</span>
</div>
</div>
<div class="col-lg-12 col-sm-12 col-xs-12 bottom-border autoPlayVideo" id="autoPlayVideoDiv" itemscope itemtype="http://schema.org/VideoObject" >
<a href="<?php echo Video::getLink($autoPlayVideo['id'], $autoPlayVideo['clean_title'], "", $get); ?>" title="<?php echo str_replace('"', '', $autoPlayVideo['title']); ?>" class="videoLink h6">
<div class="col-lg-5 col-sm-5 col-xs-5 nopadding thumbsImage">
<?php <?php
} $imgGif = "";
if (file_exists("{$global['systemRootPath']}videos/{$autoPlayVideo['filename']}.gif")) {
$imgGif = "{$global['webSiteRootURL']}videos/{$autoPlayVideo['filename']}.gif";
}
if ($autoPlayVideo['type'] === "pdf") {
$img = "{$global['webSiteRootURL']}videos/{$autoPlayVideo['filename']}.png";
$img_portrait = ($autoPlayVideo['rotation'] === "90" || $autoPlayVideo['rotation'] === "270") ? "img-portrait" : "";
} else if (($autoPlayVideo['type'] !== "audio") && ($autoPlayVideo['type'] !== "linkAudio")) {
$img = "{$global['webSiteRootURL']}videos/{$autoPlayVideo['filename']}.jpg";
$img_portrait = ($autoPlayVideo['rotation'] === "90" || $autoPlayVideo['rotation'] === "270") ? "img-portrait" : "";
} else {
$img = "{$global['webSiteRootURL']}view/img/audio_wave.jpg";
$img_portrait = "";
}
?>
<img src="<?php echo $img; ?>" alt="<?php echo str_replace('"', '', $autoPlayVideo['title']); ?>" class="img-responsive <?php echo $img_portrait; ?> rotate<?php echo $autoPlayVideo['rotation']; ?>" height="130" itemprop="thumbnail" />
<?php if (!empty($imgGif)) { ?>
<img src="<?php echo $imgGif; ?>" style="position: absolute; top: 0; display: none;" alt="<?php echo str_replace('"', '', $autoPlayVideo['title']); ?>" id="thumbsGIF<?php echo $autoPlayVideo['id']; ?>" class="thumbsGIF img-responsive <?php echo $img_portrait; ?> rotate<?php echo $autoPlayVideo['rotation']; ?>" height="130" />
<?php } ?>
<meta itemprop="thumbnailUrl" content="<?php echo $img; ?>" />
<meta itemprop="contentURL" content="<?php echo Video::getLink($autoPlayVideo['id'], $autoPlayVideo['clean_title']); ?>" />
<meta itemprop="embedURL" content="<?php echo Video::getLink($autoPlayVideo['id'], $autoPlayVideo['clean_title'], true); ?>" />
<meta itemprop="uploadDate" content="<?php echo $autoPlayVideo['created']; ?>" />
<time class="duration" itemprop="duration" datetime="<?php echo Video::getItemPropDuration($autoPlayVideo['duration']); ?>"><?php echo Video::getCleanDuration($autoPlayVideo['duration']); ?></time>
</div>
<div class="col-lg-7 col-sm-7 col-xs-7 videosDetails">
<div class="text-uppercase row"><strong itemprop="name" class="title"><?php echo $autoPlayVideo['title']; ?></strong></div>
<div class="details row text-muted" itemprop="description">
<div>
<strong><?php echo __("Category"); ?>: </strong>
<span class="<?php echo $autoPlayVideo['iconClass']; ?>"></span>
<?php echo $autoPlayVideo['category']; ?>
</div>
<?php
if (empty($advancedCustom->doNotDisplayViews)) {
?>
<div>
<strong class=""><?php echo number_format($autoPlayVideo['views_count'], 0); ?></strong>
<?php echo __("Views"); ?>
</div>
<?php
}
?>
<div><?php echo $autoPlayVideo['creator']; ?></div>
</div>
<div class="row">
<?php
if (!empty($autoPlayVideo['tags'])) {
foreach ($autoPlayVideo['tags'] as $autoPlayVideo2) {
if ($autoPlayVideo2->label === __("Group")) {
?>
<span class="label label-<?php echo $autoPlayVideo2->type; ?>"><?php echo $autoPlayVideo2->text; ?></span>
<?php
}
}
}
?>
</div>
</div>
</a>
</div>
<?php } ?>
<div class="col-lg-12 col-sm-12 col-xs-12 extraVideos nopadding"></div>
<!-- videos List -->
<div id="videosList">
<?php include $global['systemRootPath'] . 'view/videosList.php'; ?>
</div>
<!-- End of videos List -->
<script>
var fading = false;
var autoPlaySources = <?php echo json_encode($autoPlaySources); ?>;
var autoPlayURL = '<?php echo $autoPlayURL; ?>';
var autoPlayPoster = '<?php echo $autoPlayPoster; ?>';
var autoPlayThumbsSprit = '<?php echo $autoPlayThumbsSprit; ?>';
function showAutoPlayVideoDiv() {
var auto = $("#autoplay").prop('checked');
if (!auto) {
$('#autoPlayVideoDiv').slideUp();
} else {
$('#autoPlayVideoDiv').slideDown();
} }
} }
?> $(document).ready(function () {
</div> $("input.saveCookie").each(function () {
var mycookie = Cookies.get($(this).attr('name'));
if (mycookie && mycookie == "true") {
$(this).prop('checked', mycookie);
}
});
$("input.saveCookie").change(function () {
var auto = $(this).prop('checked');
Cookies.set($(this).attr("name"), auto, {
path: '/',
expires: 365
});
});
$("#autoplay").change(function () {
showAutoPlayVideoDiv();
});
showAutoPlayVideoDiv();
});
</script>
</div> </div>
</a> <div class="col-sm-1 col-md-1"></div>
</div> </div>
<?php } ?>
<div class="col-lg-12 col-sm-12 col-xs-12 extraVideos nopadding"></div>
<!-- videos List -->
<div id="videosList">
<?php include $global['systemRootPath'] . 'view/videosList.php'; ?>
</div>
<!-- End of videos List -->
<script>
var fading = false;
var autoPlaySources = <?php echo json_encode($autoPlaySources); ?>;
var autoPlayURL = '<?php echo $autoPlayURL; ?>';
var autoPlayPoster = '<?php echo $autoPlayPoster; ?>';
var autoPlayThumbsSprit = '<?php echo $autoPlayThumbsSprit; ?>';
function showAutoPlayVideoDiv() {
var auto = $("#autoplay").prop('checked');
if (!auto) {
$('#autoPlayVideoDiv').slideUp();
} else {
$('#autoPlayVideoDiv').slideDown();
}
}
$(document).ready(function () {
$("input.saveCookie").each(function () {
var mycookie = Cookies.get($(this).attr('name'));
if (mycookie && mycookie == "true") {
$(this).prop('checked', mycookie);
}
});
$("input.saveCookie").change(function () {
var auto = $(this).prop('checked');
Cookies.set($(this).attr("name"), auto, {
path: '/',
expires: 365
});
});
$("#autoplay").change(function () {
showAutoPlayVideoDiv();
});
showAutoPlayVideoDiv();
});
</script>
</div>
<div class="col-sm-1 col-md-1"></div>
</div>
<?php <?php
} else { } else {
?> ?>
@ -457,13 +451,13 @@ YouPHPTubePlugin::getModeYouTube($v['id']);
<div class="alert alert-warning"> <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; ?>. <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> </div>
<?php } ?> <?php } ?>
</div> </div>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/jquery-ui/jquery-ui.min.js" type="text/javascript"></script> <script src="<?php echo $global['webSiteRootURL']; ?>view/js/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script> <script>
/*** Handle jQuery plugin naming conflict between jQuery UI and Bootstrap ***/ /*** Handle jQuery plugin naming conflict between jQuery UI and Bootstrap ***/
$.widget.bridge('uibutton', $.ui.button); $.widget.bridge('uibutton', $.ui.button);
$.widget.bridge('uitooltip', $.ui.tooltip); $.widget.bridge('uitooltip', $.ui.tooltip);
</script> </script>
<?php <?php
$videoJSArray = array("view/js/video.js/video.js"); $videoJSArray = array("view/js/video.js/video.js");
@ -492,14 +486,14 @@ YouPHPTubePlugin::getModeYouTube($v['id']);
?> ?>
<script src="<?php echo $jsURL; ?>" type="text/javascript"></script> <script src="<?php echo $jsURL; ?>" type="text/javascript"></script>
<script> <script>
var fading = false; var fading = false;
var autoPlaySources = <?php echo json_encode($autoPlaySources); ?>; var autoPlaySources = <?php echo json_encode($autoPlaySources); ?>;
var autoPlayURL = '<?php echo $autoPlayURL; ?>'; var autoPlayURL = '<?php echo $autoPlayURL; ?>';
var autoPlayPoster = '<?php echo $autoPlayPoster; ?>'; var autoPlayPoster = '<?php echo $autoPlayPoster; ?>';
var autoPlayThumbsSprit = '<?php echo $autoPlayThumbsSprit; ?>'; var autoPlayThumbsSprit = '<?php echo $autoPlayThumbsSprit; ?>';
$(document).ready(function () { $(document).ready(function () {
}); });
</script> </script>
</body> </body>
</html> </html>