mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
Now plugins can add buttons on the upload menu
This commit is contained in:
parent
e1583edfab
commit
72d88a997c
7 changed files with 68 additions and 24 deletions
|
@ -393,6 +393,10 @@ function secondsToVideoTime($seconds) {
|
||||||
return sprintf('%02d:%02d:%02d', $hours, $mins, $secs);
|
return sprintf('%02d:%02d:%02d', $hours, $mins, $secs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseSecondsToDuration($seconds) {
|
||||||
|
return secondsToVideoTime($seconds);
|
||||||
|
}
|
||||||
|
|
||||||
function parseDurationToSeconds($str) {
|
function parseDurationToSeconds($str) {
|
||||||
if (is_numeric($str)) {
|
if (is_numeric($str)) {
|
||||||
return intval($str);
|
return intval($str);
|
||||||
|
|
|
@ -29,6 +29,7 @@ class BulkEmbed extends PluginAbstract {
|
||||||
$obj = new stdClass();
|
$obj = new stdClass();
|
||||||
|
|
||||||
$obj->API_KEY = "AIzaSyCIqxE86BawU33Um2HEGtX4PcrUWeCh_6o";
|
$obj->API_KEY = "AIzaSyCIqxE86BawU33Um2HEGtX4PcrUWeCh_6o";
|
||||||
|
$obj->onlyAdminCanBulkEmbed = true;
|
||||||
return $obj;
|
return $obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +43,16 @@ class BulkEmbed extends PluginAbstract {
|
||||||
$menu = '<a href="' . $global['webSiteRootURL'] . 'plugin/BulkEmbed/search.php" class="btn btn-primary btn-xs btn-block" target="_blank">Search</a>';
|
$menu = '<a href="' . $global['webSiteRootURL'] . 'plugin/BulkEmbed/search.php" class="btn btn-primary btn-xs btn-block" target="_blank">Search</a>';
|
||||||
return $menu;
|
return $menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDownloadMenuButton(){
|
||||||
|
global $global;
|
||||||
|
$obj = $this->getDataObject();
|
||||||
|
if($obj->onlyAdminCanBulkEmbed && !User::isAdmin()){
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '<li><a href="'.$global['webSiteRootURL'].'plugin/BulkEmbed/search.php" ><span class="fa fa-link"></span>'.__("Bulk Embed").'</a></li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,14 @@ $obj = new stdClass();
|
||||||
$obj->error = true;
|
$obj->error = true;
|
||||||
$obj->msg = array();
|
$obj->msg = array();
|
||||||
|
|
||||||
if (!User::canUpload()) {
|
|
||||||
|
$objo = YouPHPTubePlugin::getObjectDataIfEnabled('BulkEmbed');
|
||||||
|
if(empty($objo) || ($objo->onlyAdminCanBulkEmbed && !User::isAdmin())){
|
||||||
$obj->msg[] = __("Permission denied");
|
$obj->msg[] = __("Permission denied");
|
||||||
|
$obj->msg[] = "Plugin disabled";
|
||||||
|
}else if (!User::canUpload()) {
|
||||||
|
$obj->msg[] = __("Permission denied");
|
||||||
|
$obj->msg[] = "User can not upload videos";
|
||||||
} else if (!empty($_POST['itemsToSave'])) {
|
} else if (!empty($_POST['itemsToSave'])) {
|
||||||
|
|
||||||
foreach ($_POST['itemsToSave'] as $value) {
|
foreach ($_POST['itemsToSave'] as $value) {
|
||||||
|
|
|
@ -96,32 +96,36 @@ $obj = YouPHPTubePlugin::getObjectData("BulkEmbed");
|
||||||
include $global['systemRootPath'] . 'view/include/navbar.php';
|
include $global['systemRootPath'] . 'view/include/navbar.php';
|
||||||
?>
|
?>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<section>
|
|
||||||
<form id="search-form" name="search-form" onsubmit="return search()">
|
<div class="panel panel-default">
|
||||||
<div id="custom-search-input">
|
<div class="panel-heading">
|
||||||
<div class="input-group col-md-12">
|
<form id="search-form" name="search-form" onsubmit="return search()">
|
||||||
<input type="search" id="query" class="form-control input-lg" placeholder="Search YouTube" />
|
<div id="custom-search-input">
|
||||||
<span class="input-group-btn">
|
<div class="input-group col-md-12">
|
||||||
<button class="btn btn-info btn-lg" type="button">
|
<input type="search" id="query" class="form-control input-lg" placeholder="Search YouTube" />
|
||||||
<i class="glyphicon glyphicon-search"></i>
|
<span class="input-group-btn">
|
||||||
</button>
|
<button class="btn btn-info btn-lg" type="button">
|
||||||
</span>
|
<i class="glyphicon glyphicon-search"></i>
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<br>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<button class="btn btn-info btn-block" id="getAll"><?php echo __('Embed All'); ?></button>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<button class="btn btn-success btn-block" id="getSelected"><?php echo __('Embed Selected'); ?></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
|
||||||
<br>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<button class="btn btn-info btn-block" id="getAll"><?php echo __('Embed All'); ?></button>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<button class="btn btn-success btn-block" id="getSelected"><?php echo __('Embed Selected'); ?></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<div class="panel-body">
|
||||||
<ul id="results"></ul>
|
<ul id="results"></ul>
|
||||||
<div id="buttons"></div>
|
<div id="buttons"></div>
|
||||||
</section>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
include $global['systemRootPath'] . 'view/include/footer.php';
|
include $global['systemRootPath'] . 'view/include/footer.php';
|
||||||
|
|
|
@ -430,5 +430,9 @@ abstract class PluginAbstract {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDownloadMenuButton(){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1151,4 +1151,18 @@ class YouPHPTubePlugin {
|
||||||
}
|
}
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getDownloadMenuButton(){
|
||||||
|
$plugins = Plugin::getAllEnabled();
|
||||||
|
$r = "";
|
||||||
|
foreach ($plugins as $value) {
|
||||||
|
self::YPTstart();
|
||||||
|
$p = static::loadPlugin($value['dirName']);
|
||||||
|
if (is_object($p)) {
|
||||||
|
$r .= $p->getDownloadMenuButton();
|
||||||
|
}
|
||||||
|
self::YPTend("{$value['dirName']}::".__FUNCTION__);
|
||||||
|
}
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -303,6 +303,7 @@ if (((empty($advancedCustomUser->userMustBeLoggedIn) && empty($advancedCustom->d
|
||||||
</li>
|
</li>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
echo YouPHPTubePlugin::getDownloadMenuButton();
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
<?php
|
<?php
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue