本文整理匯總了PHP中ArtefactType::update_artefact_references方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArtefactType::update_artefact_references方法的具體用法?PHP ArtefactType::update_artefact_references怎麽用?PHP ArtefactType::update_artefact_references使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ArtefactType
的用法示例。
在下文中一共展示了ArtefactType::update_artefact_references方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: update_artefact_references
public function update_artefact_references(&$view, &$template, &$artefactcopies, $oldid)
{
parent::update_artefact_references($view, $template, $artefactcopies, $oldid);
// 1. Attach copies of the files that were attached to the old note.
if (isset($artefactcopies[$oldid]->oldattachments)) {
foreach ($artefactcopies[$oldid]->oldattachments as $a) {
if (isset($artefactcopies[$a])) {
$this->attach($artefactcopies[$a]->newid);
}
}
}
// 2. Update embedded images in the note and db
$regexp = array();
$replacetext = array();
if (!empty($artefactcopies[$oldid]->oldembeds)) {
foreach ($artefactcopies[$oldid]->oldembeds as $a) {
if (isset($artefactcopies[$a])) {
// Change the old image id to the new one
$regexp[] = '#<img([^>]+)src="' . get_config('wwwroot') . 'artefact/file/download.php\\?file=' . $a . '(&|&)embedded=1(.*?"[^>]+)#';
$replacetext[] = '<img$1src="' . get_config('wwwroot') . 'artefact/file/download.php?file=' . $artefactcopies[$a]->newid . '$2embedded=1$3';
}
}
require_once 'embeddedimage.php';
$newdescription = EmbeddedImage::prepare_embedded_images(preg_replace($regexp, $replacetext, $this->get('description')), 'textbox', $this->get('id'), $view->get('group'));
$this->set('description', $newdescription);
}
}
示例2: update_artefact_references
public function update_artefact_references(&$view, &$template, &$artefactcopies, $oldid)
{
parent::update_artefact_references($view, $template, $artefactcopies, $oldid);
// Attach copies of the files that were attached to the old post.
// Update <img> tags in the post body to refer to the new image artefacts.
$regexp = array();
$replacetext = array();
if (isset($artefactcopies[$oldid]->oldattachments)) {
foreach ($artefactcopies[$oldid]->oldattachments as $a) {
if (isset($artefactcopies[$a])) {
$this->attach($artefactcopies[$a]->newid);
}
$regexp[] = '#<img([^>]+)src="' . get_config('wwwroot') . 'artefact/file/download.php\\?file=' . $a . '"#';
$replacetext[] = '<img$1src="' . get_config('wwwroot') . 'artefact/file/download.php?file=' . $artefactcopies[$a]->newid . '"';
}
$this->set('description', preg_replace($regexp, $replacetext, $this->get('description')));
}
}