coding_standards.rst 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. ****************
  2. Coding Standards
  3. ****************
  4. **General**
  5. ------------
  6. class, method, function and variable names
  7. * intuitive
  8. * lower case
  9. * words separated with an underscore
  10. * do not abbreviate the words unless it makes the name excessively long.
  11. * indentation use tabs instead of spaces
  12. * recommended to code with editor showing invisible characters to prevent trailing spaces and tabs.
  13. **Applications**
  14. -----------------
  15. Apps are stored in fusionpbx/app directory.
  16. **root.php**
  17. * Ensures the document_root server variable is set and then sets the include path from the root of the website.
  18. **app_config.php**
  19. **application**
  20. * app_name
  21. * app_uuid
  22. * app_category
  23. * app_subcategory
  24. * app_description
  25. **Menu**
  26. * defines location in the menu.
  27. **Permissions**
  28. * Defines the permissions the application uses and the default groups assigned to those permissions.
  29. **Data Schema**
  30. * Define the structure of the field names, and types.
  31. **app_defaults.php**
  32. * Is run during the install and when upgrade schema is called.
  33. **app_languages.php**
  34. * Defines a php array of the words, phrases and sentences used in the project.
  35. **Files**
  36. * Names
  37. * Written in lower case.
  38. * Words are seperated by an underscore.
  39. * Use full words when possible.
  40. * Do not prefix with 'v_' files that are currently prefix in this way will be renamed to remove the 'v_'.
  41. * Program showing invisible spaces.
  42. * To eliminate tabs and spaces at the end of a line.
  43. * Line feed only.
  44. * No carriage return and line feed.
  45. **Database**
  46. * tables
  47. * Prefixed with v_ this may be configurable in the future.
  48. * Tables names are plural unless the name is used is an Acronym.
  49. * Use full words not abbreviations.
  50. * uuids used for relational id instead of auto increment identifiers.
  51. * fields
  52. * domain_uuid
  53. * Primary key name is the non plural name of table without the v_ prefix.
  54. * How to create the primary key name
  55. * If the table name is v_users take remove the 'v_', make it non-plural and add '_uuid' to the end of the field name. In this example the primary key would be user_uuid
  56. Code Documentation
  57. http://www.phpdoc.org/