Dropdown Menu Widget - Version 1.6.1

Version Description

  • Fix: Colorscheme background error.
  • Fix: jQuery not included when effects are enabled.
  • Added: Disabling options that are not used.
  • Added: Custom Theme URL option.
Download this release

Release Info

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

Code changes from version 1.6 to 1.6.1

Files changed (5) hide show
  1. css/admin.css +11 -0
  2. js/admin.js +42 -0
  3. options-page.php +16 -3
  4. readme.txt +7 -1
  5. shailan.DropDownMenu.php +89 -45
css/admin.css CHANGED
@@ -1,6 +1,7 @@
1
  /** Dropdown Menu Widget Admin Styles */
2
  .shailan_dm_input{padding:10px;}
3
  .shailan_dm_input.shailan_dm_paragraph{ background: #ddd; padding:10px; }
 
4
  .shailan_dm_paragraph p{ margin:0; line-height:1.5em; }
5
  .shailan_dm_input small{font-style:italic; font-size:smaller; color:#666;}
6
  .shailan_dm_input label{ font-size:12px;
@@ -31,3 +32,13 @@ input.color-error{border:1px solid #f00;}
31
 
32
  #widgets-right .shailan-dropdown, #widgets-left .shailan-dropdown .widget-top{ border-color: #F90; }
33
  #widgets-right .shailan-dropdown-multi, #widgets-left .shailan-dropdown-multi .widget-top{ border-color: #F90; }
 
 
 
 
 
 
 
 
 
 
1
  /** Dropdown Menu Widget Admin Styles */
2
  .shailan_dm_input{padding:10px;}
3
  .shailan_dm_input.shailan_dm_paragraph{ background: #ddd; padding:10px; }
4
+ .shailan_dm_input.shailan_dm_splitter{ border-top:1px solid #ddd; font-size:1px; line-height:1px; height:1px; margin-top:12px; margin-bottom:12px; padding:0; }
5
  .shailan_dm_paragraph p{ margin:0; line-height:1.5em; }
6
  .shailan_dm_input small{font-style:italic; font-size:smaller; color:#666;}
7
  .shailan_dm_input label{ font-size:12px;
32
 
33
  #widgets-right .shailan-dropdown, #widgets-left .shailan-dropdown .widget-top{ border-color: #F90; }
34
  #widgets-right .shailan-dropdown-multi, #widgets-left .shailan-dropdown-multi .widget-top{ border-color: #F90; }
35
+
36
+ .ads{
37
+ background-color: #F1F1F1;
38
+ border: 1px solid #DDDDDD;
39
+ padding: 10px;
40
+ text-align:center;
41
+ border-radius: 8px 8px;
42
+ -moz-border-radius: 8px 8px;
43
+ -webkit-border-radius: 8px 8px;
44
+ }
js/admin.js CHANGED
@@ -5,7 +5,45 @@ function pickColor(obj, color) {
5
  jQuery("#" + obj).val(color);
6
  }
7
 
 
 
 
 
 
 
 
 
8
  jQuery(document).ready(function() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  var f = jQuery.farbtastic('#picker');
11
  var p = jQuery('#picker').fadeOut();
@@ -56,4 +94,8 @@ jQuery(document).ready(function() {
56
  jQuery(this).fadeOut(10);
57
  });
58
  });
 
 
 
 
59
  });
5
  jQuery("#" + obj).val(color);
6
  }
7
 
8
+ jQuery.fn.enable = function(){
9
+ return jQuery(this).removeAttr('disabled');
10
+ }
11
+
12
+ jQuery.fn.disable = function(){
13
+ return jQuery(this).attr('disabled', 'disabled');
14
+ }
15
+
16
  jQuery(document).ready(function() {
17
+
18
+ /*if(jQuery('#shailan_dm_active_theme').val() == '*url*'){
19
+ jQuery('#shailan_dm_theme_url').enable();
20
+ } else {
21
+ jQuery('#shailan_dm_theme_url').disable();
22
+ }*/
23
+
24
+ function shailan_dm_active_theme_change(){
25
+ if(jQuery('#shailan_dm_active_theme').val() == '*url*'){
26
+ jQuery('#shailan_dm_theme_url').enable();
27
+ } else {
28
+ jQuery('#shailan_dm_theme_url').disable();
29
+ }
30
+ }
31
+
32
+ jQuery('#shailan_dm_active_theme').change(function(){ shailan_dm_active_theme_change() });
33
+ shailan_dm_active_theme_change();
34
+
35
+ function shailan_dm_effects_change(){
36
+ if(jQuery('#shailan_dm_effects').attr('checked') == true){
37
+ jQuery('#shailan_dm_effect').enable();
38
+ jQuery('#shailan_dm_effect_speed').enable();
39
+ } else {
40
+ jQuery('#shailan_dm_effect').disable();
41
+ jQuery('#shailan_dm_effect_speed').disable();
42
+ }
43
+ }
44
+
45
+ jQuery('#shailan_dm_effects').change(function(){ shailan_dm_effects_change() });
46
+ shailan_dm_effects_change();
47
 
48
  var f = jQuery.farbtastic('#picker');
49
  var p = jQuery('#picker').fadeOut();
94
  jQuery(this).fadeOut(10);
95
  });
96
  });
97
+
98
+
99
+
100
+
101
  });
options-page.php CHANGED
@@ -4,8 +4,8 @@ global $pluginname, $pluginoptions;
4
 
5
  $i=0;
6
 
7
- //if ( @$_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$pluginname.' settings saved.</strong></p></div>';
8
- //if ( @$_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$pluginname.' settings reset.</strong></p></div>';
9
 
10
  ?>
11
 
@@ -63,6 +63,11 @@ case "paragraph":
63
 
64
  <?php break;
65
 
 
 
 
 
 
66
  case 'picker':
67
  ?>
68
  <div id="picker"></div>
@@ -150,6 +155,14 @@ $i++;
150
  <div class="widget-liquid-right">
151
  <div id="widgets-right">
152
 
 
 
 
 
 
 
 
 
153
  <div class="widgets-holder-wrap">
154
  <div class="sidebar-name">
155
  <div class="sidebar-name-arrow"><br /></div>
@@ -216,7 +229,7 @@ tweetmeme_url = 'http://shailan.com/wordpress/plugins/dropdown-menu/'; tweetmeme
216
  </script><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></li> -->
217
  </ul>
218
 
219
- <p>You can also donate a few bugs using the button below: <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
220
  <input type="hidden" name="cmd" value="_s-xclick">
221
  <input type="hidden" name="hosted_button_id" value="8F7M79S2PBU3G">
222
  <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
4
 
5
  $i=0;
6
 
7
+ if ( @$_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$pluginname.' settings saved.</strong></p></div>';
8
+ if ( @$_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$pluginname.' settings reset.</strong></p></div>';
9
 
10
  ?>
11
 
63
 
64
  <?php break;
65
 
66
+ case "splitter":
67
+ ?>
68
+ <div class="shailan_dm_input shailan_dm_splitter"></div>
69
+ <?php break;
70
+
71
  case 'picker':
72
  ?>
73
  <div id="picker"></div>
155
  <div class="widget-liquid-right">
156
  <div id="widgets-right">
157
 
158
+ <!--
159
+ <div class="ads">
160
+ <div class="ad">
161
+ <span><a href="http://shailan.com/contact">Advertise here</a></span>
162
+ </div>
163
+ </div>
164
+ -->
165
+
166
  <div class="widgets-holder-wrap">
167
  <div class="sidebar-name">
168
  <div class="sidebar-name-arrow"><br /></div>
229
  </script><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></li> -->
230
  </ul>
231
 
232
+ <p>You can also buy me a coffee here: <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
233
  <input type="hidden" name="cmd" value="_s-xclick">
234
  <input type="hidden" name="hosted_button_id" value="8F7M79S2PBU3G">
235
  <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://shailan.com/donate
4
  Tags: css, dropdown, menu, widget, pages, categories, multi, jquery, navigation, category list, themes, custom-styles, options-page, animations, effects
5
  Requires at least: 2.8
6
  Tested up to: 3.1
7
- Stable tag: 1.6
8
 
9
  This widget adds a beatiful vertical/horizontal CSS only dropdown menu of Pages, Categories or Custom navigation menus of your blog.
10
 
@@ -47,6 +47,12 @@ You can submit errors and bugs using the [online form](http://shailan.com/contac
47
 
48
  == Changelog ==
49
 
 
 
 
 
 
 
50
  = 1.6 =
51
  * Added option to show title on widget.
52
  * Added capability to find dropdown.css on your theme folder.
4
  Tags: css, dropdown, menu, widget, pages, categories, multi, jquery, navigation, category list, themes, custom-styles, options-page, animations, effects
5
  Requires at least: 2.8
6
  Tested up to: 3.1
7
+ Stable tag: 1.6.1
8
 
9
  This widget adds a beatiful vertical/horizontal CSS only dropdown menu of Pages, Categories or Custom navigation menus of your blog.
10
 
47
 
48
  == Changelog ==
49
 
50
+ = 1.6.1 =
51
+ * Fix: Colorscheme background error.
52
+ * Fix: jQuery not included when effects are enabled.
53
+ * Added: Disabling options that are not used.
54
+ * Added: Custom Theme URL option.
55
+
56
  = 1.6 =
57
  * Added option to show title on widget.
58
  * Added capability to find dropdown.css on your theme folder.
shailan.DropDownMenu.php CHANGED
@@ -4,22 +4,23 @@ Plugin Name: 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, categories & navigation menus. You can find more widgets, plugins and themes at <a href="http://shailan.com">shailan.com</a>.
6
  Tags: dropdown, menu, css, css-dropdown, navigation, widget, dropdown-menu, customization, theme
7
- Version: 1.6
8
  Author: Matt Say
9
  Author URI: http://shailan.com
10
  Text Domain: shailan-dropdown-menu
11
  */
12
 
13
- define('SHAILAN_DM_VERSION','1.6');
14
  define('SHAILAN_DM_TITLE', 'Dropdown Menu');
15
  define('SHAILAN_DM_FOLDER', 'dropdown-menu-widget');
16
 
17
- /**
18
- * Shailan Dropdown Widget Class
19
- */
 
20
  class shailan_DropdownWidget extends WP_Widget {
21
- /** constructor */
22
- function shailan_DropdownWidget() {
23
  global $pluginname, $pluginshortname, $pluginoptions;
24
 
25
  $widget_ops = array('classname' => 'shailan-dropdown-menu', 'description' => __( 'Dropdown page/category menu', 'shailan-dropdown-menu' ) );
@@ -33,13 +34,18 @@ class shailan_DropdownWidget extends WP_Widget {
33
  add_action( 'wp_head', array(&$this, 'header') );
34
  add_action( 'wp_footer', array(&$this, 'footer'), 10, 1 );
35
 
36
- if(!is_admin()){ wp_enqueue_script( 'dropdown-ie-support', WP_PLUGIN_URL . '/' . SHAILAN_DM_FOLDER . '/js/include.js', array('jquery') ); }
 
 
 
 
37
 
38
  // Define themes
39
  $available_themes = array(
40
  'None' => '*none*',
 
41
  'Custom CSS' => '*custom*',
42
- 'Color Scheme' => plugins_url('/themes/color-scheme.css', __FILE__),
43
  'Simple White' => plugins_url('/themes/simple.css', __FILE__),
44
  'Wordpress Default' => plugins_url('/themes/wpdefault.css', __FILE__),
45
  'Grayscale' => plugins_url('/themes/grayscale.css', __FILE__),
@@ -58,6 +64,8 @@ class shailan_DropdownWidget extends WP_Widget {
58
  $available_themes['Dropdown.css (theme)'] = get_template_directory_uri() . '/dropdown.css';
59
  }
60
 
 
 
61
  // Swap array for options page
62
  $themes = array();
63
  while(list($Key,$Val) = each($available_themes))
@@ -73,7 +81,7 @@ class shailan_DropdownWidget extends WP_Widget {
73
 
74
  $alignment = array('left'=>'left', 'center' => 'center', 'right'=> 'right');
75
  $types = array('pages'=>'Pages', 'categories'=>'Categories');
76
- $effects = array('fade'=>'Fade In/Out', 'slide'=>'Slide Up/Down');
77
  $speed = array('400'=>'Normal', 'fast'=>'Fast', 'slow'=>'Slow');
78
 
79
  if(function_exists('wp_nav_menu')){
@@ -92,12 +100,6 @@ class shailan_DropdownWidget extends WP_Widget {
92
 
93
  $this->menu_types = $types; // Back it up
94
 
95
- // Option names
96
- $vertical_tag = 'shailan_dm_vertical';
97
- $width_tag = 'shailan_dm_width';
98
- $custom_walkers_tag = 'shailan_dm_customwalkers';
99
- $allow_multiline_tag = 'shailan_dm_allowmultiline';
100
-
101
  // Define plugin options
102
  $this->admin_options = array(
103
 
@@ -113,12 +115,20 @@ class shailan_DropdownWidget extends WP_Widget {
113
  "options" => $themes,
114
  "type" => "select"),
115
 
 
 
 
 
 
 
116
  array( "name" => "Rename Homepage",
117
  "desc" => "You can change your homepage link here",
118
  "id" => "shailan_dm_home_tag",
119
  "std" => __("Home"),
120
  "type" => "text"),
121
 
 
 
122
  array( "name" => "Enable dropdown effects",
123
  "desc" => "If checked sub menus will use effects below",
124
  "id" => "shailan_dm_effects",
@@ -136,6 +146,8 @@ class shailan_DropdownWidget extends WP_Widget {
136
  "type" => "select",
137
  "options" => $speed ),
138
 
 
 
139
  array( "name" => "Wrap long menu items",
140
  "desc" => "If checked long menu items will wrap",
141
  "id" => "shailan_dm_allowmultiline",
@@ -307,15 +319,15 @@ class shailan_DropdownWidget extends WP_Widget {
307
 
308
  /** Unused options */
309
  update_option('shailan_dm_customwalkers', false);
310
-
311
- }
312
 
313
- // Add settings page
 
 
314
  function adminMenu(){
315
  global $pluginname, $pluginshortname, $pluginoptions;
316
 
317
  if(is_admin()){
318
-
319
  // Styles
320
  wp_admin_css( 'widgets' );
321
  wp_enqueue_style( 'dropdownMenuStyles', WP_PLUGIN_URL . '/' . SHAILAN_DM_FOLDER . '/css/admin.css' );
@@ -323,7 +335,6 @@ class shailan_DropdownWidget extends WP_Widget {
323
  // Scripts
324
  wp_enqueue_script( 'admin-widgets' );
325
  wp_enqueue_script( 'dropdown-widgets', WP_PLUGIN_URL . '/' . SHAILAN_DM_FOLDER . '/js/widgets.js', array('jquery') );
326
-
327
  };
328
 
329
  if ( isset($_GET['page']) && $_GET['page'] == 'dropdown-menu' ) {
@@ -360,7 +371,9 @@ class shailan_DropdownWidget extends WP_Widget {
360
  include_once('options-page.php');
361
  }
362
 
363
- /** @see WP_Widget::widget */
 
 
364
  function widget($args, $instance) {
365
  extract( $args );
366
  $widget_options = wp_parse_args( $instance, $this->defaults );
@@ -506,11 +519,14 @@ class shailan_DropdownWidget extends WP_Widget {
506
  <?php echo $after_widget; ?>
507
  <?php
508
  }
509
-
510
  function update($new_instance, $old_instance) {
511
  return $new_instance;
512
  }
513
-
 
 
 
514
  function form($instance) {
515
  $widget_options = wp_parse_args( $instance, $this->defaults );
516
  extract( $widget_options, EXTR_SKIP );
@@ -559,11 +575,18 @@ class shailan_DropdownWidget extends WP_Widget {
559
  <?php
560
  }
561
 
 
 
 
562
  function header($instance){
563
  global $pluginname, $pluginshortname, $pluginoptions;
564
  if(!is_admin()){
 
565
  $theme = get_option('shailan_dm_active_theme');
 
 
566
  $allow_multiline = (bool) get_option('shailan_dm_allowmultiline');
 
567
  // Colors
568
  $custom_colors = (bool) get_option('shailan_dm_custom_colors');
569
  $shailan_dm_color_menubg = get_option('shailan_dm_color_menubg');
@@ -576,10 +599,14 @@ class shailan_DropdownWidget extends WP_Widget {
576
  echo "\n\n<!-- Dropdown Menu Widget Styles by shailan (http://shailan.com) v".SHAILAN_DM_VERSION." on wp".get_bloginfo( 'version' )." -->"; // For debug
577
  echo "\n<link rel=\"stylesheet\" href=\"".WP_PLUGIN_URL."/".SHAILAN_DM_FOLDER."/css/shailan-dropdown.css\" type=\"text/css\" />";
578
 
579
- if( $theme!='NONE' && $theme != 'custom' ){
 
 
580
  if( false === strpos($theme, 'http') ){
 
581
  echo "\n<link rel=\"stylesheet\" href=\"". plugins_url( '/themes/' . $theme . '.css', __FILE__)."\" type=\"text/css\" />";
582
  } else {
 
583
  echo "\n<link rel=\"stylesheet\" href=\"".$theme."\" type=\"text/css\" />";
584
  }
585
  }
@@ -636,12 +663,14 @@ class shailan_DropdownWidget extends WP_Widget {
636
  <?php } elseif($overlay == 'none') { ?>
637
  /* Clear background images */
638
  .shailan-dropdown-menu .dropdown-horizontal-container, ul.dropdown li, ul.dropdown li.hover, ul.dropdown li:hover, ul.dropdown li.hover a, ul.dropdown li:hover a { background-image:none; }
639
- <?php } else {/* unidentified overlay */} ?>
640
 
641
  .shailan-dropdown-menu .dropdown-horizontal-container, ul.dropdown li{ background-color:<?php echo $shailan_dm_color_menubg; ?>; }
642
  ul.dropdown a:link,
643
- ul.dropdown a:visited { color: <?php echo $shailan_dm_color_link; ?>; }
644
- ul.dropdown a:hover { color: <?php echo $shailan_dm_color_hoverlink; ?>; }
 
 
645
  ul.dropdown a:active { color: <?php echo $shailan_dm_color_hoverlink; ?>; }
646
 
647
  ul.dropdown li.hover a, ul.dropdown li:hover a{ background-color: <?php echo $shailan_dm_color_lihover; ?>; }
@@ -678,7 +707,9 @@ class shailan_DropdownWidget extends WP_Widget {
678
  }
679
  } // -- End Header
680
 
681
- // Footer scripts
 
 
682
  function footer($instance){
683
  $indent = "\n\t";
684
 
@@ -694,24 +725,21 @@ class shailan_DropdownWidget extends WP_Widget {
694
  echo "\n<script type=\"text/javascript\">/* <![CDATA[ */";
695
  echo "\njQuery(document).ready(function(){ \n";
696
 
697
- // Remove title attributes from categories
698
-
699
  if($remove_title_attributes){
700
  ?>
701
  jQuery('ul.dropdown li a').removeAttr('title');
702
  <?php
703
  }
704
 
705
- // Remove links from top-level menus
706
-
707
  if($remove_top_level_links){
708
  ?>
709
  jQuery('ul.children').parent().find('a:first').removeAttr('href');
710
  <?php
711
  }
712
 
713
- // Enable effects
714
-
715
  if( 'fade' == $effect ){
716
  ?>
717
  jQuery(".dropdown li").hover(function(){
@@ -728,34 +756,50 @@ class shailan_DropdownWidget extends WP_Widget {
728
  function(){
729
  jQuery(this).find("ul:first").slideUp('<?php echo $speed; ?>');
730
  });
731
- <?php }
 
 
 
 
 
 
 
 
 
 
 
 
 
732
  echo "\n});";
733
  echo "\n/* ]]> */</script>";
734
  echo "\n<!-- /Dropdown Menu Widget Styles -->";
735
  echo "\n\n ";
736
- }
 
 
737
  }
738
 
739
- } // class shailan_DropdownWidget
 
740
 
741
- // register widget
742
  add_action('widgets_init', create_function('', 'return register_widget("shailan_DropdownWidget");'));
743
 
744
- // load translations
745
  $plugin_dir = basename(dirname(__FILE__));
746
  load_plugin_textdomain( 'shailan-dropdown-menu', false, $plugin_dir . '/lang');
747
 
748
- // add admin menu
749
  add_action('admin_menu', array('shailan_DropdownWidget', 'adminMenu'));
750
 
751
  /* Includes */
752
- include('shailan-page-walker.php'); // Load custom page walker
753
- include('shailan-category-walker.php'); // Load custom category walker
754
 
755
  /* Custom widget */
756
- include('shailan-multi-dropdown.php'); // Load multi-dropdown widget
757
 
758
- // template tag support
759
  function shailan_dropdown_menu( $args = array() ){
760
  $type = get_option('shailan_dm_type');
761
  $exclude = get_option('shailan_dm_exclude');
4
  Plugin URI: http://shailan.com/wordpress/plugins/dropdown-menu
5
  Description: A multi widget to generate drop-down menus from your pages, categories & navigation menus. You can find more widgets, plugins and themes at <a href="http://shailan.com">shailan.com</a>.
6
  Tags: dropdown, menu, css, css-dropdown, navigation, widget, dropdown-menu, customization, theme
7
+ Version: 1.6.1
8
  Author: Matt Say
9
  Author URI: http://shailan.com
10
  Text Domain: shailan-dropdown-menu
11
  */
12
 
13
+ define('SHAILAN_DM_VERSION','1.6.1');
14
  define('SHAILAN_DM_TITLE', 'Dropdown Menu');
15
  define('SHAILAN_DM_FOLDER', 'dropdown-menu-widget');
16
 
17
+ /******************************************************************************
18
+ * Shailan Dropdown Widget Class
19
+ ******************************************************************************/
20
+
21
  class shailan_DropdownWidget extends WP_Widget {
22
+
23
+ function shailan_DropdownWidget(){
24
  global $pluginname, $pluginshortname, $pluginoptions;
25
 
26
  $widget_ops = array('classname' => 'shailan-dropdown-menu', 'description' => __( 'Dropdown page/category menu', 'shailan-dropdown-menu' ) );
34
  add_action( 'wp_head', array(&$this, 'header') );
35
  add_action( 'wp_footer', array(&$this, 'footer'), 10, 1 );
36
 
37
+ // Hook up scripts
38
+ if(!is_admin()){
39
+ wp_enqueue_script( 'jquery' );
40
+ wp_enqueue_script( 'dropdown-ie-support', WP_PLUGIN_URL . '/' . SHAILAN_DM_FOLDER . '/js/include.js', array('jquery') );
41
+ }
42
 
43
  // Define themes
44
  $available_themes = array(
45
  'None' => '*none*',
46
+ 'From URL' => '*url*',
47
  'Custom CSS' => '*custom*',
48
+ 'Color Scheme' => 'color-scheme',
49
  'Simple White' => plugins_url('/themes/simple.css', __FILE__),
50
  'Wordpress Default' => plugins_url('/themes/wpdefault.css', __FILE__),
51
  'Grayscale' => plugins_url('/themes/grayscale.css', __FILE__),
64
  $available_themes['Dropdown.css (theme)'] = get_template_directory_uri() . '/dropdown.css';
65
  }
66
 
67
+ // ksort($available_themes);
68
+
69
  // Swap array for options page
70
  $themes = array();
71
  while(list($Key,$Val) = each($available_themes))
81
 
82
  $alignment = array('left'=>'left', 'center' => 'center', 'right'=> 'right');
83
  $types = array('pages'=>'Pages', 'categories'=>'Categories');
84
+ $effects = array('fade'=>'Fade In/Out', 'slide'=>'Slide Up/Down'/*, 'fade2'=>'Fade In/Out Moving Up'*/);
85
  $speed = array('400'=>'Normal', 'fast'=>'Fast', 'slow'=>'Slow');
86
 
87
  if(function_exists('wp_nav_menu')){
100
 
101
  $this->menu_types = $types; // Back it up
102
 
 
 
 
 
 
 
103
  // Define plugin options
104
  $this->admin_options = array(
105
 
115
  "options" => $themes,
116
  "type" => "select"),
117
 
118
+ array( "name" => "Theme URL",
119
+ "desc" => "If From URL is selected you can specify theme URL here. <br />Warning : Please make sure this file only modifies dropdown theme. Otherwise your theme may be affected by this css file.",
120
+ "id" => "shailan_dm_theme_url",
121
+ "std" => "http://",
122
+ "type" => "text"),
123
+
124
  array( "name" => "Rename Homepage",
125
  "desc" => "You can change your homepage link here",
126
  "id" => "shailan_dm_home_tag",
127
  "std" => __("Home"),
128
  "type" => "text"),
129
 
130
+ array("type" => "splitter"),
131
+
132
  array( "name" => "Enable dropdown effects",
133
  "desc" => "If checked sub menus will use effects below",
134
  "id" => "shailan_dm_effects",
146
  "type" => "select",
147
  "options" => $speed ),
148
 
149
+ array("type" => "splitter"),
150
+
151
  array( "name" => "Wrap long menu items",
152
  "desc" => "If checked long menu items will wrap",
153
  "id" => "shailan_dm_allowmultiline",
319
 
320
  /** Unused options */
321
  update_option('shailan_dm_customwalkers', false);
322
+ }
 
323
 
324
+ /******************************************************************************
325
+ * OPTIONS
326
+ ******************************************************************************/
327
  function adminMenu(){
328
  global $pluginname, $pluginshortname, $pluginoptions;
329
 
330
  if(is_admin()){
 
331
  // Styles
332
  wp_admin_css( 'widgets' );
333
  wp_enqueue_style( 'dropdownMenuStyles', WP_PLUGIN_URL . '/' . SHAILAN_DM_FOLDER . '/css/admin.css' );
335
  // Scripts
336
  wp_enqueue_script( 'admin-widgets' );
337
  wp_enqueue_script( 'dropdown-widgets', WP_PLUGIN_URL . '/' . SHAILAN_DM_FOLDER . '/js/widgets.js', array('jquery') );
 
338
  };
339
 
340
  if ( isset($_GET['page']) && $_GET['page'] == 'dropdown-menu' ) {
371
  include_once('options-page.php');
372
  }
373
 
374
+ /******************************************************************************
375
+ * the WIDGET
376
+ ******************************************************************************/
377
  function widget($args, $instance) {
378
  extract( $args );
379
  $widget_options = wp_parse_args( $instance, $this->defaults );
519
  <?php echo $after_widget; ?>
520
  <?php
521
  }
522
+
523
  function update($new_instance, $old_instance) {
524
  return $new_instance;
525
  }
526
+
527
+ /******************************************************************************
528
+ * WIDGET FORM
529
+ ******************************************************************************/
530
  function form($instance) {
531
  $widget_options = wp_parse_args( $instance, $this->defaults );
532
  extract( $widget_options, EXTR_SKIP );
575
  <?php
576
  }
577
 
578
+ /******************************************************************************
579
+ * HEADER
580
+ ******************************************************************************/
581
  function header($instance){
582
  global $pluginname, $pluginshortname, $pluginoptions;
583
  if(!is_admin()){
584
+
585
  $theme = get_option('shailan_dm_active_theme');
586
+ if($theme == '*url*'){ $theme = get_option('shailan_dm_theme_url'); }
587
+
588
  $allow_multiline = (bool) get_option('shailan_dm_allowmultiline');
589
+
590
  // Colors
591
  $custom_colors = (bool) get_option('shailan_dm_custom_colors');
592
  $shailan_dm_color_menubg = get_option('shailan_dm_color_menubg');
599
  echo "\n\n<!-- Dropdown Menu Widget Styles by shailan (http://shailan.com) v".SHAILAN_DM_VERSION." on wp".get_bloginfo( 'version' )." -->"; // For debug
600
  echo "\n<link rel=\"stylesheet\" href=\"".WP_PLUGIN_URL."/".SHAILAN_DM_FOLDER."/css/shailan-dropdown.css\" type=\"text/css\" />";
601
 
602
+
603
+
604
+ if( $theme!='*none*' && $theme != '*custom*' ){
605
  if( false === strpos($theme, 'http') ){
606
+ // Default
607
  echo "\n<link rel=\"stylesheet\" href=\"". plugins_url( '/themes/' . $theme . '.css', __FILE__)."\" type=\"text/css\" />";
608
  } else {
609
+ // URL include
610
  echo "\n<link rel=\"stylesheet\" href=\"".$theme."\" type=\"text/css\" />";
611
  }
612
  }
663
  <?php } elseif($overlay == 'none') { ?>
664
  /* Clear background images */
665
  .shailan-dropdown-menu .dropdown-horizontal-container, ul.dropdown li, ul.dropdown li.hover, ul.dropdown li:hover, ul.dropdown li.hover a, ul.dropdown li:hover a { background-image:none; }
666
+ <?php } else {/* unidentified overlay ? */} ?>
667
 
668
  .shailan-dropdown-menu .dropdown-horizontal-container, ul.dropdown li{ background-color:<?php echo $shailan_dm_color_menubg; ?>; }
669
  ul.dropdown a:link,
670
+ ul.dropdown a:visited,
671
+ ul.dropdown li { color: <?php echo $shailan_dm_color_link; ?>; }
672
+ ul.dropdown a:hover,
673
+ ul.dropdown li:hover { color: <?php echo $shailan_dm_color_hoverlink; ?>; }
674
  ul.dropdown a:active { color: <?php echo $shailan_dm_color_hoverlink; ?>; }
675
 
676
  ul.dropdown li.hover a, ul.dropdown li:hover a{ background-color: <?php echo $shailan_dm_color_lihover; ?>; }
707
  }
708
  } // -- End Header
709
 
710
+ /******************************************************************************
711
+ * HEADER
712
+ ******************************************************************************/
713
  function footer($instance){
714
  $indent = "\n\t";
715
 
725
  echo "\n<script type=\"text/javascript\">/* <![CDATA[ */";
726
  echo "\njQuery(document).ready(function(){ \n";
727
 
728
+ // Remove title attributes from links
 
729
  if($remove_title_attributes){
730
  ?>
731
  jQuery('ul.dropdown li a').removeAttr('title');
732
  <?php
733
  }
734
 
735
+ // Remove links from top-level elements
 
736
  if($remove_top_level_links){
737
  ?>
738
  jQuery('ul.children').parent().find('a:first').removeAttr('href');
739
  <?php
740
  }
741
 
742
+ // Dropdown FX
 
743
  if( 'fade' == $effect ){
744
  ?>
745
  jQuery(".dropdown li").hover(function(){
756
  function(){
757
  jQuery(this).find("ul:first").slideUp('<?php echo $speed; ?>');
758
  });
759
+ <?php
760
+ } elseif( 'fade2' == $effect ) { ?>
761
+
762
+ jQuery(".dropdown li").hover(function(){
763
+ h = jQuery(this).height() + 'px';
764
+ jQuery(this).find("ul:first").animate( {opacity:'show', top:h}, '<?php echo $speed; ?>');
765
+ },
766
+ function(){
767
+ h = jQuery(this).height() + 5 + 'px';
768
+ jQuery(this).find("ul:first").animate( {opacity:'hide', top:h}, '<?php echo $speed; ?>');
769
+ });
770
+
771
+ <?php }
772
+
773
  echo "\n});";
774
  echo "\n/* ]]> */</script>";
775
  echo "\n<!-- /Dropdown Menu Widget Styles -->";
776
  echo "\n\n ";
777
+
778
+ } // fx active
779
+
780
  }
781
 
782
+ }
783
+ // *** END OF CLASS ***
784
 
785
+ // Register widget
786
  add_action('widgets_init', create_function('', 'return register_widget("shailan_DropdownWidget");'));
787
 
788
+ // Load translations
789
  $plugin_dir = basename(dirname(__FILE__));
790
  load_plugin_textdomain( 'shailan-dropdown-menu', false, $plugin_dir . '/lang');
791
 
792
+ // Add admin menu
793
  add_action('admin_menu', array('shailan_DropdownWidget', 'adminMenu'));
794
 
795
  /* Includes */
796
+ include('shailan-page-walker.php'); // Load custom page walker
797
+ include('shailan-category-walker.php'); // Load custom category walker
798
 
799
  /* Custom widget */
800
+ include('shailan-multi-dropdown.php'); // Load multi-dropdown widget
801
 
802
+ // Template tag support
803
  function shailan_dropdown_menu( $args = array() ){
804
  $type = get_option('shailan_dm_type');
805
  $exclude = get_option('shailan_dm_exclude');