Browse Source

Repositories: include templates

master
Stephan Bösch-Plepelits 7 years ago
parent
commit
ceba05da22
  1. 1
      src/RepositoryBase.php
  2. 4
      src/RepositoryDir.php
  3. 4
      src/RepositoryGit.php

1
src/RepositoryBase.php

@ -26,6 +26,7 @@ class RepositoryBase {
function data () {
$data = array(
'categories' => array(),
'templates' => array(),
'timestamp' => Date(DATE_ISO8601, $this->timestamp()),
);

4
src/RepositoryDir.php

@ -28,6 +28,10 @@ class RepositoryDir extends RepositoryBase {
$data['categories'][$m[1]] = jsonMultilineStringsJoin($d1, array('exclude' => array(array('const'))));
}
if (preg_match("/^(detailsBody|popupBody).html$/", $f, $m)) {
$data['templates'][$m[1]] = file_get_contents("{$this->path}/{$f}");
}
}
closedir($d);

4
src/RepositoryGit.php

@ -27,6 +27,10 @@ class RepositoryGit extends RepositoryBase {
$data['categories'][$id] = jsonMultilineStringsJoin($d1, array('exclude' => array(array('const'))));
}
if (preg_match("/^[0-9]{6} blob [0-9a-f]{40}\t((detailsBody|popupBody)\.html)$/", $r, $m)) {
$data['templates'][$m[2]] = shell_exec("cd " . escapeShellArg($this->path) . "; git show HEAD:" . escapeShellArg($m[1]));
}
}
pclose($d);

Loading…
Cancel
Save