protected function registerTestConn() { $targetFile = colesoApplication::getConfigVal('/system/cacheDir') . 'test/' . $this->cachePath . $this->sqliteDbFileName; colesoApplication::setConfigVal('/system/db/default/dbType', 'Pdo_Sqlite'); colesoApplication::setConfigVal('/system/db/default/dbHost', 'localhost'); colesoApplication::setConfigVal('/system/db/default/dbName', $targetFile); $this->dbConn = colesoDB::getConnection(); }
protected function getRealPath($path) { $realPath = $path; if (!colesoApplication::getConfigVal('/system/useStandaloneTheme')) { $realPath = $this->libPath . $path; } return $realPath; }
public function setUp() { $this->Environment = new colesoEnvironment(); $this->Environment->setMode('test'); colesoToken::testReset(); colesoApplication::setEnvironment($this->Environment); $this->riseFixture(); if ($this->cachePath) { $this->savedSystemCachePath = colesoApplication::getConfigVal('/system/cacheDir'); colesoApplication::setConfigVal('/system/cacheDir', $this->fullCachePath); } }
function colesoSubstr($str, $start, $length = null) { $localeData = colesoApplication::getConfigVal('/system/localeData'); if (isset($localeData['isMultiByte'])) { if (is_null($length)) { $length = mb_strlen($str); } return mb_substr($str, $start, $length, $localeData['encoding']); } if (is_null($length)) { $length = strlen($str); } return substr($str, $start, $length); }
private static function obtainCurrentLanguage() { if (colesoApplication::getConfigVal('/system/language')) { return colesoApplication::getConfigVal('/system/language'); } $language = self::$defaultLang; $environment = colesoApplication::getEnvironment(); $url = $environment->getRequestURL(); foreach (self::$languageList as $language) { if (preg_match('/^\\/' . $language . '/', $url)) { return $language; } } return $language; }
function testBook() { $sourcePath = colesoApplication::getConfigVal('/bulldoc/source'); $outputPath = colesoApplication::getConfigVal('/bulldoc/output'); $themesPath = colesoApplication::getConfigVal('/bulldoc/themeDir'); $myBookLoader = new bookLoader(); $myBook = $myBookLoader->getBook('bulldoc_book'); $this->assertEqual($myBook->getBookDest(), $outputPath . 'bulldoc_book/', 'Correct Output Dest obtained'); $this->assertEqual($myBook->getBookKey(), 'bulldoc_book', 'Book key Ok'); $this->assertEqual($myBook->getBookData(), array('source' => $sourcePath . 'bulldoc_book/', 'title' => 'Bull Doc', 'author' => 'Dmitry Smirnov', 'copyright' => 'H-type, 2008', 'site' => 'www.bulldoc.ru', 'bookShelfTitle' => 'Bull Doc', 'outputMode' => 'html'), 'Correct book data array obtained'); $this->assertEqual($myBook->getBookTitle(), 'Bull Doc', 'Book title Ok'); $this->assertEqual($myBook->getBookSource(), $sourcePath . 'bulldoc_book/', 'Book source Ok'); $this->assertEqual($myBook->getBookTheme(), array('themePath' => $themesPath . 'blueprint', 'themeUrl' => 'support/workshop/themes/blueprint'), 'Correct Theme data obtained'); $this->assertEqual($myBook->getTocFileName(), $sourcePath . 'bulldoc_book/toc.yml', 'Correct TOC filename obtained'); $this->assertIsA($myBook->getBookRenderer(), 'renderDocPage', 'book rendrer obtained'); }
function colesoEchoDebugHeader() { $sysImgPath = colesoApplication::getConfigVal('/system/urlRoot') . 'lib/coleso/web/img/'; $jsPath = colesoApplication::getConfigVal('/system/urlRoot') . 'lib/coleso/web/js/'; $richeditPath = colesoApplication::getConfigVal('/system/richedit/url'); ?> <script type='text/javascript' language='JavaScript'> colesoSystemImagesPath='<?php echo $sysImgPath; ?> '; colesoSystemRicheditPath='<?php echo $richeditPath; ?> '; colesoSkipCookie='skip'; </script> <script language='JavaScript' src="<?php echo $jsPath; ?> calendar_popup.js"> </script> <script language='JavaScript' src="<?php echo $jsPath; ?> coleso_core.js"> </script> <style type='text/css'> div.calendar { position: absolute; visibility: hidden; width: 150px; background-color: #F5EFD6; } div.formerr,span.formerrLabel { font-weight: bold; color: red; } </style> <?php }
public function run() { $shelfTemplateFile = colesoApplication::getConfigVal('/bulldoc/systemTemplates') . 'bookshelf.tset.phtml'; $template = new colesoPHPTemplateSet($shelfTemplateFile); $res = ''; $books = $this->parameters->bookLoader->getBooks(); foreach ($books as $book => $data) { if (isset($data['separatorTitle'])) { $res .= $template->parseItem('separator', array('title' => $data['separatorTitle'])); } else { $data['key'] = $book; if (file_exists($data['source'] . 'pages/cover.png')) { $data['cover'] = 'cover.png'; } elseif (file_exists($data['source'] . 'pages/cover.jpg')) { $data['cover'] = 'cover.jpg'; } else { $data['cover'] = false; } $res .= $template->parseItem('item', $data); } } $html = $template->parseItem('layout', $res); return new colesoControllerExecResult($html); }
protected function saveBook($data, $bookKey) { $text = ''; foreach ($data as $key => $val) { $text .= "{$key}: {$val}\n"; } $bookDir = colesoApplication::getConfigVal('/bulldoc/source') . "{$bookKey}/"; if (file_exists($bookDir)) { throw new bookCreationException('This folder allready exists: ' . $bookDir); } mkdir($bookDir, 0777); mkdir($bookDir . 'pages', 0777); file_put_contents($bookDir . 'book_data.yml', $text); $tocText = 'introduction.html: ' . colesoApplication::getMessage('bulldoc', 'introduction'); file_put_contents($bookDir . 'toc.yml', $tocText); }
function getCacheFileName() { return colesoApplication::getConfigVal('/system/cacheDir') . "bulldoc/bulldoc_book/book_index.cache"; }
function colesoCache() { $this->filePath = colesoApplication::getConfigVal('/system/cacheDir'); }
public function getStructureHolder() { $cacheFile = colesoApplication::getConfigVal('/system/cacheDir') . "bulldoc/{$this->bookKey}/toc.cache"; $TOC = colesoYMLLoader::load($this->tocFileName, $cacheFile); $structureHolder = new structureHolder($TOC); return $structureHolder; }
public function __construct() { parent::__construct(); $this->title = ''; $this->encoding = colesoApplication::getConfigVal('/system/lngEncoding'); }
static function getTokenKey() { return colesoApplication::getConfigVal('/system/tokenName', 'colesoToken'); }
static function formGetDateOrder() { return colesoApplication::getConfigVal('/form/FormDateOrder'); }
function colesoControlLoginSession() { $this->dbConn = colesoDB::getConnection(); $this->tPrefix = colesoApplication::getConfigVal('/system/db/tablePrefix'); $this->environment = colesoApplication::getEnvironment(); //obsolete ref }
function readController($fileName) { $prefix = colesoApplication::getConfigVal('/system/db/tablePrefix'); require $fileName; $this->packages[$CONFIG['keyword']] = array('title' => $CONFIG['name'], 'keyword' => $CONFIG['keyword'], 'tables' => $CONFIG['tables'], 'file' => $fileName, 'dump' => dirname($fileName) . '/dump.sql'); }
<?php colesoApplication::loadMessages('bulldoc/messages'); require_once 'coleso/toolkit/toolkit.php'; require_once 'coleso/locale_strings/strings.php'; require_once 'bulldoc/exceptions.php'; require_once 'bulldoc/path_builder.php'; require_once 'bulldoc/page_builder.php'; require_once 'bulldoc/book_loader.php'; $configSet = colesoApplication::getConfigVal('/system/localConfig'); colesoApplication::setConfigVal('/bulldoc/themeDir', colesoApplication::getConfigVal('/system/docRoot') . 'workshop/themes/'); colesoApplication::setConfigVal('/bulldoc/themeUrl', colesoApplication::getConfigVal('/system/urlRoot') . 'workshop/themes/'); colesoApplication::setConfigVal('/bulldoc/output', colesoApplication::getConfigVal('/system/docRoot') . 'workshop/output/'); colesoApplication::setConfigVal('/bulldoc/rootUrl', colesoApplication::getConfigVal('/system/urlRoot')); colesoApplication::setConfigVal('/bulldoc/systemTemplates', colesoApplication::getConfigVal('/system/docRoot') . 'workshop/themes/system/'); colesoApplication::setConfigVal('/bulldoc/rootIndexLevel', 2); //--------------------------------------------------------------------------------------------------- $customSource = $configSet->get('bulldoc::source', colesoApplication::getConfigVal('/system/docRoot') . 'workshop/source/'); colesoApplication::setConfigVal('/bulldoc/source', rtrim($customSource, '\\/') . '/'); //--------------------------------------------------------------------------------------------------- $customBookShelf = $configSet->get('bulldoc::bookshelf', colesoApplication::getConfigVal('/system/docRoot') . 'workshop/source/bookshelf.yml'); colesoApplication::setConfigVal('/bulldoc/bookshelfConfig', $customBookShelf); //--------------------------------------------------------------------------------------------------- $customTextProcessingClass = $configSet->get('bulldoc::defaultTextProcessingClass', 'docTemplateSet'); colesoApplication::setConfigVal('/bulldoc/textProcessingClass', $customTextProcessingClass); //--------------------------------------------------------------------------------------------------- $customDefaultTheme = $configSet->get('bulldoc::defaultTheme', 'blueprint'); colesoApplication::setConfigVal('/bulldoc/defaultTheme', $customDefaultTheme); //for standalone bulldoc application colesoApplication::setConfigVal('/system/useStandaloneTheme', true);
function getPageFileName() { return colesoApplication::getConfigVal('/bulldoc/bookshelfConfig'); }
private function getContent($pathBuilder) { $templateClass = colesoApplication::getConfigVal('/bulldoc/textProcessingClass'); $t = new $templateClass(); $t->setOutputMode($this->book->getOutputMode()); $fileName = $this->sourcePath . $pathBuilder; $params = array('root' => $pathBuilder->getRootPath(), 'path' => $pathBuilder, 'structure' => $this->structureHolder); $pageData = $this->structureHolder->getPage($pathBuilder); if ($pathBuilder->isIndex()) { $content = ''; if (file_exists($fileName)) { $content .= $t->parseFile($fileName, $params); } $content .= $this->navTemplate->parseItem('toc', $this->buildIndex($pathBuilder)); return $content; } elseif ($pageData['type'] == 'index') { $myIndexBuilder = new IndexBuilder($this->sourcePath, $this->structureHolder->getToc()); $myIndexRender = new IndexRender($myIndexBuilder, $this->book, $this->themeManager); return $myIndexRender->render($pathBuilder); } elseif (file_exists($fileName)) { return $t->parseFile($fileName, $params); } else { return colesoApplication::getMessage('bulldoc', 'underconstruction'); } }
private function getIndexCacheFileName() { return colesoApplication::getConfigVal('/system/cacheDir') . "bulldoc/{$this->bookKey}/book_index.cache"; }
function setTestTokenReq() { $tokenKey = colesoApplication::getConfigVal('/system/tokenName'); $this->setReqVar($tokenKey, 'test_env_token'); }
function getEscapedValue() { $name = $this->params['originalName']; $value = isset($this->formPtr->fields[$name]) ? $this->formPtr->fields[$name] : ''; return htmlspecialchars($value, ENT_QUOTES, colesoApplication::getConfigVal('/system/lngEncoding')); }
function errdie($errno = 0) { if (!colesoApplication::getConfigVal('/system/errorReporting/DisplayErrors')) { echo file_get_contents(colesoApplication::getConfigVal('/system/errorReporting/ErrTemplate')); } die; }
private function getTopSection() { return array('curSection' => false, 'parentSection' => null, 'upTitle' => array(), 'curTitle' => colesoApplication::getMessage('bulldoc', 'toc'), 'level' => colesoApplication::getConfigVal('/bulldoc/rootIndexLevel')); }
function getRoutingPath() { $rootURL = rtrim(colesoApplication::getConfigVal('/system/urlRoot'), '\\/'); $currentURL = $this->Environment->getReqVar('colesoRequestPath'); $trimmedURL = str_replace($rootURL, '', $currentURL); //only needed if mod_rewrite is not used $trimmedURL = str_replace($this->defaultPageName, '', $trimmedURL); $trimmedURL = ltrim($trimmedURL, '\\/'); $URL = '/' . $trimmedURL; return $URL; }