Skip to content

Commit 59f3ca6

Browse files
author
Marius Burkard
committed
Merge branch 'stable-3.1'
2 parents fb41e21 + da7597f commit 59f3ca6

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

CONTRIBUTING.md

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,36 @@
1616
* please mark any section that need review or work on with /* TODO: short description */
1717
* Make function / var names on the following way, first word lower, next word(s) first letter upper like. getFirstResult();
1818
* always a space but NO newline before opening braces, e. g.
19+
```
1920
class abc {
2021
public function cde() {
2122
if($a == $b) {
2223
return false;
2324
}
2425
}
2526
}
27+
```
2628
* no spaces after function/method or control names, e. g.
29+
```
2730
function abc($x, $y) {
2831
if($condition == true) {
2932
$x = 2;
3033
}
3134
}
35+
```
3236
and NOT
37+
```
3338
function abc ($x, $y) {
3439
if ( $condition == true ) {
3540
3641
}
3742
}
43+
```
3844

39-
//*****************************************************************************
40-
// Commenting style
41-
//*****************************************************************************
45+
# Commenting style
4246

4347
The comments break down into the following types
48+
```
4449
// is uses for removing lines and debug dev etc
4550
/*
4651
is used to comment out blocks
@@ -50,70 +55,68 @@ The comments break down into the following types
5055
* thats over
5156
* lines
5257
*/
53-
58+
```
5459
If you need to block out a section then use
60+
```
5561
/*
5662
function redundant_code(){
5763
something here
5864
}
5965
*/
60-
66+
```
6167
To block out single lines use // and all // are assumed to be redundant test code and NOT comments
6268

6369
// print_r($foo);
6470

6571
Do not use the phpdoc on every function, eg
66-
72+
```
6773
/**
6874
* Login a user
6975
* @param string user username
7076
* @param string password of user
7177
*/
72-
>>
7378
function login($user, $pass){
7479
7580
}
76-
<<
81+
```
7782
as this function is self-explaining, the following clean code will suffice
78-
>>
83+
```
7984
function login($user, $pass){
8085
8186
}
87+
```
8288

89+
# Where to store custom settings
8390

84-
//*****************************************************************************
85-
// Where to store custom settings
86-
//*****************************************************************************
87-
88-
-- Interface settings
91+
## Interface settings
8992

9093
The recommended place to store global interface settings is the ini style global config system
9194
(see system.ini.master file in install/tpl/ to set defaults). The settings file
9295
gets stored inside the ispconfig database. Settings can be accessed with the function:
9396

97+
```
9498
$app->uses('ini_parser,getconf');
9599
$interface_settings = $app->getconf->get_global_config('modulename');
100+
```
96101

97102
where modulename corresponds to the config section in the system.ini.master file.
98103
To make the settings editable under System > interface config, add the new configuration
99104
fields to the file interface/web/admin/form/system_config.tform.php and the corresponding
100105
tempalte file in the templates subfolder of the admin module.
101106

102-
-- Server settings
107+
## Server settings
103108

104109
Server settings are stored in the ini style server config system (see server.ini.master template file)
105110
The settings file gets stored inside the ispconfig database in the server table. Settings can be
106111
accessed with the function $app->getconf->get_server_config(....)
107112

108113
Example to access the web configuration:
109114

115+
```
110116
$app->uses('ini_parser,getconf');
111117
$web_config = $app->getconf->get_server_config($server_id,'web');
118+
```
112119

113-
114-
//*****************************************************************************
115-
// Learn about the form validators
116-
//*****************************************************************************
120+
# Learn about the form validators
117121
There are form validators in interface/lib/classes/tform.inc.php to make validating forms easier.
118122
Read about: REGEX,UNIQUE,NOTEMPTY,ISEMAIL,ISINT,ISPOSITIVE,ISIPV4,CUSTOM
119-

0 commit comments

Comments
 (0)