feel free to keep it strictly simple...

LEPTON Coding Styles

We periodicaly check our code with the tool from Sonarcloud to decrease number of bugs and security spots.

Naturally there are some internal conventions that may differ from Sonarcloud's standards.

Please see below the differences for LEPTON for our own standard. There are very good reasons to have sometimes our own defaults for example the LEPTON_autoloader dearches for own classes (core and addons).

File Header

You have to include following code in every single php file to protect the whole cms and probably your custom addons.

  1. // include class.secure.php to protect this file and the whole CMS!
  2. $file = '/framework/class.secure.php';
  3. if (defined('LEPTON_PATH')) {
  4. include LEPTON_PATH.$file;
  5. } else {
  6. $oneback = "../";
  7. $root = $oneback;
  8. $level = 1;
  9. while (($level < 10) && (!file_exists($root.$file))) {
  10. $root .= $oneback;
  11. $level += 1;
  12. }
  13. if (file_exists($root.$file)) {
  14. include $root.$file;
  15. } else {
  16. trigger_error(sprintf("[ %s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR);
  17. }
  18. }
  19. // end include class.secure.php
last edit: 08. Jul 2021 CEST 16:10:56

Default Class Names

In LEPTON we got following internal standards: 1. LEPTON core classes are named LEPTON + _classname, for example LEPTON_admin 2. Addon classes are named like the template or module itself, for example semantic (for standard LEPTON template) or news (for news module)

last edit: 08. Jul 2021 CEST 16:11:25