Meks Smart Social Widget - Version 1.3.2

Version Description

  • Added: Possibility to reorder (drag and drop) social icons in admin panel
Download this release

Release Info

Developer mekshq
Plugin Icon 128x128 Meks Smart Social Widget
Version 1.3.2
Comparing to
See all releases

Code changes from version 1.3.1 to 1.3.2

css/admin.css ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* ADMIN STYLING */
2
+
3
+ ul.mks_social_container {
4
+ margin-top: 0;
5
+ }
6
+
7
+ ul.mks_social_container li {
8
+ background: rgba(0, 0, 0, 0.02);
9
+ padding: 20px 15px;
10
+ cursor: move;
11
+ position: relative;
12
+ }
13
+
14
+ .mks-option-label {
15
+ display: inline-block;
16
+ width: 30%;
17
+ }
18
+
19
+ .mks-option-radio-wrapper {
20
+ margin-top: -27px;
21
+ }
22
+ label.mks-option-radio {
23
+ margin-left: 30%;
24
+ }
25
+
26
+ label.mks-sw-icon {
27
+ display: inline-block;
28
+ width: 40px;
29
+ }
30
+ span.mks-remove-social {
31
+ position: absolute;
32
+ right: -3px;
33
+ top: 0px;
34
+ padding: 6px;
35
+ color: #a00;
36
+ font-size: 17px;
37
+ cursor: pointer;
38
+ }
39
+ span.mks-remove-social:hover {
40
+ color: red !important;
41
+ }
42
+
43
+ ul.mks_social_container .mks-social-sortable-drop {
44
+ background: transparent;
45
+ border: 1px dashed rgba(0, 0, 0, 0.1);
46
+ height: 58px;
47
+ }
48
+
49
+ h4.mks-icons-title {
50
+ margin-bottom: 9px;
51
+ }
css/style.css CHANGED
@@ -164,7 +164,7 @@ ul.mks_social_widget_ul .linkedin_ico {
164
  background-color: #71b2d0;
165
  }
166
 
167
- .myspace_ico {
168
  background-color: #003398;
169
  }
170
 
164
  background-color: #71b2d0;
165
  }
166
 
167
+ ul.mks_social_widget_ul .myspace_ico {
168
  background-color: #003398;
169
  }
170
 
inc/class-social-widget.php CHANGED
@@ -35,11 +35,10 @@ class MKS_Social_Widget extends WP_Widget {
35
  wp_enqueue_style( 'meks-social-widget' );
36
  }
37
 
38
-
39
-
40
- function enqueue_admin_scripts(){
41
- wp_enqueue_script( 'meks-social-widget-js', MKS_SOCIAL_WIDGET_URL.'js/main.js', array( 'jquery'), MKS_SOCIAL_WIDGET_VER );
42
- }
43
 
44
  function widget( $args, $instance ) {
45
 
@@ -113,46 +112,46 @@ class MKS_Social_Widget extends WP_Widget {
113
  <label for="<?php echo $this->get_field_id( 'content' ); ?>"><?php _e('Introduction text (optional)', 'meks-smart-social-widget'); ?>:</label>
114
  <textarea id="<?php echo $this->get_field_id( 'content' ); ?>" rows="5" name="<?php echo $this->get_field_name( 'content' ); ?>" class="widefat"><?php echo $instance['content']; ?></textarea>
115
  </p>
116
- <h4><?php _e('Options', 'meks-smart-social-widget'); ?>:</h4>
117
  <p>
118
- <label><?php _e('Icon shape', 'meks-smart-social-widget'); ?>:</label><br/>
119
- <input type="radio" name="<?php echo $this->get_field_name( 'style' ); ?>" value="square" <?php checked($instance['style'],'square'); ?>/>
120
- <label><?php _e('Square', 'meks-smart-social-widget'); ?></label><br/>
121
- <input type="radio" name="<?php echo $this->get_field_name( 'style' ); ?>" value="circle" <?php checked($instance['style'],'circle'); ?>/>
122
- <label><?php _e('Circle', 'meks-smart-social-widget'); ?></label><br/>
123
- <input type="radio" name="<?php echo $this->get_field_name( 'style' ); ?>" value="rounded" <?php checked($instance['style'],'rounded'); ?>/>
124
- <label><?php _e('Rounded corners', 'meks-smart-social-widget'); ?></label>
125
  </p>
126
 
127
  <p>
128
- <label for="<?php echo $this->get_field_id( 'size' ); ?>"><?php _e('Icon size', 'meks-smart-social-widget'); ?>: </label>
129
  <input id="<?php echo $this->get_field_id( 'size' ); ?>" type="text" name="<?php echo $this->get_field_name( 'size' ); ?>" value="<?php echo absint($instance['size']); ?>" class="small-text" /> px
130
  </p>
131
 
132
 
133
  <p>
134
- <label for="<?php echo $this->get_field_id( 'font_size' ); ?>"><?php _e('Icon font size', 'meks-smart-social-widget'); ?>: </label>
135
  <input id="<?php echo $this->get_field_id( 'font_size' ); ?>" type="text" name="<?php echo $this->get_field_name( 'font_size' ); ?>" value="<?php echo absint($instance['font_size']); ?>" class="small-text" /> px
136
  </p>
137
 
138
  <p>
139
- <label for="<?php echo $this->get_field_id( 'target' ); ?>"><?php _e('Open links in', 'meks-smart-social-widget'); ?>: </label>
140
  <select id="<?php echo $this->get_field_id( 'target' ); ?>" name="<?php echo $this->get_field_name( 'target' ); ?>">
141
  <option value="_blank" <?php selected('_blank',$instance['target']); ?>><?php _e('New Window', 'meks-smart-social-widget'); ?></option>
142
  <option value="_self" <?php selected('_self',$instance['target']); ?>><?php _e('Same Window', 'meks-smart-social-widget'); ?></option>
143
  </select>
144
  </p>
145
 
146
- <h4><?php _e('Icons', 'meks-smart-social-widget'); ?>:</h4>
147
- <p>
148
- <ul class="mks_social_container">
149
  <?php foreach($instance['social'] as $link) : ?>
150
  <li>
151
  <?php $this->draw_social($this, $social_links, $link); ?>
152
  </li>
153
  <?php endforeach; ?>
154
- </ul>
155
- </p>
156
 
157
  <p>
158
  <a href="#" class="mks_add_social button"><?php _e('Add Icon', 'meks-smart-social-widget'); ?></a>
@@ -168,13 +167,20 @@ class MKS_Social_Widget extends WP_Widget {
168
  }
169
 
170
  function draw_social($widget, $social_links, $selected = array('icon' => '', 'url' => '') ){ ?>
171
- <?php _e('Icon', 'meks-smart-social-widget'); ?>: <select type="text" name="<?php echo $widget->get_field_name('social_icon'); ?>[]" value="<?php echo $selected['icon']; ?>" style="width: 80%">
172
- <?php foreach($social_links as $key => $link) : ?>
173
- <option value="<?php echo $key; ?>" <?php selected($key,$selected['icon']); ?>><?php echo $link; ?></option>
174
- <?php endforeach; ?>
175
- </select><br />
176
- <?php _e('Url', 'meks-smart-social-widget'); ?>: &nbsp;&nbsp;&nbsp;<input type="text" name="<?php echo $widget->get_field_name('social_url'); ?>[]" value="<?php echo $selected['url']; ?>" style="width: 80%">
177
- <a href="#" class="mks_remove_social" title="<?php _e('Remove', 'meks-smart-social-widget'); ?>"><?php _e('x', 'meks-smart-social-widget'); ?></a>
 
 
 
 
 
 
 
178
  <?php }
179
 
180
 
@@ -319,7 +325,7 @@ class MKS_Social_Widget extends WP_Widget {
319
  );
320
 
321
  return $social;
322
- }
323
  }
324
 
325
  ?>
35
  wp_enqueue_style( 'meks-social-widget' );
36
  }
37
 
38
+ function enqueue_admin_scripts(){
39
+ wp_enqueue_script( 'meks-social-widget-js', MKS_SOCIAL_WIDGET_URL.'js/main.js', array( 'jquery'), MKS_SOCIAL_WIDGET_VER );
40
+ wp_enqueue_style( 'mks-social-widget-css', MKS_SOCIAL_WIDGET_URL . 'css/admin.css', false, MKS_SOCIAL_WIDGET_VER );
41
+ }
 
42
 
43
  function widget( $args, $instance ) {
44
 
112
  <label for="<?php echo $this->get_field_id( 'content' ); ?>"><?php _e('Introduction text (optional)', 'meks-smart-social-widget'); ?>:</label>
113
  <textarea id="<?php echo $this->get_field_id( 'content' ); ?>" rows="5" name="<?php echo $this->get_field_name( 'content' ); ?>" class="widefat"><?php echo $instance['content']; ?></textarea>
114
  </p>
115
+
116
  <p>
117
+ <span class="mks-option-label mks-option-fl"><?php _e('Icon shape', 'meks-smart-social-widget'); ?>:</span><br/>
118
+ <div class="mks-option-radio-wrapper">
119
+
120
+ <label class="mks-option-radio"><input type="radio" name="<?php echo $this->get_field_name( 'style' ); ?>" value="square" <?php checked($instance['style'],'square'); ?>/><?php _e('Square', 'meks-smart-social-widget'); ?></label><br/>
121
+ <label class="mks-option-radio"><input type="radio" name="<?php echo $this->get_field_name( 'style' ); ?>" value="circle" <?php checked($instance['style'],'circle'); ?>/><?php _e('Circle', 'meks-smart-social-widget'); ?></label><br/>
122
+ <label class="mks-option-radio"><input type="radio" name="<?php echo $this->get_field_name( 'style' ); ?>" value="rounded" <?php checked($instance['style'],'rounded'); ?>/><?php _e('Rounded corners', 'meks-smart-social-widget'); ?></label>
123
+ </div>
124
  </p>
125
 
126
  <p>
127
+ <label class="mks-option-label" for="<?php echo $this->get_field_id( 'size' ); ?>"><?php _e('Icon size', 'meks-smart-social-widget'); ?>: </label>
128
  <input id="<?php echo $this->get_field_id( 'size' ); ?>" type="text" name="<?php echo $this->get_field_name( 'size' ); ?>" value="<?php echo absint($instance['size']); ?>" class="small-text" /> px
129
  </p>
130
 
131
 
132
  <p>
133
+ <label class="mks-option-label" for="<?php echo $this->get_field_id( 'font_size' ); ?>"><?php _e('Icon font size', 'meks-smart-social-widget'); ?>: </label>
134
  <input id="<?php echo $this->get_field_id( 'font_size' ); ?>" type="text" name="<?php echo $this->get_field_name( 'font_size' ); ?>" value="<?php echo absint($instance['font_size']); ?>" class="small-text" /> px
135
  </p>
136
 
137
  <p>
138
+ <label class="mks-option-label" for="<?php echo $this->get_field_id( 'target' ); ?>"><?php _e('Open links in', 'meks-smart-social-widget'); ?>: </label>
139
  <select id="<?php echo $this->get_field_id( 'target' ); ?>" name="<?php echo $this->get_field_name( 'target' ); ?>">
140
  <option value="_blank" <?php selected('_blank',$instance['target']); ?>><?php _e('New Window', 'meks-smart-social-widget'); ?></option>
141
  <option value="_self" <?php selected('_self',$instance['target']); ?>><?php _e('Same Window', 'meks-smart-social-widget'); ?></option>
142
  </select>
143
  </p>
144
 
145
+ <h4 class="mks-icons-title"><?php _e('Icons', 'meks-smart-social-widget'); ?>:</h4>
146
+
147
+ <ul class="mks_social_container mks-social-sortable">
148
  <?php foreach($instance['social'] as $link) : ?>
149
  <li>
150
  <?php $this->draw_social($this, $social_links, $link); ?>
151
  </li>
152
  <?php endforeach; ?>
153
+ </ul>
154
+
155
 
156
  <p>
157
  <a href="#" class="mks_add_social button"><?php _e('Add Icon', 'meks-smart-social-widget'); ?></a>
167
  }
168
 
169
  function draw_social($widget, $social_links, $selected = array('icon' => '', 'url' => '') ){ ?>
170
+
171
+ <label class="mks-sw-icon"><?php _e('Icon', 'meks-smart-social-widget'); ?> :</label>
172
+ <select type="text" name="<?php echo $widget->get_field_name('social_icon'); ?>[]" value="<?php echo $selected['icon']; ?>" style="width: 82%">
173
+ <?php foreach($social_links as $key => $link) : ?>
174
+ <option value="<?php echo $key; ?>" <?php selected($key,$selected['icon']); ?>><?php echo $link; ?></option>
175
+ <?php endforeach; ?>
176
+ </select>
177
+
178
+ <label class="mks-sw-icon"><?php _e('Url', 'meks-smart-social-widget'); ?> :</label>
179
+ <input type="text" name="<?php echo $widget->get_field_name('social_url'); ?>[]" value="<?php echo $selected['url']; ?>" style="width: 82%">
180
+
181
+
182
+ <span class="mks-remove-social dashicons dashicons-no-alt"></span>
183
+
184
  <?php }
185
 
186
 
325
  );
326
 
327
  return $social;
328
+ }
329
  }
330
 
331
  ?>
js/main.js CHANGED
@@ -11,12 +11,35 @@
11
 
12
  widget_holder.find('.mks_social_container').append('<li>'+cloner.html()+'</li>');
13
 
14
- });
15
 
16
- $("body").on("click", "a.mks_remove_social", function(e){
17
- e.preventDefault();
18
- $(this).closest('li').remove();
19
- });
20
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  })(jQuery);
11
 
12
  widget_holder.find('.mks_social_container').append('<li>'+cloner.html()+'</li>');
13
 
14
+ });
15
 
16
+ $("body").on("click", ".mks-remove-social", function(e){
17
+ var delete_item = confirm('Are you sure you want to delete this icon?');
18
+ delete_item ? $(this).closest('li').remove() : '';
 
19
  });
20
+
21
+
22
+ /* Init sortable */
23
+ mks_social_sortable();
24
+
25
+ $(document).on('widget-added', function(e) {
26
+ mks_social_sortable();
27
+ });
28
+
29
+ $(document).on('widget-updated', function(e) {
30
+ mks_social_sortable();
31
+ });
32
+
33
+ /* Sortable function */
34
+ function mks_social_sortable() {
35
+ $(".mks-social-sortable").sortable({
36
+ revert: false,
37
+ cursor: "move",
38
+ delay: 100,
39
+ placeholder: "mks-social-sortable-drop"
40
+ });
41
+ }
42
+
43
+ });
44
 
45
  })(jQuery);
meks-smart-social-widget.php CHANGED
@@ -6,7 +6,7 @@ Description: Easily display more than 100 social icons inside WordPress widget.
6
  Delicious, DeviantArt, Digg, Dribbble, Envato, Evernote, Facebook, Flickr, Forrst, Github, Google, GooglePlus, GrooveShark, Icloud, Instagram, LastFM, LinkedIN, MySpace, Picasa,
7
  Pinterest, ReddIt, Rss, Skype, Spotify, StumbleUpon, Tumblr, Twitter, Vimeo, Vine, WordPress, Xing, Youtube, Zerply, 500px...
8
  Author: Meks
9
- Version: 1.3.1
10
  Author URI: http://mekshq.com
11
  Text Domain: meks-smart-social-widget
12
  Domain Path: /languages
@@ -32,7 +32,7 @@ Domain Path: /languages
32
 
33
  define ('MKS_SOCIAL_WIDGET_URL', trailingslashit(plugin_dir_url(__FILE__)));
34
  define ('MKS_SOCIAL_WIDGET_DIR', trailingslashit(plugin_dir_path(__FILE__)));
35
- define ('MKS_SOCIAL_WIDGET_VER', '1.3.1');
36
 
37
  /* Initialize Widget */
38
  if(!function_exists('mks_social_widget_init')):
6
  Delicious, DeviantArt, Digg, Dribbble, Envato, Evernote, Facebook, Flickr, Forrst, Github, Google, GooglePlus, GrooveShark, Icloud, Instagram, LastFM, LinkedIN, MySpace, Picasa,
7
  Pinterest, ReddIt, Rss, Skype, Spotify, StumbleUpon, Tumblr, Twitter, Vimeo, Vine, WordPress, Xing, Youtube, Zerply, 500px...
8
  Author: Meks
9
+ Version: 1.3.2
10
  Author URI: http://mekshq.com
11
  Text Domain: meks-smart-social-widget
12
  Domain Path: /languages
32
 
33
  define ('MKS_SOCIAL_WIDGET_URL', trailingslashit(plugin_dir_url(__FILE__)));
34
  define ('MKS_SOCIAL_WIDGET_DIR', trailingslashit(plugin_dir_path(__FILE__)));
35
+ define ('MKS_SOCIAL_WIDGET_VER', '1.3.2');
36
 
37
  /* Initialize Widget */
38
  if(!function_exists('mks_social_widget_init')):
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://mekshq.com/
4
  Tags: social, icons, widget, linkedin, reddit, vimeo, dribble, instagram, pinterest
5
  Requires at least: 3.0
6
  Tested up to: 4.7
7
- Stable tag: 1.3.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
 
@@ -48,6 +48,10 @@ For any questions, error reports and suggestions please email support@mekshq.com
48
 
49
  == Changelog ==
50
 
 
 
 
 
51
  = 1.3.1 =
52
 
53
  * Fixed: Google+ icon not displaying
4
  Tags: social, icons, widget, linkedin, reddit, vimeo, dribble, instagram, pinterest
5
  Requires at least: 3.0
6
  Tested up to: 4.7
7
+ Stable tag: 1.3.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
 
48
 
49
  == Changelog ==
50
 
51
+ = 1.3.2 =
52
+
53
+ * Added: Possibility to reorder (drag and drop) social icons in admin panel
54
+
55
  = 1.3.1 =
56
 
57
  * Fixed: Google+ icon not displaying