Files
ICEcoder/lib/plugins-display.php
Matt Pass 8f06223c07 Display of plugins now handled here
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
2014-01-11 15:36:27 +00:00

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
}
}
?>