mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 17:59:55 +02:00
Version 7.5 Adding Articles support
This commit is contained in:
parent
e1d4f66780
commit
20205359cd
9 changed files with 127 additions and 42 deletions
|
@ -9,6 +9,7 @@ class BulkEmbed extends PluginAbstract {
|
||||||
//$str = 'Set DEVELOPER_KEY to the "API key" value from the "Access" tab of the<br>Google Developers Console https://console.developers.google.com<br>Please ensure that you have enabled the YouTube Data API for your project.';
|
//$str = 'Set DEVELOPER_KEY to the "API key" value from the "Access" tab of the<br>Google Developers Console https://console.developers.google.com<br>Please ensure that you have enabled the YouTube Data API for your project.';
|
||||||
//$str.= '<br>Add the Redirect URI '.$global['webSiteRootURL'].'plugin/BulkEmbed/youtubeSearch.json.php';
|
//$str.= '<br>Add the Redirect URI '.$global['webSiteRootURL'].'plugin/BulkEmbed/youtubeSearch.json.php';
|
||||||
$str = 'Create your API Key here https://console.developers.google.com/apis/credentials/key';
|
$str = 'Create your API Key here https://console.developers.google.com/apis/credentials/key';
|
||||||
|
$str .= "<br> Also make sure you enable the API YouTube Data API v3";
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -193,6 +193,38 @@ $obj = YouPHPTubePlugin::getObjectData("BulkEmbed");
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function validURL(str) {
|
||||||
|
var pattern = new RegExp('^(https?:\\/\\/)?' + // protocol
|
||||||
|
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
|
||||||
|
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
|
||||||
|
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
|
||||||
|
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
|
||||||
|
'(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
|
||||||
|
return !!pattern.test(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFromUrl(url) {
|
||||||
|
if (!validURL(url)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var regex = /[?&]([^=#]+)=([^&#]*)/g,
|
||||||
|
params = {},
|
||||||
|
match;
|
||||||
|
while (match = regex.exec(url)) {
|
||||||
|
params[match[1]] = match[2];
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPlayListId(url) {
|
||||||
|
var result = getFromUrl(url);
|
||||||
|
if (result && typeof result.list !== 'undefined') {
|
||||||
|
return result.list;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function search() {
|
function search() {
|
||||||
// clear
|
// clear
|
||||||
$('#results').html('');
|
$('#results').html('');
|
||||||
|
@ -201,35 +233,57 @@ $obj = YouPHPTubePlugin::getObjectData("BulkEmbed");
|
||||||
// get form input
|
// get form input
|
||||||
q = $('#query').val(); // this probably shouldn't be created as a global
|
q = $('#query').val(); // this probably shouldn't be created as a global
|
||||||
|
|
||||||
// run get request on API
|
var playListId = getPlayListId(q);
|
||||||
$.get(
|
|
||||||
"https://www.googleapis.com/youtube/v3/search", {
|
|
||||||
part: 'snippet, id',
|
|
||||||
q: q,
|
|
||||||
type: 'video',
|
|
||||||
key: gapikey,
|
|
||||||
maxResults: 50,
|
|
||||||
videoEmbeddable: "true"
|
|
||||||
}, function (data) {
|
|
||||||
var nextPageToken = data.nextPageToken;
|
|
||||||
var prevPageToken = data.prevPageToken;
|
|
||||||
|
|
||||||
// Log data
|
if (playListId) {
|
||||||
//console.log(data);
|
$.get(
|
||||||
|
"https://www.googleapis.com/youtube/v3/playlistItems", {
|
||||||
$.each(data.items, function (i, item) {
|
part: 'snippet, id',
|
||||||
// Get Output
|
q: q,
|
||||||
var output = getOutput(item);
|
type: 'video',
|
||||||
|
key: gapikey,
|
||||||
// display results
|
maxResults: 50,
|
||||||
$('#results').append(output);
|
videoEmbeddable: "true",
|
||||||
|
playlistId: playListId
|
||||||
|
}, function (data) {
|
||||||
|
processData(data);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// run get request on API
|
||||||
|
$.get(
|
||||||
|
"https://www.googleapis.com/youtube/v3/search", {
|
||||||
|
part: 'snippet, id',
|
||||||
|
q: q,
|
||||||
|
type: 'video',
|
||||||
|
key: gapikey,
|
||||||
|
maxResults: 50,
|
||||||
|
videoEmbeddable: "true"
|
||||||
|
}, function (data) {
|
||||||
|
processData(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var buttons = getButtons(prevPageToken, nextPageToken);
|
}
|
||||||
|
|
||||||
// Display buttons
|
function processData(data) {
|
||||||
$('#buttons').append(buttons);
|
var nextPageToken = data.nextPageToken;
|
||||||
|
var prevPageToken = data.prevPageToken;
|
||||||
|
|
||||||
|
// Log data
|
||||||
|
//console.log(data);
|
||||||
|
|
||||||
|
$.each(data.items, function (i, item) {
|
||||||
|
// Get Output
|
||||||
|
var output = getOutput(item);
|
||||||
|
|
||||||
|
// display results
|
||||||
|
$('#results').append(output);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var buttons = getButtons(prevPageToken, nextPageToken);
|
||||||
|
|
||||||
|
// Display buttons
|
||||||
|
$('#buttons').append(buttons);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next page function
|
// Next page function
|
||||||
|
|
|
@ -58,7 +58,7 @@ if (!empty($videos)) {
|
||||||
<div class="col-md-10 col-md-offset-1 list-group-item">
|
<div class="col-md-10 col-md-offset-1 list-group-item">
|
||||||
<div class="clear clearfix"><?php echo $video['creator']; ?> </div>
|
<div class="clear clearfix"><?php echo $video['creator']; ?> </div>
|
||||||
<h2><?php echo $video['title']; ?></h2>
|
<h2><?php echo $video['title']; ?></h2>
|
||||||
<div><?php echo nl2br(textToLink($video['description'])); ?></div>
|
<div><?php echo $video['description']; ?></div>
|
||||||
<div class="main-video embed-responsive <?php
|
<div class="main-video embed-responsive <?php
|
||||||
echo $embedResponsiveClass;
|
echo $embedResponsiveClass;
|
||||||
?>">
|
?>">
|
||||||
|
|
|
@ -163,10 +163,16 @@ function createGallerySection($videos, $crc = "", $get = array()) {
|
||||||
$startG = microtime(true);
|
$startG = microtime(true);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<span class="duration"><?php echo Video::getCleanDuration($value['duration']); ?></span>
|
<?php
|
||||||
<div class="progress" style="height: 3px; margin-bottom: 2px;">
|
if($value['type']!=='pdf' && $value['type']!=='article'){
|
||||||
<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>
|
<span class="duration"><?php echo Video::getCleanDuration($value['duration']); ?></span>
|
||||||
|
<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>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
</a>
|
</a>
|
||||||
<a class="h6 galleryLink" videos_id="<?php echo $value['id']; ?>" href="<?php echo Video::getLink($value['id'], $value['clean_title'], false, $getCN); ?>" title="<?php echo $value['title']; ?>">
|
<a class="h6 galleryLink" videos_id="<?php echo $value['id']; ?>" href="<?php echo Video::getLink($value['id'], $value['clean_title'], false, $getCN); ?>" title="<?php echo $value['title']; ?>">
|
||||||
<h2><?php echo $value['title']; ?></h2>
|
<h2><?php echo $value['title']; ?></h2>
|
||||||
|
@ -230,7 +236,7 @@ function createGallerySection($videos, $crc = "", $get = array()) {
|
||||||
<?php echo $name; ?>
|
<?php echo $name; ?>
|
||||||
</a>
|
</a>
|
||||||
<?php if ((!empty($value['description'])) && !empty($obj->Description)) { ?>
|
<?php if ((!empty($value['description'])) && !empty($obj->Description)) { ?>
|
||||||
<button type="button" data-trigger="focus" class="label label-danger" data-toggle="popover" data-placement="top" data-html="true" title="<?php echo $value['title']; ?>" data-content="<div> <?php echo str_replace('"', '"', nl2br(textToLink($value['description']))); ?> </div>" ><?php echo __("Description"); ?></button>
|
<button type="button" data-trigger="focus" class="label label-danger" data-toggle="popover" data-placement="top" data-html="true" title="<?php echo $value['title']; ?>" data-content="<div> <?php echo str_replace('"', '"', $value['description']); ?> </div>" ><?php echo __("Description"); ?></button>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
<?php if (Video::canEdit($value['id'])) { ?>
|
<?php if (Video::canEdit($value['id'])) { ?>
|
||||||
|
|
|
@ -23,10 +23,16 @@ if ($obj->BigVideo && empty($_GET['showOnly'])) {
|
||||||
<img src="<?php echo $global['webSiteRootURL']; ?>view/img/loading-gif.png" data-src="<?php echo $imgGif; ?>" style="position: absolute; top: 0; display: none;" alt="<?php echo $video['title']; ?>" id="thumbsGIF<?php echo $video['id']; ?>" class="thumbsGIF img-responsive <?php echo @$img_portrait; ?> rotate<?php echo $video['rotation']; ?>" height="130" />
|
<img src="<?php echo $global['webSiteRootURL']; ?>view/img/loading-gif.png" data-src="<?php echo $imgGif; ?>" style="position: absolute; top: 0; display: none;" alt="<?php echo $video['title']; ?>" id="thumbsGIF<?php echo $video['id']; ?>" class="thumbsGIF img-responsive <?php echo @$img_portrait; ?> rotate<?php echo $video['rotation']; ?>" height="130" />
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
<span class="duration"><?php echo Video::getCleanDuration($video['duration']); ?></span>
|
<?php
|
||||||
<div class="progress" style="height: 3px; margin-bottom: 2px;">
|
if ($video['type'] !== 'pdf' && $video['type'] !== 'article') {
|
||||||
<div class="progress-bar progress-bar-danger" role="progressbar" style="width: <?php echo $video['progress']['percent'] ?>%;" aria-valuenow="<?php echo $video['progress']['percent'] ?>" aria-valuemin="0" aria-valuemax="100"></div>
|
?>
|
||||||
</div>
|
<span class="duration"><?php echo Video::getCleanDuration($video['duration']); ?></span>
|
||||||
|
<div class="progress" style="height: 3px; margin-bottom: 2px;">
|
||||||
|
<div class="progress-bar progress-bar-danger" role="progressbar" style="width: <?php echo $video['progress']['percent'] ?>%;" aria-valuenow="<?php echo $video['progress']['percent'] ?>" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
|
@ -34,7 +40,7 @@ if ($obj->BigVideo && empty($_GET['showOnly'])) {
|
||||||
<h1><?php echo $video['title']; ?></h1>
|
<h1><?php echo $video['title']; ?></h1>
|
||||||
</a>
|
</a>
|
||||||
<div class="mainAreaDescriptionContainer">
|
<div class="mainAreaDescriptionContainer">
|
||||||
<h4 class="mainAreaDescription" itemprop="description"><?php echo nl2br(textToLink($video['description'])); ?></h4>
|
<h4 class="mainAreaDescription" itemprop="description"><?php echo $video['description']; ?></h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-muted galeryDetails">
|
<div class="text-muted galeryDetails">
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -129,7 +129,7 @@ if ($obj->BigVideo && empty($_GET['showOnly'])) {
|
||||||
?>
|
?>
|
||||||
<div class="infoText col-md-4 col-sm-6 col-xs-6">
|
<div class="infoText col-md-4 col-sm-6 col-xs-6">
|
||||||
<h4 class="mainInfoText" itemprop="description">
|
<h4 class="mainInfoText" itemprop="description">
|
||||||
<?php echo nl2br(textToLink($video['description'])); ?>
|
<?php echo $video['description']; ?>
|
||||||
</h4>
|
</h4>
|
||||||
<?php
|
<?php
|
||||||
if (YouPHPTubePlugin::isEnabledByName("VideoTags")) {
|
if (YouPHPTubePlugin::isEnabledByName("VideoTags")) {
|
||||||
|
|
|
@ -156,7 +156,7 @@ foreach ($videos as $value) {
|
||||||
?>
|
?>
|
||||||
<div class="infoText col-md-4 col-sm-6 col-xs-8">
|
<div class="infoText col-md-4 col-sm-6 col-xs-8">
|
||||||
<h4 class="mainInfoText" itemprop="description">
|
<h4 class="mainInfoText" itemprop="description">
|
||||||
<?php echo nl2br(textToLink($value['description'])); ?>
|
<?php echo $value['description']; ?>
|
||||||
</h4>
|
</h4>
|
||||||
<?php
|
<?php
|
||||||
if (YouPHPTubePlugin::isEnabledByName("VideoTags")) {
|
if (YouPHPTubePlugin::isEnabledByName("VideoTags")) {
|
||||||
|
|
|
@ -23,10 +23,16 @@ if ($objYTube->BigVideo && empty($_GET['showOnly'])) {
|
||||||
<img src="<?php echo $global['webSiteRootURL']; ?>view/img/loading-gif.png" data-src="<?php echo $imgGif; ?>" style="position: absolute; top: 0; display: none;" alt="<?php echo $video['title']; ?>" id="thumbsGIF<?php echo $video['id']; ?>" class="thumbsGIF img-responsive <?php echo @$img_portrait; ?> rotate<?php echo $video['rotation']; ?>" height="130" />
|
<img src="<?php echo $global['webSiteRootURL']; ?>view/img/loading-gif.png" data-src="<?php echo $imgGif; ?>" style="position: absolute; top: 0; display: none;" alt="<?php echo $video['title']; ?>" id="thumbsGIF<?php echo $video['id']; ?>" class="thumbsGIF img-responsive <?php echo @$img_portrait; ?> rotate<?php echo $video['rotation']; ?>" height="130" />
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
<span class="duration"><?php echo Video::getCleanDuration($video['duration']); ?></span>
|
<?php
|
||||||
<div class="progress" style="height: 3px; margin-bottom: 2px;">
|
if ($video['type'] !== 'pdf' && $video['type'] !== 'article') {
|
||||||
<div class="progress-bar progress-bar-danger" role="progressbar" style="width: <?php echo $video['progress']['percent'] ?>%;" aria-valuenow="<?php echo $video['progress']['percent'] ?>" aria-valuemin="0" aria-valuemax="100"></div>
|
?>
|
||||||
</div>
|
<span class="duration"><?php echo Video::getCleanDuration($video['duration']); ?></span>
|
||||||
|
<div class="progress" style="height: 3px; margin-bottom: 2px;">
|
||||||
|
<div class="progress-bar progress-bar-danger" role="progressbar" style="width: <?php echo $video['progress']['percent'] ?>%;" aria-valuenow="<?php echo $video['progress']['percent'] ?>" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
|
@ -34,7 +40,7 @@ if ($objYTube->BigVideo && empty($_GET['showOnly'])) {
|
||||||
<h1><?php echo $video['title']; ?></h1>
|
<h1><?php echo $video['title']; ?></h1>
|
||||||
</a>
|
</a>
|
||||||
<div class="mainAreaDescriptionContainer">
|
<div class="mainAreaDescriptionContainer">
|
||||||
<h4 class="mainAreaDescription" itemprop="description"><?php echo nl2br(textToLink($video['description'])); ?></h4>
|
<h4 class="mainAreaDescription" itemprop="description"><?php echo $video['description']; ?></h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-muted galeryDetails">
|
<div class="text-muted galeryDetails">
|
||||||
<div>
|
<div>
|
||||||
|
|
12
updatedb/updateDb.v7.5.sql
Normal file
12
updatedb/updateDb.v7.5.sql
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
|
||||||
|
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
|
||||||
|
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
|
||||||
|
|
||||||
|
ALTER TABLE `videos`
|
||||||
|
CHANGE COLUMN `type` `type` ENUM('audio', 'video', 'embed', 'linkVideo', 'linkAudio', 'torrent', 'pdf', 'image', 'gallery', 'article') NOT NULL DEFAULT 'video';
|
||||||
|
|
||||||
|
UPDATE configurations SET version = '7.5', modified = now() WHERE id = 1;
|
||||||
|
|
||||||
|
SET SQL_MODE=@OLD_SQL_MODE;
|
||||||
|
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
||||||
|
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
Loading…
Add table
Add a link
Reference in a new issue