Clone this wiki locally
We currently use the PSR-1 style for formatting. Or try to.
- Use spaces (4+ preferred) instead of tabs for indentation.
- Avoid working on imgboard.php, except when needed (such as loading a class).
- This was a huge change to improve clarity and modifications, we don't need to go back to a 3000 line file.
- Do most of your heavy lifting from a class, and use preexisting ones when possible.
- If you need help with this feel free to ask.
- Intended usage of
" "for strings.
- PHP treats single- and double-quotes differently.
- Double-quotes evaluate variables in strings:
- Single-quotes do not and you don't have to escape double-quotes:
'That's what "she" said.\r\n'
- Use single-quotes as much as possible. A majority of the old code was escaped double-quotes wrapped in double-quotes without using variable evaluation.
That's literally it so far.
- [version number] - Brief description of major changes
Things that will get rejected:
- Excessive amount of modifications done to imgboard.php.
- There may be a valid reason for it but it could probably also still work if relocated.
- Classes replicating functionality of others. Extend when possible. Examples:
- thread/thread.php to generate entire thread HTML, which uses:
- thread/post.php to generate individual post HTML.
require*statements that don't respect the config's directory settings.
- Especially CORE_DIR.
- This is to ease future multi-board installations.
Contributing is too difficult!
It's really not.
It may seem arbitrary at first but by abiding to these conditions it improves code readability and modifications for everyone, not just the person who made it.
While the current structure may not be the most optimized, over time it can only get better.
General coding principles
Avoid a God object (old saguaro)
- Generally avoiding imgboard.php and effectively utilizing classes is enough.
Don't Repeat Yourself (DRY)
- Loops, loops using classes, loops. So many loops. Also accessible classes. And loops.