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 searches 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 secure.php to protect this file and the whole CMS!
  2. if(!defined("SEC_FILE")){define("SEC_FILE",'/framework/secure.php' );}
  3. if (defined('LEPTON_PATH')) {
  4. include LEPTON_PATH.SEC_FILE;
  5. } else {
  6. $oneback = "../";
  7. $root = $oneback;
  8. $level = 1;
  9. while (($level < 10) && (!file_exists($root.SEC_FILE))) {
  10. $root .= $oneback;
  11. $level += 1;
  12. }
  13. if (file_exists($root.SEC_FILE)) {
  14. include $root.SEC_FILE;
  15. } else {
  16. trigger_error(sprintf("[ <b>%s</b> ] Can't include secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR);
  17. }
  18. }
  19. // end include secure.php
last edit: 18. May 2023 CEST 13:25:26

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 to be automatically loaded
via LEPTON_autoloader, for example semantic (for standard LEPTON template) or news (for news module)

last edit: 09. Aug 2023 CEST 11:31:10