Plugin Directory

Changeset 3753659


Ignore:
Timestamp:
10/18/2026 09:48:58 PM (3 days ago)
Author:
ulfben
Message:

Release WP-dTree 4.5.4: improve tree state, menu updates and compatibility

Location:
wp-dtree-30
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wp-dtree-30/tags/4.5.4/readme.txt

    r3753595 r3753659  
    33Donate link: http://www.amazon.com/gp/registry/wishlist/2QB6SQ5XX2U0N/105-3209188-5640446?reveal=unpurchased&filter=all&sort=priority&layout=standard&x=11&y=10
    44Tags: archive, navigation, category, tree, sidebar
    5 Requires at least: 6.0
     5Requires at least: 6.0.1
    66Tested up to: 7.1
    7 Stable tag: 4.5.3
     7Stable tag: 4.5.4
    88Requires PHP: 7.4
    99License: GPLv2
    … …  
    1616This plugin provides collapsible navigation trees for archives, categories, pages, links, custom taxonomies and menus. Use the widgets in a widget area or the template functions documented below. Archive trees can group posts by year and month.
    1717
    18 Requires WordPress 6.0 or later and PHP 7.4 or later.
     18Requires WordPress 6.0.1 or later and PHP 7.4 or later.
    1919
    2020== Frequently Asked Questions ==
    … …  
    8585== Upgrade Notice ==
    8686
     87= 4.5.4 =
     88Improves menu updates and remembered tree state, and avoids selecting unrelated items. Requires WordPress 6.0.1 or later. Clear any separate page cache after upgrading.
     89
    8790= 4.5.3 =
    8891Fixes missing or duplicate posts in category and custom taxonomy trees, and PHP warnings from incomplete widget settings. Clear any separate page cache after upgrading.
    … …  
    98101
    99102== Changelog ==
     103
     104= 4.5.4 =
     105* Reduce server work when building large menu trees.
     106* Require WordPress 6.0.1 or later to avoid the term-cache bug in WordPress 6.0.
     107* Avoid opening or highlighting an unrelated item when the requested item is absent from the tree.
     108* Prevent similarly named cookies from affecting remembered tree state.
     109* Fix newly added menu items sometimes missing from cached trees.
     110* Prevent tree controls from overwriting variables used by other scripts on the page.
    100111
    101112= 4.5.3 =
  • wp-dtree-30/tags/4.5.4/wp-dtree-arc.php

    r3753518 r3753659  
    3535                ) ";
    3636        }
     37        // Keep month counts and post selection on the same eligibility rules.
     38        // Leave the post-type placeholder unprepared until the complete query is built.
     39        $where = " WHERE {$wpdb->posts}.post_type = %s AND {$wpdb->posts}.post_status = 'publish'
     40                {$postexclusions}
     41                {$category_filter}";
    3742        // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- SQL fragments contain only trusted wpdb tables, fixed clauses and integer category/exclusion lists.
    38         $query = $wpdb->prepare("SELECT YEAR({$wpdb->posts}.post_date) AS 'year', MONTH({$wpdb->posts}.post_date) AS 'month' {$count}
    39                  $from 
    40                  WHERE {$wpdb->posts}.post_type = %s AND {$wpdb->posts}.post_status = 'publish'
    41                  {$postexclusions}               
    42                  {$category_filter}
     43        $months_query = $wpdb->prepare("SELECT YEAR({$wpdb->posts}.post_date) AS 'year', MONTH({$wpdb->posts}.post_date) AS 'month' {$count}
     44                 {$from}
     45                 {$where}
    4346                 GROUP BY year, month
    4447                 ORDER BY {$wpdb->posts}.post_date DESC", $posttype);
    4548        // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter -- Prepared query assembled immediately above from validated fragments.
    46         $arcresults = $wpdb->get_results($query);               
     49        $arcresults = $wpdb->get_results($months_query);               
    4750
    4851        if(!$arcresults){
    … …  
    5255        $nodelist = array();
    5356        $curyear = -1;
    54         $query = array();               
     57        $month_queries = array();               
    5558        $select_sortby = ($sortby == 'ID' || $sortby == 'post_date' || $sortby == 'post_title') ? '' : ", {$wpdb->posts}.{$sortby} AS '{$sortby}'";
    5659       
    … …  
    9396                $endmonth = wpdt_add_month($startmonth, 1);             
    9497                // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Interpolated fragments use trusted tables, allowlisted columns and integer IDs/limits/exclusions.
    95                 $query[] = $wpdb->prepare("(SELECT {$wpdb->posts}.ID AS 'ID', {$wpdb->posts}.post_date AS 'post_date', {$wpdb->posts}.post_title AS 'post_title', {$pidcount} AS 'pID' {$select_sortby}
     98                $month_queries[] = $wpdb->prepare("(SELECT {$wpdb->posts}.ID AS 'ID', {$wpdb->posts}.post_date AS 'post_date', {$wpdb->posts}.post_title AS 'post_title', {$pidcount} AS 'pID' {$select_sortby}
    9699                         {$from}
    97                          WHERE {$wpdb->posts}.post_type = %s AND {$wpdb->posts}.post_status = 'publish'
     100                         {$where}
    98101                                AND {$wpdb->posts}.post_date >= %s
    99102                                AND {$wpdb->posts}.post_date < %s
    100                          {$postexclusions}     
    101                          {$category_filter}
    102103                         {$month_order}{$limit})", $posttype, $startmonth, $endmonth);
    103104        }
    104105        unset($arcresults);     
    105         if($listposts && count($query)){
    106                 $query = implode(' UNION ALL ', $query) . " ORDER BY {$result_order}";
    107                 //_log($query);
     106        if($listposts && count($month_queries)){
     107                $posts_query = implode(' UNION ALL ', $month_queries) . " ORDER BY {$result_order}";
    108108                // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter -- UNION of prepared month queries; trailing sort column/direction were allowlisted above.
    109                 if($postresults = $wpdb->get_results($query)){
     109                if($postresults = $wpdb->get_results($posts_query)){
    110110                        foreach($postresults as $postresult){                   
    111111                                $text = wp_strip_all_tags(apply_filters('the_title', $postresult->post_title));                 
  • wp-dtree-30/tags/4.5.4/wp-dtree-mnu.php

    r3744431 r3753659  
    99                return $nodelist;
    1010        }
     11        $menu_ids = array_fill_keys(array_column($menu_items, 'ID'), true);
    1112        foreach((array)$menu_items as $key => $menu_item){
    1213                $pid = $menu_item->menu_item_parent;
    13                 $hasparent = false;                     
    14                 foreach($menu_items as $key => $potential_parent){
    15                         if($potential_parent->ID == $pid){                                     
    16                                 $hasparent = true; break;
    17                         }
    18                 }
    19                 if(!$hasparent){$pid = 0;} //connect orphans to root.
     14                if(!isset($menu_ids[(int)$pid])){$pid = 0;} //connect orphans to root.
    2015                $nodelist[$idcount] = array(
    2116                        'id' => $menu_item->ID,
  • wp-dtree-30/tags/4.5.4/wp-dtree.js

    r2056379 r3753659  
    6969        this.title = title;     
    7070        this.rsspath = rsspath; //for feed link.
    71         var icon, iconOpen, open; //these were originally passed as parameters, but were never used in wp-dtree.       
    7271        this.target = targ;
    73         this.icon = icon;
    74         this.iconOpen = iconOpen;
    75         this._io = open || false;
     72        this.icon = undefined;
     73        this.iconOpen = undefined;
     74        this._io = false;
    7675        this._is = false;
    7776        this._ls = false;
    … …  
    139138 
    140139wpdTree.prototype.truncate = function(str, length){
    141     var length = length || 16;
     140    length = length || 16;
    142141    var truncation = '...';
    143142    if(str.length > length)  {
    … …  
    217216                else if((!this.config.folderLinks || !node.url) && node._hc && node.pid != this.root.id){
    218217                        str += '<a href="javascript: ' + this._objName + '.o(' + nodeId + ');"'
    219                         if(true || node.title) str += ' title="' + node.title + '"';
     218                        str += ' title="' + node.title + '"';
    220219                        str += ' class="node">';
    221220                }
    … …  
    276275        if(this.selecteddtNode != id){
    277276                if(this.selecteddtNode || this.selecteddtNode==0){
    278                         eOld = document.getElementById("s" + this._objName + this.selecteddtNode);
     277                        var eOld = document.getElementById("s" + this._objName + this.selecteddtNode);
    279278                        if(eOld){
    280279                                eOld.className = "node";
    281280                        }
    282281                }
    283                 eNew = document.getElementById("s" + this._objName + id);
     282                var eNew = document.getElementById("s" + this._objName + id);
    284283                if(eNew){
    285284                        eNew.className = "nodeSel";
    … …  
    320319                        }
    321320                }
     321                // A public node ID is not an array index when no match was found.
     322                if(n == this.adtNodes.length) return;
    322323        }
    323324        var cn=this.adtNodes[nId];     
    … …  
    356357// Change the status of a node(open or closed)
    357358wpdTree.prototype.nodeStatus = function(status, id, bottom){
    358         eDiv    = document.getElementById('d' + this._objName + id);
    359         eJoin   = document.getElementById('j' + this._objName + id);
     359        var eDiv        = document.getElementById('d' + this._objName + id);
     360        var eJoin       = document.getElementById('j' + this._objName + id);
    360361        if(this.config.useIcons){
    361                 eIcon   = document.getElementById('i' + this._objName + id);
     362                var eIcon       = document.getElementById('i' + this._objName + id);
    362363                eIcon.src = (status) ? this.adtNodes[id].iconOpen : this.adtNodes[id].icon;
    363364        }
    … …  
    393394// [Cookie] Gets a value from a cookie
    394395wpdTree.prototype.getCookie = function(cookieName){
    395         var cookieValue = '';
    396         var posName = document.cookie.indexOf(escape(cookieName) + '=');
    397         if(posName != -1){
    398                 var posValue = posName + (escape(cookieName) + '=').length;
    399                 var endPos = document.cookie.indexOf(';', posValue);
    400                 if(endPos != -1) cookieValue = unescape(document.cookie.substring(posValue, endPos));
    401                 else cookieValue = unescape(document.cookie.substring(posValue));
    402         }
    403         return (cookieValue);
     396        var prefix = escape(cookieName) + '=';
     397        var cookies = document.cookie.split(';');
     398        for(var n=0; n<cookies.length; n++){
     399                var cookie = cookies[n].replace(/^\s+/, '');
     400                if(cookie.indexOf(prefix) == 0) return unescape(cookie.substring(prefix.length));
     401        }
     402        return '';
    404403};
    405404
    … …  
    434433if(!Array.prototype.pop){
    435434        Array.prototype.pop = function array_pop(){
    436                 lastElement = this[this.length-1];
     435                var lastElement = this[this.length-1];
    437436                this.length = Math.max(this.length-1,0);
    438437                return lastElement;
  • wp-dtree-30/tags/4.5.4/wp-dtree.min.js

    r2056379 r3753659  
    1 function dtNode(t,e,i,s,o,n,d){this.id=t,this.pid=e,this.name=i,this.url=s,this.title=o,this.rsspath=d,this.target=n,this.icon=void 0,this.iconOpen=void 0,this._io=!1,this._is=!1,this._ls=!1,this._hc=!1,this._ai=0,this._p}function wpdTree(t,e,i){this.config={target:null,folderLinks:!1,useSelection:!1,useCookies:!0,useLines:!0,useIcons:!1,useStatusText:!1,closeSameLevel:!1,inOrder:!1},this.icon={root:WPdTreeSettings.imgurl+"dtree-img/empty.gif",folder:WPdTreeSettings.imgurl+"dtree-img/folder.gif",folderOpen:WPdTreeSettings.imgurl+"dtree-img/folderopen.gif",node:WPdTreeSettings.imgurl+"dtree-img/page.gif",empty:WPdTreeSettings.imgurl+"dtree-img/empty.gif",line:WPdTreeSettings.imgurl+"dtree-img/line.gif",join:WPdTreeSettings.imgurl+"dtree-img/join.gif",joinBottom:WPdTreeSettings.imgurl+"dtree-img/joinbottom.gif",plus:WPdTreeSettings.imgurl+"dtree-img/plus.gif",plusBottom:WPdTreeSettings.imgurl+"dtree-img/plusbottom.gif",minus:WPdTreeSettings.imgurl+"dtree-img/minus.gif",minusBottom:WPdTreeSettings.imgurl+"dtree-img/minusbottom.gif",nlPlus:WPdTreeSettings.imgurl+"dtree-img/nolines_plus.gif",nlMinus:WPdTreeSettings.imgurl+"dtree-img/nolines_minus.gif"},this._url=e,this._truncate=i,this._objName=t,this.adtNodes=[],this.aIndent=[],this.root=new dtNode("root"),this.selecteddtNode=null,this.selectedFound=!1,this.completed=!1}wpdTree.prototype.a=function(t,e,i,s,o,n,d){""!=d&&(d="<a class='dtree-rss' href='"+this._url+d+"' title='Feed for "+i+"'></a>");var r=o+="";0!=o.indexOf("https://")&&0!=o.indexOf("http://")&&(r=this._url+o),s||(s=i),this._truncate>0&&(i=this.truncate(i,this._truncate)),this.adtNodes[this.adtNodes.length]=new dtNode(t,e,i,r,s,n,d)},wpdTree.prototype.truncate=function(t,e){e=e||16;return t.length>e?t.slice(0,e-"...".length)+"...":t},wpdTree.prototype.openAll=function(){this.oAll(!0)},wpdTree.prototype.closeAll=function(){this.oAll(!1)},wpdTree.prototype.toString=function(){var t='<div class="dtree_'+this._objName.substr(0,3)+'" id="dtree_'+this._objName+'">\n';return document.getElementById?(this.config.useCookies&&(this.selecteddtNode=this.getSelected()),t+=this.adddtNode(this.root)):t+="Browser not supported.",t+="</div>",this.selectedFound||(this.selecteddtNode=null),this.completed=!0,t},wpdTree.prototype.adddtNode=function(t){var e="",i=0;for(this.config.inOrder&&(i=t._ai);i<this.adtNodes.length;i++)if(this.adtNodes[i].pid==t.id){var s=this.adtNodes[i];if(s._p=t,s._ai=i,this.setCS(s),!s.target&&this.config.target&&(s.target=this.config.target),s._hc&&!s._io&&this.config.useCookies&&(s._io=this.isOpen(s.id)),!this.config.folderLinks&&s._hc&&(s.url=null),this.config.useSelection&&s.id==this.selecteddtNode&&!this.selectedFound&&(s._is=!0,this.selecteddtNode=i,this.selectedFound=!0),e+=this.node(s,i),s._ls)break}return e},wpdTree.prototype.node=function(t,e){var i='<div class="dtNode">'+this.indent(t,e);return this.config.useIcons&&(t.icon||(t.icon=this.root.id==t.pid?this.icon.root:t._hc?this.icon.folder:this.icon.node),t.iconOpen||(t.iconOpen=t._hc?this.icon.folderOpen:this.icon.node),this.root.id!=t.pid&&(i+='<img id="i'+this._objName+e+'" src="'+(t._io?t.iconOpen:t.icon)+'" alt="" />')),this.root.id!=t.pid&&(t.url?(i+='<a id="s'+this._objName+e+'" class="'+(this.config.useSelection&&t._is?"nodeSel":"node")+'" href="'+t.url+'"',t.title&&(i+=' title="'+t.title+'"'),t.target&&(i+=' target="'+t.target+'"'),this.config.useStatusText&&(i+=" onmouseover=\"window.status='"+t.name+"';return true;\" onmouseout=\"window.status='';return true;\" "),this.config.useSelection&&(t._hc&&this.config.folderLinks||!t._hc)&&(i+=' onclick="javascript: '+this._objName+".s("+e+');"'),i+=">"):this.config.folderLinks&&t.url||!t._hc||t.pid==this.root.id||(i+='<a href="javascript: '+this._objName+".o("+e+');"',i+=' title="'+t.title+'"',i+=' class="node">'),i+=t.name,!t.url&&(this.config.folderLinks&&t.url||!t._hc)||(i+="</a>")),t.rsspath&&(i+=t.rsspath),i+=" </div>",t._hc&&(i+='<div id="d'+this._objName+e+'" class="clip" style="display:'+(this.root.id==t.pid||t._io?"block":"none")+';">',i+=this.adddtNode(t),i+="</div>"),this.aIndent.pop(),i},wpdTree.prototype.indent=function(t,e){var i="";if(this.root.id!=t.pid){for(var s=0;s<this.aIndent.length;s++)i+='<img src="'+(1==this.aIndent[s]&&this.config.useLines?this.icon.line:this.icon.empty)+'" alt="" />';t._ls?this.aIndent.push(0):this.aIndent.push(1),t._hc?(i+='<a href="javascript: '+this._objName+".o("+e+');"><img id="j'+this._objName+e+'" src="',this.config.useLines?i+=t._io?t._ls&&this.config.useLines?this.icon.minusBottom:this.icon.minus:t._ls&&this.config.useLines?this.icon.plusBottom:this.icon.plus:i+=t._io?this.icon.nlMinus:this.icon.nlPlus,i+='" alt="" /></a>'):i+='<img src="'+(this.config.useLines?t._ls?this.icon.joinBottom:this.icon.join:this.icon.empty)+'" alt="" />'}return i},wpdTree.prototype.setCS=function(t){for(var e,i=0;i<this.adtNodes.length;i++)this.adtNodes[i].pid==t.id&&(t._hc=!0),this.adtNodes[i].pid==t.pid&&(e=this.adtNodes[i].id);e==t.id&&(t._ls=!0)},wpdTree.prototype.getSelected=function(){var t=this.getCookie("cs"+this._objName);return t||null},wpdTree.prototype.s=function(t){if(this.config.useSelection){var e=this.adtNodes[t];e._hc&&!this.config.folderLinks||this.selecteddtNode!=t&&((this.selecteddtNode||0==this.selecteddtNode)&&(eOld=document.getElementById("s"+this._objName+this.selecteddtNode),eOld&&(eOld.className="node")),eNew=document.getElementById("s"+this._objName+t),eNew&&(eNew.className="nodeSel"),this.selecteddtNode=t,this.config.useCookies&&this.setCookie("cs"+this._objName,e.id))}},wpdTree.prototype.o=function(t){var e=this.adtNodes[t];this.nodeStatus(!e._io,t,e._ls),e._io=!e._io,this.config.closeSameLevel&&this.closeLevel(e),this.config.useCookies&&this.updateCookie()},wpdTree.prototype.oAll=function(t){for(var e=0;e<this.adtNodes.length;e++)this.adtNodes[e]._hc&&this.adtNodes[e].pid!=this.root.id&&(this.adtNodes[e]._io!=t&&this.nodeStatus(t,e,this.adtNodes[e]._ls),this.adtNodes[e]._io=t);this.config.useCookies&&this.updateCookie()},wpdTree.prototype.openTo=function(t,e,i){if(!i)for(var s=0;s<this.adtNodes.length;s++)if(this.adtNodes[s].id==t){t=s;break}var o=this.adtNodes[t];void 0!==o&&o.pid!=this.root.id&&o._p&&(o._io=!0,o._is=e,this.completed&&o._hc&&this.nodeStatus(!0,o._ai,o._ls),this.completed&&e?this.s(o._ai):e&&(this._sn=o._ai),this.openTo(o._p._ai,!1,!0))},wpdTree.prototype.closeLevel=function(t){for(var e=0;e<this.adtNodes.length;e++)this.adtNodes[e].pid==t.pid&&this.adtNodes[e].id!=t.id&&this.adtNodes[e]._hc&&(this.nodeStatus(!1,e,this.adtNodes[e]._ls),this.adtNodes[e]._io=!1,this.closeAllChildren(this.adtNodes[e]))},wpdTree.prototype.closeAllChildren=function(t){for(var e=0;e<this.adtNodes.length;e++)this.adtNodes[e].pid==t.id&&this.adtNodes[e]._hc&&(this.adtNodes[e]._io&&this.nodeStatus(!1,e,this.adtNodes[e]._ls),this.adtNodes[e]._io=!1,this.closeAllChildren(this.adtNodes[e]))},wpdTree.prototype.nodeStatus=function(t,e,i){eDiv=document.getElementById("d"+this._objName+e),eJoin=document.getElementById("j"+this._objName+e),this.config.useIcons&&(eIcon=document.getElementById("i"+this._objName+e),eIcon.src=t?this.adtNodes[e].iconOpen:this.adtNodes[e].icon),eJoin.src=this.config.useLines?t?i?this.icon.minusBottom:this.icon.minus:i?this.icon.plusBottom:this.icon.plus:t?this.icon.nlMinus:this.icon.nlPlus,"1"===WPdTreeSettings.animate&&"function"==typeof jQuery?t?jQuery(eDiv).slideDown(parseInt(WPdTreeSettings.duration)):jQuery(eDiv).slideUp(parseInt(WPdTreeSettings.duration)):eDiv.style.display=t?"block":"none"},wpdTree.prototype.clearCookie=function(){var t=new Date,e=new Date(t.getTime()-864e5);this.setCookie("co"+this._objName,"cookieValue",e),this.setCookie("cs"+this._objName,"cookieValue",e)},wpdTree.prototype.setCookie=function(t,e,i,s,o,n){document.cookie=escape(t)+"="+escape(e)+(i?"; expires="+i.toGMTString():"")+(s?"; path="+s:"; path=/")+(o?"; domain="+o:"")+(n?"; secure":"")},wpdTree.prototype.getCookie=function(t){var e="",i=document.cookie.indexOf(escape(t)+"=");if(-1!=i){var s=i+(escape(t)+"=").length,o=document.cookie.indexOf(";",s);e=-1!=o?unescape(document.cookie.substring(s,o)):unescape(document.cookie.substring(s))}return e},wpdTree.prototype.updateCookie=function(){for(var t="",e=0;e<this.adtNodes.length;e++)this.adtNodes[e]._io&&this.adtNodes[e].pid!=this.root.id&&(t&&(t+="."),t+=this.adtNodes[e].id);this.setCookie("co"+this._objName,t)},wpdTree.prototype.isOpen=function(t){for(var e=this.getCookie("co"+this._objName).split("."),i=0;i<e.length;i++)if(e[i]==t)return!0;return!1},Array.prototype.push||(Array.prototype.push=function(){for(var t=0;t<arguments.length;t++)this[this.length]=arguments[t];return this.length}),Array.prototype.pop||(Array.prototype.pop=function(){return lastElement=this[this.length-1],this.length=Math.max(this.length-1,0),lastElement});
     1/*--------------------------------------------------|
     2| WP-dTree 2.2 | www.silpstream.com/blog/           |
     3|---------------------------------------------------|
     4| Copyright (c) 2006 Christopher Hwang              |
     5| Release Date: July 2006                           |
     6| Modifications:                                    |
     7| v2.2 Added support for generating page trees      |
     8|      Added support for excluding specific posts   |
     9|      from tree                                    |
     10|      Updated option menu                          |
     11|      Rewrite of base code                         |
     12|      Fixed support for tooltips on non-linked     |
     13|      folders                                      |
     14|      Added option for not displaying posts in     |
     15|      archive tree                                 |
     16| v2.1 Patch to work with Regulus theme             |
     17|      Ability to change open/close all link        |
     18|      Set folders as links option                  |
     19|      Highlight current position in blog           |
     20| v2.0 Support for scriptaculous effects added      |
     21|      Category based menu added                    |
     22|      Support for wpdTree options was built in       |
     23|      Option menu added to admin panel             |
     24|       v1.0 Work arounds added for wordpress beautified |
     25|      permalinks.                                  |
     26|--------------------------------------------------*/
     27/*--------------------------------------------------|
     28| wpdTree 2.05 | www.destroydrop.com/javascript/tree/ |
     29|---------------------------------------------------|
     30| Copyright (c) 2002-2003 Geir Landr?               |
     31|                                                   |
     32| This script can be used freely as long as all     |
     33| copyright messages are intact.                    |
     34|                                                   |
     35| Updated: 17.04.2003                               |
     36|--------------------------------------------------*/
     37function dtNode(id,pid,name,url,title,targ,rsspath){this.id=id;this.pid=pid;this.name=name;this.url=url;this.title=title;this.rsspath=rsspath;this.target=targ;this.icon=undefined;this.iconOpen=undefined;this._io=false;this._is=false;this._ls=false;this._hc=false;this._ai=0;this._p}function wpdTree(objName,baseUrl,truncate){this.config={target:null,folderLinks:false,useSelection:false,useCookies:true,useLines:true,useIcons:false,useStatusText:false,closeSameLevel:false,inOrder:false};this.icon={root:WPdTreeSettings.imgurl+"dtree-img/empty.gif",folder:WPdTreeSettings.imgurl+"dtree-img/folder.gif",folderOpen:WPdTreeSettings.imgurl+"dtree-img/folderopen.gif",node:WPdTreeSettings.imgurl+"dtree-img/page.gif",empty:WPdTreeSettings.imgurl+"dtree-img/empty.gif",line:WPdTreeSettings.imgurl+"dtree-img/line.gif",join:WPdTreeSettings.imgurl+"dtree-img/join.gif",joinBottom:WPdTreeSettings.imgurl+"dtree-img/joinbottom.gif",plus:WPdTreeSettings.imgurl+"dtree-img/plus.gif",plusBottom:WPdTreeSettings.imgurl+"dtree-img/plusbottom.gif",minus:WPdTreeSettings.imgurl+"dtree-img/minus.gif",minusBottom:WPdTreeSettings.imgurl+"dtree-img/minusbottom.gif",nlPlus:WPdTreeSettings.imgurl+"dtree-img/nolines_plus.gif",nlMinus:WPdTreeSettings.imgurl+"dtree-img/nolines_minus.gif"};this._url=baseUrl;this._truncate=truncate;this._objName=objName;this.adtNodes=[];this.aIndent=[];this.root=new dtNode("root");this.selecteddtNode=null;this.selectedFound=false;this.completed=false}wpdTree.prototype.a=function(id,pid,name,title,path,link_target,rsspath){if(rsspath!=""){rsspath="<a class='dtree-rss' href='"+this._url+rsspath+"' title='Feed for "+name+"'></a>"}path+="";var url=path;if(path.indexOf("https://")!=0&&path.indexOf("http://")!=0){url=this._url+path}if(!title){title=name}if(this._truncate>0){name=this.truncate(name,this._truncate)}this.adtNodes[this.adtNodes.length]=new dtNode(id,pid,name,url,title,link_target,rsspath)};wpdTree.prototype.truncate=function(str,length){length=length||16;var truncation="...";if(str.length>length){return str.slice(0,length-truncation.length)+truncation}return str};wpdTree.prototype.openAll=function(){this.oAll(true)};wpdTree.prototype.closeAll=function(){this.oAll(false)};wpdTree.prototype.toString=function(){var type=this._objName.substr(0,3);var str='<div class="dtree_'+type+'" id="dtree_'+this._objName+'">\n';if(document.getElementById){if(this.config.useCookies)this.selecteddtNode=this.getSelected();str+=this.adddtNode(this.root)}else str+="Browser not supported.";str+="</div>";if(!this.selectedFound)this.selecteddtNode=null;this.completed=true;return str};wpdTree.prototype.adddtNode=function(pdtNode){var str="";var n=0;if(this.config.inOrder)n=pdtNode._ai;for(n;n<this.adtNodes.length;n++){if(this.adtNodes[n].pid==pdtNode.id){var cn=this.adtNodes[n];cn._p=pdtNode;cn._ai=n;this.setCS(cn);if(!cn.target&&this.config.target)cn.target=this.config.target;if(cn._hc&&!cn._io&&this.config.useCookies)cn._io=this.isOpen(cn.id);if(!this.config.folderLinks&&cn._hc)cn.url=null;if(this.config.useSelection&&cn.id==this.selecteddtNode&&!this.selectedFound){cn._is=true;this.selecteddtNode=n;this.selectedFound=true}str+=this.node(cn,n);if(cn._ls)break}}return str};wpdTree.prototype.node=function(node,nodeId){var str='<div class="dtNode">'+this.indent(node,nodeId);if(this.config.useIcons){if(!node.icon)node.icon=this.root.id==node.pid?this.icon.root:node._hc?this.icon.folder:this.icon.node;if(!node.iconOpen)node.iconOpen=node._hc?this.icon.folderOpen:this.icon.node;if(this.root.id!=node.pid){str+='<img id="i'+this._objName+nodeId+'" src="'+(node._io?node.iconOpen:node.icon)+'" alt="" />'}}if(this.root.id!=node.pid){if(node.url){str+='<a id="s'+this._objName+nodeId+'" class="'+(this.config.useSelection?node._is?"nodeSel":"node":"node")+'" href="'+node.url+'"';if(node.title)str+=' title="'+node.title+'"';if(node.target)str+=' target="'+node.target+'"';if(this.config.useStatusText)str+=" onmouseover=\"window.status='"+node.name+"';return true;\" onmouseout=\"window.status='';return true;\" ";if(this.config.useSelection&&(node._hc&&this.config.folderLinks||!node._hc))str+=' onclick="javascript: '+this._objName+".s("+nodeId+');"';str+=">"}else if((!this.config.folderLinks||!node.url)&&node._hc&&node.pid!=this.root.id){str+='<a href="javascript: '+this._objName+".o("+nodeId+');"';str+=' title="'+node.title+'"';str+=' class="node">'}str+=node.name;if(node.url||(!this.config.folderLinks||!node.url)&&node._hc)str+="</a>"}if(node.rsspath){str+=node.rsspath}str+=" </div>";if(node._hc){str+='<div id="d'+this._objName+nodeId+'" class="clip" style="display:'+(this.root.id==node.pid||node._io?"block":"none")+';">';str+=this.adddtNode(node);str+="</div>"}this.aIndent.pop();return str};wpdTree.prototype.indent=function(node,nodeId){var str="";if(this.root.id!=node.pid){for(var n=0;n<this.aIndent.length;n++)str+='<img src="'+(this.aIndent[n]==1&&this.config.useLines?this.icon.line:this.icon.empty)+'" alt="" />';node._ls?this.aIndent.push(0):this.aIndent.push(1);if(node._hc){str+='<a href="javascript: '+this._objName+".o("+nodeId+');"><img id="j'+this._objName+nodeId+'" src="';if(!this.config.useLines)str+=node._io?this.icon.nlMinus:this.icon.nlPlus;else str+=node._io?node._ls&&this.config.useLines?this.icon.minusBottom:this.icon.minus:node._ls&&this.config.useLines?this.icon.plusBottom:this.icon.plus;str+='" alt="" /></a>'}else str+='<img src="'+(this.config.useLines?node._ls?this.icon.joinBottom:this.icon.join:this.icon.empty)+'" alt="" />'}return str};wpdTree.prototype.setCS=function(node){var lastId;for(var n=0;n<this.adtNodes.length;n++){if(this.adtNodes[n].pid==node.id)node._hc=true;if(this.adtNodes[n].pid==node.pid)lastId=this.adtNodes[n].id}if(lastId==node.id)node._ls=true};wpdTree.prototype.getSelected=function(){var sn=this.getCookie("cs"+this._objName);return sn?sn:null};wpdTree.prototype.s=function(id){if(!this.config.useSelection)return;var cn=this.adtNodes[id];if(cn._hc&&!this.config.folderLinks)return;if(this.selecteddtNode!=id){if(this.selecteddtNode||this.selecteddtNode==0){var eOld=document.getElementById("s"+this._objName+this.selecteddtNode);if(eOld){eOld.className="node"}}var eNew=document.getElementById("s"+this._objName+id);if(eNew){eNew.className="nodeSel"}this.selecteddtNode=id;if(this.config.useCookies)this.setCookie("cs"+this._objName,cn.id)}};wpdTree.prototype.o=function(id){var cn=this.adtNodes[id];this.nodeStatus(!cn._io,id,cn._ls);cn._io=!cn._io;if(this.config.closeSameLevel)this.closeLevel(cn);if(this.config.useCookies)this.updateCookie()};wpdTree.prototype.oAll=function(status){for(var n=0;n<this.adtNodes.length;n++){if(this.adtNodes[n]._hc&&this.adtNodes[n].pid!=this.root.id){if(this.adtNodes[n]._io!=status)this.nodeStatus(status,n,this.adtNodes[n]._ls);this.adtNodes[n]._io=status}}if(this.config.useCookies)this.updateCookie()};wpdTree.prototype.openTo=function(nId,bSelect,bFirst){if(!bFirst){for(var n=0;n<this.adtNodes.length;n++){if(this.adtNodes[n].id==nId){nId=n;break}}if(n==this.adtNodes.length)return}var cn=this.adtNodes[nId];if(cn===undefined)return;if(cn.pid==this.root.id||!cn._p)return;cn._io=true;cn._is=bSelect;if(this.completed&&cn._hc)this.nodeStatus(true,cn._ai,cn._ls);if(this.completed&&bSelect)this.s(cn._ai);else if(bSelect)this._sn=cn._ai;this.openTo(cn._p._ai,false,true)};wpdTree.prototype.closeLevel=function(node){for(var n=0;n<this.adtNodes.length;n++){if(this.adtNodes[n].pid==node.pid&&this.adtNodes[n].id!=node.id&&this.adtNodes[n]._hc){this.nodeStatus(false,n,this.adtNodes[n]._ls);this.adtNodes[n]._io=false;this.closeAllChildren(this.adtNodes[n])}}};wpdTree.prototype.closeAllChildren=function(node){for(var n=0;n<this.adtNodes.length;n++){if(this.adtNodes[n].pid==node.id&&this.adtNodes[n]._hc){if(this.adtNodes[n]._io)this.nodeStatus(false,n,this.adtNodes[n]._ls);this.adtNodes[n]._io=false;this.closeAllChildren(this.adtNodes[n])}}};wpdTree.prototype.nodeStatus=function(status,id,bottom){var eDiv=document.getElementById("d"+this._objName+id);var eJoin=document.getElementById("j"+this._objName+id);if(this.config.useIcons){var eIcon=document.getElementById("i"+this._objName+id);eIcon.src=status?this.adtNodes[id].iconOpen:this.adtNodes[id].icon}eJoin.src=this.config.useLines?status?bottom?this.icon.minusBottom:this.icon.minus:bottom?this.icon.plusBottom:this.icon.plus:status?this.icon.nlMinus:this.icon.nlPlus;if(WPdTreeSettings.animate==="1"&&typeof jQuery=="function"){status?jQuery(eDiv).slideDown(parseInt(WPdTreeSettings.duration)):jQuery(eDiv).slideUp(parseInt(WPdTreeSettings.duration))}else{eDiv.style.display=status?"block":"none"}};wpdTree.prototype.clearCookie=function(){var now=new Date;var yesterday=new Date(now.getTime()-1e3*60*60*24);this.setCookie("co"+this._objName,"cookieValue",yesterday);this.setCookie("cs"+this._objName,"cookieValue",yesterday)};wpdTree.prototype.setCookie=function(cookieName,cookieValue,expires,path,domain,secure){document.cookie=escape(cookieName)+"="+escape(cookieValue)+(expires?"; expires="+expires.toGMTString():"")+(path?"; path="+path:"; path=/")+(domain?"; domain="+domain:"")+(secure?"; secure":"")};wpdTree.prototype.getCookie=function(cookieName){var prefix=escape(cookieName)+"=";var cookies=document.cookie.split(";");for(var n=0;n<cookies.length;n++){var cookie=cookies[n].replace(/^\s+/,"");if(cookie.indexOf(prefix)==0)return unescape(cookie.substring(prefix.length))}return""};wpdTree.prototype.updateCookie=function(){var str="";for(var n=0;n<this.adtNodes.length;n++){if(this.adtNodes[n]._io&&this.adtNodes[n].pid!=this.root.id){if(str)str+=".";str+=this.adtNodes[n].id}}this.setCookie("co"+this._objName,str)};wpdTree.prototype.isOpen=function(id){var aOpen=this.getCookie("co"+this._objName).split(".");for(var n=0;n<aOpen.length;n++)if(aOpen[n]==id)return true;return false};if(!Array.prototype.push){Array.prototype.push=function array_push(){for(var i=0;i<arguments.length;i++)this[this.length]=arguments[i];return this.length}}if(!Array.prototype.pop){Array.prototype.pop=function array_pop(){var lastElement=this[this.length-1];this.length=Math.max(this.length-1,0);return lastElement}}
  • wp-dtree-30/tags/4.5.4/wp-dtree.php

    r3753595 r3753659  
    44        Plugin URI: https://wordpress.org/plugins/wp-dtree-30/
    55        Description: Collapsible navigation widgets for archives, categories, pages, links, taxonomies and menus.
    6         Version: 4.5.3
    7         Requires at least: 6.0
     6        Version: 4.5.4
     7        Requires at least: 6.0.1
    88        Requires PHP: 7.4
    99        Author: Ulf Benjaminsson
    … …  
    4848                add_action('deleted_term_relationships', 'wpdt_update_cache');
    4949                add_action('wp_update_nav_menu', 'wpdt_update_cache');
     50                // Item metadata is saved after the initial post/term hooks for new items.
     51                add_action('wp_update_nav_menu_item', 'wpdt_update_cache');
    5052                add_action('update_option_permalink_structure', 'wpdt_update_cache');
    5153                add_action('add_link',                  'wpdt_update_cache');
  • wp-dtree-30/trunk/readme.txt

    r3753595 r3753659  
    33Donate link: http://www.amazon.com/gp/registry/wishlist/2QB6SQ5XX2U0N/105-3209188-5640446?reveal=unpurchased&filter=all&sort=priority&layout=standard&x=11&y=10
    44Tags: archive, navigation, category, tree, sidebar
    5 Requires at least: 6.0
     5Requires at least: 6.0.1
    66Tested up to: 7.1
    7 Stable tag: 4.5.3
     7Stable tag: 4.5.4
    88Requires PHP: 7.4
    99License: GPLv2
    … …  
    1616This plugin provides collapsible navigation trees for archives, categories, pages, links, custom taxonomies and menus. Use the widgets in a widget area or the template functions documented below. Archive trees can group posts by year and month.
    1717
    18 Requires WordPress 6.0 or later and PHP 7.4 or later.
     18Requires WordPress 6.0.1 or later and PHP 7.4 or later.
    1919
    2020== Frequently Asked Questions ==
    … …  
    8585== Upgrade Notice ==
    8686
     87= 4.5.4 =
     88Improves menu updates and remembered tree state, and avoids selecting unrelated items. Requires WordPress 6.0.1 or later. Clear any separate page cache after upgrading.
     89
    8790= 4.5.3 =
    8891Fixes missing or duplicate posts in category and custom taxonomy trees, and PHP warnings from incomplete widget settings. Clear any separate page cache after upgrading.
    … …  
    98101
    99102== Changelog ==
     103
     104= 4.5.4 =
     105* Reduce server work when building large menu trees.
     106* Require WordPress 6.0.1 or later to avoid the term-cache bug in WordPress 6.0.
     107* Avoid opening or highlighting an unrelated item when the requested item is absent from the tree.
     108* Prevent similarly named cookies from affecting remembered tree state.
     109* Fix newly added menu items sometimes missing from cached trees.
     110* Prevent tree controls from overwriting variables used by other scripts on the page.
    100111
    101112= 4.5.3 =
  • wp-dtree-30/trunk/wp-dtree-arc.php

    r3753518 r3753659  
    3535                ) ";
    3636        }
     37        // Keep month counts and post selection on the same eligibility rules.
     38        // Leave the post-type placeholder unprepared until the complete query is built.
     39        $where = " WHERE {$wpdb->posts}.post_type = %s AND {$wpdb->posts}.post_status = 'publish'
     40                {$postexclusions}
     41                {$category_filter}";
    3742        // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- SQL fragments contain only trusted wpdb tables, fixed clauses and integer category/exclusion lists.
    38         $query = $wpdb->prepare("SELECT YEAR({$wpdb->posts}.post_date) AS 'year', MONTH({$wpdb->posts}.post_date) AS 'month' {$count}
    39                  $from 
    40                  WHERE {$wpdb->posts}.post_type = %s AND {$wpdb->posts}.post_status = 'publish'
    41                  {$postexclusions}               
    42                  {$category_filter}
     43        $months_query = $wpdb->prepare("SELECT YEAR({$wpdb->posts}.post_date) AS 'year', MONTH({$wpdb->posts}.post_date) AS 'month' {$count}
     44                 {$from}
     45                 {$where}
    4346                 GROUP BY year, month
    4447                 ORDER BY {$wpdb->posts}.post_date DESC", $posttype);
    4548        // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter -- Prepared query assembled immediately above from validated fragments.
    46         $arcresults = $wpdb->get_results($query);               
     49        $arcresults = $wpdb->get_results($months_query);               
    4750
    4851        if(!$arcresults){
    … …  
    5255        $nodelist = array();
    5356        $curyear = -1;
    54         $query = array();               
     57        $month_queries = array();               
    5558        $select_sortby = ($sortby == 'ID' || $sortby == 'post_date' || $sortby == 'post_title') ? '' : ", {$wpdb->posts}.{$sortby} AS '{$sortby}'";
    5659       
    … …  
    9396                $endmonth = wpdt_add_month($startmonth, 1);             
    9497                // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Interpolated fragments use trusted tables, allowlisted columns and integer IDs/limits/exclusions.
    95                 $query[] = $wpdb->prepare("(SELECT {$wpdb->posts}.ID AS 'ID', {$wpdb->posts}.post_date AS 'post_date', {$wpdb->posts}.post_title AS 'post_title', {$pidcount} AS 'pID' {$select_sortby}
     98                $month_queries[] = $wpdb->prepare("(SELECT {$wpdb->posts}.ID AS 'ID', {$wpdb->posts}.post_date AS 'post_date', {$wpdb->posts}.post_title AS 'post_title', {$pidcount} AS 'pID' {$select_sortby}
    9699                         {$from}
    97                          WHERE {$wpdb->posts}.post_type = %s AND {$wpdb->posts}.post_status = 'publish'
     100                         {$where}
    98101                                AND {$wpdb->posts}.post_date >= %s
    99102                                AND {$wpdb->posts}.post_date < %s
    100                          {$postexclusions}     
    101                          {$category_filter}
    102103                         {$month_order}{$limit})", $posttype, $startmonth, $endmonth);
    103104        }
    104105        unset($arcresults);     
    105         if($listposts && count($query)){
    106                 $query = implode(' UNION ALL ', $query) . " ORDER BY {$result_order}";
    107                 //_log($query);
     106        if($listposts && count($month_queries)){
     107                $posts_query = implode(' UNION ALL ', $month_queries) . " ORDER BY {$result_order}";
    108108                // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter -- UNION of prepared month queries; trailing sort column/direction were allowlisted above.
    109                 if($postresults = $wpdb->get_results($query)){
     109                if($postresults = $wpdb->get_results($posts_query)){
    110110                        foreach($postresults as $postresult){                   
    111111                                $text = wp_strip_all_tags(apply_filters('the_title', $postresult->post_title));                 
  • wp-dtree-30/trunk/wp-dtree-mnu.php

    r3744431 r3753659  
    99                return $nodelist;
    1010        }
     11        $menu_ids = array_fill_keys(array_column($menu_items, 'ID'), true);
    1112        foreach((array)$menu_items as $key => $menu_item){
    1213                $pid = $menu_item->menu_item_parent;
    13                 $hasparent = false;                     
    14                 foreach($menu_items as $key => $potential_parent){
    15                         if($potential_parent->ID == $pid){                                     
    16                                 $hasparent = true; break;
    17                         }
    18                 }
    19                 if(!$hasparent){$pid = 0;} //connect orphans to root.
     14                if(!isset($menu_ids[(int)$pid])){$pid = 0;} //connect orphans to root.
    2015                $nodelist[$idcount] = array(
    2116                        'id' => $menu_item->ID,
  • wp-dtree-30/trunk/wp-dtree.js

    r2056379 r3753659  
    6969        this.title = title;     
    7070        this.rsspath = rsspath; //for feed link.
    71         var icon, iconOpen, open; //these were originally passed as parameters, but were never used in wp-dtree.       
    7271        this.target = targ;
    73         this.icon = icon;
    74         this.iconOpen = iconOpen;
    75         this._io = open || false;
     72        this.icon = undefined;
     73        this.iconOpen = undefined;
     74        this._io = false;
    7675        this._is = false;
    7776        this._ls = false;
    … …  
    139138 
    140139wpdTree.prototype.truncate = function(str, length){
    141     var length = length || 16;
     140    length = length || 16;
    142141    var truncation = '...';
    143142    if(str.length > length)  {
    … …  
    217216                else if((!this.config.folderLinks || !node.url) && node._hc && node.pid != this.root.id){
    218217                        str += '<a href="javascript: ' + this._objName + '.o(' + nodeId + ');"'
    219                         if(true || node.title) str += ' title="' + node.title + '"';
     218                        str += ' title="' + node.title + '"';
    220219                        str += ' class="node">';
    221220                }
    … …  
    276275        if(this.selecteddtNode != id){
    277276                if(this.selecteddtNode || this.selecteddtNode==0){
    278                         eOld = document.getElementById("s" + this._objName + this.selecteddtNode);
     277                        var eOld = document.getElementById("s" + this._objName + this.selecteddtNode);
    279278                        if(eOld){
    280279                                eOld.className = "node";
    281280                        }
    282281                }
    283                 eNew = document.getElementById("s" + this._objName + id);
     282                var eNew = document.getElementById("s" + this._objName + id);
    284283                if(eNew){
    285284                        eNew.className = "nodeSel";
    … …  
    320319                        }
    321320                }
     321                // A public node ID is not an array index when no match was found.
     322                if(n == this.adtNodes.length) return;
    322323        }
    323324        var cn=this.adtNodes[nId];     
    … …  
    356357// Change the status of a node(open or closed)
    357358wpdTree.prototype.nodeStatus = function(status, id, bottom){
    358         eDiv    = document.getElementById('d' + this._objName + id);
    359         eJoin   = document.getElementById('j' + this._objName + id);
     359        var eDiv        = document.getElementById('d' + this._objName + id);
     360        var eJoin       = document.getElementById('j' + this._objName + id);
    360361        if(this.config.useIcons){
    361                 eIcon   = document.getElementById('i' + this._objName + id);
     362                var eIcon       = document.getElementById('i' + this._objName + id);
    362363                eIcon.src = (status) ? this.adtNodes[id].iconOpen : this.adtNodes[id].icon;
    363364        }
    … …  
    393394// [Cookie] Gets a value from a cookie
    394395wpdTree.prototype.getCookie = function(cookieName){
    395         var cookieValue = '';
    396         var posName = document.cookie.indexOf(escape(cookieName) + '=');
    397         if(posName != -1){
    398                 var posValue = posName + (escape(cookieName) + '=').length;
    399                 var endPos = document.cookie.indexOf(';', posValue);
    400                 if(endPos != -1) cookieValue = unescape(document.cookie.substring(posValue, endPos));
    401                 else cookieValue = unescape(document.cookie.substring(posValue));
    402         }
    403         return (cookieValue);
     396        var prefix = escape(cookieName) + '=';
     397        var cookies = document.cookie.split(';');
     398        for(var n=0; n<cookies.length; n++){
     399                var cookie = cookies[n].replace(/^\s+/, '');
     400                if(cookie.indexOf(prefix) == 0) return unescape(cookie.substring(prefix.length));
     401        }
     402        return '';
    404403};
    405404
    … …  
    434433if(!Array.prototype.pop){
    435434        Array.prototype.pop = function array_pop(){
    436                 lastElement = this[this.length-1];
     435                var lastElement = this[this.length-1];
    437436                this.length = Math.max(this.length-1,0);
    438437                return lastElement;
  • wp-dtree-30/trunk/wp-dtree.min.js

    r2056379 r3753659  
    1 function dtNode(t,e,i,s,o,n,d){this.id=t,this.pid=e,this.name=i,this.url=s,this.title=o,this.rsspath=d,this.target=n,this.icon=void 0,this.iconOpen=void 0,this._io=!1,this._is=!1,this._ls=!1,this._hc=!1,this._ai=0,this._p}function wpdTree(t,e,i){this.config={target:null,folderLinks:!1,useSelection:!1,useCookies:!0,useLines:!0,useIcons:!1,useStatusText:!1,closeSameLevel:!1,inOrder:!1},this.icon={root:WPdTreeSettings.imgurl+"dtree-img/empty.gif",folder:WPdTreeSettings.imgurl+"dtree-img/folder.gif",folderOpen:WPdTreeSettings.imgurl+"dtree-img/folderopen.gif",node:WPdTreeSettings.imgurl+"dtree-img/page.gif",empty:WPdTreeSettings.imgurl+"dtree-img/empty.gif",line:WPdTreeSettings.imgurl+"dtree-img/line.gif",join:WPdTreeSettings.imgurl+"dtree-img/join.gif",joinBottom:WPdTreeSettings.imgurl+"dtree-img/joinbottom.gif",plus:WPdTreeSettings.imgurl+"dtree-img/plus.gif",plusBottom:WPdTreeSettings.imgurl+"dtree-img/plusbottom.gif",minus:WPdTreeSettings.imgurl+"dtree-img/minus.gif",minusBottom:WPdTreeSettings.imgurl+"dtree-img/minusbottom.gif",nlPlus:WPdTreeSettings.imgurl+"dtree-img/nolines_plus.gif",nlMinus:WPdTreeSettings.imgurl+"dtree-img/nolines_minus.gif"},this._url=e,this._truncate=i,this._objName=t,this.adtNodes=[],this.aIndent=[],this.root=new dtNode("root"),this.selecteddtNode=null,this.selectedFound=!1,this.completed=!1}wpdTree.prototype.a=function(t,e,i,s,o,n,d){""!=d&&(d="<a class='dtree-rss' href='"+this._url+d+"' title='Feed for "+i+"'></a>");var r=o+="";0!=o.indexOf("https://")&&0!=o.indexOf("http://")&&(r=this._url+o),s||(s=i),this._truncate>0&&(i=this.truncate(i,this._truncate)),this.adtNodes[this.adtNodes.length]=new dtNode(t,e,i,r,s,n,d)},wpdTree.prototype.truncate=function(t,e){e=e||16;return t.length>e?t.slice(0,e-"...".length)+"...":t},wpdTree.prototype.openAll=function(){this.oAll(!0)},wpdTree.prototype.closeAll=function(){this.oAll(!1)},wpdTree.prototype.toString=function(){var t='<div class="dtree_'+this._objName.substr(0,3)+'" id="dtree_'+this._objName+'">\n';return document.getElementById?(this.config.useCookies&&(this.selecteddtNode=this.getSelected()),t+=this.adddtNode(this.root)):t+="Browser not supported.",t+="</div>",this.selectedFound||(this.selecteddtNode=null),this.completed=!0,t},wpdTree.prototype.adddtNode=function(t){var e="",i=0;for(this.config.inOrder&&(i=t._ai);i<this.adtNodes.length;i++)if(this.adtNodes[i].pid==t.id){var s=this.adtNodes[i];if(s._p=t,s._ai=i,this.setCS(s),!s.target&&this.config.target&&(s.target=this.config.target),s._hc&&!s._io&&this.config.useCookies&&(s._io=this.isOpen(s.id)),!this.config.folderLinks&&s._hc&&(s.url=null),this.config.useSelection&&s.id==this.selecteddtNode&&!this.selectedFound&&(s._is=!0,this.selecteddtNode=i,this.selectedFound=!0),e+=this.node(s,i),s._ls)break}return e},wpdTree.prototype.node=function(t,e){var i='<div class="dtNode">'+this.indent(t,e);return this.config.useIcons&&(t.icon||(t.icon=this.root.id==t.pid?this.icon.root:t._hc?this.icon.folder:this.icon.node),t.iconOpen||(t.iconOpen=t._hc?this.icon.folderOpen:this.icon.node),this.root.id!=t.pid&&(i+='<img id="i'+this._objName+e+'" src="'+(t._io?t.iconOpen:t.icon)+'" alt="" />')),this.root.id!=t.pid&&(t.url?(i+='<a id="s'+this._objName+e+'" class="'+(this.config.useSelection&&t._is?"nodeSel":"node")+'" href="'+t.url+'"',t.title&&(i+=' title="'+t.title+'"'),t.target&&(i+=' target="'+t.target+'"'),this.config.useStatusText&&(i+=" onmouseover=\"window.status='"+t.name+"';return true;\" onmouseout=\"window.status='';return true;\" "),this.config.useSelection&&(t._hc&&this.config.folderLinks||!t._hc)&&(i+=' onclick="javascript: '+this._objName+".s("+e+');"'),i+=">"):this.config.folderLinks&&t.url||!t._hc||t.pid==this.root.id||(i+='<a href="javascript: '+this._objName+".o("+e+');"',i+=' title="'+t.title+'"',i+=' class="node">'),i+=t.name,!t.url&&(this.config.folderLinks&&t.url||!t._hc)||(i+="</a>")),t.rsspath&&(i+=t.rsspath),i+=" </div>",t._hc&&(i+='<div id="d'+this._objName+e+'" class="clip" style="display:'+(this.root.id==t.pid||t._io?"block":"none")+';">',i+=this.adddtNode(t),i+="</div>"),this.aIndent.pop(),i},wpdTree.prototype.indent=function(t,e){var i="";if(this.root.id!=t.pid){for(var s=0;s<this.aIndent.length;s++)i+='<img src="'+(1==this.aIndent[s]&&this.config.useLines?this.icon.line:this.icon.empty)+'" alt="" />';t._ls?this.aIndent.push(0):this.aIndent.push(1),t._hc?(i+='<a href="javascript: '+this._objName+".o("+e+');"><img id="j'+this._objName+e+'" src="',this.config.useLines?i+=t._io?t._ls&&this.config.useLines?this.icon.minusBottom:this.icon.minus:t._ls&&this.config.useLines?this.icon.plusBottom:this.icon.plus:i+=t._io?this.icon.nlMinus:this.icon.nlPlus,i+='" alt="" /></a>'):i+='<img src="'+(this.config.useLines?t._ls?this.icon.joinBottom:this.icon.join:this.icon.empty)+'" alt="" />'}return i},wpdTree.prototype.setCS=function(t){for(var e,i=0;i<this.adtNodes.length;i++)this.adtNodes[i].pid==t.id&&(t._hc=!0),this.adtNodes[i].pid==t.pid&&(e=this.adtNodes[i].id);e==t.id&&(t._ls=!0)},wpdTree.prototype.getSelected=function(){var t=this.getCookie("cs"+this._objName);return t||null},wpdTree.prototype.s=function(t){if(this.config.useSelection){var e=this.adtNodes[t];e._hc&&!this.config.folderLinks||this.selecteddtNode!=t&&((this.selecteddtNode||0==this.selecteddtNode)&&(eOld=document.getElementById("s"+this._objName+this.selecteddtNode),eOld&&(eOld.className="node")),eNew=document.getElementById("s"+this._objName+t),eNew&&(eNew.className="nodeSel"),this.selecteddtNode=t,this.config.useCookies&&this.setCookie("cs"+this._objName,e.id))}},wpdTree.prototype.o=function(t){var e=this.adtNodes[t];this.nodeStatus(!e._io,t,e._ls),e._io=!e._io,this.config.closeSameLevel&&this.closeLevel(e),this.config.useCookies&&this.updateCookie()},wpdTree.prototype.oAll=function(t){for(var e=0;e<this.adtNodes.length;e++)this.adtNodes[e]._hc&&this.adtNodes[e].pid!=this.root.id&&(this.adtNodes[e]._io!=t&&this.nodeStatus(t,e,this.adtNodes[e]._ls),this.adtNodes[e]._io=t);this.config.useCookies&&this.updateCookie()},wpdTree.prototype.openTo=function(t,e,i){if(!i)for(var s=0;s<this.adtNodes.length;s++)if(this.adtNodes[s].id==t){t=s;break}var o=this.adtNodes[t];void 0!==o&&o.pid!=this.root.id&&o._p&&(o._io=!0,o._is=e,this.completed&&o._hc&&this.nodeStatus(!0,o._ai,o._ls),this.completed&&e?this.s(o._ai):e&&(this._sn=o._ai),this.openTo(o._p._ai,!1,!0))},wpdTree.prototype.closeLevel=function(t){for(var e=0;e<this.adtNodes.length;e++)this.adtNodes[e].pid==t.pid&&this.adtNodes[e].id!=t.id&&this.adtNodes[e]._hc&&(this.nodeStatus(!1,e,this.adtNodes[e]._ls),this.adtNodes[e]._io=!1,this.closeAllChildren(this.adtNodes[e]))},wpdTree.prototype.closeAllChildren=function(t){for(var e=0;e<this.adtNodes.length;e++)this.adtNodes[e].pid==t.id&&this.adtNodes[e]._hc&&(this.adtNodes[e]._io&&this.nodeStatus(!1,e,this.adtNodes[e]._ls),this.adtNodes[e]._io=!1,this.closeAllChildren(this.adtNodes[e]))},wpdTree.prototype.nodeStatus=function(t,e,i){eDiv=document.getElementById("d"+this._objName+e),eJoin=document.getElementById("j"+this._objName+e),this.config.useIcons&&(eIcon=document.getElementById("i"+this._objName+e),eIcon.src=t?this.adtNodes[e].iconOpen:this.adtNodes[e].icon),eJoin.src=this.config.useLines?t?i?this.icon.minusBottom:this.icon.minus:i?this.icon.plusBottom:this.icon.plus:t?this.icon.nlMinus:this.icon.nlPlus,"1"===WPdTreeSettings.animate&&"function"==typeof jQuery?t?jQuery(eDiv).slideDown(parseInt(WPdTreeSettings.duration)):jQuery(eDiv).slideUp(parseInt(WPdTreeSettings.duration)):eDiv.style.display=t?"block":"none"},wpdTree.prototype.clearCookie=function(){var t=new Date,e=new Date(t.getTime()-864e5);this.setCookie("co"+this._objName,"cookieValue",e),this.setCookie("cs"+this._objName,"cookieValue",e)},wpdTree.prototype.setCookie=function(t,e,i,s,o,n){document.cookie=escape(t)+"="+escape(e)+(i?"; expires="+i.toGMTString():"")+(s?"; path="+s:"; path=/")+(o?"; domain="+o:"")+(n?"; secure":"")},wpdTree.prototype.getCookie=function(t){var e="",i=document.cookie.indexOf(escape(t)+"=");if(-1!=i){var s=i+(escape(t)+"=").length,o=document.cookie.indexOf(";",s);e=-1!=o?unescape(document.cookie.substring(s,o)):unescape(document.cookie.substring(s))}return e},wpdTree.prototype.updateCookie=function(){for(var t="",e=0;e<this.adtNodes.length;e++)this.adtNodes[e]._io&&this.adtNodes[e].pid!=this.root.id&&(t&&(t+="."),t+=this.adtNodes[e].id);this.setCookie("co"+this._objName,t)},wpdTree.prototype.isOpen=function(t){for(var e=this.getCookie("co"+this._objName).split("."),i=0;i<e.length;i++)if(e[i]==t)return!0;return!1},Array.prototype.push||(Array.prototype.push=function(){for(var t=0;t<arguments.length;t++)this[this.length]=arguments[t];return this.length}),Array.prototype.pop||(Array.prototype.pop=function(){return lastElement=this[this.length-1],this.length=Math.max(this.length-1,0),lastElement});
     1/*--------------------------------------------------|
     2| WP-dTree 2.2 | www.silpstream.com/blog/           |
     3|---------------------------------------------------|
     4| Copyright (c) 2006 Christopher Hwang              |
     5| Release Date: July 2006                           |
     6| Modifications:                                    |
     7| v2.2 Added support for generating page trees      |
     8|      Added support for excluding specific posts   |
     9|      from tree                                    |
     10|      Updated option menu                          |
     11|      Rewrite of base code                         |
     12|      Fixed support for tooltips on non-linked     |
     13|      folders                                      |
     14|      Added option for not displaying posts in     |
     15|      archive tree                                 |
     16| v2.1 Patch to work with Regulus theme             |
     17|      Ability to change open/close all link        |
     18|      Set folders as links option                  |
     19|      Highlight current position in blog           |
     20| v2.0 Support for scriptaculous effects added      |
     21|      Category based menu added                    |
     22|      Support for wpdTree options was built in       |
     23|      Option menu added to admin panel             |
     24|       v1.0 Work arounds added for wordpress beautified |
     25|      permalinks.                                  |
     26|--------------------------------------------------*/
     27/*--------------------------------------------------|
     28| wpdTree 2.05 | www.destroydrop.com/javascript/tree/ |
     29|---------------------------------------------------|
     30| Copyright (c) 2002-2003 Geir Landr?               |
     31|                                                   |
     32| This script can be used freely as long as all     |
     33| copyright messages are intact.                    |
     34|                                                   |
     35| Updated: 17.04.2003                               |
     36|--------------------------------------------------*/
     37function dtNode(id,pid,name,url,title,targ,rsspath){this.id=id;this.pid=pid;this.name=name;this.url=url;this.title=title;this.rsspath=rsspath;this.target=targ;this.icon=undefined;this.iconOpen=undefined;this._io=false;this._is=false;this._ls=false;this._hc=false;this._ai=0;this._p}function wpdTree(objName,baseUrl,truncate){this.config={target:null,folderLinks:false,useSelection:false,useCookies:true,useLines:true,useIcons:false,useStatusText:false,closeSameLevel:false,inOrder:false};this.icon={root:WPdTreeSettings.imgurl+"dtree-img/empty.gif",folder:WPdTreeSettings.imgurl+"dtree-img/folder.gif",folderOpen:WPdTreeSettings.imgurl+"dtree-img/folderopen.gif",node:WPdTreeSettings.imgurl+"dtree-img/page.gif",empty:WPdTreeSettings.imgurl+"dtree-img/empty.gif",line:WPdTreeSettings.imgurl+"dtree-img/line.gif",join:WPdTreeSettings.imgurl+"dtree-img/join.gif",joinBottom:WPdTreeSettings.imgurl+"dtree-img/joinbottom.gif",plus:WPdTreeSettings.imgurl+"dtree-img/plus.gif",plusBottom:WPdTreeSettings.imgurl+"dtree-img/plusbottom.gif",minus:WPdTreeSettings.imgurl+"dtree-img/minus.gif",minusBottom:WPdTreeSettings.imgurl+"dtree-img/minusbottom.gif",nlPlus:WPdTreeSettings.imgurl+"dtree-img/nolines_plus.gif",nlMinus:WPdTreeSettings.imgurl+"dtree-img/nolines_minus.gif"};this._url=baseUrl;this._truncate=truncate;this._objName=objName;this.adtNodes=[];this.aIndent=[];this.root=new dtNode("root");this.selecteddtNode=null;this.selectedFound=false;this.completed=false}wpdTree.prototype.a=function(id,pid,name,title,path,link_target,rsspath){if(rsspath!=""){rsspath="<a class='dtree-rss' href='"+this._url+rsspath+"' title='Feed for "+name+"'></a>"}path+="";var url=path;if(path.indexOf("https://")!=0&&path.indexOf("http://")!=0){url=this._url+path}if(!title){title=name}if(this._truncate>0){name=this.truncate(name,this._truncate)}this.adtNodes[this.adtNodes.length]=new dtNode(id,pid,name,url,title,link_target,rsspath)};wpdTree.prototype.truncate=function(str,length){length=length||16;var truncation="...";if(str.length>length){return str.slice(0,length-truncation.length)+truncation}return str};wpdTree.prototype.openAll=function(){this.oAll(true)};wpdTree.prototype.closeAll=function(){this.oAll(false)};wpdTree.prototype.toString=function(){var type=this._objName.substr(0,3);var str='<div class="dtree_'+type+'" id="dtree_'+this._objName+'">\n';if(document.getElementById){if(this.config.useCookies)this.selecteddtNode=this.getSelected();str+=this.adddtNode(this.root)}else str+="Browser not supported.";str+="</div>";if(!this.selectedFound)this.selecteddtNode=null;this.completed=true;return str};wpdTree.prototype.adddtNode=function(pdtNode){var str="";var n=0;if(this.config.inOrder)n=pdtNode._ai;for(n;n<this.adtNodes.length;n++){if(this.adtNodes[n].pid==pdtNode.id){var cn=this.adtNodes[n];cn._p=pdtNode;cn._ai=n;this.setCS(cn);if(!cn.target&&this.config.target)cn.target=this.config.target;if(cn._hc&&!cn._io&&this.config.useCookies)cn._io=this.isOpen(cn.id);if(!this.config.folderLinks&&cn._hc)cn.url=null;if(this.config.useSelection&&cn.id==this.selecteddtNode&&!this.selectedFound){cn._is=true;this.selecteddtNode=n;this.selectedFound=true}str+=this.node(cn,n);if(cn._ls)break}}return str};wpdTree.prototype.node=function(node,nodeId){var str='<div class="dtNode">'+this.indent(node,nodeId);if(this.config.useIcons){if(!node.icon)node.icon=this.root.id==node.pid?this.icon.root:node._hc?this.icon.folder:this.icon.node;if(!node.iconOpen)node.iconOpen=node._hc?this.icon.folderOpen:this.icon.node;if(this.root.id!=node.pid){str+='<img id="i'+this._objName+nodeId+'" src="'+(node._io?node.iconOpen:node.icon)+'" alt="" />'}}if(this.root.id!=node.pid){if(node.url){str+='<a id="s'+this._objName+nodeId+'" class="'+(this.config.useSelection?node._is?"nodeSel":"node":"node")+'" href="'+node.url+'"';if(node.title)str+=' title="'+node.title+'"';if(node.target)str+=' target="'+node.target+'"';if(this.config.useStatusText)str+=" onmouseover=\"window.status='"+node.name+"';return true;\" onmouseout=\"window.status='';return true;\" ";if(this.config.useSelection&&(node._hc&&this.config.folderLinks||!node._hc))str+=' onclick="javascript: '+this._objName+".s("+nodeId+');"';str+=">"}else if((!this.config.folderLinks||!node.url)&&node._hc&&node.pid!=this.root.id){str+='<a href="javascript: '+this._objName+".o("+nodeId+');"';str+=' title="'+node.title+'"';str+=' class="node">'}str+=node.name;if(node.url||(!this.config.folderLinks||!node.url)&&node._hc)str+="</a>"}if(node.rsspath){str+=node.rsspath}str+=" </div>";if(node._hc){str+='<div id="d'+this._objName+nodeId+'" class="clip" style="display:'+(this.root.id==node.pid||node._io?"block":"none")+';">';str+=this.adddtNode(node);str+="</div>"}this.aIndent.pop();return str};wpdTree.prototype.indent=function(node,nodeId){var str="";if(this.root.id!=node.pid){for(var n=0;n<this.aIndent.length;n++)str+='<img src="'+(this.aIndent[n]==1&&this.config.useLines?this.icon.line:this.icon.empty)+'" alt="" />';node._ls?this.aIndent.push(0):this.aIndent.push(1);if(node._hc){str+='<a href="javascript: '+this._objName+".o("+nodeId+');"><img id="j'+this._objName+nodeId+'" src="';if(!this.config.useLines)str+=node._io?this.icon.nlMinus:this.icon.nlPlus;else str+=node._io?node._ls&&this.config.useLines?this.icon.minusBottom:this.icon.minus:node._ls&&this.config.useLines?this.icon.plusBottom:this.icon.plus;str+='" alt="" /></a>'}else str+='<img src="'+(this.config.useLines?node._ls?this.icon.joinBottom:this.icon.join:this.icon.empty)+'" alt="" />'}return str};wpdTree.prototype.setCS=function(node){var lastId;for(var n=0;n<this.adtNodes.length;n++){if(this.adtNodes[n].pid==node.id)node._hc=true;if(this.adtNodes[n].pid==node.pid)lastId=this.adtNodes[n].id}if(lastId==node.id)node._ls=true};wpdTree.prototype.getSelected=function(){var sn=this.getCookie("cs"+this._objName);return sn?sn:null};wpdTree.prototype.s=function(id){if(!this.config.useSelection)return;var cn=this.adtNodes[id];if(cn._hc&&!this.config.folderLinks)return;if(this.selecteddtNode!=id){if(this.selecteddtNode||this.selecteddtNode==0){var eOld=document.getElementById("s"+this._objName+this.selecteddtNode);if(eOld){eOld.className="node"}}var eNew=document.getElementById("s"+this._objName+id);if(eNew){eNew.className="nodeSel"}this.selecteddtNode=id;if(this.config.useCookies)this.setCookie("cs"+this._objName,cn.id)}};wpdTree.prototype.o=function(id){var cn=this.adtNodes[id];this.nodeStatus(!cn._io,id,cn._ls);cn._io=!cn._io;if(this.config.closeSameLevel)this.closeLevel(cn);if(this.config.useCookies)this.updateCookie()};wpdTree.prototype.oAll=function(status){for(var n=0;n<this.adtNodes.length;n++){if(this.adtNodes[n]._hc&&this.adtNodes[n].pid!=this.root.id){if(this.adtNodes[n]._io!=status)this.nodeStatus(status,n,this.adtNodes[n]._ls);this.adtNodes[n]._io=status}}if(this.config.useCookies)this.updateCookie()};wpdTree.prototype.openTo=function(nId,bSelect,bFirst){if(!bFirst){for(var n=0;n<this.adtNodes.length;n++){if(this.adtNodes[n].id==nId){nId=n;break}}if(n==this.adtNodes.length)return}var cn=this.adtNodes[nId];if(cn===undefined)return;if(cn.pid==this.root.id||!cn._p)return;cn._io=true;cn._is=bSelect;if(this.completed&&cn._hc)this.nodeStatus(true,cn._ai,cn._ls);if(this.completed&&bSelect)this.s(cn._ai);else if(bSelect)this._sn=cn._ai;this.openTo(cn._p._ai,false,true)};wpdTree.prototype.closeLevel=function(node){for(var n=0;n<this.adtNodes.length;n++){if(this.adtNodes[n].pid==node.pid&&this.adtNodes[n].id!=node.id&&this.adtNodes[n]._hc){this.nodeStatus(false,n,this.adtNodes[n]._ls);this.adtNodes[n]._io=false;this.closeAllChildren(this.adtNodes[n])}}};wpdTree.prototype.closeAllChildren=function(node){for(var n=0;n<this.adtNodes.length;n++){if(this.adtNodes[n].pid==node.id&&this.adtNodes[n]._hc){if(this.adtNodes[n]._io)this.nodeStatus(false,n,this.adtNodes[n]._ls);this.adtNodes[n]._io=false;this.closeAllChildren(this.adtNodes[n])}}};wpdTree.prototype.nodeStatus=function(status,id,bottom){var eDiv=document.getElementById("d"+this._objName+id);var eJoin=document.getElementById("j"+this._objName+id);if(this.config.useIcons){var eIcon=document.getElementById("i"+this._objName+id);eIcon.src=status?this.adtNodes[id].iconOpen:this.adtNodes[id].icon}eJoin.src=this.config.useLines?status?bottom?this.icon.minusBottom:this.icon.minus:bottom?this.icon.plusBottom:this.icon.plus:status?this.icon.nlMinus:this.icon.nlPlus;if(WPdTreeSettings.animate==="1"&&typeof jQuery=="function"){status?jQuery(eDiv).slideDown(parseInt(WPdTreeSettings.duration)):jQuery(eDiv).slideUp(parseInt(WPdTreeSettings.duration))}else{eDiv.style.display=status?"block":"none"}};wpdTree.prototype.clearCookie=function(){var now=new Date;var yesterday=new Date(now.getTime()-1e3*60*60*24);this.setCookie("co"+this._objName,"cookieValue",yesterday);this.setCookie("cs"+this._objName,"cookieValue",yesterday)};wpdTree.prototype.setCookie=function(cookieName,cookieValue,expires,path,domain,secure){document.cookie=escape(cookieName)+"="+escape(cookieValue)+(expires?"; expires="+expires.toGMTString():"")+(path?"; path="+path:"; path=/")+(domain?"; domain="+domain:"")+(secure?"; secure":"")};wpdTree.prototype.getCookie=function(cookieName){var prefix=escape(cookieName)+"=";var cookies=document.cookie.split(";");for(var n=0;n<cookies.length;n++){var cookie=cookies[n].replace(/^\s+/,"");if(cookie.indexOf(prefix)==0)return unescape(cookie.substring(prefix.length))}return""};wpdTree.prototype.updateCookie=function(){var str="";for(var n=0;n<this.adtNodes.length;n++){if(this.adtNodes[n]._io&&this.adtNodes[n].pid!=this.root.id){if(str)str+=".";str+=this.adtNodes[n].id}}this.setCookie("co"+this._objName,str)};wpdTree.prototype.isOpen=function(id){var aOpen=this.getCookie("co"+this._objName).split(".");for(var n=0;n<aOpen.length;n++)if(aOpen[n]==id)return true;return false};if(!Array.prototype.push){Array.prototype.push=function array_push(){for(var i=0;i<arguments.length;i++)this[this.length]=arguments[i];return this.length}}if(!Array.prototype.pop){Array.prototype.pop=function array_pop(){var lastElement=this[this.length-1];this.length=Math.max(this.length-1,0);return lastElement}}
  • wp-dtree-30/trunk/wp-dtree.php

    r3753595 r3753659  
    44        Plugin URI: https://wordpress.org/plugins/wp-dtree-30/
    55        Description: Collapsible navigation widgets for archives, categories, pages, links, taxonomies and menus.
    6         Version: 4.5.3
    7         Requires at least: 6.0
     6        Version: 4.5.4
     7        Requires at least: 6.0.1
    88        Requires PHP: 7.4
    99        Author: Ulf Benjaminsson
    … …  
    4848                add_action('deleted_term_relationships', 'wpdt_update_cache');
    4949                add_action('wp_update_nav_menu', 'wpdt_update_cache');
     50                // Item metadata is saved after the initial post/term hooks for new items.
     51                add_action('wp_update_nav_menu_item', 'wpdt_update_cache');
    5052                add_action('update_option_permalink_structure', 'wpdt_update_cache');
    5153                add_action('add_link',                  'wpdt_update_cache');
Note: See TracChangeset for help on using the changeset viewer.