protected function read_file(&$file, $filename) { if ($this->body_links_only) { if (is_array($file)) { $file['body_link'] = $filename; } elseif (is_object($file) && $file instanceof File) { $file->body_link = $filename; } else { $this->log("Bad file object format - most probably programming error!", LL_PANIC); die; } } else { if (is_array($file)) { $file['body'] = file_get_contents($filename); if ($file['body'] === false) { return false; } } elseif (is_object($file) && $file instanceof File) { $file->body = file_get_contents($filename); if ($file->body === false) { return false; } } else { $this->log("Bad file object format - most probably programming error!", LL_PANIC); die; } } if (isset($this->xml_file_extension) && !is_null($this->xml_file_extension)) { $filename_xmldesc = $this->filename_xmldesc($filename); $contents = file_get_contents($filename_xmldesc); if ($contents === false) { $this->log("Could not read file's description (XML)!", LL_ERROR); return false; } $data = $this->xml_to_array($contents); if (is_array($file)) { $file = array_merge($file, $data); } elseif (is_object($file) && $file instanceof File) { $file = new File($this->core, array_merge($file->data(), $data)); } } return true; }