2018-01-01 23:03:05 +01:00
|
|
|
<?php
|
2020-01-17 00:25:29 +01:00
|
|
|
require_once (__DIR__ . '/../internals/website.php');
|
2018-01-01 23:03:05 +01:00
|
|
|
|
2020-01-17 00:25:29 +01:00
|
|
|
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
|
|
|
/** @var URLRoute $ROUTE */ global $ROUTE;
|
|
|
|
/** @var Website $SITE */ global $SITE;
|
2018-01-03 00:08:42 +01:00
|
|
|
|
2020-01-17 00:25:29 +01:00
|
|
|
global $FRAGMENT_PARAM;
|
|
|
|
/** @var array $parameter */
|
|
|
|
$parameter = $FRAGMENT_PARAM;
|
2018-01-01 23:03:05 +01:00
|
|
|
|
2020-01-17 00:25:29 +01:00
|
|
|
|
|
|
|
$code = $parameter['code'];
|
|
|
|
$url = $parameter['url'];
|
|
|
|
$interactive = $parameter['interactive'];
|
|
|
|
$initspeed = $parameter['speed'];
|
|
|
|
$editable = $parameter['editable'];
|
|
|
|
|
|
|
|
function fmtBef($str)
|
|
|
|
{
|
2018-01-02 00:25:09 +01:00
|
|
|
$str = htmlspecialchars($str);
|
2018-01-03 00:55:15 +01:00
|
|
|
$str = str_replace("\r", "", $str);
|
2018-01-02 00:25:09 +01:00
|
|
|
$str = join("\n", array_map(function($p){return rtrim($p);}, explode("\n", $str)));
|
|
|
|
$str = str_replace(' ', ' ', $str);
|
|
|
|
$str = nl2br($str);
|
2018-01-02 17:11:15 +01:00
|
|
|
$str = str_replace("\r", '', $str);
|
|
|
|
$str = str_replace("\n", '', $str);
|
2018-01-02 00:25:09 +01:00
|
|
|
return $str;
|
|
|
|
}
|
2018-01-01 23:03:05 +01:00
|
|
|
|
|
|
|
$result = '';
|
|
|
|
|
2018-01-03 00:08:42 +01:00
|
|
|
|
2020-01-17 00:25:29 +01:00
|
|
|
if ($interactive)
|
|
|
|
{
|
2018-01-03 00:08:42 +01:00
|
|
|
$speed_attr = '';
|
|
|
|
if (isset($initspeed) && $initspeed != NULL && $initspeed>0) $speed_attr = ' data-b93rnr_initialspeed="'.$initspeed.'" ';
|
|
|
|
$code_attr = '';
|
|
|
|
$code_attr = 'data-b93rnr_code="' . base64_encode($code) . '"';
|
|
|
|
|
|
|
|
$result .= '<div class="bce_code b93rnr_base" ' . $speed_attr . '>' . "\n";
|
|
|
|
$result .= ' <div class="bce_code_data b93rnr_data" '.$code_attr.'>' . fmtBef($code) . '</div>' . "\n";
|
|
|
|
$result .= ' <textarea class="bce_code_editarea b93rnr_editarea generic_collapsed"></textarea>' . "\n";
|
2018-01-02 00:25:09 +01:00
|
|
|
$result .= ' <div class="bce_code_ctrl">' . "\n";
|
2018-01-01 23:03:05 +01:00
|
|
|
$result .= ' <div class="ctrl_btn_left">' . "\n";
|
2018-01-02 19:41:41 +01:00
|
|
|
$result .= ' <div class="ctrl_btn_group">' . "\n";
|
|
|
|
$result .= ' <div class="ctrl_btn ctrl_btn_ll b93rnr_start">Start</div>' . "\n";
|
2018-01-03 00:08:42 +01:00
|
|
|
$result .= ' <div class="ctrl_btn ctrl_btn_rr b93rnr_speed">??</div>' . "\n";
|
2018-01-02 19:41:41 +01:00
|
|
|
$result .= ' </div>' . "\n";
|
2018-01-02 00:25:09 +01:00
|
|
|
$result .= ' <div class="ctrl_btn b93rnr_pause ctrl_btn_disabled">Pause</div>' . "\n";
|
|
|
|
$result .= ' <div class="ctrl_btn b93rnr_reset ctrl_btn_disabled">Reset</div>' . "\n";
|
2018-01-01 23:03:05 +01:00
|
|
|
$result .= ' </div>' . "\n";
|
2018-01-03 00:08:42 +01:00
|
|
|
$result .= ' <div class="ctrl_btn_right">' . "\n";
|
|
|
|
if ($editable && $interactive) $result .= ' <div class="ctrl_btn b93rnr_edit">Edit</div>' . "\n";
|
|
|
|
if ($url !== '') $result .= ' <a class="ctrl_btn" href="' . $url . '" download target="_blank">Download</a>' . "\n";
|
|
|
|
$result .= ' </div>' . "\n";
|
2018-01-02 00:25:09 +01:00
|
|
|
$result .= ' </div>' . "\n";
|
2018-01-03 00:08:42 +01:00
|
|
|
$result .= ' <div class="bce_code_out b93rnr_outpanel generic_collapsed">' . "\n";
|
2018-01-02 19:41:41 +01:00
|
|
|
$result .= ' <div class="bce_code_out_left">' . "\n";
|
|
|
|
$result .= ' <b>Output:</b>' . "\n";
|
|
|
|
$result .= ' <div class="bce_code_out_text b93rnr_output"></div>' . "\n";
|
|
|
|
$result .= ' </div>' . "\n";
|
|
|
|
$result .= ' <div class="bce_code_out_right">' . "\n";
|
|
|
|
$result .= ' <span><b>Stack:</b> <i class="b93rnr_stacksize">(0)</i></span>' . "\n";
|
|
|
|
$result .= ' <div class="bce_code_out_stack b93rnr_stack"></div>' . "\n";
|
|
|
|
$result .= ' </div>' . "\n";
|
2018-01-02 00:25:09 +01:00
|
|
|
$result .= ' </div>' . "\n";
|
|
|
|
$result .= '</div>' . "\n";
|
|
|
|
|
2020-01-17 00:25:29 +01:00
|
|
|
$FRAME_OPTIONS->addScript("/data/javascript/blogpost_bef93runner.js", false);
|
2018-01-01 23:03:05 +01:00
|
|
|
}
|
2018-01-02 00:25:09 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$result .= '<div class="bce_code">' . "\n";
|
2018-01-03 00:08:42 +01:00
|
|
|
$result .= ' <div class="bce_code_data">' . fmtBef($code) . '</div>' . "\n";
|
2018-01-02 00:25:09 +01:00
|
|
|
$result .= ' <div class="bce_code_ctrl">' . "\n";
|
2018-01-03 00:08:42 +01:00
|
|
|
$result .= ' <div class="ctrl_btn_right">' . "\n";
|
|
|
|
if ($url !== '') $result .= ' <a class="ctrl_btn" href="' . $url . '" download target="_blank">Download</a>' . "\n";
|
|
|
|
$result .= ' </div>' . "\n";
|
2018-01-02 00:25:09 +01:00
|
|
|
$result .= ' </div>' . "\n";
|
|
|
|
$result .= '</div>' . "\n";
|
2018-01-01 23:03:05 +01:00
|
|
|
}
|
|
|
|
|
2020-01-17 00:25:29 +01:00
|
|
|
echo $result;
|