Coding style

Broadly, StatusNet code follows the PEAR project's coding style guidelines: http://pear.php.net/manual/en/standards.php

Quick sample
timezone) { return $user->timezone; }   }

return common_config('site', 'timezone'); }

PHP code tags
 tag at the end of source files, due to the likelihood of trouble caused by extra whitespace at the end. Too many spaces or newlines following a closing tag can lead to hard-to-diagnose problems with missing HTTP headers and invalid XML output, which can be notoriously hard to track down.

Function definitions
function common_timezone {   ... }

Opening curly brace should be on the line following the function definition.

Naming
Standalone function names usually follow the internal PHP naming style, with lowercased_words separated_with_underscores.

Classes are InitiallyCased.

Member functions follow camelCase.

Parens
if (common_logged_in) { ...   }    return common_config('site', 'timezone');


 * Separate control structures (if, for, etc) from their parens with a space.
 * Do not leave any space between a function name and its argument list.
 * Do not leave extra whitespace inside parens.

Indentation
Use four spaces per indent... please don't mix tabs and spaces!

JavaScript
Client-side JS code for the user interface heavily uses the jQuery framework.

Style generally follows the above conventions with a couple exceptions:
 * Function definitions usually include the opening paren on the same line

Filesystem layout
Broadly:


 * / - entry points only (index.php, install.php)
 * /action - FooAction -> foo.php
 * /classes - Foo_member extends Memcache_Data_Object -> Foo_member.php
 * /lib - FooList -> foolist.php
 * /scripts - command-line scripts and daemons (queuedaemon.php, etc)
 * /js - core JavaScript files including libraries
 * /theme - CSS and images for theme subdirs
 * /plugins - core-maintained plugins
 * each either in FooPlugin directory or a single file
 * FooPlugin -> FooPlugin.php
 * /local - area for local plugins and themes, same subdir style