Take care using the backtrace method to find the calling class of a static method, you should step backward through the array and find a match for your getInstance() function. In backtrace the class name you want is not always the last item in the array.
I will not post the whole singleton class here, but have made the following modification to Frederik Krautwald's method (found below)
<?php
$bt = debug_backtrace();
for( $i=count($bt)-1 ; $i > 0 ; $i--)
{
if($bt[$i]['function'] == 'getInstance')
{
$class = $bt[$i]['class'];
break;
}
}
?>