# Coding Conventions **Analysis Date:** 2026-05-05 ## Naming Patterns **PHP Class Files:** - Pattern: `class.ClassName.php` (PascalCase class name) - Examples: `class.Articles.php`, `class.Authors.php`, `class.Users.php` - Namespace mirrors directory path: `autoload/admin/factory/class.Articles.php` → `namespace admin\factory;` **PHP Functions & Variables:** - Functions: `snake_case` exclusively (`duplicate_article()`, `gallery_order_save()`, `article_save()`) - Variables: `snake_case` (`$article_id`, `$image_id`, `$output_file`, `$file_type`) - Class properties: `snake_case` (`$this->article['languages']`) **CSS/HTML:** - CSS classes: `kebab-case` (`.sidebar-menu`, `.menu-left`, `.google-title`) - No BEM methodology — flat class names with some nesting **SCSS Variables:** - Colors: `$c` prefix + PascalCase (`$cWhite`, `$cBlack`, `$cGrayDarkBg`, `$cYellow`) - Fonts: `$f` prefix (`$font1`, `$font2`, `$font3`, `$fLeagueSpartan`) - Defined in: `layout/style-scss/_variables.scss` **JavaScript:** - Variables: camelCase - Functions: camelCase - jQuery patterns throughout: `$(document).ready()`, `$('body').on(event, selector, handler)` **Templates:** - PHP templates: `kebab-case` in directory/feature structure - Examples: `article-edit.php`, `articles-browse-list.php`, `page-contact-v5.php` **Database Tables:** - Prefix: `pp_` on all tables - Pattern: `pp_[module]` and `pp_[module]_[subresource]` - Examples: `pp_articles`, `pp_articles_langs`, `pp_articles_images` ## Code Style **PHP:** - Indentation: 2 spaces - Braces: opening brace on same line as control structure/function - Spaces: around operators (`=`, `==`, `!=`), within array parentheses - PHP tags: short tags `` used in templates (not `` tags in templates - No import/require (no module bundler) - Load order defined in `admin/templates/site/main-layout.php` ## Function Design **PHP Factory methods:** - Static methods named after the operation: `article_save()`, `article_delete()` - No return type declarations - Return: Medoo result (array), `true`/`false`, or void **AJAX Handlers:** - `$_POST` / `$_GET` retrieved via `\S::get()` at top of handler - JSON response at end: `echo json_encode($output)` and `die()` --- *Convention analysis: 2026-05-05* *Update when patterns change*