mirror of
https://github.com/slawkens/myaac.git
synced 2025-05-07 14:49:21 +02:00
Add Sections + Add setting($key) function
Reorganisation
This commit is contained in:
parent
96068d003b
commit
084e191b28
@ -7,6 +7,5 @@
|
|||||||
"contact": "nobody@example.org",
|
"contact": "nobody@example.org",
|
||||||
"require": {
|
"require": {
|
||||||
"myaac": "0.9.0"
|
"myaac": "0.9.0"
|
||||||
},
|
}
|
||||||
"settings": "plugins/example-settings-plugin/settings.php"
|
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,10 @@ return [
|
|||||||
you can use this outfit generator: http://sleqqus.idl.pl/tlg<br/>
|
you can use this outfit generator: http://sleqqus.idl.pl/tlg<br/>
|
||||||
Format: head,body,legs,feet",
|
Format: head,body,legs,feet",
|
||||||
],
|
],
|
||||||
|
'section_1' => [
|
||||||
|
'type' => 'section',
|
||||||
|
'title' => 'Section Test',
|
||||||
|
],
|
||||||
'just_testing_boolean' => [
|
'just_testing_boolean' => [
|
||||||
'name' => 'Just Testing Boolean',
|
'name' => 'Just Testing Boolean',
|
||||||
'type' => 'boolean',
|
'type' => 'boolean',
|
||||||
|
@ -1100,6 +1100,12 @@ function configLua($key) {
|
|||||||
return @$config['lua'][$key];
|
return @$config['lua'][$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setting($key)
|
||||||
|
{
|
||||||
|
$settings = Settings::getInstance();
|
||||||
|
return $settings[$key];
|
||||||
|
}
|
||||||
|
|
||||||
function clearCache()
|
function clearCache()
|
||||||
{
|
{
|
||||||
require_once LIBS . 'news.php';
|
require_once LIBS . 'news.php';
|
||||||
|
@ -102,20 +102,6 @@ class Plugins {
|
|||||||
return $hooks;
|
return $hooks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getPluginSettings($pluginName)
|
|
||||||
{
|
|
||||||
$plugin_json = self::getPluginJson($pluginName);
|
|
||||||
if (!$plugin_json) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($plugin_json['settings']) || !file_exists(BASE . $plugin_json['settings'])) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $plugin_json['settings'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getPluginJson($name = null)
|
public static function getPluginJson($name = null)
|
||||||
{
|
{
|
||||||
if(!isset($name)) {
|
if(!isset($name)) {
|
||||||
|
@ -19,18 +19,22 @@ if (!isset($_GET['plugin']) || empty($_GET['plugin'])) {
|
|||||||
$plugin = $_GET['plugin'];
|
$plugin = $_GET['plugin'];
|
||||||
|
|
||||||
if($plugin != 'core') {
|
if($plugin != 'core') {
|
||||||
$pluginSettings = Plugins::getPluginSettings($plugin);
|
$settingsFilePath = PLUGINS . $plugin . '/settings.php';
|
||||||
if (!$pluginSettings) {
|
}
|
||||||
error('This plugin does not exist or does not have options defined.');
|
else {
|
||||||
return;
|
$settingsFilePath = SYSTEM . 'settings.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!file_exists($settingsFilePath)) {
|
||||||
|
error('This plugin does not exist or does not have settings defined.');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($plugin === 'core') {
|
if($plugin === 'core') {
|
||||||
$settingsFile = require SYSTEM . 'settings.php';
|
$settingsFile = require $settingsFilePath;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$settingsFile = require BASE . $pluginSettings;
|
$settingsFile = require $settingsFilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_array($settingsFile)) {
|
if (!is_array($settingsFile)) {
|
||||||
@ -75,22 +79,32 @@ if($query->rowCount() > 0) {
|
|||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<button name="save" type="submit" class="btn btn-primary">Save</button>
|
<button name="save" type="submit" class="btn btn-primary">Save</button>
|
||||||
</div>
|
</div>
|
||||||
<table class="table table-bordered table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th style="width: 10%">Name</th>
|
|
||||||
<th style="width: 30%">Value</th>
|
|
||||||
<th>Description</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$checkbox = function ($key, $type, $value) {
|
$checkbox = function ($key, $type, $value) {
|
||||||
echo '<label><input type="radio" id="' . $key . '" name="settings[' . $key . ']" value="' . ($type ? 'true' : 'false') . '" ' . ($value === $type ? 'checked' : '') . '/>' . ($type ? 'Yes' : 'No') . '</label> ';
|
echo '<label><input type="radio" id="' . $key . '" name="settings[' . $key . ']" value="' . ($type ? 'true' : 'false') . '" ' . ($value === $type ? 'checked' : '') . '/>' . ($type ? 'Yes' : 'No') . '</label> ';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
foreach($settingsFile as $key => $setting) {
|
foreach($settingsFile as $key => $setting) {
|
||||||
|
if($setting['type'] === 'section') {
|
||||||
|
if($i++ !== 0) {
|
||||||
|
echo '</tbody></table>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<h2 style="text-align: center"><strong><?= $setting['title']; ?></strong></h2>
|
||||||
|
<table class="table table-bordered table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 10%">Name</th>
|
||||||
|
<th style="width: 30%">Value</th>
|
||||||
|
<th>Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
continue;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><label for="<?= $key ?>" class="control-label"><?= $setting['name'] ?></label></td>
|
<td><label for="<?= $key ?>" class="control-label"><?= $setting['name'] ?></label></td>
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
'section_1' => [
|
||||||
|
'type' => 'section',
|
||||||
|
'title' => 'Template'
|
||||||
|
],
|
||||||
'template' => [
|
'template' => [
|
||||||
'name' => 'Template Name',
|
'name' => 'Template Name',
|
||||||
'type' => 'options',
|
'type' => 'options',
|
||||||
@ -14,6 +18,10 @@ return [
|
|||||||
'desc' => 'Allow changing template of the website by showing a special select in the part of website',
|
'desc' => 'Allow changing template of the website by showing a special select in the part of website',
|
||||||
'default' => true,
|
'default' => true,
|
||||||
],
|
],
|
||||||
|
'section_2' => [
|
||||||
|
'type' => 'section',
|
||||||
|
'title' => 'Misc'
|
||||||
|
],
|
||||||
'vocations_amount' => [
|
'vocations_amount' => [
|
||||||
'name' => 'Amount of Vocations',
|
'name' => 'Amount of Vocations',
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
@ -48,6 +56,10 @@ allows using gesior templates and pages with myaac<br/>
|
|||||||
might bring some performance when disabled',
|
might bring some performance when disabled',
|
||||||
'default' => true,
|
'default' => true,
|
||||||
],
|
],
|
||||||
|
'section_3' => [
|
||||||
|
'type' => 'section',
|
||||||
|
'title' => 'Meta Site Settings'
|
||||||
|
],
|
||||||
'charset' => [
|
'charset' => [
|
||||||
'name' => 'Meta Charset',
|
'name' => 'Meta Charset',
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
@ -85,6 +97,10 @@ might bring some performance when disabled',
|
|||||||
'default' => false,
|
'default' => false,
|
||||||
'desc' => 'default language (currently only English available)'
|
'desc' => 'default language (currently only English available)'
|
||||||
],*/
|
],*/
|
||||||
|
'section_4' => [
|
||||||
|
'type' => 'section',
|
||||||
|
'title' => 'Visitors Counter & Views Counter'
|
||||||
|
],
|
||||||
'visitors_counter' => [
|
'visitors_counter' => [
|
||||||
'name' => 'Visitors Counter',
|
'name' => 'Visitors Counter',
|
||||||
'type' => 'boolean',
|
'type' => 'boolean',
|
||||||
@ -103,6 +119,10 @@ might bring some performance when disabled',
|
|||||||
'desc' => 'Enable Views Counter? It will show how many times the website has been viewed by users',
|
'desc' => 'Enable Views Counter? It will show how many times the website has been viewed by users',
|
||||||
'default' => true,
|
'default' => true,
|
||||||
],
|
],
|
||||||
|
'section_5' => [
|
||||||
|
'type' => 'section',
|
||||||
|
'title' => 'Images URL'
|
||||||
|
],
|
||||||
'outfit_images_url' => [
|
'outfit_images_url' => [
|
||||||
'name' => 'Outfit Images URL',
|
'name' => 'Outfit Images URL',
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user