X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2FPlugins.php;h=120e22c9376628f8ad23ed6be44cbd26952f1ed8;hb=7aff44b2a3193e43aedfd7bf7fc3801bcffcf3e0;hp=181db12e4e2378f74ce48c663ae7de82f7eaf09a;hpb=16e8fac27cb4f25e8fcfcb30358d5486b4d8f809;p=diogenes.git
diff --git a/include/Plugins.php b/include/Plugins.php
index 181db12..120e22c 100644
--- a/include/Plugins.php
+++ b/include/Plugins.php
@@ -61,6 +61,7 @@ class Diogenes_Plugins
return $cachefile;
}
+
/** Return the cache entry for specified plugin
*
* @param $cache
@@ -75,27 +76,6 @@ class Diogenes_Plugins
}
- /** Return the cache entry for a plugin at a specified position
- *
- * @param $cache
- * @param $barrel
- * @param $page
- * @param $pos
- */
- function cacheGetAtPos($cache, $barrel, $page, $pos)
- {
- $p_node = $this->cacheGetPageNode($cache, $barrel, $page);
- foreach ($p_node->data as $plugname => $plugentry)
- {
- if ($plugentry['pos'] == $pos)
- {
- $plugentry['plugin'] = $plugname;
- return $plugentry;
- }
- }
- }
-
-
/** Return the cache entry for specified plugin
*
* @param $cache
@@ -120,16 +100,16 @@ class Diogenes_Plugins
* @param $barrel
* @param $page
*/
- function cachedActive($cache, $barrel, $page)
+ function cacheGetActive($cache, $barrel, $page)
{
$p_node = $this->cacheGetPageNode($cache, $barrel, $page);
$plugins = array();
foreach ($p_node->data as $plugname => $plugentry)
{
- //echo "cachedEditable : examining $plugname (status {$plugentry['status']})
\n";
+ //echo "cacheGetActive : examining $plugname (status {$plugentry['status']})
\n";
if ($plugentry['status'] & PLUG_ACTIVE)
{
- //echo "cachedActive : adding $plugname
\n";
+ //echo "cacheGetActive : adding $plugname
\n";
$plugins[$plugname] = $plugentry;
}
}
@@ -144,23 +124,10 @@ class Diogenes_Plugins
* @param $barrel
* @param $page
*/
- function cachedVisible($cache, $barrel, $page)
+ function cacheGetVisible($cache, $barrel, $page)
{
$p_node = $this->cacheGetPageNode($cache, $barrel, $page);
return $p_node->data;
-/*
- $available = array();
- foreach ($p_node->data as $plugname => $plugentry)
- {
- //echo "cachedEditable : examining $plugname (status {$plugentry['status']})
\n";
- if (!($plugentry['status'] & PLUG_LOCK) || !$barrel)
- {
- //echo "cachedEditable : adding $plugname
\n";
- $available[$plugname] = $plugentry;
- // }
- }
- return $available;
-*/
}
@@ -197,10 +164,9 @@ class Diogenes_Plugins
{
//echo "* plugin '$plugin' not locked off parent level
\n";
$outval = $parentval;
- if (is_array($node->data[$plugin]))
+ if ((is_array($node->data[$plugin])) && ($node->data[$plugin]['status'] & PLUG_SET))
{
//echo "** plugin set at current level
\n";
- $outval['pos'] = $node->data[$plugin]['pos'];
$outval['params'] = $node->data[$plugin]['params'];
if (!($parentval['status'] & PLUG_LOCK)) {
//echo "*** plugin status set to DB-specified value
\n";
@@ -262,7 +228,7 @@ class Diogenes_Plugins
$dbcache = array();
$sql_limit = $barrel ? " where barrel='{$barrel}' or barrel=''" : "";
- $sql = "select barrel, page, plugin, status, pos, params from diogenes_plugin" . $sql_limit;
+ $sql = "select barrel, page, plugin, status, params from diogenes_plugin" . $sql_limit;
$res = $this->dbh->query($sql);
while($row = mysql_fetch_row($res))
{
@@ -271,8 +237,7 @@ class Diogenes_Plugins
$plugin = array_shift($row);
$plugentry = array(
'status' => $row[0],
- 'pos' => $row[1],
- 'params' => ($row[2] ? var_decode_bin($row[2]) : array())
+ 'params' => ($row[1] ? var_decode_bin($row[1]) : array())
);
$plug_h = $this->load($plugin, $plugentry);
//echo "Got params from DB for '$plugin', barrel '$c_barrel', page '$c_page' : ".$row[2]."
";
@@ -343,9 +308,6 @@ class Diogenes_Plugins
if (is_array($plugentry))
$plug_h->fromArray($plugentry);
- $plug_log = $plug_h->toArray();
- //$pluglog['name'] = 'foo';
- array_push($this->log, $plug_log);
return $plug_h;
}
@@ -375,9 +337,7 @@ class Diogenes_Plugins
{
$trclass = $odd ? ' class="odd"' : '';
$out .= "