Dropdown Menu Widget - Version 1.3.5

Version Description

  • Added "Dropdown Multi" widget that allows you to inlude pages, categories and links in one menu.
Download this release

Release Info

Developer mattsay
Plugin Icon wp plugin Dropdown Menu Widget
Version 1.3.5
Comparing to
See all releases

Code changes from version 1.3.4 to 1.3.5

readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://shailan.com/donate
4
  Tags: css, dropdown, menu, widget, pages, categories
5
  Requires at least: 2.8
6
  Tested up to: 2.9.2
7
- Stable tag: 1.3.4
8
 
9
  This widget adds a beatiful vertical/horizontal CSS only dropdown menu of pages OR categories of your blog.
10
 
@@ -48,6 +48,9 @@ You can submit errors and bugs using the [online form](http://shailan.com/contac
48
 
49
  == Changelog ==
50
 
 
 
 
51
  = 1.3.4 =
52
  * Fixed dropdown errors for IE7. Report any bugs with a screenshot please. Thanks.
53
 
4
  Tags: css, dropdown, menu, widget, pages, categories
5
  Requires at least: 2.8
6
  Tested up to: 2.9.2
7
+ Stable tag: 1.3.5
8
 
9
  This widget adds a beatiful vertical/horizontal CSS only dropdown menu of pages OR categories of your blog.
10
 
48
 
49
  == Changelog ==
50
 
51
+ = 1.3.5 =
52
+ * Added "Dropdown Multi" widget that allows you to inlude pages, categories and links in one menu.
53
+
54
  = 1.3.4 =
55
  * Fixed dropdown errors for IE7. Report any bugs with a screenshot please. Thanks.
56
 
shailan-multi-dropdown.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class shailan_MultiDropDown extends WP_Widget {
4
+ /** constructor */
5
+ function shailan_MultiDropDown() {
6
+ $widget_ops = array('classname' => 'shailan-dropdown-menu', 'description' => __( 'Dropdown page & category menu', 'shailan-dropdown-menu' ) );
7
+ $this->WP_Widget('multi-dropdown-menu', __('Dropdown Multi', 'shailan-multi-dropdown'), $widget_ops);
8
+ $this->alt_option_name = 'widget_multi_dropdown';
9
+
10
+ }
11
+
12
+ /** @see WP_Widget::widget */
13
+ function widget($args, $instance) {
14
+ extract( $args );
15
+ $title = apply_filters('widget_title', $instance['title']);
16
+
17
+ $include_pages = (bool) $instance['pages'];
18
+ $include_categories = (bool) $instance['categories'];
19
+ $include_links = (bool) $instance['links'];
20
+
21
+ $exclude = $instance['exclude'];
22
+
23
+ $inline_style = $instance['style'];
24
+
25
+ $home = (bool) $instance['home'];
26
+ $login = (bool) $instance['login'];
27
+ $admin = (bool) $instance['admin'];
28
+
29
+ $vertical = (bool) $instance['vertical'];
30
+
31
+ $align = $instance['align'];
32
+
33
+ $orientation = ($vertical ? 'dropdown-vertical' : 'dropdown-horizontal');
34
+
35
+ ?>
36
+ <?php echo $before_widget; ?>
37
+
38
+ <div id="shailan-dropdown-wrapper-<?php echo $this->number; ?>" style="<?php echo $inline_style; ?>">
39
+ <div
40
+ <?php
41
+ switch($align){
42
+ case 'right':
43
+ echo ' align="right"';
44
+ break;
45
+ case 'center':
46
+ echo ' align="center"';
47
+ break;
48
+
49
+ case 'left':
50
+ default:
51
+
52
+ }
53
+
54
+ ?>
55
+ >
56
+ <table cellpadding="0" cellspacing="0">
57
+ <tr><td>
58
+ <ul class="dropdown <?php echo $orientation; ?>">
59
+
60
+ <?php if($home){ ?>
61
+ <li class="page_item cat-item blogtab <?php if ( is_front_page() && !is_paged() ){ ?>current_page_item current-cat<?php } ?>"><a href="<?php echo get_option('home'); ?>/"><span><?php _e('Home', 'shailan-dropdown-menu'); ?></span></a></li>
62
+ <?php } ?>
63
+
64
+
65
+ <?php if($include_pages){ ?>
66
+
67
+ <?php
68
+ $page_walker = new shailan_PageWalker();
69
+ wp_list_pages(array(
70
+ 'walker'=>$page_walker,
71
+ 'sort_column'=>'menu_order',
72
+ 'depth'=>'4',
73
+ 'title_li'=>'',
74
+ 'exclude'=>$exclude
75
+ )); ?>
76
+
77
+ <?php }; if($include_categories){ ?>
78
+
79
+ <?php
80
+ $cat_walker = new shailan_CategoryWalker();
81
+ wp_list_categories(array(
82
+ 'walker'=>$cat_walker,
83
+ 'order_by'=>'name',
84
+ 'depth'=>'4',
85
+ 'title_li'=>'',
86
+ 'exclude'=>$exclude
87
+ )); ?>
88
+
89
+ <?php }; ?>
90
+
91
+ <?php if($include_links){ ?>
92
+ <li> <a href="#"><span>Links</span></a>
93
+ <ul>
94
+ <?php wp_list_bookmarks('title_li=&category_before=&category_after=&categorize=0'); ?>
95
+ </ul>
96
+ </li>
97
+ <? } ?>
98
+
99
+ <?php if($admin){ wp_register('<li class="admintab">','</li>'); } if($login){ ?><li class="page_item"><?php wp_loginout(); ?><?php } ?>
100
+
101
+ </ul></td>
102
+ </tr></table>
103
+ </div>
104
+ </div>
105
+ <?php echo $after_widget; ?>
106
+ <?php
107
+ }
108
+
109
+ /** @see WP_Widget::update */
110
+ function update($new_instance, $old_instance) {
111
+ return $new_instance;
112
+ }
113
+
114
+ /** @see WP_Widget::form */
115
+ function form($instance) {
116
+
117
+ $title = apply_filters('widget_title', $instance['title']);
118
+
119
+ $include_pages = (bool) $instance['pages'];
120
+ $include_categories = (bool) $instance['categories'];
121
+ $include_links = (bool) $instance['links'];
122
+
123
+ $exclude = $instance['exclude'];
124
+
125
+ $inline_style = $instance['style'];
126
+
127
+ $home = (bool) $instance['home'];
128
+ $login = (bool) $instance['login'];
129
+ $admin = (bool) $instance['admin'];
130
+
131
+ $vertical = (bool) $instance['vertical'];
132
+
133
+ $align = $instance['align'];
134
+
135
+ ?>
136
+ <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title (won\'t be shown):', 'shailan-dropdown-menu'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
137
+
138
+ <p> Includes: <br/>
139
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('pages'); ?>" name="<?php echo $this->get_field_name('pages'); ?>"<?php checked( $include_pages ); ?> />
140
+ <label for="<?php echo $this->get_field_id('pages'); ?>"><?php _e( 'Pages' , 'shailan-dropdown-menu' ); ?></label><br />
141
+
142
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('categories'); ?>" name="<?php echo $this->get_field_name('categories'); ?>"<?php checked( $categories ); ?> />
143
+ <label for="<?php echo $this->get_field_id('categories'); ?>"><?php _e( 'Categories' , 'shailan-dropdown-menu' ); ?></label><br />
144
+
145
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('links'); ?>" name="<?php echo $this->get_field_name('links'); ?>"<?php checked( $links ); ?> />
146
+ <label for="<?php echo $this->get_field_id('links'); ?>"><?php _e( 'Links' , 'shailan-dropdown-menu' ); ?></label><br />
147
+
148
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('home'); ?>" name="<?php echo $this->get_field_name('home'); ?>"<?php checked( $home ); ?> />
149
+ <label for="<?php echo $this->get_field_id('home'); ?>"><?php _e( 'Homepage link' , 'shailan-dropdown-menu' ); ?></label><br />
150
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('login'); ?>" name="<?php echo $this->get_field_name('login'); ?>"<?php checked( $login ); ?> />
151
+ <label for="<?php echo $this->get_field_id('login'); ?>"><?php _e( 'Login/logout' , 'shailan-dropdown-menu' ); ?></label><br />
152
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('admin'); ?>" name="<?php echo $this->get_field_name('admin'); ?>"<?php checked( $admin ); ?> />
153
+ <label for="<?php echo $this->get_field_id('admin'); ?>"><?php _e( 'Register/Site Admin' , 'shailan-dropdown-menu' ); ?></label>
154
+ </p>
155
+
156
+ <p><label for="<?php echo $this->get_field_id('exclude'); ?>"><?php _e('Exclude:', 'shailan-dropdown-menu'); ?> <input class="widefat" id="<?php echo $this->get_field_id('exclude'); ?>" name="<?php echo $this->get_field_name('exclude'); ?>" type="text" value="<?php echo $exclude; ?>" /></label><br />
157
+ <small>Page IDs, separated by commas.</small></p>
158
+
159
+ <p>
160
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('vertical'); ?>" name="<?php echo $this->get_field_name('vertical'); ?>"<?php checked( $vertical ); ?> />
161
+ <label for="<?php echo $this->get_field_id('vertical'); ?>"><?php _e( 'Vertical menu' , 'shailan-dropdown-menu' ); ?></label>
162
+ </p>
163
+
164
+ <p><?php _e('Align:', 'shailan-dropdown-menu'); ?> <label for="left"><input type="radio" id="left" name="<?php echo $this->get_field_name('align'); ?>" value="left" <?php if($align=='left'){ echo 'checked="checked"'; } ?> /> <?php _e('Left', 'shailan-dropdown-menu'); ?></label> <label for="center"><input type="radio" id="center" name="<?php echo $this->get_field_name('align'); ?>" value="center" <?php if($align=='center'){ echo 'checked="checked"'; } ?>/> <?php _e('Center', 'shailan-dropdown-menu'); ?></label> <label for="right"><input type="radio" id="right" name="<?php echo $this->get_field_name('align'); ?>" value="right" <?php if($align=='right'){ echo 'checked="checked"'; } ?>/> <?php _e('Right', 'shailan-dropdown-menu'); ?></label></p>
165
+
166
+ <p><label for="<?php echo $this->get_field_id('style'); ?>"><?php _e('Inline Style:', 'shailan-dropdown-menu'); ?> <input class="widefat" id="<?php echo $this->get_field_id('style'); ?>" name="<?php echo $this->get_field_name('style'); ?>" type="text" value="<?php echo $inline_style; ?>" /></label><br />
167
+ <small><?php _e('Applied to menu container &lt;div&gt;.', 'shailan-dropdown-menu'); ?></small></p>
168
+
169
+ <div class="widget-control-actions alignright">
170
+ <p><small><a href="options-general.php?page=dropdown-menu"><?php esc_attr_e('Menu Style', 'shailan-dropdown-menu'); ?></a> | <a href="http://shailan.com/wordpress/plugins/dropdown-menu"><?php esc_attr_e('Visit plugin site', 'shailan-dropdown-menu'); ?></a></small></p>
171
+ </div>
172
+
173
+ <?php
174
+ }
175
+
176
+ } // class shailan_MultiDropDown
177
+
178
+ // register widget
179
+ add_action('widgets_init', create_function('', 'return register_widget("shailan_MultiDropDown");'));
shailan.DropDownMenu.php CHANGED
@@ -3,13 +3,13 @@
3
  Plugin Name: Shailan Dropdown Menu Widget
4
  Plugin URI: http://shailan.com/wordpress/plugins/dropdown-menu
5
  Description: A multi widget to generate drop-down menus from your pages and categories. This widget is best used in <a href="http://shailan.com">Shailan.com</a> themes. You can find more widgets, plugins and themes at <a href="http://shailan.com">shailan.com</a>.
6
- Version: 1.3.4
7
  Author: Matt Say
8
  Author URI: http://shailan.com
9
  Text Domain: shailan-dropdown-menu
10
  */
11
 
12
- define('SHAILAN_DM_VERSION','1.3.4');
13
  define('SHAILAN_DM_TITLE', 'Dropdown Menu');
14
  define('SHAILAN_DM_FOLDER', 'dropdown-menu-widget');
15
 
@@ -27,7 +27,6 @@ class shailan_DropdownWidget extends WP_Widget {
27
  // @shailan: disabled for the_widget support.
28
  add_action( 'wp_head', array(&$this, 'styles') );
29
 
30
- wp_enqueue_script( 'dropdown-ie-support', WP_PLUGIN_URL . '/' . SHAILAN_DM_FOLDER . '/include.js', 'jQuery' );
31
  }
32
 
33
  // Add settings page
@@ -182,7 +181,7 @@ Please support if you like this plugin:
182
  <p><?php _e('Visit <a href="http://shailan.com">shailan.com</a> for more wordpress themes, plugins and widgets.', 'shailan-dropdown-menu'); ?></p>
183
  </form>
184
  <p>
185
- <a href="http://shailan.com/wordpress/plugins/dropdown-menu">Dropdown Menu <?php echo SHAILAN_DM_VERSION; ?></a> by <a href="http://shailan.com">shailan</a></a> &copy; 2009
186
  </p>
187
  </div> <?php
188
 
@@ -321,11 +320,11 @@ Please support if you like this plugin:
321
  }
322
 
323
  function styles($instance){
 
324
  $theme = get_option('theme');
325
 
326
  echo '<link rel="stylesheet" href="'.WP_PLUGIN_URL.'/'.SHAILAN_DM_FOLDER.'/shailan-dropdown.css" type="text/css" />';
327
 
328
-
329
  if($theme!='NONE'){
330
  echo '<link rel="stylesheet" href="'.WP_PLUGIN_URL.'/'.SHAILAN_DM_FOLDER.'/themes/'.$theme.'.css" type="text/css" />';
331
  }
@@ -357,9 +356,19 @@ load_plugin_textdomain( 'shailan-dropdown-menu', 'wp-content/plugins/' . $plugin
357
  // add admin menu
358
  add_action('admin_menu', array('shailan_DropdownWidget', 'adminMenu'));
359
 
360
- include_once('simon-exclude-pages.php');
361
- include('shailan-page-walker.php'); // Load custom page walker
362
- include('shailan-category-walker.php'); // Load custom category walker
 
 
 
 
 
 
 
 
 
 
363
 
364
  // template tag support
365
  function shailan_dropdown_menu(){
3
  Plugin Name: Shailan Dropdown Menu Widget
4
  Plugin URI: http://shailan.com/wordpress/plugins/dropdown-menu
5
  Description: A multi widget to generate drop-down menus from your pages and categories. This widget is best used in <a href="http://shailan.com">Shailan.com</a> themes. You can find more widgets, plugins and themes at <a href="http://shailan.com">shailan.com</a>.
6
+ Version: 1.3.5
7
  Author: Matt Say
8
  Author URI: http://shailan.com
9
  Text Domain: shailan-dropdown-menu
10
  */
11
 
12
+ define('SHAILAN_DM_VERSION','1.3.5');
13
  define('SHAILAN_DM_TITLE', 'Dropdown Menu');
14
  define('SHAILAN_DM_FOLDER', 'dropdown-menu-widget');
15
 
27
  // @shailan: disabled for the_widget support.
28
  add_action( 'wp_head', array(&$this, 'styles') );
29
 
 
30
  }
31
 
32
  // Add settings page
181
  <p><?php _e('Visit <a href="http://shailan.com">shailan.com</a> for more wordpress themes, plugins and widgets.', 'shailan-dropdown-menu'); ?></p>
182
  </form>
183
  <p>
184
+ <a href="http://shailan.com/wordpress/plugins/dropdown-menu">Dropdown Menu <?php echo SHAILAN_DM_VERSION; ?></a> by <a href="http://shailan.com">shailan</a></a> &copy; 2010
185
  </p>
186
  </div> <?php
187
 
320
  }
321
 
322
  function styles($instance){
323
+
324
  $theme = get_option('theme');
325
 
326
  echo '<link rel="stylesheet" href="'.WP_PLUGIN_URL.'/'.SHAILAN_DM_FOLDER.'/shailan-dropdown.css" type="text/css" />';
327
 
 
328
  if($theme!='NONE'){
329
  echo '<link rel="stylesheet" href="'.WP_PLUGIN_URL.'/'.SHAILAN_DM_FOLDER.'/themes/'.$theme.'.css" type="text/css" />';
330
  }
356
  // add admin menu
357
  add_action('admin_menu', array('shailan_DropdownWidget', 'adminMenu'));
358
 
359
+ wp_enqueue_script( 'dropdown-ie-support', WP_PLUGIN_URL . '/' . SHAILAN_DM_FOLDER . '/include.js', 'jQuery' );
360
+
361
+ /* Includes */
362
+
363
+ include_once('simon-exclude-pages.php'); // Exclude page plugin
364
+ include('shailan-page-walker.php'); // Load custom page walker
365
+ include('shailan-category-walker.php'); // Load custom category walker
366
+
367
+ /* Custom widget */
368
+
369
+ include('shailan-multi-dropdown.php'); // Load multi-dropdown widget
370
+
371
+
372
 
373
  // template tag support
374
  function shailan_dropdown_menu(){
simon-exclude-pages.php CHANGED
@@ -301,12 +301,16 @@ function sdep_admin_init()
301
  {
302
  // Add panels into the editing sidebar(s)
303
  global $wp_version;
304
- if ( version_compare( $wp_version, '2.7-beta', '>=' ) ) {
 
305
  add_meta_box('sdep_admin_meta_box', __('Exclude Pages'), 'sdep_admin_sidebar_wp25', 'page', 'side', 'low');
306
  } else {
307
  add_action('dbx_page_sidebar', 'sdep_admin_sidebar'); // Pre WP2.5
308
  add_action('submitpage_box', 'sdep_admin_sidebar_wp25'); // Post WP 2.5, pre WP 2.7
309
  }
 
 
 
310
 
311
  // Set the exclusion when the post is saved
312
  add_action('save_post', 'sdep_update_exclusions');
301
  {
302
  // Add panels into the editing sidebar(s)
303
  global $wp_version;
304
+ if (version_compare( $wp_version, '2.7-beta', '>=' ) ) {
305
+ // add_meta_box( $id, $title, $callback, $page, $context, $priority );
306
  add_meta_box('sdep_admin_meta_box', __('Exclude Pages'), 'sdep_admin_sidebar_wp25', 'page', 'side', 'low');
307
  } else {
308
  add_action('dbx_page_sidebar', 'sdep_admin_sidebar'); // Pre WP2.5
309
  add_action('submitpage_box', 'sdep_admin_sidebar_wp25'); // Post WP 2.5, pre WP 2.7
310
  }
311
+
312
+ do_meta_boxes('dropdown-menu-widget','advanced',null);
313
+
314
 
315
  // Set the exclusion when the post is saved
316
  add_action('save_post', 'sdep_update_exclusions');