mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
* allow comments inside plugin json file
* updated German translation (by German native speaker)
This commit is contained in:
parent
f29758939c
commit
5aa1ae003e
@ -6,13 +6,21 @@
|
||||
"contact": "nobody@example.org",
|
||||
"require": {
|
||||
"myaac": "0.4.3",
|
||||
"php": "5.2.0"
|
||||
"myaac_": ">=0.7,<1.0", // support for defining versions like in composer (since 0.8.0)
|
||||
"php": "5.2.0",
|
||||
"php_": ">5.4,<7.0", // support for defining versions like in composer (since 0.8.0)
|
||||
"database": "21"
|
||||
},
|
||||
"install": "plugins/example/install.php",
|
||||
"uninstall": [
|
||||
"plugins/example.json",
|
||||
"plugins/example/install.php",
|
||||
"plugins/example/before.php"
|
||||
"plugins/example-directory",
|
||||
"templates/other-directory"
|
||||
/***
|
||||
this is example of multi line comment
|
||||
1. list example
|
||||
2. something
|
||||
****/
|
||||
],
|
||||
"hooks": {
|
||||
"Example Hook": {
|
||||
|
@ -29,7 +29,7 @@ if(Plugins::install($path_to_file)) {
|
||||
echo 'WARNING: ' . $warning;
|
||||
}
|
||||
|
||||
$info = Plugins::getPluginInfo();
|
||||
$info = Plugins::getPlugin();
|
||||
echo (isset($info['name']) ? $info['name'] . ' p' : 'P') . 'lugin has been successfully installed.';
|
||||
}
|
||||
else
|
||||
|
@ -41,7 +41,7 @@ spl_autoload_register(function ($class) {
|
||||
class Plugins {
|
||||
private static $warnings = array();
|
||||
private static $error = null;
|
||||
private static $pluginInfo = array();
|
||||
private static $plugin = array();
|
||||
|
||||
public static function install($file) {
|
||||
global $db, $cache;
|
||||
@ -67,8 +67,9 @@ class Plugins {
|
||||
}
|
||||
else {
|
||||
$string = file_get_contents($file_name);
|
||||
$string = Plugins::removeComments($string);
|
||||
$plugin = json_decode($string, true);
|
||||
self::$pluginInfo = $plugin;
|
||||
self::$plugin = $plugin;
|
||||
if ($plugin == null) {
|
||||
self::$warnings[] = 'Cannot load ' . $file_name . '. File might be not a valid json code.';
|
||||
}
|
||||
@ -221,6 +222,7 @@ class Plugins {
|
||||
}
|
||||
else {
|
||||
$string = file_get_contents($filename);
|
||||
$string = self::removeComments($string);
|
||||
$plugin_info = json_decode($string, true);
|
||||
if($plugin_info == false) {
|
||||
self::$error = 'Cannot load plugin info ' . $plugin_name . '.json';
|
||||
@ -298,7 +300,23 @@ class Plugins {
|
||||
return self::$error;
|
||||
}
|
||||
|
||||
public static function getPluginInfo() {
|
||||
return self::$pluginInfo;
|
||||
public static function getPlugin() {
|
||||
return self::$plugin;
|
||||
}
|
||||
|
||||
public static function removeComments($string) {
|
||||
$string = preg_replace('!/\*.*?\*/!s', '', $string);
|
||||
$string = preg_replace('/\n\s*\n/', "\n", $string);
|
||||
// Removes multi-line comments and does not create
|
||||
// a blank line, also treats white spaces/tabs
|
||||
$string = preg_replace('!^[ \t]*/\*.*?\*/[ \t]*[\r\n]!s', '', $string);
|
||||
|
||||
// Removes single line '//' comments, treats blank characters
|
||||
$string = preg_replace('![ \t]*//.*[ \t]*[\r\n]!', '', $string);
|
||||
|
||||
// Strip blank lines
|
||||
$string = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $string);
|
||||
|
||||
return $string;
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@ $locale['off'] = 'Aus';
|
||||
$locale['loaded'] = 'Geladen';
|
||||
$locale['not_loaded'] = 'Nicht geladen';
|
||||
|
||||
$locale['please_fill_all'] = 'Bitte alle Felder ausfüllen!';
|
||||
$locale['please_fill_all'] = 'Bitte füllen Sie alle Felder aus!';
|
||||
$locale['already_installed'] = 'MyAAC wurde bereits installiert. Bitte löschen <b>install/<b/> Verzeichnis.';
|
||||
|
||||
// welcome
|
||||
@ -41,7 +41,7 @@ $locale['step_requirements_extension'] = '$EXTENSION$ PHP Erweiterung';
|
||||
$locale['step_config'] = 'Konfiguration';
|
||||
$locale['step_config_title'] = 'Grundkonfiguration';
|
||||
$locale['step_config_server_path'] = 'Serverpfad';
|
||||
$locale['step_config_server_path_desc'] = 'Pfad zu Ihrem TFS-Hauptverzeichnis, in dem Sie sich config.lua befinden.';
|
||||
$locale['step_config_server_path_desc'] = 'Pfad zu Ihrem TFS-Hauptverzeichnis, in dem sich die config.lua befinden.';
|
||||
$locale['step_config_mail_admin'] = 'Admin E-Mail';
|
||||
$locale['step_config_mail_admin_desc'] = 'Adresse, an die E-Mails aus dem Kontaktformular gesendet werden, z. B. admin@gmail.com';
|
||||
$locale['step_config_mail_admin_error'] = 'Admin E-Mail ist nicht korrekt.';
|
||||
@ -63,7 +63,7 @@ $locale['step_database'] = 'Schema importieren';
|
||||
$locale['step_database_title'] = 'MySQL schema importieren';
|
||||
$locale['step_database_importing'] = 'Ihre Datenbank ist MySQL. Schema wird jetzt importiert...';
|
||||
$locale['step_database_error_path'] = 'Bitte geben Sie den Serverpfad an.';
|
||||
$locale['step_database_error_config'] = 'Datei config.lua kann nicht gefunden werden. Ist der Serverpfad korrekt? Geh zurück und überprüfe noch einmal.';
|
||||
$locale['step_database_error_config'] = 'Datei config.lua kann nicht gefunden werden. Ist der Serverpfad korrekt? Gehen Sie zurück und überprüfen Sie noch einmal.';
|
||||
$locale['step_database_error_database_empty'] = 'Der Datenbanktyp kann nicht aus config.lua ermittelt werden. Ihr OTS wird von diesem AAC nicht unterstützt.';
|
||||
$locale['step_database_error_only_mysql'] = 'Dieser AAC unterstützt nur MySQL. Aus Ihrer Konfigurationsdatei scheint Ihr OTS die Datenbank $DATABASE_TYPE$ zu verwenden. Bitte ändern Sie Ihre Datenbank in MySQL und folgen Sie dann der Installation erneut.';
|
||||
$locale['step_database_error_table'] = 'Die Tabelle $TABLE$ existiert nicht. Bitte importieren Sie zuerst Ihr OTS-Datenbankschema.';
|
||||
@ -71,15 +71,15 @@ $locale['step_database_error_table_exist'] = 'Die Tabelle $TABLE$ existiert bere
|
||||
$locale['step_database_error_schema'] = 'Fehler beim Importieren des Schemas:';
|
||||
$locale['step_database_success_schema'] = '$PREFIX$ Tabellen wurden erfolgreich installiert.';
|
||||
$locale['step_database_error_file'] = '$FILE$ konnte nicht geöffnet werden. Bitte kopieren Sie diesen Inhalt und fügen Sie ihn dort ein:';
|
||||
$locale['step_database_adding_field'] = 'Feld hinzufügen';
|
||||
$locale['step_database_modifying_field'] = 'Ändern Feld';
|
||||
$locale['step_database_changing_field'] = 'Ändern $FIELD$ zu $FIELD_NEW$...';
|
||||
$locale['step_database_imported_players'] = 'Importierte Spielerproben...';
|
||||
$locale['step_database_loaded_monsters'] = 'Geladen Monsters...';
|
||||
$locale['step_database_adding_field'] = 'Folgendes Feld wurde hinzugefügt: ';
|
||||
$locale['step_database_modifying_field'] = 'Folgendes Feld wurde geändert: ';
|
||||
$locale['step_database_changing_field'] = 'Änderung von $FIELD$ zu $FIELD_NEW$...';
|
||||
$locale['step_database_imported_players'] = 'Spielerproben wurden importiert...';
|
||||
$locale['step_database_loaded_monsters'] = 'Monster wurden geladen...';
|
||||
$locale['step_database_error_monsters'] = 'Beim Laden der Datei monsters.xml sind einige Probleme aufgetreten. Bitte überprüfen Sie $LOG$ für weitere Informationen.';
|
||||
$locale['step_database_loaded_spells'] = 'Geladen Zauber...';
|
||||
$locale['step_database_created_account'] = 'Administratorkonto erstellt...';
|
||||
$locale['step_database_created_news'] = 'Erstellt newses...';
|
||||
$locale['step_database_loaded_spells'] = 'Zauber wurden geladen...';
|
||||
$locale['step_database_created_account'] = 'Administratorkonto wurde erstellt...';
|
||||
$locale['step_database_created_news'] = 'Neuigkeiten wurden erstellt...';
|
||||
|
||||
// admin account
|
||||
$locale['step_admin'] = 'Administratorkonto';
|
||||
@ -88,21 +88,21 @@ $locale['step_admin_account'] = 'Name des Administratorkontos';
|
||||
$locale['step_admin_account_desc'] = 'Name Ihres Admin-Accounts, der für die Anmeldung an der Website und dem Server verwendet wird.';
|
||||
$locale['step_admin_account_error_format'] = 'Ungültiges Kontonamensformat. Verwenden Sie nur a-Z und Ziffern 0-9. Mindestens 3, maximal 32 Zeichen.';
|
||||
$locale['step_admin_account_error_same'] = 'Das Passwort darf nicht mit dem Kontonamen übereinstimmen.';
|
||||
$locale['step_admin_account_id'] = 'Administratorkontonummer';
|
||||
$locale['step_admin_account_id'] = 'Administrator Kontonummer';
|
||||
$locale['step_admin_account_id_desc'] = 'Nummer Ihres Admin-Accounts, der für die Anmeldung bei der Website und dem Server verwendet wird.';
|
||||
$locale['step_admin_account_id_error_format'] = 'Ungültiges Kontonummernformat. Bitte benutzen Sie nur die Nummern 0-9. Mindestens 6, maximal 10 Zeichen.';
|
||||
$locale['step_admin_account_id_error_same'] = 'Das Passwort darf nicht mit dem Kontonummer übereinstimmen';
|
||||
$locale['step_admin_password'] = 'Administratorkontokennwort';
|
||||
$locale['step_admin_account_id_error_same'] = 'Das Passwort darf nicht mit der Kontonummer übereinstimmen';
|
||||
$locale['step_admin_password'] = 'Administrator Konto Passwort';
|
||||
$locale['step_admin_password_desc'] = 'Passwort für Ihr Administratorkonto.';
|
||||
$locale['step_admin_password_error_empty'] = 'Bitte geben Sie das Passwort für Ihr neues Konto ein.';
|
||||
$locale['step_admin_password_error_format'] = 'Ungültiges Passwortformat. Verwenden Sie nur a-Z und Ziffern 0-9. Mindestens 8, maximal 30 Zeichen.';
|
||||
|
||||
// finish
|
||||
$locale['step_finish_admin_panel'] = 'Admin-Panel';
|
||||
$locale['step_finish_homepage'] = 'Homepage';
|
||||
$locale['step_finish'] = 'Finish';
|
||||
$locale['step_finish_admin_panel'] = 'Admin Bereich';
|
||||
$locale['step_finish_homepage'] = 'Startseite';
|
||||
$locale['step_finish'] = 'Fertig';
|
||||
$locale['step_finish_title'] = 'Installation beendet!';
|
||||
$locale['step_finish_desc'] = 'Herzliche Glückwünsche! <b>MyAAC</b> ist bereit zu verwenden!<br/>Sie können sich jetzt im $ADMIN_PANEL$ anmelden, oder die $HOMEPAGE$ besuchen.<br/><br/>
|
||||
$locale['step_finish_desc'] = 'Herzlichen Glückwunsch! <b>MyAAC</b> ist bereit zu verwenden!<br/>Sie können sich jetzt im $ADMIN_PANEL$ anmelden, oder die $HOMEPAGE$ besuchen.<br/><br/>
|
||||
<font color="red">Bitte lösche install/ Verzeichnis.</font><br/><br/>
|
||||
Sende Fehler und Vorschläge bei $LINK$, danke!';
|
||||
Bitte senden Sie Fehler und Vorschläge zu $LINK$, Vielen Dank!';
|
||||
?>
|
||||
|
@ -74,12 +74,12 @@ $locale['step_database_error_file'] = '$FILE$ couldn\'t be opened. Please copy t
|
||||
$locale['step_database_adding_field'] = 'Adding field';
|
||||
$locale['step_database_modifying_field'] = 'Modifying field';
|
||||
$locale['step_database_changing_field'] = 'Changing $FIELD$ to $FIELD_NEW$...';
|
||||
$locale['step_database_imported_players'] = 'Imported player samples...';
|
||||
$locale['step_database_loaded_monsters'] = 'Loaded monsters...';
|
||||
$locale['step_database_imported_players'] = 'Player samples has been imported...';
|
||||
$locale['step_database_loaded_monsters'] = 'Monsters has been loaded...';
|
||||
$locale['step_database_error_monsters'] = 'There were some problems loading your monsters.xml file. Please check $LOG$ for more info.';
|
||||
$locale['step_database_loaded_spells'] = 'Loaded spells...';
|
||||
$locale['step_database_loaded_spells'] = 'Spells has been loaded...';
|
||||
$locale['step_database_created_account'] = 'Created admin account...';
|
||||
$locale['step_database_created_news'] = 'Created newses...';
|
||||
$locale['step_database_created_news'] = 'Newses has been created...';
|
||||
|
||||
// admin account
|
||||
$locale['step_admin'] = 'Admin Account';
|
||||
|
@ -74,7 +74,7 @@ else if(isset($_FILES["plugin"]["name"]))
|
||||
warning($warning);
|
||||
}
|
||||
|
||||
$info = Plugins::getPluginInfo();
|
||||
$info = Plugins::getPlugin();
|
||||
success((isset($info['name']) ? '<strong>' . $info['name'] . '</strong> p' : 'P') . 'lugin has been successfully installed.');
|
||||
}
|
||||
else {
|
||||
@ -101,6 +101,7 @@ $plugins = array();
|
||||
foreach(get_plugins() as $plugin)
|
||||
{
|
||||
$string = file_get_contents(BASE . 'plugins/' . $plugin . '.json');
|
||||
$string = Plugins::removeComments($string);
|
||||
$plugin_info = json_decode($string, true);
|
||||
if($plugin_info == false) {
|
||||
warning('Cannot load plugin info ' . $plugin . '.json');
|
||||
|
Loading…
x
Reference in New Issue
Block a user