9b61957154
- [doc getting-started:installation], or - [doc getting-started:installation Custom link text] - Updated Text_Wiki to 1.2.0 - Documentation should now pass XHTML validator - Formatted DSN section so that it's easier on eyes - The single quotes in <code type='php'> won't work anymore due to the Text_Wiki update. Use double quotes instead: <code type="php">. The single quotes have been converted to double quotes in documentation files. - Modified the links in h1-h6 headings to use the same style as the headings. - Some refactoring
85 lines
2.1 KiB
PHP
85 lines
2.1 KiB
PHP
<?php
|
|
error_reporting(E_ALL);
|
|
|
|
$includePath = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'vendor'
|
|
. PATH_SEPARATOR . dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lib';
|
|
|
|
set_include_path($includePath);
|
|
|
|
require_once('Sensei/Sensei.php');
|
|
require_once('DocTool.php');
|
|
require_once('Cache.php');
|
|
|
|
spl_autoload_register(array('Sensei', 'autoload'));
|
|
|
|
// Executes the 'svn info' command for the current directory and parses the last
|
|
// changed revision.
|
|
$revision = 0;
|
|
exec('svn info .', $output);
|
|
foreach ($output as $line) {
|
|
if (preg_match('/^Last Changed Rev: ([0-9]+)$/', $line, $matches)) {
|
|
$revision = $matches[1];
|
|
break;
|
|
}
|
|
}
|
|
|
|
$cacheDir = './cache/';
|
|
$cacheRevFile = $cacheDir . 'revision.txt';
|
|
$cacheRev = 0;
|
|
|
|
$cache = new Cache($cacheDir, 'cache');
|
|
|
|
// Checks the revision cache files were created from
|
|
if (file_exists($cacheRevFile)) {
|
|
$cacheRev = (int) file_get_contents($cacheRevFile);
|
|
}
|
|
|
|
// Empties the cache directory and saves the current revision to a file, if SVN
|
|
// revision is greater than cache revision
|
|
if ($revision > $cacheRev) {
|
|
$cache->clear();
|
|
@file_put_contents($cacheRevFile, $revision);
|
|
}
|
|
|
|
|
|
if ($cache->begin()) {
|
|
|
|
$tool = new DocTool('docs/en.txt');
|
|
// $tool->setOption('clean-url', true);
|
|
|
|
$baseUrl = '';
|
|
$title = 'Doctrine Manual';
|
|
$section = null;
|
|
|
|
if (isset($_GET['chapter'])) {
|
|
$section = $tool->findByPath($_GET['chapter']);
|
|
if ($tool->getOption('clean-url')) {
|
|
$baseUrl = '../';
|
|
}
|
|
}
|
|
|
|
if (isset($_GET['one-page'])) {
|
|
$tool->setOption('one-page', true);
|
|
$tool->setOption('max-level', 0);
|
|
$section = null;
|
|
$baseUrl = '';
|
|
}
|
|
|
|
if ($section) {
|
|
while ($section->getLevel() > 1) {
|
|
$section = $section->getParent();
|
|
}
|
|
|
|
$tool->setOption('section', $section);
|
|
$title .= ' - Chapter ' . $section->getIndex() . ' ' . $section->getName();
|
|
}
|
|
|
|
if ($tool->getOption('clean-url')) {
|
|
$tool->setOption('base-url', $baseUrl);
|
|
}
|
|
|
|
include 'template.php';
|
|
|
|
$cache->end();
|
|
}
|