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


PHP HtmlEditorField::saveInto方法代碼示例

本文整理匯總了PHP中HtmlEditorField::saveInto方法的典型用法代碼示例。如果您正苦於以下問題:PHP HtmlEditorField::saveInto方法的具體用法?PHP HtmlEditorField::saveInto怎麽用?PHP HtmlEditorField::saveInto使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在HtmlEditorField的用法示例。


在下文中一共展示了HtmlEditorField::saveInto方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testBrokenLinkTracking

 public function testBrokenLinkTracking()
 {
     $sitetree = new SiteTree();
     $editor = new HtmlEditorField('Content');
     $this->assertFalse((bool) $sitetree->HasBrokenLink);
     $editor->setValue('<p><a href="[sitetree_link id=0]">Broken Link</a></p>');
     $editor->saveInto($sitetree);
     $this->assertTrue($sitetree->HasBrokenLink);
     $editor->setValue(sprintf('<p><a href="[sitetree_link id=%d]">Working Link</a></p>', $this->idFromFixture('SiteTree', 'home')));
     $sitetree->HasBrokenLink = false;
     $editor->saveInto($sitetree);
     $this->assertFalse((bool) $sitetree->HasBrokenLink);
 }
開發者ID:rixrix,項目名稱:silverstripe-cms,代碼行數:13,代碼來源:SiteTreeHTMLEditorFieldTest.php

示例2: testSavingLinksWithoutHref

 public function testSavingLinksWithoutHref()
 {
     $obj = $this->objFromFixture('HtmlEditorFieldTest_Object', 'home');
     $editor = new HtmlEditorField('Content');
     $editor->setValue('<p><a name="example-anchor"></a></p>');
     $editor->saveInto($obj);
     $this->assertEquals('<p><a name="example-anchor"></a></p>', $obj->Content, 'Saving a link without a href attribute works');
 }
開發者ID:normann,項目名稱:sapphire,代碼行數:8,代碼來源:HtmlEditorFieldTest.php

示例3: buildbrokenlinks

 public function buildbrokenlinks($request)
 {
     // Protect against CSRF on destructive action
     if (!SecurityToken::inst()->checkRequest($request)) {
         return $this->httpError(400);
     }
     increase_time_limit_to();
     increase_memory_limit_to();
     if ($this->urlParams['ID']) {
         $newPageSet[] = DataObject::get_by_id("Page", $this->urlParams['ID']);
     } else {
         $pages = DataObject::get("Page");
         foreach ($pages as $page) {
             $newPageSet[] = $page;
         }
         $pages = null;
     }
     $content = new HtmlEditorField('Content');
     $download = new HtmlEditorField('Download');
     foreach ($newPageSet as $i => $page) {
         $page->HasBrokenLink = 0;
         $page->HasBrokenFile = 0;
         $content->setValue($page->Content);
         $content->saveInto($page);
         $download->setValue($page->Download);
         $download->saveInto($page);
         echo "<li>{$page->Title} (link:{$page->HasBrokenLink}, file:{$page->HasBrokenFile})";
         $page->writeWithoutVersion();
         $page->destroy();
         $newPageSet[$i] = null;
     }
 }
開發者ID:helpfulrobot,項目名稱:webtorque7-inpage-modules,代碼行數:32,代碼來源:ContentModuleMain.php

示例4: buildbrokenlinks

 function buildbrokenlinks()
 {
     if ($this->urlParams['ID']) {
         $newPageSet[] = DataObject::get_by_id("Page", $this->urlParams['ID']);
     } else {
         $pages = DataObject::get("Page");
         foreach ($pages as $page) {
             $newPageSet[] = $page;
         }
         $pages = null;
     }
     $content = new HtmlEditorField('Content');
     $download = new HtmlEditorField('Download');
     foreach ($newPageSet as $i => $page) {
         $page->HasBrokenLink = 0;
         $page->HasBrokenFile = 0;
         $lastUsage = memory_get_usage() - $lastPoint;
         $lastPoint = memory_get_usage();
         $content->setValue($page->Content);
         $content->saveInto($page);
         $download->setValue($page->Download);
         $download->saveInto($page);
         echo "<li>{$page->Title} (link:{$page->HasBrokenLink}, file:{$page->HasBrokenFile})";
         $page->writeWithoutVersion();
         $page->destroy();
         $newPageSet[$i] = null;
     }
 }
開發者ID:hamishcampbell,項目名稱:silverstripe-cms,代碼行數:28,代碼來源:CMSMain.php


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