JQuery Accordion Menu Widget - Version 2.1

Version Description

  • Edit: Security for dynamic skins
Download this release

Release Info

Developer remix4
Plugin Icon wp plugin JQuery Accordion Menu Widget
Version 2.1
Comparing to
See all releases

Code changes from version 2.0 to 2.1

dcwp_jquery_accordion.php CHANGED
@@ -5,7 +5,7 @@
5
  Tags: jquery, dropdown, menu, vertical accordion, animated, css, navigation, accordion
6
  Description: Creates a widget, which allows you to create vertical accordion menus from any Wordpress custom menu using jQuery. Features include - handles multiple levels, saved state using cookies and option of selecting "click" or "hover" events for triggering the menu.
7
  Author: Lee Chestnutt
8
- Version: 2.0
9
  Author URI: http://www.designchemical.com
10
  */
11
 
5
  Tags: jquery, dropdown, menu, vertical accordion, animated, css, navigation, accordion
6
  Description: Creates a widget, which allows you to create vertical accordion menus from any Wordpress custom menu using jQuery. Features include - handles multiple levels, saved state using cookies and option of selecting "click" or "hover" events for triggering the menu.
7
  Author: Lee Chestnutt
8
+ Version: 2.1
9
  Author URI: http://www.designchemical.com
10
  */
11
 
dcwp_jquery_accordion_widget.php CHANGED
@@ -187,7 +187,8 @@ class dc_jqaccordion_widget extends WP_Widget {
187
  //Don't list subdirectories
188
  if (!is_dir("$dirpath/$file")) {
189
  //Remove file extension
190
- echo "<option value='$file' ".selected($skin, $file, false).">" . htmlspecialchars(ucfirst(preg_replace('/\..*$/', '', $file))) . '</option>';
 
191
  }
192
  }
193
  closedir($dh);
@@ -213,7 +214,8 @@ class dc_jqaccordion_widget extends WP_Widget {
213
  $widget_id = $this->id_base . '-' . $key;
214
  if(is_active_widget(false, $widget_id, $this->id_base)){
215
 
216
- $skin = $wpdcjqaccordion['skin'];
 
217
  if('no-theme'!=$skin){
218
  echo "\n\t<link rel=\"stylesheet\" href=\"".dc_jqaccordion::get_plugin_directory()."/skin.php?widget_id=".$key."&skin=".strtolower($skin)."\" type=\"text/css\" media=\"screen\" />";
219
  }
187
  //Don't list subdirectories
188
  if (!is_dir("$dirpath/$file")) {
189
  //Remove file extension
190
+ $newSkin = htmlspecialchars(ucfirst(preg_replace('/\..*$/', '', $file)));
191
+ echo "<option value='$newSkin' ".selected($skin, $newSkin, false).">" . $newSkin . '</option>';
192
  }
193
  }
194
  closedir($dh);
214
  $widget_id = $this->id_base . '-' . $key;
215
  if(is_active_widget(false, $widget_id, $this->id_base)){
216
 
217
+ $skin = $wpdcjqaccordion['skin'];
218
+ $skin = htmlspecialchars(ucfirst(preg_replace('/\..*$/', '', $skin)));
219
  if('no-theme'!=$skin){
220
  echo "\n\t<link rel=\"stylesheet\" href=\"".dc_jqaccordion::get_plugin_directory()."/skin.php?widget_id=".$key."&skin=".strtolower($skin)."\" type=\"text/css\" media=\"screen\" />";
221
  }
js/jquery.dcjqaccordion.2.0.js CHANGED
@@ -1,205 +1,205 @@
1
- /*
2
- * DC jQuery Accordion - jQuery accordion menu widget
3
- * Copyright (c) 2011 Design Chemical
4
- *
5
- * Dual licensed under the MIT and GPL licenses:
6
- * http://www.opensource.org/licenses/mit-license.php
7
- * http://www.gnu.org/licenses/gpl.html
8
- *
9
- */
10
- (function($){
11
-
12
- //define the new for the plugin ans how to call it
13
-
14
- $.fn.dcAccordion = function(options) {
15
- //set default options
16
- var defaults = {
17
- classParent : 'dcjq-parent',
18
- classActive : 'active',
19
- eventType : 'click',
20
- hoverDelay : 300,
21
- menuClose : true,
22
- autoClose : true,
23
- speed : 'slow',
24
- saveState : true,
25
- disableLink : true
26
- };
27
-
28
- //call in the default otions
29
- var options = $.extend(defaults, options);
30
- var $dcAccordionItem = this;
31
-
32
- //act upon the element that is passed into the design
33
- return $dcAccordionItem.each(function(options){
34
-
35
- setUpAccordion();
36
-
37
- if(defaults.saveState == true){
38
- cookieId = $(this).parent().attr('id');
39
- checkCookie();
40
- }
41
- resetAccordion();
42
-
43
- if(defaults.eventType == 'hover'){
44
-
45
- var config = {
46
- sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
47
- interval: defaults.hoverDelay, // number = milliseconds for onMouseOver polling interval
48
- over: linkOver, // function = onMouseOver callback (REQUIRED)
49
- timeout: defaults.hoverDelay, // number = milliseconds delay before onMouseOut
50
- out: linkOut // function = onMouseOut callback (REQUIRED)
51
- };
52
- $('li a',$dcAccordionItem).hoverIntent(config);
53
-
54
- var configMenu = {
55
- sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
56
- interval: 1000, // number = milliseconds for onMouseOver polling interval
57
- over: menuOver, // function = onMouseOver callback (REQUIRED)
58
- timeout: 1000, // number = milliseconds delay before onMouseOut
59
- out: menuOut // function = onMouseOut callback (REQUIRED)
60
- };
61
- $($dcAccordionItem).hoverIntent(configMenu);
62
-
63
- // Disable parent links
64
- if(defaults.disableLink == true){
65
- $('li a',$dcAccordionItem).click(function(e){
66
- if($(this).next('ul').length >0){
67
- e.preventDefault();
68
- }
69
- });
70
- }
71
-
72
- } else {
73
-
74
- $('li a',$dcAccordionItem).click(function(e){
75
-
76
- $activeLi = $(this).parent('li');
77
- $parentsLi = $activeLi.parents('li');
78
- $parentsUl = $activeLi.parents('ul');
79
-
80
- // Prevent browsing to link if has child links
81
- if(defaults.disableLink == true){
82
- if($(this).next('ul').length >0){
83
- e.preventDefault();
84
- }
85
- }
86
-
87
- // Auto close sibling menus
88
- if(defaults.autoClose == true){
89
- autoCloseAccordion($parentsLi, $parentsUl);
90
- }
91
-
92
- if ($('> ul',$activeLi).is(':visible')){
93
- $('ul',$activeLi).slideUp(defaults.speed);
94
- $('a',$activeLi).removeClass(defaults.classActive);
95
- } else {
96
- $(this).next().slideToggle(defaults.speed);
97
- $('> a',$activeLi).addClass(defaults.classActive);
98
- }
99
-
100
- // Write cookie if save state is on
101
- if(defaults.saveState == true){
102
- createCookie();
103
- }
104
- });
105
- }
106
- // Set up accordion
107
- function setUpAccordion(){
108
- $arrow = '<span class="dcjq-icon"></span>';
109
- $('> ul',$dcAccordionItem).show();
110
- $('li',$dcAccordionItem).each(function(){
111
- var classParentLi = defaults.classParent+'-li';
112
- if($('> ul',this).length > 0){
113
- $(this).addClass(classParentLi);
114
- $('> a',this).addClass(defaults.classParent).append($arrow);
115
- }
116
- });
117
- $('> ul',$dcAccordionItem).hide();
118
- }
119
- });
120
-
121
- function linkOver(){
122
-
123
- $activeLi = $(this).parent('li');
124
- $parentsLi = $activeLi.parents('li');
125
- $parentsUl = $activeLi.parents('ul');
126
-
127
- // Auto close sibling menus
128
- if(defaults.autoClose == true){
129
- autoCloseAccordion($parentsLi, $parentsUl);
130
- }
131
-
132
- if ($('> ul',$activeLi).is(':visible')){
133
- $('ul',$activeLi).slideUp(defaults.speed);
134
- $('a',$activeLi).removeClass(defaults.classActive);
135
- } else {
136
- $(this).next().slideToggle(defaults.speed);
137
- $('> a',$activeLi).addClass(defaults.classActive);
138
- }
139
-
140
- // Write cookie if save state is on
141
- if(defaults.saveState == true){
142
- createCookie();
143
- }
144
-
145
- }
146
-
147
- function linkOut(){
148
- }
149
-
150
- function menuOver(){
151
- }
152
-
153
- function menuOut(){
154
- if(defaults.menuClose == true){
155
- $('ul',$dcAccordionItem).slideUp(defaults.speed);
156
- // Reset active links
157
- $('a',$dcAccordionItem).removeClass(defaults.classActive);
158
- createCookie();
159
- }
160
- }
161
-
162
- // Auto-Close Open Menu Items
163
- function autoCloseAccordion($parentsLi, $parentsUl){
164
- $('ul',$dcAccordionItem).not($parentsUl).slideUp(defaults.speed);
165
- // Reset active links
166
- $('a',$dcAccordionItem).removeClass(defaults.classActive);
167
- $('> a',$parentsLi).addClass(defaults.classActive);
168
- }
169
-
170
- // Retrieve cookie value and set active items
171
- function checkCookie(){
172
- var cookieVal = $.cookie(cookieId);
173
- if(cookieVal != null){
174
- // create array from cookie string
175
- var activeArray = cookieVal.split(',');
176
- $.each(activeArray, function(index,value){
177
- var $cookieLi = $('li:eq('+value+')',$dcAccordionItem);
178
- $('> a',$cookieLi).addClass(defaults.classActive);
179
- var $parentsLi = $cookieLi.parents('li');
180
- $('> a',$parentsLi).addClass(defaults.classActive);
181
- });
182
- }
183
- }
184
-
185
- // Reset accordion using active links
186
- function resetAccordion(){
187
- $('ul',$dcAccordionItem).hide();
188
- $allActiveLi = $('a.'+defaults.classActive,$dcAccordionItem);
189
- $allActiveLi.next().show();
190
- }
191
-
192
- // Write cookie
193
- function createCookie(){
194
- var activeIndex = [];
195
- // Create array of active items index value
196
- $('li a.active',$dcAccordionItem).each(function(i){
197
- var $arrayItem = $(this).parent('li');
198
- var itemIndex = $('li',$dcAccordionItem).index($arrayItem);
199
- activeIndex.push(itemIndex);
200
- });
201
- // Store in cookie
202
- $.cookie(cookieId, activeIndex, { path: '/' });
203
- }
204
- };
205
  })(jQuery);
1
+ /*
2
+ * DC jQuery Accordion - jQuery accordion menu widget
3
+ * Copyright (c) 2011 Design Chemical
4
+ *
5
+ * Dual licensed under the MIT and GPL licenses:
6
+ * http://www.opensource.org/licenses/mit-license.php
7
+ * http://www.gnu.org/licenses/gpl.html
8
+ *
9
+ */
10
+ (function($){
11
+
12
+ //define the new for the plugin ans how to call it
13
+
14
+ $.fn.dcAccordion = function(options) {
15
+ //set default options
16
+ var defaults = {
17
+ classParent : 'dcjq-parent',
18
+ classActive : 'active',
19
+ eventType : 'click',
20
+ hoverDelay : 300,
21
+ menuClose : true,
22
+ autoClose : true,
23
+ speed : 'slow',
24
+ saveState : true,
25
+ disableLink : true
26
+ };
27
+
28
+ //call in the default otions
29
+ var options = $.extend(defaults, options);
30
+ var $dcAccordionItem = this;
31
+
32
+ //act upon the element that is passed into the design
33
+ return $dcAccordionItem.each(function(options){
34
+
35
+ setUpAccordion();
36
+
37
+ if(defaults.saveState == true){
38
+ cookieId = $(this).parent().attr('id');
39
+ checkCookie();
40
+ }
41
+ resetAccordion();
42
+
43
+ if(defaults.eventType == 'hover'){
44
+
45
+ var config = {
46
+ sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
47
+ interval: defaults.hoverDelay, // number = milliseconds for onMouseOver polling interval
48
+ over: linkOver, // function = onMouseOver callback (REQUIRED)
49
+ timeout: defaults.hoverDelay, // number = milliseconds delay before onMouseOut
50
+ out: linkOut // function = onMouseOut callback (REQUIRED)
51
+ };
52
+ $('li a',$dcAccordionItem).hoverIntent(config);
53
+
54
+ var configMenu = {
55
+ sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
56
+ interval: 1000, // number = milliseconds for onMouseOver polling interval
57
+ over: menuOver, // function = onMouseOver callback (REQUIRED)
58
+ timeout: 1000, // number = milliseconds delay before onMouseOut
59
+ out: menuOut // function = onMouseOut callback (REQUIRED)
60
+ };
61
+ $($dcAccordionItem).hoverIntent(configMenu);
62
+
63
+ // Disable parent links
64
+ if(defaults.disableLink == true){
65
+ $('li a',$dcAccordionItem).click(function(e){
66
+ if($(this).next('ul').length >0){
67
+ e.preventDefault();
68
+ }
69
+ });
70
+ }
71
+
72
+ } else {
73
+
74
+ $('li a',$dcAccordionItem).click(function(e){
75
+
76
+ $activeLi = $(this).parent('li');
77
+ $parentsLi = $activeLi.parents('li');
78
+ $parentsUl = $activeLi.parents('ul');
79
+
80
+ // Prevent browsing to link if has child links
81
+ if(defaults.disableLink == true){
82
+ if($(this).next('ul').length >0){
83
+ e.preventDefault();
84
+ }
85
+ }
86
+
87
+ // Auto close sibling menus
88
+ if(defaults.autoClose == true){
89
+ autoCloseAccordion($parentsLi, $parentsUl);
90
+ }
91
+
92
+ if ($('> ul',$activeLi).is(':visible')){
93
+ $('ul',$activeLi).slideUp(defaults.speed);
94
+ $('a',$activeLi).removeClass(defaults.classActive);
95
+ } else {
96
+ $(this).next().slideToggle(defaults.speed);
97
+ $('> a',$activeLi).addClass(defaults.classActive);
98
+ }
99
+
100
+ // Write cookie if save state is on
101
+ if(defaults.saveState == true){
102
+ createCookie();
103
+ }
104
+ });
105
+ }
106
+ // Set up accordion
107
+ function setUpAccordion(){
108
+ $arrow = '<span class="dcjq-icon"></span>';
109
+ $('> ul',$dcAccordionItem).show();
110
+ $('li',$dcAccordionItem).each(function(){
111
+ var classParentLi = defaults.classParent+'-li';
112
+ if($('> ul',this).length > 0){
113
+ $(this).addClass(classParentLi);
114
+ $('> a',this).addClass(defaults.classParent).append($arrow);
115
+ }
116
+ });
117
+ $('> ul',$dcAccordionItem).hide();
118
+ }
119
+ });
120
+
121
+ function linkOver(){
122
+
123
+ $activeLi = $(this).parent('li');
124
+ $parentsLi = $activeLi.parents('li');
125
+ $parentsUl = $activeLi.parents('ul');
126
+
127
+ // Auto close sibling menus
128
+ if(defaults.autoClose == true){
129
+ autoCloseAccordion($parentsLi, $parentsUl);
130
+ }
131
+
132
+ if ($('> ul',$activeLi).is(':visible')){
133
+ $('ul',$activeLi).slideUp(defaults.speed);
134
+ $('a',$activeLi).removeClass(defaults.classActive);
135
+ } else {
136
+ $(this).next().slideToggle(defaults.speed);
137
+ $('> a',$activeLi).addClass(defaults.classActive);
138
+ }
139
+
140
+ // Write cookie if save state is on
141
+ if(defaults.saveState == true){
142
+ createCookie();
143
+ }
144
+
145
+ }
146
+
147
+ function linkOut(){
148
+ }
149
+
150
+ function menuOver(){
151
+ }
152
+
153
+ function menuOut(){
154
+ if(defaults.menuClose == true){
155
+ $('ul',$dcAccordionItem).slideUp(defaults.speed);
156
+ // Reset active links
157
+ $('a',$dcAccordionItem).removeClass(defaults.classActive);
158
+ createCookie();
159
+ }
160
+ }
161
+
162
+ // Auto-Close Open Menu Items
163
+ function autoCloseAccordion($parentsLi, $parentsUl){
164
+ $('ul',$dcAccordionItem).not($parentsUl).slideUp(defaults.speed);
165
+ // Reset active links
166
+ $('a',$dcAccordionItem).removeClass(defaults.classActive);
167
+ $('> a',$parentsLi).addClass(defaults.classActive);
168
+ }
169
+
170
+ // Retrieve cookie value and set active items
171
+ function checkCookie(){
172
+ var cookieVal = $.cookie(cookieId);
173
+ if(cookieVal != null){
174
+ // create array from cookie string
175
+ var activeArray = cookieVal.split(',');
176
+ $.each(activeArray, function(index,value){
177
+ var $cookieLi = $('li:eq('+value+')',$dcAccordionItem);
178
+ $('> a',$cookieLi).addClass(defaults.classActive);
179
+ var $parentsLi = $cookieLi.parents('li');
180
+ $('> a',$parentsLi).addClass(defaults.classActive);
181
+ });
182
+ }
183
+ }
184
+
185
+ // Reset accordion using active links
186
+ function resetAccordion(){
187
+ $('ul',$dcAccordionItem).hide();
188
+ $allActiveLi = $('a.'+defaults.classActive,$dcAccordionItem);
189
+ $allActiveLi.next().show();
190
+ }
191
+
192
+ // Write cookie
193
+ function createCookie(){
194
+ var activeIndex = [];
195
+ // Create array of active items index value
196
+ $('li a.active',$dcAccordionItem).each(function(i){
197
+ var $arrayItem = $(this).parent('li');
198
+ var itemIndex = $('li',$dcAccordionItem).index($arrayItem);
199
+ activeIndex.push(itemIndex);
200
+ });
201
+ // Store in cookie
202
+ $.cookie(cookieId, activeIndex, { path: '/' });
203
+ }
204
+ };
205
  })(jQuery);
js/jquery.dcjqaccordion.2.1.js ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * DC jQuery Accordion - jQuery accordion menu widget
3
+ * Copyright (c) 2011 Design Chemical
4
+ *
5
+ * Dual licensed under the MIT and GPL licenses:
6
+ * http://www.opensource.org/licenses/mit-license.php
7
+ * http://www.gnu.org/licenses/gpl.html
8
+ *
9
+ */
10
+ (function($){
11
+
12
+ //define the new for the plugin ans how to call it
13
+
14
+ $.fn.dcAccordion = function(options) {
15
+ //set default options
16
+ var defaults = {
17
+ classParent : 'dcjq-parent',
18
+ classActive : 'active',
19
+ eventType : 'click',
20
+ hoverDelay : 300,
21
+ menuClose : true,
22
+ autoClose : true,
23
+ speed : 'slow',
24
+ saveState : true,
25
+ disableLink : true
26
+ };
27
+
28
+ //call in the default otions
29
+ var options = $.extend(defaults, options);
30
+
31
+ //act upon the element that is passed into the design
32
+ return this.each(function(options){
33
+
34
+ var $dcAccordionItem = this;
35
+ setUpAccordion();
36
+
37
+ if(defaults.saveState == true){
38
+ cookieId = $(this).parent().attr('id');
39
+ checkCookie();
40
+ }
41
+ resetAccordion();
42
+
43
+ if(defaults.eventType == 'hover'){
44
+
45
+ var config = {
46
+ sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
47
+ interval: defaults.hoverDelay, // number = milliseconds for onMouseOver polling interval
48
+ over: linkOver, // function = onMouseOver callback (REQUIRED)
49
+ timeout: defaults.hoverDelay, // number = milliseconds delay before onMouseOut
50
+ out: linkOut // function = onMouseOut callback (REQUIRED)
51
+ };
52
+ $('li a',$dcAccordionItem).hoverIntent(config);
53
+
54
+ var configMenu = {
55
+ sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
56
+ interval: 1000, // number = milliseconds for onMouseOver polling interval
57
+ over: menuOver, // function = onMouseOver callback (REQUIRED)
58
+ timeout: 1000, // number = milliseconds delay before onMouseOut
59
+ out: menuOut // function = onMouseOut callback (REQUIRED)
60
+ };
61
+ $($dcAccordionItem).hoverIntent(configMenu);
62
+
63
+ // Disable parent links
64
+ if(defaults.disableLink == true){
65
+ $('li a',$dcAccordionItem).click(function(e){
66
+ if($(this).next('ul').length >0){
67
+ e.preventDefault();
68
+ }
69
+ });
70
+ }
71
+
72
+ } else {
73
+
74
+ $('li a',$dcAccordionItem).click(function(e){
75
+
76
+ $activeLi = $(this).parent('li');
77
+ $parentsLi = $activeLi.parents('li');
78
+ $parentsUl = $activeLi.parents('ul');
79
+
80
+ // Prevent browsing to link if has child links
81
+ if(defaults.disableLink == true){
82
+ if($(this).next('ul').length >0){
83
+ e.preventDefault();
84
+ }
85
+ }
86
+
87
+ // Auto close sibling menus
88
+ if(defaults.autoClose == true){
89
+ autoCloseAccordion($parentsLi, $parentsUl);
90
+ }
91
+
92
+ if ($('> ul',$activeLi).is(':visible')){
93
+ $('ul',$activeLi).slideUp(defaults.speed);
94
+ $('a',$activeLi).removeClass(defaults.classActive);
95
+ } else {
96
+ $(this).next().slideToggle(defaults.speed);
97
+ $('> a',$activeLi).addClass(defaults.classActive);
98
+ }
99
+
100
+ // Write cookie if save state is on
101
+ if(defaults.saveState == true){
102
+ createCookie();
103
+ }
104
+ });
105
+ }
106
+ // Set up accordion
107
+ function setUpAccordion(){
108
+ $arrow = '<span class="dcjq-icon"></span>';
109
+ $('> ul',$dcAccordionItem).show();
110
+ $('li',$dcAccordionItem).each(function(){
111
+ var classParentLi = defaults.classParent+'-li';
112
+ if($('> ul',this).length > 0){
113
+ $(this).addClass(classParentLi);
114
+ $('> a',this).addClass(defaults.classParent).append($arrow);
115
+ }
116
+ });
117
+ $('> ul',$dcAccordionItem).hide();
118
+ }
119
+
120
+ // Retrieve cookie value and set active items
121
+ function checkCookie(){
122
+ var cookieVal = $.cookie(cookieId);
123
+ if(cookieVal != null){
124
+ // create array from cookie string
125
+ var activeArray = cookieVal.split(',');
126
+ $.each(activeArray, function(index,value){
127
+ var $cookieLi = $('li:eq('+value+')',$dcAccordionItem);
128
+ $('> a',$cookieLi).addClass(defaults.classActive);
129
+ var $parentsLi = $cookieLi.parents('li');
130
+ $('> a',$parentsLi).addClass(defaults.classActive);
131
+ });
132
+ }
133
+ }
134
+
135
+ // Write cookie
136
+ function createCookie(){
137
+ var activeIndex = [];
138
+
139
+ // Create array of active items index value
140
+ $('li a.active',$dcAccordionItem).each(function(i){
141
+ var $arrayItem = $(this).parent('li');
142
+ var itemIndex = $('li',$dcAccordionItem).index($arrayItem);
143
+ activeIndex.push(itemIndex);
144
+ });
145
+ // Store in cookie
146
+ $.cookie(cookieId, activeIndex, { path: '/' });
147
+ }
148
+
149
+ function linkOver(){
150
+
151
+ $activeLi = $(this).parent('li');
152
+ $parentsLi = $activeLi.parents('li');
153
+ $parentsUl = $activeLi.parents('ul');
154
+
155
+ // Auto close sibling menus
156
+ if(defaults.autoClose == true){
157
+ autoCloseAccordion($parentsLi, $parentsUl);
158
+ }
159
+
160
+ if ($('> ul',$activeLi).is(':visible')){
161
+ $('ul',$activeLi).slideUp(defaults.speed);
162
+ $('a',$activeLi).removeClass(defaults.classActive);
163
+ } else {
164
+ $(this).next().slideToggle(defaults.speed);
165
+ $('> a',$activeLi).addClass(defaults.classActive);
166
+ }
167
+
168
+ // Write cookie if save state is on
169
+ if(defaults.saveState == true){
170
+ createCookie();
171
+ }
172
+
173
+ }
174
+
175
+ function linkOut(){
176
+ }
177
+
178
+ function menuOver(){
179
+ }
180
+
181
+ function menuOut(){
182
+ if(defaults.menuClose == true){
183
+ $('ul',$dcAccordionItem).slideUp(defaults.speed);
184
+ // Reset active links
185
+ $('a',$dcAccordionItem).removeClass(defaults.classActive);
186
+ createCookie();
187
+ }
188
+ }
189
+
190
+ // Auto-Close Open Menu Items
191
+ function autoCloseAccordion($parentsLi, $parentsUl){
192
+ $('ul',$dcAccordionItem).not($parentsUl).slideUp(defaults.speed);
193
+ // Reset active links
194
+ $('a',$dcAccordionItem).removeClass(defaults.classActive);
195
+ $('> a',$parentsLi).addClass(defaults.classActive);
196
+ }
197
+
198
+ // Reset accordion using active links
199
+ function resetAccordion(){
200
+ $('ul',$dcAccordionItem).hide();
201
+ $allActiveLi = $('a.'+defaults.classActive,$dcAccordionItem);
202
+ $allActiveLi.next().show();
203
+ }
204
+ });
205
+ };
206
+ })(jQuery);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.designchemical.com
4
  Tags: jquery, dropdown, menu, vertical accordion, animated, css, navigation, widget
5
  Requires at least: 3.0
6
  Tested up to: 3.1
7
- Stable tag: 2.0
8
 
9
  Creates a widget, which allows you to create vertical accordion menus from any Wordpress custom menu using jQuery.
10
 
@@ -53,6 +53,9 @@ Another likely cause is due to other non-functioning plugins, which may have err
53
 
54
  == Changelog ==
55
 
 
 
 
56
  = 2.0 =
57
  * Added : Ability to select either hover or click to activate menu
58
  * Added : Hover delay setting for hover event
4
  Tags: jquery, dropdown, menu, vertical accordion, animated, css, navigation, widget
5
  Requires at least: 3.0
6
  Tested up to: 3.1
7
+ Stable tag: 2.1
8
 
9
  Creates a widget, which allows you to create vertical accordion menus from any Wordpress custom menu using jQuery.
10
 
53
 
54
  == Changelog ==
55
 
56
+ = 2.1 =
57
+ * Edit: Security for dynamic skins
58
+
59
  = 2.0 =
60
  * Added : Ability to select either hover or click to activate menu
61
  * Added : Hover delay setting for hover event
skin.php CHANGED
@@ -3,12 +3,35 @@
3
  header("Content-type: text/css");
4
 
5
  $id = $_GET['widget_id'];
 
6
  $skin = $_GET['skin'];
7
-
 
8
  if(!empty($skin)){
9
  $css = file_get_contents('./skins/' . $skin );
10
  $widget_skin = preg_replace('/%ID%/',$id, $css);
11
  echo $widget_skin;
12
  }
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  ?>
3
  header("Content-type: text/css");
4
 
5
  $id = $_GET['widget_id'];
6
+ $id = clean($id);
7
  $skin = $_GET['skin'];
8
+ $skin = clean($skin);
9
+ $skin .= '.css';
10
  if(!empty($skin)){
11
  $css = file_get_contents('./skins/' . $skin );
12
  $widget_skin = preg_replace('/%ID%/',$id, $css);
13
  echo $widget_skin;
14
  }
15
 
16
+ ?>
17
+ <?php
18
+ function clean($str = '', $html = false) {
19
+ if (empty($str)) return;
20
+
21
+ if (is_array($str)) {
22
+ foreach($str as $key => $value) $str[$key] = clean($value, $html);
23
+ } else {
24
+ if (get_magic_quotes_gpc()) $str = stripslashes($str);
25
+
26
+ if (is_array($html)) $str = strip_tags($str, implode('', $html));
27
+ elseif (preg_match('|<([a-z]+)>|i', $html)) $str = strip_tags($str, $html);
28
+ elseif ($html !== true) $str = strip_tags($str);
29
+
30
+ $str = trim($str);
31
+ $str = str_replace(".", "", $str);
32
+ $str = str_replace("/", "", $str);
33
+ }
34
+
35
+ return $str;
36
+ }
37
  ?>