Menu Image - Version 3.0.1

Version Description

Download this release

Release Info

Developer takanakui
Plugin Icon 128x128 Menu Image
Version 3.0.1
Comparing to
See all releases

Code changes from version 3.0 to 3.0.1

includes/css/menu-image-admin.css CHANGED
@@ -420,4 +420,23 @@
420
  /* Custom Css */
421
  #fs_connect .fs-visual .fs-plugin-icon, #fs_connect .fs-visual .fs-connect-logo, #fs_connect .fs-visual .fs-site-icon {
422
  border: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
423
  }
420
  /* Custom Css */
421
  #fs_connect .fs-visual .fs-plugin-icon, #fs_connect .fs-visual .fs-connect-logo, #fs_connect .fs-visual .fs-site-icon {
422
  border: none;
423
+ }
424
+ /* RTL adjustments */
425
+ .rtl .menu-image-item-settings-content .menu-item-preview {
426
+ left: 0px;
427
+ right: unset;
428
+ }
429
+ .rtl #menu-image-modal-body {
430
+ float: right;
431
+ }
432
+ .rtl .menu-image-close-overlay .close-text {
433
+ margin-right: 20px;
434
+ }
435
+ .rtl #menu-image-modal-header h2 {
436
+ float: right;
437
+ margin-right: 20px;
438
+ }
439
+ .rtl .menu-image-close-overlay {
440
+ float: left;
441
+ margin-left: 20px;
442
  }
includes/js/menu-image-admin.js CHANGED
@@ -216,6 +216,7 @@
216
  var select_icon = '';
217
  var title_position = $( 'input[name="menu_item_image_title_position"]:checked' ).val();
218
  var item_image_type = $( 'input[name="menu_item_image_type"]:checked' ).val();
 
219
  var item_image_notification = $( '#menu_item_image_notification' ).val();
220
  var menu_item_button = $( 'input[name="menu_item_button"]' ).is(':checked');
221
  var bubble_color = $( '.menu-image-bubble-color' ).val();
@@ -228,6 +229,7 @@
228
  menu_item_id: menu_item_id,
229
  menu_item_image_title_position: title_position,
230
  menu_item_image_type: item_image_type,
 
231
  }
232
 
233
  if ( $( '.menu-item-icon-selected' ).length > 0 ) {
216
  var select_icon = '';
217
  var title_position = $( 'input[name="menu_item_image_title_position"]:checked' ).val();
218
  var item_image_type = $( 'input[name="menu_item_image_type"]:checked' ).val();
219
+ var item_image_size = $( '#menu_item_image_size' ).val();
220
  var item_image_notification = $( '#menu_item_image_notification' ).val();
221
  var menu_item_button = $( 'input[name="menu_item_button"]' ).is(':checked');
222
  var bubble_color = $( '.menu-image-bubble-color' ).val();
229
  menu_item_id: menu_item_id,
230
  menu_item_image_title_position: title_position,
231
  menu_item_image_type: item_image_type,
232
+ menu_item_image_size: item_image_size,
233
  }
234
 
235
  if ( $( '.menu-item-icon-selected' ).length > 0 ) {
menu-image.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /**
4
  * @package Menu_Image
5
- * @version 3.0
6
  * @licence GPLv2
7
  */
8
  /*
@@ -10,14 +10,14 @@ Plugin Name: Menu Image
10
  Plugin URI: https://www.wpmenuimage.com
11
  Description: Improve your navigation menu items with images, logos, icons, buttons.
12
  Author: Rui Guerreiro
13
- Version: 3.0
14
  Author URI: https://www.wpmenuimage.com
15
  * License: GPLv2
16
  */
17
  if ( !defined( 'ABSPATH' ) ) {
18
  die;
19
  }
20
- define( 'MENU_IMAGE_VERSION', '3.0' );
21
  define( 'MENU_IMAGE_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
22
  define( 'MENU_IMAGE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
23
  /**
@@ -604,6 +604,7 @@ class WP_Menu_Image
604
  {
605
  $menu_image_settings = array(
606
  'menu_item_image_title_position',
 
607
  'menu_item_image_button',
608
  'menu_image_icon',
609
  'menu_item_image_type',
@@ -618,50 +619,7 @@ class WP_Menu_Image
618
 
619
  foreach ( $menu_image_settings as $setting_name ) {
620
  if ( isset( $_POST[$setting_name] ) ) {
621
- // Save the button option fields.
622
- switch ( $setting_name ) {
623
- case 'menu_item_image_button':
624
- $menu_image_button = array();
625
- // Update if set has a button.
626
-
627
- if ( $_POST[$setting_name] == 'true' ) {
628
- $menu_image_button['button_enabled'] = 'yes';
629
- } else {
630
- $menu_image_button['button_enabled'] = 'no';
631
- }
632
-
633
- $menu_image_button['border_radius'] = $_POST['menu_item_button_border_radius'];
634
- $menu_image_button['color'] = $_POST['menu_image_button_color'];
635
- $menu_image_button['bg_color'] = $_POST['menu_image_button_bg_color'];
636
- $menu_image_button['button_style'] = $_POST['menu_image_button_style'];
637
- $menu_image_button['padding_top'] = $_POST['menu_image_button_pd_top'];
638
- $menu_image_button['padding_left'] = $_POST['menu_image_button_pd_left'];
639
- $menu_image_button['padding_right'] = $_POST['menu_image_button_pd_right'];
640
- $menu_image_button['padding_bottom'] = $_POST['menu_image_button_pd_bottom'];
641
- update_post_meta( $post_id, '_menu_item_image_button', array_map( 'sanitize_text_field', $menu_image_button ) );
642
- break;
643
- case 'menu_item_image_notification':
644
- $menu_image_notification = array();
645
- switch ( $_POST[$setting_name] ) {
646
- case 'bubble':
647
- $menu_image_notification['type'] = 'bubble';
648
- $menu_image_notification['bubble_color'] = $_POST['bubble_color'];
649
- $menu_image_notification['bubble_func'] = $_POST['bubble_func'];
650
- break;
651
- case 'badge':
652
- $menu_image_notification['type'] = 'badge';
653
- $menu_image_notification['badge_color'] = $_POST['badge_color'];
654
- $menu_image_notification['badge_text'] = $_POST['badge_text'];
655
- break;
656
- default:
657
- $menu_image_notification['type'] = 'none';
658
- }
659
- update_post_meta( $post_id, '_menu_item_image_notification', array_map( 'sanitize_text_field', $menu_image_notification ) );
660
- break;
661
- default:
662
- update_post_meta( $post_id, "_{$setting_name}", esc_sql( $_POST[$setting_name] ) );
663
- break;
664
- }
665
  }
666
  }
667
  }
@@ -747,38 +705,8 @@ class WP_Menu_Image
747
  if ( !isset( $item->title_position ) ) {
748
  $item->title_position = get_post_meta( $item->ID, '_menu_item_image_title_position', true );
749
  }
750
- $menu_image_button = get_post_meta( $item->ID, '_menu_item_image_button', true );
751
  $menu_item_type = get_post_meta( $item->ID, '_menu_item_image_type', true );
752
  $item->menu_image_icon_type = $menu_item_type;
753
- // Button settings.
754
-
755
- if ( isset( $menu_image_button['button_enabled'] ) && $menu_image_button['button_enabled'] == 'yes' ) {
756
- $item->button_color = $menu_image_button['color'];
757
- $item->button_bg_color = $menu_image_button['bg_color'];
758
- $item->button_style = $menu_image_button['button_style'];
759
- $item->button_border_radius = $menu_image_button['border_radius'];
760
- }
761
-
762
- // Get the Notification type.
763
- $image_notification = get_post_meta( $item->ID, '_menu_item_image_notification', true );
764
-
765
- if ( $image_notification ) {
766
- // Bubble data.
767
-
768
- if ( $image_notification['type'] == 'bubble' ) {
769
- $item->bubble_color = $image_notification['bubble_color'];
770
- $item->bubble_number_func = $image_notification['bubble_func'];
771
- }
772
-
773
- // Badge data.
774
-
775
- if ( $image_notification['type'] == 'badge' ) {
776
- $item->badge_color = $image_notification['badge_color'];
777
- $item->badge_text = $image_notification['badge_text'];
778
- }
779
-
780
- }
781
-
782
  return $item;
783
  }
784
 
@@ -807,7 +735,7 @@ class WP_Menu_Image
807
  )
808
  {
809
 
810
- if ( isset( $item->thumbnail_id ) && '' !== $item->thumbnail_id ) {
811
  $this->setProcessed( $item->ID );
812
  $position = ( $item->title_position ? $item->title_position : apply_filters( 'menu_image_default_title_position', 'after' ) );
813
  $class = ( !empty($atts['class']) ? $atts['class'] : '' );
@@ -855,16 +783,18 @@ class WP_Menu_Image
855
  if ( is_numeric( $item ) && $item > 0 ) {
856
  $item = wp_setup_nav_menu_item( get_post( $item ) );
857
  }
 
 
 
858
  // Check if we will add an icon or image to the menu item.
859
 
860
  if ( $item->menu_image_icon_type != 'icon' ) {
861
 
862
- if ( isset( $item->thumbnail_id ) && '' !== $item->thumbnail_id ) {
863
  $image_size = ( $item->image_size ? $item->image_size : apply_filters( 'menu_image_default_size', 'menu-36x36' ) );
864
  $position = ( $item->title_position ? $item->title_position : apply_filters( 'menu_image_default_title_position', 'after' ) );
865
  $class = "menu-image-title-{$position}";
866
  $this->setUsedAttachments( $image_size, $item->thumbnail_id );
867
- $image = '';
868
 
869
  if ( $item->thumbnail_hover_id ) {
870
  $this->setUsedAttachments( $image_size, $item->thumbnail_hover_id );
@@ -895,7 +825,8 @@ class WP_Menu_Image
895
  "class=menu-image {$class}"
896
  );
897
  }
898
-
 
899
  }
900
 
901
  } else {
@@ -903,12 +834,12 @@ class WP_Menu_Image
903
  $position = ( $item->title_position ? $item->title_position : apply_filters( 'menu_image_default_title_position', 'after' ) );
904
  $class = "menu-image-title-{$position}";
905
  $image = '<span class="dashicons ' . $selected_icon . ' ' . $position . '-menu-image-icons"></span>';
 
906
  }
907
 
908
  $none = '';
909
  // Sugar.
910
  $image = apply_filters( 'menu_image_img_html', $image );
911
- $class .= ' menu-image-title';
912
  switch ( $position ) {
913
  case 'hide':
914
  case 'before':
@@ -930,7 +861,9 @@ class WP_Menu_Image
930
  );
931
  break;
932
  }
933
- $title = vsprintf( '%s<span class="%s">%s</span>%s', $item_args );
 
 
934
  return $title;
935
  }
936
 
@@ -1055,12 +988,6 @@ class WP_Menu_Image
1055
  MENU_IMAGE_VERSION
1056
  );
1057
  wp_enqueue_style( 'menu-image' );
1058
-
1059
- if ( !wp_style_is( 'fontawesome', 'enqueued' ) ) {
1060
- wp_register_script( 'font-awesome', 'https://kit.fontawesome.com/7873a4d9d1.js', array( 'jquery' ) );
1061
- wp_enqueue_script( 'font-awesome' );
1062
- }
1063
-
1064
  }
1065
 
1066
  public function wp_menu_image_fontawesome_admin_notice()
@@ -1749,22 +1676,16 @@ class WP_Menu_Image
1749
  <!-- Icon/Image -->
1750
  <div class="menu-image-field-holder menu-item-image-type">
1751
  <div class="menu-image-label">
1752
- <label for="edit-menu-item-image-size-<?php
1753
- echo $item_id ;
1754
- ?>">
1755
  <?php
1756
  _e( 'Image size', 'menu-image' );
1757
  ?>
1758
  </label>
1759
  </div>
1760
  <div class="menu-image-field">
1761
- <select id="edit-menu-item-image-size-<?php
1762
- echo $item_id ;
1763
- ?>"
1764
  class="widefat edit-menu-item-image-size"
1765
- name="menu_item_image_size[<?php
1766
- echo $item_id ;
1767
- ?>]">
1768
  <option value='full' <?php
1769
  echo ( $image_size == 'full' ? ' selected="selected"' : '' ) ;
1770
  ?>><?php
2
 
3
  /**
4
  * @package Menu_Image
5
+ * @version 3.0.1
6
  * @licence GPLv2
7
  */
8
  /*
10
  Plugin URI: https://www.wpmenuimage.com
11
  Description: Improve your navigation menu items with images, logos, icons, buttons.
12
  Author: Rui Guerreiro
13
+ Version: 3.0.1
14
  Author URI: https://www.wpmenuimage.com
15
  * License: GPLv2
16
  */
17
  if ( !defined( 'ABSPATH' ) ) {
18
  die;
19
  }
20
+ define( 'MENU_IMAGE_VERSION', '3.0.1' );
21
  define( 'MENU_IMAGE_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
22
  define( 'MENU_IMAGE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
23
  /**
604
  {
605
  $menu_image_settings = array(
606
  'menu_item_image_title_position',
607
+ 'menu_item_image_size',
608
  'menu_item_image_button',
609
  'menu_image_icon',
610
  'menu_item_image_type',
619
 
620
  foreach ( $menu_image_settings as $setting_name ) {
621
  if ( isset( $_POST[$setting_name] ) ) {
622
+ update_post_meta( $post_id, "_{$setting_name}", esc_sql( $_POST[$setting_name] ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
623
  }
624
  }
625
  }
705
  if ( !isset( $item->title_position ) ) {
706
  $item->title_position = get_post_meta( $item->ID, '_menu_item_image_title_position', true );
707
  }
 
708
  $menu_item_type = get_post_meta( $item->ID, '_menu_item_image_type', true );
709
  $item->menu_image_icon_type = $menu_item_type;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
710
  return $item;
711
  }
712
 
735
  )
736
  {
737
 
738
+ if ( isset( $item->thumbnail_id ) && '' !== $item->thumbnail_id && $item->thumbnail_id > 0 ) {
739
  $this->setProcessed( $item->ID );
740
  $position = ( $item->title_position ? $item->title_position : apply_filters( 'menu_image_default_title_position', 'after' ) );
741
  $class = ( !empty($atts['class']) ? $atts['class'] : '' );
783
  if ( is_numeric( $item ) && $item > 0 ) {
784
  $item = wp_setup_nav_menu_item( get_post( $item ) );
785
  }
786
+ $image = '';
787
+ $position = '';
788
+ $class = '';
789
  // Check if we will add an icon or image to the menu item.
790
 
791
  if ( $item->menu_image_icon_type != 'icon' ) {
792
 
793
+ if ( isset( $item->thumbnail_id ) && '' !== $item->thumbnail_id && $item->thumbnail_id > 0 ) {
794
  $image_size = ( $item->image_size ? $item->image_size : apply_filters( 'menu_image_default_size', 'menu-36x36' ) );
795
  $position = ( $item->title_position ? $item->title_position : apply_filters( 'menu_image_default_title_position', 'after' ) );
796
  $class = "menu-image-title-{$position}";
797
  $this->setUsedAttachments( $image_size, $item->thumbnail_id );
 
798
 
799
  if ( $item->thumbnail_hover_id ) {
800
  $this->setUsedAttachments( $image_size, $item->thumbnail_hover_id );
825
  "class=menu-image {$class}"
826
  );
827
  }
828
+
829
+ $class .= ' menu-image-title';
830
  }
831
 
832
  } else {
834
  $position = ( $item->title_position ? $item->title_position : apply_filters( 'menu_image_default_title_position', 'after' ) );
835
  $class = "menu-image-title-{$position}";
836
  $image = '<span class="dashicons ' . $selected_icon . ' ' . $position . '-menu-image-icons"></span>';
837
+ $class .= ' menu-image-title';
838
  }
839
 
840
  $none = '';
841
  // Sugar.
842
  $image = apply_filters( 'menu_image_img_html', $image );
 
843
  switch ( $position ) {
844
  case 'hide':
845
  case 'before':
861
  );
862
  break;
863
  }
864
+ if ( $class != '' ) {
865
+ $title = vsprintf( '%s<span class="%s">%s</span>%s', $item_args );
866
+ }
867
  return $title;
868
  }
869
 
988
  MENU_IMAGE_VERSION
989
  );
990
  wp_enqueue_style( 'menu-image' );
 
 
 
 
 
 
991
  }
992
 
993
  public function wp_menu_image_fontawesome_admin_notice()
1676
  <!-- Icon/Image -->
1677
  <div class="menu-image-field-holder menu-item-image-type">
1678
  <div class="menu-image-label">
1679
+ <label for="menu_item_image_size">
 
 
1680
  <?php
1681
  _e( 'Image size', 'menu-image' );
1682
  ?>
1683
  </label>
1684
  </div>
1685
  <div class="menu-image-field">
1686
+ <select id="menu_item_image_size"
 
 
1687
  class="widefat edit-menu-item-image-size"
1688
+ name="menu_item_image_size">
 
 
1689
  <option value='full' <?php
1690
  echo ( $image_size == 'full' ? ' selected="selected"' : '' ) ;
1691
  ?>><?php
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: menu, navigation, image, icons, nav menu
4
  Donate link: https://www.buymeacoffee.com/ruiguerreiro
5
  Requires at least: 4.4.0
6
  Tested up to: 5.6
7
- Stable tag: 3.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -27,10 +27,10 @@ With Menu Image plugin you can do more, check some of the features:
27
  - Add Image / Icon on the Below of the menu item title.
28
  - Switch images / icons on mouse over the menu item.
29
  - [PREMIUM] Convert menu items into Call to action buttons.
30
- - [PREMIUM] Convert menu items into Call to action buttons.
31
  - [PREMIUM] Add count bubble to menu items (Cart total, category total, custom function) menu items.
32
  - [PREMIUM] Notification badges on the menu items (New, Sale, Hiring, etc).
33
  - [PREMIUM] Color customization of the buttons, badges and bubbles.
 
34
 
35
 
36
  = Links =
@@ -52,7 +52,7 @@ What people is saying!
52
  > `Best plugin for adding a logo to your navigation`
53
  > I'd definitely recommend this plugin if you need to add a logo to your navigation in WordPress. The support provided is so 5 stars!
54
 
55
- > @dwoolworth824
56
  == Installation ==
57
 
58
  1. Upload `menu-image` to the `/wp-content/plugins/` directory
@@ -89,6 +89,12 @@ Check this article in the following [link](https://www.wpmenuimage.com/knowledge
89
 
90
  == Changelog ==
91
 
 
 
 
 
 
 
92
  ### 3.0 ###
93
  * New - New Settings redesign
94
  * New - Menu item preview in the settings
4
  Donate link: https://www.buymeacoffee.com/ruiguerreiro
5
  Requires at least: 4.4.0
6
  Tested up to: 5.6
7
+ Stable tag: 3.0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
27
  - Add Image / Icon on the Below of the menu item title.
28
  - Switch images / icons on mouse over the menu item.
29
  - [PREMIUM] Convert menu items into Call to action buttons.
 
30
  - [PREMIUM] Add count bubble to menu items (Cart total, category total, custom function) menu items.
31
  - [PREMIUM] Notification badges on the menu items (New, Sale, Hiring, etc).
32
  - [PREMIUM] Color customization of the buttons, badges and bubbles.
33
+ - [PREMIUM] Disable Menu Image in Mobile devices
34
 
35
 
36
  = Links =
52
  > `Best plugin for adding a logo to your navigation`
53
  > I'd definitely recommend this plugin if you need to add a logo to your navigation in WordPress. The support provided is so 5 stars!
54
 
55
+ > @manmade1
56
  == Installation ==
57
 
58
  1. Upload `menu-image` to the `/wp-content/plugins/` directory
89
 
90
  == Changelog ==
91
 
92
+ ### 3.0.1 ###
93
+ * New - Add RTL CSS in Admin settings
94
+ * Fix - Image size settings wasn't saving
95
+ * Fix - Avoid HTML Markup in items without Icons or images
96
+ * Fix - Remove FontAwesome Enqueue
97
+
98
  ### 3.0 ###
99
  * New - New Settings redesign
100
  * New - Menu item preview in the settings