Use WordPress standards formatting

Mostly spacing and indentation. Also adds curly braces to if statements as per standards.
http://make.wordpress.org/core/handbook/coding-standards/php/#brace-style
An attempt to enforce this rule http://make.wordpress.org/core/handbook/coding-standards/php/#indentation
But it's not necessary for blocks of 2 lines