1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-06 03:50:04 +02:00

Minor code style patch.

This commit is contained in:
Caleb Mazalevskis 2019-12-23 21:02:31 +08:00
parent 8108fc1e68
commit 172fa35b49
No known key found for this signature in database
GPG key ID: 082E6BC1046FAB95
15 changed files with 72 additions and 79 deletions

View file

@ -1,4 +1,3 @@
<?php <?php
include './customize_settings_native.php'; include './customize_settings_native.php';
include './customize_settings_plugin.php'; include './customize_settings_plugin.php';
?>

View file

@ -1,7 +1,7 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
global $global, $config; global $global, $config;
if(!isset($global['systemRootPath'])){ if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php'; require_once '../videos/configuration.php';
} }
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';

View file

@ -1,8 +1,8 @@
<?php <?php
function createTable($pluginName, $filter = array()){ function createTable($pluginName, $filter = array()) {
$plugin = AVideoPlugin::getObjectData($pluginName); $plugin = AVideoPlugin::getObjectData($pluginName);
if(empty($filter)){ if (empty($filter)) {
foreach ($plugin as $keyJson => $valueJson) { foreach ($plugin as $keyJson => $valueJson) {
$filter[$keyJson] = "&nbsp;"; $filter[$keyJson] = "&nbsp;";
} }
@ -15,8 +15,8 @@ function createTable($pluginName, $filter = array()){
$pluginsList = array(); $pluginsList = array();
if (!AVideoPlugin::exists($pluginName)) { if (!AVideoPlugin::exists($pluginName)) {
echo "<tr><td colspan='2'> Sorry you do not have the plugin </td></tr>"; echo "<tr><td colspan='2'> Sorry you do not have the plugin </td></tr>";
}else{ } else {
if(!empty($plugin)){ if (!empty($plugin)) {
$form = jsonToFormElements($plugin,$filter); $form = jsonToFormElements($plugin,$filter);
//var_dump($form); //var_dump($form);
echo implode("", $form); echo implode("", $form);
@ -63,9 +63,9 @@ function jsonToFormElements($json, $filter = array()) {
} }
function getPluginSwitch($pluginName) { function getPluginSwitch($pluginName) {
if(!AVideoPlugin::exists($pluginName)){ if (!AVideoPlugin::exists($pluginName)) {
$input = '<a href="https://www.avideo.com/plugins/" class="btn btn-danger btn-sm btn-xs">Buy this plugin now</a>'; $input = '<a href="https://www.avideo.com/plugins/" class="btn btn-danger btn-sm btn-xs">Buy this plugin now</a>';
}else{ } else {
$plugin = AVideoPlugin::loadPluginIfEnabled($pluginName); $plugin = AVideoPlugin::loadPluginIfEnabled($pluginName);
$pluginForced = AVideoPlugin::loadPlugin($pluginName); $pluginForced = AVideoPlugin::loadPlugin($pluginName);
$id = uniqid(); $id = uniqid();

View file

@ -324,6 +324,3 @@ switch ($_GET['page']) {
</script> </script>
</body> </body>
</html> </html>

View file

@ -1,5 +1,4 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
global $global, $config; global $global, $config;
if (!isset($global['systemRootPath'])) { if (!isset($global['systemRootPath'])) {
@ -30,9 +29,9 @@ $pluginDB = Plugin::getPluginByName($pluginName);
foreach ($pluginDO as $key => $value) { foreach ($pluginDO as $key => $value) {
if (isset($pluginValues[$key])) { if (isset($pluginValues[$key])) {
if(is_bool($pluginDO->$key)){ if (is_bool($pluginDO->$key)) {
$pluginDO->$key = empty($pluginValues[$key])?false:true; $pluginDO->$key = empty($pluginValues[$key])?false:true;
}else{ } else {
//$pluginDO->$key = str_replace('"', '\\"', $pluginValues[$key]); //$pluginDO->$key = str_replace('"', '\\"', $pluginValues[$key]);
$pluginDO->$key = $pluginValues[$key]; $pluginDO->$key = $pluginValues[$key];
} }
@ -44,6 +43,6 @@ $p->setObject_data(json_encode($pluginDO));
$obj = new stdClass(); $obj = new stdClass();
$obj->save = $p->save(); $obj->save = $p->save();
if($obj->save === false) error_log("[ERROR] Error saving plugin $pluginName data. Maybe plugin is not enabled?"); if ($obj->save === false) error_log("[ERROR] Error saving plugin $pluginName data. Maybe plugin is not enabled?");
echo (json_encode($obj)); echo (json_encode($obj));

View file

@ -1,7 +1,7 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
global $global, $config; global $global, $config;
if(!isset($global['systemRootPath'])){ if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php'; require_once '../videos/configuration.php';
} }
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';

View file

@ -1,9 +1,8 @@
<?php <?php
if (isset($_GET['getLanguage'])) {
if(isset($_GET['getLanguage'])) {
$lngFile = './'.strtolower(str_replace(['.', '/', '\\'], '', $_GET['getLanguage'])).'.php'; $lngFile = './'.strtolower(str_replace(['.', '/', '\\'], '', $_GET['getLanguage'])).'.php';
if(!file_exists($lngFile)) { if (!file_exists($lngFile)) {
header('HTTP/1.0 404 Not Found'); header('HTTP/1.0 404 Not Found');
exit; exit;
} }
@ -90,7 +89,7 @@ sort($vars);
console.log("Found existing translation!"); console.log("Found existing translation!");
var arrayOfLines = $('#originalWords').val().split('\n'); var arrayOfLines = $('#originalWords').val().split('\n');
$.each(arrayOfLines, function(index, item) { $.each(arrayOfLines, function(index, item) {
if(data.hasOwnProperty(item)) { if (data.hasOwnProperty(item)) {
$('#translatedCode').append(data[item]+'\n'); $('#translatedCode').append(data[item]+'\n');
} else { } else {
$('#translatedCode').append('\n'); $('#translatedCode').append('\n');

View file

@ -1,5 +1,4 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if (empty($global['systemRootPath'])) { if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = "../";
@ -22,7 +21,7 @@ if (!is_writable($dir)) {
} }
$file = $dir.strtolower($_POST['flag']).".php"; $file = $dir.strtolower($_POST['flag']).".php";
$myfile = fopen($file, "w") or die("Unable to open file!"); $myfile = fopen($file, "w") or die("Unable to open file!");
if(!$myfile){ if (!$myfile) {
$obj->status = 0; $obj->status = 0;
$obj->error = __("Unable to open file!"); $obj->error = __("Unable to open file!");
die(json_encode($obj)); die(json_encode($obj));