Set client cookies from PiwikTracker.php

This pull request adds variables, functions, and logic so PiwikTracker can update client cookies and may suffice to meet the request in ticket #3239 (http://dev.piwik.org/trac/ticket/3239).  The code was originally derived from the patch submitted (and ultimately not-accepted) in ticket #2699 (http://dev.piwik.org/trac/ticket/2699).  Deeper research showed that the logic inside this patch was incomplete and differed greatly from piwik.js.  In response, functions in Piwik.js were copied over and translated into PHP, refactoring existing code to leverage these functions.