public function returnObjects($par)
{
$objs = array();
$keys = array_keys($this->objects);
foreach ($keys as $key) {
// Skip the root, parent and info objects, returning only page and content objects.
if ($this->objects[$key]['type'] != 'root' && $this->objects[$key]['type'] != 'parent' && $this->objects[$key]['type'] != 'info') {
if ($this->objects[$key]['type'] == 'page') {
$parent = substr($this->objects[$key]['data'], strpos($this->objects[$key]['data'], 'Parent'));
$parent = substr($parent, 0, strpos($parent, '/'));
$parent = str_replace('Parent', '', $parent);
$parent = str_replace(' 0 R', '', $parent);
$parent = str_replace(' ', '', $parent);
$this->objects[$key]['data'] = str_replace('/Parent ' . $parent . ' 0 R', '/Parent ' . $par . ' 0 R', $this->objects[$key]['data']);
$this->objects[$key]['data'] = str_replace('/Parent [' . $parent . ' 0 R', '/Parent [' . $par . ' 0 R', $this->objects[$key]['data']);
}
$objs[$key] = $this->objects[$key];
}
}
return $objs;
}