diff --git a/SourceGithub/SourceGithub.php b/SourceGithub/SourceGithub.php
index 0eed048..c77145e 100755
--- a/SourceGithub/SourceGithub.php
+++ b/SourceGithub/SourceGithub.php
@@ -10,6 +10,9 @@
require_once( config_get( 'core_path' ) . 'json_api.php' );
class SourceGithubPlugin extends MantisSourcePlugin {
+
+ const ERROR_INVALID_PRIMARY_BRANCH = 'invalid_branch';
+
public function register() {
$this->name = plugin_lang_get( 'title' );
$this->description = plugin_lang_get( 'description' );
@@ -25,6 +28,16 @@
$this->url = 'http://noswap.com';
}
+ public function errors() {
+ $t_errors_list = array(
+ self::ERROR_INVALID_PRIMARY_BRANCH,
+ );
+ foreach( $t_errors_list as $t_error ) {
+ $t_errors[$t_error] = plugin_lang_get( 'error_' . $t_error );
+ }
+ return $t_errors;
+ }
+
public $type = 'github';
public function show_type() {
@@ -159,8 +172,7 @@
$f_master_branch = gpc_get_string( 'master_branch' );
if ( !preg_match( '/\*|^[a-zA-Z0-9_\., -]*$/', $f_master_branch ) ) {
- echo 'Invalid parameter: \'Primary Branch\'';
- trigger_error( ERROR_GENERIC, ERROR );
+ plugin_error( self::ERROR_INVALID_PRIMARY_BRANCH );
}
$p_repo->info['hub_username'] = $f_hub_username;
diff --git a/SourceGithub/lang/strings_english.txt b/SourceGithub/lang/strings_english.txt
index 3437143..c37aa28 100644
--- a/SourceGithub/lang/strings_english.txt
+++ b/SourceGithub/lang/strings_english.txt
@@ -24,3 +24,5 @@
$s_plugin_SourceGithub_oauth_authorization = 'GitHub OAuth Authorization';
$s_plugin_SourceGithub_back_repo = 'Back to Repository';
+
+$s_plugin_SourceGithub_error_invalid_branch = 'Invalid character in Primary Branch';
diff --git a/SourceGithub/lang/strings_german.txt b/SourceGithub/lang/strings_german.txt
index c63261d..24267a4 100644
--- a/SourceGithub/lang/strings_german.txt
+++ b/SourceGithub/lang/strings_german.txt
@@ -11,3 +11,5 @@
$s_plugin_SourceGithub_hub_username = 'GitHub Benutzername';
$s_plugin_SourceGithub_hub_reponame = 'GitHub Projektarchiv
(Klein Leerzeichen)';
$s_plugin_SourceGithub_master_branch = 'Hauptzweige
(kommaseparierte Liste)';
+
+$s_plugin_SourceGithub_error_invalid_branch = 'Ungültige Zeichen in der Hauptzweige';
diff --git a/SourceGitlab/SourceGitlab.php b/SourceGitlab/SourceGitlab.php
index 4666076..0a3e662 100644
--- a/SourceGitlab/SourceGitlab.php
+++ b/SourceGitlab/SourceGitlab.php
@@ -12,6 +12,9 @@
require_once( config_get( 'core_path' ) . 'json_api.php' );
class SourceGitlabPlugin extends MantisSourcePlugin {
+
+ const ERROR_INVALID_PRIMARY_BRANCH = 'invalid_branch';
+
public function register() {
$this->name = plugin_lang_get( 'title' );
$this->description = plugin_lang_get( 'description' );
@@ -27,6 +30,16 @@
$this->url = 'http://www.mobilexag.de';
}
+ public function errors() {
+ $t_errors_list = array(
+ self::ERROR_INVALID_PRIMARY_BRANCH,
+ );
+ foreach( $t_errors_list as $t_error ) {
+ $t_errors[$t_error] = plugin_lang_get( 'error_' . $t_error );
+ }
+ return $t_errors;
+ }
+
public $type = 'gitlab';
public function show_type() {
@@ -159,8 +172,7 @@
$f_master_branch = gpc_get_string( 'master_branch' );
if ( !preg_match( '/\*|^[a-zA-Z0-9_\., -]*$/', $f_master_branch ) ) {
- echo 'Invalid parameter: \'Primary Branch\'';
- trigger_error( ERROR_GENERIC, ERROR );
+ plugin_error( self::ERROR_INVALID_PRIMARY_BRANCH );
}
$p_repo->info['hub_root'] = $f_hub_root;
diff --git a/SourceGitlab/lang/strings_english.txt b/SourceGitlab/lang/strings_english.txt
index 6b1ea90..faa0222 100644
--- a/SourceGitlab/lang/strings_english.txt
+++ b/SourceGitlab/lang/strings_english.txt
@@ -16,3 +16,5 @@
$s_plugin_SourceGitlab_master_branch = 'Primary Branches
(comma-separated list or *)';
$s_plugin_SourceGitlab_back_repo = 'Back to Repository';
+
+$s_plugin_SourceGitlab_error_invalid_branch = 'Invalid character in Primary Branch';
diff --git a/SourceGitlab/lang/strings_german.txt b/SourceGitlab/lang/strings_german.txt
index c381479..e4dbb86 100644
--- a/SourceGitlab/lang/strings_german.txt
+++ b/SourceGitlab/lang/strings_german.txt
@@ -12,6 +12,8 @@
$s_plugin_SourceGitlab_hub_repoid = 'GitLab Repository ID
wird über Repo Name automatisch ermittelt falls leer';
$s_plugin_SourceGitlab_hub_reponame = 'GitLab Repository Name
Ohne Namespace Slash am Anfang oder Ende (namespace/project)';
$s_plugin_SourceGitlab_hub_app_secret = 'GitLab API Key
API Schlüssel für den Mantis Benutzer (continuous Benutzer)';
-$s_plugin_SourceGitlab_master_branch = 'Hauptbranches
(Komma-separierte Liste oder *)';
+$s_plugin_SourceGitlab_master_branch = 'Hauptzweige
(Komma-separierte Liste oder *)';
$s_plugin_SourceGitlab_back_repo = 'Zurück zum Repository';
+
+$s_plugin_SourceGitlab_error_invalid_branch = 'Ungültige Zeichen in der Hauptzweige';