예제 #1
0
    public function testImport2()
    {
        $bwdata = <<<EOD
Hab 1:1  La sentència ... profeta <05030> Habacuc <02265>.
Hab 1:2 ¿Fins <05704> quan <0575>, Jahveh ... no [em] salvaràs <03467>(08686)? 
Hab 1:3 ¿Per què ... i la controvèrsia <04066>.
EOD;
        $usfmdata = <<<EOD
\\id HAB
\\c 1
\\p
\\v 1 La sentència ... profeta  Habacuc .
\\v 2 ¿Fins  quan , Jahveh ... no \\add em\\add* salvaràs ?
\\v 3 ¿Per què ... i la controvèrsia .
EOD;
        $data = Filter_Bibleworks::import($bwdata, false);
        $this->assertEquals($usfmdata, $data);
    }
예제 #2
0
$success_message = "";
$error_message = "";
// The name of the Bible.
$bible = Access_Bible::clamp($_GET['bible']);
$view->view->bible = Filter_Html::sanitize($bible);
// Data submission.
if (isset($_POST['submit'])) {
    // Whether to keep the grammatical tags.
    $tags = isset($_POST['tags']);
    // The BibleWorks text.
    $data = $_POST['data'];
    $data = trim($data);
    if ($data != "") {
        if (Validate_Utf8::valid($data)) {
            // Convert the BibleWorks text to USFM.
            $usfm = Filter_Bibleworks::import($data, $tags);
            // Import the USFM.
            $datafile = tempnam(sys_get_temp_dir(), '');
            file_put_contents($datafile, $usfm);
            $success_message = Locale_Translate::_("Import has started. See Journal for progress.");
            $workingdirectory = dirname(__FILE__);
            Tasks_Logic::queue(Tasks_Logic::PHP, array("{$workingdirectory}/importcli.php", $datafile, $bible));
        } else {
            $error_message = Locale_Translate::_("Please supply valid Unicode UTF-8 text.");
        }
    } else {
        $success_message = Locale_Translate::_("Nothing was imported.");
    }
}
@($view->view->success_message = $success_message);
@($view->view->error_message = $error_message);