1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 14:46:56 +02:00

Improved example

Cameron
2020-05-25 11:50:40 -07:00
parent 097745d4ee
commit 5392e05498

@@ -60,17 +60,28 @@ Where numeric values represent a particular status, define a constant for that v
## Classes, Methods and Functions.
Class names must must use **lowercase** and use an **underscore** (_) if necessary. The corresponding file should use the same name and casing. Example: **login_shortcodes.php**
```
class login_shortcodes extends e_shortcode
{
}
```
Class names must must use **lowercase** and use an **underscore** (_) if necessary. The corresponding file should use the same name and casing.
Method/Function names should use **camelCase** unless they are shortcodes (eg. _sc_news_image()_) or methods within **e_admin_form_ui** in which case they should use **lowercase** to match the database field name.
Example: **myplugin_shortcodes.php**
```
class myplugin_shortcodes extends e_shortcode
{
public function sc_myplugin_field($parm=null)
{
$value = $this->myCustomFunction();
return $value;
}
private function myCustomFunction()
{
// ....
}
}
```
Routines are to be documented at both file and function level using phpDoc syntax. Where appropriate create supplementary pages of general documentation, and document individual variables.
When passing more than three or so parameters to a function, consider passing some of them in an array (especially convenient if many are optional) or if within a class, consider using vars.