params['tree']))
->embed(
$content,
$this->file,
function ($src, array $attributes, Entry $file) {
//Add the attachment for later upload
if ($file instanceof Raw) {
$filename = basename($file->getPath());
$this->attachments[$filename] = ['filename' => $filename, 'file' => $file];
} else if ($file instanceof ComputedRaw) {
$filename = $file->getUri();
$this->attachments[$filename] = ['filename' => $filename, 'content' => $file->getContent()];
}
return $this->createImageTag($filename, $attributes);
}
);
$intro = '';
if (array_key_exists('confluence', $this->params) && array_key_exists('header', $this->params['confluence']) && !empty($this->params['confluence']['header'])) {
$intro = '' . $this->params['confluence']['header'] . '';
}
return $intro . $content;
}
private function createImageTag($filename, $attributes)
{
$img = ' $value) {
if ($name == 'style') {
$re = '/float:\s*?(left|right);?/';
if (preg_match($re, $value, $matches)) {
$img .= ' ac:align="' . $matches[1] . '"';
$value = preg_replace($re, "", $value, 1);
}
}
$img .= ' ac:' . $name . '="' . htmlentities($value, ENT_QUOTES, 'UTF-8', false) . '"';
}
$img .= ">";
return $img;
}
}