==================== Début du test ====================
<?php
if (!defined('PLX_ROOT')) exit;
plxToken::validateFormToken();
if(filter_has_var(INPUT_POST, $plxPlugin::PARAM1)) {
$value = trim(filter_input(INPUT_POST, $plxPlugin::PARAM1, FILTER_SANITIZE_STRING));
if(array_key_exists($value, $plxPlugin->themes)) {
$plxPlugin->setParam($plxPlugin::PARAM1, $value, 'string');
$plxPlugin->saveParams();
header('Location: parametres_plugin.php?p='.$plugin);
exit;
}
}
$theme = $plxPlugin->getParam($plxPlugin::PARAM1);
if(empty($theme) or !array_key_exists($theme, $plxPlugin->themes)) {
$theme = 'default';
}
?>
<div id="<?php echo $plugin; ?>-container">
<form id="form_<?php echo $plugin; ?>" method="post">
<?php echo plxToken::getTokenPostMethod(); ?>
<div class="in-action-bar">
<button type="button" id="id_demo" /><?php $plxPlugin->lang('DEMO'); ?></button>
<input type="submit" value="<?php echo L_ARTICLE_UPDATE_BUTTON; ?>" />
</div>
<div class="<?php echo $plugin; ?>">
<label for="id_theme"><?php $plxPlugin->lang('THEME'); ?></label>
<?php plxUtils::printSelect($plxPlugin::PARAM1, $plxPlugin->themes, $theme); ?>
</div>
</form>
<pre class="<?php echo $plugin; ?>"><code class="php hljs"><?php echo strtr(file_get_contents(__DIR__."/$plugin.php"), array('<'=>'<')); ?></code></pre>
</div>
<a id="id_lnk_demo" href="<?php echo $plxPlugin::URL; ?>build/demo/" target="_blank" style="display: none;"> </a>
<script type="text/javascript">
(function() {
const demoBtn = document.getElementById('id_demo');
demoBtn.addEventListener('click', function(event) {
event.preventDefault();
const lnk = document.getElementById('id_lnk_demo');
if(lnk != null) {
lnk.click();
}
});
function enableStyle(title) {
const styles = document.head.querySelectorAll('link[title]:not([disabled])');
for(var i=0, iMax=styles.length; i<iMax; i++) {
const el = styles[i].disabled = true;
}
var st = document.head.querySelector('link[title="' + title + '"]');
if(st != null) {
st.disabled = false;
}
}
const theme = document.getElementById('id_<?php echo $plxPlugin::PARAM1; ?>');
theme.addEventListener('change', function(event) {
enableStyle(event.target.value);
});
enableStyle('<?php echo $theme; ?>');
document.addEventListener('load', function(event) {
console.log(hljs.listLanguages());
});
})();
</script>
==================== Fin du test ====================