Skip to content

Commit 8f06223

Browse files
committed
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
1 parent 7304754 commit 8f06223

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

lib/plugins-display.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
$onLoadExtras = "";
3+
$pluginsDisplay = "";
4+
5+
// Show plugins
6+
if ($_SESSION['loggedIn']) {
7+
// Work out the plugins to display to the user
8+
$pluginsDisplay = "";
9+
for ($i=0;$i<count($ICEcoder["plugins"]);$i++) {
10+
$target = explode(":",$ICEcoder["plugins"][$i][4]);
11+
$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>';
12+
};
13+
14+
// If we're updating plugins, update those shown
15+
if (isset($_GET['updatedPlugins'])) {
16+
echo "<script>top.document.getElementById('pluginsOptional').innerHTML = '".$pluginsDisplay."';</script>";
17+
}
18+
19+
// Work out what plugins we'll need to set on a setInterval
20+
$onLoadExtras = "";
21+
for ($i=0;$i<count($ICEcoder["plugins"]);$i++) {
22+
if ($ICEcoder["plugins"][$i][5]!="") {
23+
$onLoadExtras .= ";top.ICEcoder.startPluginIntervals(".$i.",'".$ICEcoder["plugins"][$i][3]."','".$ICEcoder["plugins"][$i][4]."','".$ICEcoder["plugins"][$i][5]."')";
24+
};
25+
};
26+
27+
// If we're updating our plugins, clear existing setIntervals & the array refs, then start new ones
28+
if (isset($_GET['updatedPlugins'])) {
29+
?>
30+
<script>
31+
for (i=0;i<=top.ICEcoder.pluginIntervalRefs.length-1;i++) {
32+
clearInterval(top.ICEcoder['plugTimer'+top.ICEcoder.pluginIntervalRefs[i]]);
33+
}
34+
top.ICEcoder.pluginIntervalRefs = [];
35+
<?php echo $onLoadExtras.PHP_EOL; ?>
36+
</script>
37+
<?php
38+
}
39+
}
40+
?>

0 commit comments

Comments
 (0)