Exemple #1
0
 public static function getInstance()
 {
     if (empty(self::$instance)) {
         self::$instance = new Database_Resources();
     }
     return self::$instance;
 }
Exemple #2
0
 public function get($name, $book, $chapter, $verse)
 {
     $database_resources = Database_Resources::getInstance();
     $file = $database_resources->getInclude($name);
     $output = "";
     // Pass $book, $chapter, $verse to the included script below.
     // The script fills the $output variable.
     include $file;
     return $output;
 }
Exemple #3
0
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
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.
*/
require_once "../bootstrap/bootstrap.php";
page_access_level(Filter_Roles::MANAGER_LEVEL);
$view = new Assets_View(__FILE__);
$database_resources = Database_Resources::getInstance();
$database_offlineresources = Database_OfflineResources::getInstance();
$database_versifications = Database_Versifications::getInstance();
@($name = $_GET['name']);
$view->view->name = $name;
if (isset($_GET['download'])) {
    $versification = "English";
    $books = $database_versifications->getBooks($versification);
    foreach ($books as $book) {
        // Schedule the task with low priority so it does not get in the way of regular tasks.
        Tasks_Logic::queue(Tasks_Logic::PHP, array(__DIR__ . "/downloadcli.php", $name, $book));
    }
    Filter_Url::redirect("../journal/index.php");
    die;
}
if (isset($_GET['clear'])) {
Exemple #4
0
 public function testGetNames()
 {
     $database_resources = Database_Resources::getInstance();
     $names = $database_resources->getNames();
     $this->assertContains("Statenbijbel GBS", $names);
 }
Exemple #5
0
 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;
 }