本文整理匯總了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;
}
}