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);
|
||||
}
|
||||
|
||||
function parseSecondsToDuration($seconds) {
|
||||
return secondsToVideoTime($seconds);
|
||||
}
|
||||
|
||||
function parseDurationToSeconds($str) {
|
||||
if (is_numeric($str)) {
|
||||
return intval($str);
|
||||
|
|
|
@ -29,6 +29,7 @@ class BulkEmbed extends PluginAbstract {
|
|||
$obj = new stdClass();
|
||||
|
||||
$obj->API_KEY = "AIzaSyCIqxE86BawU33Um2HEGtX4PcrUWeCh_6o";
|
||||
$obj->onlyAdminCanBulkEmbed = true;
|
||||
return $obj;
|
||||
}
|
||||
|
||||
|
@ -43,5 +44,15 @@ class BulkEmbed extends PluginAbstract {
|
|||
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->msg = array();
|
||||
|
||||
if (!User::canUpload()) {
|
||||
|
||||
$objo = YouPHPTubePlugin::getObjectDataIfEnabled('BulkEmbed');
|
||||
if(empty($objo) || ($objo->onlyAdminCanBulkEmbed && !User::isAdmin())){
|
||||
$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'])) {
|
||||
|
||||
foreach ($_POST['itemsToSave'] as $value) {
|
||||
|
|
|
@ -96,7 +96,9 @@ $obj = YouPHPTubePlugin::getObjectData("BulkEmbed");
|
|||
include $global['systemRootPath'] . 'view/include/navbar.php';
|
||||
?>
|
||||
<div class="container">
|
||||
<section>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<form id="search-form" name="search-form" onsubmit="return search()">
|
||||
<div id="custom-search-input">
|
||||
<div class="input-group col-md-12">
|
||||
|
@ -118,10 +120,12 @@ $obj = YouPHPTubePlugin::getObjectData("BulkEmbed");
|
|||
<button class="btn btn-success btn-block" id="getSelected"><?php echo __('Embed Selected'); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<ul id="results"></ul>
|
||||
<div id="buttons"></div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/footer.php';
|
||||
|
|
|
@ -430,5 +430,9 @@ abstract class PluginAbstract {
|
|||
return null;
|
||||
}
|
||||
|
||||
public function getDownloadMenuButton(){
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1151,4 +1151,18 @@ class YouPHPTubePlugin {
|
|||
}
|
||||
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>
|
||||
<?php
|
||||
}
|
||||
echo YouPHPTubePlugin::getDownloadMenuButton();
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue