host = $host; $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); } function get_js() { return file_get_contents(dirname(__FILE__) . "/note.js"); } function hook_article_button($line) { return "note"; } function edit() { $param = $_REQUEST['param']; $sth = $this->pdo->prepare("SELECT note FROM ttrss_user_entries WHERE ref_id = ? AND owner_uid = ?"); $sth->execute([$param, $_SESSION['uid']]); if ($row = $sth->fetch()) { $note = $row['note']; print \Controls\hidden_tag("id", "$param"); print \Controls\hidden_tag("op", "pluginhandler"); print \Controls\hidden_tag("method", "setNote"); print \Controls\hidden_tag("plugin", "note"); ?> pdo->prepare("UPDATE ttrss_user_entries SET note = ? WHERE ref_id = ? AND owner_uid = ?"); $sth->execute([$note, $id, $_SESSION['uid']]); $formatted_note = Article::_format_note_html($id, $note); print json_encode(array("note" => $formatted_note, "raw_length" => mb_strlen($note))); } function api_version() { return 2; } }