Wordpress Plugin Whirlio

Because of interview requirements, here is a clarification: An entire Whirlio.com suite code, except of 1. jQuery, 2. Wordpress in folder: whirlio.com/forum, and 3. public domain graphic images, is written by Konstantin Kirillov from bit to bit. Plugin whirlio.com/forum/wp-content/plugin/whirlio is written by Konstantin Kirillov. It is described in this readme. The full code of Whirlio.com suite ( except Wordpress ) is in folder https://github.com/lancelab/Boardspirator/tree/master/diary/play/ download zip from: https://github.com/lancelab/Boardspirator

Introduction

Whirlio.com is a game suite. It has "standalone" set of games. Some of these games ported to Wordpress forum which is based on Buddypress plugin. The idea of the port is that forum members can contribute own maps for games and even subgames. The contribution is implemented by already existing Wordpress facility, which is Wordpress "custom post". Custom post is a text which is added through Wordpress dashboard. When this post is loaded, then it is interpreted as a game and is displayed as a game wrapped into Wordpress theme GUI. The code which is responsible for this interpretation is a Wordpress plugin named Whirlio which is located at standard Wordpress location for plugins: Whirilio.com/forum/wp-content/plugins/whirlio/ where Whirlio.com/forum/ is a Wordpress root.

Components of plugin Whirlio

At the moment, whirlio plugin has three games ported to Whirlio forum: (legacy) whirlio, squiz, word-game, and quiz. Each game ported to Whirlio.com is called a Gameget. The Gameget comprises three parts: Gameget-engine, Gameget-injector, and Gameget-script. 1. Gameget-engine is a core of the game which can be elsewhere under or out of Wordpress root. Usually, engine is able to run as a stadalone game independently from Wordpress. 2. Gameget-injector ports engine into WP. It is a part of whirlio-plugin and belongs plugin folder tree. 3. Gameget-script is an actual custom-post made by forum contributor. It is loaded from standard WP-database. There is no Gameget-interpreter in PHP. Gameget-script is completely parsed, interpreted, and run in JavaSript part of engine. For example, for "word-puzzle", Wboard, gameget is structured like this: WP-root: .../play/forum And in respect to this root: Gameget-engine: .../play/wboard Whirlio-plugin: .../play/forum/wp-content/plugins/whirlio One of the Gameget-injector files: .../play/forum/wp-content/plugins/whirlio/wordion-script-interceptor.php Here is a full list of plugin files For core functionality, see main plugin file: whirlio.php

Advanced. Instructions for plugin developer. Adding a new Gameget.

1. whirlio2015 is a child theme of twentyfifteen and the only reason for it is inserted background canvas animation: <body <?php body_class(); ?>;>; <div id="canvas_wrap" style="position:fixed; top:0px; left:0px; ">; <canvas id="canvas" style="position:absolute; left:0px; top:0px;">; </canvas>; </div>; <div id="page" class="hfeed site">; In other words, the difference between themes is only three html-lines ini file wirlio2015/header.php 2. whirlio.php has 3 entrances of "wordtrack" fragments with lines like: } elseif( 'wordtrack' === $post_type_btb ) { 3. wordion.head.html.php subloads wboard gameget into WP 4. wordion-script-interceptor.php loads actual Gameget-script from db to JS. don't forget to set a right css id like in squiz-script-interceptor.php: <div id="squiz-btb" class="widgetion-root-btb">;</div>; These 4 are the only variable fragments necessary to add any other gameget to app. 5. Possibly, one would like to add gameget menu to the side-bar. Some example from whirlio.php $own = $result[ 'own_work' ]; if( $own ) echo ( "...SQUIZZES SANDBOX ...\n$own"); 6. After modifying the PHP code, add new custom post type in WP. ( Dashboard CPT plugin works fine for this. ) The type-slug is used in whirlio-plugin. In this example, type-slug is "wordtrack";