當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ArtefactType::update_artefact_references方法代碼示例

本文整理匯總了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 . '(&|&amp;)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);
     }
 }
開發者ID:sarahjcotton,項目名稱:mahara,代碼行數:27,代碼來源:lib.php

示例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')));
     }
 }
開發者ID:richardmansfield,項目名稱:richardms-mahara,代碼行數:18,代碼來源:lib.php


注:本文中的ArtefactType::update_artefact_references方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。