/** * 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); }
/** * 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'])); }
/** * 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; } }