本文整理匯總了PHP中Editor::preParse方法的典型用法代碼示例。如果您正苦於以下問題:PHP Editor::preParse方法的具體用法?PHP Editor::preParse怎麽用?PHP Editor::preParse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Editor
的用法示例。
在下文中一共展示了Editor::preParse方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: prepareDescription
/**
* Prepares a description by cutting it down to a max length, removing
* possible shebang (from editor) and other small jazzy things
*
* @param string $str
* @param string $link
* @return string
*/
protected function prepareDescription($str, $link)
{
$editor = new Editor($str);
$editor->preParse();
$editor->setContentUrl($link);
return $editor->parse(true);
}
示例2: edit
/**
* Edits an existing page
*
* @param int $pid
* @param string $title
* @param string $body
* @param int $parent
* @return bool
*/
public function edit($pid, $title, $body, $parent)
{
$page = $this->getPage($pid);
$editor = new Editor($body);
$pdoSt = $this->_sql->prepare('UPDATE {PREFIX}mod_page SET title = ?, body = ?, parent = ? WHERE id = ?');
return $pdoSt->execute(array($title, $editor->preParse(), abs($parent), $page['id']));
}
示例3: editPart
/**
* Edits an existing article part with new details
*
* @param int $pid
* @param string $title
* @param string $body
* @param int $order
* @return bool
*/
public function editPart($pid, $title, $body, $order)
{
$part = $this->getPart($pid);
$editor = new Editor($body);
$details = array('id' => $part['id'], 'article_id' => $part['article_id'], 'title' => $title, 'body' => $editor->preParse(), 'order' => abs($order));
$pdoSt = $this->_sql->prepare('UPDATE {PREFIX}mod_article_parts SET title = ?, body = ?, `order` = ?
WHERE id = ?');
if ($pdoSt->execute(array($details['title'], $details['body'], $details['order'], $details['id']))) {
Hooks::notifyAll('article_edit_part', $part['id'], $details);
} else {
return false;
}
}