1
0
www.mikescher.com/www/internals/fragments.php

140 lines
3.2 KiB
PHP
Raw Permalink Normal View History

2020-01-15 02:50:23 +01:00
<?php
class Fragments
{
2020-01-17 00:25:29 +01:00
private function evalFragment($name, $url, $params)
{
try
{
ob_start();
{
global $FRAGMENT_PARAM;
$FRAGMENT_PARAM = $params;
/** @noinspection PhpIncludeInspection */
include (__DIR__ . '/../fragments/' . $url);
}
return ob_get_contents();
}
finally
{
ob_end_clean();
}
}
2020-01-15 02:50:23 +01:00
public function PanelEuler()
{
2020-01-17 00:25:29 +01:00
return $this->evalFragment('PanelEuler', 'panel_euler.php', [ ]);
2020-01-15 02:50:23 +01:00
}
public function PanelPrograms()
{
2020-01-17 00:25:29 +01:00
return $this->evalFragment('PanelPrograms', 'panel_programs.php', [ ]);
2020-01-15 02:50:23 +01:00
}
public function PanelBlog()
{
2020-01-17 00:25:29 +01:00
return $this->evalFragment('PanelBlog', 'panel_blog.php', [ ]);
2020-01-15 02:50:23 +01:00
}
public function PanelBooks()
{
2020-01-17 00:25:29 +01:00
return $this->evalFragment('PanelBooks', 'panel_books.php', [ ]);
2020-01-15 02:50:23 +01:00
}
public function PanelAdventOfCode()
{
2020-01-17 00:25:29 +01:00
return $this->evalFragment('PanelAdventOfCode', 'panel_aoc.php', [ ]);
2020-01-15 02:50:23 +01:00
}
public function PanelAdventOfCodeCalendar(int $year, bool $shownav, bool $linkheader, bool $ajax, bool $frame=true, $frameid=null)
{
2020-01-17 00:25:29 +01:00
return $this->evalFragment('PanelAdventOfCodeCalendar', 'panel_aoc_calendar.php',
[
'year' => $year,
'nav' => $shownav,
'linkheader' => $linkheader,
'ajax' => $ajax,
'frame' => $frame,
'frameid' => ($frameid == null) ? ('aoc_frame_' . getRandomToken(16)) : $frameid,
]);
2020-01-15 02:50:23 +01:00
}
2020-01-16 10:50:18 +01:00
public function BlogviewPlain(array $blogpost)
{
2020-01-17 00:25:29 +01:00
return $this->evalFragment('BlogviewPlain', 'blogview_plain.php',
[
'blogpost' => $blogpost,
]);
2020-01-16 10:50:18 +01:00
}
public function BlogviewMarkdown(array $blogpost)
{
2020-01-17 00:25:29 +01:00
return $this->evalFragment('BlogviewMarkdown', 'blogview_markdown.php',
[
'blogpost' => $blogpost,
]);
2020-01-16 10:50:18 +01:00
}
public function BlogviewHTML(array $blogpost)
{
return $this->evalFragment('BlogviewHTML', 'blogview_html.php',
[
'blogpost' => $blogpost,
]);
}
2020-01-16 10:50:18 +01:00
public function BlogviewEulerList(array $blogpost)
{
2020-01-17 00:25:29 +01:00
return $this->evalFragment('BlogviewEulerList', 'blogview_euler_list.php',
[
'blogpost' => $blogpost,
]);
2020-01-16 10:50:18 +01:00
}
public function BlogviewEulerSingle(array $blogpost, string $subview)
{
2020-01-17 00:25:29 +01:00
return $this->evalFragment('BlogviewEulerSingle', 'blogview_euler_single.php',
[
'blogpost' => $blogpost,
'subview' => $subview,
]);
2020-01-16 10:50:18 +01:00
}
public function BlogviewAdventOfCodeList(array $blogpost)
{
2020-01-17 00:25:29 +01:00
return $this->evalFragment('BlogviewAdventOfCodeList', 'blogview_aoc_list.php',
[
'blogpost' => $blogpost,
]);
2020-01-16 10:50:18 +01:00
}
public function BlogviewAdventOfCodeSingle(array $blogpost, string $subview)
{
2020-01-17 00:25:29 +01:00
return $this->evalFragment('BlogviewAdventOfCodeSingle', 'blogview_aoc_single.php',
[
'blogpost' => $blogpost,
'subview' => $subview,
]);
}
public function WidgetBefunge93(string $code, string $url, bool $interactive, $speed, bool $editable)
2020-01-17 00:25:29 +01:00
{
return $this->evalFragment('WidgetBefunge93', 'widget_befunge93.php',
[
'code' => $code,
'url' => $url,
'interactive' => $interactive,
'speed' => $speed,
'editable' => $editable,
]);
}
public function WidgetBFJoust(string $codeLeft, string $codeRight)
{
return $this->evalFragment('WidgetBFJoust', 'widget_bfjoust.php',
[
'code_left' => $codeLeft,
'code_right' => $codeRight,
]);
2020-01-16 10:50:18 +01:00
}
2020-01-15 02:50:23 +01:00
}