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+ ```
1920class 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+ ```
2730function abc($x, $y) {
2831 if($condition == true) {
2932 $x = 2;
3033 }
3134}
35+ ```
3236and NOT
37+ ```
3338function abc ($x, $y) {
3439 if ( $condition == true ) {
3540
3641 }
3742}
43+ ```
3844
39- //*****************************************************************************
40- // Commenting style
41- //*****************************************************************************
45+ # Commenting style
4246
4347The 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+ ```
5459If you need to block out a section then use
60+ ```
5561/*
5662function redundant_code(){
5763 something here
5864}
5965*/
60-
66+ ```
6167To block out single lines use // and all // are assumed to be redundant test code and NOT comments
6268
6369// print_r($foo);
6470
6571Do 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- >>
7378function login($user, $pass){
7479
7580}
76- <<
81+ ```
7782as this function is self-explaining, the following clean code will suffice
78- > >
83+ ```
7984function 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
9093The 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
9295gets 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
97102where modulename corresponds to the config section in the system.ini.master file.
98103To make the settings editable under System > interface config, add the new configuration
99104fields to the file interface/web/admin/form/system_config.tform.php and the corresponding
100105tempalte file in the templates subfolder of the admin module.
101106
102- -- Server settings
107+ ## Server settings
103108
104109Server settings are stored in the ini style server config system (see server.ini.master template file)
105110The settings file gets stored inside the ispconfig database in the server table. Settings can be
106111accessed with the function $app->getconf->get_server_config(....)
107112
108113Example 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
117121There are form validators in interface/lib/classes/tform.inc.php to make validating forms easier.
118122Read about: REGEX,UNIQUE,NOTEMPTY,ISEMAIL,ISINT,ISPOSITIVE,ISIPV4,CUSTOM
119-
0 commit comments