Version Description
- bugfix : in shortcode processing, any supplied Alternative settings weren't being used. thanks corrideat
- bugfix : prevent texturization of shortcode's content, for when it is being used with an Alternative setting
- addition : the ability to make a title into a link when the title has been set from a menu item
Download this release
Release Info
Developer | wizzud |
Plugin | Custom Menu Wizard Widget |
Version | 3.1.4 |
Comparing to | |
See all releases |
Code changes from version 3.1.3 to 3.1.4
- custom-menu-wizard.css +1 -0
- custom-menu-wizard.js +8 -1
- custom-menu-wizard.min.js +52 -52
- custom-menu-wizard.php +22 -3
- include/class.walker.php +8 -6
- include/class.widget.php +44 -7
- readme.txt +20 -3
custom-menu-wizard.css
CHANGED
@@ -125,6 +125,7 @@ a.widget-custom-menu-wizard-fieldset.cmw-collapsed-fieldset:active {background-p
|
|
125 |
/*...output...*/
|
126 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput {float:right; margin:0 0 3.5em 0.5em;}
|
127 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput h3 {border-bottom:1px solid #CCCCCC; font-size:1.1667em; margin:0.25em 0; padding: 0 0.857em 0.25em 0.643em;}
|
|
|
128 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput-wrap {border:1px solid #cccccc; margin:0.5em 0; min-height:3em; min-width:10em; padding:0 0 1px;}
|
129 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput-wrap {border-left:4px solid #2ea2cc;}
|
130 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput-wrap ul,
|
125 |
/*...output...*/
|
126 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput {float:right; margin:0 0 3.5em 0.5em;}
|
127 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput h3 {border-bottom:1px solid #CCCCCC; font-size:1.1667em; margin:0.25em 0; padding: 0 0.857em 0.25em 0.643em;}
|
128 |
+
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput h3.cmw-title-linked {cursor:pointer; text-decoration:underline;}
|
129 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput-wrap {border:1px solid #cccccc; margin:0.5em 0; min-height:3em; min-width:10em; padding:0 0 1px;}
|
130 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput-wrap {border-left:4px solid #2ea2cc;}
|
131 |
.widget-custom-menu-wizard-dialog .cmw-demo-theoutput-wrap ul,
|
custom-menu-wizard.js
CHANGED
@@ -106,6 +106,7 @@ jQuery(function($){
|
|
106 |
'fallback' : '',
|
107 |
'flat_output' : 0,
|
108 |
'title_from' : '',
|
|
|
109 |
'ol_root' : 0,
|
110 |
'ol_sub' : 0
|
111 |
},
|
@@ -363,6 +364,7 @@ jQuery(function($){
|
|
363 |
items = topOfMenu.find('.picked'),
|
364 |
html = '',
|
365 |
title = settings.hide_title ? '' : settings.title,
|
|
|
366 |
currLevel = 0,
|
367 |
output = dialog.find('.cmw-demo-theoutput-wrap').empty(),
|
368 |
listClass = ['menu-widget'],
|
@@ -370,6 +372,7 @@ jQuery(function($){
|
|
370 |
if(items.length && output.length){
|
371 |
//determine title: update() might have set a class for it...
|
372 |
title = topOfMenu.find('.title-from-item').children('.cmw-item').text() || '';
|
|
|
373 |
//...otherwise, check the actual widget title...
|
374 |
if(!title && !settings.hide_title){
|
375 |
title = settings.title || '';
|
@@ -417,7 +420,7 @@ jQuery(function($){
|
|
417 |
}).addClass('cmw-has-submenu');
|
418 |
}
|
419 |
if(output.length && title && (items.length || !settings.hide_empty)){
|
420 |
-
output.prepend('<h3>' + title + '</h3>');
|
421 |
}
|
422 |
}, //end showOutput()
|
423 |
/**
|
@@ -1091,6 +1094,10 @@ jQuery(function($){
|
|
1091 |
}
|
1092 |
if(n.length){
|
1093 |
args.title_from = n;
|
|
|
|
|
|
|
|
|
1094 |
}
|
1095 |
//switches...
|
1096 |
for(n in {siblings:1, flat_output:1, ol_root:1, ol_sub:1, fallback_ci_parent:1}){
|
106 |
'fallback' : '',
|
107 |
'flat_output' : 0,
|
108 |
'title_from' : '',
|
109 |
+
'title_linked' : 0,
|
110 |
'ol_root' : 0,
|
111 |
'ol_sub' : 0
|
112 |
},
|
364 |
items = topOfMenu.find('.picked'),
|
365 |
html = '',
|
366 |
title = settings.hide_title ? '' : settings.title,
|
367 |
+
titleLinked = 0,
|
368 |
currLevel = 0,
|
369 |
output = dialog.find('.cmw-demo-theoutput-wrap').empty(),
|
370 |
listClass = ['menu-widget'],
|
372 |
if(items.length && output.length){
|
373 |
//determine title: update() might have set a class for it...
|
374 |
title = topOfMenu.find('.title-from-item').children('.cmw-item').text() || '';
|
375 |
+
titleLinked = !!title && !!settings.title_linked;
|
376 |
//...otherwise, check the actual widget title...
|
377 |
if(!title && !settings.hide_title){
|
378 |
title = settings.title || '';
|
420 |
}).addClass('cmw-has-submenu');
|
421 |
}
|
422 |
if(output.length && title && (items.length || !settings.hide_empty)){
|
423 |
+
output.prepend((titleLinked ? '<h3 class="cmw-title-linked">' : '<h3>') + title + '</h3>');
|
424 |
}
|
425 |
}, //end showOutput()
|
426 |
/**
|
1094 |
}
|
1095 |
if(n.length){
|
1096 |
args.title_from = n;
|
1097 |
+
//...title_linked is only relevant if title_from is set...
|
1098 |
+
if(settings.title_linked){
|
1099 |
+
args.title_linked = 1;
|
1100 |
+
}
|
1101 |
}
|
1102 |
//switches...
|
1103 |
for(n in {siblings:1, flat_output:1, ol_root:1, ol_sub:1, fallback_ci_parent:1}){
|
custom-menu-wizard.min.js
CHANGED
@@ -1,59 +1,59 @@
|
|
1 |
/*Source: custom-menu-wizard.js
|
2 |
-
*Compiled:
|
3 |
*STATISTICS
|
4 |
-
* - originalSize:
|
5 |
-
* - originalGzipSize:
|
6 |
-
* - compressedSize:
|
7 |
-
* - compressedGzipSize:
|
8 |
*/
|
9 |
-
jQuery(function(g){var
|
10 |
-
f);g.each(c?a:b.find(":input").serializeArray(),function(a,b){var h=b.name.replace(/.*\[([^\]]+)\]$/,"$1"),p=!m[h]&&/^-?\d+$/.test(b.value)?parseInt(b.value,10):b.value;e[h]=p;"hide_empty"===h?e[h]=c||!!d.cmwV36plus||p:f[h]&&(e["_"+h+"_sep"]=!p||/(^\d+\+?$|,)/.test(g.trim(p))?",":" ",p=g.map(p.split(/[,\s]+/),function(a){var b=!
|
11 |
-
b&&("current"===e&&a||"no-current"===e&&!a||"no-output"===e&&!c)},
|
12 |
-
(c[f]=e[f]);f=!!c.items;d=!f&&!!c.branch;e=!f&&!d;f&&(c.filter="items");if(d){c.filter="branch";f=c.start_at.toString();c.branch_start=f;if("0"===f||"branch"===f)c.branch_start="";"root"===f&&(c.branch_start="1");"children"===f&&(c.branch_start="+1");"parent"===f&&(c.branch_start="-1");if("current"===c.branch||"current-item"===c.branch)c.branch=0;else if(!/^[+\-]?\d+$/.test(c.branch.toString()))if(c.branch=c.branch.toLowerCase(),f=a.find("a.cmw-item").filter(function(){return g(this).text().toLowerCase()===
|
13 |
c.branch}),f.length)c.branch=f.parent().data("itemid");else return!1}e&&(c.filter="",c.level=Math.max(1,parseInt(c.level,10)));c.start_at=null;c.include_level||"1"!==c.include_root||(c.include_level="1");c.include_root=null;if(d&&!c.branch&&c.fallback&&(e=c.fallback.toLowerCase().split(/[\s,]+/),f=" "+e.join(" ")+" ",c.fallback="",0<=f.indexOf(" quit ")?c.fallback="quit":0<=f.indexOf(" parent ")?c.fallback="parent":0<=f.indexOf(" current ")&&(c.fallback="current"),""!==c.fallback&&"quit"!==c.fallback))for(0<=
|
14 |
-
f.indexOf(" +siblings ")&&(c.fallback_siblings=1),
|
15 |
-
"";b&&(a=b.replace(/[\r\n\t]+/g," ").replace(/^[\[\s]+/,"").replace(/[\s\/\]]+$/,"").split(/[\[\]]/)[0],a=g.trim(a.replace(/\/+$/,""))+" ",a=g.trim((" "+a.replace(/^cmwizard\s/,"")+" ").replace(/\smenu=[^\s]*\s/," ").replace(/\salternative=("[^"]*"|[^\s]*)\s/," ")),a=a.replace(/\s\s+/g," "));return a},
|
16 |
-
!1===d.altSettings);return!1===d.altSettings?!1:g.extend({},d.altSettings)},
|
17 |
-
c).find("li").removeClass("cmw-has-"+c+" cmw-inherit-"+c).add(b.filter(".cmw-has-"+c))},
|
18 |
-
|
19 |
-
'"><a href="#'+c.data("indx")+'">'+c.text()+"</a>";
|
20 |
-
g(this).data().cmwOptgroupIndex===c;a||g(this).remove();return a}).length||(d=g("#"+b.attr("id")+"_ignore").find("optgroup").eq(c).clone(),d.length&&(0<a&&(a=0),b.append(d).val(a)));return a},
|
21 |
-
"ui-icon-circle-check"});d.toggleClass("cmw-assistance-dialog-fixed",!c);e.dialog("option",{maxHeight:c?!c:a.cmwMaxHeight});d.css("top",
|
22 |
-
this.title.replace(/\s.*$/,"")});for(d=0;d<a.length;d++)e=1===d?b.join(" "):b[0],a.eq(d).children(".cmw-item").find("span").addClass(e).each(
|
23 |
-
var d=c.hasClass("cmw-inherit-"+a),e=d||c.hasClass("cmw-has-"+a),
|
24 |
-
c[0]||this===
|
25 |
-
icons:{primary:"ui-icon-circle-check"}}).appendTo(a.find(".ui-dialog-titlebar")).on("click",
|
26 |
-
b.cmwDialogPrompt+"</em>")).append(g("<div/>").addClass("cmw-demo-theoutput").html('<em class="cmw-demo-small">'+b.cmwDialogOutput+'</em><em class="cmw-demo-plugin-version cmw-demo-small">v'+b.cmwDialogVersion+"</em>"+c.shift()+'<div class="cmw-demo-theoutput-wrap ui-corner-all"></div>'+c.join(""))).append(g("<div/>").addClass("cmw-demo-theshortcode").html('<code class="ui-corner-all"></code><div class="cmw-find-shortcodes"><a href="#" class="button-secondary '+
|
27 |
-
(b.cmwDialogNonce||"")+'" title="'+b.cmwDialogShortcodes+'"><span class="spinner"></span><span>[…]</span></a></div><div class="cmw-demo-found-shortcodes cmw-demo-small ui-corner-all"></div>'));c.dialog(a);c.find(".cmw-demo-themenu").on("click",".cmw-tick,.cmw-cross",
|
28 |
-
"]")},
|
29 |
-
(f+="</li>",e.pop());f+='<li class="level-'+c+'" data-itemid="'+this.value+'" data-level="'+c+'" data-trace="'+e.join(",")+'">';f+='<a href="#" class="cmw-cross ui-corner-all"></a>';f+='<a class="cmw-item ui-corner-all" href="#" data-indx="'+a+'"><span class="ui-corner-all" title="#'+this.value+'">'+g.trim(b.text());f+='</span></a><a href="#" class="cmw-tick ui-corner-all"></a>';e.push(this.value);c>
|
30 |
-
menuid:c}))}};
|
31 |
")"))),++m});/^\d+$/.test(d)?d>a&&c.val("1"):""!==d&&Math.abs(d)>=a&&c.val("");b.find(".cmw-ancestors,.cmw-ancestor-siblings").each(function(){var b=g(this),c=(b.find("option").length+1)/2,d=b.val(),m=Math.max(2,a);Math.abs(d)>=a&&b.val(0>d?1-a:a-1);c!==m&&b.find("optgroup").each(function(a,b){var d=g(b),e=d.data().cmwTextForOption,f;c>m&&d.find("option").slice(m-c).remove();for(f=c;f<m;f++)d.append(g("<option/>",{value:a?f:-f}).text(e.replace("%d",a?f:-f)))})});b.find(".cmw-include-level,.cmw-exclude-level").each(function(){var b=
|
32 |
-
g(this),c=b.find("option"),d=(c.length-1)/3,m=b.val(),q=c.eq(2).text(),
|
33 |
-
a).remove();q<a;)++q,b.append(g("<option/>",{value:q}).text(q+d))})}},setFields:function(b,a){var c=a.find(".cmw-bybranch"),d=a.find(".cmw-byitems").prop("checked"),e=d||!c.prop("checked"),
|
34 |
(e=d=!0,a.find(".cmw-byitems").prop("checked",d)):b.hasClass("cmw-ancestors")&&"0"===b.val()?a.find(".cmw-ancestor-siblings").val("0"):b.hasClass("cmw-ancestor-siblings")&&"0"!==b.val()&&"0"===a.find(".cmw-ancestors").val()&&a.find(".cmw-ancestors").val(b.val());c=a.find(".cmw-fallback").val();g.each({"-ss":d,"-ud":d||1>a.find(".cmw-depth").val(),"not-br":e,"not-br-ci":e||!!f,"not-fb-pc":e||!!f||"parent"!==c&&"current"!==c,"not-sw":!!a.find(".cmw-switchable").filter(function(){return!g(this).val()}).length},
|
35 |
-
function(b,c){a.find(".cmw-disableif"+b).toggleClass("cmw-colour-grey",c)})},shortcode:function(b){var a={menu:b.menu},c="branch"===b.filter,d="items"===b.filter,e,
|
36 |
1);c&&!b.branch&&b.fallback&&(a.fallback=[b.fallback],"quit"!==b.fallback&&(b.fallback_siblings&&a.fallback.push("+siblings"),b.fallback_depth&&a.fallback.push(b.fallback_depth)));c&&b.ancestors&&(a.ancestors=b.ancestors,b.ancestor_siblings&&(a.ancestor_siblings=b.ancestor_siblings));b.include_level&&(a.include_level=[b.include_level]);b._exclude&&(a.exclude=[b._exclude]);b.exclude_level&&(a.exclude_level=[b.exclude_level]);d=[];b.title_from_current?d.push("current"):b.title_from_current_root&&d.push("current-root");
|
37 |
-
c&&b.title_from_branch?d.push("branch"):c&&b.title_from_branch_root&&d.push("branch-root");d.length&&(a.title_from=d);for(d in{siblings:1,flat_output:1,ol_root:1,ol_sub:1,fallback_ci_parent:1})b[d]&&(a[d]=1);c={contains_current:"",container:"div",container_id:"",container_class:"",menu_class:"menu-widget",widget_class:""};for(d in c)b[d]!==c[d]&&(a[d]=[b[d]]);c={wrap_link:"before",wrap_link_text:"link_before"};for(d in c)(e=b[c[d]].toString().match(/^<(\w+)/))&&
|
38 |
-
(a.alternative=[b.switch_if,b.switch_at],
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
b),!1!==q))return q;
|
43 |
-
h}a.siblings&&
|
44 |
-
a.contains_current!==
|
45 |
-
(!!a.contains_current||
|
46 |
-
this.setFields(a,b);d=
|
47 |
-
|
48 |
-
c){a.find(".cmw-disableif"+b).toggleClass("cmw-colour-grey",c).find("input,select").prop("disabled",c)})},shortcode:function(b){var a={menu:b.menu},c=0<b.filter,d=!!b.filter&&!c,e;b.title&&(a.title=[b.title]);if(c)switch(b.filter_item){case 0:a.children_of=["current"];break;case -1:a.children_of=["parent"];break;case -2:a.children_of=["root"];break;default:a.children_of=b.filter_item}d&&(a.items=[b._items]);c&&0>b.filter_item&&b.fallback_no_ancestor&&(a.fallback_parent=
|
49 |
-
["siblings"]:b.fallback_include_parent?["parent"]:1);c&&!b.filter_item&&b.fallback_no_children&&(a.fallback_current=b.fallback_nc_include_parent_siblings?["siblings"]:b.fallback_nc_include_parent?["parent"]:1);1<b.start_level&&(a.start_level=b.start_level);0<b.depth&&(a.depth=b.depth);b.depth_rel_current&&0<b.depth&&(a.depth_rel_current=1);d=[];c&&(b.include_parent_siblings?d.push("siblings"):b.include_parent&&d.push("parent"),b.include_ancestors&&d.push("ancestors"),
|
50 |
-
c&&b.title_from_parent&&d.push("parent");b.title_from_current&&d.push("current");d.length&&(a.title_from=d);for(d in{flat_output:1,contains_current:1,ol_root:1,ol_sub:1})b[d]&&(a[d]=1);c={container:"div",container_id:"",container_class:"",menu_class:"menu-widget",widget_class:""};for(d in c)b[d]!==c[d]&&(a[d]=[b[d]]);c={wrap_link:"before",wrap_link_text:"link_before"};for(d in c)(e=b[c[d]].toString().match(/^<(\w+)/))&&e[1]&&(a[d]=[e[1]]);c=[];for(d in a)c.push(g.isArray(a[d])?
|
51 |
-
'"':d+"="+a[d]);return"[custom_menu_wizard "+c.join(" ")+"]"},update:function(b){var a=g(b);b=
|
52 |
-
|
53 |
-
p.find("li").length?r=p:f.fallback_no_children&&(r=
|
54 |
-
Math.max((r.data().level||0)+f.depth,f.start_level+f.depth-1):9999,h=r.find("li").filter(function(){var a=g(this).data().level;return a>=f.start_level&&a<=
|
55 |
-
(h=g([]));f.title_from_parent&&h.length&&r&&r.is("li")?r.addClass("title-from-item"):f.title_from_current&&h.length&&p.addClass("title-from-item");
|
56 |
-
g(document).on("change",
|
57 |
-
c),a.next("div")[c?"slideUp":"slideDown"]());this.blur();return!1}).on("click",".widget-action,.widget-control-close",function(b){b=g(this).closest("div.widget");var a=b.parent();a.hasClass("customize-control-widget_form")&&!a.hasClass("expanded")||
|
58 |
-
(a.dialog("destroy"),a.remove())})}).on("click",
|
59 |
-
"0"!==b&&(a.find(".cmw-demo-found-shortcodes").html(g(b).find("response_data").text()),a.addClass("cmw-ajax-showing"))}).always(function(b){a.removeClass("cmw-ajax-fetching")})));this.blur();return!1}).on("click",
|
1 |
/*Source: custom-menu-wizard.js
|
2 |
+
*Compiled: 2015-04-02, Google Closure Compiler...
|
3 |
*STATISTICS
|
4 |
+
* - originalSize: 76120
|
5 |
+
* - originalGzipSize: 19261
|
6 |
+
* - compressedSize: 26287
|
7 |
+
* - compressedGzipSize: 8440
|
8 |
*/
|
9 |
+
jQuery(function(g){var x,L=/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)/g,v=function(b,a){return(a?".":"")+"widget-custom-menu-wizard-"+b},A=function(b){var a=g(this).data().cmwDialogVersion.replace(/\./g,""),a=/^\d+$/.test(a)?"v"+a:a;x[a]?x[a].update(b?b.target:this):x.update(b?b.target:this)},C=function(b,a){var c=!1===b,d=c?{}:b.data(),e={},k=!c&&"2.1.0"===d.cmwDialogVersion,f={items:1,exclude:1},m=g.extend({branch_start:1,exclude_level:1,include_level:1},
|
10 |
+
f);g.each(c?a:b.find(":input").serializeArray(),function(a,b){var h=b.name.replace(/.*\[([^\]]+)\]$/,"$1"),p=!m[h]&&/^-?\d+$/.test(b.value)?parseInt(b.value,10):b.value;e[h]=p;"hide_empty"===h?e[h]=c||!!d.cmwV36plus||p:f[h]&&(e["_"+h+"_sep"]=!p||/(^\d+\+?$|,)/.test(g.trim(p))?",":" ",p=g.map(p.split(/[,\s]+/),function(a){var b=!k&&/\+$/.test(a);a=a?parseInt(a,10):0;return isNaN(a)||1>a?null:b?a+"+":a}),e["_"+h]=p.join(e["_"+h+"_sep"]))});return e},D=function(b,a,c,d){var e=d.switch_if;return d.switch_at===
|
11 |
+
b&&("current"===e&&a||"no-current"===e&&!a||"no-output"===e&&!c)},Q=function(b,a){b=g.trim(b||"");for(var c={title:"",level:1,branch:0,items:"",depth:0,depth_rel_current:0,start_at:"",start_mode:"",allow_all_root:0,ancestors:0,ancestor_siblings:0,include_root:0,include_level:"",siblings:0,exclude:"",exclude_level:"",contains_current:"",fallback:"",flat_output:0,title_from:"",title_linked:0,ol_root:0,ol_sub:0},d=L.exec(b),e={},k=0,f;d;)k++,d[1]?e[d[1]]=d[2]:d[3]?e[d[3]]=d[4]:d[5]?e[d[5]]=d[6]:k--,
|
12 |
+
d=L.exec(b);if(k)for(f in e)c.hasOwnProperty(f)&&(c[f]=e[f]);f=!!c.items;d=!f&&!!c.branch;e=!f&&!d;f&&(c.filter="items");if(d){c.filter="branch";f=c.start_at.toString();c.branch_start=f;if("0"===f||"branch"===f)c.branch_start="";"root"===f&&(c.branch_start="1");"children"===f&&(c.branch_start="+1");"parent"===f&&(c.branch_start="-1");if("current"===c.branch||"current-item"===c.branch)c.branch=0;else if(!/^[+\-]?\d+$/.test(c.branch.toString()))if(c.branch=c.branch.toLowerCase(),f=a.find("a.cmw-item").filter(function(){return g(this).text().toLowerCase()===
|
13 |
c.branch}),f.length)c.branch=f.parent().data("itemid");else return!1}e&&(c.filter="",c.level=Math.max(1,parseInt(c.level,10)));c.start_at=null;c.include_level||"1"!==c.include_root||(c.include_level="1");c.include_root=null;if(d&&!c.branch&&c.fallback&&(e=c.fallback.toLowerCase().split(/[\s,]+/),f=" "+e.join(" ")+" ",c.fallback="",0<=f.indexOf(" quit ")?c.fallback="quit":0<=f.indexOf(" parent ")?c.fallback="parent":0<=f.indexOf(" current ")&&(c.fallback="current"),""!==c.fallback&&"quit"!==c.fallback))for(0<=
|
14 |
+
f.indexOf(" +siblings ")&&(c.fallback_siblings=1),k=0;k<e.length;k++)if(/^\d+$/.test(e[k])&&(f=parseInt(e[k],10),0<f)){c.fallback_depth=f;break}if(c.title_from)for(e=c.title_from.toLowerCase().split(/[\s,]+/),k=0;k<e.length;k++)if("branch"===e[k]||"current"===e[k])c["title_from_"+e[k]]=1;else if("branch-root"===e[k]||"current-root"===e[k])c["title_from_"+e[k].replace("-","_")]=1;c.title_from=null;c.hide_empty=1;return C(!1,g.map(c,function(a,b){return null===a?a:{name:b,value:a}}))},M=function(b){var a=
|
15 |
+
"";b&&(a=b.replace(/[\r\n\t]+/g," ").replace(/^[\[\s]+/,"").replace(/[\s\/\]]+$/,"").split(/[\[\]]/)[0],a=g.trim(a.replace(/\/+$/,""))+" ",a=g.trim((" "+a.replace(/^cmwizard\s/,"")+" ").replace(/\smenu=[^\s]*\s/," ").replace(/\salternative=("[^"]*"|[^\s]*)\s/," ")),a=a.replace(/\s\s+/g," "));return a},E=function(b,a){var c=a.find(".cmw-demo-themenu-ul"),d=c.data(),e=M(b.switch_to),e="cmwizard menu="+b.menu+(""===e?e:" "+e);d.altCode&&d.altCode===e||(d.altCode=e,d.altSettings=Q(e,c));a.find(".cmw-demo-alternative").addClass("updated").toggleClass("error",
|
16 |
+
!1===d.altSettings);return!1===d.altSettings?!1:g.extend({},d.altSettings)},I=function(b,a,c){var d="tick"===c?a._items_sep:a._exclude_sep,e=[],k="tick"===c?"_items":"_exclude",k=a[k]?g.grep(a[k].split(d),function(a){return/\+$/.test(a)?(e.push(parseInt(a,10)),!a):!!a}):[],k=d+k.join(d)+d,e=d+e.join(d)+d;b=b.each(function(){var a=g(this),b=a.data(),q=-1<e.indexOf(d+b.itemid+d),b=q||-1<k.indexOf(d+b.itemid+d);a.toggleClass("cmw-has-"+c,b).toggleClass("cmw-inherit-"+c,q)});return b.filter(".cmw-inherit-"+
|
17 |
+
c).find("li").removeClass("cmw-has-"+c+" cmw-inherit-"+c).add(b.filter(".cmw-has-"+c))},y=function(b,a){return(b?b:a)[b?"find":"closest"](v("onchange",1))},N=function(b,a){var c=[],d=b.match(/^(\d+)(\+|-)?$/),e,d=d?[parseInt(d[1],10),d[2]||""]:[];if(0<d[0])for(e=1;e<=a;e++)(e===d[0]||"-"===d[1]&&e<d[0]||"+"===d[1]&&e>d[0])&&c.push(".level-"+e);return c.join(",")},O=function(b,a){var c=b.find(".cmw-demo-themenu-ul"),d=c.find(".picked"),e="",k=a.hide_title?"":a.title,f=0,m=0,q=b.find(".cmw-demo-theoutput-wrap").empty(),
|
18 |
+
t=["menu-widget"],h={};if(d.length&&q.length){k=c.find(".title-from-item").children(".cmw-item").text()||"";f=!!k&&!!a.title_linked;k||a.hide_title||(k=a.title||"");for(d.each(function(b){var c=g(this),d=c.data(),f=d.trace?d.trace.toString().split(","):[];b=d.itemid.toString();var k=1,c=c.children(".cmw-item");if(!a.flat_output)for(h[b]=1,b=0;b<f.length;b++)h[f[b]]&&k++;if(m)if(k>m)e+=a.ol_sub?"<ol>":"<ul>";else{for(;m>k;)--m,e+="</li>"+(a.ol_sub?"</ol>":"</ul>");e+="</li>"}e+='<li class="cmw-level-'+
|
19 |
+
k+(d.included||"")+'"><a href="#'+c.data("indx")+'">'+c.text()+"</a>";m=k});1<m;)--m,e+="</li>"+(a.ol_sub?"</ol>":"</ul>");e+="</li>";t.push(b.find(".cmw-demo-fallback").data("fellback"));e=(a.ol_root?"<ol":"<ul")+' class="'+g.trim(t.join(" "))+'">'+e+(a.ol_root?"</ol>":"</ul>");q.html(e);q.find("li").filter(function(){return!!g(this).children("ul, ol").length}).addClass("cmw-has-submenu")}q.length&&k&&(d.length||!a.hide_empty)&&q.prepend((f?'<h3 class="cmw-title-linked">':"<h3>")+k+"</h3>")},P=function(b,
|
20 |
+
a,c){var d;b.find("optgroup").filter(function(){var a=g(this).data().cmwOptgroupIndex===c;a||g(this).remove();return a}).length||(d=g("#"+b.attr("id")+"_ignore").find("optgroup").eq(c).clone(),d.length&&(0<a&&(a=0),b.append(d).val(a)));return a},R=function(b){b=g(this);var a=b.data(),c=!a.cmwAbsolute,d=b.closest(".ui-dialog"),e=d.find(".ui-dialog-content"),k=parseInt(d.css("top"),10)+(c?1:-1)*g(document).scrollTop();a.cmwAbsolute=c;a.cmwMaxHeight||(a.cmwMaxHeight=e.dialog("option","maxHeight"));b.button("option",
|
21 |
+
"icons",{primary:c?"ui-icon-circle-close":"ui-icon-circle-check"});d.toggleClass("cmw-assistance-dialog-fixed",!c);e.dialog("option",{maxHeight:c?!c:a.cmwMaxHeight});d.css("top",k);return!1},S=function(b){var a=g(this);b=["current-menu-item","current-menu-parent","current-menu-ancestor"];var c=a.closest(".ui-dialog-content"),d=c.find(".cmw-demo-themenu-ul"),a=a.find("span").not("."+b[0]).parentsUntil(d,"li"),e,k=function(){this.title=this.title+" "+e.replace(" "," & ").replace(/-/g," ")};d.find("."+
|
22 |
+
b.join(",.")).removeClass(b.join(" ")).each(function(){this.title=this.title.replace(/\s.*$/,"")});for(d=0;d<a.length;d++)e=1===d?b.join(" "):b[0],a.eq(d).children(".cmw-item").find("span").addClass(e).each(k),1<b.length&&b.shift();A.call(g(c.data().cmwOnchange).get(0));return!1},T=function(b){g(this).closest(".ui-dialog-content").find(".cmw-item").eq(this.href.split("#")[1]).not(":has(.current-menu-item)").trigger("click");this.blur();return!1},U=function(b){b=g(this);var a=b.hasClass("cmw-tick")?
|
23 |
+
"tick":"cross",c=b.parent();b=c.closest(".cmw-demo-themenu-ul");var d=c.hasClass("cmw-inherit-"+a),e=d||c.hasClass("cmw-has-"+a),k=e?g([]):c.parentsUntil(b,".cmw-inherit-"+a),f=g(c.closest(".ui-dialog-content").data().cmwOnchange).find("tick"===a?".cmw-setitems":".cmw-exclusions"),m;!b.hasClass("cmw-using-alternative")&&f.length&&(m=b.find(".cmw-has-"+a)[d||k.length?"not":"add"](c),!e||c.children("ul").length&&!b.parent().hasClass("cmw-version-210")?e&&!d&&(m=m.not(c.find(".cmw-has-"+a))):m=m.not(c),
|
24 |
+
m=m.add(k.find("li").not(c)),m=m.map(function(){var b=this===c[0]||this===k.get(0)?e:g(this).hasClass("cmw-inherit-"+a);return g(this).data().itemid+(b?"+":"")}).get().join(/(,|^\d+\+?$)/.test(g.trim(f.val())||",")?",":" "),f.val(m).trigger("change"));this.blur();return!1},V=function(b){var a={autoOpen:!1,width:Math.min(.9*g(window).width(),600),maxHeight:g(window).height()-40,modal:!1,containment:"window",create:function(){var a=g(this).closest(".ui-dialog");if(a.hasClass("cmw-assistance-dialog-fixed"))g("<button/>").addClass("cmw-dialog-fixed-absolute").button({label:b.cmwDialogFixed,
|
25 |
+
icons:{primary:"ui-icon-circle-check"}}).appendTo(a.find(".ui-dialog-titlebar")).on("click",R)},dialogClass:"cmw-assistance-dialog cmw-assistance-dialog-fixed"},c=g.map(["SetCurrent","Inclusions","Exclusions","Fallback","Alternative"],function(a){return'<div class="cmw-demo-'+a.toLowerCase()+' cmw-demo-small">'+(b["cmwDialog"+a]||"")+"</div>"}),c=g("<div/>",{id:b.cmwDialogId}).addClass(v("dialog")).append(g("<div/>").addClass("cmw-demo-themenu cmw-version-"+b.cmwDialogVersion.replace(/\./g,"")).html('<em class="cmw-demo-small">'+
|
26 |
+
b.cmwDialogPrompt+"</em>")).append(g("<div/>").addClass("cmw-demo-theoutput").html('<em class="cmw-demo-small">'+b.cmwDialogOutput+'</em><em class="cmw-demo-plugin-version cmw-demo-small">v'+b.cmwDialogVersion+"</em>"+c.shift()+'<div class="cmw-demo-theoutput-wrap ui-corner-all"></div>'+c.join(""))).append(g("<div/>").addClass("cmw-demo-theshortcode").html('<code class="ui-corner-all"></code><div class="cmw-find-shortcodes"><a href="#" class="button-secondary '+v("find-shortcodes")+'" data-nonce="'+
|
27 |
+
(b.cmwDialogNonce||"")+'" title="'+b.cmwDialogShortcodes+'"><span class="spinner"></span><span>[…]</span></a></div><div class="cmw-demo-found-shortcodes cmw-demo-small ui-corner-all"></div>'));c.dialog(a);c.find(".cmw-demo-themenu").on("click",".cmw-tick,.cmw-cross",U).on("click",".cmw-item",S);c.find(".cmw-demo-theoutput").on("click","a",T);return c},J=function(b,a){b.dialog("option","title","CMW : "+(a.find(".cmw-widget-title").val()||b.data().cmwUntitled)+" ["+a.find(".cmw-select-menu").find("option:selected").text()+
|
28 |
+
"]")},K=function(b){var a=g(b.data().cmwOnchange),c=parseInt(a.find(".cmw-select-menu").val(),10),d=b.find(".cmw-demo-themenu-ul"),e=[],k=0,f="",m=function(a){return 1<a?'<a href="#" class="'+v("colexp")+' ui-icon ui-icon-triangle-1-e" style="left:-'+(2.4*(a-2)+2)+'em;"> </a>':""};if(!d.length||d.data("menuid")!==c){for(a.find(".cmw-assist-items optgroup").find("option").each(function(a){for(var b=g(this),c=b.data().cmwLevel;c<e.length;)f+="</li></ul>"+m(e.length),e.pop();c>e.length?f+="<ul>":
|
29 |
+
(f+="</li>",e.pop());f+='<li class="level-'+c+'" data-itemid="'+this.value+'" data-level="'+c+'" data-trace="'+e.join(",")+'">';f+='<a href="#" class="cmw-cross ui-corner-all"></a>';f+='<a class="cmw-item ui-corner-all" href="#" data-indx="'+a+'"><span class="ui-corner-all" title="#'+this.value+'">'+g.trim(b.text());f+='</span></a><a href="#" class="cmw-tick ui-corner-all"></a>';e.push(this.value);c>k&&(k=c)});e.length;)f+="</li></ul>"+m(e.length),e.pop();d.remove();b.find(".cmw-demo-themenu").append(g(f).addClass("cmw-demo-themenu-ul").data({maxLevel:k,
|
30 |
+
menuid:c}))}};x={setLevels:function(b,a){if(a){var c=b.find(".cmw-branch-start"),d=c.val();c.find("optgroup").each(function(b){var c=g(this),d=c.find("option"),m=d.length,q=c.data();if(b)for(d.slice(a).remove();m<a;)++m,c.append(g("<option/>",{value:m}).text(m));else for(m=(m+1)/2,m>a&&d.each(function(b,c){Math.abs(c.value)>=a&&g(c).remove()});m<a;)c.prepend(g("<option/>",{value:-m}).text(-m+(1<m?"":" ("+q.cmwTextParent+")"))).append(g("<option/>",{value:"+"+m}).text("+"+m+(1<m?"":" ("+q.cmwTextChildren+
|
31 |
")"))),++m});/^\d+$/.test(d)?d>a&&c.val("1"):""!==d&&Math.abs(d)>=a&&c.val("");b.find(".cmw-ancestors,.cmw-ancestor-siblings").each(function(){var b=g(this),c=(b.find("option").length+1)/2,d=b.val(),m=Math.max(2,a);Math.abs(d)>=a&&b.val(0>d?1-a:a-1);c!==m&&b.find("optgroup").each(function(a,b){var d=g(b),e=d.data().cmwTextForOption,f;c>m&&d.find("option").slice(m-c).remove();for(f=c;f<m;f++)d.append(g("<option/>",{value:a?f:-f}).text(e.replace("%d",a?f:-f)))})});b.find(".cmw-include-level,.cmw-exclude-level").each(function(){var b=
|
32 |
+
g(this),c=b.find("option"),d=(c.length-1)/3,m=b.val(),q=c.eq(2).text(),t=c.eq(3).text();for(c.slice(3*a+1).remove();d<a;)++d,b.append(g("<option/>",{value:d}).text(d)).append(g("<option/>",{value:d+"-"}).text(q.replace(/\d+/,d))).append(g("<option/>",{value:d+"+"}).text(t.replace(/\d+/,d)));parseInt(m,10)>a&&b.val("")});b.find(".cmw-set-levels").each(function(){var b=g(this),c=b.data(),d=c.cmwTextLevels||"",c=c.cmwSetLevels||0,m=b.find("option"),q=m.length-c;b.val()>a&&b.val(m.eq(0).val());for(b.find("option").slice(c+
|
33 |
+
a).remove();q<a;)++q,b.append(g("<option/>",{value:q}).text(q+d))})}},setFields:function(b,a){var c=a.find(".cmw-bybranch"),d=a.find(".cmw-byitems").prop("checked"),e=d||!c.prop("checked"),k=a.find(".cmw-assist-items"),f=parseInt(k.val(),10);b.hasClass("cmw-select-menu")?(f=P(k,f,b[0].selectedIndex),this.setLevels(a,(k.find("optgroup").data()||{}).cmwMaxLevel)):b.hasClass("cmw-level")?(e=!0,d=!e,a.find(".cmw-bylevel").prop("checked",e)):b.is(k)?(e=d=!1,c.prop("checked",!e)):b.hasClass("cmw-setitems")?
|
34 |
(e=d=!0,a.find(".cmw-byitems").prop("checked",d)):b.hasClass("cmw-ancestors")&&"0"===b.val()?a.find(".cmw-ancestor-siblings").val("0"):b.hasClass("cmw-ancestor-siblings")&&"0"!==b.val()&&"0"===a.find(".cmw-ancestors").val()&&a.find(".cmw-ancestors").val(b.val());c=a.find(".cmw-fallback").val();g.each({"-ss":d,"-ud":d||1>a.find(".cmw-depth").val(),"not-br":e,"not-br-ci":e||!!f,"not-fb-pc":e||!!f||"parent"!==c&&"current"!==c,"not-sw":!!a.find(".cmw-switchable").filter(function(){return!g(this).val()}).length},
|
35 |
+
function(b,c){a.find(".cmw-disableif"+b).toggleClass("cmw-colour-grey",c)})},shortcode:function(b){var a={menu:b.menu},c="branch"===b.filter,d="items"===b.filter,e,k;b.title&&!b.hide_title&&(a.title=[b.title]);!c&&!d&&1<b.level&&(a.level=b.level);c&&(a.branch=b.branch||"current",b.branch_start&&(a.start_at=[b.branch_start]),"level"===b.start_mode&&(a.start_mode="level"),b.allow_all_root&&(a.allow_all_root=1));d&&(a.items=[b._items]);0<b.depth&&(a.depth=b.depth);b.depth_rel_current&&0<b.depth&&(a.depth_rel_current=
|
36 |
1);c&&!b.branch&&b.fallback&&(a.fallback=[b.fallback],"quit"!==b.fallback&&(b.fallback_siblings&&a.fallback.push("+siblings"),b.fallback_depth&&a.fallback.push(b.fallback_depth)));c&&b.ancestors&&(a.ancestors=b.ancestors,b.ancestor_siblings&&(a.ancestor_siblings=b.ancestor_siblings));b.include_level&&(a.include_level=[b.include_level]);b._exclude&&(a.exclude=[b._exclude]);b.exclude_level&&(a.exclude_level=[b.exclude_level]);d=[];b.title_from_current?d.push("current"):b.title_from_current_root&&d.push("current-root");
|
37 |
+
c&&b.title_from_branch?d.push("branch"):c&&b.title_from_branch_root&&d.push("branch-root");d.length&&(a.title_from=d,b.title_linked&&(a.title_linked=1));for(d in{siblings:1,flat_output:1,ol_root:1,ol_sub:1,fallback_ci_parent:1})b[d]&&(a[d]=1);c={contains_current:"",container:"div",container_id:"",container_class:"",menu_class:"menu-widget",widget_class:""};for(d in c)b[d]!==c[d]&&(a[d]=[b[d]]);c={wrap_link:"before",wrap_link_text:"link_before"};for(d in c)(e=b[c[d]].toString().match(/^<(\w+)/))&&
|
38 |
+
e[1]&&(a[d]=[e[1]]);b.switch_if&&b.switch_at&&(a.alternative=[b.switch_if,b.switch_at],k=M(b.switch_to));c=[];for(d in a)c.push(g.isArray(a[d])?d+'="'+a[d].join(",")+'"':d+"="+a[d]);return"[cmwizard "+c.join(" ")+(k?"]"+k+"[/cmwizard]":"/]")},structureUpdate:function(b,a,c){var d=-1,e=9999,k=0,f=0,m="",q=null,t,h,p,n,u="menu",r="branch"===a.filter,v="items"===a.filter,y=!r&&!v,x=r&&!a.branch,F=!c&&!!a.switch_if&&!!a.switch_at,B=b.find(".cmw-demo-themenu-ul"),z=B.data().maxLevel,w=B.find(".current-menu-item").closest("li"),
|
39 |
+
H=w.length?w.data().level:-1,l=B.find("li").removeData("included").removeClass("title-from-item"),G=a.depth,A=a.depth_rel_current,C=I(l,a,"cross");h=l.length&&w.is(l);a.contains_current!==u||h||(l=g([]));if(F&&D(u,h,l.length,a)&&(q=E(a,b),!1!==q))return q;u="primary";v&&l.length&&(l=I(l,a,"tick"));r&&l.length&&(p=x?w:l.filter("[data-itemid="+a.branch+"]"),p.length?(d=p.data().level||0,l=p.add(p.find("li")),t=p):l=g([]));if(y&&l.length&&1<a.level){h=1;for(n=[];h<a.level;h++)n.push(".level-"+h);l=l.not(n.join(","))}h=
|
40 |
+
l.length&&w.is(l);a.contains_current!==u||h||(l=g([]));if(F&&D(u,h,l.length,a)&&(q=E(a,b),!1!==q))return q;u="secondary";if(y&&l.length&&G&&(h=A&&H>=a.level?H:a.level,h+=G,h<=z)){for(n=[];h<=z;h++)n.push(".level-"+h);l=l.not(n.join(","))}if(r&&l.length&&(n=parseInt(a.branch_start,10),n=isNaN(n)||!n?d:a.branch_start.match(/^(\+|-)/)?Math.max(1,d+n):n,x&&a.fallback&&!w.find("li").length&&(m="cmw-fellback-to-"+a.fallback,"quit"===a.fallback?n=z+1:(n="current"===a.fallback||2>d?d:d-1,a.fallback_depth&&
|
41 |
+
(G=a.fallback_depth,A=1))),n>z?l=g([]):(n<d&&(p=p.parentsUntil(B,"li.level-"+n)),"level"===a.start_mode&&n<=d&&(1<n||a.allow_all_root)?l=p.parent().find("li"):n<d&&(l=p.add(p.find("li"))),m&&a.fallback_siblings&&l.length&&(1<n||a.allow_all_root)&&(l=l.add(p.siblings("li.level-"+n)))),l.length)){d=n;p=9999;G&&(p=A&&H>=d&&l.filter(w).length?H:d,p+=G,e=p-1);h=1;for(n=[];h<=z;h++)h>=d&&h<p&&n.push(".level-"+h);l=l.filter(n.join(","))}h=l.length&&w.is(l);a.contains_current!==u||h||(l=g([]));if(F&&D(u,
|
42 |
+
h,l.length,a)&&(q=E(a,b),!1!==q))return q;u="inclusions";if(r&&l.length){n=t.data().level;if(a.ancestors&&(t.is(l)||n>e)){h=a.ancestors;0>h&&(h=Math.max(1,n+h));d=a.ancestor_siblings;0>d&&(d=Math.max(1,n+d));n=[];for(p=[];h<=z;h++)h<=e&&(n.push(".level-"+h),0<d&&h>=d&&p.push(".level-"+h));h=l.length;n=t.parentsUntil(B,n.join(","));l=l.add(n.not(l).data("included"," cmw-an-included-ancestor"));p.length&&(l=l.add(n.filter(p.join(",")).siblings("li").not(l).data("included"," cmw-an-included-ancestor-sibling")));
|
43 |
+
k+=l.length-h}a.siblings&&t.is(l)&&(n=l.length,l=l.add(t.siblings("li").data("included"," cmw-an-included-sibling")),k+=l.length-n)}l.length&&a.include_level&&(p=N(a.include_level,z))&&(n=l.length,l=l.add(B.find(p)),k+=l.length-n);h=l.length&&w.is(l);a.contains_current!==u||h||(l=g([]));if(F&&D(u,h,l.length,a)&&(q=E(a,b),!1!==q))return q;u="output";l.length&&C.length&&(n=l.length,l=l.not(C),f+=n-l.length);l.length&&a.exclude_level&&(p=N(a.exclude_level,z))&&(n=l.length,l=l.not(p),f+=n-l.length);h=
|
44 |
+
l.length&&w.is(l);a.contains_current!==u||h||(l=g([]));if(F&&D(u,h,l.length,a)&&(q=E(a,b),!1!==q))return q;a.title_from_current&&w.length?w.addClass("title-from-item"):a.title_from_current_root&&w.length?w.closest(".level-1").addClass("title-from-item"):r&&t&&(a.title_from_branch?t.addClass("title-from-item"):a.title_from_branch_root&&t.closest(".level-1").addClass("title-from-item"));b.find(".cmw-demo-fallback").data("fellback",m).toggleClass("updated",!!m);b.find(".cmw-demo-setcurrent").toggleClass("error",
|
45 |
+
!w.length&&(!!a.contains_current||x));c||null!==q||b.find(".cmw-demo-alternative").removeClass("error updated");b.find(".cmw-demo-themenu-ul").toggleClass("cmw-using-alternative",!!c);h={inclusions:k,exclusions:f};for(n in h)p=b.find(".cmw-demo-"+n),p.text(p.text().replace(/\d+$/,h[n])).toggleClass("updated",0<h[n]);B.toggleClass("cmw-demo-filteritems",v).find(".picked").not(l.addClass("picked")).removeClass("picked");return!1},update:function(b){var a=g(b);b=y(0,a);var c=g("#"+b.data().cmwDialogId),
|
46 |
+
d;a.hasClass("cmw-listen")&&this.setFields(a,b);d=C(b);c.length&&c.dialog("isOpen")&&(c.dialog("moveToTop"),a.hasClass("cmw-select-menu")&&K(c),a=this.structureUpdate(c,d),!1!==a&&this.structureUpdate(c,a,!0),J(c,b),O(c,a||d));b.add(c).find("code").text(this.shortcode(d))},v210:{setLevels:function(b,a){var c=b.find(".cmw-start-level"),d=c.val(),e=c.find("option").length,k;d>a&&c.val(1);for(c.find("option").slice(a).remove();e<a;)++e,c.append(g("<option/>",{value:e}).text(e));c=b.find(".cmw-depth");
|
47 |
+
d=c.val();e=c.find("option").length;k=c.data().cmwTextLevels;d>a&&c.val(0);for(c.find("option").slice(a+1).remove();e<=a;)c.append(g("<option/>",{value:e}).text(e+k)),++e},setFields:function(b,a){var c=a.find(".cmw-showall").prop("checked"),d=a.find(".cmw-showspecific").prop("checked"),e=a.find(".cmw-assist-items"),k=parseInt(e.val(),10);b.hasClass("cmw-select-menu")&&(k=P(e,k,b[0].selectedIndex),this.setLevels(a,(e.find("optgroup").data()||{}).cmwMaxLevel));g.each({"":c||d,"-ss":d,"not-rp":c||d||
|
48 |
+
0<=k,"not-ci":c||d||!!k},function(b,c){a.find(".cmw-disableif"+b).toggleClass("cmw-colour-grey",c).find("input,select").prop("disabled",c)})},shortcode:function(b){var a={menu:b.menu},c=0<b.filter,d=!!b.filter&&!c,e;b.title&&(a.title=[b.title]);if(c)switch(b.filter_item){case 0:a.children_of=["current"];break;case -1:a.children_of=["parent"];break;case -2:a.children_of=["root"];break;default:a.children_of=b.filter_item}d&&(a.items=[b._items]);c&&0>b.filter_item&&b.fallback_no_ancestor&&(a.fallback_parent=
|
49 |
+
b.fallback_include_parent_siblings?["siblings"]:b.fallback_include_parent?["parent"]:1);c&&!b.filter_item&&b.fallback_no_children&&(a.fallback_current=b.fallback_nc_include_parent_siblings?["siblings"]:b.fallback_nc_include_parent?["parent"]:1);1<b.start_level&&(a.start_level=b.start_level);0<b.depth&&(a.depth=b.depth);b.depth_rel_current&&0<b.depth&&(a.depth_rel_current=1);d=[];c&&(b.include_parent_siblings?d.push("siblings"):b.include_parent&&d.push("parent"),b.include_ancestors&&d.push("ancestors"),
|
50 |
+
d.length&&(a.include=d));d=[];c&&b.title_from_parent&&d.push("parent");b.title_from_current&&d.push("current");d.length&&(a.title_from=d);for(d in{flat_output:1,contains_current:1,ol_root:1,ol_sub:1})b[d]&&(a[d]=1);c={container:"div",container_id:"",container_class:"",menu_class:"menu-widget",widget_class:""};for(d in c)b[d]!==c[d]&&(a[d]=[b[d]]);c={wrap_link:"before",wrap_link_text:"link_before"};for(d in c)(e=b[c[d]].toString().match(/^<(\w+)/))&&e[1]&&(a[d]=[e[1]]);c=[];for(d in a)c.push(g.isArray(a[d])?
|
51 |
+
d+'="'+a[d].join(" ")+'"':d+"="+a[d]);return"[custom_menu_wizard "+c.join(" ")+"]"},update:function(b){var a=g(b);b=y(0,a);var c=g("#"+b.data().cmwDialogId),d,e,k,f,m,q,t,h,p,n,u,r,v;a.hasClass("cmw-listen")&&this.setFields(a,b);if(c.length&&c.dialog("isOpen")){c.dialog("moveToTop");a.hasClass("cmw-select-menu")&&K(c);f=C(b);d=!f.filter;a=0<f.filter;e=!d&&!a;m=f.include_parent;q=f.include_parent_siblings;t=c.find(".cmw-demo-themenu-ul");k=t.data().maxLevel;p=t.find(".current-menu-item").closest("li");
|
52 |
+
n=p.length?p.data().level:-1;h=t.find("li").removeData("included").removeClass("title-from-item");e&&(h=I(h,f,"tick"));h.length&&!p.length&&(f.contains_current||a&&1>f.filter_item)&&(h=g([]));h.length&&a&&(0<f.filter_item?r=h.filter("[data-itemid="+f.filter_item+"]"):f.filter_item?1===n&&f.fallback_no_ancestor?(r=p,m=m||f.fallback_include_parent,q=q||f.fallback_include_parent_siblings,u="cmw-fellback-to-current"):r=1===n?t:-1>f.filter_item?t.find(".current-menu-ancestor").eq(0).closest("li"):t.find(".current-menu-parent").closest("li"):
|
53 |
+
p.find("li").length?r=p:f.fallback_no_children&&(r=t.find(".current-menu-parent").closest("li"),r.length||(r=t),m=m||f.fallback_nc_include_parent,q=q||f.fallback_nc_include_parent_siblings,u="cmw-fellback-to-parent"));if(h.length)if(d)for(v=f.depth_rel_current&&f.depth&&p.length&&n>=f.start_level?n+f.depth-1:f.depth?f.start_level+f.depth-1:9999,d=1;d<=k;d++){if(d<f.start_level||d>v)h=h.not(".level-"+d)}else r&&r.length?(v=f.depth_rel_current&&f.depth&&p.length&&r.has(p[0]).length?n-1+f.depth:f.depth?
|
54 |
+
Math.max((r.data().level||0)+f.depth,f.start_level+f.depth-1):9999,h=r.find("li").filter(function(){var a=g(this).data().level;return a>=f.start_level&&a<=v})):a&&(h=g([]));h.length&&a&&r&&r.is("li")&&(q&&(h=h.add(r.siblings("li").data("included"," cmw-an-included-parent-sibling")),m=!0),f.include_ancestors&&(h=h.add(r.parentsUntil(t,"li").data("included"," cmw-an-included-ancestor")),m=!0),m&&(h=h.add(r.data("included"," cmw-the-included-parent"))));!h.length||!f.contains_current||p.length&&h.filter(p).length||
|
55 |
+
(h=g([]));f.title_from_parent&&h.length&&r&&r.is("li")?r.addClass("title-from-item"):f.title_from_current&&h.length&&p.addClass("title-from-item");u=h.length?u:"";c.find(".cmw-demo-fallback").data("fellback",u).toggleClass("updated",!!u);c.find(".cmw-demo-setcurrent").toggleClass("error",!p.length&&(f.contains_current||a&&1>f.filter_item));t.toggleClass("cmw-demo-filteritems",e).find(".picked").not(h.addClass("picked")).removeClass("picked");J(c,b);O(c,f);c.find("code").text(this.shortcode(f))}}}};
|
56 |
+
g(document).on("change",v("onchange",1),A).on("click",v("assist",1),function(b){b=g(this);b=y(0,b);var a=b.data(),c=g("#"+a.cmwDialogId);c.length||(c=V(a).data({cmwOnchange:"#"+b.attr("id"),cmwUntitled:"["+a.cmwDialogUntitled+"]"}));c.dialog("isOpen")?c.dialog("close"):(K(c),J(c,b),c.dialog("open"),A.call(b[0]));this.blur();return!1}).on("click",v("fieldset",1),function(b){b=g(this);var a=b.next(".cmw-fieldset-state"),c=!a.prop("checked");a.length&&(a.prop("checked",c),b.toggleClass("cmw-collapsed-fieldset",
|
57 |
+
c),a.next("div")[c?"slideUp":"slideDown"]());this.blur();return!1}).on("click",".widget-action,.widget-control-close",function(b){b=g(this).closest("div.widget");var a=b.parent();a.hasClass("customize-control-widget_form")&&!a.hasClass("expanded")||y(b).each(function(){var a=g("#"+g(this).data().cmwDialogId);a.length&&a.dialog("isOpen")&&a.dialog("close")})}).on("click",".widget-control-remove",function(b){y(g(this).closest("div.widget")).each(function(){var a=g("#"+g(this).data().cmwDialogId);a.length&&
|
58 |
+
(a.dialog("destroy"),a.remove())})}).on("click",v("colexp",1),function(b){b=/1-e/.test(this.className)?"slideUp":"slideDown";g(this).toggleClass("ui-icon-triangle-1-s ui-icon-triangle-1-e").prev("ul")[b]();return!1}).on("click",v("find-shortcodes",1),function(b){b=g(this);var a=b.parent().parent();ajaxurl&&!a.hasClass("cmw-ajax-fetching")&&(a.hasClass("cmw-ajax-showing")?a.removeClass("cmw-ajax-showing"):(a.addClass("cmw-ajax-fetching"),g.get(ajaxurl,{action:"cmw-find-shortcodes",_wpnonce:b.data().nonce}).done(function(b){b&&
|
59 |
+
"0"!==b&&(a.find(".cmw-demo-found-shortcodes").html(g(b).find("response_data").text()),a.addClass("cmw-ajax-showing"))}).always(function(b){a.removeClass("cmw-ajax-fetching")})));this.blur();return!1}).on("click",v("legacy-close",1),function(){g(this).parent().remove();return!1});window.Custom_Menu_Wizard_Widget&&g(window.Custom_Menu_Wizard_Widget.trigger||[]).trigger("change")});
|
custom-menu-wizard.php
CHANGED
@@ -3,13 +3,18 @@
|
|
3 |
* Plugin Name: Custom Menu Wizard
|
4 |
* Plugin URI: http://wordpress.org/plugins/custom-menu-wizard/
|
5 |
* Description: Show any part of a custom menu in a Widget, or in content using a Shortcode. Customise the output with extra classes or html; filter by current menu item or a specific item; set a depth, show the parent(s), change the list style, etc. Use the included emulator to assist with the filter settings.
|
6 |
-
* Version: 3.1.
|
7 |
* Author: Roger Barrett
|
8 |
* Author URI: http://www.wizzud.com/
|
9 |
* License: GPL2+
|
10 |
*/
|
11 |
defined( 'ABSPATH' ) or exit();
|
12 |
/*
|
|
|
|
|
|
|
|
|
|
|
13 |
* v3.1.3 change log
|
14 |
* - tweak : css tweak for the assist when in customizer, for WordPress 4.1
|
15 |
*
|
@@ -150,7 +155,7 @@ if( !class_exists( 'Custom_Menu_Wizard_Plugin' ) ){
|
|
150 |
//declare the main plugin class...
|
151 |
class Custom_Menu_Wizard_Plugin {
|
152 |
|
153 |
-
public static $version = '3.1.
|
154 |
public static $script_handle = 'custom-menu-wizard-plugin-script';
|
155 |
public static $widget_class = 'Custom_Menu_Wizard_Widget';
|
156 |
protected static $instance;
|
@@ -170,6 +175,8 @@ if( !class_exists( 'Custom_Menu_Wizard_Plugin' ) ){
|
|
170 |
add_action( 'customize_controls_enqueue_scripts', array( &$this, 'enqueue_styles' ) );
|
171 |
add_action( 'customize_controls_enqueue_scripts', array( &$this, 'enqueue_scripts' ) );
|
172 |
|
|
|
|
|
173 |
//add filter for encoding a cmwizard shortcode into instance settings...
|
174 |
add_filter( 'custom_menu_wizard_encode_shortcode', array( $this, 'encode_shortcode' ), 10, 1 );
|
175 |
//add filter for sanitizing an alternative shortcode setting...
|
@@ -450,6 +457,16 @@ if( !class_exists( 'Custom_Menu_Wizard_Plugin' ) ){
|
|
450 |
|
451 |
} //end sanitize_alternative()
|
452 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
453 |
/**
|
454 |
* shortcode processing for [cmwizard option="" option="" ...] (as of v3.0.0)
|
455 |
*
|
@@ -620,6 +637,7 @@ if( !class_exists( 'Custom_Menu_Wizard_Plugin' ) ){
|
|
620 |
'flat_output' => 0,
|
621 |
//determines title_from_[branch|current|branch-root|current-root]...
|
622 |
'title_from' => '', // csv of branch|current|branch-root|current-root
|
|
|
623 |
'ol_root' => 0,
|
624 |
'ol_sub' => 0,
|
625 |
//strings...
|
@@ -801,7 +819,8 @@ if( !class_exists( 'Custom_Menu_Wizard_Plugin' ) ){
|
|
801 |
}
|
802 |
}
|
803 |
if( !empty( $instance['switch_if'] ) && !empty( $instance['switch_at'] ) ){
|
804 |
-
$
|
|
|
805 |
}else{
|
806 |
$instance['switch_if'] = $instance['switch_at'] = $instance['switch_to'] = '';
|
807 |
}
|
3 |
* Plugin Name: Custom Menu Wizard
|
4 |
* Plugin URI: http://wordpress.org/plugins/custom-menu-wizard/
|
5 |
* Description: Show any part of a custom menu in a Widget, or in content using a Shortcode. Customise the output with extra classes or html; filter by current menu item or a specific item; set a depth, show the parent(s), change the list style, etc. Use the included emulator to assist with the filter settings.
|
6 |
+
* Version: 3.1.4
|
7 |
* Author: Roger Barrett
|
8 |
* Author URI: http://www.wizzud.com/
|
9 |
* License: GPL2+
|
10 |
*/
|
11 |
defined( 'ABSPATH' ) or exit();
|
12 |
/*
|
13 |
+
* v3.1.4 change log
|
14 |
+
* - fixed bug : in the shortcode format, the Alternative wasn't actually being used (always ran the default)! thanks corrideat
|
15 |
+
* - fixed bug : prevent texturization of the shortcode's content (the Alternative, when supplied)
|
16 |
+
* - added the ability to make the title a link if it is set from a menu item (using Set Title from)
|
17 |
+
*
|
18 |
* v3.1.3 change log
|
19 |
* - tweak : css tweak for the assist when in customizer, for WordPress 4.1
|
20 |
*
|
155 |
//declare the main plugin class...
|
156 |
class Custom_Menu_Wizard_Plugin {
|
157 |
|
158 |
+
public static $version = '3.1.4';
|
159 |
public static $script_handle = 'custom-menu-wizard-plugin-script';
|
160 |
public static $widget_class = 'Custom_Menu_Wizard_Widget';
|
161 |
protected static $instance;
|
175 |
add_action( 'customize_controls_enqueue_scripts', array( &$this, 'enqueue_styles' ) );
|
176 |
add_action( 'customize_controls_enqueue_scripts', array( &$this, 'enqueue_scripts' ) );
|
177 |
|
178 |
+
//add filter to prevent texturisation of cmwizard shortcode (screws up alternatives!)...
|
179 |
+
add_filter( 'no_texturize_shortcodes', array( &$this, 'no_texturize_shortcode' ) );
|
180 |
//add filter for encoding a cmwizard shortcode into instance settings...
|
181 |
add_filter( 'custom_menu_wizard_encode_shortcode', array( $this, 'encode_shortcode' ), 10, 1 );
|
182 |
//add filter for sanitizing an alternative shortcode setting...
|
457 |
|
458 |
} //end sanitize_alternative()
|
459 |
|
460 |
+
/**
|
461 |
+
* hooked into no_texturize_shortcodes filter : prevents texturisation of cmwizard shortcode
|
462 |
+
*
|
463 |
+
* @param array $arr Array of shortcodes
|
464 |
+
* @return array
|
465 |
+
*/
|
466 |
+
public function no_texturize_shortcode( $arr = false ){
|
467 |
+
return empty( $arr ) ? array('cmwizard') : array_merge( (array)$arr, array('cmwizard') );
|
468 |
+
}
|
469 |
+
|
470 |
/**
|
471 |
* shortcode processing for [cmwizard option="" option="" ...] (as of v3.0.0)
|
472 |
*
|
637 |
'flat_output' => 0,
|
638 |
//determines title_from_[branch|current|branch-root|current-root]...
|
639 |
'title_from' => '', // csv of branch|current|branch-root|current-root
|
640 |
+
'title_linked' => 0, //v3.1.4
|
641 |
'ol_root' => 0,
|
642 |
'ol_sub' => 0,
|
643 |
//strings...
|
819 |
}
|
820 |
}
|
821 |
if( !empty( $instance['switch_if'] ) && !empty( $instance['switch_at'] ) ){
|
822 |
+
//v3.1.4 : fixed bug where $content - the alternative shortcode - wasn't being passed into the filter...
|
823 |
+
$instance['switch_to'] = apply_filters( 'custom_menu_wizard_sanitize_alternative', $content );
|
824 |
}else{
|
825 |
$instance['switch_if'] = $instance['switch_at'] = $instance['switch_to'] = '';
|
826 |
}
|
include/class.walker.php
CHANGED
@@ -848,26 +848,28 @@ class Custom_Menu_Wizard_Walker extends Walker_Nav_Menu {
|
|
848 |
|
849 |
//check for title_from...
|
850 |
if( $continue ){
|
|
|
|
|
851 |
//might we want the (original) branch item's, or root item's, title as the widget title?...
|
852 |
if( $find_branch && $theBranchItem > 0 ){
|
853 |
-
$cmw['_walker']['
|
854 |
if( $this->_cmw_tree[ $theBranchItem ]['level'] > 1 ){
|
855 |
$topOfBranch = array_slice( $this->_cmw_tree[ $theBranchItem ]['ancestors'], 1, 1 );
|
856 |
$topOfBranch = $topOfBranch[0];
|
857 |
-
$cmw['_walker']['
|
858 |
}else{
|
859 |
-
$cmw['_walker']['
|
860 |
}
|
861 |
}
|
862 |
//might we want the current item's, or root item's, title as the widget title?...
|
863 |
if( $currentItem !== false ){
|
864 |
-
$cmw['_walker']['
|
865 |
if( $this->_cmw_tree[ $currentItem ]['level'] > 1 ){
|
866 |
$topOfBranch = array_slice( $this->_cmw_tree[ $currentItem ]['ancestors'], 1, 1 );
|
867 |
$topOfBranch = $topOfBranch[0];
|
868 |
-
$cmw['_walker']['
|
869 |
}else{
|
870 |
-
$cmw['_walker']['
|
871 |
}
|
872 |
}
|
873 |
}
|
848 |
|
849 |
//check for title_from...
|
850 |
if( $continue ){
|
851 |
+
//v3.1.4 : this used to pass back just the title; it now passes back the element object!
|
852 |
+
$cmw['_walker']['get_title_from'] = array();
|
853 |
//might we want the (original) branch item's, or root item's, title as the widget title?...
|
854 |
if( $find_branch && $theBranchItem > 0 ){
|
855 |
+
$cmw['_walker']['get_title_from']['branch'] = $elements[ $this->_cmw_tree[ $theBranchItem ]['element'][0] ];
|
856 |
if( $this->_cmw_tree[ $theBranchItem ]['level'] > 1 ){
|
857 |
$topOfBranch = array_slice( $this->_cmw_tree[ $theBranchItem ]['ancestors'], 1, 1 );
|
858 |
$topOfBranch = $topOfBranch[0];
|
859 |
+
$cmw['_walker']['get_title_from']['branch_root'] = $elements[ $this->_cmw_tree[ $topOfBranch ]['element'][0] ];
|
860 |
}else{
|
861 |
+
$cmw['_walker']['get_title_from']['branch_root'] = $cmw['_walker']['get_title_from']['branch'];
|
862 |
}
|
863 |
}
|
864 |
//might we want the current item's, or root item's, title as the widget title?...
|
865 |
if( $currentItem !== false ){
|
866 |
+
$cmw['_walker']['get_title_from']['current'] = $elements[ $this->_cmw_tree[ $currentItem ]['element'][0] ];
|
867 |
if( $this->_cmw_tree[ $currentItem ]['level'] > 1 ){
|
868 |
$topOfBranch = array_slice( $this->_cmw_tree[ $currentItem ]['ancestors'], 1, 1 );
|
869 |
$topOfBranch = $topOfBranch[0];
|
870 |
+
$cmw['_walker']['get_title_from']['current_root'] = $elements[ $this->_cmw_tree[ $topOfBranch ]['element'][0] ];
|
871 |
}else{
|
872 |
+
$cmw['_walker']['get_title_from']['current_root'] = $cmw['_walker']['get_title_from']['current'];
|
873 |
}
|
874 |
}
|
875 |
}
|
include/class.widget.php
CHANGED
@@ -513,6 +513,13 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
513 |
'disableif' => $isNotByBranch
|
514 |
) ); ?>
|
515 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
516 |
</div>
|
517 |
|
518 |
<div>
|
@@ -839,17 +846,41 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
839 |
|
840 |
//title from : priority is current -> current root -> branch -> branch root...
|
841 |
//note that none actually have to be present in the results
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
846 |
}
|
847 |
}
|
848 |
if( empty( $title ) ){
|
849 |
-
$title = $instance['hide_title'] ? '' : $instance['title'];
|
850 |
}
|
851 |
-
//allow the widget_title filter to override anything we've set up...
|
852 |
-
$title = apply_filters('widget_title', $title, $instance, $this->id_base);
|
853 |
|
854 |
//remove/replace the cmw-fellback-maybe class...
|
855 |
$out = str_replace(
|
@@ -1298,6 +1329,7 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1298 |
'title_from_branch_root' => 0, //v3.0.0 added
|
1299 |
'title_from_current' => 0,
|
1300 |
'title_from_current_root' => 0, //v3.0.0 added
|
|
|
1301 |
'ol_root' => 0,
|
1302 |
'ol_sub' => 0,
|
1303 |
'hide_empty' => 0, //this only has relevance prior to WP v3.6
|
@@ -1431,6 +1463,7 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1431 |
* returns the shortcode equivalent of the current settings (not called by legacy code!)
|
1432 |
*
|
1433 |
* @param array $instance
|
|
|
1434 |
* @return string
|
1435 |
*/
|
1436 |
public function cmw_shortcode( $instance, $asJSON=false ){
|
@@ -1532,6 +1565,10 @@ class Custom_Menu_Wizard_Widget extends WP_Widget {
|
|
1532 |
}
|
1533 |
if( !empty( $n ) ){
|
1534 |
$args['title_from'] = $n;
|
|
|
|
|
|
|
|
|
1535 |
}
|
1536 |
//switches...
|
1537 |
foreach( array('siblings', 'flat_output', 'ol_root', 'ol_sub', 'fallback_ci_parent') as $n ){
|
513 |
'disableif' => $isNotByBranch
|
514 |
) ); ?>
|
515 |
</div>
|
516 |
+
<div class="cmw-indented">
|
517 |
+
… <?php _e('and:'); ?>
|
518 |
+
<?php $this->cmw_formfield_checkbox( $instance, 'title_linked',
|
519 |
+
array(
|
520 |
+
'label' => __('Make it a Link')
|
521 |
+
) ); ?>
|
522 |
+
</div>
|
523 |
</div>
|
524 |
|
525 |
<div>
|
846 |
|
847 |
//title from : priority is current -> current root -> branch -> branch root...
|
848 |
//note that none actually have to be present in the results
|
849 |
+
//v3.1.4 : used to get just the title string passed back, now get the menu item element!
|
850 |
+
if( !empty( $this->_cmw_walker['get_title_from'] ) ){
|
851 |
+
foreach( array('current', 'current_root', 'branch', 'branch_root') as $v){
|
852 |
+
if( $instance[ 'title_from_' . $v ] && !empty( $this->_cmw_walker['get_title_from'][ $v ] )
|
853 |
+
&& !empty( $this->_cmw_walker['get_title_from'][ $v ]->title ) ){
|
854 |
+
//allow the widget_title filter to override...
|
855 |
+
$title = apply_filters( 'widget_title', $this->_cmw_walker['get_title_from'][ $v ]->title, $instance, $this->id_base );
|
856 |
+
//if we've been asked for a linked title...
|
857 |
+
if( $instance['title_linked'] ){
|
858 |
+
$n = array(
|
859 |
+
'title' => empty( $this->_cmw_walker['get_title_from'][ $v ]->attr_title ) ? '' : $this->_cmw_walker['get_title_from'][ $v ]->attr_title,
|
860 |
+
'target' => empty( $this->_cmw_walker['get_title_from'][ $v ]->target ) ? '' : $this->_cmw_walker['get_title_from'][ $v ]->target,
|
861 |
+
'rel' => empty( $this->_cmw_walker['get_title_from'][ $v ]->xfn ) ? '' : $this->_cmw_walker['get_title_from'][ $v ]->xfn,
|
862 |
+
'href' => empty( $this->_cmw_walker['get_title_from'][ $v ]->url ) ? '' : $this->_cmw_walker['get_title_from'][ $v ]->url,
|
863 |
+
'class' => 'cmw-linked-widget-title'
|
864 |
+
);
|
865 |
+
$n = apply_filters( 'custom_menu_wizard_title_link_atts', $n, $this->_cmw_walker['get_title_from'][ $v ], $instance, $this->id_base );
|
866 |
+
$atts = '';
|
867 |
+
foreach ( (array)$n as $i => $j ) {
|
868 |
+
if ( !empty( $j ) ) {
|
869 |
+
$j = ( $i === 'href' ) ? esc_url( $j ) : esc_attr( $j );
|
870 |
+
$atts .= ' ' . $i . '="' . $j . '"';
|
871 |
+
}
|
872 |
+
}
|
873 |
+
if( !empty( $atts ) ){
|
874 |
+
$title = '<a' . $atts . '>' . $title . '</a>';
|
875 |
+
}
|
876 |
+
}
|
877 |
+
break;
|
878 |
+
}
|
879 |
}
|
880 |
}
|
881 |
if( empty( $title ) ){
|
882 |
+
$title = $instance['hide_title'] ? '' : apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
|
883 |
}
|
|
|
|
|
884 |
|
885 |
//remove/replace the cmw-fellback-maybe class...
|
886 |
$out = str_replace(
|
1329 |
'title_from_branch_root' => 0, //v3.0.0 added
|
1330 |
'title_from_current' => 0,
|
1331 |
'title_from_current_root' => 0, //v3.0.0 added
|
1332 |
+
'title_linked' => 0, //v3.1.4 added
|
1333 |
'ol_root' => 0,
|
1334 |
'ol_sub' => 0,
|
1335 |
'hide_empty' => 0, //this only has relevance prior to WP v3.6
|
1463 |
* returns the shortcode equivalent of the current settings (not called by legacy code!)
|
1464 |
*
|
1465 |
* @param array $instance
|
1466 |
+
* @param boolean $asJSON Requests response in JSON format, for the data-cmws attribute
|
1467 |
* @return string
|
1468 |
*/
|
1469 |
public function cmw_shortcode( $instance, $asJSON=false ){
|
1565 |
}
|
1566 |
if( !empty( $n ) ){
|
1567 |
$args['title_from'] = $n;
|
1568 |
+
//...title_linked is only relevant if title_from is set...
|
1569 |
+
if( $instance['title_linked'] ){
|
1570 |
+
$args['title_linked'] = 1;
|
1571 |
+
}
|
1572 |
}
|
1573 |
//switches...
|
1574 |
foreach( array('siblings', 'flat_output', 'ol_root', 'ol_sub', 'fallback_ci_parent') as $n ){
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: menu,widget,navigation,custom menu,partial menu,current item,current page,menu level,menu branch,menu shortcode,menu widget,advanced,enhanced
|
5 |
Requires at least: 3.6
|
6 |
Tested up to: 4.1
|
7 |
-
Stable tag: 3.1.
|
8 |
License: GPLv2 or Later
|
9 |
|
10 |
Show branches or levels of your menu in a widget, or in content using a shortcode, with full customisation.
|
@@ -336,6 +336,11 @@ as the Current Item.
|
|
336 |
* **Branch** : only applicable to a `Branch` filter, and sets `Title` from the `Branch` item.
|
337 |
* **...or its Root** : only applicable to a `Branch` filter, and sets `Title` from the branch's root menu item.
|
338 |
|
|
|
|
|
|
|
|
|
|
|
339 |
* **Change UL to OL** *checkboxes*
|
340 |
|
341 |
The standard for menus is to use UL (unordered list) elements to display the output. These settings give you the option to
|
@@ -491,7 +496,7 @@ a "+" or "-") integer, eg. `start_at="+1"`, while an absolute level is unsigned,
|
|
491 |
|
492 |
= start_mode =
|
493 |
*string* : This has only one accepted value - "level" - and is only applicable for a `Branch` filter whose **start_at** setting returns
|
494 |
-
in an item is at or above the selected branch item (relatively or absolutely).
|
495 |
Setting `start_mode="level"` forces the widget to use not only the resultant starting item
|
496 |
and its relevant descendants, but also all that item's siblings *and their descendants*
|
497 |
(ref. the widget's `Level` radio option under *Secondary Filter*,
|
@@ -572,6 +577,9 @@ same as "current,1,+siblings", and "2,parent" is the same as "parent,2", etc.
|
|
572 |
* *"branch"* : enables the widget's *Branch* `Set Title from` option
|
573 |
* *"branch-root"* : enables the widget's *...or its Root* option that relates to the `Branch` `Set Title from` option
|
574 |
|
|
|
|
|
|
|
575 |
= ol_root =
|
576 |
*switch, off by default, 1 to enable* : See widget's `Top Level` option, under *Change UL to OL* in the [Output Section](http://wordpress.org/plugins/custom-menu-wizard/other_notes/#Output-Section).
|
577 |
|
@@ -680,7 +688,7 @@ Example : `[cmwizard findme=1 title="Posts containing a CMW shortcode..."/]`
|
|
680 |
* Show the entire "main" menu entitled "Main Menu" *unless* there's a current menu item, in which case show the current menu item, its siblings and its immediate children, and entitle it "Nearest and Dearest!"
|
681 |
|
682 |
`
|
683 |
-
[cmwizard menu=main title="Main Menu"]title="Nearest and Dearest!" branch=current depth=2 siblings=1[/cmwizard]
|
684 |
`
|
685 |
|
686 |
== Frequently Asked Questions ==
|
@@ -788,6 +796,11 @@ Note that output from this shortcode extension is restricted to users with edit_
|
|
788 |
|
789 |
== Changelog ==
|
790 |
|
|
|
|
|
|
|
|
|
|
|
791 |
= 3.1.3 =
|
792 |
* tweak : minor change to css for the assist when running under the Customizer (WordPress 4.1)
|
793 |
|
@@ -924,6 +937,10 @@ Note that output from this shortcode extension is restricted to users with edit_
|
|
924 |
|
925 |
== Upgrade Notice ==
|
926 |
|
|
|
|
|
|
|
|
|
927 |
= 3.1.3 =
|
928 |
Tweaked the assist's css for when running the Customizer in WordPress 4.1.
|
929 |
|
4 |
Tags: menu,widget,navigation,custom menu,partial menu,current item,current page,menu level,menu branch,menu shortcode,menu widget,advanced,enhanced
|
5 |
Requires at least: 3.6
|
6 |
Tested up to: 4.1
|
7 |
+
Stable tag: 3.1.4
|
8 |
License: GPLv2 or Later
|
9 |
|
10 |
Show branches or levels of your menu in a widget, or in content using a shortcode, with full customisation.
|
336 |
* **Branch** : only applicable to a `Branch` filter, and sets `Title` from the `Branch` item.
|
337 |
* **...or its Root** : only applicable to a `Branch` filter, and sets `Title` from the branch's root menu item.
|
338 |
|
339 |
+
* **Make it a Link** *checkbox*
|
340 |
+
|
341 |
+
If the widget `Title` does actually get set using one of the `Set Title from` options, then this will put an anchor around the
|
342 |
+
title, using the information from the menu item that supplies the title.
|
343 |
+
|
344 |
* **Change UL to OL** *checkboxes*
|
345 |
|
346 |
The standard for menus is to use UL (unordered list) elements to display the output. These settings give you the option to
|
496 |
|
497 |
= start_mode =
|
498 |
*string* : This has only one accepted value - "level" - and is only applicable for a `Branch` filter whose **start_at** setting returns
|
499 |
+
in an item that is at or above the selected branch item (relatively or absolutely).
|
500 |
Setting `start_mode="level"` forces the widget to use not only the resultant starting item
|
501 |
and its relevant descendants, but also all that item's siblings *and their descendants*
|
502 |
(ref. the widget's `Level` radio option under *Secondary Filter*,
|
577 |
* *"branch"* : enables the widget's *Branch* `Set Title from` option
|
578 |
* *"branch-root"* : enables the widget's *...or its Root* option that relates to the `Branch` `Set Title from` option
|
579 |
|
580 |
+
= title_linked =
|
581 |
+
*switch, off by default, 1 to enable* : Makes the title into a link if the title comes from one of the `title_from` options.
|
582 |
+
|
583 |
= ol_root =
|
584 |
*switch, off by default, 1 to enable* : See widget's `Top Level` option, under *Change UL to OL* in the [Output Section](http://wordpress.org/plugins/custom-menu-wizard/other_notes/#Output-Section).
|
585 |
|
688 |
* Show the entire "main" menu entitled "Main Menu" *unless* there's a current menu item, in which case show the current menu item, its siblings and its immediate children, and entitle it "Nearest and Dearest!"
|
689 |
|
690 |
`
|
691 |
+
[cmwizard menu=main title="Main Menu" alternative="current,menu"]title="Nearest and Dearest!" branch=current depth=2 siblings=1[/cmwizard]
|
692 |
`
|
693 |
|
694 |
== Frequently Asked Questions ==
|
796 |
|
797 |
== Changelog ==
|
798 |
|
799 |
+
= 3.1.4 =
|
800 |
+
* bugfix : in shortcode processing, any supplied Alternative settings weren't being used. thanks corrideat
|
801 |
+
* bugfix : prevent texturization of shortcode's content, for when it is being used with an Alternative setting
|
802 |
+
* addition : the ability to make a title into a link when the title has been set from a menu item
|
803 |
+
|
804 |
= 3.1.3 =
|
805 |
* tweak : minor change to css for the assist when running under the Customizer (WordPress 4.1)
|
806 |
|
937 |
|
938 |
== Upgrade Notice ==
|
939 |
|
940 |
+
= 3.1.4 =
|
941 |
+
Fixed a couple of bugs in the shortcode processing, for when an Alternative is being used.
|
942 |
+
Added the ability to make a title into a link when the title has been set from a menu item.
|
943 |
+
|
944 |
= 3.1.3 =
|
945 |
Tweaked the assist's css for when running the Customizer in WordPress 4.1.
|
946 |
|