diff --git a/serendipity_event_linklist/ChangeLog b/serendipity_event_linklist/ChangeLog
index 40fc78d2..820b3b29 100644
--- a/serendipity_event_linklist/ChangeLog
+++ b/serendipity_event_linklist/ChangeLog
@@ -1 +1,11 @@
+2.00
+ - silence cache lite non static PEAR errors on $obj->remove()
+ - minor preparations for the Serendipity 2.0 backend
+ - fix multiple dtree includements using a unique name
+ - add css seperators
+
+1.99.1 - use serendipity_specialchars
+
+1.99 - compat fixes
+
1.98 - remove short tag occurences
diff --git a/serendipity_event_linklist/dtree.js b/serendipity_event_linklist/dtree.js
index c51f4fc9..f4fd46f2 100644
--- a/serendipity_event_linklist/dtree.js
+++ b/serendipity_event_linklist/dtree.js
@@ -11,341 +11,341 @@
// Node object
function Node(id, pid, name, url, title, target, icon, iconOpen, open) {
- this.id = id;
- this.pid = pid;
- this.name = name;
- this.url = url;
- this.title = title;
- this.target = target;
- this.icon = icon;
- this.iconOpen = iconOpen;
- this._io = open || false;
- this._is = false;
- this._ls = false;
- this._hc = false;
- this._ai = 0;
- this._p;
+ this.id = id;
+ this.pid = pid;
+ this.name = name;
+ this.url = url;
+ this.title = title;
+ this.target = target;
+ this.icon = icon;
+ this.iconOpen = iconOpen;
+ this._io = open || false;
+ this._is = false;
+ this._ls = false;
+ this._hc = false;
+ this._ai = 0;
+ this._p;
};
// Tree object
function dTree(objName, img_directory) {
- this.config = {
- target : null,
- folderLinks : true,
- useSelection : true,
- useCookies : true,
- useLines : true,
- useIcons : true,
- useStatusText : false,
- closeSameLevel : false,
- inOrder : false
- }
+ this.config = {
+ target : null,
+ folderLinks : true,
+ useSelection : true,
+ useCookies : true,
+ useLines : true,
+ useIcons : true,
+ useStatusText : false,
+ closeSameLevel : false,
+ inOrder : false
+ }
- this.icon = {
- root : img_directory + '/img/base.gif',
- folder : img_directory + '/img/folder.gif',
- folderOpen : img_directory + '/img/folderopen.gif',
- node : img_directory + '/img/page.gif',
- empty : img_directory + '/img/empty.gif',
- line : img_directory + '/img/line.gif',
- join : img_directory + '/img/join.gif',
- joinBottom : img_directory + '/img/joinbottom.gif',
- plus : img_directory + '/img/plus.gif',
- plusBottom : img_directory + '/img/plusbottom.gif',
- minus : img_directory + '/img/minus.gif',
- minusBottom : img_directory + '/img/minusbottom.gif',
- nlPlus : img_directory + '/img/nolines_plus.gif',
- nlMinus : img_directory + '/img/nolines_minus.gif'
- };
- this.obj = objName;
- this.aNodes = [];
- this.aIndent = [];
- this.root = new Node(-1);
- this.selectedNode = null;
- this.selectedFound = false;
- this.completed = false;
+ this.icon = {
+ root : img_directory + '/img/base.gif',
+ folder : img_directory + '/img/folder.gif',
+ folderOpen : img_directory + '/img/folderopen.gif',
+ node : img_directory + '/img/page.gif',
+ empty : img_directory + '/img/empty.gif',
+ line : img_directory + '/img/line.gif',
+ join : img_directory + '/img/join.gif',
+ joinBottom : img_directory + '/img/joinbottom.gif',
+ plus : img_directory + '/img/plus.gif',
+ plusBottom : img_directory + '/img/plusbottom.gif',
+ minus : img_directory + '/img/minus.gif',
+ minusBottom : img_directory + '/img/minusbottom.gif',
+ nlPlus : img_directory + '/img/nolines_plus.gif',
+ nlMinus : img_directory + '/img/nolines_minus.gif'
+ };
+ this.obj = objName;
+ this.aNodes = [];
+ this.aIndent = [];
+ this.root = new Node(-1);
+ this.selectedNode = null;
+ this.selectedFound = false;
+ this.completed = false;
};
// Adds a new node to the node array
dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) {
- this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open);
+ this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open);
};
// Open/close all nodes
dTree.prototype.openAll = function() {
- this.oAll(true);
+ this.oAll(true);
};
dTree.prototype.closeAll = function() {
- this.oAll(false);
+ this.oAll(false);
};
// Outputs the tree to the page
dTree.prototype.toString = function() {
- var str = '
\n';
- if (document.getElementById) {
- if (this.config.useCookies) this.selectedNode = this.getSelected();
- str += this.addNode(this.root);
- } else str += 'Browser not supported.';
- str += '
';
- if (!this.selectedFound) this.selectedNode = null;
- this.completed = true;
- return str;
+ var str = '\n';
+ if (document.getElementById) {
+ if (this.config.useCookies) this.selectedNode = this.getSelected();
+ str += this.addNode(this.root);
+ } else str += 'Browser not supported.';
+ str += '
';
+ if (!this.selectedFound) this.selectedNode = null;
+ this.completed = true;
+ return str;
};
// Creates the tree structure
dTree.prototype.addNode = function(pNode) {
- var str = '';
- var n=0;
- if (this.config.inOrder) n = pNode._ai;
- for (n; n';
- }
- if (node.url) {
- str += '';
- }
- else if ((!this.config.folderLinks || !node.url) && node._hc && node.pid != this.root.id)
- str += '';
- str += node.name;
- if (node.url || ((!this.config.folderLinks || !node.url) && node._hc)) str += '';
- str += '';
- if (node._hc) {
- str += '';
- str += this.addNode(node);
- str += '
';
- }
- this.aIndent.pop();
- return str;
+ var str = '';
+ if (node._hc) {
+ str += '';
+ str += this.addNode(node);
+ str += '
';
+ }
+ this.aIndent.pop();
+ return str;
};
// Adds the empty and line icons
dTree.prototype.indent = function(node, nodeId) {
- var str = '';
- if (this.root.id != node.pid) {
- for (var n=0; n';
- (node._ls) ? this.aIndent.push(0) : this.aIndent.push(1);
- if (node._hc) {
- str += '';
- } else str += '';
- }
- return str;
+ var str = '';
+ if (this.root.id != node.pid) {
+ for (var n=0; n';
+ (node._ls) ? this.aIndent.push(0) : this.aIndent.push(1);
+ if (node._hc) {
+ str += '';
+ } else str += '';
+ }
+ return str;
};
// Checks if a node has any children and if it is the last sibling
dTree.prototype.setCS = function(node) {
- var lastId;
- for (var n=0; nadd('description', PLUGIN_LINKLIST_DESC);
$propbag->add('event_hooks', array('backend_sidebar_entries_event_display_linklist' => true,
'backend_sidebar_entries' => true,
+ 'backend_sidebar_admin_appearance' => true,
'plugins_linklist_input' => true,
'css' => true,
'plugins_linklist_conf' => true,
'external_plugin' => true
));
$propbag->add('author', 'Matthew Groeninger, Omid Mottaghi Rad');
- $propbag->add('version', '1.99.1');
+ $propbag->add('version', '2.00');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
@@ -128,34 +128,41 @@ class serendipity_event_linklist extends serendipity_event {
break;
case 'backend_sidebar_entries':
- if ($this->get_config('active')=='true') {
- echo '';
- }
+ if ($this->get_config('active')=='true' && $serendipity['version'][0] < 2) {
+ echo "\n".'';
+ }
+ return true;
+ break;
+
+ case 'backend_sidebar_admin_appearance':
+ if ($this->get_config('active')=='true' && $serendipity['version'][0] > 1) {
+ echo "\n".'' . PLUGIN_LINKLIST_ADMINLINK . '';
+ }
+
return true;
break;
case 'css':
- if ($this->get_config('style') == "dtree") {
+ if ($this->get_config('style') == 'dtree') {
$searchstr = '.dtree';
- $filename = "serendipity_event_dtree.css";
+ $filename = 'serendipity_event_dtree.css';
} else {
$searchstr = '.linklist';
- $filename = "serendipity_event_linklist.css";
+ $filename = 'serendipity_event_linklist.css';
}
- if (stristr($eventData, $searchstr)) {
- // class exists in CSS, so a user has customized it and we don't need default
+ if (strpos($eventData, $searchstr)) {
+ // class exists in CSS by another Plugin, or a user has customized it and we don't need default
return true;
break;
- }
- $out = serendipity_getTemplateFile($filename, 'serendipityPath');
- if ($out && $out != $filename) {
- $eventData .= file_get_contents($out);
- } else {
- $eventData .= file_get_contents(dirname(__FILE__) . '/'.$filename);
}
- return true;
+ $tfile = serendipity_getTemplateFile($filename, 'serendipityPath');
+ if (!$tfile || $tfile == $filename) {
+ $tfile = dirname(__FILE__) . '/' . $filename;
+ }
+ echo file_get_contents($tfile);
+ return true;
break;
@@ -164,7 +171,7 @@ class serendipity_event_linklist extends serendipity_event {
$parts = explode('&', $uri_parts[0]);
$uri_part = $parts[0];
switch($uri_part) {
- case 'dtree.js':
+ case 'lldtree.js': // name unique!
header('Content-Type: text/javascript');
echo file_get_contents(dirname(__FILE__).'/dtree.js');
break;
@@ -177,76 +184,78 @@ class serendipity_event_linklist extends serendipity_event {
break;
case 'plugins_linklist_input':
- $eventData['links'] = $this->generate_output(false);
- return true;
+ $eventData['links'] = $this->generate_output(false);
+
+ return true;
break;
case 'plugins_linklist_conf':
- $this->set_config('style', $eventData['style']);
- $this->set_config('display', $eventData['display']);
- $this->set_config('category', $eventData['category']);
- $this->set_config('cache', $eventData['cache']);
+ $this->set_config('style', $eventData['style']);
+ $this->set_config('display', $eventData['display']);
+ $this->set_config('category', $eventData['category']);
+ $this->set_config('cache', $eventData['cache']);
- $eventData['changed'] = 'false';
- if ($eventData['enabled']=='true') {
- if ($this->get_config('active')!='true') {
- $eventData['changed'] = 'true';
- $this->set_config('active','true');
- $this->set_config('active','true');
- $this->set_config('category','custom');
- $q = 'SELECT count(id) FROM '.$serendipity['dbPrefix'].'links';
- $sql = serendipity_db_query($q);
- if ($sql[0][0] == 0) {
- $xml = xml_parser_create('UTF-8');
- xml_parse_into_struct($xml, ''.serendipity_utf8_encode($eventData['links']).'
', $struct, $index);
- xml_parser_free($xml);
- $depth = -1;
- for($level[]=0, $i=1, $j=1; isset($struct[$i]); $i++, $j++){
- if(isset($struct[$i]['type'])){
- if($struct[$i]['type']=='open' && strtolower($struct[$i]['tag'])=='dir'){
- $this->add_cat($this->decode($struct[$i]['attributes']['NAME']),$in_cat[0]);
- $q = 'SELECT categoryid FROM '.$serendipity['dbPrefix'].'link_category where category_name = "'.serendipity_db_escape_string($this->decode($struct[$i]['attributes']['NAME'])).'"';
- $sql = serendipity_db_query($q);
- $in_cat[] = $sql[0][0];
- $depth++;
- } else if($struct[$i]['type']=='close' && strtolower($struct[$i]['tag'])=='dir'){
- $blah = array_pop($in_cat);
- $depth--;
- } else if($struct[$i]['type']=='complete' && strtolower($struct[$i]['tag'])=='link'){
- $this->add_link($this->decode($struct[$i]['attributes']['LINK']),$this->decode($struct[$i]['attributes']['NAME']),$this->decode($struct[$i]['attributes']['DESCRIP']),$in_cat[$depth]);
- }
+ $eventData['changed'] = 'false';
+ if ($eventData['enabled']=='true') {
+ if ($this->get_config('active')!='true') {
+ $eventData['changed'] = 'true';
+ $this->set_config('active','true');
+ $this->set_config('active','true');
+ $this->set_config('category','custom');
+ $q = 'SELECT count(id) FROM '.$serendipity['dbPrefix'].'links';
+ $sql = serendipity_db_query($q);
+ if ($sql[0][0] == 0) {
+ $xml = xml_parser_create('UTF-8');
+ xml_parse_into_struct($xml, ''.serendipity_utf8_encode($eventData['links']).'
', $struct, $index);
+ xml_parser_free($xml);
+ $depth = -1;
+ for($level[]=0, $i=1, $j=1; isset($struct[$i]); $i++, $j++){
+ if (isset($struct[$i]['type'])){
+ if ($struct[$i]['type']=='open' && strtolower($struct[$i]['tag'])=='dir'){
+ $this->add_cat($this->decode($struct[$i]['attributes']['NAME']),$in_cat[0]);
+ $q = 'SELECT categoryid FROM '.$serendipity['dbPrefix'].'link_category where category_name = "'.serendipity_db_escape_string($this->decode($struct[$i]['attributes']['NAME'])).'"';
+ $sql = serendipity_db_query($q);
+ $in_cat[] = $sql[0][0];
+ $depth++;
+ } else if($struct[$i]['type']=='close' && strtolower($struct[$i]['tag'])=='dir'){
+ $blah = array_pop($in_cat);
+ $depth--;
+ } else if($struct[$i]['type']=='complete' && strtolower($struct[$i]['tag'])=='link'){
+ $this->add_link($this->decode($struct[$i]['attributes']['LINK']),$this->decode($struct[$i]['attributes']['NAME']),$this->decode($struct[$i]['attributes']['DESCRIP']),$in_cat[$depth]);
}
}
}
- if ($eventData['cache'] == 'yes') {
- if (@include_once("Cache/Lite.php")) {
- $cache_obj = new Cache_Lite( array('cacheDir' => $serendipity['serendipityPath'].'templates_c/','automaticSerialization' => true));
- $output = $this->generate_output(true);
- $eventData['links'] = $output;
- $cache_obj->save($output,'linklist_cache');
- } else {
- $output = $this->generate_output(true);
- $eventData['links'] = $output;
- $this->set_config('cached_output',$output);
- }
+ }
+ if ($eventData['cache'] == 'yes') {
+ if (@include_once("Cache/Lite.php")) {
+ $cache_obj = new Cache_Lite( array('cacheDir' => $serendipity['serendipityPath'].'templates_c/','automaticSerialization' => true));
+ $output = $this->generate_output(true);
+ $eventData['links'] = $output;
+ $cache_obj->save($output,'linklist_cache');
+ } else {
+ $output = $this->generate_output(true);
+ $eventData['links'] = $output;
+ $this->set_config('cached_output',$output);
}
}
- } else {
- if ($this->get_config('active') =='true') {
- $this->set_config('active','false');
- $this->set_config('cache', 'no');
- $this->set_config('display', 'category');
- $eventData['links'] = $this->generate_output(true);
- if (@include_once("Cache/Lite.php")) {
- $cache_obj = new Cache_Lite(array('cacheDir' => $serendipity['serendipityPath'].'templates_c/','automaticSerialization' => true));
- $cache_obj->remove('linklist_cache');
- } else {
- $this->set_config('cached_output','');
- }
- $eventData['changed'] = 'true';
- }
}
- return true;
+ } else {
+ if ($this->get_config('active') =='true') {
+ $this->set_config('active','false');
+ $this->set_config('cache', 'no');
+ $this->set_config('display', 'category');
+ $eventData['links'] = $this->generate_output(true);
+ if (@include_once("Cache/Lite.php")) {
+ $cache_obj = new Cache_Lite(array('cacheDir' => $serendipity['serendipityPath'].'templates_c/','automaticSerialization' => true));
+ @$cache_obj->remove('linklist_cache');
+ } else {
+ $this->set_config('cached_output','');
+ }
+ $eventData['changed'] = 'true';
+ }
+ }
+
+ return true;
break;
default:
@@ -279,17 +288,17 @@ class serendipity_event_linklist extends serendipity_event {
if ($this->get_config('category') == 'custom') {
$table = $serendipity['dbPrefix'].'link_category';
} else {
- $table = $serendipity['dbPrefix'].'category';
+ $table = $serendipity['dbPrefix'].'category';
}
$output = $this->category_output($table,0,0);
} else {
- $q = $this->set_query($display);
+ $q = $this->set_query($display);
$sql = serendipity_db_query($q);
if ($sql && is_array($sql)) {
foreach($sql AS $key => $row) {
$name = $row['name'];
$link = $row['link'];
- $id = $row['id'];
+ $id = $row['id'];
$descrip = $row['descrip'];
$output .= ''."\n";
}
@@ -577,7 +586,7 @@ class serendipity_event_linklist extends serendipity_event {
$q = $this->set_query($display);
$categories = $this->build_categories();
- echo ''.PLUGIN_LINKLIST_ADMINLINK.'
';
+ echo ''.PLUGIN_LINKLIST_ADMINLINK.'
'."\n\n";
?>
';
+ echo '
+
+
+
+
+
+
+ ';
}
}
@@ -679,19 +688,20 @@ class serendipity_event_linklist extends serendipity_event {
echo ''.$maintitle.'
';
?>
';
}
function set_query($display) {
global $serendipity;
- $q = 'SELECT s.link AS link,
- s.title AS name,
- s.descrip AS descrip,
- s.category AS cat_id,
- s.id AS id
- FROM '.$serendipity['dbPrefix'].'links AS s ';
+ $q = 'SELECT s.link AS link,
+ s.title AS name,
+ s.descrip AS descrip,
+ s.category AS cat_id,
+ s.id AS id
+ FROM '.$serendipity['dbPrefix'].'links AS s ';
switch($display) {
case 'category':
- $q .= 'ORDER BY s.category';
+ $q .= 'ORDER BY s.category';
break;
case 'order_num':
- $q .= 'ORDER BY s.order_num ASC';
+ $q .= 'ORDER BY s.order_num ASC';
break;
case 'dateacs':
@@ -778,7 +796,7 @@ class serendipity_event_linklist extends serendipity_event {
$q .= 'ORDER BY date_added DESC';
break;
default:
- $q .= 'ORDER BY s.title ASC';
+ $q .= 'ORDER BY s.title ASC';
break;
}
return $q;
@@ -791,10 +809,10 @@ class serendipity_event_linklist extends serendipity_event {
} else {
$table = $serendipity['dbPrefix'].'category';
}
- $q = 'SELECT s.categoryid AS id,
- s.category_name AS name
- FROM '.$table.' AS s
- ORDER BY s.category_name DESC';
+ $q = 'SELECT s.categoryid AS id,
+ s.category_name AS name
+ FROM '.$table.' AS s
+ ORDER BY s.category_name DESC';
$sql = serendipity_db_query($q);
$categories['0'] = '';
if ($sql && is_array($sql)) {
diff --git a/serendipity_event_linklist/serendipity_plugin_linklist.php b/serendipity_event_linklist/serendipity_plugin_linklist.php
index de8978d9..f45ad0fd 100644
--- a/serendipity_event_linklist/serendipity_plugin_linklist.php
+++ b/serendipity_event_linklist/serendipity_plugin_linklist.php
@@ -1,5 +1,4 @@
-add('description', PLUGIN_LINKS_BLAHBLAH);
$propbag->add('stackable', true);
$propbag->add('author', 'Matthew Groeninger, Omid Mottaghi Rad');
- $propbag->add('version', '1.20');
+ $propbag->add('version', '1.21');
$propbag->add('stackable', false);
$propbag->add('configuration', array(
'title',
@@ -134,7 +133,7 @@ class serendipity_plugin_linklist extends serendipity_plugin
$propbag->add('description', PLUGIN_LINKLIST_CATEGORY_NAME_DESC);
$propbag->add('radio',
array( 'value' => array('custom','default'),
- 'desc' => array(PLUGIN_LINKLIST_CATEGORY_NAME_CUSTOM,PLUGIN_LINKLIST_CATEGORY_NAME_DEFAULT)
+ 'desc' => array(PLUGIN_LINKLIST_CATEGORY_NAME_CUSTOM,PLUGIN_LINKLIST_CATEGORY_NAME_DEFAULT)
));
$propbag->add('radio_per_row', '2');
$propbag->add('default', 'custom');
@@ -290,7 +289,7 @@ class serendipity_plugin_linklist extends serendipity_plugin
$propbag->add('description', PLUGIN_LINKLIST_CATEGORY_DEFAULT_OPEN_DESC);
$propbag->add('radio',
array( 'value' => array('closed','open'),
- 'desc' => array(PLUGIN_LINKLIST_CATEGORY_DEFAULT_OPEN_NAME_CLOSED,PLUGIN_LINKLIST_CATEGORY_DEFAULT_OPEN_NAME_OPEN)
+ 'desc' => array(PLUGIN_LINKLIST_CATEGORY_DEFAULT_OPEN_NAME_CLOSED,PLUGIN_LINKLIST_CATEGORY_DEFAULT_OPEN_NAME_OPEN)
));
$propbag->add('radio_per_row', '2');
$propbag->add('default', 'closed');
@@ -372,34 +371,33 @@ class serendipity_plugin_linklist extends serendipity_plugin
$imgdir = $serendipity['baseURL'] . 'plugins/' . $plugin_dir;
}
- $str = $this->get_config('prepend_text');
- $str.="\n\n";
+ $str = $this->get_config('prepend_text');
+ $str .= "\n\n";
if ($style == "dtree") {
- $str.='';
+ $str .= "\n".''."\n";
-
- if($this->get_config('showOpenAndCloseLinks')=='true' && $this->get_config('locationOfOpenAndClose')=='top'){
- $str.=''.$this->get_config('openAllText').' | '.$this->get_config('closeAllText').'
';
+ if ($this->get_config('showOpenAndCloseLinks')=='true' && $this->get_config('locationOfOpenAndClose')=='top'){
+ $str .= ''.$this->get_config('openAllText').' | '.$this->get_config('closeAllText').'
';
}
- $str.='';
+ $str .= '';
}
$str .= ''.$delimiter;
@@ -510,14 +508,14 @@ class serendipity_plugin_linklist extends serendipity_plugin
$str .= '
';
}
- $str.=$this->get_config('append_text');
+ $str .= $this->get_config('append_text');
- if($this->get_config('call_markup')=='true') {
+ if ($this->get_config('call_markup') == 'true') {
$entry = array('html_nugget' => $str);
serendipity_plugin_api::hook_event('frontend_display', $entry);
return $entry['html_nugget'];
} else {
- return $str;
+ return $str;
}
}
@@ -528,16 +526,16 @@ class serendipity_plugin_linklist extends serendipity_plugin
if ($this->get_config('cache') == 'no') {
if (@include_once("Cache/Lite.php")) {
$cache_obj = new Cache_Lite( array('cacheDir' => $serendipity['serendipityPath'].'templates_c/','automaticSerialization' => true));
- $cache_obj->remove('linklist_html');
- $cache_obj->remove('linklist_xmlhash');
- }
+ @$cache_obj->remove('linklist_html');
+ @$cache_obj->remove('linklist_xmlhash');
+ }
}
- $setdata = array('display' => $this->get_config('display'),
+ $setdata = array('display' => $this->get_config('display'),
'category' => $this->get_config('category'),
- 'style' => $this->get_config('style'),
- 'cache' => $cache);
+ 'style' => $this->get_config('style'),
+ 'cache' => $cache);
- if($this->get_config('directxml')!='true') {
+ if($this->get_config('directxml') != 'true') {
$blah = $this->get_config('display');
if (!isset($blah)) {
$this->set_config('display','category');
@@ -548,7 +546,7 @@ class serendipity_plugin_linklist extends serendipity_plugin
$setdata['enabled'] = 'false';
}
serendipity_plugin_api::hook_event('plugins_linklist_conf',$setdata);
- if ($setdata['changed']=='true') {
+ if ($setdata['changed'] == 'true') {
$this->set_config('links',$setdata['links']);
}