OBServer Coding Standards

From Open Broadcaster
Jump to: navigation, search

OB Server (Clientside)­

HTML/CSS

- Tag names should be lowercase

- IDs and Classes should be lowercase_with_underscores.

- For indentation, use 2 space characters instead of Tabs

- Keep things clean and themeable, avoid internal stylesheets and inline styles.


JavaScript

- For indentation, use 2 space characters instead of Tabs


JavaScript Naming Conventions

- Class names should use CamelCase / CapsWords. i.e., ClassName. Core classes go in OB object. Modules should create their own object to use (i.e., OBModuleName).

- Variables/properties should use lowercase_with_underscore.

- Methods/functions should use lowerCamelCase.

- CONSTANTS should use UPPERCASE_WITH_UNDERSCORES.

OB Server (Serverside)

The following is the style guide for the server­side (PHP) code in the OpenBroadcaster Server web application.

General Notes

- For indentation, use 2 space characters instead of Tabs

- Model methods should be invoked via the model object, rather than the method directly. For example, to call the "get_shows" in the "schedule" model, you should use:

$schedule_model('get_shows',$param1,$param2);

This is required to allow modules to hook into model code.

- Unless it makes things terribly ugly, controllers should not call other controllers. Put reusable code into models.


Naming Conventions

- Class names should use CapsWords. i.e., ClassName

- Variables, functions, and methods should use lowercase_with_underscore.

- CONSTANTS should use UPPERCASE_WITH_UNDERSCORES.