mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-10-01 01:26:10 -04:00
turned bootstrap template variants into logic
This commit is contained in:
parent
87fad1fb77
commit
67f6c4eb61
@ -31,7 +31,7 @@ defaultformatter = "plaintext"
|
|||||||
; size limit per paste or comment in bytes, defaults to 2 Mebibytes
|
; size limit per paste or comment in bytes, defaults to 2 Mebibytes
|
||||||
sizelimit = 2097152
|
sizelimit = 2097152
|
||||||
|
|
||||||
; template to include, default is "bootstrap" (tpl/bootstrap.html)
|
; template to include, default is "bootstrap" (tpl/bootstrap.php)
|
||||||
template = "bootstrap"
|
template = "bootstrap"
|
||||||
|
|
||||||
; (optional) notice to display
|
; (optional) notice to display
|
||||||
|
@ -52,7 +52,8 @@ class View
|
|||||||
*/
|
*/
|
||||||
public function draw($template)
|
public function draw($template)
|
||||||
{
|
{
|
||||||
$path = PATH . 'tpl' . DIRECTORY_SEPARATOR . $template . '.php';
|
$file = substr($template, 0, 9) === 'bootstrap' ? 'bootstrap' : $template;
|
||||||
|
$path = PATH . 'tpl' . DIRECTORY_SEPARATOR . $file . '.php';
|
||||||
if (!file_exists($path)) {
|
if (!file_exists($path)) {
|
||||||
throw new Exception('Template ' . $template . ' not found!', 80);
|
throw new Exception('Template ' . $template . ' not found!', 80);
|
||||||
}
|
}
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
<?php
|
|
||||||
$tpl = 'bootstrap-compact-page';
|
|
||||||
include 'bootstrap.php';
|
|
@ -1,3 +0,0 @@
|
|||||||
<?php
|
|
||||||
$tpl = 'bootstrap-compact';
|
|
||||||
include 'bootstrap.php';
|
|
@ -1,3 +0,0 @@
|
|||||||
<?php
|
|
||||||
$tpl = 'bootstrap-dark-page';
|
|
||||||
include 'bootstrap.php';
|
|
@ -1,3 +0,0 @@
|
|||||||
<?php
|
|
||||||
$tpl = 'bootstrap-dark';
|
|
||||||
include 'bootstrap.php';
|
|
@ -1,3 +0,0 @@
|
|||||||
<?php
|
|
||||||
$tpl = 'bootstrap-page';
|
|
||||||
include 'bootstrap.php';
|
|
@ -1,9 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
use PrivateBin\I18n;
|
use PrivateBin\I18n;
|
||||||
if (!isset($tpl)) $tpl = 'bootstrap';
|
$isCpct = substr($template, 9, 8) === '-compact';
|
||||||
$isCpct = substr($tpl, 9, 8) === '-compact';
|
$isDark = substr($template, 9, 5) === '-dark';
|
||||||
$isDark = substr($tpl, 9, 5) === '-dark';
|
$isPage = substr($template, -5) === '-page';
|
||||||
$isPage = substr($tpl, -5) === '-page';
|
|
||||||
?><!DOCTYPE html>
|
?><!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
@ -67,6 +67,25 @@ class ViewTest extends PHPUnit_Framework_TestCase
|
|||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// check bootstrap variants
|
||||||
|
$template = 'bootstrap-page';
|
||||||
|
ob_start();
|
||||||
|
$page->draw($template);
|
||||||
|
$this->_content[$template] = ob_get_contents();
|
||||||
|
ob_end_clean();
|
||||||
|
foreach (array('-dark', '-compact') as $suffix) {
|
||||||
|
$template = 'bootstrap' . $suffix;
|
||||||
|
ob_start();
|
||||||
|
$page->draw($template);
|
||||||
|
$this->_content[$template] = ob_get_contents();
|
||||||
|
ob_end_clean();
|
||||||
|
|
||||||
|
$template .= '-page';
|
||||||
|
ob_start();
|
||||||
|
$page->draw($template);
|
||||||
|
$this->_content[$template] = ob_get_contents();
|
||||||
|
ob_end_clean();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
|
Loading…
Reference in New Issue
Block a user