1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 17:59:55 +02:00

Release plugin free

This commit is contained in:
daniel 2018-10-18 09:59:16 -03:00
parent a2155cdc83
commit fc2d1676f2
42 changed files with 9640 additions and 0 deletions

View file

@ -0,0 +1,82 @@
<?php
global $global;
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
require_once $global['systemRootPath'] . 'objects/userGroups.php';
class PredefinedCategory extends PluginAbstract {
public function getDescription() {
$txt = "Choose what category the video goes when upload, encode or embed";
$help = "<br><small><a href='https://github.com/DanielnetoDotCom/YouPHPTube/wiki/PredefinedCategory-Plugin' target='__blank'><i class='fas fa-question-circle'></i> Help</a></small>";
return $txt.$help;
}
public function getName() {
return "PredefinedCategory";
}
public function getUUID() {
return "b0d93ffa-9a92-4017-88fe-38a6597efaaa";
}
public function getEmptyDataObject() {
$obj = new stdClass();
$obj->defaultCategory = 1;
$obj->userCategory = new stdClass();
$groups = UserGroups::getAllUsersGroups();
//import external plugins configuration options
foreach ($groups as $value) {
$obj->{"AddVideoOnGroup_[{$value['id']}]_"}=false;
}
return $obj;
}
public function getPluginMenu() {
global $global;
$filename = $global['systemRootPath'] . 'plugin/PredefinedCategory/pluginMenu.html';
return file_get_contents($filename);
}
public function getCategoryId() {
global $global;
require_once $global['systemRootPath'] . 'objects/user.php';
$obj = YouPHPTubePlugin::getObjectDataIfEnabled("PredefinedCategory");
$id = $obj->defaultCategory;
if(User::canUpload()){
$user_id = User::getId();
if(!empty($obj->userCategory->$user_id)){
$id = $obj->userCategory->$user_id;
}
}
return $id;
}
public function getUserGroupsArray(){
$obj = $this->getDataObject();
$videoGroups = array();
foreach ($obj as $key => $value) {
if($value===true){
preg_match("/^AddVideoOnGroup_\[([0-9]+)\]_/", $key, $match);
if(!empty($match[1])){
//check if group exists
$group=new UserGroups($match[1]);
if(!empty($group->getGroup_name())){
$videoGroups[] = $match[1];
}
}
}
}
return $videoGroups;
}
public function getTags() {
return array('free');
}
}

View file

@ -0,0 +1,306 @@
<?php
require_once '../../../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not manager plugin add logo"));
exit;
}
require_once $global['systemRootPath'] . 'objects/category.php';
$categories = Category::getAllCategories();
$groups = UserGroups::getAllUsersGroups();
$users = User::getAllUsers();
$o = YouPHPTubePlugin::getObjectData("PredefinedCategory");
?>
<!DOCTYPE html>
<html lang="<?php echo $_SESSION['language']; ?>">
<head>
<title><?php echo $config->getWebSiteTitle(); ?> :: Predefined Category</title>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
?>
<style>
.funkyradio div {
clear: both;
overflow: hidden;
}
.funkyradio label {
width: 100%;
border-radius: 3px;
border: 1px solid #D1D3D4;
font-weight: normal;
}
.funkyradio input[type="radio"]:empty,
.funkyradio input[type="checkbox"]:empty {
display: none;
}
.funkyradio input[type="radio"]:empty ~ label,
.funkyradio input[type="checkbox"]:empty ~ label {
position: relative;
line-height: 2.5em;
text-indent: 3.25em;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.funkyradio input[type="radio"]:empty ~ label:before,
.funkyradio input[type="checkbox"]:empty ~ label:before {
position: absolute;
display: block;
top: 0;
bottom: 0;
left: 0;
content: '';
width: 2.5em;
background: #D1D3D4;
border-radius: 3px 0 0 3px;
}
.funkyradio input[type="radio"]:hover:not(:checked) ~ label,
.funkyradio input[type="checkbox"]:hover:not(:checked) ~ label {
color: #888;
}
.funkyradio input[type="radio"]:hover:not(:checked) ~ label:before,
.funkyradio input[type="checkbox"]:hover:not(:checked) ~ label:before {
content: '\2714';
text-indent: .9em;
color: #C2C2C2;
}
.funkyradio input[type="radio"]:checked ~ label,
.funkyradio input[type="checkbox"]:checked ~ label {
color: #777;
}
.funkyradio input[type="radio"]:checked ~ label:before,
.funkyradio input[type="checkbox"]:checked ~ label:before {
content: '\2714';
text-indent: .9em;
color: #333;
background-color: #ccc;
}
.funkyradio input[type="radio"]:focus ~ label:before,
.funkyradio input[type="checkbox"]:focus ~ label:before {
box-shadow: 0 0 0 3px #999;
}
.funkyradio-default input[type="radio"]:checked ~ label:before,
.funkyradio-default input[type="checkbox"]:checked ~ label:before {
color: #333;
background-color: #ccc;
}
.funkyradio-primary input[type="radio"]:checked ~ label:before,
.funkyradio-primary input[type="checkbox"]:checked ~ label:before {
color: #fff;
background-color: #337ab7;
}
.funkyradio-success input[type="radio"]:checked ~ label:before,
.funkyradio-success input[type="checkbox"]:checked ~ label:before {
color: #fff;
background-color: #5cb85c;
}
.funkyradio-danger input[type="radio"]:checked ~ label:before,
.funkyradio-danger input[type="checkbox"]:checked ~ label:before {
color: #fff;
background-color: #d9534f;
}
.funkyradio-warning input[type="radio"]:checked ~ label:before,
.funkyradio-warning input[type="checkbox"]:checked ~ label:before {
color: #fff;
background-color: #f0ad4e;
}
.funkyradio-info input[type="radio"]:checked ~ label:before,
.funkyradio-info input[type="checkbox"]:checked ~ label:before {
color: #fff;
background-color: #5bc0de;
}
</style>
</head>
<body>
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container">
<div class="col-md-3">
<div class="alert alert-info">
<i class="fa fa-info-circle"></i> Here you can choose the default category whenever a video is submitted to your site.
</div>
<div class="card">
<div class="card-header">Site Default Category</div>
<div class="card-body">
<div class="funkyradio">
<?php
foreach ($categories as $value) {
?>
<div class="funkyradio-primary">
<input type="radio" name="radio" class="categoryRadio" id="radio<?php echo $value['id']; ?>" value="<?php echo $value['id']; ?>" <?php if ($o->defaultCategory == $value['id']) { ?>checked<?php } ?>/>
<label for="radio<?php echo $value['id']; ?>"><i class="<?php echo $value['iconClass']; ?>"></i> <?php echo $value['name']; ?></label>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card">
<div class="card-header">Default Category per User</div>
<div class="card-body">
<div class="alert alert-info">
<i class="fa fa-info-circle"></i> Select a user then choose the defaul category.
</div>
<div class="col-md-6">
<div class="card">
<div class="card-header">Users</div>
<div class="card-body">
<div class="funkyradio">
<?php
$count = 0;
foreach ($users as $value) {
?>
<div class="funkyradio-warning">
<input type="radio" name="radioUser" class="userRadio" id="radioUser<?php echo $value['id']; ?>" value="<?php echo $value['id']; ?>" <?php if (empty($count)) { ?>checked<?php } ?>/>
<label for="radioUser<?php echo $value['id']; ?>"> <?php echo $value['user']; ?></label>
</div>
<?php
$count++;
}
?>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card">
<div class="card-header">Category</div>
<div class="card-body">
<div class="funkyradio">
<div class="funkyradio-default">
<input type="radio" name="radioUserCat" class="categoryGroupRadio" id="radioUserCat" value="0" checked="checked"/>
<label for="radioUserCat">Use Site Default Category</label>
</div>
<?php
foreach ($categories as $value) {
?>
<div class="funkyradio-info">
<input type="radio" name="radioUserCat" class="categoryGroupRadio" id="radioUserCat<?php echo $value['id']; ?>" value="<?php echo $value['id']; ?>"/>
<label for="radioUserCat<?php echo $value['id']; ?>"><i class="<?php echo $value['iconClass']; ?>"></i> <?php echo $value['name']; ?></label>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="alert alert-info">
<i class="fa fa-info-circle"></i> Here you can choose the default user group.<br>
When ever you upload a new video this video will be exclusive for the
<a href="http://127.0.0.1/YouPHPTube/usersGroups">user groups</a> you selected.<br>
Leave it blank to be public by default
</div>
<div class="card">
<div class="card-header">Site Default User Group</div>
<div class="card-body">
<div class="funkyradio">
<?php
foreach ($groups as $value) {
?>
<div class="funkyradio-danger">
<input type="checkbox" name="groupRadio" class="groupRadio" id="groupRadio<?php echo $value['id']; ?>" value="<?php echo $value['id']; ?>" <?php if (!empty($o->{"AddVideoOnGroup_[{$value['id']}]_"})) { ?>checked<?php } ?>/>
<label for="groupRadio<?php echo $value['id']; ?>"> <?php echo $value['group_name']; ?></label>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
</div>
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
<script>
var userCategory = <?php echo json_encode($o->userCategory); ?>;
$(document).ready(function () {
$('.groupRadio').click(function () {
modal.showPleaseWait();
$.ajax({
url: 'editorSave.php',
data: {
"groupRadio": $(this).is(":checked"),
"groupRadioValue": $(this).val()
},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
});
$('.categoryRadio').click(function () {
modal.showPleaseWait();
$.ajax({
url: 'editorSave.php',
data: {
"category_id": $(this).val()
},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
});
$('.userRadio').click(function () {
var value = 0;
if(typeof userCategory != 'undefined' && userCategory[$(this).val()]){
value = userCategory[$(this).val()];
}
$("input[name=radioUserCat][value=0]").prop('checked', true);
$('[name=radioUserCat]').removeAttr('checked');
$("input[name=radioUserCat][value=" + value + "]").prop('checked', true);
});
$("input[name='radioUser']:checked").trigger('click')
$('.categoryGroupRadio').click(function () {
modal.showPleaseWait();
var radioValue = $("input[name='radioUser']:checked").val();
$.ajax({
url: 'editorSave.php',
data: {
"user_id": radioValue,
"category_id": $(this).val()
},
type: 'post',
success: function (response) {
userCategory = response.userCategory;
modal.hidePleaseWait();
}
});
});
});
</script>
</body>
</html>

View file

@ -0,0 +1,37 @@
<?php
require_once '../../../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/plugin.php';
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not manager plugin logo overlay"));
exit;
}
header('Content-Type: application/json');
require_once $global['systemRootPath'] . 'plugin/PredefinedCategory/PredefinedCategory.php';
$plugin = new PredefinedCategory();
$obj = new stdClass();
$o = $plugin->getDataObject();
//var_dump($o);exit;
if(!empty($_POST['groupRadioValue'])){
$o->{"AddVideoOnGroup_[{$_POST['groupRadioValue']}]_"}=$_POST['groupRadio']==='true'?true:false;
}else if(empty($_POST['user_id'])){
$o->defaultCategory = $_POST['category_id'];
}else{
$v = $_POST['user_id'];
if(empty($_POST['category_id'])){
unset($o->userCategory->$v);
}else{
$o->userCategory->$v = $_POST['category_id'];
}
}
$p = new Plugin(0);
$p->loadFromUUID($plugin->getUUID());
$p->setObject_data(json_encode($o));
$obj->saved = $p->save();
echo json_encode($o);
?>

View file

@ -0,0 +1 @@
<a href="plugin/PredefinedCategory/page/editor.php" class="btn btn-primary btn-sm"><i class="fa fa-edit"></i> Default Category</a>

View file

@ -0,0 +1,32 @@
<?php
global $global;
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
class ShareSocialButtonsOnEmbed extends PluginAbstract {
public function getDescription() {
return "Enable Or disable Share Social Buttons on Embed videos";
}
public function getName() {
return "ShareSocialButtonsOnEmbed";
}
public function getUUID() {
return "c63ae9e3-bf01-4f76-9d7e-b3ad7fd92e3e";
}
public function getFooterCode() {
global $global, $video, $isEmbed;
if(empty($isEmbed)){
return "";
}
include 'script.php';
}
public function getTags() {
return array('free');
}
}

View file

@ -0,0 +1,143 @@
<div id="share" style="z-index: 280; position: absolute; top: 10px; right: 10px; display: none;" class="text-center">
<button type="button" class="btn btn-light" style="width: 30px;
height: 30px;
text-align: center;
padding: 6px 0;
font-size: 12px;
line-height: 1.428571429;
border-radius: 50%;" title="<?php echo __("Share"); ?>"><i class="fa fa-share"></i></button>
</div>
<div id="modalSocial" style="background-color: rgba(0,0,0,0.8); width:100%;
height: 100%;
z-index: 290;
top: 0;
left: 0;
position: fixed;display: none;">
<div id="close" style="z-index: 280; position: absolute; top: 10px; right: 10px;" class="text-center">
<button type="button" class="btn btn-light" style="width: 30px;
height: 30px;
text-align: center;
padding: 6px 0;
font-size: 12px;
line-height: 1.428571429;
border-radius: 50%;" title="<?php echo __("Close"); ?>"><i class="far fa-window-close"></i></button>
</div>
<h2 style="z-index: 290; color: white;" class="text-center"><?php echo __("Share"); ?></h2>
<div id="social" style="z-index: 300; position: absolute; top: 10px; left: 50%; margin-left: -200px; width: 400px; " class="text-center">
<?php
$url = urlencode($global['webSiteRootURL'] . "video/" . $video['clean_title']);
$title = urlencode($video['title']);
?>
<div class="row">
<a class="" target="_blank" aria-label="Share link" href="<?php echo urldecode($url); ?>" title="Share link" style="display: block;
height: 28px;
margin-top: 18px;
text-overflow: ellipsis;
font-size: 120%;
color: white;
font-weight: 500;
letter-spacing: 1px;
white-space: nowrap;
overflow: hidden;
text-decoration: none;
outline: 0;"><?php echo urldecode($url); ?></a>
</div>
<div class="row">
<?php
include './include/social.php';
?>
</div>
<div class="row" style="margin-top: 10px;">
<button class="btn btn-light btn-sm copyTooltip" id="cpLink"><i class="fa fa-link" aria-hidden="true"></i> Copy Link</button>
<button class="btn btn-light btn-sm copyTooltip" id="cpEmbed"><i class="fa fa-code" aria-hidden="true"></i> Copy Embed</button>
</div>
</div>
</div>
<script>
var waitSocial = 0;
var timeout;
function setTooltip(element, message) {
$(element).attr('data-original-title', message)
.tooltip('show');
}
$(document).ready(function () {
$('.copyTooltip').tooltip({
trigger: 'click',
placement: 'bottom'
});
if (typeof player == 'undefined') {
player = videojs('mainVideo');
}
$('#cpLink, #cpEmbed').mouseleave(function (event) {
$(this).tooltip('hide');
});
$('#cpLink').click(function (event) {
copyToClipboard('<?php echo urldecode($url); ?>');
setTooltip(this, 'Copied!');
});
$('#cpEmbed').click(function (event) {
copyToClipboard('<?php
if ($video['type'] == 'video' || $video['type'] == 'embed') {
$code = '<iframe width="640" height="480" style="max-width: 100%;max-height: 100%;" src="' . $global['webSiteRootURL'] . 'videoEmbeded/' . $video['clean_title'] . '" frameborder="0" allowfullscreen="allowfullscreen" ></iframe>';
} else {
$code = '<iframe width="350" height="40" style="max-width: 100%;max-height: 100%;" src="' . $global['webSiteRootURL'] . 'videoEmbeded/' . $video['clean_title'] . '" frameborder="0" allowfullscreen="allowfullscreen" ></iframe>';
}
echo ($code);
?>');
setTooltip(this, 'Copied!');
});
$('#share').click(function (event) {
waitSocial = 1;
event.stopPropagation();
var top = ($('.embed-responsive').outerHeight() / 2) - 55;
console.log(top);
$('#social').css({"top": top + "px"});
$('#modalSocial').fadeIn();
});
$('#close').click(function (event) {
waitShare = 0;
$('#modalSocial').fadeOut();
});
$('#modalSocial').mouseleave(function (event) {
waitSocial = 0;
});
$('.embed-responsive, #modalSocial').mouseleave(function () {
setTimeout(function () {
if (!waitSocial) {
$('#modalSocial').fadeOut();
}
}, 1000);
});
var waitShare = 0;
$('#share').mouseenter(function (event) {
waitShare = 1;
event.stopPropagation();
$('#share').fadeIn();
});
$('.embed-responsive').mouseenter(function (event) {
event.stopPropagation();
$('#share').fadeIn();
});
$('#share').mouseleave(function (event) {
setTimeout(function () {
waitShare = 0;
}, 500);
});
$('.embed-responsive').mouseleave(function () {
console.log("leave responsive: " + waitShare);
setTimeout(function () {
if (!waitShare) {
$('#share').fadeOut();
}
}, 1000);
});
});
</script>

View file

@ -0,0 +1,50 @@
<?php
$configFile = $global['systemRootPath'] . 'videos/configuration.php';
require_once $configFile;
require_once $global['systemRootPath'] . 'plugin/TopMenu/Objects/Menu.php';
require_once $global['systemRootPath'] . 'plugin/TopMenu/Objects/MenuItem.php';
$menu = Menu::getAllActive(2);
?>
<?php
foreach ($menu as $key => $value) {
?>
<li>
<hr>
<h3 class="text-danger">
<?php
if (!empty($value['icon'])) {
?>
<i class="<?php echo $value['icon'] ?>"></i>
<?php
}
?>
<?php echo $value['menuName']; ?>
</h3>
</li>
<?php
$menuItems = MenuItem::getAllFromMenu($value['id'], true);
foreach ($menuItems as $key2 => $value2) {
$url = $value2['url'];
if (empty($url)) {
$url = $global['webSiteRootURL'] . "menu/{$value2['menuSeoUrlItem']}";
}
?>
<li>
<a href="<?php echo $url; ?>" >
<?php
if (!empty($value2['icon'])) {
?>
<i class="<?php echo $value2['icon'] ?>"></i>
<?php
}
?>
<?php echo $value2['title'] ?>
</a>
</li>
<?php
}
}
?>

View file

@ -0,0 +1,55 @@
<?php
$configFile = $global['systemRootPath'] . 'videos/configuration.php';
require_once $configFile;
require_once $global['systemRootPath'] . 'plugin/TopMenu/Objects/Menu.php';
require_once $global['systemRootPath'] . 'plugin/TopMenu/Objects/MenuItem.php';
$menu = Menu::getAllActive(1);
?>
<?php
foreach ($menu as $key => $value) {
?>
<li class="dropdown">
<a href="#" class=" btn btn-light navbar-btn" data-toggle="dropdown">
<?php
if (!empty($value['icon'])) {
?>
<i class="<?php echo $value['icon'] ?>"></i>
<?php
}
?>
<?php echo $value['menuName']; ?>
<b class="caret"></b>
</a>
<ul class="dropdown-menu dropdown-menu-right" id="availableLive" style="">
<?php
$menuItems = MenuItem::getAllFromMenu($value['id'], true);
foreach ($menuItems as $key2 => $value2) {
$url = $value2['url'];
if(empty($url)){
$url = $global['webSiteRootURL']."plugin/TopMenu/?id={$value2['id']}";
}
?>
<li style="margin-right: 0;">
<a href="<?php echo $url; ?>" >
<?php
if (!empty($value2['icon'])) {
?>
<i class="<?php echo $value2['icon'] ?>"></i>
<?php
}
?>
<?php echo $value2['title'] ?>
</a>
</li>
<?php
}
?>
</ul>
</li>
<?php
}
?>

View file

@ -0,0 +1,107 @@
<?php
require_once dirname(__FILE__) . '/../../../videos/configuration.php';
require_once dirname(__FILE__) . '/../../../objects/bootGrid.php';
require_once dirname(__FILE__) . '/../../../objects/user.php';
class Menu extends ObjectYPT {
protected $id, $menuName, $categories_id, $users_groups_id, $menu_order, $status, $position, $type, $icon, $menuSeoUrl;
static function getSearchFieldsNames() {
return array();
}
static function getTableName() {
return 'topMenu';
}
function setMenuName($menuName) {
$this->menuName = $menuName;
}
function setCategories_id($categories_id) {
$this->categories_id = $categories_id;
}
function setUsers_groups_id($users_groups_id) {
$this->users_groups_id = $users_groups_id;
}
function setMenu_order($menu_order) {
$this->menu_order = $menu_order;
}
function setStatus($status) {
$this->status = $status;
}
function setPosition($position) {
$this->position = $position;
}
function setType($type) {
$this->type = $type;
}
function setIcon($icon) {
$this->icon = $icon;
}
function setmenuSeoUrl($menuSeoUrl){
$this->menuSeoUrl=$menuSeoUrl;
}
static function getAllActive($type=false) {
global $global;
$sql = "SELECT * FROM ".static::getTableName()." WHERE status = 'active' ";
if(!empty($type)){
$sql .= " AND type = $type ";
}
$sql .= " ORDER BY menu_order ";
$res = $global['mysqli']->query($sql);
$rows = array();
if ($res) {
while ($row = $res->fetch_assoc()) {
$rows[] = $row;
}
}
return $rows;
}
function save() {
if(empty($this->menuName)){
$this->menuName = 'Unknow Menu Name';
}
if(empty($this->categories_id)){
$this->categories_id = 'null';
}
if(empty($this->users_groups_id)){
$this->users_groups_id = 'null';
}
if(empty($this->menu_order)){
$this->menu_order = 0;
}
if(empty($this->status)){
$this->status = "active";
}
if(empty($this->position)){
$this->position = "right";
}
if(empty($this->type)){
$this->type = 1;
}
if(empty($this->menuSeoUrl)){
$this->menuSeoUrl=$this->menuName;
}
$this->menuSeoUrl=$global['mysqli']->real_escape_string(preg_replace('/[^a-z0-9]+/', '_', strtolower($this->menuSeoUrl)));
return parent::save();
}
}

View file

@ -0,0 +1,125 @@
<?php
require_once dirname(__FILE__) . '/../../../videos/configuration.php';
require_once dirname(__FILE__) . '/../../../objects/bootGrid.php';
require_once dirname(__FILE__) . '/../../../objects/user.php';
class MenuItem extends ObjectYPT {
protected $id, $title, $image, $url, $class, $style, $item_order, $topMenu_id, $status, $text, $icon, $clean_url, $menuSeoUrlItem;
static function getSearchFieldsNames() {
return array();
}
static function getTableName() {
return 'topMenu_items';
}
static function getAllFromMenu($menu_id, $activeOnly = false, $sort = true) {
global $global;
$menu_id = intval($menu_id);
if(empty($menu_id)){
return false;
}
$sql = "SELECT * FROM ".static::getTableName()." WHERE topMenu_id = {$menu_id}";
if($activeOnly){
$sql .= " AND status = 'active' ";
}
if($sort){
$sql .= " ORDER BY item_order ";
}
$res = $global['mysqli']->query($sql);
$rows = array();
if ($res) {
while ($row = $res->fetch_assoc()) {
$rows[] = $row;
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $rows;
}
function setTitle($title) {
$this->title = $title;
}
function setImage($image) {
$this->image = $image;
}
function setUrl($url) {
$this->url = $url;
}
function setClass($class) {
$this->class = $class;
}
function setStyle($style) {
$this->style = $style;
}
function setItem_order($item_order) {
$this->item_order = intval($item_order);
}
function setTopMenu_id($topMenu_id) {
$this->topMenu_id = intval($topMenu_id);
}
function setStatus($status) {
$this->status = $status;
}
function setText($text) {
$this->text = $text;
}
function setIcon($icon) {
$this->icon = $icon;
}
function setClean_url($clean_url) {
$this->clean_url = $clean_url;
}
function setmenuSeoUrlItem($menuSeoUrlItem){
$this->menuSeoUrlItem=$menuSeoUrlItem;
}
function save() {
global $global;
if(empty($this->title)){
$this->title = "Unknow Item Menu Title";
}
if(empty($this->status)){
$this->status = "active";
}
if(empty($this->menuSeoUrlItem)){
$this->menuSeoUrlItem=$this->title;
}
$this->menuSeoUrlItem=$global['mysqli']->real_escape_string(preg_replace('/[^a-z0-9]+/', '_', strtolower($this->title)));
$this->title = $global['mysqli']->real_escape_string($this->title);
$this->text = $global['mysqli']->real_escape_string($this->text);
return parent::save();
}
function getTitle() {
return $this->title;
}
function getText() {
return $this->text;
}
}

View file

@ -0,0 +1,86 @@
<?php
global $global;
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
use Pecee\SimpleRouter\SimpleRouter; //required if we want to define routes on our plugin.
class TopMenu extends PluginAbstract {
public function getDescription() {
$txt = "Responsive Customized Top Menu";
$help = "<br><small><a href='https://github.com/DanielnetoDotCom/YouPHPTube/wiki/How-to-use-TopMenu-Plug-in' target='__blank'><i class='fas fa-question-circle'></i> Help</a></small>";
return $txt.$help;
}
public function getName() {
return "TopMenu";
}
public function getUUID() {
return "2e7866ed-2e02-4136-bec6-4cd90754e3a2";
}
public function getPluginVersion() {
return "2.1";
}
public function updateScript() {
global $mysqlDatabase;
//update version 2.0
$sql = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ? and COLUMN_NAME=?";
$res = sqlDAL::readSql($sql,"s",array($mysqlDatabase, "topMenu_items", "menuSeoUrlItem"));
$menuSeoUrlItem=sqlDAL::fetchAssoc($res);
if(!$menuSeoUrlItem){
sqlDal::writeSql("alter table topMenu_items add menuSeoUrlItem varchar(255) default ''");
}
return true;
}
public function addRoutes()
{
global $basePath;
SimpleRouter::get($basePath."/menu/{menuSeoUrlItem}", function($menuSeoUrlItem) {
$_GET['$menuSeoUrlItem']=$menuSeoUrlItem;
require_once "plugin/TopMenu/seo.php";
},['defaultParameterRegex' => '.*']);
return false;
}
public function getHeadCode() {
global $global;
$css = '<link href="' . $global['webSiteRootURL'] . 'plugin/TopMenu/style.css" rel="stylesheet" type="text/css"/>';
return $css;
}
public function getHTMLMenuRight() {
global $global;
include $global['systemRootPath'] . 'plugin/TopMenu/HTMLMenuRight.php';
}
public function getPluginMenu() {
global $global;
$filename = $global['systemRootPath'] . 'plugin/TopMenu/pluginMenu.html';
return file_get_contents($filename);
}
public function getHTMLMenuLeft() {
global $global;
include $global['systemRootPath'] . 'plugin/TopMenu/HTMLMenuLeft.php';
}
public function getidBySeoUrl($menuSeoUrlItem) {
global $global;
$sql="select id from topMenu_items where menuSeoUrlItem= ?";
$res=sqlDal::readSql($sql, "s", array($global['mysqli']->real_escape_string($menuSeoUrlItem)));
$menuId=sqlDAL::fetchAssoc($res);
if(!isset($menuId['id']))
return false;
return $menuId['id'];
}
public function getTags() {
return array('free');
}
}

36
plugin/TopMenu/index.php Normal file
View file

@ -0,0 +1,36 @@
<?php
require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'plugin/TopMenu/Objects/MenuItem.php';
global $config;
$menuItem = new MenuItem($_GET['id']);
?>
<!DOCTYPE html>
<html lang="<?php echo $_SESSION['language']; ?>">
<head>
<title><?php echo $config->getWebSiteTitle(); ?> :: <?php echo $menuItem->getTitle(); ?></title>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
?>
<style>
</style>
</head>
<body>
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container">
<div class="bgWhite bg-light clear clearfix">
<?php echo $menuItem->getText(); ?>
</div>
</div>
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
<script>
$(document).ready(function () {
});
</script>
</body>
</html>

View file

@ -0,0 +1,50 @@
-- MySQL Workbench Forward Engineering
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';
CREATE TABLE IF NOT EXISTS `topMenu` (
`id` INT NOT NULL AUTO_INCREMENT,
`menuName` VARCHAR(255) NOT NULL,
`categories_id` INT NULL,
`users_groups_id` INT NULL,
`created` DATETIME NULL,
`modified` DATETIME NULL,
`menu_order` INT NOT NULL DEFAULT 0,
`status` ENUM('active', 'inactive') NOT NULL DEFAULT 'active',
`position` ENUM('left', 'right', 'center', 'bottom') NOT NULL DEFAULT 'right',
`type` INT NOT NULL DEFAULT 1 COMMENT '1 = default\n',
`icon` VARCHAR(255) NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS `topMenu_items` (
`id` INT NOT NULL AUTO_INCREMENT,
`title` VARCHAR(255) NOT NULL,
`image` VARCHAR(255) NULL,
`url` VARCHAR(255) NULL,
`class` VARCHAR(255) NULL,
`style` VARCHAR(255) NULL,
`item_order` INT NULL,
`created` DATETIME NULL,
`modified` DATETIME NULL,
`topMenu_id` INT NOT NULL,
`status` ENUM('active', 'inactive') NOT NULL DEFAULT 'active',
`text` TEXT NULL,
`icon` VARCHAR(255) NULL,
`clean_url` VARCHAR(255) NULL,
`menuSeoUrlItem` VARCHAR(255) DEFAULT '',
PRIMARY KEY (`id`),
INDEX `fk_topMenu_items_topMenu_idx` (`topMenu_id` ASC),
CONSTRAINT `fk_topMenu_items_topMenu`
FOREIGN KEY (`topMenu_id`)
REFERENCES `topMenu` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

View file

@ -0,0 +1,23 @@
<?php
require_once '../../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not manager plugins"));
exit;
}
require_once $global['systemRootPath'] . 'plugin/TopMenu/Objects/Menu.php';
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
$obj->message = "";
if (empty($_POST['menuId'])) {
$obj->message = "Menu ID can not be empty";
} else {
$menu = new Menu($_POST['menuId']);
$obj->error = $menu->delete();
}
echo json_encode($obj);
?>

View file

@ -0,0 +1,23 @@
<?php
require_once '../../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not manager plugins"));
exit;
}
require_once $global['systemRootPath'] . 'plugin/TopMenu/Objects/MenuItem.php';
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
$obj->message = "";
if (empty($_POST['menuItemId'])) {
$obj->message = "Menu Item ID can not be empty";
} else {
$menu = new MenuItem($_POST['menuItemId']);
$obj->error = $menu->delete();
}
echo json_encode($obj);
?>

View file

@ -0,0 +1,30 @@
<?php
require_once '../../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not manager plugins"));
exit;
}
require_once $global['systemRootPath'] . 'plugin/TopMenu/Objects/MenuItem.php';
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
$obj->message = "";
$menu = new MenuItem(@$_POST['menuItemId']);
$menu->setTopMenu_id($_POST['menuId']);
//$menu->setClass($_POST['class']);
//$menu->setImage($_POST['image']);
$menu->setItem_order($_POST['item_order']);
$menu->setStatus($_POST['item_status']);
//$menu->setStyle($_POST['style']);
$menu->setText($_POST['text']);
$menu->setTitle($_POST['title']);
$menu->setUrl($_POST['url']);
$menu->setIcon($_POST['icon']);
$menu->setMenuSeoUrlItem($_POST['menuSeoUrlItem']);
$obj->error = $menu->save();
echo json_encode($obj); ?>

View file

@ -0,0 +1,21 @@
<?php
require_once '../../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not manager plugins"));
exit;
}
require_once $global['systemRootPath'] . 'plugin/TopMenu/Objects/MenuItem.php';
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
$obj->message = "";
foreach ($_POST['itens'] as $key => $value) {
$menu = new MenuItem($value);
$menu->setItem_order($key+10);
$obj->error = $menu->save();
}
echo json_encode($obj); ?>

View file

@ -0,0 +1,12 @@
<?php
require_once '../../videos/configuration.php';
require_once $global['systemRootPath'] . 'plugin/TopMenu/Objects/MenuItem.php';
header('Content-Type: application/json');
if(empty($_POST['sort'])){
$_POST['sort'] = array('item_order'=>"ASC");
}
$menu = MenuItem::getAllFromMenu($_POST['menuId']);
?>
{"data": <?php echo json_encode($menu); ?>}

View file

@ -0,0 +1,27 @@
<?php
require_once '../../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not manager plugins"));
exit;
}
require_once $global['systemRootPath'] . 'plugin/TopMenu/Objects/Menu.php';
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
$obj->message = "";
$menu = new Menu(@$_POST['menuId']);
$menu->setMenuName($_POST['menuName']);
//$menu->setCategories_id(@$_POST['categories_id']);
$menu->setMenu_order(@$_POST['menu_order']);
//$menu->setPosition(@$_POST['position']);
$menu->setStatus(@$_POST['status']);
$menu->setType(@$_POST['type']);
//$menu->setUsers_groups_id(@$_POST['users_groups_id']);
$menu->setIcon(@$_POST['icon']);
$obj->error = $menu->save();
echo json_encode($obj); ?>

View file

@ -0,0 +1,11 @@
<?php
require_once '../../videos/configuration.php';
require_once $global['systemRootPath'] . 'plugin/TopMenu/Objects/Menu.php';
header('Content-Type: application/json');
if(empty($_POST['sort'])){
$_POST['sort'] = array('menu_order'=>"ASC");
}
$menu = Menu::getAll();
?>
{"data": <?php echo json_encode($menu); ?>}

View file

@ -0,0 +1,627 @@
<?php
require_once '../../../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/category.php';
require_once $global['systemRootPath'] . 'objects/userGroups.php';
require_once $global['systemRootPath'] . 'plugin/TopMenu/Objects/Menu.php';
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not manager plugins"));
exit;
}
require_once $global['systemRootPath'] . 'objects/plugin.php';
$categories = Category::getAllCategories();
$groups = UserGroups::getAllUsersGroups();
?>
<!DOCTYPE html>
<html lang="<?php echo $_SESSION['language']; ?>">
<head>
<title><?php echo $config->getWebSiteTitle(); ?> :: Top Menu</title>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
?>
<link rel="stylesheet" type="text/css" href="<?php echo $global['webSiteRootURL']; ?>view/css/DataTables/datatables.min.css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>view/js/jquery-ui/jquery-ui.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>js/Croppie/croppie.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>js/bootstrap3-wysiwyg/bootstrap3-wysihtml5.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>css/fontawesome-iconpicker/dist/css/fontawesome-iconpicker.min.css" rel="stylesheet" type="text/css"/>
<style>
#sortable li{
list-style: none;
margin: 2px;
padding: 5px;
}
#sortable{
padding: 0;
}
.ui-state-highlight{
height: 30px;
}
</style>
</head>
<body>
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container">
<div class="bgWhite bg-light clear clearfix">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#menu">Menu</a></li>
<li class="disabled" id="menuItemsTab"><a data-toggle="tab" href="#menuItems" id="menuItemsTabButton">Menu Items</a></li>
</ul>
<div class="tab-content">
<div id="menu" class="tab-pane fade in active">
<div class="col-md-8">
<div class="panel panel-default">
<div class="panel-heading">Menu Form</div>
<div class="panel-body">
<div>
<button class="btn btn-default" id="btnNewMenu"><i class="fa fa-plus"></i> New Menu</button>
<button class="btn btn-success" id="btnSaveMenu"><i class="fa fa-save"></i> Save Menu</button>
<button class="btn btn-primary showWhenHaveId" id="btnEditMenuItens" style="display: none;"><i class="fa fa-edit"></i> Edit Menu Itens</button>
<button class="btn btn-danger showWhenHaveId" id="btnDeleteMenu" style="display: none;"><i class="fa fa-times"></i> Delete Menu</button>
</div>
<hr>
<div id="menuForm">
<input type="hidden" id="menuId">
<div class="form-group">
<label for="menuName">Name:</label>
<input type="text" class="form-control" id="menuName">
</div>
<!--
<div class="col-md-6">
<div class="form-group">
<label for="categories_id">Category:</label>
<select class="form-control" id="categories_id">
<option value="0">All Categories</option>
<?php
foreach ($categories as $key => $value) {
?>
<option value="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="users_groups_id">Group:</label>
<select class="form-control" id="users_groups_id">
<option value="0">All Groups</option>
<?php
foreach ($groups as $key => $value) {
?>
<option value="<?php echo $value['id']; ?>"><?php echo $value['group_name']; ?></option>
<?php
}
?>
</select>
</div>
</div>
-->
<div class="col-md-6">
<div class="form-group">
<label for="menu_order">Order:</label>
<select class="form-control" id="menu_order">
<?php
for ($i = 0; $i < 30; $i++) {
?>
<option value="<?php echo $i; ?>"><?php echo $i; ?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="status">Status:</label>
<select class="form-control" id="status">
<option value="active"><?php echo __('Active'); ?></option>
<option value="inactive"><?php echo __('Inactive'); ?></option>
</select>
</div>
</div>
<!--
<div class="col-md-6">
<div class="form-group">
<label for="position">Position:</label>
<select class="form-control" id="position">
<option value="left"><?php echo __('Left'); ?></option>
<option value="right"><?php echo __('Right'); ?></option>
<option value="center"><?php echo __('Center'); ?></option>
<option value="bottom"><?php echo __('Bottom'); ?></option>
</select>
</div>
</div>
-->
<div class="col-md-6">
<div class="form-group">
<label for="type">Type:</label>
<select class="form-control" id="type">
<option value="1"><?php echo __('Default'); ?></option>
<option value="2"><?php echo __('Left Menu'); ?></option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Icon:</label><br>
<div class="btn-group">
<button data-selected="graduation-cap" type="button" class="icp iconMenu btn btn-light dropdown-toggle iconpicker-component" data-toggle="dropdown">
<?php echo __("Select an icon for the menu"); ?> <i class="fa fa-fw"></i>
<span class="caret"></span>
</button>
<div class="dropdown-menu"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card ">
<div class="card-header">Menus Available</div>
<div class="card-body">
<table id="example" class="display" width="100%" cellspacing="0">
<thead>
<tr>
<th>Name</th>
<th>Status</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Status</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
<div id="menuItems" class="tab-pane fade" >
<div class="col-md-8 showWhenHaveId" style="display: none;">
<div class="panel panel-default">
<div class="panel-heading">Menu Item Form</div>
<div class="panel-body">
<div>
<button class="btn btn-primary" id="btnNewMenuItem"><i class="fa fa-plus"></i> New Menu Item</button>
<button class="btn btn-success" id="btnSaveMenuItem"><i class="fa fa-save"></i> Save Menu Item</button>
</div>
<hr>
<input type="hidden" class="form-control" id="menuItemId">
<div class="form-group">
<label for="title" >Title:</label>
<input type="text" class="form-control" id="title">
</div>
<div class="form-group">
<label for="menuSeoUrlItem">SEO friedly url:</label>
<?=$global['webSiteRootURL'];?>menu/<input type="text" class="form-control" id="menuSeoUrlItem">
</div> <!--
<div class="col-md-6">
<div class="form-group">
<label for="image">Image:</label>
<input type="text" class="form-control" id="image">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="class">class:</label>
<input type="text" class="form-control" id="class">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="style">style:</label>
<input type="text" class="form-control" id="style">
</div>
</div>
-->
<div class="col-md-6">
<div class="form-group">
<label for="item_order">Order:</label>
<select class="form-control" id="item_order">
<?php
for ($i = 0; $i < 30; $i++) {
?>
<option value="<?php echo $i; ?>"><?php echo $i; ?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="item_status">Status:</label>
<select class="form-control" id="item_status">
<option value="active"><?php echo __('Active'); ?></option>
<option value="inactive"><?php echo __('Inactive'); ?></option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="pageType">Type:</label>
<select class="form-control" id="pageType">
<option value="url"><?php echo __('URL'); ?></option>
<option value="page"><?php echo __('Page'); ?></option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Icon:</label><br>
<div class="btn-group">
<button data-selected="graduation-cap" type="button" class="icp iconMenuItem btn btn-light dropdown-toggle iconpicker-component" data-toggle="dropdown">
<?php echo __("Select an icon for the menu"); ?> <i class="fa fa-fw"></i>
<span class="caret"></span>
</button>
<div class="dropdown-menu"></div>
</div>
</div>
</div>
<hr>
<div class="col-md-12">
<div id="divURL" class="divType" style="display: none;">
<div class="form-group">
<label for="url">URL:</label>
<input type="text" class="form-control" id="url">
</div>
</div>
<div id="divText" class="divType" style="display: none;">
<div class="form-group">
<label for="text">text:</label>
<textarea type="text" class="form-control" id="text"></textarea>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4 showWhenHaveId" style="display: none;">
<div class="card">
<div class="card-header">Menu Items Order</div>
<div class="card-body">
<div class="alert alert-warning">Drag and Drop Items to Sort</div>
<ul id="sortable">
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<li class="ui-state-default hidden liModel" itemid="0">
<button class="btn btn-light btn-sm" onclick="editItem(this)">
<i class="fa fa-edit"></i>
</button>
<button class="btn btn-light btn-sm" onclick="removeItem(this)">
<i class="fa fa-trash"></i>
</button>
<i class="icon"></i>
<span>Text</span>
</li>
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
<script type="text/javascript" src="<?php echo $global['webSiteRootURL']; ?>view/css/DataTables/datatables.min.js"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>js/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>js/Croppie/croppie.min.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>js/bootstrap3-wysiwyg/bootstrap3-wysihtml5.all.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>css/fontawesome-iconpicker/dist/js/fontawesome-iconpicker.min.js" type="text/javascript"></script>
<script>
var currentItem = [];
function checkIfHasId(){
menuId = $('#menuId').val();
if(!menuId){
$('#menuItemsTab').addClass('disabled');
$('.showWhenHaveId').fadeOut();
}else{
$('#menuItemsTab').removeClass('disabled');
$('.showWhenHaveId').fadeIn();
}
}
function clearMenuForm() {
$('#menuId').val("");
$('#menuName').val("");
$('#categories_id').val("");
$('#menu_order').val("");
$('#position').val("");
$('#status').val("");
$('#type').val("");
$('#users_groups_id').val("");
clearMenuItemForm();
checkIfHasId();
}
function clearMenuItemForm() {
$('#menuItemId').val("");
$('#title').val("");
$('#image').val("");
$('#url').val("");
$('#class').val("");
$('#style').val("");
$('#item_order').val("");
$('#item_status').val("");
$('#menuSeoUrlItem').val("");
$('iframe').contents().find('.wysihtml5-editor').html('');
}
function startSortable() {
$("#sortable").sortable({
stop: function (event, ui) {
var menu = {};
var itens = [];
menu.id = $('#menuId').val();
$('#sortable li').each(function () {
itens.push($(this).attr('itemId'));
});
menu.itens = itens;
console.log(menu);
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/TopMenu/menuItemSort.json.php',
data: {
"id": menu.id,
"itens": menu.itens
},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
console.log(response);
}
});
}
});
$("#sortable").disableSelection();
}
function loadItems(menu_id) {
clearMenuItemForm();
$('#sortable').sortable("destroy");
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/TopMenu/menuItems.json.php',
data: {
"menuId": menu_id
},
type: 'post',
success: function (response) {
console.log(response);
console.log(response.data.length);
currentItem = response.data;
$('#sortable').empty();
for (i = 0; i < response.data.length; i++) {
li = $('.liModel').clone();
li.removeClass('liModel');
li.removeClass('hidden');
li.find('.icon').addClass(response.data[i].icon);
li.attr('id', 'item' + response.data[i].id);
li.attr('itemid', response.data[i].id);
li.find('span').html(response.data[i].title);
$('#sortable').append(li);
}
startSortable();
}
});
}
function removeItem(t) {
id = $(t).parent('li').attr('itemid');
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/TopMenu/menuItemDelete.json.php',
data: {
"menuItemId": id
},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
console.log(response);
$('#item' + id).fadeOut();
}
});
}
function editItem(t) {
id = $(t).parent('li').attr('itemid');
item = false;
for (i = 0; i < currentItem.length; i++) {
if (currentItem[i].id == id) {
item = currentItem[i];
break;
}
}
loadMenuItemForm(item);
}
function loadMenuItemForm(item) {
clearMenuItemForm();
if (item !== false) {
$('#menuItemId').val(item.id);
$('#title').val(item.title);
$('#image').val(item.image);
$('#url').val(item.url);
$('#class').val(item.class);
$('#style').val(item.style);
$('#item_order').val(item.item_order);
$('#item_status').val(item.status);
$('#text').val(item.text);
$('#menuSeoUrlItem').val(item.menuSeoUrlItem);
$(".iconMenuItem i").attr("class", item.icon);
$('iframe').contents().find('.wysihtml5-editor').html(item.text);
if (item.url.length > 0) {
$('#pageType').val('url');
} else {
$('#pageType').val('page');
}
$('#pageType').trigger('change');
}
}
$(document).ready(function () {
$(".nav-tabs a[data-toggle=tab]").on("click", function (e) {
if ($(this).parent().hasClass("disabled")) {
e.preventDefault();
return false;
}
});
$('#pageType').change(function () {
console.log($(this).val());
if ($(this).val() == 'url') {
$('#divText').slideUp();
$('#divURL').slideDown();
} else {
$('#divText').slideDown();
$('#divURL').slideUp();
}
});
$('#pageType').trigger('change');
$('.iconMenu, .iconMenuItem').iconpicker({});
var table = $('#example').DataTable({
"ajax": "<?php echo $global['webSiteRootURL']; ?>plugin/TopMenu/menus.json.php",
"columns": [
{"data": "menuName"},
{"data": "status"}
],
select: true,
});
$('#btnNewMenu').click(function () {
clearMenuForm();
});
$('#btnNewMenuItem').click(function () {
clearMenuItemForm();
});
$('#text').wysihtml5({toolbar: {
"html": true,
"color": true
}
});
$('#example tbody').on('click', 'tr', function () {
var data = table.row(this).data();
console.log(data);
$('#menuId').val(data.id);
$('#menuName').val(data.menuName);
$('#categories_id').val(data.categories_id);
$('#menu_order').val(data.menu_order);
$('#position').val(data.position);
$('#status').val(data.status);
$('#type').val(data.type);
$('#users_groups_id').val(data.users_groups_id);
$(".iconMenu i").attr("class", data.icon)
checkIfHasId();
loadItems(data.id);
});
startSortable();
$("#sortable").disableSelection();
$('#btnSaveMenu').click(function () {
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/TopMenu/menuSave.json.php',
data: {
"menuId": $('#menuId').val(),
"menuName": $('#menuName').val(),
"categories_id": $('#categories_id').val(),
"menu_order": $('#menu_order').val(),
"position": $('#position').val(),
"status": $('#status').val(),
"type": $('#type').val(),
"users_groups_id": $('#users_groups_id').val(),
"icon": $(".iconMenu i").hasClass("iconpicker-component") ? "" : $(".iconMenu i").attr("class")
},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
console.log(response);
table.ajax.reload();
clearMenuForm();
}
});
});
$('#btnSaveMenuItem').click(function () {
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/TopMenu/menuItemSave.json.php',
data: {
"menuItemId": $('#menuItemId').val(),
"menuId": $('#menuId').val(),
"title": $('#title').val(),
"image": $('#image').val(),
"url": $('#pageType').val() == 'url' ? $('#url').val() : '',
"menuSeoUrlItem": $("#menuSeoUrlItem").val(),
"class": $('#class').val(),
"style": $('#style').val(),
"item_order": $('#item_order').val(),
"item_status": $('#item_status').val(),
"text": $('#pageType').val() == 'page' ? $('#text').val() : '',
"icon": $(".iconMenuItem i").hasClass("iconpicker-component") ? "" : $(".iconMenuItem i").attr("class")
},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
console.log(response);
loadItems($('#menuId').val());
}
});
});
$('#btnDeleteMenu').click(function () {
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/TopMenu/menuDelete.json.php',
data: {
"menuId": $('#menuId').val()
},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
console.log(response);
table.ajax.reload();
clearMenuForm();
}
});
});
$('#btnEditMenuItens').click(function () {
$('#menuItemsTabButton').tab('show');
});
});
</script>
</body>
</html>

View file

@ -0,0 +1 @@
<a href="plugin/TopMenu/page/editor.php" class="btn btn-primary btn-sm"><i class="fa fa-edit"></i> Create Menus</a>

17
plugin/TopMenu/seo.php Normal file
View file

@ -0,0 +1,17 @@
<?php
global $global;
require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'plugin/YouPHPTubePlugin.php';
$topMenu=YouPHPTubePlugin::loadPluginIfEnabled("TopMenu");
if(!$topMenu)
die("404 page not found");
$id=$topMenu->getidBySeoUrl($_GET['$menuSeoUrlItem']);
if(!$id)
die("404 page not found");
$_GET['id']=$id;
require_once $global['systemRootPath'] . 'plugin/TopMenu/index.php';

4
plugin/TopMenu/style.css Normal file
View file

@ -0,0 +1,4 @@
.navbar-form {
margin-right: 0;
margin-left: 0;
}

View file

@ -0,0 +1,157 @@
<?php
require_once dirname(__FILE__) . '/../../../videos/configuration.php';
require_once dirname(__FILE__) . '/../../../objects/bootGrid.php';
require_once dirname(__FILE__) . '/../../../objects/video.php';
require_once dirname(__FILE__) . '/../../../objects/user.php';
class VideosVR360 extends ObjectYPT {
protected $id, $videos_id, $clickAndDrag, $showNotice, $initLat, $initLon, $backToVerticalCenter, $videoType, $active;
protected $intVal = array(
'videos_id',
'clickAndDrag',
'showNotice',
'initLat',
'initLon',
'backToVerticalCenter',
'active'
);
static function getSearchFieldsNames() {
return array();
}
static function getTableName() {
return 'videos_VR360';
}
protected function loadFromVideo($videos_id) {
$row = self::getFromVideoDb($videos_id);
if (empty($row))
return false;
foreach ($row as $key => $value) {
if(in_array($key, $this->intVal)){
$value = intval($value);
}
$this->$key = $value;
}
return true;
}
static protected function getFromVideoDb($videos_id) {
global $global;
$videos_id = intval($videos_id);
$sql = "SELECT * FROM ".static::getTableName()." WHERE videos_id = $videos_id LIMIT 1";
$res = $global['mysqli']->query($sql);
if ($res) {
$row = $res->fetch_assoc();
} else {
$row = false;
}
return $row;
}
static function isVR360Enabled($videos_id){
$vr = new VideosVR360(0);
$vr->loadFromVideo($videos_id);
return !empty($vr->getActive());
}
static function isVR360EnabledByVideoCleanTitle($clean_title){
$video = Video::getVideoFromCleanTitle($clean_title);
return self::isVR360Enabled($video['id']);
}
static function toogleVR360($videos_id){
if(!User::canUpload()){
return false;
}
$vr = new VideosVR360(0);
$vr->loadFromVideo($videos_id);
$vr->setVideos_id($videos_id);
$vr->setActive(intval(!$vr->getActive()));
$vr->save();
return $vr->getActive();
}
static function toogleVR360ByVideoCleanTitle($clean_title){
$video = Video::getVideoFromCleanTitle($clean_title);
return self::toogleVR360($video['id']);
}
function getId() {
return $this->id;
}
function getVideos_id() {
return $this->videos_id;
}
function getClickAndDrag() {
return $this->clickAndDrag;
}
function getShowNotice() {
return $this->showNotice;
}
function getInitLat() {
return $this->initLat;
}
function getInitLon() {
return $this->initLon;
}
function getBackToVerticalCenter() {
return $this->backToVerticalCenter;
}
function getVideoType() {
return $this->videoType;
}
function getActive() {
return $this->active;
}
function setId($id) {
$this->id = $id;
}
function setVideos_id($videos_id) {
$this->videos_id = intval($videos_id);
}
function setClickAndDrag($clickAndDrag) {
$this->clickAndDrag = intval($clickAndDrag);
}
function setShowNotice($showNotice) {
$this->showNotice = intval($showNotice);
}
function setInitLat($initLat) {
$this->initLat = intval($initLat);
}
function setInitLon($initLon) {
$this->initLon = intval($initLon);
}
function setBackToVerticalCenter($backToVerticalCenter) {
$this->backToVerticalCenter = intval($backToVerticalCenter);
}
function setVideoType($videoType) {
$this->videoType = $videoType;
}
function setActive($active) {
$this->active = intval($active);
}
}

95
plugin/VR360/VR360.php Normal file
View file

@ -0,0 +1,95 @@
<?php
global $global;
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
class VR360 extends PluginAbstract {
private $script = 'panorama';
public function getDescription() {
return "Panoramic 360 video player. Project video onto different shapes";
}
public function getName() {
return "VR360";
}
public function getUUID() {
return "ce09988f-e578-4b91-96bb-4b701e5c0884";
}
public function getHTMLMenuRight() {
global $global;
if (empty($_GET['videoName']) || !User::canUpload()) {
return "";
}
$video = Video::getVideoFromCleanTitle($_GET['videoName']);
$videos_id = $video['id'];
$is_enabled = VideosVR360::isVR360Enabled($videos_id);
include $global['systemRootPath'] . 'plugin/VR360/view/menuRight.php';
}
public function getHeadCode() {
return $this->getHeadPanorama();
}
public function getFooterCode() {
return $this->getFooterPanorama();
}
private function getHeadPanorama() {
global $global;
require_once $global['systemRootPath'] . 'plugin/VR360/Objects/VideosVR360.php';
if (empty($_GET['videoName']) || !VideosVR360::isVR360EnabledByVideoCleanTitle($_GET['videoName'])) {
return "";
}
$css = '<link href="' . $global['webSiteRootURL'] . 'plugin/VR360/videojs-panorama/videojs-panorama.css" rel="stylesheet" type="text/css"/>';
$css .= '<style></style>';
return $css;
}
private function getFooterPanorama() {
global $global;
require_once $global['systemRootPath'] . 'plugin/VR360/Objects/VideosVR360.php';
if (empty($_GET['videoName']) || !VideosVR360::isVR360EnabledByVideoCleanTitle($_GET['videoName'])) {
return "";
}
$js = '<script src="' . $global['webSiteRootURL'] . 'plugin/VR360/videojs-panorama/videojs-panorama.v5.js" type="text/javascript"></script>';
$js .= '<script src="' . $global['webSiteRootURL'] . 'plugin/VR360/videojs-panorama/three.min.js" type="text/javascript"></script>';
$js .= '<script>
(function(window, videojs) {
var player = window.player = videojs(\'mainVideo\', {}, function () {
window.addEventListener("resize", function () {
var canvas = player.getChild(\'Canvas\');
if(canvas) canvas.handleResize();
});
});
var videoElement = document.getElementById("mainVideo");
var width = videoElement.offsetWidth;
var height = videoElement.offsetHeight;
player.width(width), player.height(height);
player.panorama({
clickToToggle: (!isMobile()),
autoMobileOrientation: true,
initFov: 100,
VREnable: isMobile(),
NoticeMessage: (isMobile())? "please drag and drop the video" : "please use your mouse drag and drop the video",
callback: function () {
if(!isMobile()) player.play();
}
});
player.on("VRModeOn", function(){
if(!player.isFullscreen())
player.controlBar.fullscreenToggle.trigger("tap");
});
}(window, window.videojs));</script>';
return $js;
}
public function getTags() {
return array('free');
}
}

View file

@ -0,0 +1,24 @@
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';
CREATE TABLE IF NOT EXISTS `videos_VR360` (
`id` INT NOT NULL AUTO_INCREMENT,
`videos_id` INT NOT NULL,
`clickAndDrag` TINYINT(1) NULL,
`showNotice` TINYINT(1) NULL,
`initLat` INT NULL DEFAULT 0,
`initLon` INT NULL DEFAULT -180,
`backToVerticalCenter` TINYINT(1) NULL,
`videoType` VARCHAR(45) NULL DEFAULT 'equirectangular',
`active` TINYINT(1) NULL DEFAULT 1,
`created` DATETIME NULL,
`modified` DATETIME NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `videos_id_UNIQUE` (`videos_id` ASC))
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

View file

@ -0,0 +1,4 @@
<?php
require_once '../../videos/configuration.php';
require_once $global['systemRootPath'] . 'plugin/VR360/Objects/VideosVR360.php';
VideosVR360::toogleVR360($_POST['videos_id']);

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,113 @@
/**
* Created by yanwsh on 4/3/16.
*/
.IIV::-webkit-media-controls-play-button,
.IIV::-webkit-media-controls-start-playback-button {
opacity: 0;
pointer-events: none;
width: 5px; }
@font-face {
font-family: "VideoJS-Panorama";
src: url("data:application/font-woff;base64,d09GRgABAAAAAAU8AAsAAAAABPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABCAAAAGAAAABgDxIFgGNtYXAAAAFoAAAAVAAAAFQXVtKIZ2FzcAAAAbwAAAAIAAAACAAAABBnbHlmAAABxAAAASwAAAEsI6gHfmhlYWQAAALwAAAANgAAADYKxyD1aGhlYQAAAygAAAAkAAAAJAexA8dobXR4AAADTAAAABgAAAAYDgAAUWxvY2EAAANkAAAADgAAAA4AvgCMbWF4cAAAA3QAAAAgAAAAIAAKAD9uYW1lAAADlAAAAYYAAAGGmUoJ+3Bvc3QAAAUcAAAAIAAAACAAAwAAAAMDVQGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAA6QEDwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADgAAAAKAAgAAgACAAEAIOkB//3//wAAAAAAIOkA//3//wAB/+MXBAADAAEAAAAAAAAAAAAAAAEAAf//AA8AAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAwARAHID7wL8ACIALwA8AAABJiQMAQcOARQWFx4DMzcwNjMyFjEXMj4CNz4CJicxASImNTQ2MzIWFRQGIyEiJjU0NjMyFhUUBiMD7wv+zv6X/tAICAkJCAM6XntFKi47PzkjRHpcOAMHCgEICv0FPVZWPT1WVzwCEj1WVj09VlY9AvwKCQEKCAnD5sMIAwUDAnFrgloCBAQDB8LmxAr+Q1Y9PVZWPT1WVj09VlY9PVYAAAAAAQBA/8AC+gPAAA0AAAU+AS4BBxUJARU2HgECAvorJjirqP6AAYDJ40ZPQE22mmUE/gGAAYD4BZzs/u0AAQAAAAAAADT5+xNfDzz1AAsEAAAAAADT3O48AAAAANPc7jwAAP/AA+8DwAAAAAgAAgAAAAAAAAABAAADwP/AAAAEAAAAAAAD7wABAAAAAAAAAAAAAAAAAAAABgQAAAAAAAAAAAAAAAIAAAAEAAARBAAAQAAAAAAACgAUAB4AeACWAAAAAQAAAAYAPQADAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGljb21vb24AaQBjAG8AbQBvAG8AblZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGljb21vb24AaQBjAG8AbQBvAG8Abmljb21vb24AaQBjAG8AbQBvAG8AblJlZ3VsYXIAUgBlAGcAdQBsAGEAcmljb21vb24AaQBjAG8AbQBvAG8AbkZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=") format("woff"), url("data:;base64,AAEAAAALAIAAAwAwT1MvMg8SBYAAAAC8AAAAYGNtYXAXVtKIAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5ZiOoB34AAAF4AAABLGhlYWQKxyD1AAACpAAAADZoaGVhB7EDxwAAAtwAAAAkaG10eA4AAFEAAAMAAAAAGGxvY2EAvgCMAAADGAAAAA5tYXhwAAoAPwAAAygAAAAgbmFtZZlKCfsAAANIAAABhnBvc3QAAwAAAAAE0AAAACAAAwNVAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpAQPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6QH//f//AAAAAAAg6QD//f//AAH/4xcEAAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAADABEAcgPvAvwAIgAvADwAAAEmJAwBBw4BFBYXHgMzNzA2MzIWMRcyPgI3PgImJzEBIiY1NDYzMhYVFAYjISImNTQ2MzIWFRQGIwPvC/7O/pf+0AgICQkIAzpee0UqLjs/OSNEelw4AwcKAQgK/QU9VlY9PVZXPAISPVZWPT1WVj0C/AoJAQoICcPmwwgDBQMCcWuCWgIEBAMHwubECv5DVj09VlY9PVZWPT1WVj09VgAAAAABAED/wAL6A8AADQAABT4BLgEHFQkBFTYeAQIC+ismOKuo/oABgMnjRk9ATbaaZQT+AYABgPgFnOz+7QABAAAAAAAANPn7E18PPPUACwQAAAAAANPc7jwAAAAA09zuPAAA/8AD7wPAAAAACAACAAAAAAAAAAEAAAPA/8AAAAQAAAAAAAPvAAEAAAAAAAAAAAAAAAAAAAAGBAAAAAAAAAAAAAAAAgAAAAQAABEEAABAAAAAAAAKABQAHgB4AJYAAAABAAAABgA9AAMAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEABwAAAAEAAAAAAAIABwBgAAEAAAAAAAMABwA2AAEAAAAAAAQABwB1AAEAAAAAAAUACwAVAAEAAAAAAAYABwBLAAEAAAAAAAoAGgCKAAMAAQQJAAEADgAHAAMAAQQJAAIADgBnAAMAAQQJAAMADgA9AAMAAQQJAAQADgB8AAMAAQQJAAUAFgAgAAMAAQQJAAYADgBSAAMAAQQJAAoANACkaWNvbW9vbgBpAGMAbwBtAG8AbwBuVmVyc2lvbiAxLjAAVgBlAHIAcwBpAG8AbgAgADEALgAwaWNvbW9vbgBpAGMAbwBtAG8AbwBuaWNvbW9vbgBpAGMAbwBtAG8AbwBuUmVndWxhcgBSAGUAZwB1AGwAYQByaWNvbW9vbgBpAGMAbwBtAG8AbwBuRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==") format("truetype");
font-weight: normal;
font-style: normal; }
.vjs-full-window .video-js {
position: fixed !important;
top: 0 !important;
left: 0 !important;
z-index: 1000000; }
.video-js .vjs-control-bar {
z-index: 5; }
.video-js .vjs-control-bar .vjs-VR-control {
cursor: pointer; }
.video-js .vjs-control-bar .vjs-VR-control::before {
font-family: "VideoJS-Panorama";
content: "\e900"; }
.video-js .vjs-control-bar .vjs-VR-control.enable::before {
content: "\e901"; }
.video-js.vjs-using-native-controls .vjs-poster, .video-js.vjs-using-native-controls .vjs-big-play-button {
display: block; }
.video-js.vjs-panorama {
display: block; }
.video-js.vjs-panorama .vjs-video-canvas {
position: absolute;
top: 0;
left: 50%;
-webkit-transform: translateX(-50%) translateZ(0);
-moz-transform: translateX(-50%) translateZ(0);
-o-transform: translateX(-50%) translateZ(0);
transform: translateX(-50%) translateZ(0);
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
background: #000;
cursor: pointer; }
.video-js.vjs-panorama .vjs-video-notice-label {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
font-size: 1.3em;
font-size: 1vw;
padding: 0.5em 1em;
background: rgba(0, 0, 0, 0.8);
color: #FFF;
-webkit-border-radius: 0.5em;
-moz-border-radius: 0.5em;
border-radius: 0.5em;
-webkit-transition: opacity 0.3s linear;
-moz-transition: opacity 0.3s linear;
-ms-transition: opacity 0.3s linear;
-o-transition: opacity 0.3s linear;
transition: opacity 0.3s linear;
pointer-events: none; }
.video-js.vjs-panorama .vjs-video-notice-label.vjs-video-notice-fadeOut {
opacity: 0; }
.video-js.vjs-panorama #webgl-error-message {
position: relative;
font-family: monospace;
font-size: 13px;
font-weight: normal;
text-align: center;
color: black;
padding: 1.5em;
width: 400px;
margin: 5em auto 0px;
background: white;
-webkit-transition: opacity 0.3s linear;
-moz-transition: opacity 0.3s linear;
-ms-transition: opacity 0.3s linear;
-o-transition: opacity 0.3s linear;
transition: opacity 0.3s linear; }
.video-js.vjs-panorama #webgl-error-message.vjs-video-notice-fadeOut {
opacity: 0; }
.video-js.vjs-panorama .vjs-loading-spinner {
z-index: 10; }
.video-js.vjs-panorama.vjs-panorama-mobile-inline-video.vjs-seeking .vjs-loading-spinner {
display: none; }
.video-js.vjs-panorama.vjs-panorama-mobile-inline-video.vjs-waiting .vjs-loading-spinner {
display: block !important; }
.video-js.vjs-panorama.vjs-panorama-mobile-inline-video-buffering .vjs-loading-spinner {
display: block !important; }
.video-js.vjs-panorama.vjs-panorama-mobile-inline-video-buffering .vjs-loading-spinner:before,
.video-js.vjs-panorama.vjs-panorama-mobile-inline-video-buffering .vjs-loading-spinner:after {
-webkit-animation: vjs-spinner-spin 1.1s cubic-bezier(0.6, 0.2, 0, 0.8) infinite, vjs-spinner-fade 1.1s linear infinite;
animation: vjs-spinner-spin 1.1s cubic-bezier(0.6, 0.2, 0, 0.8) infinite, vjs-spinner-fade 1.1s linear infinite; }
.video-js.vjs-panorama.vjs-panorama-mobile-inline-video-buffering .vjs-loading-spinner:before,
.video-js.vjs-panorama.vjs-panorama-mobile-inline-video-buffering .vjs-loading-spinner:before {
border-top-color: white; }
.video-js.vjs-panorama.vjs-panorama-mobile-inline-video-buffering .vjs-loading-spinner:after,
.video-js.vjs-panorama.vjs-panorama-mobile-inline-video-buffering .vjs-loading-spinner:after {
border-top-color: white;
-webkit-animation-delay: 0.44s;
animation-delay: 0.44s; }

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,25 @@
<li>
<div class="material-switch navbar-text" style="width: 120px;">
<i class="fa fa-cube"></i> VR360 &nbsp;&nbsp;
<input id="vr360" type="checkbox" value="0" <?php if($is_enabled){ ?> checked="checked" <?php } ?>/>
<label for="vr360" class="badge-success"></label>
</div>
</li>
<script>
$('#vr360').change(function () {
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/VR360/toogleVR360.php',
method: 'POST',
data: {
'videos_id': <?php echo $videos_id; ?>,
'vr360': $(this).is(":checked")
},
success: function (response) {
console.log(response);
modal.hidePleaseWait();
}
});
return false;
});
</script>

View file

@ -0,0 +1,83 @@
<?php
global $global;
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
class VideoLogoOverlay extends PluginAbstract {
public function getDescription() {
return "Put an Logo overlay on video";
}
public function getName() {
return "VideoLogoOverlay";
}
public function getUUID() {
return "0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b";
}
public function getEmptyDataObject() {
$obj = new stdClass();
$obj->url = "";
$obj->position = "";
$obj->opacity = 50;
$obj->position_options = array('center', 'top', 'bottom', 'top left', 'bottom left', 'top right', 'bottom right');
return $obj;
}
public function getPluginMenu() {
global $global;
$filename = $global['systemRootPath'] . 'plugin/VideoLogoOverlay/pluginMenu.html';
return file_get_contents($filename);
}
static function getStyle() {
$obj = YouPHPTubePlugin::getObjectData("VideoLogoOverlay");
"position: absolute; top: 0; left: 0; opacity: 0.5; filter: alpha(opacity=50);";
$opacity = "opacity: " . ($obj->opacity / 100) . "; filter: alpha(opacity={$obj->opacity});";
$position = "position: absolute; top: 0; left: 0; ";
switch ($obj->position) {
case "center":
$position = "position: absolute; top: 50%; left: 50%; margin-left: -125px; margin-top: -35px; ";
break;
case "top":
$position = "position: absolute; top: 0; left: 50%; margin-left: -125px; ";
break;
case "bottom":
$position = "position: absolute; bottom: 0; left: 50%; margin-left: -125px; ";
break;
case "top left":
$position = "position: absolute; top: 0; left: 0; ";
break;
case "bottom left":
$position = "position: absolute; bottom: 0; left: 0; ";
break;
case "top right":
$position = "position: absolute; top: 0; right: 0; ";
break;
case "bottom right":
$position = "position: absolute; bottom: 0; right: 0; ";
break;
}
return $position.$opacity;
}
static function getLink() {
$obj = YouPHPTubePlugin::getObjectData("VideoLogoOverlay");
if(!empty($obj->url)){
$url = $obj->url;
}else{
$url = "#";
}
return $url;
}
public function getTags() {
return array('free');
}
}

View file

@ -0,0 +1,179 @@
<?php
require_once '../../../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not manager plugin add logo"));
exit;
}
$o = YouPHPTubePlugin::getObjectData("VideoLogoOverlay");
?>
<!DOCTYPE html>
<html lang="<?php echo $_SESSION['language']; ?>">
<head>
<title><?php echo $config->getWebSiteTitle(); ?> :: Customize</title>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
?>
<link href="<?php echo $global['webSiteRootURL']; ?>js/Croppie/croppie.css" rel="stylesheet" type="text/css"/>
<script src="<?php echo $global['webSiteRootURL']; ?>js/Croppie/croppie.min.js" type="text/javascript"></script>
</head>
<body>
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container">
<h1>Create an Video Overlay Button</h1>
<div class="row">
<div class="col-md-12 ">
<div id="croppieLogo"></div>
<a id="logo-btn" class="btn btn-light btn-sm btn-block"><?php echo __("Upload a logo"); ?></a>
<input type="file" id="logo" value="Choose a Logo" accept="image/*" style="display: none;" />
</div>
</div>
<hr>
<div class="row">
<div class="col-md-12 ">
<div class="form-group">
<div class="col-md-2 text-right">
<label for="position"><?php echo __("Position"); ?>:</label>
</div>
<div class="col-md-10 ">
<select class="form-control" id="position">
<?php
foreach ($o->position_options as $value) {
echo "<option ".($value==$o->position?"selected='selected'":"").">{$value}</option>";
}
?>
</select>
</div>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-12 ">
<div class="form-group">
<div class="col-md-2 text-right">
<label for="url"><?php echo __("URL"); ?>:</label>
</div>
<div class="col-md-10 ">
<input type="url" id="url" class="form-control" value="<?php echo $o->url; ?>">
</div>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-12 ">
<div class="form-group">
<div class="col-md-2 text-right">
<label for="opacity"><?php echo __("Opacity"); ?>:</label>
</div>
<div class="col-md-10 ">
<input type="number" id="opacity" class="form-control" value="<?php echo $o->opacity; ?>">
</div>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-12 text-center">
<button class="btn btn-success" id="save"><i class="fa fa-save"></i> Save</button>
</div>
</div>
</div>
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
<script>
var logoCrop;
function readFile(input, c) {
console.log("read file");
if ($(input)[0].files && $(input)[0].files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
c.croppie('bind', {
url: e.target.result
}).then(function () {
console.log('jQuery bind complete');
});
}
reader.readAsDataURL($(input)[0].files[0]);
} else {
swal("Sorry - you're browser doesn't support the FileReader API");
}
}
var logoImgBase64;
$(document).ready(function () {
// start croppie logo
$('#logo').on('change', function () {
readFile(this, logoCrop);
});
$('#logo-btn').on('click', function (ev) {
$('#logo').trigger("click");
});
$('#logo-result-btn').on('click', function (ev) {
logoCrop.croppie('result', {
type: 'canvas',
size: 'viewport'
}).then(function (resp) {
});
});
logoCrop = $('#croppieLogo').croppie({
url: '<?php echo $global['webSiteRootURL']; ?>videos/logoOverlay.png',
enableExif: true,
enforceBoundary: false,
mouseWheelZoom: false,
viewport: {
width: 250,
height: 70
},
boundary: {
width: 300,
height: 120
}
});
setTimeout(function () {
logoCrop.croppie('setZoom', 1);
}, 1000);
// END croppie logo
$('#save').click(function (evt) {
modal.showPleaseWait();
logoCrop.croppie('result', {
type: 'canvas',
size: 'viewport'
}).then(function (resp) {
logoImgBase64 = resp;
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/VideoLogoOverlay/page/editorSave.php',
data: {
"logoImgBase64": logoImgBase64,
"position": $('#position').val(),
"opacity": $('#opacity').val(),
"url": $('#url').val()
},
type: 'post',
success: function (response) {
if (response.saved) {
swal("<?php echo __("Congratulations!"); ?>", "<?php echo __("Your configurations has been updated!"); ?>", "success");
} else {
swal("<?php echo __("Sorry!"); ?>", "<?php echo __("Your configurations has NOT been updated!"); ?>", "error");
}
modal.hidePleaseWait();
}
});
});
});
});
</script>
</body>
</html>

View file

@ -0,0 +1,32 @@
<?php
require_once '../../../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/plugin.php';
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not manager plugin logo overlay"));
exit;
}
header('Content-Type: application/json');
require_once $global['systemRootPath'] . 'plugin/VideoLogoOverlay/VideoLogoOverlay.php';
$plugin = new VideoLogoOverlay();
$obj = new stdClass();
$o = $plugin->getDataObject();
$o->position = $_POST['position'];
$o->opacity = $_POST['opacity'];
$o->url = $_POST['url'];
$fileData = base64DataToImage($_POST['logoImgBase64']);
$fileName = 'logoOverlay.png';
$photoPath = $global['systemRootPath'] . '/videos/' . $fileName;
$obj->bytes = file_put_contents($photoPath, $fileData);
$p = new Plugin(0);
$p->loadFromUUID($plugin->getUUID());
$p->setObject_data(json_encode($o));
$obj->saved = $p->save();
echo json_encode($obj);
?>

View file

@ -0,0 +1 @@
<a href="plugin/VideoLogoOverlay/page/editor.php" class="btn btn-primary btn-sm"><i class="fa fa-edit"></i> Edit Logo</a>