コード例 #1
0
ファイル: css.php プロジェクト: alerque/bibledit
 public function customize($bible)
 {
     $database_config_bible = Database_Config_Bible::getInstance();
     $class = Filter_CustomCSS::getClass($bible);
     $font = $database_config_bible->getTextFont($bible);
     $uploaded_font = Fonts_Logic::fontExists($font);
     $font = Fonts_Logic::getFontPath($font);
     $direction = $database_config_bible->getTextDirection($bible);
     $css = Filter_CustomCSS::getCss($class, $font, $direction);
     if ($uploaded_font) {
         $css = str_replace("../fonts/", "", $css);
     }
     $this->css[] = $css;
 }
コード例 #2
0
ファイル: index.php プロジェクト: alerque/bibledit
$view->view->navigationCode = Navigation_Passage::code($bible);
// Write access?
$write_access = Access_Bible::write($bible);
$view->view->write_access = $write_access;
$chapterLoaded = Locale_Translate::_("Loaded");
$chapterSaving = Locale_Translate::_("Saving...");
$chapterRetrying = Locale_Translate::_("Retrying...");
$write_access = $write_access ? "true" : "false";
$script = <<<EOD
var editorChapterLoaded = '{$chapterLoaded}';
var editorChapterSaving = '{$chapterSaving}';
var editorChapterRetrying = '{$chapterRetrying}';
var editorWriteAccess = {$write_access};
EOD;
$view->view->script = $script;
$class = Filter_CustomCSS::getClass($bible);
$font = $database_config_bible->getTextFont($bible);
$direction = $database_config_bible->getTextDirection($bible);
$view->view->custom_class = $class;
$view->view->custom_css = Filter_CustomCSS::getCss($class, Fonts_Logic::getFontPath($font), $direction);
$view->render("index.php");
Assets_Page::footer();
/*
Tests for the Bible editor:
* Autosave on going to another passage.
* Autosave on document unload.
* Autosave shortly after any change.
* Automatic reload when another user updates the chapter on the server.
* Position caret at correct verse.
* Scroll caret into view.
*/
コード例 #3
0
ファイル: customcssTest.php プロジェクト: alerque/bibledit
    public function testCss()
    {
        $css = Filter_CustomCSS::getCss("class", "", 0);
        $standard = <<<EOD
.class
{
}
EOD;
        $this->assertEquals($standard, $css);
        $css = Filter_CustomCSS::getCss("class", "", 101);
        $standard = <<<EOD
.class
{
direction: ltr;
}
EOD;
        $this->assertEquals($standard, $css);
        $css = Filter_CustomCSS::getCss("class", "", 102);
        $standard = <<<EOD
.class
{
direction: rtl;
}
EOD;
        $this->assertEquals($standard, $css);
        $css = Filter_CustomCSS::getCss("class", "", 110);
        $standard = <<<EOD
.class
{
writing-mode: tb-lr;
}
EOD;
        $this->assertEquals($standard, $css);
        $css = Filter_CustomCSS::getCss("class", "", 130);
        $standard = <<<EOD
.class
{
writing-mode: bt-lr;
}
EOD;
        $this->assertEquals($standard, $css);
        $css = Filter_CustomCSS::getCss("class", "", 1322);
        $standard = <<<EOD
.class
{
direction: rtl;
writing-mode: tb-rl;
}
EOD;
        $this->assertEquals($standard, $css);
        $css = Filter_CustomCSS::getCss("class", "sherif", 0);
        $standard = <<<EOD
.class
{
font-family: sherif;
}
EOD;
        $this->assertEquals($standard, $css);
        $css = Filter_CustomCSS::getCss("class", "sherif", 102);
        $standard = <<<EOD
.class
{
font-family: sherif;
direction: rtl;
}
EOD;
        $this->assertEquals($standard, $css);
        $css = Filter_CustomCSS::getCss("class", "../font.ttf", 0);
        $standard = <<<EOD
@font-face
{
font-family: class;
src: url(../font.ttf);
}
.class
{
font-family: class;
}
EOD;
        $this->assertEquals($standard, $css);
    }