Example #1
0
 public static function getInstance()
 {
     if (empty(self::$instance)) {
         self::$instance = new Editor_Export();
     }
     return self::$instance;
 }
Example #2
0
$database_logs = Database_Logs::getInstance();
$database_bibles = Database_Bibles::getInstance();
$database_modifications = Database_Modifications::getInstance();
$session_logic = Session_Logic::getInstance();
$bible = $_POST['bible'];
$book = $_POST['book'];
$chapter = $_POST['chapter'];
$html = $_POST['html'];
$checksum = $_POST['checksum'];
if (isset($bible) && isset($book) && isset($chapter) && isset($html) && isset($checksum)) {
    if (Checksum_Logic::get($html) == $checksum) {
        $html = trim($html);
        if ($html != "") {
            if (Validate_Utf8::valid($html)) {
                $stylesheet = $database_config_user->getStylesheet();
                $editor_export = Editor_Export::getInstance();
                $editor_export->load($html);
                $editor_export->stylesheet($stylesheet);
                $editor_export->run();
                $usfm = $editor_export->get();
                $book_chapter_text = Filter_Usfm::import($usfm, $stylesheet);
                foreach ($book_chapter_text as $data) {
                    $book_number = $data[0];
                    $chapter_number = $data[1];
                    $chapter_data_to_save = $data[2];
                    if (($book_number == $book || $book_number == 0) && $chapter_number == $chapter) {
                        // Collect some data about the changes for this user.
                        $username = $session_logic->currentUser();
                        $oldID = $database_bibles->getChapterId($bible, $book, $chapter);
                        $oldText = $database_bibles->getChapter($bible, $book, $chapter);
                        // Safely store the chapter.
Example #3
0
    public function testEmbeddedTextSpansOne()
    {
        $html = <<<'EOD'
<p class="p"><span>The <span class="add"><span class="nd">Lord God</span> is calling</span> you</span><span>.</span></p>
EOD;
        $editor_export = Editor_Export::getInstance();
        $editor_export->load($html);
        $editor_export->stylesheet("Standard");
        $editor_export->run();
        $usfm = $editor_export->get();
        $standard = <<<'EOD'
\p The \add \+nd Lord God\+nd* is calling\add* you.
EOD;
        $this->assertEquals($standard, $usfm);
    }