Skip to content
jstensved edited this page Sep 13, 2014 · 6 revisions

Innovator Development Guidelines

Why this document?

This document with guidelines exists to keep the quality on our codebase on the same level in all aspects regardless of whom who have written the code.

It defines how we want code to be written so we can guarantee the quality of the final product.

WordPress Development

General

  • Comply to the WordPress coding standards: http://make.wordpress.org/core/handbook/coding-standards/

  • Use OOP and classes for logic

  • On large projects; split logical areas of the application into plugins, ie one plugin for a booking system and another for an integration. Don’t mix both, and don’t put it in the theme.

  • The theme should only contain code for displaying data, all logic should be contained in plugins. Really small changes could be included if small and considered appropriate.

  • If a function exists in the framework - don’t make your own. This also applies to code doing the same think even if it is not in a function. For example: use get_term_link instead of concatenating url strings yourself.

  • Use filters and hooks as much as possible

  • Don’t leave code commented out when commiting completed code, only working code shoulde be left when the project is done

  • Folder structure:

root - put all php files here

* css - all css and less goes here

* img - all images here

* js - all script files here
  • Put code needed for viewing data in the php template file, code för manipulating data (ex fetching from an API in a separate class and call it from the view).

Ajax

  • For ajax requests - hook in with wp_ajax or wp_ajax_nopriv functions

  • One class per file.

JavaScript

  • All stylesheets should be registered with wp_eneuque_script or (admin_script) hook.

  • Minimal inline, use inline to hook up with classes,

ex. $(‘#button’).enableMyFunc();

but declare "enableMyFunc" in a separate file

  • Use closures for jQuery and wrap the global namespace, ex:

(function($){

// add code here

}()(jQuery);

CSS

  • Use LESS (lesscss.org) to compile the .css

  • Include the .less files in the project commit

  • Divide the styles in to sections using comments

  • No inline css

  • No style-tags

  • All stylesheets should be registered with wp_eneuque_style (or admin style) hook.

HTML

Database

  • Never use mysql_* functions directly. Use global $wpdb if really neeed.

timetracking Toggl

All Innovator employees report their time spent on tasks in an online tracking system called toggl.

Toggl is an internal reviewing system that we use to:

  1. Create detailed timereports to our employers for invoices

  2. Create better estimated prices to our employers.

Every employee will be handed a login to toggl registered on there own email adress. The employee will be send an email to register.

Using Toggl should be done on task basis. Timestamps can be copied from the project specification or GitHub issue list. Be sure to put in the right client so your stamp is booked properly.

www.toggl.com

Clone this wiki locally