Spacer - Version 2.0.1

Version Description

  • Shortcode changed to use actual number (eg: [spacer height="20px"]), which will be easier to edit as you work
  • 'Dismiss notice' link changed to red to make it more visible.
  • Added compatibility with Beaver Page Builder's wysiswyg UI.
Download this release

Release Info

Developer clevelandwebdeveloper
Plugin Icon 128x128 Spacer
Version 2.0.1
Comparing to
See all releases

Code changes from version 2.0 to 2.0.1

Files changed (3) hide show
  1. editor_plugin.js +14 -1
  2. index.php +12 -2
  3. readme.txt +10 -6
editor_plugin.js CHANGED
@@ -1,4 +1,17 @@
1
  (function() {
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  var button_name = 'motech_spacer'; //set button name
3
 
4
  tinymce.create('tinymce.plugins.'+button_name, {
@@ -11,7 +24,7 @@
11
  //var vidId = prompt("YouTube Video", "Enter the id or url for your video");
12
  //var m = idPattern.exec(vidId);
13
  //if (m != null && m != 'undefined')
14
- ed.execCommand('mceInsertContent', false, '[spacer height="default"]');
15
  }
16
  });
17
  },
1
  (function() {
2
+
3
+ jQuery.ajax({
4
+ type: "POST",
5
+ dataType: "json",
6
+ url: ajaxurl,
7
+ data: {action: 'motech_spacer'},
8
+ success: function(response) { //ajax response
9
+ //modal.find('.modal-body').html(data); //insert the response.
10
+ ajaxresponse = response;
11
+
12
+ }
13
+ });
14
+
15
  var button_name = 'motech_spacer'; //set button name
16
 
17
  tinymce.create('tinymce.plugins.'+button_name, {
24
  //var vidId = prompt("YouTube Video", "Enter the id or url for your video");
25
  //var m = idPattern.exec(vidId);
26
  //if (m != null && m != 'undefined')
27
+ ed.execCommand('mceInsertContent', false, '[spacer height="'+ajaxresponse["useheight"]+'"]');
28
  }
29
  });
30
  },
index.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: Spacer
5
  Description: Adds a spacer button to the WYSIWYG visual editor which allows you to add precise custom spacing between lines in your posts and pages.
6
- Version: 2.0
7
  Author: Justin Saad
8
  Author URI: http://www.clevelandwebdeveloper.com
9
  License: GPL2
@@ -45,12 +45,22 @@ class motech_spacer {
45
 
46
  add_action( 'admin_enqueue_scripts', array($this, 'enqueue_color_picker') ); //enqueue color picker
47
 
 
 
48
  //admin messages
49
  add_action('admin_notices', array($this,'admin_show_message'));
50
  add_action('admin_init', array($this,'adminmessage_init'));
51
  }
52
  }
53
 
 
 
 
 
 
 
 
 
54
 
55
  function admin_show_message()
56
  {
@@ -61,7 +71,7 @@ class motech_spacer {
61
  echo '<div id="message" class="updated fade notice"><p>';
62
  echo ("<b>You can now <a href=\"".get_bloginfo( 'wpurl' ) . "/wp-admin/options-general.php?page=".$this->plugin_slug."-setting-admin\">hide spacer on mobile screens</a>, or set a custom spacer height for mobile screens.</b>");
63
  echo "</p>";
64
- echo "<p><strong><a href=\"".get_bloginfo( 'wpurl' ) . "/wp-admin/options-general.php?page=".$this->plugin_slug."-setting-admin\" target=\"_parent\">Set spacer height for mobile devices</a> | <a class=\"dismiss-notice\" href=\"".get_bloginfo( 'wpurl' ) . "/wp-admin/options-general.php?page=".$this->plugin_slug."-setting-admin&spacer3001_nag_ignore=0\" target=\"_parent\">Dismiss this notice</a></strong></p></div>";
65
  }
66
  }
67
 
3
  /*
4
  Plugin Name: Spacer
5
  Description: Adds a spacer button to the WYSIWYG visual editor which allows you to add precise custom spacing between lines in your posts and pages.
6
+ Version: 2.0.1
7
  Author: Justin Saad
8
  Author URI: http://www.clevelandwebdeveloper.com
9
  License: GPL2
45
 
46
  add_action( 'admin_enqueue_scripts', array($this, 'enqueue_color_picker') ); //enqueue color picker
47
 
48
+ add_action( 'wp_ajax_motech_spacer', array($this,'motech_spacer_callback') );
49
+
50
  //admin messages
51
  add_action('admin_notices', array($this,'admin_show_message'));
52
  add_action('admin_init', array($this,'adminmessage_init'));
53
  }
54
  }
55
 
56
+ function motech_spacer_callback() {
57
+ $return = array();
58
+ $checkheight = get_option($this->plugin_slug . '_default_height','20');
59
+ $checkunit = get_option($this->plugin_slug . '_default_height_unit','px');
60
+ $return["useheight"] = $checkheight.$checkunit;
61
+ echo json_encode($return);
62
+ wp_die(); // this is required to terminate immediately and return a proper response
63
+ }
64
 
65
  function admin_show_message()
66
  {
71
  echo '<div id="message" class="updated fade notice"><p>';
72
  echo ("<b>You can now <a href=\"".get_bloginfo( 'wpurl' ) . "/wp-admin/options-general.php?page=".$this->plugin_slug."-setting-admin\">hide spacer on mobile screens</a>, or set a custom spacer height for mobile screens.</b>");
73
  echo "</p>";
74
+ echo "<p><strong><a href=\"".get_bloginfo( 'wpurl' ) . "/wp-admin/options-general.php?page=".$this->plugin_slug."-setting-admin\" target=\"_parent\">Set spacer height for mobile devices</a> | <a class=\"dismiss-notice\" style=\"color:red;\" href=\"".get_bloginfo( 'wpurl' ) . "/wp-admin/options-general.php?page=".$this->plugin_slug."-setting-admin&spacer3001_nag_ignore=0\" target=\"_parent\">Dismiss this notice [X]</a></strong></p></div>";
75
  }
76
  }
77
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.clevelandwebdeveloper.com/wordpress-plugins/donate.php
4
  Tags: spacer, spacing, line space
5
  Requires at least: 2.9
6
  Tested up to: 4.4
7
- Stable tag: 2.0
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -44,11 +44,11 @@ Settings > Spacer > Default Spacer Height On Mobile > Set this to 0
44
 
45
  = How do I add a spacer to a page/post? =
46
 
47
- Press the spacer button in WYSIWYG visual editor (see screenshot). This will add a shortcode [spacer height="default"].
48
 
49
  = How do I manually set the spacer height on individual spacers? =
50
 
51
- Press the spacer button in WYSIWYG visual editor. This will add a shortcode [spacer height="default"]. Change default to whatever your desired line spacing is. For example, [spacer height="30px"] will give you 30 pixels of extra line spacing. If you use negative values the following content will be shifted upwards.
52
 
53
  = How do I manually edit the height, mobile height, classes, and inline style on individual spacers? =
54
  Here's an example of how you could apply this:
@@ -63,10 +63,14 @@ Here's an example of how you could apply this:
63
 
64
  == Changelog ==
65
 
 
 
 
 
 
66
  = 2.0 =
67
  * Feature added: Choose to hide spacer on mobile devices, or choose a different spacer height for mobile.
68
  * Feature added: Manually edit mobile height, custom classes, and inline style for individual spacer elements.
69
- * Feature added: Compatibility with Beaver Page Builder's wysiswyg UI.
70
  * Premium users: Speed up your workflow by setting a default height for your spacer. You can also set defaults for your spacer's custom classes and inline style.
71
 
72
  = 1.0 =
@@ -74,5 +78,5 @@ Here's an example of how you could apply this:
74
 
75
  == Upgrade Notice ==
76
 
77
- = 2.0 =
78
- New: The new version allows you to hide spacer on mobile devices, or choose a different spacer height for mobile. Added compatibility with Beaver Page Builder's wysiswyg UI.
4
  Tags: spacer, spacing, line space
5
  Requires at least: 2.9
6
  Tested up to: 4.4
7
+ Stable tag: 2.0.1
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
44
 
45
  = How do I add a spacer to a page/post? =
46
 
47
+ Press the spacer button in WYSIWYG visual editor (see screenshot). This will add a shortcode [spacer height="20px"].
48
 
49
  = How do I manually set the spacer height on individual spacers? =
50
 
51
+ Press the spacer button in WYSIWYG visual editor. This will add a shortcode [spacer height="20px"]. Change 20px to whatever your desired line spacing is. For example, [spacer height="30px"] will give you 30 pixels of extra line spacing. If you use negative values the following content will be shifted upwards.
52
 
53
  = How do I manually edit the height, mobile height, classes, and inline style on individual spacers? =
54
  Here's an example of how you could apply this:
63
 
64
  == Changelog ==
65
 
66
+ = 2.0.1 =
67
+ * Shortcode changed to use actual number (eg: [spacer height="20px"]), which will be easier to edit as you work
68
+ * 'Dismiss notice' link changed to red to make it more visible.
69
+ * Added compatibility with Beaver Page Builder's wysiswyg UI.
70
+
71
  = 2.0 =
72
  * Feature added: Choose to hide spacer on mobile devices, or choose a different spacer height for mobile.
73
  * Feature added: Manually edit mobile height, custom classes, and inline style for individual spacer elements.
 
74
  * Premium users: Speed up your workflow by setting a default height for your spacer. You can also set defaults for your spacer's custom classes and inline style.
75
 
76
  = 1.0 =
78
 
79
  == Upgrade Notice ==
80
 
81
+ = 2.0.1 =
82
+ New: Shortcode changed to use actual number (eg: [spacer height="20px"]), which will be easier to edit as you work. 'Dismiss notice' link changed to red to make it more visible. Added compatibility with Beaver Page Builder's wysiswyg UI.