What this function does in PHP 4 is the following:
It takes the input, whether a single value or an array, and creates a number of hidden input fields in an HTML form. When you instantiate the Hiddens object, the function tries to change $this (which refers to the object itself) to the string of hidden input fields.
The ob_ functions are being used to buffer the output and allow you to stick it into a variable instead of immediately outputting it to the screen.
Change this line:
$this = ob_get_contents(); ob_end_clean();
$contents = ob_get_contents(); ob_end_clean();
This will work if you use the Hiddens object by assigning it to some variable like this:
$hidden_fields = Hiddens($array);
Where $array is the array of values being passed to the object.