mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 23:34:01 +01:00
Handled here rather than in settings.php file $onLoadExtras = ""; and $pluginsDisplay = ""; also set here No need to recreate the plugins array from POST'd values, now picked up from a page load If isset($_GET['updatedPlugins']) then update the new pluginsOptional DIV innerHTML, no need to also check if the DIV exists Also restart the plugin intervals upon $_GET['updatedPlugins'] No longer tacking content visibility onto $onLoadExtras
40 lines
1.5 KiB
PHP
40 lines
1.5 KiB
PHP
<?php
|
|
$onLoadExtras = "";
|
|
$pluginsDisplay = "";
|
|
|
|
// Show plugins
|
|
if ($_SESSION['loggedIn']) {
|
|
// Work out the plugins to display to the user
|
|
$pluginsDisplay = "";
|
|
for ($i=0;$i<count($ICEcoder["plugins"]);$i++) {
|
|
$target = explode(":",$ICEcoder["plugins"][$i][4]);
|
|
$pluginsDisplay .= '<a href="'.$ICEcoder["plugins"][$i][3].'" title="'.$ICEcoder["plugins"][$i][0].'" target="'.$target[0].'"><img src="'.$ICEcoder["plugins"][$i][1].'" style="'.$ICEcoder["plugins"][$i][2].'" alt="'.$ICEcoder["plugins"][$i][0].'"></a><br><br>';
|
|
};
|
|
|
|
// If we're updating plugins, update those shown
|
|
if (isset($_GET['updatedPlugins'])) {
|
|
echo "<script>top.document.getElementById('pluginsOptional').innerHTML = '".$pluginsDisplay."';</script>";
|
|
}
|
|
|
|
// Work out what plugins we'll need to set on a setInterval
|
|
$onLoadExtras = "";
|
|
for ($i=0;$i<count($ICEcoder["plugins"]);$i++) {
|
|
if ($ICEcoder["plugins"][$i][5]!="") {
|
|
$onLoadExtras .= ";top.ICEcoder.startPluginIntervals(".$i.",'".$ICEcoder["plugins"][$i][3]."','".$ICEcoder["plugins"][$i][4]."','".$ICEcoder["plugins"][$i][5]."')";
|
|
};
|
|
};
|
|
|
|
// If we're updating our plugins, clear existing setIntervals & the array refs, then start new ones
|
|
if (isset($_GET['updatedPlugins'])) {
|
|
?>
|
|
<script>
|
|
for (i=0;i<=top.ICEcoder.pluginIntervalRefs.length-1;i++) {
|
|
clearInterval(top.ICEcoder['plugTimer'+top.ICEcoder.pluginIntervalRefs[i]]);
|
|
}
|
|
top.ICEcoder.pluginIntervalRefs = [];
|
|
<?php echo $onLoadExtras.PHP_EOL; ?>
|
|
</script>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|