Skip to content
Krzysztof Kasowski edited this page Jan 21, 2016 · 6 revisions

###Internal Development Standards At Jigoshop, our team of developers follow a set of the same rules and policies for the development of each plugin. Our procedures were designed to achieve following objectives:

  • Design code and files for performance so that a website with even 15 Jigoshop plugins can be fast
  • prepare common development rules and policies for developers
  • simplify directory structure, code and file naming convention
  • ensure compatibility with number of commonly used tools including Google Insight, HTML and CSS validators

Please find our internal development policies and rules below:

  1. Structure of directories
    • Each plugin can only have following approved folders without any unnecessary sub folders: js, css, src, img, languages, templates
  2. Template init file
    • Each plugin should use the up-to-date version of an init file (template)
  3. Code should be divided into Jigoshop 1.x and Jigoshop 2.x
    • The idea behind dividing the code is to avoid multiple checks for a version of Jigoshop. As a result there should be 2 versions of the code within the src directory:
      • one for Jigoshop 1.x in following form*-1x-*
      • one for Jigoshop 2.x without any suffixes
  4. Divide CSS and JavaScript files into common, frontend and backend
    • Thanks to dividing the CSS and JavaScripts files into common, frontend and backend we can ensure that no unnecessary items are sent to the browser, thus improving page generation times. As a result plugins will have style-common.css, style-frontend.css and style-backend.css files in their respective directories defined in point 1
  5. Divide the CSS, JavaScript and php code by the functional areas of the frontend
    • If a JavaScript is required on the checkout page only, there is no need to load it on every page. Example: CSS, JavaScripts and php code for payment gateways is not needed on any other page than checkout (frontend) or payment gateways settings page (backend) and therefore those should be the only pages where code is loaded
  6. PHP code has to be compatible with PHP 5.3, 5.4, 5.5 and 5.6
  7. All the old and slow functions should be removed
    • Example: ereg_* are slow and therefore they should be replaced with preg_*
  8. Each plugin should be compatible and support JRTO
    • One of the most important issues with even a relatively small website based on WordPress is the fact that most of the plugins add additional CSS and JavaScript files. Every new file has to be downloaded by the browser and therefore it increases the page loading time. Jigoshop Round Trip Optimizer provides a framework which combines relevant files every time new plugin that supports JRTO is installed, activated, deactivated or when JRTO settings are changed JRTO is available under following link: https://github.com/jigoshop/jigoshop-round-trip-optimizer
  9. Every plugin should be prepared in a such a way that it doesn’t cause any issues with following tools: Google Insight and Pingdom
  10. All the obsolete code and unnecessary comments should be removed
  11. PHP code should be compatible with PSR-2 standard
  12. Plugins shouldn’t cause any HTML, CSS and PHP errors/warnings
  13. Assuming that all the points above are followed, code and all the files should pass following tests: PHP-CPD (Copy Paste Detector), PHP-MD (Mess Detector), PHP-CS (Code Sniffer), HTML validator, CSS validator
Clone this wiki locally