basic cloning functionality

* Modifies api.php to serve as function, not outputter of JSON text
* Builds basic functionality of cloning template directory into new
unique folder
php returns JSON of embed URL