Spacer - Version 3.0.1

Version Description

  • Fixed Spacer button bug, which prevented some users from seeing the dropdown list via the Spacer button
  • Added compatibility with Beaver Page Builder's wysiswyg UI
  • Fixed lack of trash icon in WP version 3.8.
  • Added live preview tool for Visual Artist
Download this release

Release Info

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

Code changes from version 3.0 to 3.0.1

editor_plugin.js CHANGED
@@ -1,67 +1,33 @@
1
  (function() {
2
-
3
- var button_name = 'motech_spacer'; //set button name
4
- //console.log(ajaxresponse);
5
- tinymce.PluginManager.add(button_name, function( editor, url ) {
6
- var self = this, button;
7
-
8
- /* function getMenu() {
9
- return editor.settings.myMenu;
10
- }*/
11
-
12
- editor.addButton( button_name, {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  title: 'Add a Spacer',
14
  type: 'menubutton',
15
  icon: 'icon motech_spacer_icon',
16
- onPostRender: function() {
17
- //this is a hack to get button refrence.
18
- //there may be a better way to do this
19
- var ctrl = this;
20
- jQuery.ajax({
21
- type: "POST",
22
- dataType: "json",
23
- //async: false,
24
- url: ajaxurl,
25
- data: {action: 'motech_spacer'},
26
- success: function(response) { //ajax response
27
- //modal.find('.modal-body').html(data); //insert the response.
28
- ajaxresponse = response;
29
-
30
- var menu_array = [];
31
- menu_array.push({
32
- text:"Default",
33
- onclick:function() {
34
- editor.insertContent('[spacer height="'+ajaxresponse["useheight"]+'"]');
35
- }
36
- });
37
- var addspacers = ajaxresponse["addspacers"];
38
- var index;
39
- if(ajaxresponse["addspacers"]){
40
- for (index = 0; index < addspacers.length; index++) {
41
- menu_array.push({
42
- text: addspacers[index]["title"],
43
- value: '[spacer height="'+addspacers[index]["height"]+'" id="'+addspacers[index]["id"]+'"]',
44
- onclick:function() {
45
- editor.insertContent(this.value());
46
- }
47
- });
48
- }
49
- }
50
-
51
- //Set new values to myKeyValueList
52
- ctrl.state.data.menu = ctrl.settings.menu = menu_array;
53
-
54
-
55
- }
56
- });
57
- }
58
-
59
  });
60
-
61
-
62
  });
63
-
64
-
65
-
66
-
67
  })();
1
  (function() {
2
+ var msdata = motech_spacer_prepjsbuttons;
3
+ tinymce.PluginManager.add('motech_spacer', function( editor, url ) {
4
+ var menu_array = [];
5
+
6
+ menu_array.push({
7
+ text:"Default",
8
+ value:'[spacer height="'+msdata["useheight"]+'"]',
9
+ onclick:function() {
10
+ editor.insertContent(this.value());
11
+ }
12
+ });
13
+
14
+ if(msdata.hasOwnProperty("addspacers")){
15
+ var index;
16
+ for (index = 0; index < msdata["addspacers"].length; index++) {
17
+
18
+ useval = msdata["addspacers"][index]["height"];
19
+ useid = msdata["addspacers"][index]["id"];
20
+ menu_array.push({text:msdata["addspacers"][index]["title"],value:'[spacer height="'+useval+'" id="'+useid+'"]',onclick : function(){
21
+ editor.insertContent(this.value());
22
+ }});
23
+ }
24
+ }
25
+
26
+ editor.addButton( 'motech_spacer', {
27
  title: 'Add a Spacer',
28
  type: 'menubutton',
29
  icon: 'icon motech_spacer_icon',
30
+ menu: menu_array
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  });
 
 
32
  });
 
 
 
 
33
  })();
editor_plugin_back.js CHANGED
@@ -1,75 +1,72 @@
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
- var menu_array = [];
12
- menu_array.push({
13
- text:"Default",
14
- value:'[spacer height="'+ajaxresponse["useheight"]+'"]',
15
- onclick:function() {
16
- tinyMCE.activeEditor.insertContent(this.value());
17
- }
18
- });
19
- var addspacers = ajaxresponse["addspacers"];
20
- var index;
21
- if(ajaxresponse["addspacers"]){
22
- for (index = 0; index < addspacers.length; index++) {
23
- menu_array.push({
24
- text: addspacers[index]["title"],
25
- value: '[spacer height="'+addspacers[index]["height"]+'" id="'+addspacers[index]["id"]+'"]',
26
- onclick:function() {
27
- tinyMCE.activeEditor.insertContent(this.value());
28
- }
29
- });
30
- }
31
- }
32
- //Call following code block from ajax success method
33
- //Set new values to myKeyValueList
34
- tinyMCE.activeEditor.settings.myKeyValueList = menu_array;
35
- //Call plugin method to reload the dropdown
36
- tinyMCE.activeEditor.plugins.motech_spacer.refresh();
37
 
38
- }
39
- });
40
 
41
- var button_name = 'motech_spacer'; //set button name
42
-
43
- tinymce.PluginManager.add(button_name, function( editor, url ) {
44
- var self = this, button;
45
 
46
- function getValues() {
47
- return editor.settings.myKeyValueList;
48
- }
49
- // Add a button that opens a window
50
- editor.addButton(button_name, {
51
- title: 'Add a Spacer',
52
- type: 'menubutton',
53
- icon: 'icon motech_spacer_icon',
54
- menu: getValues(),
55
- onPostRender: function() {
56
- //this is a hack to get button refrence.
57
- //there may be a better way to do this
58
- button = this;
59
- },
60
- });
61
 
62
- self.refresh = function() {
63
- //remove existing menu if it is already rendered
64
- if(button.menu){
65
- button.menu.remove();
66
- button.menu = null;
67
- }
68
 
69
- button.settings.menu = getValues();
70
- };
71
- });
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
 
 
 
 
 
74
 
75
- })();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
 
 
3
 
 
 
 
 
4
 
5
+ var button_name = 'motech_spacer'; //set button name
6
+ var msdata = motech_spacer_prepjsbuttons;
7
+ tinymce.create('tinymce.plugins.'+button_name, {
8
+ init : function(ed, url) {
9
+ ed.addButton(button_name, {
10
+ title : 'Add a Spacer', //set button label
11
+ //image : url+'/icon.png', //set icon filename (20 X 20px). put icon in same folder
12
+ icon: 'icon motech_spacer_icon',
13
+ onclick : function() {
 
 
 
 
 
 
14
 
15
+ ed.execCommand('mceInsertContent', false, '[spacer height="'+msdata["useheight"]+'"]');
16
+ },
17
+
18
+ });
19
+ },
 
20
 
21
+ createControl: function(n, cm) {
 
 
22
 
23
+ switch (n) {
24
+ case button_name:
25
+ var c = cm.createMenuButton(button_name, {
26
+ title : 'Add a Spacer',
27
+ //image : '/example_data/example.gif',
28
+ icons : false
29
+ });
30
+
31
+ c.onRenderMenu.add(function(c, m) {
32
+ m.add({title:"Default",onclick : function(){
33
+ tinyMCE.activeEditor.execCommand('mceInsertContent', false, '[spacer height="'+msdata["useheight"]+'"]' );
34
+ }});
35
+ if(msdata.hasOwnProperty("addspacers")){
36
+ var index;
37
+ for (index = 0; index < msdata["addspacers"].length; index++) {
38
+
39
+ useval = msdata["addspacers"][index]["height"];
40
+ useid = msdata["addspacers"][index]["id"];
41
+ m.add({title:msdata["addspacers"][index]["title"],value:'[spacer height="'+useval+'" id="'+useid+'"]',onclick : function(){
42
+ //console.log(my_shortcodes);
43
+ //console.log(this.value);
44
+ //console.log(msdata.addspacers.index);
45
+ tinyMCE.activeEditor.execCommand('mceInsertContent', false, this.value );
46
+ }});
47
+ }
48
+ }
49
 
50
+ });
51
+
52
+ // Return the new menu button instance
53
+ return c;
54
+ }
55
 
56
+ return null;
57
+ },
58
+ getInfo : function() {
59
+ return {
60
+ longname : button_name,
61
+ author : 'Justin Saad',
62
+ authorurl : 'http://clevelandwebdeveloper.com/',
63
+ infourl : 'http://clevelandwebdeveloper.com/',
64
+ version : "1.0"
65
+ };
66
+ }
67
+ });
68
+ tinymce.PluginManager.add(button_name, tinymce.plugins[button_name]);
69
+
70
+
71
+
72
+ });
editor_plugin_backback.js DELETED
@@ -1,72 +0,0 @@
1
- jQuery(document).ready(function($) {
2
-
3
-
4
-
5
- var button_name = 'motech_spacer'; //set button name
6
- var msdata = motech_spacer_prepjsbuttons;
7
- tinymce.create('tinymce.plugins.'+button_name, {
8
- init : function(ed, url) {
9
- ed.addButton(button_name, {
10
- title : 'Add a Spacer', //set button label
11
- //image : url+'/icon.png', //set icon filename (20 X 20px). put icon in same folder
12
- icon: 'icon motech_spacer_icon',
13
- onclick : function() {
14
-
15
- ed.execCommand('mceInsertContent', false, '[spacer height="'+msdata["useheight"]+'"]');
16
- },
17
-
18
- });
19
- },
20
-
21
- createControl: function(n, cm) {
22
-
23
- switch (n) {
24
- case button_name:
25
- var c = cm.createMenuButton(button_name, {
26
- title : 'Add a Spacer',
27
- //image : '/example_data/example.gif',
28
- icons : false
29
- });
30
-
31
- c.onRenderMenu.add(function(c, m) {
32
- m.add({title:"Default",onclick : function(){
33
- tinyMCE.activeEditor.execCommand('mceInsertContent', false, '[spacer height="'+msdata["useheight"]+'"]' );
34
- }});
35
- if(msdata.hasOwnProperty("addspacers")){
36
- var index;
37
- for (index = 0; index < msdata["addspacers"].length; index++) {
38
-
39
- useval = msdata["addspacers"][index]["height"];
40
- useid = msdata["addspacers"][index]["id"];
41
- m.add({title:msdata["addspacers"][index]["title"],value:'[spacer height="'+useval+'" id="'+useid+'"]',onclick : function(){
42
- //console.log(my_shortcodes);
43
- //console.log(this.value);
44
- //console.log(msdata.addspacers.index);
45
- tinyMCE.activeEditor.execCommand('mceInsertContent', false, this.value );
46
- }});
47
- }
48
- }
49
-
50
- });
51
-
52
- // Return the new menu button instance
53
- return c;
54
- }
55
-
56
- return null;
57
- },
58
- getInfo : function() {
59
- return {
60
- longname : button_name,
61
- author : 'Justin Saad',
62
- authorurl : 'http://clevelandwebdeveloper.com/',
63
- infourl : 'http://clevelandwebdeveloper.com/',
64
- version : "1.0"
65
- };
66
- }
67
- });
68
- tinymce.PluginManager.add(button_name, tinymce.plugins[button_name]);
69
-
70
-
71
-
72
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
editor_plugin_backbackback.js DELETED
@@ -1,47 +0,0 @@
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, {
18
- init : function(ed, url) {
19
- ed.addButton(button_name, {
20
- title : 'Add a Spacer', //set button label
21
- //image : url+'/icon.png', //set icon filename (20 X 20px). put icon in same folder
22
- icon: 'icon motech_spacer_icon',
23
- onclick : function() {
24
- //idPattern = /(?:(?:[^v]+)+v.)?([^&=]{11})(?=&|$)/;
25
- //var vidId = prompt("YouTube Video", "Enter the id or url for your video");
26
- //var m = idPattern.exec(vidId);
27
- //if (m != null && m != 'undefined')
28
- ed.execCommand('mceInsertContent', false, '[spacer height="'+ajaxresponse["useheight"]+'"]');
29
- }
30
- });
31
- },
32
- createControl : function(n, cm) {
33
- return null;
34
- },
35
- getInfo : function() {
36
- return {
37
- longname : button_name,
38
- author : 'Justin Saad',
39
- authorurl : 'http://clevelandwebdeveloper.com/',
40
- infourl : 'http://clevelandwebdeveloper.com/',
41
- version : "1.0"
42
- };
43
- }
44
- });
45
- tinymce.PluginManager.add(button_name, tinymce.plugins[button_name]);
46
-
47
- })();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
images/Thumbs.db ADDED
Binary file
images/dfa3.png DELETED
Binary file
index.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Spacer
5
  Plugin URI: http://www.clevelandwebdeveloper.com/wordpress-plugins/spacer
6
  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.
7
- Version: 3.0
8
  Author: Justin Saad
9
  Author URI: http://www.clevelandwebdeveloper.com
10
  License: GPL2
@@ -63,6 +63,8 @@ class motech_spacer {
63
  add_action('admin_init', array($this,'adminmessage_init'));
64
 
65
  add_action( 'admin_enqueue_scripts', array($this,'load_custom_wp_admin_style'), 50 );
 
 
66
  }
67
 
68
  //prepare plugin for localization
@@ -70,9 +72,10 @@ class motech_spacer {
70
  }
71
 
72
  function load_custom_wp_admin_style() {
73
-
74
- wp_register_style( 'mspacer_wp_admin_css', plugins_url( 'admin-style.css' , __FILE__ ), false, '1.0.0' );
75
- wp_enqueue_style( 'mspacer_wp_admin_css' );
 
76
  if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') { //if we are on our admin page
77
  wp_register_style( 'mspacer_wp_adminpage_css', plugins_url( 'adminpage-style.css' , __FILE__ ), false, '1.0.0' );
78
  wp_enqueue_style( 'mspacer_wp_adminpage_css' );
@@ -108,19 +111,19 @@ class motech_spacer {
108
  $user_id = get_current_user_id();
109
  //there is no default spacer height set, and nag message not ignored...
110
  //$checkdefault = get_option($this->plugin_slug . '_default_height_mobile','');
111
- if ( ( ! get_user_meta($user_id, 'spacer3029_nag_ignore') ) && (current_user_can( 'manage_options' )) ) {
112
  echo '<div id="message" class="updated fade notice"><p>';
113
- echo "<b>".__('You can now create an UNLIMITED amount of spacers, dividers, and section breaks! Give them names and save them for later. Put them to good use as you style your posts and pages. Oh yeah, you also get a live preview tool to help you visualize as you build. Enjoy!', 'motech-spacer')."</b>";
114
  echo "</p>";
115
- echo "<p><strong><a href=\"".get_bloginfo( 'wpurl' ) . "/wp-admin/options-general.php?page=".$this->plugin_slug."-setting-admin\" target=\"_parent\">".__('Create Spacers &raquo;', 'motech-spacer')."</a> | <a class=\"dismiss-notice\" style=\"color:red;\" href=\"".get_bloginfo( 'wpurl' ) . "/wp-admin/options-general.php?page=".$this->plugin_slug."-setting-admin&spacer3029_nag_ignore=0\" target=\"_parent\">".__('Stop bugging me', 'motech-spacer')." [X]</a></strong></p></div>";
116
  }
117
  }
118
 
119
  function adminmessage_init()
120
  {
121
- if ( isset($_GET['spacer3029_nag_ignore']) && '0' == $_GET['spacer3029_nag_ignore'] ) {
122
  $user_id = get_current_user_id();
123
- add_user_meta($user_id, 'spacer3029_nag_ignore', 'true', true);
124
  if (wp_get_referer()) {
125
  /* Redirects user to where they were before */
126
  wp_safe_redirect(wp_get_referer());
@@ -140,7 +143,7 @@ class motech_spacer {
140
  if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') {
141
  wp_enqueue_script( $this->plugin_slug.'-motech-javascript', plugins_url('js/motech-javascript.js', __FILE__ ), array('jquery'), false, true );
142
  }
143
- }
144
 
145
  function spacer_imageupload_script() {
146
  if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') {
@@ -325,9 +328,10 @@ function activespacer($id="") { #return attributes for active spacer based on id
325
  add_filter('mce_external_plugins', array($this, 'add_custom_tinymce_plugin'),99999999);
326
  add_filter('mce_buttons', array($this, 'register_custom_button'),99999999);
327
  global $wp_version;
328
- if($wp_version < 3.9){
329
- add_action('admin_head', array($this,'motech_spacer_prepjsbuttons'));
330
- }
 
331
  }
332
 
333
  }
@@ -340,12 +344,10 @@ function activespacer($id="") { #return attributes for active spacer based on id
340
  function add_custom_tinymce_plugin($plugin_array) {
341
  global $wp_version;
342
  //use this in a plugin
343
- if($wp_version >= 4.4){
344
- $plugin_array[get_class($this)] = plugins_url( 'editor_plugin.js' , __FILE__ );
345
- }elseif($wp_version >= 3.9){
346
- $plugin_array[get_class($this)] = plugins_url( 'editor_plugin_back.js' , __FILE__ );
347
  }else {
348
- $plugin_array[get_class($this)] = plugins_url( 'editor_plugin_backback.js' , __FILE__ );
349
  }
350
  //use this in a theme
351
  //$plugin_array[get_class($this)] = get_bloginfo('template_url').'/editor_plugin.js';
@@ -361,6 +363,7 @@ function activespacer($id="") { #return attributes for active spacer based on id
361
  $plugin = plugin_basename(__FILE__);
362
  if ($file == $plugin) // only for this plugin
363
  return array_merge( $links,
 
364
  array( '<a target="_blank" href="http://www.linkedin.com/in/ClevelandWebDeveloper/">' . __('Find me on LinkedIn', 'motech-spacer' ) . '</a>' ),
365
  array( '<a target="_blank" href="http://twitter.com/ClevelandWebDev">' . __('Follow me on Twitter', 'motech-spacer') . '</a>' )
366
  );
@@ -374,14 +377,14 @@ function activespacer($id="") { #return attributes for active spacer based on id
374
  <h2 class="aplabel"><?php echo $this->plugin_label ?></h2>
375
 
376
 
377
- <div id="green_ribbon" style="display:none;">
378
 
379
  <div id="green_ribbon_top">
380
  <div id="green_ribbon_left">
381
  </div>
382
  <div id="green_ribbon_base">
383
- <?php /*?><span id="hms_get_premium"><?php _e('NEW! Get Premium &raquo;', 'motech-spacer')?></span><?php */?>
384
- <?php /*?><span class="hms_get_premium_meta"><?php _e('Spacer Premium is now available for as low as $20!', 'motech-spacer')?></span><?php */?>
385
  </div>
386
  <div id="green_ribbon_right">
387
  </div>
@@ -399,7 +402,7 @@ function activespacer($id="") { #return attributes for active spacer based on id
399
  <button name="submit">
400
  <div class="purchase_graphic"><?php _e('Buy', 'motech-spacer')?> <span><?php _e('Unlimited', 'motech-spacer')?></span></div>
401
  <div class="purchase_bubble">
402
- <div class="purchase_price">$49</div>
403
  <div class="purchase_meta"><?php _e('Unlimited sites forever!', 'motech-spacer')?></div>
404
  </div>
405
  </button>
@@ -412,7 +415,7 @@ function activespacer($id="") { #return attributes for active spacer based on id
412
  <button name="submit">
413
  <div class="purchase_graphic"><?php _e('Buy 1 Use', 'motech-spacer')?></div>
414
  <div class="purchase_bubble">
415
- <div class="purchase_price">$19</div>
416
  <div class="purchase_meta"><?php _e('1 site license', 'motech-spacer')?></div>
417
  </div>
418
  </button>
@@ -437,9 +440,8 @@ function activespacer($id="") { #return attributes for active spacer based on id
437
  <a href="#admin-custom" class="nav-tab">Admin Customizations</a>
438
  <a href="#smtp" class="nav-tab">Smtp Settings</a><?php */?>
439
  </h2>
440
-
441
  <form method="post" action="options.php" class="<?php echo $this->plugin_slug ?>_form">
442
- <div class="mt_boxed leftside">
443
  <?php
444
  // This prints out all hidden setting fields
445
  settings_fields($this->plugin_slug.'_option_group');
@@ -515,7 +517,7 @@ function activespacer($id="") { #return attributes for active spacer based on id
515
  <div class="hiddenx" style="display:none;">
516
  <?php do_settings_sections($this->plugin_slug.'-setting-admin_hd_addspacers'.$key); ?>
517
  </div>
518
- <div class="removebutton"><span class="dashicons dashicons-trash"></span> <?php _e('REMOVE', 'motech-spacer') ?></div>
519
  </div>
520
  </div>
521
  <?php } ?>
@@ -526,7 +528,7 @@ function activespacer($id="") { #return attributes for active spacer based on id
526
  </div>
527
  <div id="addons" class="metabox-holder mainsection hidden wrap">
528
  <?php
529
- $actionbutton = '<a href="http://justinsaad.com/extensions/conditional-logic/?utm_medium=plugin&amp;utm_source=plugin-addons-page&amp;utm_campaign=Ninja+Forms+Addons+Page&amp;utm_content=Conditional+Logic" title="'.__('Buy Visual Artist', 'motech-spacer').'" class="button-primary msbutton buynowbutton">'.__('Buy Now', 'motech-spacer').'</a>';
530
  if( is_plugin_active( 'spacer-visual-artist/index.php' ) ) {
531
  $actionbutton = '<a href="javascript:void(0)" title="'.__('Active', 'motech-spacer').'" class="button-secondary msbutton">'.__('Active', 'motech-spacer').'</a>';
532
  } elseif( file_exists(plugin_dir_path(__FILE__) . '../spacer-visual-artist/index.php') ) {
@@ -541,23 +543,7 @@ if( is_plugin_active( 'spacer-visual-artist/index.php' ) ) {
541
  </div>
542
  </div>
543
  <div class="wrap"><div class="savebutton"><button type="submit"><span class="dashicons dashicons-yes"></span> <?php _e('SAVE CHANGES!', 'motech-spacer') ?></button></div></div>
544
- </div>
545
- <div class="mt_boxed rightside">
546
- <h3 style="margin-top:0px;"><?php _e('Spacer Add-Ons', 'motech-spacer') ?></h3>
547
- <img src="<?php echo plugins_url( 'images/dfa3.png' , __FILE__ ) ?>" style="cursor:pointer;" class="buynowbutton" />
548
- <div class="msaddon-buttons" style="margin-top: 12px;"><a href="http://www.clevelandwebdeveloper.com/?p=644&amp;utm_medium=plugin&amp;utm_source=plugin-settings-page&amp;utm_campaign=Spacers+Settings+Page&amp;utm_content=Spacer+Sidebar" target="_blank" class="button-secondary msdbutton" style="float:left;"><?php _e('Learn More', 'motech-spacer') ?></a><a href="javascript:void(0)" class="button-primary msbutton buynowbutton" style="float:right;"><?php _e('Buy Now', 'motech-spacer') ?></a></div>
549
- <div style="clear:both;"></div>
550
- <hr style="border:none;border-top:dotted 1px #f25a4b;margin: 30px 0;">
551
-
552
-
553
-
554
- <iframe width="290" height="163" src="https://www.youtube-nocookie.com/embed/43MFLibyFBU?rel=0" frameborder="0" style="margin-bottom:11px;" allowfullscreen></iframe>
555
- <strong><?php _e('Improve Your Layouts With Visual Artist</strong><br />Design fancy dividers, horizontal rules, and other ornate section breaks. Incorporate rich colors and images, all without mastering css.', 'motech-spacer') ?>
556
-
557
- </div>
558
-
559
  </form>
560
-
561
  </div>
562
  <?php
563
  }
@@ -1135,7 +1121,6 @@ if( is_plugin_active( 'spacer-visual-artist/index.php' ) ) {
1135
  }
1136
 
1137
 
1138
-
1139
  } // end create_a_text_input
1140
 
1141
  function create_a_textarea_input($args) {
@@ -1416,13 +1401,6 @@ if( is_plugin_active( 'spacer-visual-artist/index.php' ) ) {
1416
  .motech_premium_cancel {color:#626262;text-align:center;font-size:22px;margin-top:43px;}
1417
  .motech_premium_cancel span:hover {cursor:pointer;text-decoration:underline;}
1418
  .<?php echo $this->plugin_slug ?>_form > .form-table {max-width:770px;}
1419
- .motech_spacer_form {margin-right:310px;}
1420
- .mt_boxed.rightside { width: 290px;
1421
- margin-top: 35px;
1422
- float: right;
1423
- margin-right: -310px;}
1424
- .mt_boxed.leftside {padding: 0 20px 0 0; float: left; width: 100%;}
1425
-
1426
 
1427
 
1428
  /*css for the image picker*/
@@ -1458,11 +1436,7 @@ if( is_plugin_active( 'spacer-visual-artist/index.php' ) ) {
1458
  }
1459
  @media only screen and (max-width: 980px) {
1460
  .motech_purchase_button {display:block;margin-bottom: 80px;margin-right:0px;}
1461
- .motech_spacer_form {margin-right:0px;}
1462
- .mt_boxed.rightside {margin-right:0px;float:none;}
1463
- .mt_boxed.leftside {padding: 0px; float: none; width: 100%;}
1464
  }
1465
-
1466
  @media only screen and (max-width: 445px) {
1467
  .motech_premium_box h2 {font-size:22px;}
1468
  }
@@ -1501,9 +1475,18 @@ if( is_plugin_active( 'spacer-visual-artist/index.php' ) ) {
1501
  if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1502
  return $input;
1503
  }
1504
- if (!empty($input)) {
1505
- add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
 
 
 
 
 
 
 
 
1506
  }
 
1507
  }
1508
 
1509
  function po_px($input) {
@@ -1515,6 +1498,63 @@ if( is_plugin_active( 'spacer-visual-artist/index.php' ) ) {
1515
  }
1516
  }
1517
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1518
  function po_20($input) {
1519
  if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1520
  return $input;
@@ -1600,7 +1640,7 @@ if( is_plugin_active( 'spacer-visual-artist/index.php' ) ) {
1600
  jQuery(".motech_premium_cancel span").click(function(){
1601
  jQuery(".motech_premium_box").slideUp(200, function() {
1602
  // Animation complete.
1603
- jQuery("#green_ribbon").hide();
1604
  });
1605
 
1606
  });
@@ -1627,6 +1667,16 @@ if( is_plugin_active( 'spacer-visual-artist/index.php' ) ) {
1627
 
1628
  } //end class
1629
 
 
 
 
 
 
 
 
 
 
1630
  $class = new motech_spacer();
1631
 
1632
- add_action('init', array($class, 'add_custom_button'));
 
4
  Plugin Name: Spacer
5
  Plugin URI: http://www.clevelandwebdeveloper.com/wordpress-plugins/spacer
6
  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.
7
+ Version: 3.0.1
8
  Author: Justin Saad
9
  Author URI: http://www.clevelandwebdeveloper.com
10
  License: GPL2
63
  add_action('admin_init', array($this,'adminmessage_init'));
64
 
65
  add_action( 'admin_enqueue_scripts', array($this,'load_custom_wp_admin_style'), 50 );
66
+ } else{
67
+ add_action( 'wp_enqueue_scripts', array($this,'load_custom_wp_admin_style') );
68
  }
69
 
70
  //prepare plugin for localization
72
  }
73
 
74
  function load_custom_wp_admin_style() {
75
+ if ( current_user_can('edit_posts') or current_user_can('edit_pages') ) {
76
+ wp_register_style( 'mspacer_wp_admin_css', plugins_url( 'admin-style.css' , __FILE__ ), false, '1.0.0' );
77
+ wp_enqueue_style( 'mspacer_wp_admin_css' );
78
+ }
79
  if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') { //if we are on our admin page
80
  wp_register_style( 'mspacer_wp_adminpage_css', plugins_url( 'adminpage-style.css' , __FILE__ ), false, '1.0.0' );
81
  wp_enqueue_style( 'mspacer_wp_adminpage_css' );
111
  $user_id = get_current_user_id();
112
  //there is no default spacer height set, and nag message not ignored...
113
  //$checkdefault = get_option($this->plugin_slug . '_default_height_mobile','');
114
+ if ( ( ! get_user_meta($user_id, 'spacer3195_nag_ignore') ) && (current_user_can( 'manage_options' )) ) {
115
  echo '<div id="message" class="updated fade notice"><p>';
116
+ echo "<b>".__('You can now preview the Visual Artist tool for your Spacers. Check it out!', 'motech-spacer')."</b>";
117
  echo "</p>";
118
+ echo "<p><strong><a href=\"".get_bloginfo( 'wpurl' ) . "/wp-admin/options-general.php?page=".$this->plugin_slug."-setting-admin\" target=\"_parent\">".__('Create Spacers &raquo;', 'motech-spacer')."</a> | <a class=\"dismiss-notice\" style=\"color:red;\" href=\"".get_bloginfo( 'wpurl' ) . "/wp-admin/options-general.php?page=".$this->plugin_slug."-setting-admin&spacer3195_nag_ignore=0\" target=\"_parent\">".__('I got it. Thanks.', 'motech-spacer')." [X]</a></strong></p></div>";
119
  }
120
  }
121
 
122
  function adminmessage_init()
123
  {
124
+ if ( isset($_GET['spacer3195_nag_ignore']) && '0' == $_GET['spacer3195_nag_ignore'] ) {
125
  $user_id = get_current_user_id();
126
+ add_user_meta($user_id, 'spacer3195_nag_ignore', 'true', true);
127
  if (wp_get_referer()) {
128
  /* Redirects user to where they were before */
129
  wp_safe_redirect(wp_get_referer());
143
  if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') {
144
  wp_enqueue_script( $this->plugin_slug.'-motech-javascript', plugins_url('js/motech-javascript.js', __FILE__ ), array('jquery'), false, true );
145
  }
146
+ }
147
 
148
  function spacer_imageupload_script() {
149
  if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') {
328
  add_filter('mce_external_plugins', array($this, 'add_custom_tinymce_plugin'),99999999);
329
  add_filter('mce_buttons', array($this, 'register_custom_button'),99999999);
330
  global $wp_version;
331
+ //if($wp_version < 3.9){
332
+ add_action('admin_head', array($this,'motech_spacer_prepjsbuttons'));
333
+ add_action('wp_head', array($this,'motech_spacer_prepjsbuttons'));
334
+ //}
335
  }
336
 
337
  }
344
  function add_custom_tinymce_plugin($plugin_array) {
345
  global $wp_version;
346
  //use this in a plugin
347
+ if($wp_version >= 3.9){
348
+ $plugin_array[get_class($this)] = plugins_url( 'editor_plugin.js' , __FILE__ );
 
 
349
  }else {
350
+ $plugin_array[get_class($this)] = plugins_url( 'editor_plugin_back.js' , __FILE__ );
351
  }
352
  //use this in a theme
353
  //$plugin_array[get_class($this)] = get_bloginfo('template_url').'/editor_plugin.js';
363
  $plugin = plugin_basename(__FILE__);
364
  if ($file == $plugin) // only for this plugin
365
  return array_merge( $links,
366
+ array( '<a target="_blank" href="http://www.clevelandwebdeveloper.com/wordpress-plugins/spacer/">' . __('Project homepage', 'motech-spacer' ) . '</a>' ),
367
  array( '<a target="_blank" href="http://www.linkedin.com/in/ClevelandWebDeveloper/">' . __('Find me on LinkedIn', 'motech-spacer' ) . '</a>' ),
368
  array( '<a target="_blank" href="http://twitter.com/ClevelandWebDev">' . __('Follow me on Twitter', 'motech-spacer') . '</a>' )
369
  );
377
  <h2 class="aplabel"><?php echo $this->plugin_label ?></h2>
378
 
379
 
380
+ <div id="green_ribbon">
381
 
382
  <div id="green_ribbon_top">
383
  <div id="green_ribbon_left">
384
  </div>
385
  <div id="green_ribbon_base">
386
+ <span id="hms_get_premium"><?php _e('NEW! Get Premium &raquo;', 'motech-spacer')?></span>
387
+ <span class="hms_get_premium_meta"><?php _e('Visual Artist Add-On now available for as low as $20!', 'motech-spacer')?></span>
388
  </div>
389
  <div id="green_ribbon_right">
390
  </div>
402
  <button name="submit">
403
  <div class="purchase_graphic"><?php _e('Buy', 'motech-spacer')?> <span><?php _e('Unlimited', 'motech-spacer')?></span></div>
404
  <div class="purchase_bubble">
405
+ <div class="purchase_price">$50</div>
406
  <div class="purchase_meta"><?php _e('Unlimited sites forever!', 'motech-spacer')?></div>
407
  </div>
408
  </button>
415
  <button name="submit">
416
  <div class="purchase_graphic"><?php _e('Buy 1 Use', 'motech-spacer')?></div>
417
  <div class="purchase_bubble">
418
+ <div class="purchase_price">$20</div>
419
  <div class="purchase_meta"><?php _e('1 site license', 'motech-spacer')?></div>
420
  </div>
421
  </button>
440
  <a href="#admin-custom" class="nav-tab">Admin Customizations</a>
441
  <a href="#smtp" class="nav-tab">Smtp Settings</a><?php */?>
442
  </h2>
443
+
444
  <form method="post" action="options.php" class="<?php echo $this->plugin_slug ?>_form">
 
445
  <?php
446
  // This prints out all hidden setting fields
447
  settings_fields($this->plugin_slug.'_option_group');
517
  <div class="hiddenx" style="display:none;">
518
  <?php do_settings_sections($this->plugin_slug.'-setting-admin_hd_addspacers'.$key); ?>
519
  </div>
520
+ <div class="removebutton"><span class="dashicons dashicons-post-trash"></span> <?php _e('REMOVE', 'motech-spacer') ?></div>
521
  </div>
522
  </div>
523
  <?php } ?>
528
  </div>
529
  <div id="addons" class="metabox-holder mainsection hidden wrap">
530
  <?php
531
+ $actionbutton = '<a href="#" title="'.__('Buy Visual Artist', 'motech-spacer').'" class="button-primary msbutton buynowbutton">'.__('Buy Now', 'motech-spacer').'</a>';
532
  if( is_plugin_active( 'spacer-visual-artist/index.php' ) ) {
533
  $actionbutton = '<a href="javascript:void(0)" title="'.__('Active', 'motech-spacer').'" class="button-secondary msbutton">'.__('Active', 'motech-spacer').'</a>';
534
  } elseif( file_exists(plugin_dir_path(__FILE__) . '../spacer-visual-artist/index.php') ) {
543
  </div>
544
  </div>
545
  <div class="wrap"><div class="savebutton"><button type="submit"><span class="dashicons dashicons-yes"></span> <?php _e('SAVE CHANGES!', 'motech-spacer') ?></button></div></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
546
  </form>
 
547
  </div>
548
  <?php
549
  }
1121
  }
1122
 
1123
 
 
1124
  } // end create_a_text_input
1125
 
1126
  function create_a_textarea_input($args) {
1401
  .motech_premium_cancel {color:#626262;text-align:center;font-size:22px;margin-top:43px;}
1402
  .motech_premium_cancel span:hover {cursor:pointer;text-decoration:underline;}
1403
  .<?php echo $this->plugin_slug ?>_form > .form-table {max-width:770px;}
 
 
 
 
 
 
 
1404
 
1405
 
1406
  /*css for the image picker*/
1436
  }
1437
  @media only screen and (max-width: 980px) {
1438
  .motech_purchase_button {display:block;margin-bottom: 80px;margin-right:0px;}
 
 
 
1439
  }
 
1440
  @media only screen and (max-width: 445px) {
1441
  .motech_premium_box h2 {font-size:22px;}
1442
  }
1475
  if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1476
  return $input;
1477
  }
1478
+ if(is_array($input)){
1479
+ foreach($input as $val){
1480
+ if (!empty($val)) {
1481
+ add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1482
+ }
1483
+ }
1484
+ } else {
1485
+ if (!empty($input)) {
1486
+ add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1487
+ }
1488
  }
1489
+
1490
  }
1491
 
1492
  function po_px($input) {
1498
  }
1499
  }
1500
 
1501
+ function po_repeat($input) {
1502
+ if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1503
+ return $input;
1504
+ }
1505
+
1506
+ if(is_array($input)){
1507
+ foreach($input as $val){
1508
+ if ($val != "repeat") {
1509
+ add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1510
+ }
1511
+ }
1512
+ } else {
1513
+ if ((!empty($input))&&($input != "repeat")) {
1514
+ add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1515
+ }
1516
+ }
1517
+
1518
+ }
1519
+
1520
+ function po_solid($input) {
1521
+ if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1522
+ return $input;
1523
+ }
1524
+
1525
+ if(is_array($input)){
1526
+ foreach($input as $val){
1527
+ if ($val != "solid") {
1528
+ add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1529
+ }
1530
+ }
1531
+ } else {
1532
+ if ((!empty($input))&&($input != "solid")) {
1533
+ add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1534
+ }
1535
+ }
1536
+
1537
+ }
1538
+
1539
+ function po_none($input) {
1540
+ if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1541
+ return $input;
1542
+ }
1543
+
1544
+ if(is_array($input)){
1545
+ foreach($input as $val){
1546
+ if ($val != "none") {
1547
+ add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1548
+ }
1549
+ }
1550
+ } else {
1551
+ if ((!empty($input))&&($input != "none")) {
1552
+ add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1553
+ }
1554
+ }
1555
+
1556
+ }
1557
+
1558
  function po_20($input) {
1559
  if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1560
  return $input;
1640
  jQuery(".motech_premium_cancel span").click(function(){
1641
  jQuery(".motech_premium_box").slideUp(200, function() {
1642
  // Animation complete.
1643
+ //jQuery("#green_ribbon").hide();
1644
  });
1645
 
1646
  });
1667
 
1668
  } //end class
1669
 
1670
+ function load_sva() {
1671
+ if( !class_exists( 'spacer_layout_aid' ) ) {
1672
+
1673
+ include 'sva/sva.php';
1674
+
1675
+ }
1676
+ }
1677
+ add_action( 'plugins_loaded', 'load_sva' );
1678
+
1679
  $class = new motech_spacer();
1680
 
1681
+ add_action('init', array($class, 'add_custom_button'));
1682
+
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: 3.5
6
  Tested up to: 4.4
7
- Stable tag: 3.0
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -26,6 +26,11 @@ Spacer is also compatible with WordPress Multisite.
26
  <li>Choose which Spacer you want to add via the spacer button in the WYSIWYG visual editor.</li>
27
  </ul>
28
 
 
 
 
 
 
29
  == Installation ==
30
 
31
  1. From WP admin > Plugins > Add New
@@ -69,10 +74,10 @@ Try adding <code>margin-bottom: 25px;</code> to the Spacer's Style setting.
69
 
70
  == Screenshots ==
71
 
72
- 1. Live preview tool
 
73
  1. Create an arsenal of spacers and sectional breaks to have at your disposal as you lay out your pages.
74
  1. When writing your posts and pages, you can choose which Spacer you want to add via the Spacer button.
75
- 1. Showcasing some examples of Spacers and sectional breaks you can create.
76
  1. Spacer Button
77
  1. Setting the spacer height
78
  1. Spacer height: 35px
@@ -80,6 +85,12 @@ Try adding <code>margin-bottom: 25px;</code> to the Spacer's Style setting.
80
 
81
  == Changelog ==
82
 
 
 
 
 
 
 
83
  = 3.0 =
84
  * You can now create an arsenal of additional spacers and sectional breaks to have at your disposal as you lay out your pages.
85
  * Give your new Spacers names and save them for later.
@@ -109,5 +120,5 @@ Try adding <code>margin-bottom: 25px;</code> to the Spacer's Style setting.
109
 
110
  == Upgrade Notice ==
111
 
112
- = 3.0 =
113
- New: You can now create an unlimited amount of spacers, dividers, and section breaks! Give them names and save them for later. Put them to good use as your style your posts and pages. Oh yeah, you also get a live preview tool to help visualize the Spacers as you build them. Enjoy!
4
  Tags: spacer, spacing, line space
5
  Requires at least: 3.5
6
  Tested up to: 4.4
7
+ Stable tag: 3.0.1
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
26
  <li>Choose which Spacer you want to add via the spacer button in the WYSIWYG visual editor.</li>
27
  </ul>
28
 
29
+ More information at the <a href="http://www.clevelandwebdeveloper.com/wordpress-plugins/spacer/?utm_medium=wordpress_spacer_page&utm_source=description_tab&utm_campaign=readme&utm_content=Spacer+project+homepage">Spacer project homepage</a>.
30
+
31
+ <h4>Premium Add-on</h4>
32
+ <a href="http://www.clevelandwebdeveloper.com/wordpress-plugins/visual-artist/?utm_medium=wordpress_spacer_page&utm_source=description_tab&utm_campaign=readme&utm_content=Visual+Artist">Visual Artist</a> - gives you even more control over the look and feel of your text. Create fancy dividers without mastering css!
33
+
34
  == Installation ==
35
 
36
  1. From WP admin > Plugins > Add New
74
 
75
  == Screenshots ==
76
 
77
+ 1. In version 3, you can create fancy dividers to help organize your texts. These are helpful for breaking up paragraphs, chapters, distinct thoughts, etc
78
+ 1. Give your spacers descriptive names (like gray divider) to remember them later. Use the live preview tool to help as you build.
79
  1. Create an arsenal of spacers and sectional breaks to have at your disposal as you lay out your pages.
80
  1. When writing your posts and pages, you can choose which Spacer you want to add via the Spacer button.
 
81
  1. Spacer Button
82
  1. Setting the spacer height
83
  1. Spacer height: 35px
85
 
86
  == Changelog ==
87
 
88
+ = 3.0.1 =
89
+ * Fixed Spacer button bug, which prevented some users from seeing the dropdown list via the Spacer button
90
+ * Added compatibility with Beaver Page Builder's wysiswyg UI
91
+ * Fixed lack of trash icon in WP version 3.8.
92
+ * Added live preview tool for Visual Artist
93
+
94
  = 3.0 =
95
  * You can now create an arsenal of additional spacers and sectional breaks to have at your disposal as you lay out your pages.
96
  * Give your new Spacers names and save them for later.
120
 
121
  == Upgrade Notice ==
122
 
123
+ = 3.0.1 =
124
+ New: This update fixes the bug which prevented some users from seeing the dropdown list via the Spacer button. Also adds compatibility with Beaver Page Builder's wysiswyg UI and fixes lack of a trash icon in WP version 3.8. Finally, it adds a a live preview tool for Visual Artist. Enjoy!
sva/images/palette.png ADDED
Binary file
sva/js/motech-javascript.js ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($){
2
+
3
+ //perform function when element is clicked
4
+ $('body').on('click', '.wp-picker-clear', function() {
5
+ $(this).closest(".aspacerunit").find("input[name^='motech_spacer_default_border_top_width']").trigger("change");
6
+ });
7
+
8
+ jQuery("#motech_spacer_visualartist_license").after("<input type='hidden' name='motech_spacer_visualartist_license_av' id='motech_spacer_visualartist_license_av' value=0>");
9
+ //perform function when element is clicked
10
+ jQuery(".motech_spacer_visualartist_validate_alt").click(function(e){
11
+ e.preventDefault();
12
+ //console.log('hi');
13
+ var hmsp = prompt("Please enter your Visual Artist license", "");
14
+ if (hmsp!=null && hmsp!='') {
15
+ jQuery.ajax({
16
+ url: 'http://www.clevelandwebdeveloper.com/spacerl/vl_ajax.php',
17
+ data: {k: hmsp, w: window.location.href},
18
+ dataType: 'jsonp',
19
+ jsonp: 'callback',
20
+ jsonpCallback: 'jsonpCallback_motech_spacer_visualartist_license',
21
+ success: function(){
22
+ //
23
+ }
24
+ });
25
+ }
26
+
27
+ });
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+ //make sure this runs within jquery on dom ready. javascript file should be loaded before spacer core javascript file.
37
+ motechSpacerPreview.hooks.push(
38
+ function(spacerElement){
39
+ useImagePreviewElement = spacerElement.find("input[name^='motech_spacer_default_background_image_upload']");
40
+ if (typeof useImagePreviewElement !== 'undefined') {
41
+ useImagePreviewValue = useImagePreviewElement.first().val();
42
+ useImagePreviewElement.closest("tr").find(".motech_spacer_preview_image").css("background-image","url("+useImagePreviewValue+")");
43
+ }
44
+ useTopBorderWidth = spacerElement.find("input[name^='motech_spacer_default_border_top_width']").first().val();
45
+ useTopBorderStyle = spacerElement.find("select[name^='motech_spacer_default_border_top_style']").val();
46
+ useTopBorderColor = spacerElement.find("input[name^='motech_spacer_default_border_top_color']").val();
47
+ if ((typeof useTopBorderStyle !== 'undefined')) {
48
+ spacerElement.find(".spacer_preview").css( 'border-top-style',useTopBorderStyle );
49
+ }
50
+ if (typeof useTopBorderWidth !== 'undefined') {
51
+ if(!((typeof parseFloat(useTopBorderWidth) === 'number') && (parseFloat(useTopBorderWidth) >= 0))){
52
+ useTopBorderWidth = 0;
53
+ }
54
+ spacerElement.find(".spacer_preview").css( 'border-top-width',useTopBorderWidth+'px' );
55
+ }
56
+ if ((typeof useTopBorderColor !== 'undefined')) {
57
+ if(useTopBorderColor==""){
58
+ useTopBorderColor = "transparent";
59
+ }
60
+ spacerElement.find(".spacer_preview").css( 'border-top-color',useTopBorderColor );
61
+ }
62
+
63
+ useBottomBorderWidth = spacerElement.find("input[name^='motech_spacer_default_border_bottom_width']").first().val();
64
+ useBottomBorderStyle = spacerElement.find("select[name^='motech_spacer_default_border_bottom_style']").val();
65
+ useBottomBorderColor = spacerElement.find("input[name^='motech_spacer_default_border_bottom_color']").val();
66
+ if ((typeof useBottomBorderStyle !== 'undefined')) {
67
+ spacerElement.find(".spacer_preview").css( 'border-bottom-style',useBottomBorderStyle );
68
+ }
69
+ if (typeof useBottomBorderWidth !== 'undefined') {
70
+ if(!((typeof parseFloat(useBottomBorderWidth) === 'number') && (parseFloat(useBottomBorderWidth) >= 0))){
71
+ useBottomBorderWidth = 0;
72
+ }
73
+ spacerElement.find(".spacer_preview").css( 'border-bottom-width',useBottomBorderWidth+'px' );
74
+ }
75
+ if ((typeof useBottomBorderColor !== 'undefined')) {
76
+ if(useBottomBorderColor==""){
77
+ useBottomBorderColor = "transparent";
78
+ }
79
+ spacerElement.find(".spacer_preview").css( 'border-bottom-color',useBottomBorderColor );
80
+ }
81
+
82
+ useBgColor = spacerElement.find("input[name^='motech_spacer_default_bg_color']").val();
83
+ if ((typeof useBgColor !== 'undefined')&&(useBgColor!="")) {
84
+ spacerElement.find(".spacer_preview").css( 'background-color',useBgColor );
85
+ }
86
+
87
+ useBgImage = spacerElement.find("input[name^='motech_spacer_default_background_image_upload']").val();
88
+ if ((typeof useBgImage !== 'undefined')&&(useBgImage!="")) {
89
+ spacerElement.find(".spacer_preview").css( 'background-image','url("'+useBgImage+'")' );
90
+ }
91
+
92
+ useBgPosition = spacerElement.find("select[name^='motech_spacer_custom_background_image_position']").val();
93
+ if (typeof useBgPosition !== 'undefined') {
94
+ if(useBgPosition=="repeat"){
95
+ useBgPosition = {"background-repeat":"repeat"};
96
+ } else if(useBgPosition=="croptofit"){
97
+ useBgPosition = {"background-size":"cover","background-position":"center"};
98
+ } else if(useBgPosition=="stretch"){
99
+ useBgPosition = {"background-size":"100% 100%","background-repeat":"no-repeat","background-position":"center"};
100
+ } else if(useBgPosition=="propstretch"){
101
+ useBgPosition = {"background-size":"contain","background-repeat":"no-repeat","background-position":"center"};
102
+ }else if(useBgPosition=="proprepeat"){
103
+ useBgPosition = {"background-size":"contain","background-repeat":"repeat","background-position":"center"};
104
+ }
105
+ spacerElement.find(".spacer_preview").css( useBgPosition );
106
+ }
107
+
108
+ useBottomMargin = spacerElement.find("input[name^='motech_spacer_default_bottom_margin']").first().val();
109
+ if (typeof useBottomMargin !== 'undefined') {
110
+ if(((typeof parseFloat(useBottomMargin) === 'number'))){
111
+ spacerElement.find(".spacer_preview").css( 'margin-bottom',useBottomMargin+'px' );
112
+ }
113
+ }
114
+
115
+ useShadow = spacerElement.find("select[name^='motech_spacer_default_shadow']").val();
116
+ if ((typeof useShadow !== 'undefined')&&(useShadow!="none")) {
117
+ if(useShadow=="light"){
118
+ useShadow = {"box-shadow":"0px 2px 3px rgba(119, 119, 119,0.5)"};
119
+ } else if(useShadow=="medium"){
120
+ useShadow = {"box-shadow":"0px 2px 4px #777"};
121
+ } else if(useShadow=="heavy"){
122
+ useShadow = {"box-shadow":"0px 2px 10px #888"};
123
+ }
124
+ spacerElement.find(".spacer_preview").css( useShadow );
125
+ }
126
+
127
+
128
+
129
+ }
130
+ );
131
+
132
+ });
133
+
134
+ function jsonpCallback_motech_spacer_visualartist_license(data){
135
+ if(data.r == "vle"){
136
+ jQuery("#motech_spacer_visualartist_license_av").val(1);
137
+ jQuery(".savebutton button").click();
138
+ } else {
139
+ alert(data.error);
140
+ }
141
+ }
142
+
sva/sva.php ADDED
@@ -0,0 +1,911 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $sva_plugin_label = "Spacer - Visual Artist";
4
+ $sva_plugin_slug = "spacer_layout_aid_preview";
5
+
6
+ class spacer_layout_aid_preview {
7
+
8
+ public function __construct(){
9
+
10
+ global $sva_plugin_label, $plugin_slug;
11
+ $this->sva_plugin_slug = $plugin_slug;
12
+ $this->sva_plugin_label = $sva_plugin_label;
13
+
14
+ $checkaddspacers = get_option("motech_spacer_addspacer_id");
15
+ if(!empty($checkaddspacers)){
16
+ $this->key_array = $checkaddspacers;
17
+ $this->has_addspacers = true;
18
+ }else{
19
+ $this->key_array = array(0);
20
+ $this->has_addspacers = false;
21
+ }
22
+
23
+ $this->ihmsa = 'hmsia';
24
+
25
+
26
+
27
+ //uncomment the following line to enqueue color picker
28
+ //add_action( 'admin_enqueue_scripts', array($this, 'enqueue_color_picker') );
29
+
30
+ //uncomment following line to add extra plugin row links under plugin description
31
+ //add_filter( 'plugin_row_meta', array($this,'plugin_row_links'), 10, 2 );
32
+
33
+ add_filter('spacer_add_css', array($this,'spacer_add_css'),50,2);
34
+
35
+ add_filter('spacer_add_to_default', array($this,'spacer_add_to_default'),50);
36
+ add_filter('spacer_add_to_extras', array($this,'spacer_add_to_extras'),50,2);
37
+
38
+ if(is_admin()){
39
+
40
+ //uncomment following line to add Settings link to plugin page
41
+ //add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array($this, 'add_plugin_action_links') );
42
+
43
+ //uncomment following line to add admin notices
44
+ //add_action( 'admin_notices', array($this, 'admin_notices') );
45
+
46
+ //add_action('admin_menu', array($this, 'add_plugin_page'));
47
+ //add_action('admin_init', array($this, 'page_init'));
48
+ //add_filter('spacer_licenses_settings', array($this,'add_layout_licenses_section'),50,2);
49
+
50
+ add_action( 'admin_enqueue_scripts', array($this, 'enqueue_motech_javascript'), 10 ); //enqueue color picker. set this to a number lower than 50, so it will load before spacer javascript.
51
+ add_filter('spacer_default_settings', array($this,'add_layout_aid_section'),50,2);
52
+ if($this->ihmsa == 'hmsia'){
53
+ add_filter('spacer_default_sections', array($this,'add_layout_aid_section_container'),50,2);
54
+ }
55
+ add_filter('spacer_add_to_admincss', array($this,'spacer_add_to_admincss'),50);
56
+ if($this->ihmsa == 'hmsia'){
57
+ add_action( 'admin_enqueue_scripts', array($this,'load_custom_wp_admin_style'), 60 ); //set this to a number higher than 50, so it will load after spacer core
58
+ }
59
+ $key_array = $this->key_array;
60
+ $getoption = get_option($this->sva_plugin_slug.'_title_addspacers','');
61
+ if($this->ihmsa == 'hmsia'){
62
+ foreach($key_array as $key=>$value){
63
+ add_filter('spacer_addspacer_sections'.$key, array($this,'add_layout_aid_addspacer_section_container'),50,2);
64
+ }
65
+ }
66
+ }
67
+
68
+ }
69
+
70
+ function load_custom_wp_admin_style() {
71
+
72
+ //wp_register_style( 'mspacerlayout_wp_admin_css', plugins_url( 'admin-style.css' , __FILE__ ), false, '1.0.0' );
73
+ //wp_enqueue_style( 'mspacerlayout_wp_admin_css' );
74
+ }
75
+
76
+ function spacer_add_to_admincss($val){
77
+ ?>
78
+ <style>
79
+ <?php if ($this->ihmsa == 'hmsia') { ?> #motech_spacer_visualartist_license{display:none;} <?php } ?>
80
+ /*css for column box - move to add on css via hook instead */
81
+ .columnbox { background: #fff;
82
+ padding: 0 8px;
83
+ margin-bottom: 9px;
84
+ outline: 0;
85
+ margin: 10px 0 0;
86
+ border: 1px solid #e5e5e5;
87
+ -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.04);
88
+ box-shadow: 0 1px 1px rgba(0,0,0,.04); float: left; width: 21%;margin-right:16px;overflow:hidden;}
89
+
90
+ .columnbox h2,.postbox .inside .columnbox h2 {
91
+ background: #fafafa;
92
+ color: #23282d;
93
+ margin: 0;
94
+ padding: 15px;
95
+ font-size: 1em;
96
+ line-height: 1;
97
+ overflow: hidden;
98
+ white-space: nowrap;
99
+ text-overflow: ellipsis;
100
+ padding-left: 9px;
101
+ margin-left: -10px;
102
+ border-bottom: 1px solid #e5e5e5;
103
+ margin-right: -10px;
104
+ font-weight:600;
105
+ }
106
+
107
+ .columnbox .form-table th {font-weight: normal; }
108
+ .columnbox .form-table td { padding-left: 0px;}
109
+ .addspacerunit .columnbox { background: #fafafa;}
110
+ .addspacerunit .columnbox h2, .addspacerunit .postbox .inside .columnbox h2 {background:white;}
111
+ .motech_spacer_preview_image_container {display:none;}
112
+ .wp-picker-holder {position:absolute;}
113
+
114
+ @media only screen and (max-width: 1370px) {
115
+ .columnbox input[type="text"], .columnbox select {max-width:50%;}
116
+ .columnbox {width:auto;float:none;margin-right:0px;}
117
+ }
118
+
119
+ @media only screen and (max-width: 1050px) {
120
+ .columnbox {width:auto;float:none;margin-right:0px;}
121
+ }
122
+ </style>
123
+ <?php
124
+ }
125
+
126
+ function spacer_add_to_default($return) {
127
+ //return is an array like $return["checkheight"], we want to add elements to it
128
+ $return["bgcolor"] = get_option('motech_spacer_default_bg_color');
129
+ $return["bgimage"] = get_option('motech_spacer_default_background_image_upload');
130
+ $return["bordertopwidth"] = get_option('motech_spacer_default_border_top_width');
131
+ $return["bordertopstyle"] = get_option('motech_spacer_default_border_top_style');
132
+ $return["bordertopcolor"] = get_option('motech_spacer_default_border_top_color');
133
+ $return["borderbottomwidth"] = get_option('motech_spacer_default_border_bottom_width');
134
+ $return["borderbottomstyle"] = get_option('motech_spacer_default_border_bottom_style');
135
+ $return["borderbottomcolor"] = get_option('motech_spacer_default_border_bottom_color');
136
+ $return["bottommargin"] = get_option('motech_spacer_default_bottom_margin');
137
+ $return["shadow"] = get_option('motech_spacer_default_shadow');
138
+ $return["bgimageposition"] = get_option('motech_spacer_custom_background_image_position');
139
+
140
+ //$spacer_css .= "background:red;";
141
+ return $return;
142
+ }
143
+
144
+ function spacer_add_to_extras($return,$key) {
145
+ $get = get_option('motech_spacer_default_bg_color_addspacers');
146
+ $return["bgcolor"] = $get[$key];
147
+
148
+ $get = get_option('motech_spacer_default_background_image_upload_addspacers');
149
+ $return["bgimage"] = $get[$key];
150
+
151
+ $get = get_option('motech_spacer_default_border_top_width_addspacers');
152
+ $return["bordertopwidth"] = $get[$key];
153
+
154
+ $get = get_option('motech_spacer_default_border_top_style_addspacers');
155
+ $return["bordertopstyle"] = $get[$key];
156
+
157
+ $get = get_option('motech_spacer_default_border_top_color_addspacers');
158
+ $return["bordertopcolor"] = $get[$key];
159
+
160
+ $get = get_option('motech_spacer_default_border_bottom_width_addspacers');
161
+ $return["borderbottomwidth"] = $get[$key];
162
+
163
+ $get = get_option('motech_spacer_default_border_bottom_style_addspacers');
164
+ $return["borderbottomstyle"] = $get[$key];
165
+
166
+ $get = get_option('motech_spacer_default_border_bottom_color_addspacers');
167
+ $return["borderbottomcolor"] = $get[$key];
168
+
169
+ $get = get_option('motech_spacer_default_bottom_margin_addspacers');
170
+ $return["bottommargin"] = $get[$key];
171
+
172
+ $get = get_option('motech_spacer_default_shadow_addspacers');
173
+ $return["shadow"] = $get[$key];
174
+
175
+ $get = get_option('motech_spacer_custom_background_image_position_addspacers');
176
+ $return["bgimageposition"] = $get[$key];
177
+
178
+ //$spacer_css .= "background:red;";
179
+ return $return;
180
+ }
181
+
182
+
183
+ function use_shadow($shadow){
184
+ if($shadow=="light"){
185
+ return "box-shadow:0px 2px 3px rgba(119, 119, 119,0.5);";
186
+ }elseif($shadow=="medium"){
187
+ return "box-shadow:0px 2px 4px #777;";
188
+ }elseif($shadow=="heavy"){
189
+ return "box-shadow:0px 2px 10px #888;";
190
+ }
191
+
192
+ }
193
+
194
+ function use_bgimageposition($bgimageposition){
195
+ if($bgimageposition=="repeat"){
196
+ return "background-repeat:repeat;";
197
+ }elseif($bgimageposition=="croptofit"){
198
+ return "background-size:cover;background-position:center;";
199
+ }elseif($bgimageposition=="stretch"){
200
+ return "background-size:100% 100%;background-repeat:no-repeat;background-position:center;";
201
+ }elseif($bgimageposition=="propstretch"){
202
+ return "background-size:contain;background-repeat:no-repeat;background-position:center;";
203
+ }elseif($bgimageposition=="proprepeat"){
204
+ return "background-size:contain;background-repeat:repeat;background-position:center;";
205
+ }
206
+
207
+ }
208
+
209
+ function spacer_add_css($spacer_css,$activespacer) {
210
+
211
+ extract($activespacer);
212
+
213
+ if(!empty($bgcolor)) {
214
+ $spacer_css .= "background-color:".$bgcolor.";";
215
+ }
216
+ if(!empty($bgimage)) {
217
+ $spacer_css .= "background-image:url(".$bgimage.");";
218
+ }
219
+ if(!empty($bordertopstyle)) {
220
+ $spacer_css .= "border-top-style:".$bordertopstyle.";";
221
+ }
222
+ if(!empty($bordertopwidth)) {
223
+ $spacer_css .= "border-top-width:".$bordertopwidth."px;";
224
+ } else{
225
+ $spacer_css .= "border-top-width:0px;";
226
+ }
227
+ if(!empty($bordertopcolor)) {
228
+ $spacer_css .= "border-top-color:".$bordertopcolor.";";
229
+ }
230
+ if(!empty($borderbottomwidth)) {
231
+ $spacer_css .= "border-bottom-width:".$borderbottomwidth."px;";
232
+ }else{
233
+ $spacer_css .= "border-bottom-width:0px;";
234
+ }
235
+ if(!empty($borderbottomstyle)) {
236
+ $spacer_css .= "border-bottom-style:".$borderbottomstyle.";";
237
+ }
238
+ if(!empty($borderbottomcolor)) {
239
+ $spacer_css .= "border-bottom-color:".$borderbottomcolor.";";
240
+ }
241
+ if(!empty($bottommargin)) {
242
+ $spacer_css .= "margin-bottom:".$bottommargin."px;";
243
+ }
244
+ if(!empty($shadow)) {
245
+ $spacer_css .= $this->use_shadow($shadow);
246
+ }
247
+ if(!empty($bgimageposition)) {
248
+ $spacer_css .= $this->use_bgimageposition($bgimageposition);
249
+ }
250
+
251
+ //imaqe position
252
+
253
+ return $spacer_css;
254
+ }
255
+
256
+ function enqueue_motech_javascript( ) {
257
+ if (isset($_GET['page']) && $_GET['page'] == 'motech_spacer-setting-admin') {
258
+ wp_enqueue_script( $this->sva_plugin_slug.'-motech-javascript2', plugins_url('js/motech-javascript.js', __FILE__ ), array('jquery'), false, true );
259
+ }
260
+ }
261
+
262
+
263
+ function add_layout_aid_section_container($val,$object){
264
+ ?>
265
+ <div class="motech-spacer-options section layoutaid" style="border-top: solid 1px #BFBFBF;margin-top: 3px;">
266
+ <div class="postbox closed" style="margin-top:20px;margin-bottom:12px;">
267
+ <button type="button" class="handlediv button-link" aria-expanded="true"><span class="toggle-indicator" aria-hidden="true"></span></button>
268
+ <h2 class="hndle ui-sortable-handle" style="font-size: 1.3em;font-weight: bold;padding-left: 51px;position: relative;"><img style="position: absolute;top: -1px;width: 42px;left: 7px;" src="<?php echo plugins_url('images/palette.png', __FILE__ ) ?>" /><span><?php _e('Visual Artist', 'spacer-layout-aid') ?><?php echo $object->get_premium_warning() ?></span></h2>
269
+ <div class="inside">
270
+ <div class="columnbox"><h2><?php _e('Background', 'spacer-layout-aid') ?></h2><?php do_settings_sections($object->plugin_slug.'-setting-admin_layoutaidbg'); ?></div>
271
+ <div class="columnbox"><h2><?php _e('Top Border', 'spacer-layout-aid') ?></h2><?php do_settings_sections($object->plugin_slug.'-setting-admin_layoutaidtb'); ?></div>
272
+ <div class="columnbox"><h2><?php _e('Bottom Border', 'spacer-layout-aid') ?></h2><?php do_settings_sections($object->plugin_slug.'-setting-admin_layoutaidbb'); ?></div>
273
+ <div class="columnbox" style="margin-right:0px;"><h2><?php _e('Other', 'spacer-layout-aid') ?></h2><?php do_settings_sections($object->plugin_slug.'-setting-admin_layoutaidother'); ?></div>
274
+ <div style="clear:both;"></div>
275
+ </div>
276
+ </div>
277
+ </div>
278
+ <?php
279
+ }
280
+
281
+ function add_layout_aid_addspacer_section_container($val,$key){
282
+ ?>
283
+ <div class="motech-spacer-options section layoutaid aslayoutaid" style="border-top: solid 1px #eee;margin-top: 3px;">
284
+ <?php /*?><?php do_settings_sections('motech_spacer-setting-admin_layoutaid_addspacer'.$key); ?><?php */?>
285
+ <div class="postbox closed" style="margin-top:20px;margin-bottom:12px;background: #fafafa;">
286
+ <button type="button" class="handlediv button-link" aria-expanded="true"><span class="toggle-indicator" aria-hidden="true"></span></button>
287
+ <h2 class="hndle ui-sortable-handle" style="font-size: 1.3em;font-weight: bold;padding-left: 51px;position: relative;"><img style="position: absolute;top: -1px;width: 42px;left: 7px;" src="<?php echo plugins_url('images/palette.png', __FILE__ ) ?>" /><span><?php _e('Visual Artist', 'spacer-layout-aid') ?><?php echo '<span class="motech_premium_only"> ('.__('Premium Only', 'motech-spacer').')</span>'?></span></h2>
288
+ <div class="inside">
289
+ <div class="columnbox"><h2><?php _e('Background', 'spacer-layout-aid') ?></h2><?php do_settings_sections('motech_spacer-setting-admin_layoutaidbg_addspacer'.$key); ?></div>
290
+ <div class="columnbox"><h2><?php _e('Top Border', 'spacer-layout-aid') ?></h2><?php do_settings_sections('motech_spacer-setting-admin_layoutaidtb_addspacer'.$key); ?></div>
291
+ <div class="columnbox"><h2><?php _e('Bottom Border', 'spacer-layout-aid') ?></h2><?php do_settings_sections('motech_spacer-setting-admin_layoutaidbb_addspacer'.$key); ?></div>
292
+ <div class="columnbox" style="margin-right:0px;"><h2><?php _e('Other', 'spacer-layout-aid') ?></h2><?php do_settings_sections('motech_spacer-setting-admin_layoutaidother_addspacer'.$key); ?></div>
293
+ <div style="clear:both;"></div>
294
+ </div>
295
+ </div>
296
+ </div>
297
+ <?php
298
+ }
299
+
300
+
301
+
302
+ function add_layout_licenses_section($val,$object){
303
+ //update_option('motech_spacer_visualartist_license','');
304
+ //update_option('motech_spacer_visualartist_ihmsa','');
305
+ //add text input field
306
+ $field_slug = "visualartist_license";
307
+ $field_label = __('Visual Artist Key', 'spacer-layout-aid');
308
+ $field_id = $object->plugin_slug.'_'.$field_slug;
309
+ //register_setting($object->plugin_slug.'_option_group', $field_id);
310
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($this, 'license_v'));
311
+ if ($this->ihmsa == 'hmsia') {
312
+ $desc = "<div class='mvalid'>".__('Valid', 'spacer-layout-aid')."</div>";
313
+ } else {
314
+ //$desc = "Enter your license key to unlock premium features. <a href='#' class='hms_validate_alt'>Alernative Method</a>";
315
+ $desc = __("You will find this included with your purchase email. If this doesn't work, try the <a href='#' class='motech_spacer_visualartist_validate_alt'>Alternative Method</a>", "spacer-layout-aid");
316
+ }
317
+ add_settings_field(
318
+ $field_id,
319
+ $field_label,
320
+ array($object, 'create_a_text_input'), //callback function for text input
321
+ $object->plugin_slug.'-setting-admin_licenses',
322
+ $object->plugin_slug.'_setting_section',
323
+ array( // The array of arguments to pass to the callback.
324
+ "id" => $field_id, //sends field id to callback
325
+ //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
326
+ //"placeholder" => __('5', 'spacer-layout-aid'),
327
+ "desc" => $desc,
328
+ "default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
329
+ )
330
+ );
331
+ }
332
+
333
+ function add_layout_aid_section($val,$object){
334
+
335
+ add_settings_section(
336
+ $object->plugin_slug.'_setting_section',
337
+ __('', 'spacer-layout-aid'),
338
+ false,
339
+ $object->plugin_slug.'-setting-admin_layoutaidbg'
340
+ );
341
+
342
+ add_settings_section(
343
+ $object->plugin_slug.'_setting_section',
344
+ __('', 'spacer-layout-aid'),
345
+ false,
346
+ $object->plugin_slug.'-setting-admin_layoutaidtb'
347
+ );
348
+
349
+ add_settings_section(
350
+ $object->plugin_slug.'_setting_section',
351
+ __('', 'spacer-layout-aid'),
352
+ false,
353
+ $object->plugin_slug.'-setting-admin_layoutaidbb'
354
+ );
355
+
356
+ add_settings_section(
357
+ $object->plugin_slug.'_setting_section',
358
+ __('', 'spacer-layout-aid'),
359
+ false,
360
+ $object->plugin_slug.'-setting-admin_layoutaidother'
361
+ );
362
+
363
+ //add color picker text input field
364
+ $field_slug = "default_bg_color";
365
+ $field_label = __('Color', 'spacer-layout-aid');
366
+ $field_id = $object->plugin_slug.'_'.$field_slug;
367
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
368
+ add_settings_field(
369
+ $field_id,
370
+ $field_label,
371
+ array($object, 'create_a_text_input'), //callback function for text input
372
+ $object->plugin_slug.'-setting-admin_layoutaidbg',
373
+ $object->plugin_slug.'_setting_section',
374
+ array( // The array of arguments to pass to the callback.
375
+ "id" => $field_id, //sends field id to callback
376
+ //"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
377
+ "default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
378
+ "class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
379
+ )
380
+ );
381
+
382
+ //add image upload field
383
+ $field_slug = "default_background_image_upload";
384
+ $field_label = "Image";
385
+ $field_id = $object->plugin_slug.'_'.$field_slug;
386
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
387
+ add_settings_field(
388
+ $field_id, // ID of the option
389
+ $field_label, // Title of the option
390
+ array($object, 'create_image_upload'), // Callback used to render the input field
391
+ $object->plugin_slug.'-setting-admin_layoutaidbg', // Page to associate this option with
392
+ $object->plugin_slug.'_setting_section', // Section to associate this option with
393
+ array( // The array of arguments to pass to the callback.
394
+ "id" => $field_id //sends field id to callback
395
+ )
396
+ );
397
+
398
+ //add an image select input field
399
+ $field_slug = "custom_background_image_position";
400
+ $field_label = "Image Position";
401
+ $field_id = $object->plugin_slug.'_'.$field_slug;
402
+ $object->back_options = array(
403
+ array("label" => "Repeat", "value" => "repeat"),
404
+ array("label" => "Proportional Stretch", "value" => "propstretch"),
405
+ array("label" => "Proportional Repeat", "value" => "proprepeat"),
406
+ array("label" => "Crop to Fit", "value" => "croptofit"),
407
+ array("label" => "Stretch", "value" => "stretch")
408
+ );
409
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_repeat'));
410
+ add_settings_field(
411
+ $field_id,
412
+ $field_label,
413
+ array($object, 'create_a_select_input'), //callback function for select input
414
+ $object->plugin_slug.'-setting-admin_layoutaidbg',
415
+ $object->plugin_slug.'_setting_section',
416
+ array( // The array of arguments to pass to the callback.
417
+ "id" => $field_id, //sends select field id to callback
418
+ "default" => 'repeat', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
419
+ "select_options" => $object->back_options //sets select option data
420
+ )
421
+ );
422
+
423
+ //add text input field
424
+ $field_slug = "default_border_top_width";
425
+ $field_label = __('Width (px)', 'spacer-layout-aid');
426
+ $field_id = $object->plugin_slug.'_'.$field_slug;
427
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
428
+ add_settings_field(
429
+ $field_id,
430
+ $field_label,
431
+ array($object, 'create_a_text_input'), //callback function for text input
432
+ $object->plugin_slug.'-setting-admin_layoutaidtb',
433
+ $object->plugin_slug.'_setting_section',
434
+ array( // The array of arguments to pass to the callback.
435
+ "id" => $field_id, //sends field id to callback
436
+ //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
437
+ "placeholder" => __('eg: 5', 'spacer-layout-aid'),
438
+ "default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
439
+ )
440
+ );
441
+
442
+ //add a select input field
443
+ $field_slug = "default_border_top_style";
444
+ $field_label = __('Style', 'spacer-layout-aid');
445
+ $field_id = $object->plugin_slug.'_'.$field_slug;
446
+ $object->unit_options = array(
447
+ array("label" => "Solid", "value" => "solid"),
448
+ array("label" => "Dotted", "value" => "dotted"),
449
+ array("label" => "Dashed", "value" => "dashed"),
450
+ array("label" => "Double", "value" => "double"),
451
+ array("label" => "Groove", "value" => "groove"),
452
+ array("label" => "Inset", "value" => "inset"),
453
+ array("label" => "Outset", "value" => "outset"),
454
+ );
455
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_solid'));
456
+ add_settings_field(
457
+ $field_id,
458
+ $field_label,
459
+ array($object, 'create_a_select_input'), //callback function for select input
460
+ $object->plugin_slug.'-setting-admin_layoutaidtb',
461
+ $object->plugin_slug.'_setting_section',
462
+ array( // The array of arguments to pass to the callback.
463
+ "id" => $field_id, //sends select field id to callback
464
+ "default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
465
+ "meta" => 'style="max-width:450px;"',
466
+ "select_options" => $object->unit_options //sets select option data
467
+ )
468
+ );
469
+
470
+ //add color picker text input field
471
+ $field_slug = "default_border_top_color";
472
+ $field_label = __('Color', 'spacer-layout-aid');
473
+ $field_id = $object->plugin_slug.'_'.$field_slug;
474
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
475
+ add_settings_field(
476
+ $field_id,
477
+ $field_label,
478
+ array($object, 'create_a_text_input'), //callback function for text input
479
+ $object->plugin_slug.'-setting-admin_layoutaidtb',
480
+ $object->plugin_slug.'_setting_section',
481
+ array( // The array of arguments to pass to the callback.
482
+ "id" => $field_id, //sends field id to callback
483
+ //"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
484
+ "default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
485
+ "class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
486
+ )
487
+ );
488
+
489
+ //add text input field
490
+ $field_slug = "default_border_bottom_width";
491
+ $field_label = __('Width (px)', 'spacer-layout-aid');
492
+ $field_id = $object->plugin_slug.'_'.$field_slug;
493
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
494
+ add_settings_field(
495
+ $field_id,
496
+ $field_label,
497
+ array($object, 'create_a_text_input'), //callback function for text input
498
+ $object->plugin_slug.'-setting-admin_layoutaidbb',
499
+ $object->plugin_slug.'_setting_section',
500
+ array( // The array of arguments to pass to the callback.
501
+ "id" => $field_id, //sends field id to callback
502
+ //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
503
+ "placeholder" => __('eg: 5', 'spacer-layout-aid'),
504
+ "default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
505
+ )
506
+ );
507
+
508
+ //add a select input field
509
+ $field_slug = "default_border_bottom_style";
510
+ $field_label = __('Style', 'spacer-layout-aid');
511
+ $field_id = $object->plugin_slug.'_'.$field_slug;
512
+ $object->unit_options = array(
513
+ array("label" => "Solid", "value" => "solid"),
514
+ array("label" => "Dotted", "value" => "dotted"),
515
+ array("label" => "Dashed", "value" => "dashed"),
516
+ array("label" => "Double", "value" => "double"),
517
+ array("label" => "Groove", "value" => "groove"),
518
+ array("label" => "Inset", "value" => "inset"),
519
+ array("label" => "Outset", "value" => "outset"),
520
+ );
521
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_solid'));
522
+ add_settings_field(
523
+ $field_id,
524
+ $field_label,
525
+ array($object, 'create_a_select_input'), //callback function for select input
526
+ $object->plugin_slug.'-setting-admin_layoutaidbb',
527
+ $object->plugin_slug.'_setting_section',
528
+ array( // The array of arguments to pass to the callback.
529
+ "id" => $field_id, //sends select field id to callback
530
+ "default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
531
+ "meta" => 'style="max-width:450px;"',
532
+ "select_options" => $object->unit_options //sets select option data
533
+ )
534
+ );
535
+
536
+ //add color picker text input field
537
+ $field_slug = "default_border_bottom_color";
538
+ $field_label = __('Color', 'spacer-layout-aid');
539
+ $field_id = $object->plugin_slug.'_'.$field_slug;
540
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
541
+ add_settings_field(
542
+ $field_id,
543
+ $field_label,
544
+ array($object, 'create_a_text_input'), //callback function for text input
545
+ $object->plugin_slug.'-setting-admin_layoutaidbb',
546
+ $object->plugin_slug.'_setting_section',
547
+ array( // The array of arguments to pass to the callback.
548
+ "id" => $field_id, //sends field id to callback
549
+ //"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
550
+ "default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
551
+ "class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
552
+ )
553
+ );
554
+
555
+ //add text input field
556
+ $field_slug = "default_bottom_margin";
557
+ $field_label = __('Bottom Margin (px)', 'spacer-layout-aid');
558
+ $field_id = $object->plugin_slug.'_'.$field_slug;
559
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
560
+ add_settings_field(
561
+ $field_id,
562
+ $field_label,
563
+ array($object, 'create_a_text_input'), //callback function for text input
564
+ $object->plugin_slug.'-setting-admin_layoutaidother',
565
+ $object->plugin_slug.'_setting_section',
566
+ array( // The array of arguments to pass to the callback.
567
+ "id" => $field_id, //sends field id to callback
568
+ //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
569
+ "placeholder" => __('eg: 5', 'spacer-layout-aid'),
570
+ "default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
571
+ )
572
+ );
573
+
574
+ //add a select input field
575
+ $field_slug = "default_shadow";
576
+ $field_label = __('Shadow', 'spacer-layout-aid');
577
+ $field_id = $object->plugin_slug.'_'.$field_slug;
578
+ $object->unit_options = array(
579
+ array("label" => "None", "value" => "none"),
580
+ array("label" => "Light", "value" => "light"),
581
+ array("label" => "Medium", "value" => "medium"),
582
+ array("label" => "Heavy", "value" => "heavy")
583
+ );
584
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_none'));
585
+ add_settings_field(
586
+ $field_id,
587
+ $field_label,
588
+ array($object, 'create_a_select_input'), //callback function for select input
589
+ $object->plugin_slug.'-setting-admin_layoutaidother',
590
+ $object->plugin_slug.'_setting_section',
591
+ array( // The array of arguments to pass to the callback.
592
+ "id" => $field_id, //sends select field id to callback
593
+ "default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
594
+ "meta" => 'style="max-width:450px;"',
595
+ "select_options" => $object->unit_options //sets select option data
596
+ )
597
+ );
598
+
599
+
600
+
601
+ //BEGIN ADD SPACER LAYOUT FIELDS
602
+
603
+ $key_array = $object->key_array;
604
+ foreach($key_array as $key=>$value){
605
+ add_settings_section(
606
+ $object->plugin_slug.'_setting_section',
607
+ __('', 'spacer-layout-aid'),
608
+ false,
609
+ $object->plugin_slug.'-setting-admin_layoutaidbg_addspacer'.$key
610
+ );
611
+
612
+ add_settings_section(
613
+ $object->plugin_slug.'_setting_section',
614
+ __('', 'spacer-layout-aid'),
615
+ false,
616
+ $object->plugin_slug.'-setting-admin_layoutaidtb_addspacer'.$key
617
+ );
618
+
619
+ add_settings_section(
620
+ $object->plugin_slug.'_setting_section',
621
+ __('', 'spacer-layout-aid'),
622
+ false,
623
+ $object->plugin_slug.'-setting-admin_layoutaidbb_addspacer'.$key
624
+ );
625
+
626
+ add_settings_section(
627
+ $object->plugin_slug.'_setting_section',
628
+ __('', 'spacer-layout-aid'),
629
+ false,
630
+ $object->plugin_slug.'-setting-admin_layoutaidother_addspacer'.$key
631
+ );
632
+
633
+ //add color picker text input field
634
+ $field_slug = "default_bg_color_addspacers";
635
+ $field_label = __('Color', 'spacer-layout-aid');
636
+ $field_id = $object->plugin_slug.'_'.$field_slug;
637
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
638
+ add_settings_field(
639
+ $field_id,
640
+ $field_label,
641
+ array($object, 'create_a_text_input_array'), //callback function for text input
642
+ $object->plugin_slug.'-setting-admin_layoutaidbg_addspacer'.$key,
643
+ $object->plugin_slug.'_setting_section',
644
+ array( // The array of arguments to pass to the callback.
645
+ "id" => $field_id, //sends field id to callback
646
+ //"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
647
+ "default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
648
+ "key" => $key,
649
+ "class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
650
+ )
651
+ );
652
+
653
+ //add image upload field
654
+ $field_slug = "default_background_image_upload_addspacers";
655
+ $field_label = "Image";
656
+ $field_id = $object->plugin_slug.'_'.$field_slug;
657
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
658
+ add_settings_field(
659
+ $field_id, // ID of the option
660
+ $field_label, // Title of the option
661
+ array($object, 'create_image_upload_array'), // Callback used to render the input field
662
+ $object->plugin_slug.'-setting-admin_layoutaidbg_addspacer'.$key, // Page to associate this option with
663
+ $object->plugin_slug.'_setting_section', // Section to associate this option with
664
+ array( // The array of arguments to pass to the callback.
665
+ "id" => $field_id, //sends field id to callback
666
+ "key" => $key
667
+ )
668
+ );
669
+
670
+ //add an image select input field
671
+ $field_slug = "custom_background_image_position_addspacers";
672
+ $field_label = "Image Position";
673
+ $field_id = $object->plugin_slug.'_'.$field_slug;
674
+ $object->back_options = array(
675
+ array("label" => "Repeat", "value" => "repeat"),
676
+ array("label" => "Proportional Stretch", "value" => "propstretch"),
677
+ array("label" => "Proportional Repeat", "value" => "proprepeat"),
678
+ array("label" => "Crop to Fit", "value" => "croptofit"),
679
+ array("label" => "Stretch", "value" => "stretch")
680
+ );
681
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_repeat'));
682
+ add_settings_field(
683
+ $field_id,
684
+ $field_label,
685
+ array($object, 'create_a_select_input_array'), //callback function for select input
686
+ $object->plugin_slug.'-setting-admin_layoutaidbg_addspacer'.$key,
687
+ $object->plugin_slug.'_setting_section',
688
+ array( // The array of arguments to pass to the callback.
689
+ "id" => $field_id, //sends select field id to callback
690
+ "default" => 'repeat', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
691
+ "key" => $key,
692
+ "select_options" => $object->back_options //sets select option data
693
+ )
694
+ );
695
+
696
+ //add text input field
697
+ $field_slug = "default_border_top_width_addspacers";
698
+ $field_label = __('Width (px)', 'spacer-layout-aid');
699
+ $field_id = $object->plugin_slug.'_'.$field_slug;
700
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
701
+ add_settings_field(
702
+ $field_id,
703
+ $field_label,
704
+ array($object, 'create_a_text_input_array'), //callback function for text input
705
+ $object->plugin_slug.'-setting-admin_layoutaidtb_addspacer'.$key,
706
+ $object->plugin_slug.'_setting_section',
707
+ array( // The array of arguments to pass to the callback.
708
+ "id" => $field_id, //sends field id to callback
709
+ //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
710
+ "placeholder" => __('eg: 5', 'spacer-layout-aid'),
711
+ "key" => $key,
712
+ "default" => '0' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
713
+ )
714
+ );
715
+
716
+ //add a select input field
717
+ $field_slug = "default_border_top_style_addspacers";
718
+ $field_label = __('Style', 'spacer-layout-aid');
719
+ $field_id = $object->plugin_slug.'_'.$field_slug;
720
+ $object->unit_options = array(
721
+ array("label" => "Solid", "value" => "solid"),
722
+ array("label" => "Dotted", "value" => "dotted"),
723
+ array("label" => "Dashed", "value" => "dashed"),
724
+ array("label" => "Double", "value" => "double"),
725
+ array("label" => "Groove", "value" => "groove"),
726
+ array("label" => "Inset", "value" => "inset"),
727
+ array("label" => "Outset", "value" => "outset"),
728
+ );
729
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_solid'));
730
+ add_settings_field(
731
+ $field_id,
732
+ $field_label,
733
+ array($object, 'create_a_select_input_array'), //callback function for select input
734
+ $object->plugin_slug.'-setting-admin_layoutaidtb_addspacer'.$key,
735
+ $object->plugin_slug.'_setting_section',
736
+ array( // The array of arguments to pass to the callback.
737
+ "id" => $field_id, //sends select field id to callback
738
+ "default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
739
+ "meta" => 'style="max-width:450px;"',
740
+ "key" => $key,
741
+ "select_options" => $object->unit_options //sets select option data
742
+ )
743
+ );
744
+
745
+ //add color picker text input field
746
+ $field_slug = "default_border_top_color_addspacers";
747
+ $field_label = __('Color', 'spacer-layout-aid');
748
+ $field_id = $object->plugin_slug.'_'.$field_slug;
749
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
750
+ add_settings_field(
751
+ $field_id,
752
+ $field_label,
753
+ array($object, 'create_a_text_input_array'), //callback function for text input
754
+ $object->plugin_slug.'-setting-admin_layoutaidtb_addspacer'.$key,
755
+ $object->plugin_slug.'_setting_section',
756
+ array( // The array of arguments to pass to the callback.
757
+ "id" => $field_id, //sends field id to callback
758
+ //"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
759
+ "default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
760
+ "key" => $key,
761
+ "class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
762
+ )
763
+ );
764
+
765
+ //add text input field
766
+ $field_slug = "default_border_bottom_width_addspacers";
767
+ $field_label = __('Width (px)', 'spacer-layout-aid');
768
+ $field_id = $object->plugin_slug.'_'.$field_slug;
769
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
770
+ add_settings_field(
771
+ $field_id,
772
+ $field_label,
773
+ array($object, 'create_a_text_input_array'), //callback function for text input
774
+ $object->plugin_slug.'-setting-admin_layoutaidbb_addspacer'.$key,
775
+ $object->plugin_slug.'_setting_section',
776
+ array( // The array of arguments to pass to the callback.
777
+ "id" => $field_id, //sends field id to callback
778
+ //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
779
+ "placeholder" => __('eg: 5', 'spacer-layout-aid'),
780
+ "key" => $key,
781
+ "default" => '0' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
782
+ )
783
+ );
784
+
785
+ //add a select input field
786
+ $field_slug = "default_border_bottom_style_addspacers";
787
+ $field_label = __('Style', 'spacer-layout-aid');
788
+ $field_id = $object->plugin_slug.'_'.$field_slug;
789
+ $object->unit_options = array(
790
+ array("label" => "Solid", "value" => "solid"),
791
+ array("label" => "Dotted", "value" => "dotted"),
792
+ array("label" => "Dashed", "value" => "dashed"),
793
+ array("label" => "Double", "value" => "double"),
794
+ array("label" => "Groove", "value" => "groove"),
795
+ array("label" => "Inset", "value" => "inset"),
796
+ array("label" => "Outset", "value" => "outset"),
797
+ );
798
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_solid'));
799
+ add_settings_field(
800
+ $field_id,
801
+ $field_label,
802
+ array($object, 'create_a_select_input_array'), //callback function for select input
803
+ $object->plugin_slug.'-setting-admin_layoutaidbb_addspacer'.$key,
804
+ $object->plugin_slug.'_setting_section',
805
+ array( // The array of arguments to pass to the callback.
806
+ "id" => $field_id, //sends select field id to callback
807
+ "default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
808
+ "meta" => 'style="max-width:450px;"',
809
+ "key" => $key,
810
+ "select_options" => $object->unit_options //sets select option data
811
+ )
812
+ );
813
+
814
+ //add color picker text input field
815
+ $field_slug = "default_border_bottom_color_addspacers";
816
+ $field_label = __('Color', 'spacer-layout-aid');
817
+ $field_id = $object->plugin_slug.'_'.$field_slug;
818
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
819
+ add_settings_field(
820
+ $field_id,
821
+ $field_label,
822
+ array($object, 'create_a_text_input_array'), //callback function for text input
823
+ $object->plugin_slug.'-setting-admin_layoutaidbb_addspacer'.$key,
824
+ $object->plugin_slug.'_setting_section',
825
+ array( // The array of arguments to pass to the callback.
826
+ "id" => $field_id, //sends field id to callback
827
+ //"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
828
+ "default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
829
+ "key" => $key,
830
+ "class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
831
+ )
832
+ );
833
+
834
+ //add text input field
835
+ $field_slug = "default_bottom_margin_addspacers";
836
+ $field_label = __('Bottom Margin (px)', 'spacer-layout-aid');
837
+ $field_id = $object->plugin_slug.'_'.$field_slug;
838
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
839
+ add_settings_field(
840
+ $field_id,
841
+ $field_label,
842
+ array($object, 'create_a_text_input_array'), //callback function for text input
843
+ $object->plugin_slug.'-setting-admin_layoutaidother_addspacer'.$key,
844
+ $object->plugin_slug.'_setting_section',
845
+ array( // The array of arguments to pass to the callback.
846
+ "id" => $field_id, //sends field id to callback
847
+ //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
848
+ "placeholder" => __('eg: 5', 'spacer-layout-aid'),
849
+ "key" => $key,
850
+ "default" => '0' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
851
+ )
852
+ );
853
+
854
+ //add a select input field
855
+ $field_slug = "default_shadow_addspacers";
856
+ $field_label = __('Shadow', 'spacer-layout-aid');
857
+ $field_id = $object->plugin_slug.'_'.$field_slug;
858
+ $object->unit_options = array(
859
+ array("label" => "None", "value" => "none"),
860
+ array("label" => "Light", "value" => "light"),
861
+ array("label" => "Medium", "value" => "medium"),
862
+ array("label" => "Heavy", "value" => "heavy")
863
+ );
864
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_none'));
865
+ add_settings_field(
866
+ $field_id,
867
+ $field_label,
868
+ array($object, 'create_a_select_input_array'), //callback function for select input
869
+ $object->plugin_slug.'-setting-admin_layoutaidother_addspacer'.$key,
870
+ $object->plugin_slug.'_setting_section',
871
+ array( // The array of arguments to pass to the callback.
872
+ "id" => $field_id, //sends select field id to callback
873
+ "default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
874
+ "meta" => 'style="max-width:450px;"',
875
+ "key" => $key,
876
+ "select_options" => $object->unit_options //sets select option data
877
+ )
878
+ );
879
+
880
+ }
881
+
882
+ }
883
+
884
+
885
+
886
+
887
+ //add plugin action links logic
888
+ function add_plugin_action_links( $links ) {
889
+
890
+ return array_merge(
891
+ array(
892
+ 'settings' => '<a href="' . get_bloginfo( 'wpurl' ) . '/wp-admin/options-general.php?page='.$this->sva_plugin_slug.'-setting-admin">Settings</a>'
893
+ ),
894
+ $links
895
+ );
896
+
897
+ }
898
+
899
+ public function plugin_row_links($links, $file) {
900
+ $plugin = plugin_basename(__FILE__);
901
+ if ($file == $plugin) // only for this plugin
902
+ return array_merge( $links,
903
+ array( '<a target="_blank" href="http://www.linkedin.com/in/ClevelandWebDeveloper/">' . __('Find me on LinkedIn' ) . '</a>' ),
904
+ array( '<a target="_blank" href="http://twitter.com/ClevelandWebDev">' . __('Follow me on Twitter') . '</a>' )
905
+ );
906
+ return $links;
907
+ }
908
+
909
+ } //end of plugin class
910
+
911
+ $custom_plugin = new $sva_plugin_slug();