public function consultationNote($id) { $database_notes = Database_Notes::getInstance(); $database_logs = Database_Logs::getInstance(); $passage = $database_notes->getPassages($id); $passageText = Filter_Books::passagesDisplayInline($passage); $summary = $database_notes->getSummary($id); $contents = $database_notes->getContents($id); $contents = Filter_Html::html2text($contents); $session_logic = Session_Logic::getInstance(); $username = $session_logic->currentUser(); $database_logs->log("{$username} deleted / marked for deletion consultation note {$passageText} | {$summary} | {$contents}"); }
public function updateSearchFields($identifier) { // The search field is a combination of the summary and content converted to clean text. // It enables us to search with wildcards before and after the search query. $noteSummary = $this->getSummary($identifier); $noteContents = $this->getContents($identifier); $cleanText = $noteSummary . "\n" . Filter_Html::html2text($noteContents); // Bail out if the search field is already up to date. if ($cleanText == $this->getSearchField($identifier)) { return; } // Update the field. $db = self::connect(); $identifier = Database_SQLiteInjection::no($identifier); $cleanText = Database_SQLiteInjection::no($cleanText); $query = "UPDATE notes SET cleantext = '{$cleanText}' WHERE identifier = {$identifier};"; Database_SQLite::exec($db, $query); unset($db); }
public function testHtml2Text4() { $html = <<<EOD Line one.<BR> Line two.<BR> Line three.<BR> EOD; $plain = <<<EOD Line one. Line two. Line three. EOD; $this->assertEquals($plain, Filter_Html::html2text($html)); }
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ // This script logs a message in the Journal through the web. // Skip empty message. @($msg = $_GET["msg"]); if ($msg == "") { die; } // It can be called from localhost only for security reasons. if ($_SERVER['SERVER_ADDR'] != $_SERVER['REMOTE_ADDR']) { die; } require_once "../bootstrap/bootstrap.php"; if (Filter_Cli::not_yet_ready()) { die; } // Keep pure text only. $msg = Filter_Html::html2text($msg); $msg = trim($msg); if ($msg == "") { die; } // Log the message. $database_logs = Database_Logs::getInstance(); $database_logs->log($msg);
public static function getText($resource, $book, $chapter, $verse) { $database_bibles = Database_Bibles::getInstance(); $database_resources = Database_Resources::getInstance(); $database_usfmresources = Database_UsfmResources::getInstance(); $database_offlineresources = Database_OfflineResources::getInstance(); $bibles = $database_bibles->getBibles(); $usfms = $database_usfmresources->getResources(); $externals = $database_resources->getNames(); $isBible = in_array($resource, $bibles); $isUsfm = in_array($resource, $usfms); if ($isBible || $isUsfm) { if ($isBible) { $chapter_usfm = $database_bibles->getChapter($resource, $book, $chapter); } if ($isUsfm) { $chapter_usfm = $database_usfmresources->getUsfm($resource, $book, $chapter); } $verse_usfm = Filter_Usfm::getVerseText($chapter_usfm, $verse); $database_config_user = Database_Config_User::getInstance(); $stylesheet = $database_config_user->getStylesheet(); $filter_text = new Filter_Text($resource); $filter_text->text_text = new Text_Text(); $filter_text->addUsfmCode($verse_usfm); $filter_text->run($stylesheet); $text = $filter_text->text_text->get(); } else { if (in_array($resource, $externals)) { // Use offline copy if it exists, else fetch it online. if ($database_offlineresources->exists($resource, $book, $chapter, $verse)) { $text = $database_offlineresources->get($resource, $book, $chapter, $verse); } else { $text = Resource_Logic::getExternal($resource, $book, $chapter, $verse, true); } $text = Filter_Html::html2text($text); } else { $text = ""; } } return $text; }