当前位置: 首页>>代码示例>>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;未经允许,请勿转载。