本文整理汇总了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);
}
示例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');
}
示例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;
}
}
示例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;
}
}