public function testDisplay() { $input = <<<EOD Psalms = Ps. Exodus = Exod. EOD; $data = Filter_Abbreviations::display($input); $output = <<<EOD Genesis = Exodus = Exod. Leviticus = Numbers = Deuteronomy = Joshua = Judges = Ruth = 1 Samuel = 2 Samuel = 1 Kings = 2 Kings = 1 Chronicles = 2 Chronicles = Ezra = Nehemiah = Esther = Job = Psalms = Ps. Proverbs = Ecclesiastes = Song of Solomon = Isaiah = Jeremiah = Lamentations = Ezekiel = Daniel = Hosea = Joel = Amos = Obadiah = Jonah = Micah = Nahum = Habakkuk = Zephaniah = Haggai = Zechariah = Malachi = Matthew = Mark = Luke = John = Acts = Romans = 1 Corinthians = 2 Corinthians = Galatians = Ephesians = Philippians = Colossians = 1 Thessalonians = 2 Thessalonians = 1 Timothy = 2 Timothy = Titus = Philemon = Hebrews = James = 1 Peter = 2 Peter = 1 John = 2 John = 3 John = Jude = Revelation = Front Matter = Back Matter = Other Material = EOD; $this->assertEquals($output, $data); }
along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ require_once "../bootstrap/bootstrap.php"; page_access_level(Filter_Roles::TRANSLATOR_LEVEL); $database_config_user = Database_Config_User::getInstance(); $database_config_bible = Database_Config_Bible::getInstance(); $database_books = Database_Books::getInstance(); $sourceBible = $database_config_user->getSourceXrefBible(); $targetBible = $database_config_user->getTargetXrefBible(); // Save book / abbreviation pair. if (isset($_POST['save'])) { $fullname = $_POST['fullname']; $abbreviation = $_POST['abbreviation']; $abbreviations = $database_config_bible->getBookAbbreviations($targetBible); $abbreviations = Filter_Abbreviations::display($abbreviations); $abbreviations .= "\n{$fullname} = {$abbreviation}"; $database_config_bible->setBookAbbreviations($targetBible, $abbreviations); } $sourceAbbreviations = $database_config_bible->getBookAbbreviations($sourceBible); $sourceAbbreviations = Filter_Abbreviations::read($sourceAbbreviations); $sourceAbbreviations = array_values($sourceAbbreviations); $targetAbbreviations = $database_config_bible->getBookAbbreviations($targetBible); $targetAbbreviations = Filter_Abbreviations::read($targetAbbreviations); $targetAbbreviations = array_values($targetAbbreviations); $unknown_abbreviations = array_diff($sourceAbbreviations, $targetAbbreviations); $unknown_abbreviations = array_unique($unknown_abbreviations); foreach ($unknown_abbreviations as &$abbreviation) { $abbreviation = $database_books->getEnglishFromId($abbreviation); } $unknown_abbreviations = array_values($unknown_abbreviations);
page_access_level(Filter_Roles::TRANSLATOR_LEVEL); Assets_Page::header(Locale_Translate::_("Abbreviations")); $view = new Assets_View(__FILE__); $database_config_bible = Database_Config_Bible::getInstance(); $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'])) { $data = $_POST['data']; $data = trim($data); if ($data != "") { if (Validate_Utf8::valid($data)) { $database_config_bible->setBookAbbreviations($bible, $data); $success_message = Locale_Translate::_("The abbreviations were saved."); } else { $error_message = Locale_Translate::_("Please supply valid Unicode UTF-8 text."); } } else { $success_message = Locale_Translate::_("Nothing was saved."); } } $data = $database_config_bible->getBookAbbreviations($bible); $data = Filter_Abbreviations::display($data); $view->view->data = $data; $view->view->success_message = $success_message; $view->view->error_message = $error_message; $view->render("abbreviations.php"); Assets_Page::footer();